summaryrefslogtreecommitdiff
path: root/apps/plugins/sdl/src/audio/symbian/streamplayer.h
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2017-01-21 15:18:31 -0500
committerFranklin Wei <git@fwei.tk>2017-12-23 21:01:26 -0500
commita855d6202536ff28e5aae4f22a0f31d8f5b325d0 (patch)
tree8c75f224dd64ed360505afa8843d016b0d75000b /apps/plugins/sdl/src/audio/symbian/streamplayer.h
parent01c6dcf6c7b9bb1ad2fa0450f99bacc5f3d3e04b (diff)
downloadrockbox-a855d6202536ff28e5aae4f22a0f31d8f5b325d0.tar.gz
rockbox-a855d6202536ff28e5aae4f22a0f31d8f5b325d0.zip
Port of Duke Nukem 3D
This ports Fabien Sanglard's Chocolate Duke to run on a version of SDL for Rockbox. Change-Id: I8f2c4c78af19de10c1633ed7bb7a997b43256dd9
Diffstat (limited to 'apps/plugins/sdl/src/audio/symbian/streamplayer.h')
-rw-r--r--apps/plugins/sdl/src/audio/symbian/streamplayer.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/apps/plugins/sdl/src/audio/symbian/streamplayer.h b/apps/plugins/sdl/src/audio/symbian/streamplayer.h
new file mode 100644
index 0000000000..8c6e74f920
--- /dev/null
+++ b/apps/plugins/sdl/src/audio/symbian/streamplayer.h
@@ -0,0 +1,89 @@
1#ifndef STREAMPLAYER_H
2#define STREAMPLAYER_H
3
4#include<MdaAudioOutputStream.h>
5
6const TInt KSilenceBuffer = 256;
7
8class 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
21class MStreamProvider
22 {
23 public:
24 virtual TPtrC8 Data() = 0;
25 };
26
27NONSHARABLE_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