Big cleanup part 1.
[SDL.s60v3.git] / src / audio / symbian / streamplayer.h
blob4083fecbeb2d32cc6429ed8b978c4827a9ec0888
1 #ifndef STREAMPLAYER_H
2 #define STREAMPLAYER_H
4 #include<mdaaudiooutputstream.h>
6 const TInt KSilenceBuffer = 256;
8 class MStreamObs
10 public:
11 enum
13 EInit,
14 EPlay,
15 EWrite,
16 EClose,
18 virtual void Complete(TInt aState, TInt aError) = 0;
21 class MStreamProvider
23 public:
24 virtual TPtrC8 Data() = 0;
27 NONSHARABLE_CLASS(CStreamPlayer) : public CBase, public MMdaAudioOutputStreamCallback
29 public:
30 CStreamPlayer(MStreamProvider& aProvider, MStreamObs& aObs);
31 ~CStreamPlayer();
32 void ConstructL();
34 static TInt ClosestSupportedRate(TInt aRate);
36 TInt OpenStream(TInt aRate, TInt aChannels, TUint32 aType = KMMFFourCCCodePCM16);
38 void SetVolume(TInt aNew);
39 TInt Volume() const;
40 TInt MaxVolume() const;
42 void Stop();
43 void Start();
44 void Open();
45 void Close();
47 TBool Playing() const;
48 TBool Closed() const;
50 private:
52 void MaoscOpenComplete(TInt aError) ;
53 void MaoscBufferCopied(TInt aError, const TDesC8& aBuffer);
54 void MaoscPlayComplete(TInt aError);
56 void Request();
57 void SetCapsL();
59 MStreamProvider& iProvider;
60 MStreamObs& iObs;
61 TInt iVolume;
63 CMdaAudioOutputStream* iStream;
65 TInt iRate;
66 TInt iChannels;
67 TUint32 iType;
69 enum
71 ENone = 0,
72 EInited = 0x1,
73 EStarted = 0x2,
74 EStopped = 0x4,
75 EVolumeChange = 0x8,
76 EDied = 0x10
79 TInt iState;
80 TBuf8<KSilenceBuffer> iSilence;
81 TPtrC8 iPtr;
84 #endif