1 | /* $Id: waveoutdart.h,v 1.4 2003-04-03 14:04:50 sandervl Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Wave playback class (DART)
|
---|
5 | *
|
---|
6 | * Copyright 1998-2001 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
7 | *
|
---|
8 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
9 | */
|
---|
10 |
|
---|
11 | #ifndef __DWAVEOUT_H__
|
---|
12 | #define __DWAVEOUT_H__
|
---|
13 |
|
---|
14 | #include "waveoutbase.h"
|
---|
15 |
|
---|
16 | #ifdef OS2_ONLY
|
---|
17 | #include "winmmtype.h"
|
---|
18 | #endif
|
---|
19 | #include "vmutex.h"
|
---|
20 |
|
---|
21 | #ifdef _OS2WIN_H
|
---|
22 | #define MCI_MIX_BUFFER DWORD
|
---|
23 | #define PMCI_MIX_BUFFER MCI_MIX_BUFFER *
|
---|
24 | #define MCI_MIXSETUP_PARMS DWORD
|
---|
25 | #define MCI_BUFFER_PARMS DWORD
|
---|
26 | #define MCI_PLAY_PARMS DWORD
|
---|
27 | #endif
|
---|
28 |
|
---|
29 | // this should be defined in some #included .h file, but it isn't
|
---|
30 | typedef LONG (APIENTRY MIXERPROC)(ULONG ulHandle, PMCI_MIX_BUFFER pBuffer, ULONG ulFlags);
|
---|
31 |
|
---|
32 | class DartWaveOut : public WaveOut
|
---|
33 | {
|
---|
34 | public:
|
---|
35 | DartWaveOut(LPWAVEFORMATEX pwfx, DWORD fdwOpen,
|
---|
36 | ULONG nCallback, ULONG dwInstance);
|
---|
37 | virtual ~DartWaveOut();
|
---|
38 |
|
---|
39 | virtual MMRESULT open();
|
---|
40 | virtual MMRESULT write(LPWAVEHDR pwh, UINT cbwh);
|
---|
41 | virtual MMRESULT pause();
|
---|
42 | virtual MMRESULT stop();
|
---|
43 | virtual MMRESULT resume();
|
---|
44 | virtual MMRESULT setVolume(ULONG ulVol);
|
---|
45 | virtual MMRESULT reset();
|
---|
46 | virtual ULONG getPosition();
|
---|
47 |
|
---|
48 | protected:
|
---|
49 | MMRESULT initBuffers();
|
---|
50 | void writeBuffer();
|
---|
51 | static void mciError(ULONG rc);
|
---|
52 | void handler(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer, ULONG ulFlags);
|
---|
53 |
|
---|
54 | private:
|
---|
55 | USHORT DeviceId;
|
---|
56 | BOOL fMixerSetup;
|
---|
57 | BOOL fUnderrun;
|
---|
58 | int curFillBuf;
|
---|
59 | int curPlayBuf;
|
---|
60 | ULONG curFillPos;
|
---|
61 | ULONG curPlayPos;
|
---|
62 | ULONG ulBufSize;
|
---|
63 | ULONG ulBufCount;
|
---|
64 | ULONG bytesPlayed;
|
---|
65 | ULONG bytesCopied;
|
---|
66 | ULONG bytesReturned;
|
---|
67 | ULONG ulUnderrunBase;
|
---|
68 | ULONG mixHandle;
|
---|
69 | WAVEHDR * curhdr;
|
---|
70 | MIXERPROC * pmixWriteProc;
|
---|
71 | MCI_MIX_BUFFER * MixBuffer;
|
---|
72 | MCI_BUFFER_PARMS * BufferParms;
|
---|
73 |
|
---|
74 | friend LONG APIENTRY WaveOutHandler(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer,
|
---|
75 | ULONG ulFlags);
|
---|
76 | };
|
---|
77 |
|
---|
78 | #endif
|
---|