sl@0
|
1 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// wins\specific\winssoundsc.h
|
sl@0
|
15 |
// Definitions for the emulator shared chunk sound driver PDD.
|
sl@0
|
16 |
//
|
sl@0
|
17 |
//
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@file
|
sl@0
|
21 |
@internalTechnology
|
sl@0
|
22 |
@prototype
|
sl@0
|
23 |
*/
|
sl@0
|
24 |
|
sl@0
|
25 |
#ifndef __WINSSOUNDSC_H__
|
sl@0
|
26 |
#define __WINSSOUNDSC_H__
|
sl@0
|
27 |
|
sl@0
|
28 |
#include <drivers/soundsc.h>
|
sl@0
|
29 |
#include "nk_priv.h"
|
sl@0
|
30 |
#include <emulator.h>
|
sl@0
|
31 |
#pragma warning(disable : 4201) // nonstandard extension used : nameless struct/union
|
sl@0
|
32 |
#include <mmsystem.h>
|
sl@0
|
33 |
#include <mmreg.h>
|
sl@0
|
34 |
#pragma warning(default : 4201)
|
sl@0
|
35 |
#include <property.h>
|
sl@0
|
36 |
|
sl@0
|
37 |
//#define FORCE_NO_HARDWARE
|
sl@0
|
38 |
|
sl@0
|
39 |
//#define __KTRACE_SND(s) s;
|
sl@0
|
40 |
#define __KTRACE_SND(s)
|
sl@0
|
41 |
|
sl@0
|
42 |
#define PANIC() Kern::Fault("WinsSoundScPdd", __LINE__)
|
sl@0
|
43 |
|
sl@0
|
44 |
const TInt KMMTimerRes = 5; // Minimum timer resolution (5mS). Timer used only when no audio hardware present.
|
sl@0
|
45 |
const TInt KWinsMaxAudioTransferLen=0x8000; // The maximum transfer length this PDD will accept (32K).
|
sl@0
|
46 |
const TInt KMinWaveHdrBufCount=8; // The minimum number of record or playback waveform audio buffers.
|
sl@0
|
47 |
|
sl@0
|
48 |
GLREF_C TInt RateInSamplesPerSecond(TSoundRate aRate);
|
sl@0
|
49 |
GLREF_C DWORD WaitForSingleObjectDualThread(HANDLE hHandle,DWORD dwMilliseconds);
|
sl@0
|
50 |
GLREF_C WAVEHDR* RemoveFromPendingList(WAVEHDR** aList);
|
sl@0
|
51 |
GLREF_C void AddToPendingList(WAVEHDR* aBuffer,WAVEHDR** aList);
|
sl@0
|
52 |
|
sl@0
|
53 |
// Utility class used to lock the kernel for a short period while windows
|
sl@0
|
54 |
// API calls are made. This is to stop a possible deadlock from occurring when
|
sl@0
|
55 |
// a windows thread is suspended while a (windows) synchronization object is held
|
sl@0
|
56 |
// and a second thread tries to gain access to that object. Typically this object
|
sl@0
|
57 |
// is declared on the stack - when the constructor is called, the kernel is locked;
|
sl@0
|
58 |
// when the object goes out of scope, the destructor unlocks the kernel.
|
sl@0
|
59 |
// Used by the __HOST_LOCK macro.
|
sl@0
|
60 |
class THostLock
|
sl@0
|
61 |
{
|
sl@0
|
62 |
public:
|
sl@0
|
63 |
THostLock();
|
sl@0
|
64 |
~THostLock();
|
sl@0
|
65 |
void Lock();
|
sl@0
|
66 |
void Unlock();
|
sl@0
|
67 |
protected:
|
sl@0
|
68 |
THostLock(TBool aLock);
|
sl@0
|
69 |
private:
|
sl@0
|
70 |
TBool iLocked;
|
sl@0
|
71 |
};
|
sl@0
|
72 |
|
sl@0
|
73 |
// Utility class used to lock the kernel for a short period while windows
|
sl@0
|
74 |
// API calls are made. This is used instead of THostLock for functions
|
sl@0
|
75 |
// which are used by both the driver thread and the play thread -
|
sl@0
|
76 |
// if the thread is a windows thread, then the kernel is not locked.
|
sl@0
|
77 |
// Used by the __COND_HOST_LOCK macro.
|
sl@0
|
78 |
class TCondHostLock : public THostLock
|
sl@0
|
79 |
{
|
sl@0
|
80 |
public:
|
sl@0
|
81 |
TCondHostLock();
|
sl@0
|
82 |
void Lock();
|
sl@0
|
83 |
void Unlock();
|
sl@0
|
84 |
private:
|
sl@0
|
85 |
TBool iEpocThread;
|
sl@0
|
86 |
};
|
sl@0
|
87 |
|
sl@0
|
88 |
// Forward declarations
|
sl@0
|
89 |
class TWaveformBufMgr;
|
sl@0
|
90 |
|
sl@0
|
91 |
/**
|
sl@0
|
92 |
This the abstraction for a windows waveform audio buffer.
|
sl@0
|
93 |
*/
|
sl@0
|
94 |
class TWaveformAudioBuf
|
sl@0
|
95 |
{
|
sl@0
|
96 |
public:
|
sl@0
|
97 |
TWaveformAudioBuf();
|
sl@0
|
98 |
inline void SetWaveformBufMgr(TWaveformBufMgr* aWaveformBufMgr)
|
sl@0
|
99 |
{iWaveformBufMgr=aWaveformBufMgr;}
|
sl@0
|
100 |
inline void SetBufNum(TInt aBufNum)
|
sl@0
|
101 |
{iBufNum=aBufNum;}
|
sl@0
|
102 |
void Prepare(char* aBufAddr,TInt aBufLength,TInt aDeviceHandle);
|
sl@0
|
103 |
void Unprepare(TInt aDeviceHandle);
|
sl@0
|
104 |
private:
|
sl@0
|
105 |
void DoPrepareOut(HWAVEOUT aPlayDeviceHandle);
|
sl@0
|
106 |
void DoUnprepareOut(HWAVEOUT aPlayDeviceHandle);
|
sl@0
|
107 |
void DoPrepareIn(HWAVEIN aRecordDeviceHandle);
|
sl@0
|
108 |
void DoUnprepareIn(HWAVEIN aRecordDeviceHandle);
|
sl@0
|
109 |
public:
|
sl@0
|
110 |
/** The owning waveform audio buffer manager. */
|
sl@0
|
111 |
TWaveformBufMgr* iWaveformBufMgr;
|
sl@0
|
112 |
/** Set when the waveform audio buffer is currently prepared. */
|
sl@0
|
113 |
TBool iIsPrepared;
|
sl@0
|
114 |
/** Set when the waveform audio buffer is involved in an active transfer. */
|
sl@0
|
115 |
TBool iIsInUse;
|
sl@0
|
116 |
/** The header used by windows to identify the waveform audio buffer. */
|
sl@0
|
117 |
WAVEHDR iBufHdr;
|
sl@0
|
118 |
/** A value used to identify a particular waveform audio buffer within an array of these objects. */
|
sl@0
|
119 |
TInt iBufNum;
|
sl@0
|
120 |
/** The transfer ID supplied by the LDD when the buffer is involved in an active transfer. */
|
sl@0
|
121 |
TUint iTransferID;
|
sl@0
|
122 |
friend class TWaveformBufMgr;
|
sl@0
|
123 |
};
|
sl@0
|
124 |
|
sl@0
|
125 |
/**
|
sl@0
|
126 |
The waveform audio buffer manager. This owns and maintains a set of windows waveform audio buffers which it makes
|
sl@0
|
127 |
available to the PDD for data block transfers.
|
sl@0
|
128 |
*/
|
sl@0
|
129 |
class TWaveformBufMgr
|
sl@0
|
130 |
{
|
sl@0
|
131 |
public:
|
sl@0
|
132 |
TWaveformBufMgr(TSoundDirection aDirection,TBool aIsHardware);
|
sl@0
|
133 |
~TWaveformBufMgr();
|
sl@0
|
134 |
TInt ReAllocAndUpdate(TSoundSharedChunkBufConfig* aBufConfig,TLinAddr aChunkBase,TInt aDeviceHandle);
|
sl@0
|
135 |
TWaveformAudioBuf* AcquireBuf(char* aStartAddress,TInt aBufLength,TInt aDeviceHandle);
|
sl@0
|
136 |
public:
|
sl@0
|
137 |
/** The array of windows waveform audio buffer objects. There is at least one buffer object per buffer within the
|
sl@0
|
138 |
LDD shared chunk. */
|
sl@0
|
139 |
TWaveformAudioBuf* iWaveformAudioBuf;
|
sl@0
|
140 |
/** The count of the number of audio play buffers in the waveform buffer array. */
|
sl@0
|
141 |
TInt iNumWaveformBufs;
|
sl@0
|
142 |
/** The default size of each audio buffer in the waveform buffer array. */
|
sl@0
|
143 |
TInt iWaveformBufSize;
|
sl@0
|
144 |
/** List of waveform audio buffer objects waiting to be played/recorded - in FIFO order. Used only when
|
sl@0
|
145 |
no audio hardware is present.*/
|
sl@0
|
146 |
WAVEHDR** iPendingBufList;
|
sl@0
|
147 |
/** Set when no audio hardware is present. */
|
sl@0
|
148 |
TBool iIsHardware;
|
sl@0
|
149 |
/** The direction of the windows waveform audio buffer, record or playback. */
|
sl@0
|
150 |
TSoundDirection iDirection;
|
sl@0
|
151 |
};
|
sl@0
|
152 |
|
sl@0
|
153 |
/**
|
sl@0
|
154 |
The WINS physical device (factory class) for the shared chunk sound driver.
|
sl@0
|
155 |
*/
|
sl@0
|
156 |
class DWinsSoundScPddFactory : public DPhysicalDevice
|
sl@0
|
157 |
{
|
sl@0
|
158 |
public:
|
sl@0
|
159 |
DWinsSoundScPddFactory();
|
sl@0
|
160 |
~DWinsSoundScPddFactory();
|
sl@0
|
161 |
virtual TInt Install();
|
sl@0
|
162 |
virtual void GetCaps(TDes8 &aDes) const;
|
sl@0
|
163 |
virtual TInt Create(DBase*& aChannel, TInt aUnit, const TDesC8* anInfo, const TVersion &aVer);
|
sl@0
|
164 |
virtual TInt Validate(TInt aUnit, const TDesC8* anInfo, const TVersion &aVer);
|
sl@0
|
165 |
private:
|
sl@0
|
166 |
/** The DFC queue (used also by the LDD). */
|
sl@0
|
167 |
TDynamicDfcQue* iDfcQ;
|
sl@0
|
168 |
/** DFC for terminating the DFC thread. */
|
sl@0
|
169 |
static TDfc ExitDfc;
|
sl@0
|
170 |
friend class DWinsSoundScTxPdd;
|
sl@0
|
171 |
friend class DWinsSoundScRxPdd;
|
sl@0
|
172 |
};
|
sl@0
|
173 |
|
sl@0
|
174 |
/**
|
sl@0
|
175 |
The WINS physical device driver (PDD) for the playback shared chunk sound driver.
|
sl@0
|
176 |
*/
|
sl@0
|
177 |
class DWinsSoundScTxPdd : public DSoundScPdd
|
sl@0
|
178 |
{
|
sl@0
|
179 |
private:
|
sl@0
|
180 |
enum TThreadCommand {ESendData, EStop, EExit, EPause, EResume};
|
sl@0
|
181 |
enum TCreatePlayDeviceMode {EInit,ESetConfig,EStartTransfer};
|
sl@0
|
182 |
public:
|
sl@0
|
183 |
DWinsSoundScTxPdd();
|
sl@0
|
184 |
~DWinsSoundScTxPdd();
|
sl@0
|
185 |
TInt DoCreate(DWinsSoundScPddFactory* aPhysicalDevice);
|
sl@0
|
186 |
// Implementations of the pure virtual functions inherited from DSoundScPdd.
|
sl@0
|
187 |
virtual TDfcQue* DfcQ(TInt aUnit);
|
sl@0
|
188 |
virtual void GetChunkCreateInfo(TChunkCreateInfo& aChunkCreateInfo);
|
sl@0
|
189 |
virtual void Caps(TDes8& aCapsBuf) const;
|
sl@0
|
190 |
virtual TInt MaxTransferLen() const;
|
sl@0
|
191 |
virtual TInt SetConfig(const TDesC8& aConfigBuf);
|
sl@0
|
192 |
virtual TInt SetVolume(TInt aVolume);
|
sl@0
|
193 |
virtual TInt StartTransfer();
|
sl@0
|
194 |
virtual TInt TransferData(TUint aTransferID,TLinAddr aLinAddr,TPhysAddr aPhysAddr,TInt aNumBytes);
|
sl@0
|
195 |
virtual void StopTransfer();
|
sl@0
|
196 |
virtual TInt PauseTransfer();
|
sl@0
|
197 |
virtual TInt ResumeTransfer();
|
sl@0
|
198 |
virtual TInt PowerUp();
|
sl@0
|
199 |
virtual void PowerDown();
|
sl@0
|
200 |
virtual TInt CustomConfig(TInt aFunction,TAny* aParam);
|
sl@0
|
201 |
virtual TInt TimeTransferred(TInt64& aTime, TInt aState);
|
sl@0
|
202 |
public:
|
sl@0
|
203 |
void WaveOutProc(WAVEHDR* aHdr);
|
sl@0
|
204 |
void PlayThread();
|
sl@0
|
205 |
private:
|
sl@0
|
206 |
void SetCaps();
|
sl@0
|
207 |
TInt OpenWaveOutDevice();
|
sl@0
|
208 |
TInt CreatePlayDevice(TCreatePlayDeviceMode aMode);
|
sl@0
|
209 |
void ClosePlayDevice();
|
sl@0
|
210 |
void PlayThreadCommand(TThreadCommand aCommand,TInt aArg0=0,TInt aArg1=0,TInt aArg2=0);
|
sl@0
|
211 |
TInt ProcessPlayCommand(TThreadCommand aCommand,TInt aArg0,TInt aArg1,TInt aArg2);
|
sl@0
|
212 |
void HandlePlayTimerEvent();
|
sl@0
|
213 |
void HandleTransferComplete();
|
sl@0
|
214 |
void PlayThreadNotifyDriver(TInt aError);
|
sl@0
|
215 |
void StartTimer(WAVEHDR* aBuffer);
|
sl@0
|
216 |
void StopTimer(TBool aCancelAll);
|
sl@0
|
217 |
static void PlayDfc(TAny* aPtr);
|
sl@0
|
218 |
private:
|
sl@0
|
219 |
/** A pointer to the PDD factory. */
|
sl@0
|
220 |
DWinsSoundScPddFactory* iPhysicalDevice;
|
sl@0
|
221 |
/** The capabilities of this device. */
|
sl@0
|
222 |
TSoundFormatsSupportedV02 iCaps;
|
sl@0
|
223 |
/** The current audio configuration of this device. */
|
sl@0
|
224 |
TCurrentSoundFormatV02 iSoundConfig;
|
sl@0
|
225 |
/** The current setting for the play volume - a value in the range 0 to 0xFFFF. */
|
sl@0
|
226 |
TInt iVolume;
|
sl@0
|
227 |
/** The driver thread semaphore - used by the windows thread to signal the driver thread. */
|
sl@0
|
228 |
HANDLE iDriverThreadSem;
|
sl@0
|
229 |
/** The handle for the play windows thread. */
|
sl@0
|
230 |
HANDLE iPlayThread;
|
sl@0
|
231 |
/** ETrue if the Windows thread is running, else EFalse. Used when shutting down to decide whether to
|
sl@0
|
232 |
signal the thread to exit. */
|
sl@0
|
233 |
TBool iPlayThreadRunning;
|
sl@0
|
234 |
/** The play thread mutuex - to serialise acccess to the play thread creation and destruction routines. */
|
sl@0
|
235 |
HANDLE iPlayThreadMutex;
|
sl@0
|
236 |
/** The play thread semaphore - indicates to the windows thread that the driver thread has issued a command. */
|
sl@0
|
237 |
HANDLE iPlayThreadSem;
|
sl@0
|
238 |
/** Semaphore to synchronise between driver thread and windows thread when closing the output device. */
|
sl@0
|
239 |
HANDLE iStopSemaphore;
|
sl@0
|
240 |
/** Semaphore to synchronise between driver thread and windows thread when closing the PDD. */
|
sl@0
|
241 |
HANDLE iDeathSemaphore;
|
sl@0
|
242 |
/** The handle on the waveform output device. */
|
sl@0
|
243 |
HWAVEOUT iPlayDeviceHandle;
|
sl@0
|
244 |
/** Used to transfer commands between the driver thread and the windows thread. */
|
sl@0
|
245 |
TThreadCommand iPlayCommand;
|
sl@0
|
246 |
/** Used to transfer commands between the driver thread and the windows thread. */
|
sl@0
|
247 |
TInt iPlayCommandArg0;
|
sl@0
|
248 |
/** Used to transfer commands between the driver thread and the windows thread. */
|
sl@0
|
249 |
TInt iPlayCommandArg1;
|
sl@0
|
250 |
/** Used to transfer commands between the driver thread and the windows thread. */
|
sl@0
|
251 |
TInt iPlayCommandArg2;
|
sl@0
|
252 |
// The number of outstanding data transfers on the waveform output device. */
|
sl@0
|
253 |
TInt iPendingPlay;
|
sl@0
|
254 |
/** DFC which handes data block play completion. */
|
sl@0
|
255 |
TDfc iDfc;
|
sl@0
|
256 |
/** A variable used to pass a value from the windows thread to the driver thread. */
|
sl@0
|
257 |
TInt iPlayThreadError;
|
sl@0
|
258 |
/** The windows waveform audio buffer manager. */
|
sl@0
|
259 |
TWaveformBufMgr* iWaveformBufMgr;
|
sl@0
|
260 |
/** A mask used to pass information on transfers that have just completed between the window thread and the
|
sl@0
|
261 |
driver thread. Updates to this variable typically need to happen atomically. Bit positions are converted
|
sl@0
|
262 |
into windows waveform audio buffer IDs. */
|
sl@0
|
263 |
TUint32 iCompletedPlayBufHdrMask;
|
sl@0
|
264 |
/** Set when no audio hardware is present. */
|
sl@0
|
265 |
TBool iNoHardware;
|
sl@0
|
266 |
/** The timer event object - indicates the 'no-hardware' timer has gone off. */
|
sl@0
|
267 |
HANDLE iPlayTimerEvent;
|
sl@0
|
268 |
/** The identifier for the current 'no-hardware' timer event. */
|
sl@0
|
269 |
UINT iTimerID;
|
sl@0
|
270 |
/** Indicates whether the 'no-hardware' timer is currently active. */
|
sl@0
|
271 |
TBool iTimerActive;
|
sl@0
|
272 |
/** A variable used to save the play volume setting of the waveform output device at the point when this driver was opened. */
|
sl@0
|
273 |
DWORD iWinWaveVolume;
|
sl@0
|
274 |
/** The number of bytes (not samples) that will be played back per second, at the current sample rate. */
|
sl@0
|
275 |
TUint iBytesPerSecond;
|
sl@0
|
276 |
/** The simulated (ie. no hardware) microseconds played. */
|
sl@0
|
277 |
TInt64 iSimulatedUSecPlayed;
|
sl@0
|
278 |
/** The # of milliseconds that pass per block of data that is played. */
|
sl@0
|
279 |
UINT iSimulatedMsecDuration;
|
sl@0
|
280 |
/** The Windows system timer time at which the last block of data was played. */
|
sl@0
|
281 |
DWORD iLastTimerEventTime;
|
sl@0
|
282 |
/** The Windows system timer time at which playback was paused. */
|
sl@0
|
283 |
DWORD iPauseTime;
|
sl@0
|
284 |
};
|
sl@0
|
285 |
|
sl@0
|
286 |
/**
|
sl@0
|
287 |
The WINS physical device driver (PDD) for the record shared chunk sound driver.
|
sl@0
|
288 |
*/
|
sl@0
|
289 |
class DWinsSoundScRxPdd : public DSoundScPdd
|
sl@0
|
290 |
{
|
sl@0
|
291 |
private:
|
sl@0
|
292 |
enum TThreadCommand {ERecData, EStop, EExit, EPause, EResume};
|
sl@0
|
293 |
public:
|
sl@0
|
294 |
DWinsSoundScRxPdd();
|
sl@0
|
295 |
~DWinsSoundScRxPdd();
|
sl@0
|
296 |
TInt DoCreate(DWinsSoundScPddFactory* aPhysicalDevice);
|
sl@0
|
297 |
// Implementations of the pure virtual functions inherited from DSoundScPdd.
|
sl@0
|
298 |
virtual TDfcQue* DfcQ(TInt aUnit);
|
sl@0
|
299 |
virtual void GetChunkCreateInfo(TChunkCreateInfo& aChunkCreateInfo);
|
sl@0
|
300 |
virtual void Caps(TDes8& aCapsBuf) const;
|
sl@0
|
301 |
virtual TInt MaxTransferLen() const;
|
sl@0
|
302 |
virtual TInt SetConfig(const TDesC8& aConfigBuf);
|
sl@0
|
303 |
virtual TInt SetVolume(TInt aVolume);
|
sl@0
|
304 |
virtual TInt StartTransfer();
|
sl@0
|
305 |
virtual TInt TransferData(TUint aTransferID,TLinAddr aLinAddr,TPhysAddr aPhysAddr,TInt aNumBytes);
|
sl@0
|
306 |
virtual void StopTransfer();
|
sl@0
|
307 |
virtual TInt PauseTransfer();
|
sl@0
|
308 |
virtual TInt ResumeTransfer();
|
sl@0
|
309 |
virtual TInt PowerUp();
|
sl@0
|
310 |
virtual void PowerDown();
|
sl@0
|
311 |
virtual TInt CustomConfig(TInt aFunction,TAny* aParam);
|
sl@0
|
312 |
virtual TInt TimeTransferred(TInt64& aTime, TInt aState);
|
sl@0
|
313 |
public:
|
sl@0
|
314 |
void WaveInProc(WAVEHDR* aHdr);
|
sl@0
|
315 |
void RecordThread();
|
sl@0
|
316 |
private:
|
sl@0
|
317 |
void SetCaps();
|
sl@0
|
318 |
TInt OpenWaveInDevice();
|
sl@0
|
319 |
TInt CreateRecordDevice(TBool aCheckDevice=EFalse);
|
sl@0
|
320 |
void CloseRecordDevice();
|
sl@0
|
321 |
void RecordThreadCommand(TThreadCommand aCommand,TInt aArg0=0,TInt aArg1=0,TInt aArg2=0);
|
sl@0
|
322 |
TInt ProcessRecordCommand(TThreadCommand aCommand,TInt aArg0,TInt aArg1,TInt aArg2);
|
sl@0
|
323 |
void HandleRecordTimerEvent();
|
sl@0
|
324 |
void HandleTransferComplete();
|
sl@0
|
325 |
void RecordThreadNotifyDriver(TInt aError);
|
sl@0
|
326 |
void StartTimer(WAVEHDR* aBuffer);
|
sl@0
|
327 |
void StopTimer(TBool aCancelAll);
|
sl@0
|
328 |
static void RecordDfc(TAny* aPtr);
|
sl@0
|
329 |
private:
|
sl@0
|
330 |
/** A pointer to the PDD factory. */
|
sl@0
|
331 |
DWinsSoundScPddFactory* iPhysicalDevice;
|
sl@0
|
332 |
/** The capabilities of this device. */
|
sl@0
|
333 |
TSoundFormatsSupportedV02 iCaps;
|
sl@0
|
334 |
/** The current audio configuration of this device. */
|
sl@0
|
335 |
TCurrentSoundFormatV02 iSoundConfig;
|
sl@0
|
336 |
/** The driver thread semaphore - used by the windows thread to signal the driver thread. */
|
sl@0
|
337 |
HANDLE iDriverThreadSem;
|
sl@0
|
338 |
/** The handle for the record windows thread. */
|
sl@0
|
339 |
HANDLE iRecordThread;
|
sl@0
|
340 |
/** ETrue if the Windows thread is running, else EFalse. Used when shutting down to decide whether to
|
sl@0
|
341 |
signal the thread to exit. */
|
sl@0
|
342 |
TBool iRecordThreadRunning;
|
sl@0
|
343 |
/** The record thread mutuex - to serialise acccess to the record thread creation and destruction routines. */
|
sl@0
|
344 |
HANDLE iRecordThreadMutex;
|
sl@0
|
345 |
/** The record thread semaphore - indicates to the windows thread that the driver thread has issued a command. */
|
sl@0
|
346 |
HANDLE iRecordThreadSem;
|
sl@0
|
347 |
/** Semaphore to synchronise between driver thread and windows thread when closing the input device. */
|
sl@0
|
348 |
HANDLE iStopSemaphore;
|
sl@0
|
349 |
/** Semaphore to synchronise between driver thread and windows thread when closing the PDD. */
|
sl@0
|
350 |
HANDLE iDeathSemaphore;
|
sl@0
|
351 |
/** The handle on the waveform input device. */
|
sl@0
|
352 |
HWAVEIN iRecordDeviceHandle;
|
sl@0
|
353 |
/** Used to transfer commands between the driver thread and the windows thread. */
|
sl@0
|
354 |
TThreadCommand iRecordCommand;
|
sl@0
|
355 |
/** Used to transfer commands between the driver thread and the windows thread. */
|
sl@0
|
356 |
TInt iRecordCommandArg0;
|
sl@0
|
357 |
/** Used to transfer commands between the driver thread and the windows thread. */
|
sl@0
|
358 |
TInt iRecordCommandArg1;
|
sl@0
|
359 |
/** Used to transfer commands between the driver thread and the windows thread. */
|
sl@0
|
360 |
TInt iRecordCommandArg2;
|
sl@0
|
361 |
// The number of outstanding data transfers on the waveform input device. */
|
sl@0
|
362 |
TInt iPendingRecord;
|
sl@0
|
363 |
/** DFC which handes data block record completion. */
|
sl@0
|
364 |
TDfc iDfc;
|
sl@0
|
365 |
/** A variable used to pass a value from the windows thread to the driver thread. */
|
sl@0
|
366 |
TInt iRecordThreadError;
|
sl@0
|
367 |
/** The windows waveform audio buffer manager. */
|
sl@0
|
368 |
TWaveformBufMgr* iWaveformBufMgr;
|
sl@0
|
369 |
/** A mask used to pass information on transfers that have just completed between the window thread and the
|
sl@0
|
370 |
driver thread. Updates to this variable typically need to happen atomically. Bit positions are converted
|
sl@0
|
371 |
into windows waveform audio buffer IDs. */
|
sl@0
|
372 |
TUint32 iCompletedRecordBufHdrMask;
|
sl@0
|
373 |
/** Indicates when record mode is enabled. */
|
sl@0
|
374 |
TBool iRecordEnabled;
|
sl@0
|
375 |
/** Set when no audio hardware is present. */
|
sl@0
|
376 |
TBool iNoHardware;
|
sl@0
|
377 |
/** The timer event object - indicates the 'no-hardware' timer has gone off. */
|
sl@0
|
378 |
HANDLE iRecordTimerEvent;
|
sl@0
|
379 |
/** The identifier for the current 'no-hardware' timer event. */
|
sl@0
|
380 |
UINT iTimerID;
|
sl@0
|
381 |
/** Indicates whether the 'no-hardware' timer is currently active. */
|
sl@0
|
382 |
TBool iTimerActive;
|
sl@0
|
383 |
/** The number of bytes (not samples) that will be recorded back per second, at the current sample rate. */
|
sl@0
|
384 |
TUint iBytesPerSecond;
|
sl@0
|
385 |
/** The number of bytes recorded before the last pause command (when we pause the windows byte
|
sl@0
|
386 |
count is reset so we need to add this on for the TimeRecorded API). */
|
sl@0
|
387 |
TUint iBytesRecordedBeforeLastPause;
|
sl@0
|
388 |
/** The number of recorded bytes reported to the LDD. Subtracted from the windows recorded byte count
|
sl@0
|
389 |
to calculate the last, partial buffer, transfer size */
|
sl@0
|
390 |
TUint iBytesSincePauseReportedToLdd;
|
sl@0
|
391 |
/** The # of milliseconds that pass per block of data that is recorded. */
|
sl@0
|
392 |
UINT iSimulatedMsecDuration;
|
sl@0
|
393 |
/** The Windows system timer time at which the last block of data was recorded. */
|
sl@0
|
394 |
DWORD iLastTimerEventTime;
|
sl@0
|
395 |
};
|
sl@0
|
396 |
|
sl@0
|
397 |
#define __HOST_LOCK THostLock lock
|
sl@0
|
398 |
#define __HOST_LOCK_ON lock.Lock();
|
sl@0
|
399 |
#define __HOST_LOCK_OFF lock.Unlock();
|
sl@0
|
400 |
#define __COND_HOST_LOCK TCondHostLock lock
|
sl@0
|
401 |
|
sl@0
|
402 |
#endif /* __WINSSOUNDSC_H__ */
|