Author Topic: "ASIO input" not connected to any output, causing a very BIG buffer?  (Read 656 times)

esponi

  • Posts: 80
We start monitoring ASIO input Channels (all at the same time) and then the user plugs them to desired ASIO outputs.

(...)
BASS_ASIO_ChannelEnable > BASS_ASIO_ChannelJoin > BASS_ASIO_ChannelSetFormat > BASS_ASIO_ChannelSetRate
Each ASIO Channel injecting audio into their own "inputStream" (STREAMPROC_PUSH, BASS_STREAM_DECODE, BASS_SAMPLE_FLOAT)
(...)

We have noticed that after some time BASS_ASIO_GetCPU() gets higher values and ASIO driver fails.

1.- Is this produced by the amount of data that is not delivered to any output, causing the buffers to become big and big?
2.- If so, how can we discard that audio info until user "connects" inputs with desired outputs?

Thanks!
« Last Edit: 22 Apr '15 - 17:32 by esponi »

Ian @ un4seen

  • Administrator
  • Posts: 20437
Yes, there will be a build-up of data in the "inputStream" push stream if BASS_ChannelPutData is called to add data more quickly than BASS_ChannelGetData is being called to remove it. If the push stream is providing more data than you need, then you could use BASS_ChannelSetPosition with pos=0 to clear out the excess data, eg. after calling BASS_ChannelGetDat to get the amount of data that you want.

esponi

  • Posts: 80
But in case we do not need any data, until users decides where to deliver output, can we plug that inputs into a dummy output to discard that audio?

Ian @ un4seen

  • Administrator
  • Posts: 20437
If you don't need any data from the push stream, then I would recommend just skipping the BASS_StreamPutData call. If it will be plugged into a mixer when it is needed, then you could use BASS_Mixer_ChannelGetMixer to check whether that has happened...

Code: [Select]
DWORD CALLBACK InputAsioProc(BOOL input, DWORD channel, void *buffer, DWORD length, void *user)
{
if (BASS_Mixer_ChannelGetMixer(inputStream)) // the push stream is in a mixer
BASS_StreamPutData(inputStream, buffer, length); // pass the data to it
return 0;
}

esponi

  • Posts: 80
it works  ;)