1 | ' dmusicc.sbp - This module defines the DirectMusic core API's
|
---|
2 |
|
---|
3 | Const DMUS_MAX_DESCRIPTION = 128
|
---|
4 |
|
---|
5 | Type DMUS_BUFFERDESC
|
---|
6 | dwSize As DWord
|
---|
7 | dwFlags As DWord
|
---|
8 | guidBufferFormat As GUID
|
---|
9 | cbBuffer As DWord
|
---|
10 | End Type
|
---|
11 |
|
---|
12 | ' dwEffectFlags fields of both DMUS_PORTCAPS and DMUS_PORTPARAMS.
|
---|
13 | Const DMUS_EFFECT_NONE = &H00000000
|
---|
14 | Const DMUS_EFFECT_REVERB = &H00000001
|
---|
15 | Const DMUS_EFFECT_CHORUS = &H00000002
|
---|
16 | Const DMUS_EFFECT_DELAY = &H00000004
|
---|
17 |
|
---|
18 | ' For DMUS_PORTCAPS dwClass
|
---|
19 | Const DMUS_PC_INPUTCLASS = 0
|
---|
20 | Const DMUS_PC_OUTPUTCLASS = 1
|
---|
21 |
|
---|
22 | ' For DMUS_PORTCAPS dwFlags
|
---|
23 | Const DMUS_PC_DLS = &H00000001 'Supports DLS downloading and DLS level 1.
|
---|
24 | Const DMUS_PC_EXTERNAL = &H00000002 'External MIDI module.
|
---|
25 | Const DMUS_PC_SOFTWARESYNTH = &H00000004 'Software synthesizer.
|
---|
26 | Const DMUS_PC_MEMORYSIZEFIXED = &H00000008 'Memory size is fixed.
|
---|
27 | Const DMUS_PC_GMINHARDWARE = &H00000010 'GM sound set is built in, no need to download.
|
---|
28 | Const DMUS_PC_GSINHARDWARE = &H00000020 'GS sound set is built in.
|
---|
29 | Const DMUS_PC_XGINHARDWARE = &H00000040 'XG sound set is built in.
|
---|
30 | Const DMUS_PC_DIRECTSOUND = &H00000080 'Connects to DirectSound via a DSound buffer.
|
---|
31 | Const DMUS_PC_SHAREABLE = &H00000100 'Synth can be actively shared by multiple apps at once.
|
---|
32 | Const DMUS_PC_DLS2 = &H00000200 'Supports DLS2 instruments.
|
---|
33 | Const DMUS_PC_AUDIOPATH = &H00000400 'Multiple outputs can be connected to DirectSound for audiopaths.
|
---|
34 | Const DMUS_PC_WAVE = &H00000800 'Supports streaming and one shot waves.
|
---|
35 | Const DMUS_PC_SYSTEMMEMORY = &H7FFFFFFF 'Sample memory is system memory.
|
---|
36 |
|
---|
37 | ' For DMUS_PORTCAPS dwType
|
---|
38 | Const DMUS_PORT_WINMM_DRIVER = 0
|
---|
39 | Const DMUS_PORT_USER_MODE_SYNTH = 1
|
---|
40 | Const DMUS_PORT_KERNEL_MODE = 2
|
---|
41 |
|
---|
42 | Type DMUS_PORTCAPS
|
---|
43 | dwSize As DWord
|
---|
44 | dwFlags As DWord
|
---|
45 | guidPort As GUID
|
---|
46 | dwClass As DWord
|
---|
47 | dwType As DWord
|
---|
48 | dwMemorySize As DWord
|
---|
49 | dwMaxChannelGroups As DWord
|
---|
50 | dwMaxVoices As DWord
|
---|
51 | dwMaxAudioChannels As DWord
|
---|
52 | dwEffectFlags As DWord
|
---|
53 | wszDescription[DMUS_MAX_DESCRIPTION-1] As WCHAR
|
---|
54 | End Type
|
---|
55 |
|
---|
56 | ' For DMUS_PORTPARAMS8 dwValidParams
|
---|
57 | Const DMUS_PORTPARAMS_VOICES = &H00000001
|
---|
58 | Const DMUS_PORTPARAMS_CHANNELGROUPS = &H00000002
|
---|
59 | Const DMUS_PORTPARAMS_AUDIOCHANNELS = &H00000004
|
---|
60 | Const DMUS_PORTPARAMS_SAMPLERATE = &H00000008
|
---|
61 | Const DMUS_PORTPARAMS_EFFECTS = &H00000020
|
---|
62 | Const DMUS_PORTPARAMS_SHARE = &H00000040
|
---|
63 | Const DMUS_PORTPARAMS_FEATURES = &H00000080
|
---|
64 |
|
---|
65 | ' For DMUS_PORTPARAMS8 dwFeatures
|
---|
66 | Const DMUS_PORT_FEATURE_AUDIOPATH = &H00000001 'Supports audiopath connection to DSound buffers.
|
---|
67 | Const DMUS_PORT_FEATURE_STREAMING = &H00000002 'Supports streaming waves through the synth.
|
---|
68 |
|
---|
69 | Type DMUS_PORTPARAMS8
|
---|
70 | dwSize As DWord
|
---|
71 | dwValidParams As DWord
|
---|
72 | dwVoices As DWord
|
---|
73 | dwChannelGroups As DWord
|
---|
74 | dwAudioChannels As DWord
|
---|
75 | dwSampleRate As DWord
|
---|
76 | dwEffectFlags As DWord
|
---|
77 | fShare As Long
|
---|
78 | dwFeatures As DWord
|
---|
79 | End Type
|
---|
80 | TypeDef DMUS_PORTPARAMS = DMUS_PORTPARAMS8
|
---|
81 |
|
---|
82 | Type DMUS_SYNTHSTATS
|
---|
83 | dwSize As DWord 'Size in bytes of the structure
|
---|
84 | dwValidStats As DWord 'Flags indicating which fields below are valid.
|
---|
85 | dwVoices As DWord 'Average number of voices playing.
|
---|
86 | dwTotalCPU As DWord 'Total CPU usage as percent * 100.
|
---|
87 | dwCPUPerVoice As DWord 'CPU per voice as percent * 100.
|
---|
88 | dwLostNotes As DWord 'Number of notes lost in 1 second.
|
---|
89 | dwFreeMemory As DWord 'Free memory in bytes
|
---|
90 | lPeakVolume As Long 'Decibel level * 100.
|
---|
91 | End Type
|
---|
92 |
|
---|
93 | Const Enum DMUS_CLOCKTYPE
|
---|
94 | DMUS_CLOCK_SYSTEM = 0
|
---|
95 | DMUS_CLOCK_WAVE = 1
|
---|
96 | End Enum
|
---|
97 |
|
---|
98 | Type DMUS_CLOCKINFO
|
---|
99 | dwSize As DWord
|
---|
100 | ctType As DMUS_CLOCKTYPE
|
---|
101 | guidClock As GUID
|
---|
102 | wszDescription[DMUS_MAX_DESCRIPTION-1] As WCHAR
|
---|
103 | dwFlags As DWord
|
---|
104 | End Type
|
---|
105 | TypeDef DMUS_CLOCKINFO8 = DMUS_CLOCKINFO
|
---|
106 |
|
---|
107 |
|
---|
108 | '-----------------
|
---|
109 | ' Interface
|
---|
110 | '-----------------
|
---|
111 |
|
---|
112 | Class IDirectMusic
|
---|
113 | Inherits IUnknown
|
---|
114 | Public
|
---|
115 | 'IDirectMusic
|
---|
116 | Abstract Function EnumPort(dwIndex As DWord, pPortCaps As *DMUS_PORTCAPS) As DWord
|
---|
117 | Abstract Function CreateMusicBuffer(pBufferDesc As *DMUS_BUFFERDESC, ppBuffer As *LPDIRECTMUSICBUFFER, pUnkOuter As LPUNKNOWN) As DWord
|
---|
118 | Abstract Function CreatePort(ByRef rclsidPort As GUID, pPortParams As *DMUS_PORTPARAMS, ppPort As *LPDIRECTMUSICPORT8, pUnkOuter As LPUNKNOWN) As DWord
|
---|
119 | Abstract Function EnumMasterClock(dwIndex As DWord, lpClockInfo As *DMUS_CLOCKINFO) As DWord
|
---|
120 | Abstract Function GetMasterClock(pguidClock As *GUID, ppReferenceClock As **IReferenceClock) As DWord
|
---|
121 | Abstract Function SetMasterClock(ByRef rguidClock As GUID) As DWord
|
---|
122 | Abstract Function Activate(fEnable As Long) As DWord
|
---|
123 | Abstract Function GetDefaultPort(pguidPort As *GUID) As DWord
|
---|
124 | Abstract Function SetDirectSound(pDirectSound As LPDIRECTSOUND, hWnd As HWND) As DWord
|
---|
125 | End Class
|
---|
126 | TypeDef LPDIRECTMUSIC = *IDirectMusic
|
---|
127 |
|
---|
128 | Class IDirectMusic8
|
---|
129 | Inherits IDirectMusic
|
---|
130 | Public
|
---|
131 | 'IDirectMusic8
|
---|
132 | Abstract Function SetExternalMasterClock(pClock As *IReferenceClock) As DWord
|
---|
133 | End Class
|
---|
134 | TypeDef LPDIRECTMUSIC8 = *IDirectMusic8
|
---|
135 |
|
---|
136 | Class IDirectMusicBuffer
|
---|
137 | Inherits IUnknown
|
---|
138 | Public
|
---|
139 | 'IDirectMusicBuffer
|
---|
140 | Abstract Function Flush() As DWord
|
---|
141 | Abstract Function TotalTime(prtTime As *REFERENCE_TIME) As DWord
|
---|
142 | Abstract Function PackStructured(rt As REFERENCE_TIME, dwChannelGroup As DWord, dwChannelMessage As DWord) As DWord
|
---|
143 | Abstract Function PackUnstructured(rt As REFERENCE_TIME, dwChannelGroup As DWord, cb As DWord, lpb As BytePtr) As DWord
|
---|
144 | Abstract Function ResetReadPtr() As DWord
|
---|
145 | Abstract Function GetNextEvent(prt As *REFERENCE_TIME, pdwChannelGroup As DWordPtr, pdwLength As DWordPtr, ppData As **Byte) As DWord
|
---|
146 | Abstract Function GetRawBufferPtr(ppData As **Byte) As DWord
|
---|
147 | Abstract Function GetStartTime(prt As *REFERENCE_TIME) As DWord
|
---|
148 | Abstract Function GetUsedBytes(pcb As DWordPtr) As DWord
|
---|
149 | Abstract Function GetMaxBytes(pcb As DWordPtr) As DWord
|
---|
150 | Abstract Function GetBufferFormat(pGuidFormat As *GUID) As DWord
|
---|
151 | Abstract Function SetStartTime(rt As REFERENCE_TIME) As DWord
|
---|
152 | Abstract Function SetUsedBytes(cb As DWord) As DWord
|
---|
153 | End Class
|
---|
154 | TypeDef LPDIRECTMUSICBUFFER = *IDirectMusicBuffer
|
---|
155 | TypeDef IDirectMusicBuffer8 = IDirectMusicBuffer
|
---|
156 | TypeDef LPDIRECTMUSICBUFFER8 = *IDirectMusicBuffer8
|
---|
157 |
|
---|
158 | Class IDirectMusicInstrument
|
---|
159 | Inherits IUnknown
|
---|
160 | Public
|
---|
161 | 'IDirectMusicInstrument
|
---|
162 | Abstract Function GetPatch(pdwPatch As DWordPtr) As DWord
|
---|
163 | Abstract Function SetPatch(dwPatch As DWord) As DWord
|
---|
164 | End Class
|
---|
165 | TypeDef IDirectMusicInstrument8 = IDirectMusicInstrument
|
---|
166 | TypeDef LPDIRECTMUSICINSTRUMENT8 = *IDirectMusicInstrument8
|
---|
167 |
|
---|
168 | Class IDirectMusicDownloadedInstrument
|
---|
169 | Inherits IUnknown
|
---|
170 | End Class
|
---|
171 | TypeDef IDirectMusicDownloadedInstrument8 = IDirectMusicDownloadedInstrument
|
---|
172 | TypeDef LPDIRECTMUSICDOWNLOADEDINSTRUMENT8 = *IDirectMusicDownloadedInstrument8
|
---|
173 |
|
---|
174 | Class IDirectMusicCollection
|
---|
175 | Inherits IUnknown
|
---|
176 | Public
|
---|
177 | 'IDirectMusicCollection
|
---|
178 | Abstract Function GetInstrument(dwPatch As DWord, ppInstrument As **IDirectMusicInstrument) As DWord
|
---|
179 | Abstract Function EnumInstrument(dwIndex As DWord, pdwPatch As DWordPtr, pwszName As *WCHAR, dwNameLen As DWord) As DWord
|
---|
180 | End Class
|
---|
181 | TypeDef IDirectMusicCollection8 = IDirectMusicCollection
|
---|
182 | TypeDef LPDIRECTMUSICCOLLECTION8 = *IDirectMusicCollection8
|
---|
183 |
|
---|
184 | Class IDirectMusicDownload
|
---|
185 | Inherits IUnknown
|
---|
186 | Public
|
---|
187 | 'IDirectMusicDownload
|
---|
188 | Abstract Function GetBuffer(ppvBuffer As DWordPtr, pdwSize As DWordPtr) As DWord
|
---|
189 | End Class
|
---|
190 | TypeDef IDirectMusicDownload8 = IDirectMusicDownload
|
---|
191 | TypeDef LPDIRECTMUSICDOWNLOAD8 = *IDirectMusicDownload8
|
---|
192 |
|
---|
193 | Class IDirectMusicPortDownload
|
---|
194 | Inherits IUnknown
|
---|
195 | Public
|
---|
196 | 'IDirectMusicPortDownload
|
---|
197 | Abstract Function GetBuffer(dwDLId As DWord, ppIDMDownload As **IDirectMusicDownload) As DWord
|
---|
198 | Abstract Function AllocateBuffer(dwSize As DWord, ppIDMDownload As **IDirectMusicDownload) As DWord
|
---|
199 | Abstract Function GetDLId(pdwStartDLId As DWordPtr, dwCount As DWord) As DWord
|
---|
200 | Abstract Function GetAppend(pdwAppend As DWordPtr) As DWord
|
---|
201 | Abstract Function Download(pIDMDownload As *IDirectMusicDownload) As DWord
|
---|
202 | Abstract Function Unload(pIDMDownload As *IDirectMusicDownload) As DWord
|
---|
203 | End Class
|
---|
204 | TypeDef IDirectMusicPortDownload8 = IDirectMusicPortDownload
|
---|
205 | TypeDef LPDIRECTMUSICPORTDOWNLOAD8 = *IDirectMusicPortDownload8
|
---|
206 |
|
---|
207 | Class IDirectMusicPort
|
---|
208 | Inherits IUnknown
|
---|
209 | Public
|
---|
210 | 'IDirectMusicPort
|
---|
211 | Abstract Function PlayBuffer(pBuffer As LPDIRECTMUSICBUFFER) As DWord
|
---|
212 | Abstract Function SetReadNotificationHandle(hEvent As HANDLE) As DWord
|
---|
213 | Abstract Function Read(pBuffer As LPDIRECTMUSICBUFFER) As DWord
|
---|
214 | Abstract Function DownloadInstrument(pInstrument As *IDirectMusicInstrument, ppDownloadedInstrument As **IDirectMusicDownloadedInstrument, pNoteRanges As *DMUS_NOTERANGE, dwNumNoteRanges As DWord) As DWord
|
---|
215 | Abstract Function UnloadInstrument(pDownloadedInstrument As *IDirectMusicDownloadedInstrument) As DWord
|
---|
216 | Abstract Function GetLatencyClock(ppClock As **IReferenceClock) As DWord
|
---|
217 | Abstract Function GetRunningStats(pStats As *DMUS_SYNTHSTATS) As DWord
|
---|
218 | Abstract Function Compact() As DWord
|
---|
219 | Abstract Function GetCaps(pPortCaps As *DMUS_PORTCAPS) As DWord
|
---|
220 | Abstract Function DeviceIoControl(dwIoControlCode As DWord, lpInBuffer As VoidPtr, nInBufferSize As DWord, lpOutBuffer As VoidPtr, nOutBufferSize As DWord, lpBytesReturned As DWordPtr, lpOverlapped As *OVERLAPPED) As DWord
|
---|
221 | Abstract Function SetNumChannelGroups(dwChannelGroups As DWord) As DWord
|
---|
222 | Abstract Function GetNumChannelGroups(pdwChannelGroups As DWordPtr) As DWord
|
---|
223 | Abstract Function Activate(fActive As Long) As DWord
|
---|
224 | Abstract Function SetChannelPriority(dwChannelGroup As DWord, dwChannel As DWord, dwPriority As DWord) As DWord
|
---|
225 | Abstract Function GetChannelPriority(dwChannelGroup As DWord, dwChannel As DWord, pdwPriority As DWordPtr) As DWord
|
---|
226 | Abstract Function SetDirectSound(pDirectSound As LPDIRECTSOUND, pDirectSoundBuffer As LPDIRECTSOUNDBUFFER) As DWord
|
---|
227 | Abstract Function GetFormat(pWaveFormatEx As *WAVEFORMATEX, pdwWaveFormatExSize As DWordPtr, pdwBufferSize As DWordPtr) As DWord
|
---|
228 | End Class
|
---|
229 | TypeDef IDirectMusicPort8 = IDirectMusicPort
|
---|
230 | TypeDef LPDIRECTMUSICPORT8 = *IDirectMusicPort8
|
---|
231 |
|
---|
232 | Class IDirectMusicThru
|
---|
233 | Inherits IUnknown
|
---|
234 | Public
|
---|
235 | 'IDirectMusicThru
|
---|
236 | Abstract Function ThruChannel(dwSourceChannelGroup As DWord, dwSourceChannel As DWord, dwDestinationChannelGroup As DWord, dwDestinationChannel As DWord, pDestinationPort As LPDIRECTMUSICPORT8) As DWord
|
---|
237 | End Class
|
---|
238 | TypeDef IDirectMusicThru8 = IDirectMusicThru
|
---|
239 | TypeDef LPDIRECTMUSICTHRU8 = *IDirectMusicThru8
|
---|
240 |
|
---|
241 |
|
---|
242 | '-----------------
|
---|
243 | ' CLSID and IID
|
---|
244 | '-----------------
|
---|
245 |
|
---|
246 | Dim CLSID_DirectMusic = [&H636b9f10,&H0c7d,&H11d1,[&H95,&Hb2,&H00,&H20,&Haf,&Hdc,&H74,&H21]] As GUID
|
---|
247 | Dim CLSID_DirectMusicCollection = [&H480ff4b0, &H28b2, &H11d1, [&Hbe, &Hf7, &H0, &Hc0, &H4f, &Hbf, &H8f, &Hef]] As GUID
|
---|
248 | Dim CLSID_DirectMusicSynth = [&H58C2B4D0,&H46E7,&H11D1,[&H89,&HAC,&H00,&HA0,&HC9,&H05,&H41,&H29]] As GUID
|
---|
249 |
|
---|
250 | Dim IID_IDirectMusic = [&H6536115a,&H7b2d,&H11d2,[&Hba,&H18,&H00,&H00,&Hf8,&H75,&Hac,&H12]] As GUID
|
---|
251 | Dim IID_IDirectMusicBuffer = [&Hd2ac2878, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
|
---|
252 | Dim IID_IDirectMusicPort = [&H08f2d8c9,&H37c2,&H11d2,[&Hb9,&Hf9,&H00,&H00,&Hf8,&H75,&Hac,&H12]] As GUID
|
---|
253 | Dim IID_IDirectMusicThru = [&Hced153e7, &H3606, &H11d2, [&Hb9, &Hf9, &H00, &H00, &Hf8, &H75, &Hac, &H12]] As GUID
|
---|
254 | Dim IID_IDirectMusicPortDownload = [&Hd2ac287a, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
|
---|
255 | Dim IID_IDirectMusicDownload = [&Hd2ac287b, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
|
---|
256 | Dim IID_IDirectMusicCollection = [&Hd2ac287c, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
|
---|
257 | Dim IID_IDirectMusicInstrument = [&Hd2ac287d, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
|
---|
258 | Dim IID_IDirectMusicDownloadedInstrument = [&Hd2ac287e, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
|
---|