Mercurial > sdl-ios-xcode
comparison src/audio/symbian/streamplayer.h @ 3975:e85e65aec22f SDL-1.2
Added S60 port.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Sun, 24 Jun 2007 18:26:35 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
3974:42578e98a295 | 3975:e85e65aec22f |
---|---|
1 #ifndef STREAMPLAYER_H | |
2 #define STREAMPLAYER_H | |
3 | |
4 #include<MdaAudioOutputStream.h> | |
5 | |
6 const TInt KSilenceBuffer = 256; | |
7 | |
8 class MStreamObs | |
9 { | |
10 public: | |
11 enum | |
12 { | |
13 EInit, | |
14 EPlay, | |
15 EWrite, | |
16 EClose, | |
17 }; | |
18 virtual void Complete(TInt aState, TInt aError) = 0; | |
19 }; | |
20 | |
21 class MStreamProvider | |
22 { | |
23 public: | |
24 virtual TPtrC8 Data() = 0; | |
25 }; | |
26 | |
27 NONSHARABLE_CLASS(CStreamPlayer) : public CBase, public MMdaAudioOutputStreamCallback | |
28 { | |
29 public: | |
30 CStreamPlayer(MStreamProvider& aProvider, MStreamObs& aObs); | |
31 ~CStreamPlayer(); | |
32 void ConstructL(); | |
33 | |
34 static TInt ClosestSupportedRate(TInt aRate); | |
35 | |
36 TInt OpenStream(TInt aRate, TInt aChannels, TUint32 aType = KMMFFourCCCodePCM16); | |
37 | |
38 void SetVolume(TInt aNew); | |
39 TInt Volume() const; | |
40 TInt MaxVolume() const; | |
41 | |
42 void Stop(); | |
43 void Start(); | |
44 void Open(); | |
45 void Close(); | |
46 | |
47 TBool Playing() const; | |
48 TBool Closed() const; | |
49 | |
50 private: | |
51 | |
52 void MaoscOpenComplete(TInt aError) ; | |
53 void MaoscBufferCopied(TInt aError, const TDesC8& aBuffer); | |
54 void MaoscPlayComplete(TInt aError); | |
55 | |
56 private: | |
57 void Request(); | |
58 void SetCapsL(); | |
59 | |
60 private: | |
61 MStreamProvider& iProvider; | |
62 MStreamObs& iObs; | |
63 TInt iVolume; | |
64 | |
65 CMdaAudioOutputStream* iStream; | |
66 | |
67 TInt iRate; | |
68 TInt iChannels; | |
69 TUint32 iType; | |
70 | |
71 enum | |
72 { | |
73 ENone = 0, | |
74 EInited = 0x1, | |
75 EStarted = 0x2, | |
76 EStopped = 0x4, | |
77 EVolumeChange = 0x8, | |
78 EDied = 0x10 | |
79 }; | |
80 | |
81 TInt iState; | |
82 TBuf8<KSilenceBuffer> iSilence; | |
83 TPtrC8 iPtr; | |
84 | |
85 }; | |
86 | |
87 | |
88 #endif | |
89 |