os/mm/mmlibs/mmfw/MIDI/src/midiclientutility.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
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
#include <midiclientutility.h>
sl@0
    17
#include "midiclientutilitybody.h"
sl@0
    18
sl@0
    19
sl@0
    20
/**
sl@0
    21
Static factory function for creating a MIDI client utility object.
sl@0
    22
This function is synchronous, unlike the other factory functions,
sl@0
    23
because it doesn't need to perform any MIDI resource initialisation.
sl@0
    24
sl@0
    25
@param aObserver
sl@0
    26
       Reference to an object to receive callbacks on completion of asynchronous functions.
sl@0
    27
@param aPriority
sl@0
    28
       The Priority Value - this client's relative priority. This is a value between EMdaPriorityMin and 
sl@0
    29
       EMdaPriorityMax and represents a relative priority. A higher value indicates a more important request.
sl@0
    30
@param aPref
sl@0
    31
       The Priority Preference - an additional audio policy parameter. The suggested default is 
sl@0
    32
       EMdaPriorityPreferenceNone. Further values are given by TMdaPriorityPreference, and additional 
sl@0
    33
       values may be supported by given phones and/or platforms, but should not be depended upon by 
sl@0
    34
       portable code.
sl@0
    35
@param aUseSharedHeap
sl@0
    36
	   Select if the underlying controller will have its own heap or share a single heap with other
sl@0
    37
	   controller instances.
sl@0
    38
	   The default behaviour, or if this value is EFalse, is that each controller is created with
sl@0
    39
	   its own heap. The alternative, if the value is ETrue, is that controllers share a special
sl@0
    40
	   heap with other controllers created the same way. Each heap uses a chunk, so this avoids
sl@0
    41
	   situations where the number of chunks per process is limited. The default behaviour is
sl@0
    42
	   generally to be preferred, and should give lower overall memory usage. However, if many
sl@0
    43
	   controllers are to be created for a particular thread, then ETrue should be provided to
sl@0
    44
	   prevent running out of heaps or chunks.
sl@0
    45
@return Fully constructed utility object ready to have an OpenXxxx() function called.
sl@0
    46
sl@0
    47
Note: The Priority Value and Priority Preference are used primarily when deciding what to do when
sl@0
    48
several audio clients attempt to play or record simultaneously. In addition to the Priority Value and Preference, 
sl@0
    49
the adaptation may consider other parameters such as the SecureId and Capabilities of the client process. 
sl@0
    50
Whatever, the decision  as to what to do in such situations is up to the audio adaptation, and may
sl@0
    51
vary between different phones. Portable applications are advised not to assume any specific behaviour. 
sl@0
    52
*/
sl@0
    53
EXPORT_C CMidiClientUtility* CMidiClientUtility::NewL(MMidiClientUtilityObserver& aObserver, TInt aPriority, TInt aPref, TBool aUseSharedHeap)
sl@0
    54
	{
sl@0
    55
	CMidiClientUtility* self = new(ELeave) CMidiClientUtility();
sl@0
    56
	CleanupStack::PushL(self);
sl@0
    57
	self->iBody = CMidiClientUtility::CBody::NewL(self, aObserver, aPriority, aPref, aUseSharedHeap );
sl@0
    58
	CleanupStack::Pop(self);
sl@0
    59
	return self;
sl@0
    60
	}
sl@0
    61
	
sl@0
    62
/**
sl@0
    63
Static factory function for creating a MIDI client utility object.
sl@0
    64
This function is synchronous, unlike the other factory functions,
sl@0
    65
because it doesn't need to perform any MIDI resource initialisation
sl@0
    66
The underlying controller that is created will be given its own heap.
sl@0
    67
sl@0
    68
@param aObserver
sl@0
    69
       Reference to an object to receive callbacks on completion of asynchronous functions.
sl@0
    70
@param aPriority
sl@0
    71
       The Priority Value - this client's relative priority. This is a value between EMdaPriorityMin and 
sl@0
    72
       EMdaPriorityMax and represents a relative priority. A higher value indicates a more important request.
sl@0
    73
@param aPref
sl@0
    74
       The Priority Preference - an additional audio policy parameter. The suggested default is 
sl@0
    75
       EMdaPriorityPreferenceNone. Further values are given by TMdaPriorityPreference, and additional 
sl@0
    76
       values may be supported by given phones and/or platforms, but should not be depended upon by 
sl@0
    77
       portable code.
sl@0
    78
@return Fully constructed utility object ready to have an OpenXxxx() function called.
sl@0
    79
sl@0
    80
Note: The Priority Value and Priority Preference are used primarily when deciding what to do when
sl@0
    81
several audio clients attempt to play or record simultaneously. In addition to the Priority Value and Preference, 
sl@0
    82
the adaptation may consider other parameters such as the SecureId and Capabilities of the client process. 
sl@0
    83
Whatever, the decision  as to what to do in such situations is up to the audio adaptation, and may
sl@0
    84
vary between different phones. Portable applications are advised not to assume any specific behaviour. 
sl@0
    85
*/
sl@0
    86
EXPORT_C CMidiClientUtility* CMidiClientUtility::NewL(MMidiClientUtilityObserver& aObserver, TInt aPriority, TInt aPref)
sl@0
    87
	{
sl@0
    88
	return NewL( aObserver, aPriority, aPref, EFalse );
sl@0
    89
	}
sl@0
    90
sl@0
    91
CMidiClientUtility::~CMidiClientUtility()
sl@0
    92
	{
sl@0
    93
	delete iBody;
sl@0
    94
	}
sl@0
    95
sl@0
    96
/**
sl@0
    97
Asynchronous function to open a file containing MIDI data and perform
sl@0
    98
initialisation ready for playback
sl@0
    99
sl@0
   100
@param aFileName Name of the MIDI file to open
sl@0
   101
*/
sl@0
   102
EXPORT_C void CMidiClientUtility::OpenFile(const TDesC& aFileName)
sl@0
   103
	{
sl@0
   104
	iBody->OpenFile(aFileName);
sl@0
   105
	}
sl@0
   106
	
sl@0
   107
/**
sl@0
   108
Asynchronous function to open a file containing MIDI data and perform
sl@0
   109
initialisation ready for playback
sl@0
   110
sl@0
   111
@param aFile Open shared protected session handle to the midi file to read
sl@0
   112
*/
sl@0
   113
EXPORT_C void CMidiClientUtility::OpenFile(const RFile& aFile)
sl@0
   114
	{
sl@0
   115
	iBody->OpenFile(const_cast<RFile&>(aFile));
sl@0
   116
	}
sl@0
   117
sl@0
   118
/**
sl@0
   119
Asynchronous function to open a file containing MIDI data and perform
sl@0
   120
initialisation ready for playback
sl@0
   121
sl@0
   122
@param aFileSource TFileSource object which references either a filename or a
sl@0
   123
file handle to the midi file to read
sl@0
   124
*/
sl@0
   125
EXPORT_C void CMidiClientUtility::OpenFile(const TMMSource& aSource)
sl@0
   126
	{
sl@0
   127
	iBody->OpenFile(aSource);
sl@0
   128
	}
sl@0
   129
sl@0
   130
/**
sl@0
   131
Asynchronous function to open a descriptor containing MIDI data and perform
sl@0
   132
initialisation ready for playback
sl@0
   133
sl@0
   134
@param aDescriptor descriptor containing MIDI data
sl@0
   135
*/
sl@0
   136
EXPORT_C void CMidiClientUtility::OpenDes(const TDesC8& aDescriptor)
sl@0
   137
	{
sl@0
   138
	iBody->OpenDes(aDescriptor);
sl@0
   139
	}
sl@0
   140
sl@0
   141
/**
sl@0
   142
Asynchronous function to open a URL containing MIDI data and perform
sl@0
   143
initialisation ready for playback
sl@0
   144
sl@0
   145
@param  aUrl
sl@0
   146
        Uniform Resource Locator for a MIDI data stream
sl@0
   147
@param  aIapId
sl@0
   148
        Identifier of the Internet Access Point to use -
sl@0
   149
        available from CommDB, the comms connections database.
sl@0
   150
        Defaults to using the default access point, as defined by CommDB
sl@0
   151
@param  aMimeType
sl@0
   152
        Mime type of the MIDI data stream to be played.
sl@0
   153
        Defaults to nothing in which case the an attempt will be made to recognise the type of the MIDI data automatically.
sl@0
   154
*/
sl@0
   155
