Anyway (with a hack?) to play a sample at a different samplerate?

Previous topic - Next topic

PJBonoVox

Hi all,

I'm working on a racing game (old style), and want to use a single sample for the engine sound and just play it at different samplerates depending on the speed of the engine. Is there anyway I could do this?

I realise GLBasic doesn't have this functionality built in but I wonder if anyone could assist me with some kind of inline C++ hack or something to make it happen? Just to clarify, I'm not looking for a 'pitch-up' that keeps the length the same, I just need to play it at a different rate.

Any help much appreciated, this is pretty critical to my project :)

Thanks!

Wampus

If you want it to work on many different platforms you're probably going to be disappointed. GLBasic uses SDL Mixer. As far as I know there isn't some hack to change playback rate of samples. You may have to look for external libraries. The trouble there is that, generally speaking, compatibility is inversely proportionate to utility. Most require paid licenses to use for commercial apps too. e.g. If you're intending to release your racing game on just the PC and for free then you have lots of options. If you're intending your racing game to work on everything and cost money you might have to rethink your handling of sound.


PJBonoVox

Good point, well made. I think I'm going to have to just create a shedload of samples, one for each engine note :(