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>
|
278
|
24 #include <stdio.h>
|
265
|
25
|
|
26 #ifdef __CYGWIN32__
|
|
27 extern BOOL WINAPI PlaySound(LPCSTR,HMODULE,DWORD);
|
|
28 #endif
|
|
29
|
|
30 void play_sound_file (char *sound_file, int volume);
|
|
31 void play_sound_file (char *sound_file, int volume)
|
|
32 {
|
|
33 DWORD flags = SND_ASYNC | SND_NODEFAULT | SND_FILENAME;
|
|
34 char* dst=0;
|
|
35 #ifdef __CYGWIN32__
|
|
36 CYGWIN_WIN32_PATH(sound_file, dst);
|
|
37 sound_file=dst;
|
|
38 #endif
|
|
39 if (PlaySound(sound_file, NULL, flags)==FALSE)
|
|
40 {
|
|
41 perror(sound_file);
|
|
42 }
|
|
43 return;
|
|
44 }
|
|
45
|
|
46 /* Call "linux_play_data_or_file" with the appropriate parameters for
|
|
47 playing pre-loaded data */
|
|
48 void play_sound_data (unsigned char *data, int length, int volume);
|
|
49 void play_sound_data (unsigned char *data, int length, int volume)
|
|
50 {
|
|
51 DWORD flags = SND_ASYNC | SND_MEMORY | SND_NODEFAULT;
|
|
52 if (PlaySound(data, NULL, flags)==FALSE)
|
|
53 {
|
|
54 perror("couldn't play sound file");
|
|
55 }
|
|
56 return;
|
|
57 }
|