Reputation: 3444
How can I play and pause a wave file in C++ and get the length and duration in which its been played in milliseconds. It should preferably be cross-platform but not Qt as QSound is to simple and phonon require DirectX and doesn't work with mingw. Thanks
Upvotes: 1
Views: 330
Reputation: 25647
I'd use a low-level library like libAO. You control how much gets played, and so to "pause," you would simply stop calling ao_play()
and count the number of samples you've sent.
Simple audio playback is not really such a complex task that it requires complex APIs.
Upvotes: 3
Reputation: 769
Well there is always jack. Its pretty easy to use and has good documentation, plus its intended as a low latency cross platform I/O with integrated tools to handle network sound processing. Rather nice piece of software for what it sounds like you are trying to do.
Upvotes: 0
Reputation: 32919
Have a look at http://www.portaudio.com/. Also, SFML has an audio module: http://www.sfml-dev.org/index.php. Also, commercial (but free to use, depending on the project) alternatives like http://www.fmod.org/ and BASS (Win, Mac) exist.
Upvotes: 1