Lightweight WAV parser and Win32 sound player using waveOut* in C
CMIT
Simple WAV File Parser and Player in C
c-wav-player is a lightweight WAV file parser and Win32 sound player written in C. It reads standard RIFF/WAV headers, skips non-audio metadata chunks (such as smpl, LIST, etc.), and extracts raw PCM audio data for playback via the Windows waveOut API.
#include"win32/soundplayer.h"#include"playsound_ui_demo.h"intmain(intargc, charconst*argv[])
{
sound*snd=sound_init("resources/sound/bass-wiggle.wav");
play_sound(&snd);
// Keep the main thread alive while the sound is playing.// This uses a simple UI demo that internally checks is_playing(snd).// Alternatively, a sleep loop or similar wait could be used instead.playsound_ui_demo(&snd);
sound_unload(&snd);
return0;
}
Example Output
WAV parser (header data display)
Success Output
Error Output
Win32 Soundplayer(using the wav parser)
Player Demo : Playing
Player Demo : End
License
This project is open source and free to use under the MIT License.