comparison playercode/drv_raw.c @ 8:b30908f9d9f9

Initial entry of mikmod into the CVS tree.
author darius
date Fri, 23 Jan 1998 16:05:10 +0000
parents
children
comparison
equal deleted inserted replaced
7:de95ce2eacfd 8:b30908f9d9f9
1 /*
2
3 Name:
4 DRV_RAW.C
5
6 Description:
7 Mikmod driver for output to a file called MUSIC.RAW
8
9 MS-DOS Programmers:
10 !! DO NOT CALL MD_UPDATE FROM A INTERRUPT IF YOU USE THIS DRIVER !!
11
12 Portability:
13
14 MSDOS: BC(y) Watcom(y) DJGPP(y)
15 Win95: BC(y)
16 Linux: y
17
18 (y) - yes
19 (n) - no (not possible or not useful)
20 (?) - may be possible, but not tested
21
22 */
23
24 #include "mikmod.h"
25
26 #ifdef __GNUC__
27 #include <sys/types.h>
28 #else
29 #include <io.h>
30 #endif
31 #include <sys/stat.h>
32 #include <fcntl.h>
33
34 #define RAWBUFFERSIZE 8192
35
36 static int rawout;
37
38 static SBYTE RAW_DMABUF[RAWBUFFERSIZE];
39
40
41 static BOOL RAW_IsThere(void)
42 {
43 return 1;
44 }
45
46
47 static BOOL RAW_Init(void)
48 {
49 if(-1 == (rawout = open("music.raw",
50 #ifndef __GNUC__
51 O_BINARY |
52 #endif
53 O_RDWR | O_TRUNC | O_CREAT, S_IREAD | S_IWRITE)))
54 return 1;
55
56 md_mode |= DMODE_SOFT_MUSIC | DMODE_SOFT_SNDFX;
57
58 if(VC_Init()) return 1;
59
60 return 0;
61 }
62
63
64 static void RAW_Exit(void)
65 {
66 VC_Exit();
67 close(rawout);
68 }
69
70
71 static void RAW_Update(void)
72 {
73 VC_WriteBytes(RAW_DMABUF, RAWBUFFERSIZE);
74 write(rawout, RAW_DMABUF, RAWBUFFERSIZE);
75 }
76
77
78 static BOOL RAW_Reset(void)
79 {
80 return 0;
81 }
82
83
84 MDRIVER drv_raw =
85 { NULL,
86 "music.raw file",
87 "RAW [music.raw] file output driver v1.0",
88 0,255,
89 RAW_IsThere,
90 VC_SampleLoad,
91 VC_SampleUnload,
92 VC_SampleSpace,
93 VC_SampleLength,
94 RAW_Init,
95 RAW_Exit,
96 RAW_Reset,
97 VC_SetNumVoices,
98 VC_PlayStart,
99 VC_PlayStop,
100 RAW_Update,
101 VC_VoiceSetVolume,
102 VC_VoiceSetFrequency,
103 VC_VoiceSetPanning,
104 VC_VoicePlay,
105 VC_VoiceStop,
106 VC_VoiceStopped,
107 VC_VoiceReleaseSustain,
108 VC_VoiceGetPosition,
109 VC_VoiceRealVolume
110 };
111