sl@0
|
1 |
// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#ifndef __MIDICLIENTUTILITYBODY_H__
|
sl@0
|
17 |
#define __MIDICLIENTUTILITYBODY_H__
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <midiclientutility.h>
|
sl@0
|
20 |
#include <mmf/common/midistandardcustomcommands.h>
|
sl@0
|
21 |
#include <mmf/server/mmffile.h>
|
sl@0
|
22 |
#include <mmf/server/mmfdes.h>
|
sl@0
|
23 |
#include "mmfclientutility.h"
|
sl@0
|
24 |
|
sl@0
|
25 |
|
sl@0
|
26 |
/**
|
sl@0
|
27 |
Mixin class to allow notification that the timed silence has finished.
|
sl@0
|
28 |
*/
|
sl@0
|
29 |
class MRepeatTrailingSilenceTimerObs
|
sl@0
|
30 |
{
|
sl@0
|
31 |
public:
|
sl@0
|
32 |
virtual void RepeatTrailingSilenceTimerComplete() = 0;
|
sl@0
|
33 |
};
|
sl@0
|
34 |
|
sl@0
|
35 |
/**
|
sl@0
|
36 |
CTimer-based active object that waits the requested time before notifying its observer.
|
sl@0
|
37 |
*/
|
sl@0
|
38 |
class CRepeatTrailingSilenceTimer : public CTimer
|
sl@0
|
39 |
{
|
sl@0
|
40 |
public:
|
sl@0
|
41 |
static CRepeatTrailingSilenceTimer* NewL(MRepeatTrailingSilenceTimerObs& aObs);
|
sl@0
|
42 |
void RunL();
|
sl@0
|
43 |
private:
|
sl@0
|
44 |
CRepeatTrailingSilenceTimer(MRepeatTrailingSilenceTimerObs& aObs);
|
sl@0
|
45 |
private:
|
sl@0
|
46 |
MRepeatTrailingSilenceTimerObs& iObs;
|
sl@0
|
47 |
};
|
sl@0
|
48 |
|
sl@0
|
49 |
|
sl@0
|
50 |
class MMidiControllerEventMonitorObserver
|
sl@0
|
51 |
{
|
sl@0
|
52 |
public:
|
sl@0
|
53 |
virtual void HandleMidiEvent(const CMMFMidiEvent& aEvent) = 0;
|
sl@0
|
54 |
};
|
sl@0
|
55 |
|
sl@0
|
56 |
|
sl@0
|
57 |
class CMidiControllerEventMonitor : public CActive
|
sl@0
|
58 |
{
|
sl@0
|
59 |
public:
|
sl@0
|
60 |
static CMidiControllerEventMonitor* NewL(MMidiControllerEventMonitorObserver& aMidiObserver,
|
sl@0
|
61 |
RMidiControllerCustomCommands& aMidiControllerCustomCommands,
|
sl@0
|
62 |
const CMidiClientUtility& aParent);
|
sl@0
|
63 |
~CMidiControllerEventMonitor();
|
sl@0
|
64 |
void Start();
|
sl@0
|
65 |
void SelfComplete(TInt aError);
|
sl@0
|
66 |
private:
|
sl@0
|
67 |
void ConstructL();
|
sl@0
|
68 |
void RunL();
|
sl@0
|
69 |
void DoCancel();
|
sl@0
|
70 |
TInt RunError(TInt aError);
|
sl@0
|
71 |
CMidiControllerEventMonitor(MMidiControllerEventMonitorObserver& aObserver,
|
sl@0
|
72 |
RMidiControllerCustomCommands& aMidiControllerCustomCommands, const CMidiClientUtility& aParent);
|
sl@0
|
73 |
private:
|
sl@0
|
74 |
MMidiControllerEventMonitorObserver& iMidiObserver;
|
sl@0
|
75 |
RMidiControllerCustomCommands& iMidiControllerCustomCommands;
|
sl@0
|
76 |
TPckgBuf<TInt> iSizeOfEvent;
|
sl@0
|
77 |
const CMidiClientUtility& iParent;
|
sl@0
|
78 |
CMMFMidiEvent* iMidiEvent;
|
sl@0
|
79 |
};
|
sl@0
|
80 |
|
sl@0
|
81 |
|
sl@0
|
82 |
class CMidiEventMonitor : public CActive
|
sl@0
|
83 |
{
|
sl@0
|
84 |
public:
|
sl@0
|
85 |
static CMidiEventMonitor* NewL(MMidiControllerEventMonitorObserver& aMidiObserver,
|
sl@0
|
86 |
const CMidiClientUtility& aParent);
|
sl@0
|
87 |
~CMidiEventMonitor();
|
sl@0
|
88 |
void SelfComplete(TInt aError);
|
sl@0
|
89 |
private:
|
sl@0
|
90 |
void ConstructL();
|
sl@0
|
91 |
void RunL();
|
sl@0
|
92 |
void DoCancel();
|
sl@0
|
93 |
TInt RunError(TInt aError);
|
sl@0
|
94 |
CMidiEventMonitor(MMidiControllerEventMonitorObserver& aObserver,
|
sl@0
|
95 |
const CMidiClientUtility& aParent);
|
sl@0
|
96 |
private:
|
sl@0
|
97 |
MMidiControllerEventMonitorObserver& iMidiObserver;
|
sl@0
|
98 |
const CMidiClientUtility& iParent;
|
sl@0
|
99 |
CMMFMidiEvent* iMidiEvent;
|
sl@0
|
100 |
};
|
sl@0
|
101 |
|
sl@0
|
102 |
|
sl@0
|
103 |
class CContent;
|
sl@0
|
104 |
class CData;
|
sl@0
|
105 |
/**
|
sl@0
|
106 |
*/
|
sl@0
|
107 |
class CMidiClientUtility::CBody : public CBase,
|
sl@0
|
108 |
public MMidiControllerEventMonitorObserver,
|
sl@0
|
109 |
public MRepeatTrailingSilenceTimerObs,
|
sl@0
|
110 |
public MMMFAddDataSourceSinkAsyncObserver
|
sl@0
|
111 |
{
|
sl@0
|
112 |
public:
|
sl@0
|
113 |
static CMidiClientUtility::CBody* NewL(CMidiClientUtility* aParent,
|
sl@0
|
114 |
MMidiClientUtilityObserver& aObserver,
|
sl@0
|
115 |
TInt aPriority,
|
sl@0
|
116 |
TInt aPref,
|
sl@0
|
117 |
TBool aUseSharedHeap);
|
sl@0
|
118 |
|
sl@0
|
119 |
|
sl@0
|
120 |
/**
|
sl@0
|
121 |
Destructor
|
sl@0
|
122 |
*/
|
sl@0
|
123 |
~CBody();
|
sl@0
|
124 |
|
sl@0
|
125 |
void OpenFile(const TDesC& aFileSource);
|
sl@0
|
126 |
void OpenFile(RFile& aFile);
|
sl@0
|
127 |
void OpenFile(const TMMSource& aFileSource);
|
sl@0
|
128 |
void OpenDes(const TDesC8& aDescriptor);
|
sl@0
|
129 |
void OpenUrl(const TDesC& aUrl,TInt aIapId = KUseDefaultIap,const TDesC8& aMimeType=KNullDesC8);
|
sl@0
|
130 |
void Close();
|
sl@0
|
131 |
void Play();
|
sl@0
|
132 |
void Stop(const TTimeIntervalMicroSeconds& aFadeOutDuration);
|
sl@0
|
133 |
TMidiState State() const;
|
sl@0
|
134 |
void PlayNoteL(TInt aChannel,TInt aNote,const TTimeIntervalMicroSeconds& aDuration,TInt aNoteOnVelocity,TInt aNoteOffVelocity);
|
sl@0
|
135 |
void PlayNoteL(TInt aChannel,TInt aNote,const TTimeIntervalMicroSeconds& aStartTime,const TTimeIntervalMicroSeconds& aDuration,TInt aNoteOnVelocity,TInt aNoteOffVelocity);
|
sl@0
|
136 |
void StopNotes(TInt aChannel);
|
sl@0
|
137 |
void NoteOnL(TInt aChannel,TInt aNote,TInt aVelocity);
|
sl@0
|
138 |
void NoteOffL(TInt aChannel,TInt aNote,TInt aVelocity);
|
sl@0
|
139 |
TInt PlaybackRateL() const;
|
sl@0
|
140 |
void SetPlaybackRateL(TInt aRate);
|
sl@0
|
141 |
TInt MaxPlaybackRateL() const;
|
sl@0
|
142 |
TInt MinPlaybackRateL() const;
|
sl@0
|
143 |
TInt TempoMicroBeatsPerMinuteL() const;
|
sl@0
|
144 |
void SetTempoL(TInt aMicroBeatsPerMinute);
|
sl@0
|
145 |
TInt PitchTranspositionCentsL() const;
|
sl@0
|
146 |
TInt SetPitchTranspositionL(TInt aCents);
|
sl@0
|
147 |
TTimeIntervalMicroSeconds DurationMicroSecondsL() const;
|
sl@0
|
148 |
TInt64 DurationMicroBeatsL() const;
|
sl@0
|
149 |
TInt NumTracksL() const;
|
sl@0
|
150 |
void SetTrackMuteL(TInt aTrack,TBool aMuted) const;
|
sl@0
|
151 |
const TDesC8& MimeTypeL();
|
sl@0
|
152 |
TTimeIntervalMicroSeconds PositionMicroSecondsL() const;
|
sl@0
|
153 |
void SetPositionMicroSecondsL(const TTimeIntervalMicroSeconds& aPosition);
|
sl@0
|
154 |
TInt64 PositionMicroBeatsL() const;
|
sl@0
|
155 |
void SetPositionMicroBeatsL(TInt64 aMicroBeats);
|
sl@0
|
156 |
void SetSyncUpdateCallbackIntervalL(const TTimeIntervalMicroSeconds& aMicroSeconds,TInt64 aMicroBeats=0);
|
sl@0
|
157 |
TInt SendMessageL(const TDesC8& aMidiMessage);
|
sl@0
|
158 |
TInt SendMessageL(const TDesC8& aMidiMessage,const TTimeIntervalMicroSeconds& aTime);
|
sl@0
|
159 |
void SendMipMessageL(const RArray<TMipMessageEntry>& aEntry);
|
sl@0
|
160 |
TInt NumberOfBanksL(TBool aCustom) const;
|
sl@0
|
161 |
TInt GetBankIdL(TBool aCustom,TInt aBankIndex) const;
|
sl@0
|
162 |
void LoadCustomBankL(const TDesC& aFileName,TInt& aBankCollectionIndex);
|
sl@0
|
163 |
void UnloadCustomBankL(TInt aBankCollectionIndex);
|
sl@0
|
164 |
TBool CustomBankLoadedL(TInt aBankCollectionIndex) const;
|
sl@0
|
165 |
void UnloadAllCustomBanksL();
|
sl@0
|
166 |
TInt NumberOfInstrumentsL(TInt aBankId,TBool aCustom) const;
|
sl@0
|
167 |
TInt GetInstrumentIdL(TInt aBankId,TBool aCustom,TInt aInstrumentIndex) const;
|
sl@0
|
168 |
HBufC* InstrumentNameL(TInt aBankId, TBool aCustom, TInt aInstrumentId) const;
|
sl@0
|
169 |
void SetInstrumentL(TInt aChannel,TInt aBankId,TInt aInstrumentId);
|
sl@0
|
170 |
void LoadCustomInstrumentL(const TDesC& aFileName,TInt aFileBankId,TInt aFileInstrumentId,TInt aMemoryBankId,TInt aMemoryInstrumentId);
|
sl@0
|
171 |
void UnloadCustomInstrumentL(TInt aCustomBankId,TInt aInstrumentId);
|
sl@0
|
172 |
HBufC* PercussionKeyNameL(TInt aNote, TInt aBankId, TBool aCustom, TInt aInstrumentId) const;
|
sl@0
|
173 |
void StopTimeL(TTimeIntervalMicroSeconds& aStopTime) const;
|
sl@0
|
174 |
void SetStopTimeL(const TTimeIntervalMicroSeconds& aStopTime);
|
sl@0
|
175 |
void SetRepeatsL(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence);
|
sl@0
|
176 |
TInt PolyphonyL() const;
|
sl@0
|
177 |
TInt ChannelsSupportedL() const;
|
sl@0
|
178 |
TReal32 ChannelVolumeL(TInt aChannel) const;
|
sl@0
|
179 |
TReal32 MaxChannelVolumeL() const;
|
sl@0
|
180 |
void SetChannelVolumeL(TInt aChannel,TReal32 aVolume);
|
sl@0
|
181 |
void SetChannelMuteL(TInt aChannel,TBool aMuted);
|
sl@0
|
182 |
TInt VolumeL() const;
|
sl@0
|
183 |
TInt MaxVolumeL() const;
|
sl@0
|
184 |
void SetVolumeL(TInt aVolume);
|
sl@0
|
185 |
void SetVolumeRampL(const TTimeIntervalMicroSeconds& aRampDuration);
|
sl@0
|
186 |
TInt GetBalanceL() const;
|
sl@0
|
187 |
void SetBalanceL(TInt aBalance = KMMFBalanceCenter);
|
sl@0
|
188 |
void SetPriorityL(TInt aPriority, TInt aPref);
|
sl@0
|
189 |
TInt NumberOfMetaDataEntriesL() const;
|
sl@0
|
190 |
CMMFMetaDataEntry* GetMetaDataEntryL(TInt aMetaDataIndex) const;
|
sl@0
|
191 |
void SetMaxPolyphonyL(TInt aMaxVoices);
|
sl@0
|
192 |
TInt GetRepeats();
|
sl@0
|
193 |
void LoadCustomBankDataL(const TDesC8& aBankData,TInt& aBankCollectionIndex);
|
sl@0
|
194 |
void LoadCustomInstrumentDataL(const TDesC8& aInstrumentData, TInt aBankDataId, TInt aInstrumentDataId, TInt aMemoryBankId, TInt aMemoryInstrumentId);
|
sl@0
|
195 |
void SetBankL(TBool aCustom);
|
sl@0
|
196 |
TBool IsTrackMuteL(TInt aTrack) const;
|
sl@0
|
197 |
TBool IsChannelMuteL(TInt aChannel) const;
|
sl@0
|
198 |
void GetInstrumentL(TInt aChannel, TInt& aInstrumentId, TInt& aBankId);
|
sl@0
|
199 |
TInt MaxPolyphonyL() const;
|
sl@0
|
200 |
void CustomCommandSyncL(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom);
|
sl@0
|
201 |
void CustomCommandSyncL(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2);
|
sl@0
|
202 |
void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus);
|
sl@0
|
203 |
void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus);
|
sl@0
|
204 |
|
sl@0
|
205 |
MMMFDRMCustomCommand* GetDRMCustomCommand();
|
sl@0
|
206 |
|
sl@0
|
207 |
virtual void RepeatTrailingSilenceTimerComplete();
|
sl@0
|
208 |
//From MMMFControllerEventMonitorObserver
|
sl@0
|
209 |
virtual void HandleMidiEvent(const CMMFMidiEvent& aEvent);
|
sl@0
|
210 |
|
sl@0
|
211 |
// from MMMFAddDataSourceSinkAsyncObserver
|
sl@0
|
212 |
virtual void MadssaoAddDataSourceSinkAsyncComplete(TInt aError, const TMMFMessageDestination& aHandle);
|
sl@0
|
213 |
|
sl@0
|
214 |
private:
|
sl@0
|
215 |
CBody(CMidiClientUtility* aParent, MMidiClientUtilityObserver& aObserver, TInt aPriority, TInt aPref);
|
sl@0
|
216 |
void ConstructL(TBool aUseSharedHeap);
|
sl@0
|
217 |
TInt DoOpen(const RMMFControllerImplInfoArray& aControllers, TUid aSinkUid, const TDesC8& aSinkData, TBool aUseSharedHeap);
|
sl@0
|
218 |
void ExternalizeToCBufFlatL(CBufFlat*& aCfgBuffer, const CMMFUrlParams* aUrlParams) const;
|
sl@0
|
219 |
void DoOpenFileL(const TMMSource& aSource);
|
sl@0
|
220 |
void DoOpenUrlL(const TDesC& aUrl, TInt aIapId);
|
sl@0
|
221 |
private:
|
sl@0
|
222 |
CMidiClientUtility* iParent;
|
sl@0
|
223 |
MMidiClientUtilityObserver& iObserver;
|
sl@0
|
224 |
RMMFController iController;
|
sl@0
|
225 |
CMidiControllerEventMonitor* iMidiControllerEventMonitor;
|
sl@0
|
226 |
TMidiState iState;
|
sl@0
|
227 |
TMMFPrioritySettings iPrioritySettings;
|
sl@0
|
228 |
CRepeatTrailingSilenceTimer* iRepeatTrailingSilenceTimer;
|
sl@0
|
229 |
|
sl@0
|
230 |
// Source and sink handle info
|
sl@0
|
231 |
TMMFMessageDestination iSourceHandle;
|
sl@0
|
232 |
TMMFMessageDestination iSinkHandle;
|
sl@0
|
233 |
|
sl@0
|
234 |
// Custom command handlers
|
sl@0
|
235 |
RMidiControllerCustomCommands iMidiControllerCommands;
|
sl@0
|
236 |
|
sl@0
|
237 |
RMMFDRMCustomCommands iDRMCustomCommands;
|
sl@0
|
238 |
|
sl@0
|
239 |
//Stop position
|
sl@0
|
240 |
TTimeIntervalMicroSeconds iStopPosition;
|
sl@0
|
241 |
|
sl@0
|
242 |
HBufC8* iMimeType;
|
sl@0
|
243 |
TBool iIntervalSec;
|
sl@0
|
244 |
CMMFAddDataSourceSinkAsync* iAddDataSourceSinkAsync;
|
sl@0
|
245 |
CMMSourceSink* iSource;
|
sl@0
|
246 |
|
sl@0
|
247 |
ContentAccess::CContent* iContent;
|
sl@0
|
248 |
ContentAccess::CData* iData;
|
sl@0
|
249 |
};
|
sl@0
|
250 |
|
sl@0
|
251 |
#endif
|