Author Topic: A few questions (.net related)  (Read 484 times)

_chris

  • Posts: 3
A few questions (.net related)
« on: 17 Nov '14 - 15:06 »
Hi,

I am using mixer to playback 24 files in sync and am getting stuck on a couple of things:

1. I want to get a callback method to trigger when a file has finished playing. I've tried adding the flag BassFlag.BASS_MIXER_END and adding a SYNCPROC but nothing seems to happen, I think I'm a little confused.

2. What is the best way to scrub through the 24 files?

3. Is there a callback method that contains the current playback position of the file(s)?

Thanks

Ian @ un4seen

  • Administrator
  • Posts: 20400
Re: A few questions (.net related)
« Reply #1 on: 17 Nov '14 - 16:44 »
1. I want to get a callback method to trigger when a file has finished playing. I've tried adding the flag BassFlag.BASS_MIXER_END and adding a SYNCPROC but nothing seems to happen, I think I'm a little confused.

I think a BASS_SYNC_END sync is what you want. If you want to detect when the mixer reaches the end, then it should be set on the mixer via BASS_ChannelSetSync. If you want to detect when a particular source reaches the end, then it should be set on the source via BASS_Mixer_ChannelSetSync instead.

2. What is the best way to scrub through the 24 files?

Do you mean mix them as fast as possible, not real-time speed? If so, you can make the mixer itself a decoding channel by setting the BASS_STREAM_DECODE flag on it and then repeatedly call BASS_ChannelGetData to process it, something like this....

Code: [Select]
mixer = BASS_Mixer_StreamCreate(freq, chans, BASS_MIXER_END|BASS_SAMPLE_FLOAT|BASS_STREAM_DECODE); // create a mixer
// add the sources to the mix here

// processing loop
while (BASS_ChannelIsActive(mixer)) { // mixer is still going
BYTE buf[20000]; // processing buffer
BASS_ChannelGetData(mixer, buf, sizeof(buf)); // process the mix
}

Note that there is no need to use a BASS_SYNC_END sync to find out when the mixer ends in this case, as it will be at the end when it exits the "while" loop.

3. Is there a callback method that contains the current playback position of the file(s)?

You can use a BASS_SYNC_POS sync to be informed of when playback reaches a particular position. More generally, you can get the current position from BASS_ChannelGetPosition or BASS_Mixer_ChannelGetPosition.

Please see the documentation for details on all of the mentioned functions.