/
DirectSound.hpp
1668 lines (1479 loc) · 60.2 KB
/
DirectSound.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * src->core->HLE->DSound->DirectSound->DirectSound.h
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// * (c) 2017-2018 RadWolfie
// *
// * All rights reserved
// *
// ******************************************************************
#ifndef EMUDSOUND_H
#define EMUDSOUND_H
#undef FIELD_OFFSET // prevent macro redefinition warnings
#include <dsound.h>
#include "core\kernel\init\CxbxKrnl.h"
#include "..\XbDSoundTypes.h"
#ifdef __cplusplus
extern "C" {
#endif
void CxbxInitAudio();
#ifdef __cplusplus
}
#endif
// ******************************************************************
// * X_CDirectSound
// ******************************************************************
struct X_CDirectSound
{
// TODO: Fill this in?
};
enum X_DSB_TOGGLE {
X_DSB_TOGGLE_DEFAULT = 0,
X_DSB_TOGGLE_PLAY,
X_DSB_TOGGLE_LOOP
};
typedef struct _DSoundBuffer_Lock {
PVOID pLockPtr1;
DWORD dwLockBytes1;
PVOID pLockPtr2;
DWORD dwLockBytes2;
DWORD dwLockOffset;
DWORD dwLockFlags;
} DSoundBuffer_Lock;
// ******************************************************************
// * X_CDirectSoundBuffer
// ******************************************************************
struct X_CDirectSoundBuffer
{
BYTE UnknownA[0x20]; // Offset: 0x00
union // Offset: 0x20
{
PVOID pMpcxBuffer;
LPDIRECTSOUNDBUFFER8 EmuDirectSoundBuffer8;
};
BYTE UnknownB[0x0C]; // Offset: 0x24
LPVOID X_BufferCache; // Offset: 0x28
DSBUFFERDESC EmuBufferDesc; // Offset: 0x2C
/*LPVOID EmuLockPtr1; // Offset: 0x30
DWORD EmuLockBytes1; // Offset: 0x34
LPVOID EmuLockPtr2; // Offset: 0x38
DWORD EmuLockBytes2; // Offset: 0x3C*/
DWORD EmuPlayFlags; // Offset: 0x40
DWORD EmuFlags; // Offset: 0x44
LPDIRECTSOUND3DBUFFER8 EmuDirectSound3DBuffer8;
//DWORD EmuLockOffset;
//DWORD EmuLockFlags;
// Play/Loop Region Section
X_DSB_TOGGLE EmuBufferToggle;
DWORD EmuRegionLoopStartOffset;
DWORD EmuRegionLoopLength;
DWORD EmuRegionPlayStartOffset;
DWORD EmuRegionPlayLength;
DWORD X_BufferCacheSize;
DSoundBuffer_Lock Host_lock;
DSoundBuffer_Lock X_lock;
REFERENCE_TIME Xb_rtPauseEx;
REFERENCE_TIME Xb_rtStopEx;
LONG Xb_Volume;
LONG Xb_VolumeMixbin;
DWORD Xb_dwHeadroom;
X_DSENVOLOPEDESC Xb_EnvolopeDesc;
};
//Custom flags (4 bytes support up to 31 shifts,starting from 0)
#define DSE_FLAG_PCM (1 << 0)
#define DSE_FLAG_XADPCM (1 << 1)
#define DSE_FLAG_PCM_UNKNOWN (1 << 2)
#define DSE_FLAG_SYNCHPLAYBACK_CONTROL (1 << 10)
#define DSE_FLAG_PAUSE (1 << 11)
#define DSE_FLAG_FLUSH_ASYNC (1 << 12)
#define DSE_FLAG_ENVELOPE (1 << 13)
#define DSE_FLAG_ENVELOPE2 (1 << 14) // NOTE: This flag is a requirement for GetStatus to return X_DSSSTATUS_ENVELOPECOMPLETE value.
#define DSE_FLAG_RECIEVEDATA (1 << 20)
#define DSE_FLAG_DEBUG_MUTE (1 << 30) // Cxbx-R debugging usage only
#define DSE_FLAG_BUFFER_EXTERNAL (1 << 31)
#define DSE_FLAG_AUDIO_CODECS (DSE_FLAG_PCM | DSE_FLAG_XADPCM | DSE_FLAG_PCM_UNKNOWN)
// ******************************************************************
// * X_CMcpxStream
// ******************************************************************
class X_CMcpxStream
{
public:
// construct vtable (or grab ptr to existing)
X_CMcpxStream(class X_CDirectSoundStream *pParentStream) : pVtbl(&vtbl), pParentStream(pParentStream) {};
private:
// vtable (cached by each instance, via constructor)
struct _vtbl
{
DWORD Unknown1; // 0x00 - ???
DWORD Unknown2; // 0x04 - ???
DWORD Unknown3; // 0x08 - ???
DWORD Unknown4; // 0x0C - ???
//
// TODO: Function needs X_CMcpxStream "this" pointer (ecx!)
//
VOID (WINAPI *Dummy_0x10)(DWORD dwDummy1, DWORD dwDummy2); // 0x10
}
*pVtbl;
// global vtbl for this class
static _vtbl vtbl;
// debug mode guard for detecting naughty data accesses
#ifdef _DEBUG
DWORD DebugGuard[256];
#endif
public:
class X_CDirectSoundStream *pParentStream;
};
// host_voice_packet is needed for DirectSoundStream packet handling internally.
struct host_voice_packet {
XTL::XMEDIAPACKET xmp_data;
PVOID pBuffer_data;
DWORD rangeStart;
bool isWritten;
bool isPlayed;
};
// ******************************************************************
// * X_CDirectSoundStream
// ******************************************************************
class X_CDirectSoundStream
{
public:
// construct vtable (or grab ptr to existing)
X_CDirectSoundStream() : pVtbl(&vtbl) { pMcpxStream = new X_CMcpxStream(this); };
private:
// vtable (cached by each instance, via constructor)
struct _vtbl
{
ULONG (WINAPI *AddRef)(X_CDirectSoundStream *pThis); // 0x00
ULONG (WINAPI *Release)(X_CDirectSoundStream *pThis); // 0x04
HRESULT (WINAPI *GetInfo) // 0x08
(
X_CDirectSoundStream* pThis,
XMEDIAINFO* pInfo
);
HRESULT (WINAPI *GetStatus) // 0x0C
(
X_CDirectSoundStream* pThis,
LPDWORD pdwStatus
);
HRESULT (WINAPI *Process) // 0x10
(
X_CDirectSoundStream* pThis,
PXMEDIAPACKET pInputBuffer,
PXMEDIAPACKET pOutputBuffer
);
HRESULT (WINAPI *Discontinuity)(X_CDirectSoundStream *pThis); // 0x14
HRESULT (WINAPI *Flush)(X_CDirectSoundStream *pThis); // 0x18
DWORD Unknown2; // 0x1C - ???
DWORD Unknown3; // 0x20 - ???
DWORD Unknown4; // 0x24 - ???
DWORD Unknown5; // 0x28 - ???
DWORD Unknown6; // 0x2C - ???
DWORD Unknown7; // 0x30 - ???
DWORD Unknown8; // 0x34 - ???
DWORD Unknown9; // 0x38 - ???
}
*pVtbl;
// global vtbl for this class
static _vtbl vtbl;
DWORD Spacer[8];
PVOID pMcpxStream;
// debug mode guard for detecting naughty data accesses
#ifdef _DEBUG
DWORD DebugGuard[256];
#endif
public:
// cached data
LPDIRECTSOUNDBUFFER8 EmuDirectSoundBuffer8;
LPDIRECTSOUND3DBUFFER8 EmuDirectSound3DBuffer8;
PVOID X_BufferCache; // Not really needed...
DSBUFFERDESC EmuBufferDesc;
PVOID EmuLockPtr1;
DWORD EmuLockBytes1;
PVOID EmuLockPtr2;
DWORD EmuLockBytes2;
DWORD EmuPlayFlags;
DWORD EmuFlags;
DWORD X_BufferCacheSize; // Not really needed...
DWORD X_MaxAttachedPackets;
std::vector<struct host_voice_packet> Host_BufferPacketArray;
DWORD Host_dwWriteOffsetNext;
DWORD Host_dwTriggerRange;
bool Host_isProcessing;
LPFNXMOCALLBACK Xb_lpfnCallback;
LPVOID Xb_lpvContext;
REFERENCE_TIME Xb_rtFlushEx;
REFERENCE_TIME Xb_rtPauseEx;
LONG Xb_Volume;
LONG Xb_VolumeMixbin;
DWORD Xb_dwHeadroom;
X_DSENVOLOPEDESC Xb_EnvolopeDesc;
};
// ******************************************************************
// * X_XFileMediaObject
// ******************************************************************
class X_XFileMediaObject
{
public:
X_XFileMediaObject() : pVtbl(&vtbl) { EmuRefCount = 1; }
private:
// vtable (cached by each instance, via constructor)
struct _vtbl
{
ULONG (WINAPI *AddRef)(X_XFileMediaObject *pThis); // 0x00
ULONG (WINAPI *Release)(X_XFileMediaObject *pThis); // 0x04
HRESULT (WINAPI *GetInfo) // 0x08
(
X_XFileMediaObject* pThis,
XMEDIAINFO* pInfo
);
HRESULT (WINAPI *GetStatus) // 0x0C
(
X_XFileMediaObject* pThis,
LPDWORD pdwStatus
);
HRESULT (WINAPI *Process) // 0x10
(
X_XFileMediaObject* pThis,
PXMEDIAPACKET pInputBuffer,
PXMEDIAPACKET pOutputBuffer
);
HRESULT (WINAPI *Discontinuity)(X_XFileMediaObject *pThis); // 0x14
DWORD Unknown7;
/*
HRESULT (WINAPI *Flush)(X_XFileMediaObject *pThis); // 0x18
*/
HRESULT (WINAPI *Seek) // 0x1C
(
X_XFileMediaObject* pThis,
LONG lOffset,
DWORD dwOrigin,
LPDWORD pdwAbsolute
);
/*
HRESULT (WINAPI *GetLength) // 0x20
(
X_XFileMediaObject *pThis,
LPDWORD pdwLength
);*/
DWORD Unknown9;
void (WINAPI *DoWork)(X_XFileMediaObject *pThis); // 0x24
}
*pVtbl;
// global vtbl for this class
static _vtbl vtbl;
// debug mode guard for detecting naughty data accesses
#ifdef _DEBUG
DWORD DebugGuard[256];
#endif
public:
// TODO: More?
LPVOID EmuBuffer;
HANDLE EmuHandle;
UINT EmuRefCount;
};
extern "C" {
// ******************************************************************
// * patch: DirectSoundCreate
// ******************************************************************
HRESULT WINAPI EMUPATCH(DirectSoundCreate)
(
LPVOID pguidDeviceId,
LPDIRECTSOUND8 *ppDirectSound,
LPUNKNOWN pUnknown
);
// ******************************************************************
// * patch: DirectSoundDoWork
// ******************************************************************
VOID WINAPI EMUPATCH(DirectSoundDoWork)();
// ******************************************************************
// * patch: IDirectSound_AddRef
// ******************************************************************
ULONG WINAPI EMUPATCH(IDirectSound_AddRef)
(
LPDIRECTSOUND8 pThis
);
// ******************************************************************
// * patch: IDirectSound_Release
// ******************************************************************
ULONG WINAPI EMUPATCH(IDirectSound_Release)
(
LPDIRECTSOUND8 pThis
);
// ******************************************************************
// * patch: CDirectSound_GetSpeakerConfig
// ******************************************************************
HRESULT WINAPI EMUPATCH(CDirectSound_GetSpeakerConfig)
(
X_CDirectSound* pThis,
PDWORD pdwSpeakerConfig
);
// ******************************************************************
// * patch: IDirectSound_SynchPlayback
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSound_SynchPlayback)
(
LPDIRECTSOUND8 pThis
);
// ******************************************************************
// * patch: IDirectSound_DownloadEffectsImage
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSound_DownloadEffectsImage)
(
LPDIRECTSOUND8 pThis,
LPCVOID pvImageBuffer,
DWORD dwImageSize,
PVOID pImageLoc, // TODO: Use this param
PVOID *ppImageDesc // TODO: Use this param
);
// ******************************************************************
// * patch: IDirectSound_SetOrientation
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSound_SetOrientation)
(
LPDIRECTSOUND8 pThis,
FLOAT xFront,
FLOAT yFront,
FLOAT zFront,
FLOAT xTop,
FLOAT yTop,
FLOAT zTop,
DWORD dwApply
);
// ******************************************************************
// * patch: IDirectSound_SetDistanceFactor
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSound_SetDistanceFactor)
(
LPDIRECTSOUND8 pThis,
FLOAT fDistanceFactor,
DWORD dwApply
);
// ******************************************************************
// * patch: IDirectSound_SetRolloffFactor
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSound_SetRolloffFactor)
(
LPDIRECTSOUND8 pThis,
FLOAT fRolloffFactor,
DWORD dwApply
);
// ******************************************************************
// * patch: IDirectSound_SetDopplerFactor
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSound_SetDopplerFactor)
(
LPDIRECTSOUND8 pThis,
FLOAT fDopplerFactor,
DWORD dwApply
);
// ******************************************************************
// * patch: IDirectSound_SetI3DL2Listener
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSound_SetI3DL2Listener)
(
LPDIRECTSOUND8 pThis,
X_DSI3DL2LISTENER *pds3dl,
DWORD dwApply
);
// ******************************************************************
// * patch: IDirectSound_SetMixBinHeadroom
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSound_SetMixBinHeadroom)
(
LPDIRECTSOUND8 pThis,
DWORD dwMixBinMask,
DWORD dwHeadroom
);
// ******************************************************************
// * patch: IDirectSoundBuffer_SetMixBins
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_SetMixBins)
(
LPDIRECTSOUND8 pThis,
PVOID pMixBins // TODO: fill this out
);
// ******************************************************************
// * patch: IDirectSoundBuffer_SetMixBinVolumes_12
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_SetMixBinVolumes_12)
(
X_CDirectSoundBuffer* pThis,
DWORD dwMixBinMask,
const LONG* alVolumes
);
// ******************************************************************
// * patch: IDirectSoundBuffer_SetMixBinVolumes_12
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_SetMixBinVolumes_8)
(
X_CDirectSoundBuffer* pThis,
X_LPDSMIXBINS pMixBins
);
// ******************************************************************
// * patch: IDirectSound_SetPosition
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSound_SetPosition)
(
LPDIRECTSOUND8 pThis,
FLOAT x,
FLOAT y,
FLOAT z,
DWORD dwApply
);
// ******************************************************************
// * patch: IDirectSound_SetVelocity
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSound_SetVelocity)
(
LPDIRECTSOUND8 pThis,
FLOAT x,
FLOAT y,
FLOAT z,
DWORD dwApply
);
// ******************************************************************
// * patch: IDirectSound_SetAllParameters
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSound_SetAllParameters)
(
LPDIRECTSOUND8 pThis,
LPCDS3DLISTENER pDS3DListenerParameters,
DWORD dwApply
);
// ******************************************************************
// * patch: CDirectSound_CommitDeferredSettings
// ******************************************************************
HRESULT WINAPI EMUPATCH(CDirectSound_CommitDeferredSettings)
(
X_CDirectSound* pThis
);
// ******************************************************************
// * patch: IDirectSound_CreateSoundBuffer
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSound_CreateSoundBuffer)
(
LPDIRECTSOUND8 pThis,
X_DSBUFFERDESC* pdsbd,
X_CDirectSoundBuffer** ppBuffer,
LPUNKNOWN pUnkOuter
);
// ******************************************************************
// * patch: DirectSoundCreateBuffer
// ******************************************************************
HRESULT WINAPI EMUPATCH(DirectSoundCreateBuffer)
(
X_DSBUFFERDESC* pdsbd,
X_CDirectSoundBuffer** ppBuffer
);
// ******************************************************************
// * patch: IDirectSoundBuffer_SetBufferData
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_SetBufferData)
(
X_CDirectSoundBuffer* pThis,
LPVOID pvBufferData,
DWORD dwBufferBytes
);
// ******************************************************************
// * patch: IDirectSoundBuffer_SetPlayRegion
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_SetPlayRegion)
(
X_CDirectSoundBuffer* pThis,
DWORD dwPlayStart,
DWORD dwPlayLength
);
// ******************************************************************
// * patch: IDirectSoundBuffer_Lock
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_Lock)
(
X_CDirectSoundBuffer* pThis,
DWORD dwOffset,
DWORD dwBytes,
LPVOID* ppvAudioPtr1,
LPDWORD pdwAudioBytes1,
LPVOID* ppvAudioPtr2,
LPDWORD pdwAudioBytes2,
DWORD dwFlags
);
// ******************************************************************
// * patch: IDirectSoundBuffer_Unlock
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_Unlock)
(
X_CDirectSoundBuffer* pThis,
LPVOID ppvAudioPtr1,
DWORD pdwAudioBytes1,
LPVOID ppvAudioPtr2,
DWORD pdwAudioBytes2
);
// ******************************************************************
// * patch: IDirectSoundBuffer_SetHeadroom
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_SetHeadroom)
(
X_CDirectSoundBuffer* pThis,
DWORD dwHeadroom
);
// ******************************************************************
// * patch: IDirectSoundBuffer_SetLoopRegion
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_SetLoopRegion)
(
X_CDirectSoundBuffer* pThis,
DWORD dwLoopStart,
DWORD dwLoopLength
);
// ******************************************************************
// * patch: IDirectSoundBuffer_Release
// ******************************************************************
ULONG WINAPI EMUPATCH(IDirectSoundBuffer_Release)
(
X_CDirectSoundBuffer* pThis
);
// ******************************************************************
// * patch: IDirectSoundBuffer_SetPitch
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_SetPitch)
(
X_CDirectSoundBuffer* pThis,
LONG lPitch
);
// ******************************************************************
// * patch: IDirectSoundBuffer_GetStatus
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_GetStatus)
(
X_CDirectSoundBuffer* pThis,
LPDWORD pdwStatus
);
// ******************************************************************
// * patch: IDirectSoundBuffer_SetVolume
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_SetVolume)
(
X_CDirectSoundBuffer* pThis,
LONG lVolume
);
// ******************************************************************
// * patch: IDirectSoundBuffer_SetCurrentPosition
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_SetCurrentPosition)
(
X_CDirectSoundBuffer* pThis,
DWORD dwNewPosition
);
// ******************************************************************
// * patch: IDirectSoundBuffer_GetCurrentPosition
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_GetCurrentPosition)
(
X_CDirectSoundBuffer* pThis,
PDWORD pdwCurrentPlayCursor,
PDWORD pdwCurrentWriteCursor
);
// ******************************************************************
// * patch: IDirectSoundBuffer_Stop
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_Stop)
(
X_CDirectSoundBuffer* pThis
);
// ******************************************************************
// * patch: IDirectSoundBuffer_StopEx
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_StopEx)
(
X_CDirectSoundBuffer *pBuffer,
REFERENCE_TIME rtTimeStamp,
DWORD dwFlags
);
// ******************************************************************
// * patch: IDirectSoundBuffer_Play
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_Play)
(
X_CDirectSoundBuffer* pThis,
DWORD dwReserved1,
DWORD dwReserved2,
DWORD dwFlags
);
// ******************************************************************
// * patch: IDirectSoundBuffer_PlayEx
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_PlayEx)
(
X_CDirectSoundBuffer* pBuffer,
REFERENCE_TIME rtTimeStamp,
DWORD dwFlags
);
// ******************************************************************
// * patch: IDirectSoundBuffer_SetVolume
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_SetVolume)
(
X_CDirectSoundBuffer* pThis,
LONG lVolume
);
// ******************************************************************
// * patch: IDirectSoundBuffer_SetFrequency
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_SetFrequency)
(
X_CDirectSoundBuffer* pThis,
DWORD dwFrequency
);
// ******************************************************************
// * patch: DirectSoundCreateStream
// ******************************************************************
HRESULT WINAPI EMUPATCH(DirectSoundCreateStream)
(
X_DSSTREAMDESC* pdssd,
X_CDirectSoundStream** ppStream
);
// ******************************************************************
// * patch: IDirectSound_CreateSoundStream
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSound_CreateSoundStream)
(
LPDIRECTSOUND8 pThis,
X_DSSTREAMDESC* pdssd,
X_CDirectSoundStream** ppStream,
PVOID pUnknown
);
// ******************************************************************
// * patch: CMcpxStream_Dummy_0x10
// ******************************************************************
VOID WINAPI EMUPATCH(CMcpxStream_Dummy_0x10)(DWORD dwDummy1, DWORD dwDummy2);
// ******************************************************************
// * patch: CDirectSoundStream_SetRolloffFactor
// ******************************************************************
HRESULT WINAPI EMUPATCH(CDirectSoundStream_SetRolloffFactor)
(
X_CDirectSoundStream *pThis,
FLOAT fRolloffFactor,
DWORD dwApply
);
// ******************************************************************
// * patch: CDirectSoundStream_AddRef
// ******************************************************************
ULONG WINAPI EMUPATCH(CDirectSoundStream_AddRef)(X_CDirectSoundStream *pThis);
// ******************************************************************
// * patch: CDirectSoundStream_Release
// ******************************************************************
ULONG WINAPI EMUPATCH(CDirectSoundStream_Release)(X_CDirectSoundStream *pThis);
// ******************************************************************
// * CDirectSoundStream_GetInfo
// ******************************************************************
HRESULT WINAPI EMUPATCH(CDirectSoundStream_GetInfo)
(
X_CDirectSoundStream* pThis,
LPXMEDIAINFO pInfo
);
// ******************************************************************
// * patch: CDirectSoundStream_GetStatus
// ******************************************************************
HRESULT WINAPI EMUPATCH(CDirectSoundStream_GetStatus)
(
X_CDirectSoundStream* pThis,
LPDWORD pdwStatus
);
// ******************************************************************
// * patch: CDirectSoundStream_Process
// ******************************************************************
HRESULT WINAPI EMUPATCH(CDirectSoundStream_Process)
(
X_CDirectSoundStream* pThis,
PXMEDIAPACKET pInputBuffer,
PXMEDIAPACKET pOutputBuffer
);
// ******************************************************************
// * patch: CDirectSoundStream_Discontinuity
// ******************************************************************
HRESULT WINAPI EMUPATCH(CDirectSoundStream_Discontinuity)(X_CDirectSoundStream *pThis);
// ******************************************************************
// * patch: CDirectSoundStream_Flush
// ******************************************************************
HRESULT WINAPI EMUPATCH(CDirectSoundStream_Flush)(X_CDirectSoundStream *pThis);
// ******************************************************************
// * patch: CDirectSound_SynchPlayback
// ******************************************************************
HRESULT WINAPI EMUPATCH(CDirectSound_SynchPlayback)
(
LPDIRECTSOUND8 pThis
);
// ******************************************************************
// * patch: CDirectSoundStream_Pause
// ******************************************************************
HRESULT WINAPI EMUPATCH(CDirectSoundStream_Pause)
(
X_CDirectSoundStream* pThis,
DWORD dwPause
);
// ******************************************************************
// * patch: CDirectSoundStream_SetHeadroom
// ******************************************************************
HRESULT WINAPI EMUPATCH(CDirectSoundStream_SetHeadroom)
(
X_CDirectSoundStream* pThis,
DWORD dwHeadroom
);
// ******************************************************************
// * patch: CDirectSoundStream_SetAllParameters
// ******************************************************************
HRESULT WINAPI EMUPATCH(CDirectSoundStream_SetAllParameters)
(
X_CDirectSoundStream* pThis,
X_DS3DBUFFER* pc3DBufferParameters,
DWORD dwApply
);
// ******************************************************************
// * patch: CDirectSoundStream_SetConeAngles
// ******************************************************************
HRESULT WINAPI EMUPATCH(CDirectSoundStream_SetConeAngles)
(
X_CDirectSoundStream* pThis,
DWORD dwInsideConeAngle,
DWORD dwOutsideConeAngle,
DWORD dwApply
);
// ******************************************************************
// * patch: CDirectSoundStream_SetConeOutsideVolume
// ******************************************************************
HRESULT WINAPI EMUPATCH(CDirectSoundStream_SetConeOutsideVolume)
(
X_CDirectSoundStream* pThis,
LONG lConeOutsideVolume,
DWORD dwApply
);
// ******************************************************************
// * patch: CDirectSoundStream_SetMaxDistance
// ******************************************************************
HRESULT WINAPI EMUPATCH(CDirectSoundStream_SetMaxDistance)
(
X_CDirectSoundStream* pThis,
D3DVALUE fMaxDistance,
DWORD dwApply
);
// ******************************************************************
// * patch: CDirectSoundStream_SetMinDistance
// ******************************************************************
HRESULT WINAPI EMUPATCH(CDirectSoundStream_SetMinDistance)
(
X_CDirectSoundStream* pThis,
D3DVALUE fMinDistance,
DWORD dwApply
);
// ******************************************************************
// * patch: CDirectSoundStream_SetVelocity
// ******************************************************************
HRESULT WINAPI EMUPATCH(CDirectSoundStream_SetVelocity)
(
X_CDirectSoundStream* pThis,
D3DVALUE x,
D3DVALUE y,
D3DVALUE z,
DWORD dwApply
);
// ******************************************************************
// * patch: CDirectSoundStream_SetConeOrientation
// ******************************************************************
HRESULT WINAPI EMUPATCH(CDirectSoundStream_SetConeOrientation)
(
X_CDirectSoundStream* pThis,
D3DVALUE x,
D3DVALUE y,
D3DVALUE z,
DWORD dwApply
);
// ******************************************************************
// * patch: CDirectSoundStream_SetPosition
// ******************************************************************
HRESULT WINAPI EMUPATCH(CDirectSoundStream_SetPosition)
(
X_CDirectSoundStream* pThis,
D3DVALUE x,
D3DVALUE y,
D3DVALUE z,
DWORD dwApply
);
// ******************************************************************
// * patch: CDirectSoundStream_SetFrequency
// ******************************************************************
HRESULT WINAPI EMUPATCH(CDirectSoundStream_SetFrequency)
(
X_CDirectSoundStream* pThis,
DWORD dwFrequency
);
// ******************************************************************
// * patch: CDirectSoundStream_SetI3DL2Source
// ******************************************************************
HRESULT WINAPI EMUPATCH(CDirectSoundStream_SetI3DL2Source)
(
X_CDirectSoundStream* pThis,
X_DSI3DL2BUFFER* pds3db,
DWORD dwApply
);
// ******************************************************************
// * patch: CDirectSoundStream_SetMixBins
// ******************************************************************
HRESULT WINAPI EMUPATCH(CDirectSoundStream_SetMixBins)
(
X_CDirectSoundStream* pThis,
PVOID pMixBins
);
// s+
// ******************************************************************
// * patch: IDirectSoundBuffer_SetMaxDistance
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_SetMaxDistance)
(
X_CDirectSoundBuffer* pThis,
FLOAT flMaxDistance,
DWORD dwApply
);
// ******************************************************************
// * patch: IDirectSoundBuffer_SetMinDistance
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_SetMinDistance)
(
X_CDirectSoundBuffer* pThis,
FLOAT flMaxDistance,
DWORD dwApply
);
// ******************************************************************
// * patch: IDirectSoundBuffer_SetRolloffFactor
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_SetRolloffFactor)
(
X_CDirectSoundBuffer* pThis,
FLOAT flRolloffFactor,
DWORD dwApply
);
// ******************************************************************
// * patch: IDirectSoundBuffer_SetDistanceFactor
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_SetDistanceFactor)
(
X_CDirectSoundBuffer* pThis,
FLOAT flDistanceFactor,
DWORD dwApply