EXPORT_C void CMidiClientUtility::OpenUrl(const TDesC& aUrl,TInt aIapId,const TDesC8& aMimeType)
sl@0
   156
	{
sl@0
   157
	iBody->OpenUrl(aUrl, aIapId, aMimeType);
sl@0
   158
	}
sl@0
   159
sl@0
   160
/**
sl@0
   161
Asynchronous function to initiate or resume playback of a previously opened resource.
sl@0
   162
Also used to start an internal timer to establish a zero-time for the media stream
sl@0
   163
time relative to which commands with timestamps are timed against
sl@0
   164
*/
sl@0
   165
EXPORT_C void CMidiClientUtility::Play()
sl@0
   166
	{
sl@0
   167
	iBody->Play();
sl@0
   168
	}
sl@0
   169
sl@0
   170
/**
sl@0
   171
Stops playback of a resource but does not change the current position or release any resources.
sl@0
   172
Pauses the internal timer if no resource is open
sl@0
   173
sl@0
   174
@param aFadeOutDuration
sl@0
   175
       Length of time over which the volume is faded out from the current settings to zero.
sl@0
   176
*/
sl@0
   177
EXPORT_C void CMidiClientUtility::Stop(const TTimeIntervalMicroSeconds& aFadeOutDuration)
sl@0
   178
	{
sl@0
   179
	iBody->Stop(aFadeOutDuration);
sl@0
   180
	}
sl@0
   181
sl@0
   182
/**
sl@0
   183
Asynchronous function which closes any currently open resources, such as files, descriptors or URLs in use.
sl@0
   184
Does nothing if there is nothing currently open.
sl@0
   185
*/
sl@0
   186
EXPORT_C void CMidiClientUtility::Close()
sl@0
   187
	{
sl@0
   188
	iBody->Close();
sl@0
   189
	}
sl@0
   190
sl@0
   191
/**
sl@0
   192
Gets the current state of the MIDI client utility with regard to MIDI resources
sl@0
   193
sl@0
   194
@return The current state of the utility
sl@0
   195
*/
sl@0
   196
EXPORT_C TMidiState CMidiClientUtility::State() const
sl@0
   197
	{
sl@0
   198
	return iBody->State();
sl@0
   199
	}
sl@0
   200
sl@0
   201
/**
sl@0
   202
Synchronous function to play a single note.
sl@0
   203
Multiple calls to this function will be accommodated as far as the MIDI engine can
sl@0
   204
manage. The same functionality could be implemented using the SendMessage function
sl@0
   205
sl@0
   206
@param aChannel 
sl@0
   207
       Logical channel to play note on. 0 <= aChannel <= 15.
sl@0
   208
@param aNote 
sl@0
   209
       Note to play. 0 <= aNote <= 127
sl@0
   210
@param aDuration 
sl@0
   211
       Length of time to play note for.
sl@0
   212
@param aNoteOnVelocity 
sl@0
   213
       Velocity with which to start the note. 0 <= aNoteOnVelocity <= 127.
sl@0
   214
@param aNoteOffVelocity 
sl@0
   215
       Velocity with which to stop the note. 0 <= aNoteOffVelocity <= 127.
sl@0
   216
*/
sl@0
   217
EXPORT_C void CMidiClientUtility::PlayNoteL(TInt aChannel,TInt aNote,const TTimeIntervalMicroSeconds& aDuration,TInt aNoteOnVelocity,TInt aNoteOffVelocity)
sl@0
   218
	{
sl@0
   219
	iBody->PlayNoteL(aChannel, aNote, aDuration, aNoteOnVelocity, aNoteOffVelocity);
sl@0
   220
	}
sl@0
   221
sl@0
   222
/**
sl@0
   223
Synchronous function to play a single note at a specified time.
sl@0
   224
Multiple calls to this function will be accommodated as far as the MIDI engine can
sl@0
   225
manage. The same functionality could be implemented using the SendMessage function
sl@0
   226
sl@0
   227
@param aChannel 
sl@0
   228
       Logical channel to play note on. 0 <= aChannel <= 15.
sl@0
   229
@param aNote 
sl@0
   230
       Note to play. 0 <= aNote <= 127
sl@0
   231
@param aStartTime 
sl@0
   232
       specifies the time at which to start playing the note,
sl@0
   233
       relative to the MIDI resource playing time or the time elapsed since Play() was called if no resource is present
sl@0
   234
@param aDuration
sl@0
   235
       Length of time to play note for.
sl@0
   236
@param aNoteOnVelocity 
sl@0
   237
       Velocity with which to start the note. 0 <= aNoteOnVelocity <= 127.
sl@0
   238
@param aNoteOffVelocity
sl@0
   239
       Velocity with which to stop the note. 0 <= aNoteOffVelocity <= 127.
sl@0
   240
*/
sl@0
   241
EXPORT_C void CMidiClientUtility::PlayNoteL(TInt aChannel,TInt aNote,const TTimeIntervalMicroSeconds& aStartTime,const TTimeIntervalMicroSeconds& aDuration,TInt aNoteOnVelocity,TInt aNoteOffVelocity)
sl@0
   242
	{
sl@0
   243
	iBody->PlayNoteL(aChannel, aNote, aStartTime, aDuration, aNoteOnVelocity, aNoteOffVelocity);
sl@0
   244
	}
sl@0
   245
sl@0
   246
/**
sl@0
   247
Stops the playback of all notes on the given channel,
sl@0
   248
by means of an All Notes Off MIDI message
sl@0
   249
sl@0
   250
@param aChannel 
sl@0
   251
       Logical channel to stop notes on. 0 <= aChannel <= 15
sl@0
   252
*/
sl@0
   253
EXPORT_C void CMidiClientUtility::StopNotes(TInt aChannel)
sl@0
   254
	{
sl@0
   255
	iBody->StopNotes(aChannel);
sl@0
   256
	}
sl@0
   257
sl@0
   258
/**
sl@0
   259
Synchronous function to commence playback of a note.
sl@0
   260
Multiple calls to this function will be accommodated as far as the MIDI engine can manage
sl@0
   261
sl@0
   262
@param aChannel 
sl@0
   263
       Logical channel to play note on. 0 <= aChannel <= 15
sl@0
   264
@param aNote 
sl@0
   265
       Note to play. 0 <= aNote <= 127
sl@0
   266
@param aVelocity 
sl@0
   267
       Velocity with which to start the note.
sl@0
   268
       The legal integer range is 0 <= aVelocity <= 127, but the value zero
sl@0
   269
       actually causes the message to be interpreted as a Note Off message
sl@0
   270
       instead of a Note On.
sl@0
   271
*/
sl@0
   272
EXPORT_C void CMidiClientUtility::NoteOnL(TInt aChannel,TInt aNote,TInt aVelocity)
sl@0
   273
	{
sl@0
   274
	iBody->NoteOnL(aChannel, aNote, aVelocity);
sl@0
   275
	}
sl@0
   276
sl@0
   277
/**
sl@0
   278
Synchronous function to terminate playback of a note. If no corresponding note
sl@0
   279
is found then no error is raised.
sl@0
   280
sl@0
   281
@param aChannel 
sl@0
   282
       Logical channel on which the note is playing. 0 <= aChannel <= 15.
sl@0
   283
@param aNote 
sl@0
   284
       Note to terminate. 0 <= aNote <= 127.
sl@0
   285
@param aVelocity 
sl@0
   286
       Velocity with which to stop the note. 0 <= aVelocity <= 127. There is no 
sl@0
   287
	   standard behaviour corresponding with note off velocity.
sl@0
   288
*/
sl@0
   289
EXPORT_C void CMidiClientUtility::NoteOffL(TInt aChannel,TInt aNote,TInt aVelocity)
sl@0
   290
	{
sl@0
   291
	iBody->NoteOffL(aChannel, aNote, aVelocity);
sl@0
   292
	}
