Symbian
Symbian OS Library

FAQ-0880 How can I play a MIDI note when I have no MIDI source?

[Index][spacer] [Previous] [Next]



 

Classification: C++ Category: Development
Created: 06/06/2003 Modified: 06/11/2003
Number: FAQ-0880
Platform: Symbian OS v7.0s

Question:
The MIDI documentation tends to suggest that one requires a MIDI source (file or descriptor) in order to play MIDI.
Is it possible to play a note without a MIDI resource?



Answer:
Call PlayNoteL() directly after creating the CMidiClientUtility.
There is no need to open a source resource using OpenXxxL()

eg

CMidiClientUtility* midi=CMidiClientUtility::NewL(*this);
CleanupStack::PushL(midi);
TTimeIntervalMicroSeconds duration(1000000);
midi->PlayNoteL(1, 60, duration, 64, 64) //play middle C on channel 1 for 1 second at average velocity.
CleanupStack::PopAndDestroy();