Author Topic: Wasapi if Samplerate changes  (Read 357 times)

udo

  • Posts: 93
Wasapi if Samplerate changes
« on: 7 Feb '24 - 11:52 »
What do I have to do in SYNCPROC/BASS_SYNC_END so that Wasapi outputs the correct sample rate if the new file has a different one?
Reset something?

The Wasapi example uses the mixer. Is this always necessary? We only use playback.

Why is WasapiOutputProc still called although Wasapi called Endsync?
How can I remove Outproc which is passed in BASS_WASAPI_Init?
« Last Edit: 7 Feb '24 - 12:08 by udo »

Ian @ un4seen

  • Administrator
  • Posts: 26218
Re: Wasapi if Samplerate changes
« Reply #1 on: 7 Feb '24 - 14:23 »
What do I have to do in SYNCPROC/BASS_SYNC_END so that Wasapi outputs the correct sample rate if the new file has a different one?
Reset something?

If you're using BASSWASPI, you'll need to call BASS_WASAPI_Init again (after BASS_WASAPI_Free) with the new sample rate. Note it's only possible to change a device's rate in exclusive mode (BASS_WASAPI_EXCLUSIVE).

The Wasapi example uses the mixer. Is this always necessary? We only use playback.

No, if you're only playing one file at a time then you probably don't need a mixer. The BASSWASAPI examples mainly use a mixer for resampling purposes because WASAPI didn't originally include resampling support, but it is supported these days (with BASSWASAPI 2.4.4).

Why is WasapiOutputProc still called although Wasapi called Endsync?
How can I remove Outproc which is passed in BASS_WASAPI_Init?

BASSWASAPI doesn't have any knowledge of syncs. They're handled by BASS. You can call BASS_WASAPI_Stop and/or BASS_WASAPI_Free to stop BASSWASAPI at the end.

udo

  • Posts: 93
Re: Wasapi if Samplerate changes
« Reply #2 on: 8 Feb '24 - 14:24 »
Quote
BASSWASAPI doesn't have any knowledge of syncs. They're handled by BASS...
But its set in BassWasapi.BASS_WASAPI_Init as the penultimate parameter

Where can i set Volume?
Bass.BASS_ChannelSetAttribute(stream, BASSAttribute.BASS_ATTRIB_VOL, volume)
dont work without mixer.
The function is succesful and with Bass.BASS_ChannelGetAttribute(stream, BASSAttribute.BASS_ATTRIB_VOL, ref value) value is correct.
But no change can be heard.
The volume only changes with BassWasapi.BASS_WASAPI_SetVolume. What am I doing wrong?

Playback without mixer is not ok with mp3(22050 Hz). It is played back too fast. What do I have to change? Wasapi is initialized with
BASSWASAPIInit.BASS_WASAPI_EXCLUSIVE | BASSWASAPIInit.BASS_WASAPI_AUTOFORMAT | BASSWASAPIInit.BASS_WASAPI_BUFFER.
The DAC shows 44.1 kHz
« Last Edit: 9 Feb '24 - 11:19 by udo »