sl@0
   293
sl@0
   294
/**
sl@0
   295
Gets the current playback rate factor of the currently open MIDI resource.
sl@0
   296
The playback rate is independent from tempo,
sl@0
   297
i.e., it can be used to give an overall speed factor for playback
sl@0
   298
sl@0
   299
@return Current playback rate in percent times 1000,
sl@0
   300
        i.e., 100000 means original playback speed, 200000 means double speed,
sl@0
   301
        and 50000 means half speed playback
sl@0
   302
*/
sl@0
   303
EXPORT_C TInt CMidiClientUtility::PlaybackRateL() const
sl@0
   304
	{
sl@0
   305
	return iBody->PlaybackRateL();
sl@0
   306
	}
sl@0
   307
sl@0
   308
/**
sl@0
   309
Sets the playback rate for the playback of the current MIDI resource.
sl@0
   310
The playback rate is independent from tempo,
sl@0
   311
i.e., it can be used to give an overall speed factor for playback.
sl@0
   312
May be called whether playback is in progress or not.
sl@0
   313
sl@0
   314
@param aRate 
sl@0
   315
       Playback rate in percent times 1000,
sl@0
   316
       i.e., 100000 means original playback speed, 200000 means double speed,
sl@0
   317
       and 50000 means half speed playback
sl@0
   318
*/
sl@0
   319
EXPORT_C void CMidiClientUtility::SetPlaybackRateL(TInt aRate)
sl@0
   320
	{
sl@0
   321
	iBody->SetPlaybackRateL(aRate);
sl@0
   322
	}
sl@0
   323
sl@0
   324
/**
sl@0
   325
Gets the maximum playback rate in milli-percentage from the MIDI engine.
sl@0
   326
@see SetPlaybackRate() for milli-percentage details
sl@0
   327
sl@0
   328
@return Maximum playback rate supported by MIDI player
sl@0
   329
*/
sl@0
   330
EXPORT_C TInt CMidiClientUtility::MaxPlaybackRateL() const
sl@0
   331
	{
sl@0
   332
	return iBody->MaxPlaybackRateL();
sl@0
   333
	}
sl@0
   334
sl@0
   335
/**
sl@0
   336
Gets the minimum playback rate in milli-percentage from the MIDI engine.
sl@0
   337
@see SetPlaybackRate() for milli-percentage details.
sl@0
   338
sl@0
   339
@return Minimum playback rate supported by MIDI player.
sl@0
   340
*/
sl@0
   341
EXPORT_C TInt CMidiClientUtility::MinPlaybackRateL() const
sl@0
   342
	{
sl@0
   343
	return iBody->MinPlaybackRateL();
sl@0
   344
	}
sl@0
   345
sl@0
   346
/**
sl@0
   347
Gets the current tempo of the currently open MIDI resource. The tempo is independent
sl@0
   348
from the playback rate, i.e., the resulting playback speed will be affected by both.
sl@0
   349
sl@0
   350
@return Tempo at the current position of the currently open resource in microbeats per minute,
sl@0
   351
        i.e. BPM * 1000000. Filled in by the controller framework
sl@0
   352
*/
sl@0
   353
EXPORT_C TInt CMidiClientUtility::TempoMicroBeatsPerMinuteL() const
sl@0
   354
	{
sl@0
   355
	return iBody->TempoMicroBeatsPerMinuteL();
sl@0
   356
	}
sl@0
   357
sl@0
   358
/**
sl@0
   359
Sets the tempo at which the current MIDI resource should be played.
sl@0
   360
May be called whether playback is in progress or not.
sl@0
   361
The tempo is independent from the playback rate,
sl@0
   362
i.e., the resulting playback speed will be affected by both
sl@0
   363
sl@0
   364
@param aMicroBeatsPerMinute 
sl@0
   365
       Tempo in microbeats per minute (BPM*1000000) to set
sl@0
   366
*/
sl@0
   367
EXPORT_C void CMidiClientUtility::SetTempoL(TInt aMicroBeatsPerMinute)
sl@0
   368
	{
sl@0
   369
	iBody->SetTempoL(aMicroBeatsPerMinute);
sl@0
   370
	}
sl@0
   371
sl@0
   372
/**
sl@0
   373
Gets the pitch shift in use for the currently open MIDI resource
sl@0
   374
sl@0
   375
@return Pitch shift in cents, i.e. semitones * 100. One octave equals 1200 cents
sl@0
   376
*/
sl@0
   377
EXPORT_C TInt CMidiClientUtility::PitchTranspositionCentsL() const
sl@0
   378
	{
sl@0
   379
	return iBody->PitchTranspositionCentsL();
sl@0
   380
	}
sl@0
   381
sl@0
   382
/**
sl@0
   383
Sets the pitch shift to apply to the currently open MIDI resource.
sl@0
   384
May be called during playback
sl@0
   385
aCents parameter is not checked - if the value is out of range, it is expected KErrArgument is return by MIDI engine.
sl@0
   386
sl@0
   387
@param aCents 
sl@0
   388
       Pitch shift in cents, i.e. semitones * 100. One octave equals 1200 cents
sl@0
   389
@return Actual pitch shift applied -
sl@0
   390
        may differ from the requested value due to limitations of the MIDI engine
sl@0
   391
*/
sl@0
   392
EXPORT_C TInt CMidiClientUtility::SetPitchTranspositionL(TInt aCents)
sl@0
   393
	{
sl@0
   394
	return iBody->SetPitchTranspositionL(aCents);
sl@0
   395
	}
sl@0
   396
sl@0
   397
/**
sl@0
   398
Gets the length of the currently open MIDI resource in micro-seconds
sl@0
   399
sl@0
   400
@return Duration in microseconds (seconds * 1000000).
sl@0
   401
*/
sl@0
   402
EXPORT_C TTimeIntervalMicroSeconds CMidiClientUtility::DurationMicroSecondsL() const
sl@0
   403
	{
sl@0
   404
	return iBody->DurationMicroSecondsL();
sl@0
   405
	}
sl@0
   406
sl@0
   407
/**
sl@0
   408
Gets the length of the currently open MIDI resource in micro-beats
sl@0
   409
sl@0
   410
@return Duration in microbeats (beats * 1000000).
sl@0
   411
*/
sl@0
   412
EXPORT_C TInt64 CMidiClientUtility::DurationMicroBeatsL() const
sl@0
   413
	{
sl@0
   414
	return iBody->DurationMicroBeatsL();
sl@0
   415
	}
sl@0
   416
sl@0
   417
/**
sl@0
   418
Gets the number of tracks present in the currently open MIDI resource
sl@0
   419
sl@0
   420
@return Number of tracks
sl@0
   421
*/
sl@0
   422
EXPORT_C TInt CMidiClientUtility::NumTracksL() const
sl@0
   423
	{
sl@0
   424
	return iBody->NumTracksL();
sl@0
   425
	}
sl@0
   426
sl@0
   427
/**
sl@0
   428
Mutes or unmutes a particular track
sl@0
   429
sl@0
   430
@param aTrack
sl@0
   431
       Index of the track to mute - 0 <= aTrack < NumTracksL().
sl@0
   432
@param aMuted
sl@0
   433
       ETrue to mute the track, EFalse to unmute it.
sl@0
   434
*/
sl@0
   435
EXPORT_C void CMidiClientUtility::SetTrackMuteL(TInt aTrack,TBool aMuted) const
sl@0
   436
	{
sl@0
   437
	iBody->SetTrackMuteL(aTrack, aMuted);
sl@0
   438
	}
sl@0
   439
sl@0
   440
sl@0
   441
/**
sl@0
   442
Gets the MIME type of the MIDI resource currently open
sl@0
   443
sl@0
   444
@return Descriptor containing the MIDI mime type
sl@0
   445
*/
sl@0
   446
EXPORT_C const TDesC8& CMidiClientUtility::MimeTypeL()
sl@0
   447
	{
sl@0
   448
	return iBody->MimeTypeL();
sl@0
   449
	}
sl@0
   450
sl@0
   451
