|
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 INPUT_STREAMER_H |
|
20 #define INPUT_STREAMER_H |
|
21 |
|
22 //#include <StifTestInterface.h> |
|
23 #include <MdaAudioInputStream.h> |
|
24 #include <StifLogger.h> |
|
25 #include "mda/common/audio.h" |
|
26 #include "EventTarget.h" |
|
27 #include "StreamerBase.h" |
|
28 |
|
29 class CInputStreamer : public CStreamerBase , public MMdaAudioInputStreamCallback |
|
30 { |
|
31 private: |
|
32 CInputStreamer(CStifLogger *aLogger); |
|
33 void ConstructL(); |
|
34 void ConstructL(TInt aPriority, TMdaPriorityPreference aPref); |
|
35 |
|
36 public: |
|
37 // Standard two-phase construction |
|
38 static CInputStreamer* NewL(CStifLogger *aLogger, TInt aId=0); |
|
39 static CInputStreamer* NewLC(CStifLogger *aLogger, TInt aId=0); |
|
40 |
|
41 static CInputStreamer* NewL(TInt aPriority, TMdaPriorityPreference aPref, |
|
42 CStifLogger *aLogger, TInt aId=0); |
|
43 static CInputStreamer* NewLC(TInt aPriority, TMdaPriorityPreference aPref, |
|
44 CStifLogger *aLogger, TInt aId=0); |
|
45 |
|
46 ~CInputStreamer(); |
|
47 |
|
48 void SetAudioPropertiesL(TInt aSampleRate, TInt aChannels); |
|
49 void SetPriority(TInt aPriority, TMdaPriorityPreference aPref); |
|
50 TInt GetBalanceL(); |
|
51 void SetBalanceL(TInt aBalance); |
|
52 void SetGain(const TInt aNewGain); |
|
53 TInt GetMaxGain(); |
|
54 TInt GetGain(); |
|
55 void SetDataTypeL(TFourCC aDataType); |
|
56 TFourCC GetDataType(); |
|
57 void GetSupportedBitRatesL(RArray<TInt>& aSupportedBitRates); |
|
58 TInt BitRateL(); |
|
59 void SetBitRateL(TInt aBitRate); |
|
60 |
|
61 void Stop(); |
|
62 |
|
63 RPointerArray<TDes8> &GetBuffers(); |
|
64 void StartRecording(); |
|
65 |
|
66 TInt ExecuteL(CParameters *aParams); |
|
67 void Exit(TInt aExitCode); |
|
68 void SetSettings(TMdaPackage *aSettings); |
|
69 //void SetExitAfterOpen(TBool aFlag); |
|
70 |
|
71 // iherited from MMdaAudioInputStreamCallback |
|
72 void MaiscOpenComplete(TInt aError); |
|
73 void MaiscBufferCopied(TInt aError, const TDesC8& aBuffer); |
|
74 void MaiscRecordComplete(TInt aError); |
|
75 |
|
76 public: |
|
77 static const TInt KRecorderActionStop; |
|
78 static const TInt KSchedulerStop; |
|
79 private: |
|
80 CMdaAudioInputStream *iMdaAudioInputStream; |
|
81 TBool iAlreadyClosed; |
|
82 TBool iRecording; |
|
83 //TBool iExitAfterOpen; |
|
84 enum TState |
|
85 { |
|
86 EClosed, |
|
87 EFirstOpenSuccessful, |
|
88 EOpen, |
|
89 EPlaying, |
|
90 ERecording, |
|
91 EStopped |
|
92 }; |
|
93 TState iState; |
|
94 TMdaPackage *iSettings; |
|
95 }; |
|
96 |
|
97 #endif //INPUT_STREAMER_H |