Mercurial > hg > xemacs-beta
diff src/ntplay.c @ 292:6cb5e14cd98e r21-0b44
Import from CVS: tag r21-0b44
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:37:15 +0200 |
parents | e11d67e05968 |
children | 4711e16a8e49 |
line wrap: on
line diff
--- a/src/ntplay.c Mon Aug 13 10:36:50 2007 +0200 +++ b/src/ntplay.c Mon Aug 13 10:37:15 2007 +0200 @@ -27,6 +27,8 @@ #ifdef __CYGWIN32__ extern BOOL WINAPI PlaySound(LPCSTR,HMODULE,DWORD); +#else +#include <mmsystem.h> #endif static void play_sound_data_1 (unsigned char *data, int length, int volume, int convert); @@ -64,11 +66,9 @@ xfree (data); return; } + close (ofd); play_sound_data_1 (data, size, 100, FALSE); - - xfree (data); - close (ofd); } else PlaySound (XSTRING_DATA (fname), NULL, flags); @@ -80,7 +80,14 @@ int convert_to_malloc) { DWORD flags = SND_ASYNC | SND_MEMORY | SND_NODEFAULT; - unsigned char* sound_data; + static unsigned char* sound_data=0; + if (sound_data) + { + PlaySound (NULL, NULL, flags); + xfree (sound_data); + sound_data=0; + } + if (convert_to_malloc) { sound_data = xmalloc (length); @@ -90,8 +97,7 @@ sound_data = data; PlaySound(sound_data, NULL, flags); - if (convert_to_malloc) - xfree (sound_data); + return; }