/**
sl@0
   452
Gets the current temporal position of the MIDI resource being played.
sl@0
   453
sl@0
   454
@return Microseconds relative to the start of the resource
sl@0
   455
*/
sl@0
   456
EXPORT_C TTimeIntervalMicroSeconds CMidiClientUtility::PositionMicroSecondsL() const
sl@0
   457
	{
sl@0
   458
	return iBody->PositionMicroSecondsL();
sl@0
   459
	}
sl@0
   460
sl@0
   461
/**
sl@0
   462
Change the position of the currently playing MIDI resource to the given position.
sl@0
   463
May be called whenever a MIDI resource is open
sl@0
   464
sl@0
   465
@param aPosition
sl@0
   466
       Temporal position to move to. Clamped to (0, DurationMicroSecondsL()).
sl@0
   467
*/
sl@0
   468
EXPORT_C void CMidiClientUtility::SetPositionMicroSecondsL(const TTimeIntervalMicroSeconds& aPosition)
sl@0
   469
	{
sl@0
   470
	iBody->SetPositionMicroSecondsL(aPosition);
sl@0
   471
	}
sl@0
   472
sl@0
   473
/**
sl@0
   474
Gets the current metrical position of the MIDI resource being played
sl@0
   475
sl@0
   476
@return Microbeats (BPM*1000000) relative to the start of the resource
sl@0
   477
*/
sl@0
   478
EXPORT_C TInt64 CMidiClientUtility::PositionMicroBeatsL() const
sl@0
   479
	{
sl@0
   480
	return iBody->PositionMicroBeatsL();
sl@0
   481
	}
sl@0
   482
sl@0
   483
/**
sl@0
   484
Change the position of the currently playing MIDI resource to the given position.
sl@0
   485
May be called whenever a MIDI resource is open.
sl@0
   486
sl@0
   487
@param aMicroBeats 
sl@0
   488
       Metrical position to move to. Clamped to (0, DurationMicroBeatsL()).
sl@0
   489
*/
sl@0
   490
EXPORT_C void CMidiClientUtility::SetPositionMicroBeatsL(TInt64 aMicroBeats)
sl@0
   491
	{
sl@0
   492
	iBody->SetPositionMicroBeatsL(aMicroBeats);
sl@0
   493
	}
sl@0
   494
sl@0
   495
/**
sl@0
   496
Sets the frequency at which MMIDIClientUtilityObserver::MmcuoSyncUpdateL(…) is called
sl@0
   497
to allow other components to synchronise with playback of this MIDI resource
sl@0
   498
sl@0
   499
@param aMicroSeconds 
sl@0
   500
       Temporal interval to callback at. Used in preference to aMicroBeats if both are set
sl@0
   501
@param aMicroBeats 
sl@0
   502
       Metrical interval to callback at. Set both parameters to zero to cancel.
sl@0
   503
*/
sl@0
   504
EXPORT_C void CMidiClientUtility::SetSyncUpdateCallbackIntervalL(const TTimeIntervalMicroSeconds& aMicroSeconds,TInt64 aMicroBeats)
sl@0
   505
	{
sl@0
   506
	iBody->SetSyncUpdateCallbackIntervalL(aMicroSeconds, aMicroBeats);
sl@0
   507
	}
sl@0
   508
sl@0
   509
/**
sl@0
   510
Sends a single MIDI message to the MIDI engine
sl@0
   511
sl@0
   512
@param aMidiMessage 
sl@0
   513
       Descriptor containing the MIDI message data.
sl@0
   514
       If there are several MIDI messages in the buffer, only the first one is processed
sl@0
   515
*/
sl@0
   516
EXPORT_C TInt CMidiClientUtility::SendMessageL(const TDesC8& aMidiMessage)
sl@0
   517
	{
sl@0
   518
	return iBody->SendMessageL(aMidiMessage);
sl@0
   519
	}
sl@0
   520
sl@0
   521
/**
sl@0
   522
Sends a single MIDI message, with time stamp, to the MIDI engine
sl@0
   523
sl@0
   524
@param aMidiMessage 
sl@0
   525
       Descriptor containing the MIDI message data.
sl@0
   526
       If there are several MIDI messages in the buffer, only the first one is processed
sl@0
   527
@param aTime 
sl@0
   528
       The time at which to execute the message, relative to the MIDI resource playing
sl@0
   529
       time or the time elapsed since Play() was called if no resource is present
sl@0
   530
*/
sl@0
   531
EXPORT_C TInt CMidiClientUtility::SendMessageL(const TDesC8& aMidiMessage,const TTimeIntervalMicroSeconds& aTime)
sl@0
   532
	{
sl@0
   533
	return iBody->SendMessageL(aMidiMessage, aTime);
sl@0
   534
	}
sl@0
   535
sl@0
   536
/**
sl@0
   537
Sends a mip message to the MIDI engine. This is a convenience function,
sl@0
   538
because the same functionality could be achieved with the SendMessage() function
sl@0
   539
sl@0
   540
@param aEntry 
sl@0
   541
       Array of logical {channel, MIP} value pairs to send, highest priority first
sl@0
   542
*/
sl@0
   543
EXPORT_C void CMidiClientUtility::SendMipMessageL(const RArray<TMipMessageEntry>& aEntry)
sl@0
   544
	{
sl@0
   545
	iBody->SendMipMessageL(aEntry);
sl@0
   546
	}
sl@0
   547
sl@0
   548
/**
sl@0
   549
Gets the number of standard or custom sound banks currently available
sl@0
   550
sl@0
   551
@param aCustom 
sl@0
   552
       Specifies whether to reference a custom or standard sound bank
sl@0
   553
@return Number of custom or standard sound banks available
sl@0
   554
*/
sl@0
   555
EXPORT_C TInt CMidiClientUtility::NumberOfBanksL(TBool aCustom) const
sl@0
   556
	{
sl@0
   557
	return iBody->NumberOfBanksL(aCustom);
sl@0
   558
	}
sl@0
   559
sl@0
   560
/**
sl@0
   561
Gets the identifier of a sound bank. Bank identifier (aka bank number) is a
sl@0
   562
14-bit value consisting of MIDI bank MSB and LSB values
sl@0
   563
sl@0
   564
@param  aCustom 
sl@0
   565
        Specifies whether to reference a custom or standard sound bank
sl@0
   566
@param  aBankIndex
sl@0
   567
        Index of sound bank where 0 <= aBankIndex < NumberOfBanksL(…)
sl@0
   568
@return Identifier of the specified bank occupying, at most, 14 bits
sl@0
   569
*/
sl@0
   570
EXPORT_C TInt CMidiClientUtility::GetBankIdL(TBool aCustom, TInt aBankIndex) const
sl@0
   571
	{
sl@0
   572
	return iBody->GetBankIdL(aCustom, aBankIndex);
sl@0
   573
	}
sl@0
   574
sl@0
   575
/**
sl@0
   576
Loads one or more custom sound banks from a file into memory for use.
sl@0
   577
If several banks are loaded with consequent LoadCustomBanksL() function calls,
sl@0
   578
the banks are combined if the bank sets have colliding bank numbers
sl@0
   579
sl@0
   580
@param aFileName 
sl@0
   581
       Name of the file containing the custom sound bank
sl@0
   582
@param aBankCollectionIndex 
sl@0
   583
       Identifier of the custom sound bank loaded, occupying no more than 14 bits
sl@0
   584
*/
sl@0
   585
EXPORT_C void CMidiClientUtility::LoadCustomBankL(const TDesC& aFileName, TInt& aBankCollectionIndex)
sl@0
   586
	{
sl@0
   587
	iBody->LoadCustomBankL(aFileName, aBankCollectionIndex);
sl@0
   588
	}
sl@0
   589
sl@0
   590
/**
sl@0
   591
Removes a custom sound bank from memory.
sl@0
   592
Only valid for sound banks previously loaded from file.
sl@0
   593
Once unloaded the custom sound bank is no longer available for use.
sl@0
   594
sl@0
   595
@param aBankCollectionIndex 
sl@0
   596
       Identifier of the custom sound bank to unload,
sl@0
   597
       occupying no more than 14 bits
sl@0
   598
*/
sl@0
   599
