annotate src/ntplay.c @ 266:18d185df8c54

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