source: trunk/src/winmm/dwaveout.h@ 46

Last change on this file since 46 was 46, checked in by sandervl, 26 years ago

* empty log message *

File size: 2.4 KB
Line 
1/*
2 * Wave playback class
3 *
4 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
5 *
6 *
7 * Project Odin Software License can be found in LICENSE.TXT
8 *
9 */
10#ifndef __DWAVEOUT_H__
11#define __DWAVEOUT_H__
12
13#define STATE_STOPPED 0
14#define STATE_PLAYING 1
15#define STATE_PAUSED 2
16
17#define PREFILLBUF_DART 4
18#define DART_BUFSIZE 4096
19
20#ifdef OS2_ONLY
21#include "winmmtype.h"
22#endif
23#include "vmutex.h"
24
25#ifdef _OS2WIN_H
26#define MCI_MIX_BUFFER DWORD
27#define PMCI_MIX_BUFFER MCI_MIX_BUFFER *
28#define MCI_MIXSETUP_PARMS DWORD
29#define MCI_BUFFER_PARMS DWORD
30#define MCI_PLAY_PARMS DWORD
31#endif
32
33class DartWaveOut
34{
35public:
36 DartWaveOut(LPWAVEFORMATEX pwfx, ULONG nCallback, ULONG dwInstance);
37 DartWaveOut(LPWAVEFORMATEX pwfx, HWND hwndCallback);
38 DartWaveOut(LPWAVEFORMATEX pwfx);
39 ~DartWaveOut();
40
41 MMRESULT getError();
42 MMRESULT write(LPWAVEHDR pwh, UINT cbwh);
43 MMRESULT pause();
44 MMRESULT restart();
45 int getState() { return State; };
46 MMRESULT reset();
47
48 static BOOL queryFormat(ULONG formatTag, ULONG nChannels,
49 ULONG nSamplesPerSec, ULONG sampleSize);
50
51 static BOOL find(DartWaveOut *dwave);
52
53protected:
54 static void mciError(ULONG ulError);
55 void Init(LPWAVEFORMATEX pwfx);
56 void handler(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer, ULONG ulFlags);
57
58private:
59 USHORT DeviceId;
60 ULONG ulBufferCount; /* Current file buffer */
61 ULONG ulBufSize;
62
63 ULONG ulError, State;
64
65 MCI_MIX_BUFFER *MixBuffer; /* Device buffers */
66 MCI_MIXSETUP_PARMS *MixSetupParms; /* Mixer parameters */
67 MCI_BUFFER_PARMS *BufferParms; /* Device buffer parms */
68
69 int SampleRate;
70 int BitsPerSample;
71 int nChannels;
72 int curPlayBuf, curFillBuf;
73 int curFillPos, curPlayPos; //fillpos == pos in os2 mix buffer, bufpos == pos in win buffer
74
75 LPDRVCALLBACK callback;
76 HWND hwndCallback;
77 DWORD dwInstance;
78 WAVEHDR *wavehdr, *curhdr;
79
80 BOOL fMixerSetup;
81
82 VMutex *wmutex;
83 // Linked list management
84 DartWaveOut* next; // Next Timer
85 static DartWaveOut* waveout; // List of Timer
86
87#ifndef _OS2WIN_H
88 friend LONG APIENTRY WaveOutHandler(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer, ULONG ulFlags);
89#endif
90};
91
92#endif
Note: See TracBrowser for help on using the repository browser.