|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Audio stream test component |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef OUTPUT_STREAMER_H |
|
20 #define OUTPUT_STREAMER_H |
|
21 |
|
22 //#include <StifTestInterface.h> |
|
23 #include <MdaAudioOutputStream.h> |
|
24 #include <StifLogger.h> |
|
25 #include "mda/common/audio.h" |
|
26 //#include "EventTarget.h" |
|
27 #include "StreamerBase.h" |
|
28 //#include "AudioDataSettingsParams.h" |
|
29 //#include "OutputPrinter.h" |
|
30 |
|
31 class COutputStreamer : public CStreamerBase , public MMdaAudioOutputStreamCallback // , public MEventTarget |
|
32 { |
|
33 private: |
|
34 COutputStreamer(CStifLogger *aLogger); |
|
35 void Exit(TInt aExitCode); |
|
36 void ConstructL(); |
|
37 void ConstructL(TInt aPriority, TMdaPriorityPreference aPref); |
|
38 |
|
39 public: |
|
40 // Standard two-phase construction |
|
41 static COutputStreamer* NewL(CStifLogger *aLogger, TInt aId=0); |
|
42 static COutputStreamer* NewLC(CStifLogger *aLogger, TInt aId=0); |
|
43 static COutputStreamer* NewL(TInt aPriority, TMdaPriorityPreference aPref, |
|
44 CStifLogger *aLogger, TInt aId=0); |
|
45 static COutputStreamer* NewLC(TInt aPriority, TMdaPriorityPreference aPref, |
|
46 CStifLogger *aLogger, TInt aId=0); |
|
47 |
|
48 ~COutputStreamer(); |
|
49 |
|
50 void SetAudioPropertiesL(TInt aSampleRate, TInt aChannels); |
|
51 void SetVolume(TInt Volume); |
|
52 TInt GetVolume(); |
|
53 TInt GetMaxVolume(); |
|
54 |
|
55 void SetPriority(TInt aPriority, TMdaPriorityPreference aPref); |
|
56 TInt GetBalanceL(); |
|
57 void SetBalanceL(TInt aBalance); |
|
58 void Stop(); |
|
59 TFourCC GetDataType(); |
|
60 void SetDataTypeL(TFourCC aAudioType); |
|
61 |
|
62 void AdoptBuffers(RPointerArray<TDes8> &aBuffers ); |
|
63 void StartPlayback(TMdaPackage *aSettings); |
|
64 RArray<TInt> &COutputStreamer::GetBufferErrors(); |
|
65 void SetIsClosedLoop(TBool=EFalse); |
|
66 TInt DesToBuffers(TDes8 &aDes); |
|
67 |
|
68 TInt ExecuteL(CParameters *aParams); |
|
69 |
|
70 TInt AppendWriteBuffer(HBufC8 *aBuffer); |
|
71 TInt LoadAudioFileL(const TFileName &aFileName); |
|
72 |
|
73 // iherited from MMdaAudioOutputStreamCallback |
|
74 void MaoscOpenComplete(TInt aError); |
|
75 void MaoscBufferCopied(TInt aError, const TDesC8 &aBuffer); |
|
76 void MaoscPlayComplete(TInt aError); |
|
77 |
|
78 public: |
|
79 static const TInt KPlayerActionPlay; |
|
80 static const TInt KPlayerActionStop; |
|
81 |
|
82 private: |
|
83 CMdaAudioOutputStream *iMdaAudioOutputStream; |
|
84 RArray<TInt> iArrBufferErrors; |
|
85 TBool iAlreadyClosed; |
|
86 TBool iPlaybackStopped; |
|
87 |
|
88 RPointerArray<HBufC8> iWriteBuffers; |
|
89 |
|
90 protected: |
|
91 }; |
|
92 |
|
93 #endif // OUTPUT_STREAMER_H |