Author Topic: how to get ASIO input data in dsp callback  (Read 525 times)

songziyun

  • Posts: 32
Hi,Ian
Im trying to get data from ASIO input
here is my code:



g_hw_input_bass_chan[0] = BASS_StreamCreate(48000, 1, BASS_SAMPLE_FLOAT | BASS_STREAM_DECODE, STREAMPROC_PUSH,0);
    if(g_hw_input_bass_chan[0]==0){
        IDebug << "BASS_StreamCreate failed" << BASS_ErrorGetCode();
        return;
    }
    if (!BASS_ASIO_ChannelEnableBASS(TRUE, 0, g_hw_input_bass_chan[0], TRUE)) {   // i tried 0/1 channels,join or not join, not work
        IDebug <<"Can't enable ASIO channels" << BASS_ErrorGetCode() << BASS_ASIO_ErrorGetCode();
    }
    if(!BASS_ChannelSetDSP(g_hw_input_bass_chan[0], &MIC_DSP, 0, 1)){
        ERRTRACE
                IDebug << "BASS_ChannelSetDSP" << BASS_ErrorGetCode();
    }
No error happened
but MIC_DSP never called

Best regards
Ziyun
« Last Edit: 3 Apr '24 - 06:44 by songziyun »

Ian @ un4seen

  • Administrator
  • Posts: 26177
Re: how to get ASIO input data in dsp callback
« Reply #1 on: 3 Apr '24 - 15:46 »
The "push" stream will buffer the data received from the ASIO channel, and the data won't be processed (eg. DSP applied) until you call BASS_ChannelGetData to take it from the buffer. If you want your DSP function to be called immediately without buffering then you should create a "dummy" stream (proc=STREAMPROC_DUMMY) instead.

songziyun

  • Posts: 32
Re: how to get ASIO input data in dsp callback
« Reply #2 on: 4 Apr '24 - 14:53 »
Hi Ian
No lucky,after change the chan to dummy
g_hw_input_bass_chan[0] = BASS_StreamCreate(48000, 1, BASS_SAMPLE_FLOAT | BASS_STREAM_DECODE, STREAMPROC_DUMMY,0);
    if(g_hw_input_bass_chan[0]==0){
        IDebug << "BASS_StreamCreate failed" << BASS_ErrorGetCode();
        return;
    }
    if (!BASS_ASIO_ChannelEnableBASS(TRUE, 0, g_hw_input_bass_chan[0], TRUE)) {
        IDebug <<"Can't enable ASIO channels" << BASS_ErrorGetCode() << BASS_ASIO_ErrorGetCode();
    }
    if(!BASS_ChannelSetDSP(g_hw_input_bass_chan[0], &MIC_DSP, 0, 1)){
        ERRTRACE
                IDebug << "BASS_ChannelSetDSP" << BASS_ErrorGetCode();
    }


the app crashed at BASS_ASIO_ChannelEnableMirror(call stack): write access violation at : 0x0,flags=0x0.

Ian @ un4seen

  • Administrator
  • Posts: 26177
Re: how to get ASIO input data in dsp callback
« Reply #3 on: 4 Apr '24 - 16:43 »
BASS_ASIO_ChannelEnableMirror is a strange place for a crash. Did you mean BASS_ASIO_ChannelEnableBASS? In any case, please first try with this latest BASSASIO build:

   www.un4seen.com/stuff/bassasio.zip

And if the crash still happens, then provide a dump file from it for more info. If you're using Visual Studio, you can use its "Save Dump As" option in the "Debug" menu to create the dump file, and then ZIP and upload it here:

   ftp.un4seen.com/incoming/

songziyun

  • Posts: 32
Re: how to get ASIO input data in dsp callback
« Reply #4 on: 8 Apr '24 - 02:39 »
Thank you Ian for the reply
Finally,I use BASS_ASIO_ChannelEnable intead
It works very well

Best regards
Ziyun