cc68a136 |
1 | /*******************************************************************\r |
2 | *\r |
3 | * File: Audio_mediaserver.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 |
ca482e5d |
18 | #include <mda/common/audio.h>\r |
19 | #include <mdaaudiooutputstream.h>\r |
cc68a136 |
20 | \r |
21 | //#include "audio.h"\r |
ca482e5d |
22 | #include "PolledAS.h"\r |
cc68a136 |
23 | \r |
24 | const TInt KSoundBuffers = 4;\r |
25 | \r |
26 | \r |
27 | class TGameAudioEventListener : public MMdaAudioOutputStreamCallback\r |
28 | {\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 |
33 | \r |
34 | TBool iIsOpen;\r |
35 | // TBool iHasCopied;\r |
36 | TInt iUnderflowed;\r |
37 | TInt iLastError;\r |
38 | };\r |
39 | \r |
40 | \r |
41 | class CGameAudioMS // : public IGameAudio // IGameAudio MUST be specified first!\r |
42 | {\r |
43 | public: // implements IGameAudio\r |
44 | TInt16 *NextFrameL(TInt aPcmFrames);\r |
45 | TInt16 *ResumeL();\r |
46 | void Pause();\r |
ca482e5d |
47 | TInt ChangeVolume(TInt aUp);\r |
cc68a136 |
48 | \r |
49 | public:\r |
50 | ~CGameAudioMS();\r |
ca482e5d |
51 | CGameAudioMS(TInt aRate, TBool aStereo, TInt aWritesPerSec, TInt aVolume);\r |
52 | static CGameAudioMS* NewL(TInt aRate, TBool aStereo, TInt aWritesPerSec, TInt aVolume);\r |
cc68a136 |
53 | \r |
54 | protected:\r |
55 | void WriteBlockL();\r |
56 | void UnderflowedL();\r |
57 | void ConstructL();\r |
58 | \r |
59 | protected:\r |
60 | void WaitForOpenToCompleteL();\r |
61 | \r |
62 | TInt iRate;\r |
63 | TBool iStereo;\r |
64 | \r |
65 | CMdaAudioOutputStream *iMdaAudioOutputStream;\r |
66 | TMdaAudioDataSettings iMdaAudioDataSettings;\r |
67 | \r |
68 | TGameAudioEventListener iListener;\r |
69 | \r |
70 | CPolledActiveScheduler *iScheduler;\r |
71 | \r |
72 | HBufC8* iSoundBuffers[KSoundBuffers];\r |
ca482e5d |
73 | TInt iWritesPerSec; // fps, may be more actual writes\r |
74 | TInt iMaxWriteSamples; // max samples per write\r |
cc68a136 |
75 | TInt16* iCurrentPosition;\r |
ca482e5d |
76 | TInt iCurrentBuffer; // active buffer\r |
77 | TInt iCurrentBufferSize; // bytes filled in buffer\r |
78 | TInt iBufferSize;\r |
cc68a136 |
79 | CMdaServer* iServer;\r |
80 | \r |
81 | TInt64 iTime;\r |
82 | TInt iVolume;\r |
83 | };\r |
84 | \r |
85 | #endif /* __AUDIO_MEDIASERVER_H */\r |