EXPORT_C void CMidiClientUtility::UnloadCustomBankL(TInt aBankCollectionIndex)
sl@0
   600
	{
sl@0
   601
	iBody->UnloadCustomBankL(aBankCollectionIndex);
sl@0
   602
	}
sl@0
   603
sl@0
   604
/**
sl@0
   605
Query if a bank has been loaded to the memory
sl@0
   606
sl@0
   607
@param aBankCollectionIndex 
sl@0
   608
       Identifier of the custom sound bank to check if it's in memory or not
sl@0
   609
@return ETrue if the specified bank is in memory, EFalse otherwise
sl@0
   610
*/
sl@0
   611
EXPORT_C TBool CMidiClientUtility::CustomBankLoadedL(TInt aBankCollectionIndex) const
sl@0
   612
	{
sl@0
   613
	return iBody->CustomBankLoadedL(aBankCollectionIndex);
sl@0
   614
	}
sl@0
   615
sl@0
   616
/**
sl@0
   617
Removes all custom sound banks from memory.
sl@0
   618
*/
sl@0
   619
EXPORT_C void CMidiClientUtility::UnloadAllCustomBanksL()
sl@0
   620
	{
sl@0
   621
	iBody->UnloadAllCustomBanksL();
sl@0
   622
	}
sl@0
   623
sl@0
   624
/**
sl@0
   625
Gets the number of instruments available in a given sound bank
sl@0
   626
sl@0
   627
@param aBankId 
sl@0
   628
       Identifier of sound bank to reference, occupying no more than 14 bits
sl@0
   629
@param aCustom 
sl@0
   630
       Specifies whether to reference a custom or standard sound bank
sl@0
   631
@return Count of the number of instruments available for the specified sound bank
sl@0
   632
*/
sl@0
   633
EXPORT_C TInt CMidiClientUtility::NumberOfInstrumentsL(TInt aBankId,TBool aCustom) const
sl@0
   634
	{
sl@0
   635
	return iBody->NumberOfInstrumentsL(aBankId, aCustom);
sl@0
   636
	}
sl@0
   637
sl@0
   638
/**
sl@0
   639
Gets the identifier of an instrument.
sl@0
   640
sl@0
   641
@param aBankId 
sl@0
   642
       Identifier of the sound bank to reference, occupying no more than 14 bits.
sl@0
   643
@param aCustom 
sl@0
   644
       Specifies whether to reference a custom or standard sound bank.
sl@0
   645
@param aInstrumentIndex 
sl@0
   646
       Index of the instrument to reference where 0 <= aInstrumentIndex < NumberOfInstrumentsL(). 
sl@0
   647
@return Identifier of specified instrument.
sl@0
   648
        This may differ from the index since the index simply enumerates the instruments,
sl@0
   649
        whereas identifiers may not be contiguous, especially where certain instruments
sl@0
   650
        correspond to General MIDI-defined instruments but not all instruments are
sl@0
   651
        present. Instrument identifiers are between 0 and 127 inclusive.
sl@0
   652
*/
sl@0
   653
EXPORT_C TInt CMidiClientUtility::GetInstrumentIdL(TInt aBankId,TBool aCustom,TInt aInstrumentIndex) const
sl@0
   654
	{
sl@0
   655
	return iBody->GetInstrumentIdL(aBankId, aCustom, aInstrumentIndex);
sl@0
   656
	}
sl@0
   657
sl@0
   658
/**
sl@0
   659
Gets the name of the given instrument.
sl@0
   660
sl@0
   661
@param  aBankId
sl@0
   662
        Identifier of the bank that the instrument belongs to, occupying no more than 14 bits
sl@0
   663
@param  aCustom
sl@0
   664
        Specifies whether to reference a custom or standard sound bank
sl@0
   665
@param  aInstrumentId
sl@0
   666
        Identifier of the instrument under scrutiny. 0 <= iInstrumentId <= 127.
sl@0
   667
@return Buffer containing the name of the specified instrument.
sl@0
   668
        If it has no name then an empty descriptor is returned
sl@0
   669
*/
sl@0
   670
EXPORT_C HBufC* CMidiClientUtility::InstrumentNameL(TInt aBankId, TBool aCustom, TInt aInstrumentId) const
sl@0
   671
	{
sl@0
   672
	return iBody->InstrumentNameL(aBankId, aCustom, aInstrumentId);
sl@0
   673
	}
sl@0
   674
sl@0
   675
/**
sl@0
   676
Sets a logical channel to use the given instrument.
sl@0
   677
sl@0
   678
@param aChannel 
sl@0
   679
       Logical channel to set the instrument for. 0 <= aChannel <= 15
sl@0
   680
@param aBankId 
sl@0
   681
       Identifier of the bank that the instrument belongs to,
sl@0
   682
       occupying no more than 14 bits.
sl@0
   683
       The bank ID is a concatenation of MIDI bank MSB and LSB values
sl@0
   684
@param aInstrumentId 
sl@0
   685
       Identifier of the instrument under scrutiny. 0 <= iInstrumentId <= 127.
sl@0
   686
*/
sl@0
   687
EXPORT_C void CMidiClientUtility::SetInstrumentL(TInt aChannel,TInt aBankId,TInt aInstrumentId)
sl@0
   688
	{
sl@0
   689
	iBody->SetInstrumentL(aChannel, aBankId, aInstrumentId);
sl@0
   690
	}
sl@0
   691
sl@0
   692
/**
sl@0
   693
Loads an individual instrument from file into custom sound bank memory for use.
sl@0
   694
The bank and instrument ids given in the file can be mapped into different bank
sl@0
   695
and instrument ids in memory
sl@0
   696
sl@0
   697
@param aFileName 
sl@0
   698
       Name of the file containing the instrument
sl@0
   699
@param aFileBankId 
sl@0
   700
       Identifier of the bank in the file from which to load the instrument,
sl@0
   701
       occupying no more than 14 bits
sl@0
   702
@param aFileInstrumentId 
sl@0
   703
       Identifier of the instrument to load. 0 <= aInstrumentId <= 127
sl@0
   704
@param aMemoryBankId 
sl@0
   705
       Identifier of the custom bank in memory to load the instrument into,
sl@0
   706
       occupying no more than 14 bits.
sl@0
   707
@param aMemoryInstrumentId 
sl@0
   708
       Identifier of the instrument in memory to load the new
sl@0
   709
       instrument into. 0 <= aInstrumentId <= 127.
sl@0
   710
*/
sl@0
   711
EXPORT_C void CMidiClientUtility::LoadCustomInstrumentL(const TDesC& aFileName,TInt aFileBankId,TInt aFileInstrumentId,TInt aMemoryBankId,TInt aMemoryInstrumentId)
sl@0
   712
	{
sl@0
   713
	iBody->LoadCustomInstrumentL(aFileName, aFileBankId, aFileInstrumentId, aMemoryBankId, aMemoryInstrumentId);
sl@0
   714
	}
sl@0
   715
sl@0
   716
/**
sl@0
   717
Removes an instrument from custom sound bank memory.
sl@0
   718
Only valid for instruments previously loaded from file.
sl@0
   719
Once unloaded the instrument is no longer available for use
sl@0
   720
sl@0
   721
@param aCustomBankId 
sl@0
   722
       Identifier of the custom sound bank containing
sl@0
   723
       the instrument to unload, occupying no more than 14 bits.
sl@0
   724
@param aInstrumentId 
sl@0
   725
       Identifier of the instrument to unload. 0 <= aInstrumentId <= 127
sl@0
   726
*/
sl@0
   727
EXPORT_C void CMidiClientUtility::UnloadCustomInstrumentL(TInt aCustomBankId,TInt aInstrumentId)
sl@0
   728
	{
sl@0
   729
	iBody->UnloadCustomInstrumentL(aCustomBankId, aInstrumentId);
sl@0
   730
	}
sl@0
   731
sl@0
   732
