| 1 | /*******************************************************************\r |
| 2 | *\r |
| 3 | * File: Audio_motorola.h\r |
| 4 | *\r |
| 5 | * Author: Peter van Sebille (peter@yipton.net)\r |
| 6 | *\r |
| 7 | * Modified/adapted for picodriveN by notaz, 2006\r |
| 8 | *\r |
| 9 | * (c) Copyright 2006, notaz\r |
| 10 | * (c) Copyright 2001, Peter van Sebille\r |
| 11 | * All Rights Reserved\r |
| 12 | *\r |
| 13 | *******************************************************************/\r |
| 14 | \r |
| 15 | #ifndef __AUDIO_MEDIASERVER_H\r |
| 16 | #define __AUDIO_MEDIASERVER_H\r |
| 17 | \r |
| 18 | #include <cmaudiofb.h>\r |
| 19 | \r |
| 20 | #include "audio.h"\r |
| 21 | #include "polledas.h"\r |
| 22 | \r |
| 23 | const TInt KSoundBuffers = 8;\r |
| 24 | const TInt KMaxUnderflows = 20; // max underflows/API errors we are going allow in a row (to prevent lockups)\r |
| 25 | \r |
| 26 | \r |
| 27 | class TGameAudioEventListener : public MMAudioFBObserver, public MMAudioACObserver\r |
| 28 | {\r |
| 29 | public:\r |
| 30 | // Implementation of MMAudioFBObserver\r |
| 31 | void OnEvent(TMAudioFBCallbackState aState, TInt aError);\r |
| 32 | void OnEvent(TMAudioFBCallbackState aState, TInt aError, TDes8* aBuffer);\r |
| 33 | // Implementation of MMAudioACObserver\r |
| 34 | void OnEvent(TMAudioACCallbackState aState, TInt aError);\r |
| 35 | \r |
| 36 | TBool iIsOpen;\r |
| 37 | TBool iIsCtrlOpen;\r |
| 38 | // TBool iHasCopied;\r |
| 39 | TInt iUnderflowed;\r |
| 40 | TBool iFatalError;\r |
| 41 | };\r |
| 42 | \r |
| 43 | \r |
| 44 | class CGameAudioMot : public IGameAudio // IGameAudio MUST be specified first!\r |
| 45 | {\r |
| 46 | public: // implements IGameAudio\r |
| 47 | TInt16 *NextFrameL();\r |
| 48 | TInt16 *DupeFrameL(TInt &aUnderflowed);\r |
| 49 | TInt16 *ResumeL();\r |
| 50 | void Pause();\r |
| 51 | void ChangeVolume(TInt aUp);\r |
| 52 | \r |
| 53 | public:\r |
| 54 | ~CGameAudioMot();\r |
| 55 | CGameAudioMot(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames);\r |
| 56 | void ConstructL();\r |
| 57 | EXPORT_C static CGameAudioMot* NewL(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames);\r |
| 58 | \r |
| 59 | protected:\r |
| 60 | void WriteBlockL();\r |
| 61 | void UnderflowedL();\r |
| 62 | \r |
| 63 | protected:\r |
| 64 | void WaitForOpenToCompleteL();\r |
| 65 | \r |
| 66 | TInt iRate;\r |
| 67 | TBool iStereo;\r |
| 68 | \r |
| 69 | CMAudioFB *iAudioOutputStream;\r |
| 70 | CMAudioAC *iAudioControl;\r |
| 71 | TMAudioFBBufSettings iSettings;\r |
| 72 | \r |
| 73 | TGameAudioEventListener iListener;\r |
| 74 | \r |
| 75 | CPolledActiveScheduler *iScheduler;\r |
| 76 | \r |
| 77 | HBufC8* iSoundBuffers[KSoundBuffers+1];\r |
| 78 | TPtr8* iSoundBufferPtrs[KSoundBuffers+1];\r |
| 79 | \r |
| 80 | TInt iBufferedFrames;\r |
| 81 | TInt16* iCurrentPosition;\r |
| 82 | TInt iCurrentBuffer;\r |
| 83 | TInt iFrameCount;\r |
| 84 | TInt iPcmFrames;\r |
| 85 | \r |
| 86 | TBool iDecoding;\r |
| 87 | \r |
| 88 | //TInt64 iTime; // removed because can't test\r |
| 89 | };\r |
| 90 | \r |
| 91 | #endif /* __AUDIO_MEDIASERVER_H */\r |