renderers (interlace and stuff)
[picodrive.git] / platform / uiq3 / engine / audio_mediaserver.h
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
18 #include <Mda\Common\Audio.h>\r
19 #include <MdaAudioOutputStream.h>\r
20 \r
21 //#include "audio.h"\r
22 #include "polledas.h"\r
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
47         void ChangeVolume(TInt aUp);\r
48 \r
49 public:\r
50         ~CGameAudioMS();\r
51         CGameAudioMS(TInt aRate, TBool aStereo, TInt aWritesPerSec);\r
52         static CGameAudioMS* NewL(TInt aRate, TBool aStereo, TInt aWritesPerSec);\r
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
73         TInt                                    iWritesPerSec;\r
74         TInt                                    iBufferedFrames;\r
75         TInt16*                                 iCurrentPosition;\r
76         TInt                                    iCurrentBuffer;\r
77         TInt                                    iCurrentBufferSize;\r
78         TInt                                    iFrameCount;\r
79         CMdaServer*                             iServer;\r
80 \r
81         TInt64                                  iTime;\r
82         TInt                                    iVolume;\r
83 };\r
84 \r
85 #endif                  /* __AUDIO_MEDIASERVER_H */\r