/**
sl@0
   733
Gets the name of a particular percussion key corresponding to a given note.
sl@0
   734
sl@0
   735
@param aNote 
sl@0
   736
       Note to query. 0 <= aNote <= 127
sl@0
   737
@param aBankId 
sl@0
   738
       Identifier of the bank that the instrument belongs to, occupying no more than 14 bits.
sl@0
   739
       The bank ID is a concatenation of MIDI bank MSB and LSB values.
sl@0
   740
@param aCustom 
sl@0
   741
       Specifies whether to reference a custom or standard sound bank
sl@0
   742
@param aInstrumentId 
sl@0
   743
       Identifier of an instrument
sl@0
   744
@return Descriptor containing the name of the percussion key.
sl@0
   745
        If the key does not have a name then an empty descriptor is returned
sl@0
   746
*/
sl@0
   747
EXPORT_C HBufC* CMidiClientUtility::PercussionKeyNameL(TInt aNote, TInt aBankId, TBool aCustom, TInt aInstrumentId) const
sl@0
   748
	{
sl@0
   749
	return iBody->PercussionKeyNameL(aNote, aBankId, aCustom, aInstrumentId);
sl@0
   750
	}
sl@0
   751
sl@0
   752
/**
sl@0
   753
Get the stop time currently set for the MIDI resource
sl@0
   754
sl@0
   755
@param aStopTime 
sl@0
   756
       Time at which playback will stop, relative to the start of the resource
sl@0
   757
*/
sl@0
   758
EXPORT_C void CMidiClientUtility::StopTimeL(TTimeIntervalMicroSeconds& aStopTime) const
sl@0
   759
	{
sl@0
   760
	iBody->StopTimeL(aStopTime);
sl@0
   761
	}
sl@0
   762
sl@0
   763
/**
sl@0
   764
Sets the stop time to use for the currently open MIDI resource
sl@0
   765
sl@0
   766
@param aStopTime 
sl@0
   767
       Time at which playback will stop, relative to the start of the resource.
sl@0
   768
       Clamped to 0 and the duration of the resource
sl@0
   769
*/
sl@0
   770
EXPORT_C void CMidiClientUtility::SetStopTimeL(const TTimeIntervalMicroSeconds& aStopTime)
sl@0
   771
	{
sl@0
   772
	iBody->SetStopTimeL(aStopTime);
sl@0
   773
	}
sl@0
   774
sl@0
   775
/**
sl@0
   776
Set the number of times to repeat the current MIDI resource.
sl@0
   777
After Stop() has been called, repeat number of times and the trailing silence are reset
sl@0
   778
sl@0
   779
@param aRepeatNumberOfTimes 
sl@0
   780
       Number of time to repeat the resource during playback.
sl@0
   781
       This includes the first playing
sl@0
   782
@param aTrailingSilence 
sl@0
   783
       Time in microseconds to pause between repeats
sl@0
   784
*/
sl@0
   785
EXPORT_C void CMidiClientUtility::SetRepeatsL(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence)
sl@0
   786
	{
sl@0
   787
	iBody->SetRepeatsL(aRepeatNumberOfTimes, aTrailingSilence);
sl@0
   788
	}
sl@0
   789
sl@0
   790
/**
sl@0
   791
Gets the number of currently active voices.
sl@0
   792
sl@0
   793
@return The number of currently active voices
sl@0
   794
*/
sl@0
   795
EXPORT_C TInt CMidiClientUtility::PolyphonyL() const
sl@0
   796
	{
sl@0
   797
	return iBody->PolyphonyL();
sl@0
   798
	}
sl@0
   799
sl@0
   800
/**
sl@0
   801
Gets the maximum number of logical channels supported by the MIDI engine.
sl@0
   802
sl@0
   803
@return  The maximum number of logical channels that the MIDI engine supports, 0 <= aChannels <=15.
sl@0
   804
*/
sl@0
   805
EXPORT_C TInt CMidiClientUtility::ChannelsSupportedL() const
sl@0
   806
	{
sl@0
   807
	return iBody->ChannelsSupportedL();
sl@0
   808
	}
sl@0
   809
sl@0
   810
/**
sl@0
   811
Get the current volume setting of a logical channel
sl@0
   812
sl@0
   813
@param aChannel 
sl@0
   814
       Logical channel to query. 0 <= aChannel <= 15.
sl@0
   815
@return Volume currently set on the specified channel in decibels
sl@0
   816
*/
sl@0
   817
EXPORT_C TReal32 CMidiClientUtility::ChannelVolumeL(TInt aChannel) const
sl@0
   818
	{
sl@0
   819
	return iBody->ChannelVolumeL(aChannel);
sl@0
   820
	}
sl@0
   821
sl@0
   822
/**
sl@0
   823
Gets the Maximum volume setting that may be applied to a logical channel
sl@0
   824
sl@0
   825
@return Maximum volume setting. Minimum value is -infinity dB, which is the
sl@0
   826
       smallest possible value that TReal32 supports.
sl@0
   827
*/
sl@0
   828
EXPORT_C TReal32 CMidiClientUtility::MaxChannelVolumeL() const
sl@0
   829
	{
sl@0
   830
	return iBody->MaxChannelVolumeL();
sl@0
   831
	}
sl@0
   832
sl@0
   833
/**
sl@0
   834
Set the volume of a channel.
sl@0
   835
sl@0
   836
@param aChannel 
sl@0
   837
       Logical channel to set the volume on. 0 <= aChannel <= 15
sl@0
   838
@param aVolume 
sl@0
   839
       Volume currently set on the specified channel in decibels. The minimum
sl@0
   840
       channel volume supported value is -infinity dB, which is the smallest
sl@0
   841
       possible value that TReal32 supports. 
sl@0
   842
	   The maximum channel volume can be set via MaxChannelVolumeL()
sl@0
   843
*/
sl@0
   844
EXPORT_C void CMidiClientUtility::SetChannelVolumeL(TInt aChannel,TReal32 aVolume)
sl@0
   845
	{
sl@0
   846
	iBody->SetChannelVolumeL(aChannel, aVolume);
sl@0
   847
	}
sl@0
   848
sl@0
   849
/**
sl@0
   850
Set the muting state of a channel without changing its volume setting.
sl@0
   851
When unmuted the channel goes back to its previous volume setting
sl@0
   852
sl@0
   853
@param aChannel 
sl@0
   854
       Logical channel to set the mute state of. 0 <= aChannel <= 15.
sl@0
   855
@param aMuted 
sl@0
   856
       ETrue to mute the channel, EFalse to unmute it.
sl@0
   857
*/
sl@0
   858
EXPORT_C void CMidiClientUtility::SetChannelMuteL(TInt aChannel,TBool aMuted)
sl@0
   859
	{
sl@0
   860
	iBody->SetChannelMuteL(aChannel, aMuted);
sl@0
   861
	}
sl@0
   862
sl@0
   863
/**
sl@0
   864
Gets the overall volume of the MIDI client.
sl@0
   865
sl@0
   866
@return The current overall volume setting
sl@0
   867
*/
sl@0
   868
EXPORT_C TInt CMidiClientUtility::VolumeL() const
sl@0
   869
	{
sl@0
   870
	return iBody->VolumeL();
sl@0
   871
	}
sl@0
   872
sl@0
   873
/**
sl@0
   874
Maximum volume setting that may be applied overall.
sl@0
   875
sl@0
   876
@return Maximum volume setting. Minimum value is always zero which is silent
sl@0
   877
*/
sl@0
   878
EXPORT_C TInt CMidiClientUtility::MaxVolumeL() const
sl@0
   879
	{
sl@0
   880
	return iBody->MaxVolumeL();
sl@0
   881
	}
sl@0
   882
sl@0
   883
/**
sl@0
   884
Set the overall volume of the MIDI client.
sl@0
   885
This setting scales all channel volumes respectively so the actual volume
sl@0
   886
that a channel is played at is (overall volume * channel volume / max volume).
sl@0
   887
sl@0
   888
@param aVolume 
sl@0
   889
       Overall volume setting to use
sl@0
   890
*/
sl@0
   891
EXPORT_C void CMidiClientUtility::SetVolumeL(TInt aVolume)
sl@0
   892
	{
sl@0
   893
	iBody->SetVolumeL(aVolume);
sl@0
   894
	}
sl@0
   895
