1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Mmf\Common\MmfMidi.h
18 #ifndef __MMF_COMMON_MMFMIDI_H__
19 #define __MMF_COMMON_MMFMIDI_H__
21 // Standard EPOC32 includes
24 // Public Media Server includes
25 #include <mmf/common/mmfbase.h>
26 #include <mmf/common/mmfutilities.h>
28 #include <midiclientutility.h>
31 MIDI event usued by a MIDI controller to signal to a
32 client that a MIDI source open request has completed.
37 const TUid KMMFEventCategoryMidiOpenDataSourceComplete = {0x101F8F85};
40 MIDI event used by a MIDI controller to signal to a
41 client that play of a MIDI resource has commenced.
46 const TUid KMMFEventCategoryMidiPlaying = {0x101F8F86};
49 MIDI event used by a MIDI controller to signal to
50 a client that play of a MIDI resource has commenced
51 but not all SP-MIDI requirements can be met.
56 const TUid KMMFEventCategoryMidiPlaybackIncompatible = {0x101F8F87};
59 MIDI event used by a MIDI controller to signal to a client that play
60 of a MIDI resource has commenced but due to system resource constraints
61 and SP-MIDI content constraints, there is no audible MIDI content
67 const TUid KMMFEventCategoryMidiPlaybackSilent = {0x101F8F88};
70 MIDI event used by a MIDI controller to signal to
71 a client that play of a MIDI resource has completed.
76 const TUid KMMFEventCategoryMidiPlayingComplete = {0x101F8F89};
79 MIDI event used by a MIDI controller to signal to
80 a client a sync update event. The frequency of this event is
81 set by the client with SetSyncUpdateCallbackIntervalL.
86 const TUid KMMFEventCategoryMidiSyncUpdate = {0x101F8F8A};
89 MIDI event used by a MIDI controller to signal to
90 a client that any currently opened resources have been closed.
95 const TUid KMMFEventCategoryMidiClose = {0x101F8F8B};
98 MIDI event used by a MIDI controller to signal to a client that the
99 MIDI controller has been primed and it's ready to play.
104 const TUid KMMFEventCategoryMidiPrime = {0x101F8F8C};
107 MIDI event used by a MIDI controller to signal to a client that the MIDI
108 resource has encountered a tempo change message in the MIDI data stream.
113 const TUid KMMFEventCategoryTempoChanged = {0x101F8F8D};
116 MIDI event used by a MIDI controller to signal to a client that the MIDI
117 resource has encountered a volume change message in the MIDI data stream.
122 const TUid KMMFEventCategoryVolumeChanged = {0x101F8F8E};
125 MIDI event used by a MIDI controller to signal to a client that the
126 MIDI resource has encountered a mute message in the MIDI data stream.
131 const TUid KMMFEventCategoryMuteChanged = {0x101F8F8F};
134 MIDI event used by a MIDI controller to signal to a client that the polyphony
135 of the MIDI engine has changed.
140 const TUid KMMFEventCategoryPolyphonyChanged = {0x101F8F90};
143 MIDI event used by a MIDI controller to signal to a client that
144 an instrument has been changed on a channel.
149 const TUid KMMFEventCategoryInstrumentChanged = {0x101F8F91};
152 MIDI event used by a MIDI controller to signal to a client that a timed
153 meta data entry has been found in the MIDI data stream.
158 const TUid KMMFEventCategoryMetaDataEntryFound = {0x101F8F92};
161 MIDI event used by a MIDI controller to signal to a client that a
162 MIP message has been found in the MIDI data stream.
167 const TUid KMMFEventCategoryMipMessageReceived = {0x101F8F93};
172 class TMMFMidiConfig1
175 inline TMMFMidiConfig1();
178 * Number of tracks present in the currently open MIDI resource.
183 * Current state of the MIDI client utility object
184 * (EMidiStateClosedDisengaged,EMidiStateOpenDisengaged,EMidiStateOpenPlaying,EMidiStatePlaybackIncompatible,
185 * EMidiStatePlaybackSilent, EMidiStateClosedEngaged, EMidiStateOpenEngaged).
191 * Tempo in microbeats per minute (BPM*1000000).
196 * Pitch shift in cents, i.e. semitones * 100. One octave equals 1200 cents.
201 * Array of logical {channel, MIP} value pairs to send SP-MIDI MIP message to the MIDI engine.
203 const TArray<TMipMessageEntry>* iMipMessage;
206 * The maximum number of notes that the MIDI engine supports simultaneously (polyphony).
211 * Max polyphony level: 0 <= PolyphonyL() <= iMaxNotes.
216 * Overall volume of the MIDI client.
221 * Maximum volume that may be applied overall to the MIDI client.
226 * Length of time over which the volume is faded up from zero to the current settings when playback is started.
228 TTimeIntervalMicroSeconds iRampDuration;
231 * Stereo balance value: KMMFBalanceMaxLeft <= iBalance <= KMMFBalanceMaxRight.
236 * The number of times the current opened resources has to be repeated.
237 * This includes the first instance of playing.
242 * Length of time over which the volume is faded out from the current settings to zero.
244 TTimeIntervalMicroSeconds iFadeOutDuration;
250 class TMMFMidiConfig2
253 inline TMMFMidiConfig2();
256 * Index of the track to mute: 0 <= iTrack < NumTracksL().
261 * ETrue to mute the track/channel, EFalse to unmute it.
266 * Note to play ot to terminate: 0 <= iNote <= 127.
271 * Length of time to play the note for.
273 TTimeIntervalMicroSeconds iDurationMicroSeconds;
276 * Specifying the time at which to start playing the note.
277 * It's relative to the MIDI resource playing time or the time elapsed
278 * since Play() was called if no resource is present.
280 TTimeIntervalMicroSeconds iStartTime;
283 * Velocity with which to start the note: 0 <= iNoteOnVelocity <= 127.
285 TInt iNoteOnVelocity;
288 * Velocity with which to stop the note: 0 <= iNoteOffVelocity <= 127.
290 TInt iNoteOffVelocity;
293 * Number of standard or custom sound banks currently available.
298 * Specifies whether to reference a custom or standard sound bank.
303 * Index of custom/deault bank: 0 <= iBankIndex < NumberOfBanksL()
308 * Custom/deault Bank's Identifier.
313 * Identifier of the custom bank in memory.
318 * Name of the file containing the custom sound bank or the name
319 * of the file containing the instrument. Includes the directory path.
321 const TDesC* iFileName;
324 * Descriptor containing the custom sound bank.
326 const TDesC8* iBankData;
329 * Descriptor containing the instrument.
331 const TDesC8* iInstrumentData;
334 * ETrue if the specified bank is in memory, EFalse otherwise.
339 * Number of instruments available for the specified sound bank.
341 TInt iNumInstruments;
344 * Index of the instrument to reference: 0 <= aInstrumentIndex < NumberOfInstrumentsL().
346 TInt iInstrumentIndex;
349 * Identifier of specified instrument. This may differ from the index
350 * since the index simply enumerates the instruments, whereas identifiers
351 * may not be contiguous, especially where certain instruments correspond
352 * to General MIDI-defined instruments but not all instruments are present.
353 * 0 <= iInstrumentId <= 127.
358 * Identifier of the instrument in memory.
360 TInt iMemoryInstrumentId;
363 * Current metrical position of the MIDI resource being played.
364 * Microbeats (BPM*1000000) relative to the start of the resource.
366 TInt64 iPositionMicroBeats;
369 * Length of the currently open MIDI resource.
370 * Duration in microbeats (beats * 1000000).
372 TInt64 iDurationMicroBeats;
375 * Time at which playback will stop, relative to the start of the resource.
376 * Clamped to 0 and the duration of the resource.
378 TTimeIntervalMicroSeconds iStopTime;
381 * Logical channel: 0 <= iChannel < ChannelsSupportedL().
386 * Volume level in dB corresponding to the MIDI Channel:
387 * -infinity <= iChannelVol <= MaxVolumeL().
392 * Maximum volume setting in dB, should always be 0 dB and
393 * correspond to the MIDI Channel Volume controller maximum value.
395 TReal32 iMaxChannelVol;
401 class TMMFMidiConfig3
404 inline TMMFMidiConfig3();
407 * Temporal interval between MmcuoSyncUpdate callback.
409 TTimeIntervalMicroSeconds iCallbackIntervalMicroSeconds;
412 * Metrical interval between MmcuoSyncUpdate callback.
414 TInt64 iCallbackIntervalMicroBeats;
417 * Number of bytes of the MIDI message buffer actually processed when client
418 * calls SendMessageL.
420 TInt iBytesProcessed;
423 * Time at which to execute the MIDI message sent by SendMessageL.
424 * It's relative to the MIDI resource playing time or the time elapsed
425 * since Play() was called if no resource is present.
427 TTimeIntervalMicroSeconds iTimeStamp;
430 * Number of time to repeat the resource during playback. This includes the first playing.
432 TInt iRepeatNumberOfTimes;
435 * Time in microseconds to pause between repeats.
437 TTimeIntervalMicroSeconds iTrailingSilence;
440 * Playback rate for the playback of the current MIDI resource
441 * in percent times 1000, i.e., 100000 means original playback speed,
442 * 200000 means double speed, and 50000 means half speed playback.
447 * Maximum playback rate supported by MIDI player.
449 TInt iPlayBackMaxRate;
452 * Minimum playback rate supported by MIDI player.
454 TInt iPlayBackMinRate;
457 * Descriptor containing a MIDI message data. If there
458 * are several MIDI messages in the buffer, only the first
461 const TDesC8* iMidiMessage;
464 inline TMMFMidiConfig1::TMMFMidiConfig1()
467 inline TMMFMidiConfig2::TMMFMidiConfig2()
470 inline TMMFMidiConfig3::TMMFMidiConfig3()