René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

playsound

// compiling with mingw: gcc -mwindows playsound.c -lwinmm -o playsound.exe
//                       strip playsound.exe

#include <windows.h>
#include <stdio.h>

int main(int argc, char* argv[]) {
  if (argc == 1) {
    printf ("%s <soundfile>\n", argv[0]);
    exit(0);
  }

  if (!PlaySound(argv[1], 0, SND_FILENAME)) {
    printf ("error playing file\n");
  }
  return 0;
}
Caveat: The sound specified by pszSound must fit into available physical memory. In order to play files that dont fit into memory, waveOutOpen and related functions must be used. Buffers are filled from the file and passed to waveOutWrite. After each buffer has been played, the function returns and another buffer is filled from the file (and passed to waveOutWrite).
Dave Navarro has wav.zip on www.cmdtools.com. wav.zip contains, of course, wav.exe which plays a wave and any other by Windows supported sound files. [Note, these links were broken on November 18th, 2005.]