1 /*******************************************************************
\r
3 * File: Audio_mediaserver.h
\r
5 * Author: Peter van Sebille (peter@yipton.net)
\r
7 * Modified/adapted for picodriveN by notaz, 2006
\r
9 * (c) Copyright 2006, notaz
\r
10 * (c) Copyright 2001, Peter van Sebille
\r
11 * All Rights Reserved
\r
13 *******************************************************************/
\r
15 #ifndef __AUDIO_MEDIASERVER_H
\r
16 #define __AUDIO_MEDIASERVER_H
\r
18 #include <mda/common/audio.h>
\r
19 #include <mdaaudiooutputstream.h>
\r
21 //#include "audio.h"
\r
22 #include "PolledAS.h"
\r
24 const TInt KSoundBuffers = 4;
\r
27 class TGameAudioEventListener : public MMdaAudioOutputStreamCallback
\r
29 public: // implements MMdaAudioOutputStreamCallback
\r
30 void MaoscOpenComplete(TInt aError);
\r
31 void MaoscBufferCopied(TInt aError, const TDesC8& );
\r
32 void MaoscPlayComplete(TInt aError);
\r
35 // TBool iHasCopied;
\r
41 class CGameAudioMS // : public IGameAudio // IGameAudio MUST be specified first!
\r
43 public: // implements IGameAudio
\r
44 TInt16 *NextFrameL(TInt aPcmFrames);
\r
47 TInt ChangeVolume(TInt aUp);
\r
51 CGameAudioMS(TInt aRate, TBool aStereo, TInt aWritesPerSec, TInt aVolume);
\r
52 static CGameAudioMS* NewL(TInt aRate, TBool aStereo, TInt aWritesPerSec, TInt aVolume);
\r
56 void UnderflowedL();
\r
60 void WaitForOpenToCompleteL();
\r
65 CMdaAudioOutputStream *iMdaAudioOutputStream;
\r
66 TMdaAudioDataSettings iMdaAudioDataSettings;
\r
68 TGameAudioEventListener iListener;
\r
70 CPolledActiveScheduler *iScheduler;
\r
72 HBufC8* iSoundBuffers[KSoundBuffers];
\r
73 TInt iWritesPerSec; // fps, may be more actual writes
\r
74 TInt iMaxWriteSamples; // max samples per write
\r
75 TInt16* iCurrentPosition;
\r
76 TInt iCurrentBuffer; // active buffer
\r
77 TInt iCurrentBufferSize; // bytes filled in buffer
\r
79 CMdaServer* iServer;
\r
85 #endif /* __AUDIO_MEDIASERVER_H */
\r