sl@0
   896
/**
sl@0
   897
Length of time over which the volume is faded up from zero to the current settings
sl@0
   898
when playback is started.
sl@0
   899
sl@0
   900
@param aRampDuration 
sl@0
   901
       Duration of the ramping period.
sl@0
   902
*/
sl@0
   903
EXPORT_C void CMidiClientUtility::SetVolumeRampL(const TTimeIntervalMicroSeconds& aRampDuration)
sl@0
   904
	{
sl@0
   905
	iBody->SetVolumeRampL(aRampDuration);
sl@0
   906
	}
sl@0
   907
sl@0
   908
/**
sl@0
   909
Get the current stereo balance value
sl@0
   910
sl@0
   911
@return Balance value ranging from KMMFBalanceMaxLeft to KMMFBalanceMaxRight
sl@0
   912
*/
sl@0
   913
EXPORT_C TInt CMidiClientUtility::GetBalanceL() const
sl@0
   914
	{
sl@0
   915
	return iBody->GetBalanceL();
sl@0
   916
	}
sl@0
   917
sl@0
   918
/**
sl@0
   919
Set the current stereo balance value
sl@0
   920
sl@0
   921
@param aBalance 
sl@0
   922
       Balance value to set. Defaults to KMMFBalanceCenter to restore equal left-right balance
sl@0
   923
*/
sl@0
   924
EXPORT_C void CMidiClientUtility::SetBalanceL(TInt aBalance)
sl@0
   925
	{
sl@0
   926
	iBody->SetBalanceL(aBalance);
sl@0
   927
	}
sl@0
   928
sl@0
   929
/**
sl@0
   930
Set the priority with which this client plays MIDI data
sl@0
   931
sl@0
   932
@param  aPriority
sl@0
   933
        The Priority Value.
sl@0
   934
@param  aPref
sl@0
   935
        The Priority Preference.
sl@0
   936
        
sl@0
   937
@see CMidiClientUtility::NewL()
sl@0
   938
*/
sl@0
   939
EXPORT_C void CMidiClientUtility::SetPriorityL(TInt aPriority, TInt aPref)
sl@0
   940
	{
sl@0
   941
	iBody->SetPriorityL(aPriority, aPref);
sl@0
   942
	}
sl@0
   943
sl@0
   944
/**
sl@0
   945
Get the number of meta data entries currently known about in the currently open
sl@0
   946
resource. XMF,SMF meta data are part of the XMF,SMF file header and can thus be examined
sl@0
   947
before playback. If there is no XMF,SMF resource open, will return zero.
sl@0
   948
Standard MIDI file meta data entries encountered during playback will be passed back
sl@0
   949
via MMIDIClientUtilityObserver::MmcuoMetaDataEntryFound()
sl@0
   950
sl@0
   951
@return Number of XMF meta data entries currently known about
sl@0
   952
*/
sl@0
   953
EXPORT_C TInt CMidiClientUtility::NumberOfMetaDataEntriesL() const
sl@0
   954
	{
sl@0
   955
	return iBody->NumberOfMetaDataEntriesL();
sl@0
   956
	}
sl@0
   957
sl@0
   958
/**
sl@0
   959
Retrieve the specified XMF,SMF meta data entry.
sl@0
   960
sl@0
   961
@param aMetaDataIndex 
sl@0
   962
       Index of the meta data entry to retrieve
sl@0
   963
@return Meta data entry. Ownership is passed to the client.
sl@0
   964
*/
sl@0
   965
EXPORT_C CMMFMetaDataEntry* CMidiClientUtility::GetMetaDataEntryL(TInt aMetaDataIndex) const
sl@0
   966
	{
sl@0
   967
	return iBody->GetMetaDataEntryL(aMetaDataIndex);
sl@0
   968
	}
sl@0
   969
sl@0
   970
/**
sl@0
   971
Synchronously pass implementation-specific commands to the MIDI engine
sl@0
   972
and receive a response
sl@0
   973
sl@0
   974
@param aDestination 
sl@0
   975
       Recipient of the message. Should be initialised with KUidInterfaceMIDI
sl@0
   976
       and a TInt describing the server-side object to which the command should be delivered.
sl@0
   977
       The TInt will usually be KMMFObjectHandleController, to deliver the message to the
sl@0
   978
       controller plugin, which is the default value.
sl@0
   979
@param aFunction 
sl@0
   980
       Index of the function to perform
sl@0
   981
@param aDataTo1 
sl@0
   982
       First command data buffer to send, eg command parameters
sl@0
   983
@param aDataTo2 
sl@0
   984
       Second command data buffer to send, eg data parameters
sl@0
   985
@param aDataFrom 
sl@0
   986
       Buffer to receive data in response to the command.
sl@0
   987
       The user must ensure that it is large enough to hold all the data returned.
sl@0
   988
*/
sl@0
   989
EXPORT_C void CMidiClientUtility::CustomCommandSyncL(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom)
sl@0
   990
	{
sl@0
   991
	iBody->CustomCommandSyncL(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
sl@0
   992
	}
sl@0
   993
sl@0
   994
/**
sl@0
   995
Synchronously pass implementation-specific commands to the MIDI engine.
sl@0
   996
sl@0
   997
@param aDestination 
sl@0
   998
       Recipient of the message. Should be initialised with KUidInterfaceMIDI
sl@0
   999
       and a TInt describing the server-side object to which the command should be delivered.
sl@0
  1000
       The TInt will usually be KMMFObjectHandleController, to deliver the message to the
sl@0
  1001
       controller plugin, which is the default value.
sl@0
  1002
@param aFunction 
sl@0
  1003
       Index of the function to perform
sl@0
  1004
@param aDataTo1 
sl@0
  1005
       First command data buffer to send, eg command parameters
sl@0
  1006
@param aDataTo2 
sl@0
  1007
       Second command data buffer to send, eg data parameters
sl@0
  1008
*/
sl@0
  1009
EXPORT_C void CMidiClientUtility::CustomCommandSyncL(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2)
sl@0
  1010
	{
sl@0
  1011
	iBody->CustomCommandSyncL(aDestination, aFunction, aDataTo1, aDataTo2);
sl@0
  1012
	}
sl@0
  1013
sl@0
  1014
/**
sl@0
  1015
Asynchronously pass implementation-specific commands to the MIDI engine
sl@0
  1016
and receive a response
sl@0
  1017
sl@0
  1018
@param aDestination 
sl@0
  1019
       aDestination Recipient of the message. Should be initialised with KUidInterfaceMIDI
sl@0
  1020
       and a TInt describing the server-side object to which the command should be delivered.
sl@0
  1021
       The TInt will usually be KMMFObjectHandleController, to deliver the message to the
sl@0
  1022
       controller plugin, which is the default value.
sl@0
  1023
@param aFunction 
sl@0
  1024
       Index of the function to perform
sl@0
  1025
@param aDataTo1 
sl@0
  1026
       First command data buffer to send, eg command parameters
sl@0
  1027
@param aDataTo2 
sl@0
  1028
       Second command data buffer to send, eg data parameters
sl@0
  1029
@param aDataFrom 
sl@0
  1030
       Buffer to receive data in response to the command.
sl@0
  1031
       The user must ensure that it is large enough to hold all the data returned.
sl@0
  1032
@param aStatus
sl@0
  1033
       Status flag belonging to an active object that will have it's RunL() called
sl@0
  1034
       when this request complete
sl@0
  1035
*/
sl@0
  1036
EXPORT_C void CMidiClientUtility::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus)
sl@0
  1037
	{
sl@0
  1038
	iBody->CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
sl@0
  1039
	}
sl@0
  1040
sl@0
  1041
