Allow conditional audio device disabling.
[SDL.s60v3.git] / src / audio / symbian / streamplayer.h
blobe507deb54baaa1a718755aadfc9b9e36b9e7082b
1 #ifndef STREAMPLAYER_H
2 #define STREAMPLAYER_H
4 #include <mdaaudiooutputstream.h>
6 const int KMaxVolume = 256;
8 class MStreamObs
10 public:
11 enum
13 EInit,
14 EPlay,
15 EWrite,
16 EClose,
18 virtual void Complete(int aState, int aError) = 0;
21 class MStreamProvider
23 public:
24 virtual TPtrC8 Data() = 0;
27 class CStreamPlayer : public CBase, public MMdaAudioOutputStreamCallback
29 public:
30 CStreamPlayer(MStreamProvider& aProvider, MStreamObs& aObs);
31 ~CStreamPlayer();
33 static int ClosestSupportedRate(int aRate);
35 int OpenStream(int aRate, int aChannels, TUint32 aType = KMMFFourCCCodePCM16);
37 void SetVolume(int aNew);
39 void Stop();
40 void Start();
41 void Open();
42 void Close();
44 bool Playing() const { return (iState & EInited) && (iState & EStarted); }
45 bool Closed() const { return !(iState & EInited) && !(iState & EDied); }
47 private:
48 void MaoscOpenComplete(int aError);
49 void MaoscBufferCopied(int aError, const TDesC8& aBuffer);
50 void MaoscPlayComplete(int aError);
52 void Request();
54 MStreamProvider& iProvider;
55 MStreamObs& iObs;
56 int iVolume;
58 CMdaAudioOutputStream* iStream;
60 int iRate;
61 int iChannels;
62 TUint32 iType;
64 enum
66 ENone = 0,
67 EInited = 0x1,
68 EStarted = 0x2,
69 EStopped = 0x4,
70 EVolumeChange = 0x8,
71 EDied = 0x10
74 int iState;
75 TPtrC8 iPtr;
78 #endif