265
|
1 /* Sound in windows nt XEmacs.
|
|
2 Copyright (C) 1998 Andy Piper.
|
|
3
|
|
4 This file is part of XEmacs.
|
|
5
|
|
6 XEmacs is free software; you can redistribute it and/or modify it
|
|
7 under the terms of the GNU General Public License as published by the
|
|
8 Free Software Foundation; either version 2, or (at your option) any
|
|
9 later version.
|
|
10
|
|
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 for more details.
|
|
15
|
|
16 You should have received a copy of the GNU General Public License
|
|
17 along with XEmacs; see the file COPYING. If not, write to the Free
|
|
18 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
19 02111-1307, USA.*/
|
|
20
|
|
21 #include <windows.h>
|
|
22 #undef CONST
|
|
23 #include <config.h>
|
|
24
|
|
25 #ifdef __CYGWIN32__
|
|
26 extern BOOL WINAPI PlaySound(LPCSTR,HMODULE,DWORD);
|
|
27 #endif
|
|
28
|
|
29 void play_sound_file (char *sound_file, int volume);
|
|
30 void play_sound_file (char *sound_file, int volume)
|
|
31 {
|
|
32 DWORD flags = SND_ASYNC | SND_NODEFAULT | SND_FILENAME;
|
|
33 char* dst=0;
|
|
34 #ifdef __CYGWIN32__
|
|
35 CYGWIN_WIN32_PATH(sound_file, dst);
|
|
36 sound_file=dst;
|
|
37 #endif
|
|
38 if (PlaySound(sound_file, NULL, flags)==FALSE)
|
|
39 {
|
|
40 perror(sound_file);
|
|
41 }
|
|
42 return;
|
|
43 }
|
|
44
|
|
45 /* Call "linux_play_data_or_file" with the appropriate parameters for
|
|
46 playing pre-loaded data */
|
|
47 void play_sound_data (unsigned char *data, int length, int volume);
|
|
48 void play_sound_data (unsigned char *data, int length, int volume)
|
|
49 {
|
|
50 DWORD flags = SND_ASYNC | SND_MEMORY | SND_NODEFAULT;
|
|
51 if (PlaySound(data, NULL, flags)==FALSE)
|
|
52 {
|
|
53 perror("couldn't play sound file");
|
|
54 }
|
|
55 return;
|
|
56 }
|