Author Topic: Mixer issues  (Read 885 times)

3delite

  • Posts: 932
Mixer issues
« on: 8 Dec '11 - 16:43 »
Hi!

I am updating my app. to BASS 2.4 (from 2.3) and I decided to rewrite my audio system for a favour of a main mixer stream that can be output to either DirectSound or ASIO.
This would also add the possibility to add WinAmp DSP plugins to the main mixer stream (and visualisation plugins too) and have the output effected nicely.
I create a main mixer stream and when I want to play an audio file I simply plug it into the mixer. This works fine although there's a delay until the audio is heard but this is ok.

The problem I am having is that I display the sample to see it visually and display the current playback position from the position from the plugged stream which is plugged into the mixer.

The first problem is that the position is advancing in much greater increments then when just playing it without the mixer stream. I am using my TGraphDisplay3D component which has a frame rate of 30fps, and this spoils the whole concept of having a very smooth sample display. Is there a way the get greater precision for current playback position? For examample of what I am thinking: would it be possible te set the mixer's GetData() calls amount parameter? Would this give greater precision?

My other problem is that the reported position is ahead of what is actually playing. With the same code just playing directly with ChannelPlay it's exact.

Update period is set at 300ms.

Are there any options to fix these?

Best regards
3delite
« Last Edit: 8 Dec '11 - 16:58 by 3delite »

Ian @ un4seen

  • Administrator
  • Posts: 21388
Re: Mixer issues
« Reply #1 on: 8 Dec '11 - 17:16 »
Are you currently using BASS_ChannelGetPosition to get the position? When playing a BASS channel via a mixer, you can use BASS_Mixer_ChannelGetPosition instead, which will take account of the mixer's playback buffer to give the position that is currently being heard from it. You can do the same with BASS_ChannelGetData/Level, ie. replace them with BASS_Mixer_ChannelGetData/Level (after adding the BASS_MIXER_BUFFER flag to the BASS_Mixer_StreamAddChannel call).

3delite

  • Posts: 932
Re: Mixer issues
« Reply #2 on: 8 Dec '11 - 18:30 »
You are the best! :)

Works perfectly!

Yes, I was using BASS_ChannelGetPosition(), just replaced it with BASS_Mixer_ChannelGetPosition() and both problems disappeared! ;)

Best regards
3delite