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

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

PD: implemented waveOutGet/SetVolume

File size: 2.9 KB
Line 
1/* $Id: dwaveout.h,v 1.7 1999-12-31 13:55:51 sandervl Exp $ */
2
3/*
4 * Wave playback class
5 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
6 * Project Odin Software License can be found in LICENSE.TXT
7 */
8#ifndef __DWAVEOUT_H__
9#define __DWAVEOUT_H__
10
11#define STATE_STOPPED 0
12#define STATE_PLAYING 1
13#define STATE_PAUSED 2
14
15#define PREFILLBUF_DART 4
16#define DART_BUFSIZE 4096
17
18#ifdef OS2_ONLY
19#include "winmmtype.h"
20#endif
21#include "vmutex.h"
22
23#ifdef _OS2WIN_H
24#define MCI_MIX_BUFFER DWORD
25#define PMCI_MIX_BUFFER MCI_MIX_BUFFER *
26#define MCI_MIXSETUP_PARMS DWORD
27#define MCI_BUFFER_PARMS DWORD
28#define MCI_PLAY_PARMS DWORD
29#endif
30
31class DartWaveOut
32{
33public:
34 DartWaveOut(LPWAVEFORMATEX pwfx, ULONG nCallback, ULONG dwInstance, USHORT usSel);
35 DartWaveOut(LPWAVEFORMATEX pwfx, HWND hwndCallback);
36 DartWaveOut(LPWAVEFORMATEX pwfx);
37 ~DartWaveOut();
38
39 MMRESULT getError();
40 MMRESULT write(LPWAVEHDR pwh, UINT cbwh);
41 MMRESULT pause();
42 MMRESULT restart();
43 MMRESULT setVolume(ULONG ulVol);
44 ULONG getVolume() {return volume; };
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 static int getNumDevices();
53
54protected:
55 static void mciError(ULONG ulError);
56 void Init(LPWAVEFORMATEX pwfx);
57 void handler(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer, ULONG ulFlags);
58
59private:
60 USHORT DeviceId;
61 ULONG ulBufferCount; /* Current file buffer */
62 ULONG ulBufSize;
63
64 ULONG ulError, State;
65 ULONG volume; // Volume state
66
67 MCI_MIX_BUFFER *MixBuffer; /* Device buffers */
68 MCI_MIXSETUP_PARMS *MixSetupParms; /* Mixer parameters */
69 MCI_BUFFER_PARMS *BufferParms; /* Device buffer parms */
70
71 int SampleRate;
72 int BitsPerSample;
73 int nChannels;
74 int curPlayBuf, curFillBuf;
75 int curFillPos, curPlayPos; //fillpos == pos in os2 mix buffer, bufpos == pos in win buffer
76
77 // callback interface
78 LPDRVCALLBACK mthdCallback; // pointer to win32 routine for the callback
79 USHORT selCallback; // the win32 tib selector for the callback (saved at waveOutOpen)
80 void callback(HDRVR h, UINT uMessage, DWORD dwUser, DWORD dw1, DWORD dw2);
81 HWND hwndCallback;
82 DWORD dwInstance;
83
84 WAVEHDR *wavehdr,
85 *curhdr;
86
87 BOOL fMixerSetup;
88
89 VMutex *wmutex;
90 // Linked list management
91 DartWaveOut* next; // Next Timer
92 static DartWaveOut* waveout; // List of Timer
93
94#ifndef _OS2WIN_H
95 friend LONG APIENTRY WaveOutHandler(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer, ULONG ulFlags);
96#endif
97};
98
99#endif
Note: See TracBrowser for help on using the repository browser.