Author Topic: Finding current sample or current time played of channel.  (Read 177 times)

KevC

  • Posts: 22
Hi,

I am looking to find the timing of the channel currently playing with the following code:

Code: [Select]
Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_16BITS, IntPtr.Zero);

int _BASSStream = Bass.BASS_StreamCreatePush(44100, 1, BASSFlag.BASS_SAMPLE_FLOAT, IntPtr.Zero);

Bass.BASS_StreamPutData(_BASSStream, buffer, buffer.Length * 4);

Bass.BASS_ChannelPlay(_BASSStream, false);

Ideally, is there a function call to do this?  I am trying to match onscreen visuals with particular timing events in the sound stream currently playing(i.e. beat Num) by using a timer to update the screen every 50ms(I need finer grain information which a function such as that could provide).

Thank you.

KevC

  • Posts: 22
Hi,

Just figured out an accurate way of getting timer synchronization with DateTime.Now.Ticks in Windows forms, false alarm, thanks!

Ian @ un4seen

  • Administrator
  • Posts: 26028
In case it'd still be useful, you can get the stream's currently heard position from BASS_ChannelGetPosition (and use BASS_ChannelBytes2Seconds to convert to seconds if wanted).

KevC

  • Posts: 22
Oh thank you!  It may come in useful.