author | peter1138 |
Mon, 23 Oct 2006 18:45:43 +0000 | |
changeset 4930 | 708801d486c6 |
parent 2548 | 49c8a096033f |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
2189
5cdc11ffeaa4
(svn r2704) Remove . from include path again, too much trouble. Also add some #ifdefs and #includes for the Windows build
tron
parents:
2186
diff
changeset
|
3 |
#include "../stdafx.h" |
5cdc11ffeaa4
(svn r2704) Remove . from include path again, too much trouble. Also add some #ifdefs and #includes for the Windows build
tron
parents:
2186
diff
changeset
|
4 |
#include "../openttd.h" |
5cdc11ffeaa4
(svn r2704) Remove . from include path again, too much trouble. Also add some #ifdefs and #includes for the Windows build
tron
parents:
2186
diff
changeset
|
5 |
#include "os2_m.h" |
2175
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
6 |
|
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
7 |
#define INCL_DOS |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
8 |
#define INCL_OS2MM |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
9 |
#define INCL_WIN |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
10 |
|
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
11 |
#include <stdarg.h> |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
12 |
#include <os2.h> |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
13 |
#include <os2me.h> |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
14 |
|
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
15 |
/********************** |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
16 |
* OS/2 MIDI PLAYER |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
17 |
**********************/ |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
18 |
|
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
19 |
/* Interesting how similar the MCI API in OS/2 is to the Win32 MCI API, |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
20 |
* eh? Anyone would think they both came from the same place originally! ;) |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
21 |
*/ |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
22 |
|
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
23 |
static long CDECL MidiSendCommand(const char *cmd, ...) |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
24 |
{ |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
25 |
va_list va; |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
26 |
char buf[512]; |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
27 |
va_start(va, cmd); |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
28 |
vsprintf(buf, cmd, va); |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
29 |
va_end(va); |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
30 |
return mciSendString(buf, NULL, 0, NULL, 0); |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
31 |
} |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
32 |
|
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
33 |
static void OS2MidiPlaySong(const char *filename) |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
34 |
{ |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
35 |
MidiSendCommand("close all"); |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
36 |
|
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
37 |
if (MidiSendCommand("open %s type sequencer alias song", filename) != 0) |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
38 |
return; |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
39 |
|
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
40 |
MidiSendCommand("play song from 0"); |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
41 |
} |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
42 |
|
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
43 |
static void OS2MidiStopSong(void) |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
44 |
{ |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
45 |
MidiSendCommand("close all"); |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
46 |
} |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
47 |
|
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
48 |
static void OS2MidiSetVolume(byte vol) |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
49 |
{ |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
50 |
MidiSendCommand("set song audio volume %d", ((vol/127)*100)); |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
51 |
} |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
52 |
|
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
53 |
static bool OS2MidiIsSongPlaying(void) |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
54 |
{ |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
55 |
char buf[16]; |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
56 |
mciSendString("status song mode", buf, sizeof(buf), NULL, 0); |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
57 |
return strcmp(buf, "playing") == 0 || strcmp(buf, "seeking") == 0; |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
58 |
} |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
59 |
|
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
60 |
static const char *OS2MidiStart(const char * const *parm) |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
61 |
{ |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
62 |
return 0; |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
63 |
} |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
64 |
|
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
65 |
static void OS2MidiStop(void) |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
66 |
{ |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
67 |
MidiSendCommand("close all"); |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
68 |
} |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
69 |
|
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
70 |
const HalMusicDriver _os2_music_driver = { |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
71 |
OS2MidiStart, |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
72 |
OS2MidiStop, |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
73 |
OS2MidiPlaySong, |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
74 |
OS2MidiStopSong, |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
75 |
OS2MidiIsSongPlaying, |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
76 |
OS2MidiSetVolume, |
06415cf75dc1
(svn r2689) - Split OS/2 music driver into os2_m.c, update project file
orudge
parents:
diff
changeset
|
77 |
}; |