source: cmedia/trunk/Drv16/stream.hpp@ 577

Last change on this file since 577 was 354, checked in by stevenhl, 18 years ago

Import untested baseline cmedia sources, work products and binaries
Binaries and work products should be deleted from repository.
once new builds are verified to work.

File size: 5.0 KB
Line 
1/* $Id: stream.hpp,v 1.4 2001/04/30 21:07:59 sandervl Exp $ */
2
3/* SCCSID = %W% %E% */
4/****************************************************************************
5 * *
6 * Copyright (c) IBM Corporation 1994 - 1997. *
7 * *
8 * The following IBM OS/2 source code is provided to you solely for the *
9 * the purpose of assisting you in your development of OS/2 device drivers. *
10 * You may use this code in accordance with the IBM License Agreement *
11 * provided in the IBM Device Driver Source Kit for OS/2. *
12 * *
13 ****************************************************************************/
14/**@internal %W%
15 * Defines, class definations and prototypes for
16 * @version %I%
17 * @context Unless otherwise noted, all interfaces are Ring-0, 16-bit,
18 * <stack context>.
19 * @history
20 *
21 */
22#ifndef STREAM_INCLUDED
23#define STREAM_INCLUDED
24
25#ifndef OS2_INCLUDED
26#define INCL_NOPMAPI
27#include <os2.h>
28#endif
29#include <os2me.h>
30#include <shdd.h>
31
32#include "strategy.h"
33#include "audiohw.hpp"
34#include "strmbuff.hpp"
35#include <daudio.h>
36
37extern PQUEUEHEAD pStreamList; // List head for Streams.Defined in STREAM.CPP.
38
39// stream types
40#define STREAM_READ AUDIOHW_READ_DEVICE
41#define STREAM_WRITE AUDIOHW_WRITE_DEVICE
42#define STREAM_WAVE_CAPTURE AUDIOHW_WAVE_CAPTURE
43#define STREAM_WAVE_PLAY AUDIOHW_WAVE_PLAY
44#define STREAM_FMSYNTH_CAPTURE AUDIOHW_FMSYNTH_CAPTURE
45#define STREAM_FMSYNTH_PLAY AUDIOHW_FMSYNTH_PLAY
46#define STREAM_MPU401_CAPTURE AUDIOHW_MPU401_CAPTURE
47#define STREAM_MPU401_PLAY AUDIOHW_MPU401_PLAY
48#define STREAM_ANY AUDIOHW_INVALID_DEVICE
49
50
51// stream states
52#define STREAM_STOPPED 0x0000
53#define STREAM_STREAMING 0x0001
54#define STREAM_PAUSED 0x0002
55#define STREAM_IDLE 0x0004
56#define STREAM_NOT_IDLE (~STREAM_IDLE)
57#define STREAM_SUSPENDED 0x0008 // APM
58
59
60// input sources
61#define INPUT_LINEIN 0
62#define INPUT_MIC 1
63#define INPUT_MIXER 2
64
65typedef ULONG (__far __cdecl *PFN_SHD) (void __far *);
66
67class STREAM;
68class AUDIOHW;
69class EVENT;
70
71class STREAM : public QUEUEELEMENT {
72public:
73 HSTREAM hstream;
74 PFN_SHD pfnSHD;
75 USHORT usSysFileNum;
76 QUEUEHEAD qhInProcess;
77 QUEUEHEAD qhDone;
78 QUEUEHEAD qhEvent;
79 ULONG ulStreamId;
80 USHORT usStreamType; // the stream type see above
81 USHORT usStreamState; // the current state to the stream see above
82
83 int fIncrementCounter; // true if the current time should be incremented on every tick
84
85 ULONG EnableEvent(PDDCMDCONTROL pControl);
86 ULONG DisableEvent(PDDCMDCONTROL pControl);
87 ULONG PauseStreamTime(void);
88 ULONG ResumeStreamTime(void);
89 virtual ULONG Register(PDDCMDREGISTER);
90 virtual void DeRegister(void);
91 virtual ULONG Write(PSTREAMBUF, ULONG, BOOL fLooping = 0);
92 virtual void SetLooping(BOOL fLooping);
93 virtual ULONG Read(PSTREAMBUF, unsigned) = 0;
94 virtual ULONG GetCurrentTime(void) = 0;
95 virtual ULONG GetCurrentPos(void) = 0;
96 virtual ULONG GetCurrentWritePos(void) = 0;
97 virtual void SetCurrentTime(ULONG) = 0;
98 virtual ULONG StartStream(void) = 0;
99 virtual ULONG StopStream(PCONTROL_PARM) = 0;
100 virtual ULONG PauseStream(PCONTROL_PARM) = 0;
101 virtual ULONG ResumeStream(void) = 0;
102
103 inline BOOL isActive() { return usStreamState == STREAM_STREAMING; };
104
105 virtual BOOL SetProperty(int type, ULONG value, ULONG reserved = 0);
106 virtual ULONG GetProperty(int type);
107
108 void SetNextEvent(void);
109 STREAM(USHORT streamtype, USHORT filesysnum);
110 virtual ~STREAM(void);
111
112 static BOOL QueryMixerChange(void) {
113 BOOL result = mixerchange; mixerchange = FALSE; return result;
114 };
115
116 static void SetMasterControl(ULONG ulMasterVol, ULONG ulMasterBal);
117
118protected:
119 ULONG ulCurrentTime;
120 PAUDIOHW pahw; // pointer to the hardware object for this stream
121 virtual void ReturnBuffer(void); // returns one buffer
122 void ReturnBuffers(void); // returns all buffers
123 void ProcessEvents(void);
124
125 ULONG balance;
126 ULONG volume;
127 ULONG inputsrc;
128 ULONG inputgain;
129
130static ULONG mastervol;
131static ULONG masterbal;
132static BOOL mixerchange;
133};
134
135typedef STREAM *PSTREAM;
136
137
138PSTREAM FindActiveStream(USHORT StreamType);
139// Returns the pointer to the Active STREAM object with the given stream type
140
141PSTREAM FindActiveStream(USHORT StreamType, ULONG streamid);
142// Returns the pointer to the Active STREAM object with the given stream type
143
144PSTREAM FindStream(HSTREAM hStream);
145// Returns the pointer to the STREAM object with the given stream handle
146
147PSTREAM FindStream_fromFile(USHORT usSysFileNum);
148// Returns the pointer to the STREAM object with the given system file handle
149
150PSTREAM EnumStreams(PSTREAM pStream, USHORT StreamType = STREAM_ANY);
151// Enumerate stream list
152
153#endif
Note: See TracBrowser for help on using the repository browser.