How to sync PlaySound ?

Blitz3D Forums/Blitz3D Programming/How to sync PlaySound ?

semar(Posted 2009) [#1]
All,
I've two sample codes, one uses a timer, the other code uses the Millisecs() function.

The goal of both codes is the same: play a drum sound - for example an high hat - at a given tempo - for example each 200 millisecs.

Using DebugLog or paying attention visually, I can 'see' that both codes works well - they trigger the PlaySound command at the right moment - but the sound produced is not always in sync with the given tempo.

I can hear "glitches", I mean, at the very moment the sound should played, it is played slightly later.

This is not acceptable for a mini sequencer I'm coding. So, I wonder if any of you have already had a similar problem, and if so, would you mind to share your solution ?

A question more: do you know if using the Microsoft MCI Api, could solve this sync problem ?

Thanks in advance,
Sergio.


John Blackledge(Posted 2009) [#2]
No no no - the MS MCI system is even more 'queued' than what you have already doing.
Unfortunately you're probably going to have to code this using more modern MS API's which are dedicated to this purpose.
But do search the toolbox - I'm sure I remember a lib in there.


Adam Novagen(Posted 2009) [#3]
I think your problem here is that, unless I'm mistaken, Blitz's capabilities of triggering sounds are confined to the framerate window, so minimum gap being 1/60th of a second.


Guy Fawkes(Posted 2009) [#4]
or u could try Imphenzia :)