/**
sl@0
  1042
Asynchronously pass implementation-specific commands to the MIDI engine
sl@0
  1043
sl@0
  1044
@param aDestination 
sl@0
  1045
       aDestination Recipient of the message. Should be initialised with KUidInterfaceMIDI
sl@0
  1046
       and a TInt describing the server-side object to which the command should be delivered.
sl@0
  1047
       The TInt will usually be KMMFObjectHandleController, to deliver the message to the
sl@0
  1048
       controller plugin, which is the default value.
sl@0
  1049
@param aFunction 
sl@0
  1050
       Index of the function to perform
sl@0
  1051
@param aDataTo1 
sl@0
  1052
       First command data buffer to send, eg command parameters
sl@0
  1053
@param aDataTo2 
sl@0
  1054
       Second command data buffer to send, eg data parameters
sl@0
  1055
@param aStatus 
sl@0
  1056
       Status flag belonging to an active object that will have it's RunL() called
sl@0
  1057
       when this request complete
sl@0
  1058
*/
sl@0
  1059
EXPORT_C void CMidiClientUtility::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus)
sl@0
  1060
	{
sl@0
  1061
	iBody->CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
sl@0
  1062
	}
sl@0
  1063
sl@0
  1064
/**
sl@0
  1065
Gets a controller's DRM custom command implementation.
sl@0
  1066
sl@0
  1067
@return A pointer to a controller's DRM custom command implementation or NULL
sl@0
  1068
		if the interface can not be obtained
sl@0
  1069
*/
sl@0
  1070
EXPORT_C MMMFDRMCustomCommand* CMidiClientUtility::GetDRMCustomCommand()
sl@0
  1071
	{
sl@0
  1072
	return iBody->GetDRMCustomCommand();
sl@0
  1073
	}
sl@0
  1074
sl@0
  1075
/**
sl@0
  1076
Set the max polyphony the engine can handle
sl@0
  1077
sl@0
  1078
@param aMaxNotes 
sl@0
  1079
       Max polyphony level,  0 <= PolyphonyL() <= aMaxNotes
sl@0
  1080
*/
sl@0
  1081
EXPORT_C void CMidiClientUtility::SetMaxPolyphonyL(TInt aMaxNotes)
sl@0
  1082
	{
sl@0
  1083
	iBody->SetMaxPolyphonyL(aMaxNotes);
sl@0
  1084
	}
sl@0
  1085
sl@0
  1086
/**
sl@0
  1087
Gets the number of times the current opened resources has to be repeated
sl@0
  1088
sl@0
  1089
@return The number of time the current opened resources has to be repeated
sl@0
  1090
*/
sl@0
  1091
EXPORT_C TInt CMidiClientUtility::GetRepeats() const
sl@0
  1092
	{
sl@0
  1093
	return iBody->GetRepeats();
sl@0
  1094
	}
sl@0
  1095
sl@0
  1096
/**
sl@0
  1097
Loads one or more custom sound banks from a descriptor into memory for use.
sl@0
  1098
If several banks are loaded with consequent LoadCustomBanksL() function calls,
sl@0
  1099
the banks are combined if the bank sets have colliding bank numbers
sl@0
  1100
sl@0
  1101
@param aBankData 
sl@0
  1102
       Descriptor containing the custom sound bank
sl@0
  1103
@param aBankId 
sl@0
  1104
       Identifier of the custom sound bank loaded, occupying no more than 14 bits.
sl@0
  1105
*/
sl@0
  1106
EXPORT_C void CMidiClientUtility::LoadCustomBankDataL(const TDesC8& aBankData,TInt& aBankId)
sl@0
  1107
	{
sl@0
  1108
	iBody->LoadCustomBankDataL(aBankData, aBankId);
sl@0
  1109
	}
sl@0
  1110
sl@0
  1111
/**
sl@0
  1112
Loads an individual instrument from descriptor into custom sound bank memory for use.
sl@0
  1113
The bank and instrument ids given in the descriptor can be mapped into different bank
sl@0
  1114
and instrument ids in memory
sl@0
  1115
sl@0
  1116
@param aInstrumentData 
sl@0
  1117
       Descriptor containing the instrument
sl@0
  1118
@param aBankDataId 
sl@0
  1119
       Identifier of the bank in the descriptor from which to load the instrument,
sl@0
  1120
       occupying no more than 14 bits
sl@0
  1121
@param aInstrumentDataId 
sl@0
  1122
       Identifier of the instrument to load. 0 <= aInstrumentId <= 127
sl@0
  1123
@param aMemoryBankId 
sl@0
  1124
       Identifier of the custom bank in memory to load the instrument into,
sl@0
  1125
       occupying no more than 14 bits
sl@0
  1126
@param aMemoryInstrumentId 
sl@0
  1127
       Identifier of the instrument in memory to load the new
sl@0
  1128
       instrument into. 0 <= aInstrumentId <= 127.
sl@0
  1129
*/
sl@0
  1130
EXPORT_C void CMidiClientUtility::LoadCustomInstrumentDataL(const TDesC8& aInstrumentData, TInt aBankDataId, TInt aInstrumentDataId, TInt aMemoryBankId, TInt aMemoryInstrumentId)
sl@0
  1131
	{
sl@0
  1132
	iBody->LoadCustomInstrumentDataL(aInstrumentData, aBankDataId, aInstrumentDataId, aMemoryBankId, aMemoryInstrumentId);
sl@0
  1133
	}
sl@0
  1134
sl@0
  1135
/**
sl@0
  1136
Tell the MIDI engine to use a custom bank or a standard bank
sl@0
  1137
sl@0
  1138
@param aCustom 
sl@0
  1139
       If Etrue the custom bank in memory is used otherwise the standard bank
sl@0
  1140
       is used leaving the custom bank in memory
sl@0
  1141
*/
sl@0
  1142
EXPORT_C void CMidiClientUtility::SetBankL(TBool aCustom)
sl@0
  1143
	{
sl@0
  1144
	iBody->SetBankL(aCustom);
sl@0
  1145
	}
sl@0
  1146
sl@0
  1147
/**
sl@0
  1148
Gets the muting status of a specific track
sl@0
  1149
sl@0
  1150
@param aTrack 
sl@0
  1151
       The track to query
sl@0
  1152
@return The mute status of the track.
sl@0
  1153
*/
sl@0
  1154
EXPORT_C TBool CMidiClientUtility::IsTrackMuteL(TInt aTrack) const
sl@0
  1155
	{
sl@0
  1156
	return iBody->IsTrackMuteL(aTrack);
sl@0
  1157
	}
sl@0
  1158
sl@0
  1159
/**
sl@0
  1160
Gets the muting status of a specific channel
sl@0
  1161
sl@0
  1162
@param aChannel 
sl@0
  1163
       The channel to query
sl@0
  1164
@return The mute status of the channel
sl@0
  1165
*/
sl@0
  1166
EXPORT_C TBool CMidiClientUtility::IsChannelMuteL(TInt aChannel) const
sl@0
  1167
	{
sl@0
  1168
	return iBody->IsChannelMuteL(aChannel);
sl@0
  1169
	}
sl@0
  1170
sl@0
  1171
/**
sl@0
  1172
Gets the instrument assigned to a specified channel
sl@0
  1173
sl@0
  1174
@param aChannel 
sl@0
  1175
       Logical channel, 0 <= aChannel <= 15.
sl@0
  1176
@param aInstrumentId 
sl@0
  1177
       Identifier of the instrument assigned to aChannel. 0 <= iInstrumentId <= 127
sl@0
  1178
@param aBankId 
sl@0
  1179
       Identifier of the bank that the instrument belongs to, occupying no more than 14 bits
sl@0
  1180
*/
sl@0
  1181
EXPORT_C void CMidiClientUtility::GetInstrumentL(TInt aChannel, TInt& aInstrumentId, TInt& aBankId)
sl@0
  1182
	{
sl@0
  1183
	iBody->GetInstrumentL(aChannel, aInstrumentId, aBankId);
sl@0
  1184
	}
sl@0
  1185
sl@0
  1186
/**
sl@0
  1187
Get the maximum polyphony level that the engine can handle
sl@0
  1188
sl@0
  1189
@return The maximum number of simultaneous notes the engine can handle.
sl@0
  1190
		0 <= PolyphonyL() <= MaxPolyphonyL()
sl@0
  1191
*/
sl@0
  1192
EXPORT_C TInt CMidiClientUtility::MaxPolyphonyL() const
sl@0
  1193
	{
sl@0
  1194
	return iBody->MaxPolyphonyL();
sl@0
  1195
	}
sl@0
  1196