Playing Midi from TDesC8...
| Mon, 2004-01-12 16:46 | |
|
Hi all gurus.
I am successfully using CMdaAudioPlayerUtility and its NewFilePlayerL method, to play a Midi file. I tried to play that Midi file directly from the buffer containing the data (using NewDesPlayerL or NewDesPlayerReadOnlyL), but it does not work... The MapcInitComplete completion routine is never called, either with error or not. Series60 or UIQ. My first (and only) thought is that CMdaAudioPlayerUtility is not able to recognize that the data are Midi (even if it's not so complicated), and that it's only because a file is named with the ".mid" extension that it assumes that the data are Midi - but is there a way to make it recognize the data given in a buffer as Midi ones? Or at least to call the callback with an error? The reason why I want to do that is that the user will be offered to download a Midi file and play it - and then purchase it (or not). But if the file lies on the disk, it's too easy to duplicate it! Or is there a way to "hide" a file on the disk? Thanks for your attention, Daniel. |
|






Forum posts: 2006
I think - but I am not 100% sure - that there is a bug in the Media Server which prevent to play Midi data from a descriptor and that you will need to play it from a file.
Cheers,
Eric
Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant
Forum posts: 3
I think - but I am not 100% sure - that there is a bug in the Media Server which prevent to play Midi data from a descriptor and that you will need to play it from a file.
Cheers,
Eric
I was afraid of hearing such answer. I'll deal with it, then!
Regards,
Daniel.
Forum posts: 1
I can't make NewDesPlayerL play WAV data too.
Thanks
Nikos.
Forum posts: 63
Forum posts: 63
I also try play midi with v2.0 and it works fine, but with v1.0 doesnt work.
Are there any solution to convert midi or ota to other type and play it then? I don't want save sound to file and play it then. Can someone give me example code how to do it.
Forum posts: 23
Any ideas?
Thanks, Alex
Forum posts: 2
just joined up.
I've got a problem playing a MIDI TDesC8 too. When I call:
iMidiPlayer=CMidiClientUtility::NewL(*this)
it leaves with a KErrNotSupported error.
After reading this thread, I thought it might be possible to pass it to save it into a file using:
_LIT(KSoundStorageFile, "C:\\System\\Apps\\MyApp\\temp.mid");
TFileName fileName(KSoundStorageFile);
RFs& fs=CEikonEnv::Static()->FsSession();
RFile file;
TInt err = file.Replace(fs,fileName,EFileWrite);
if (err==KErrNone)
{
file.Close();
RFileWriteStream writer;
err = writer.Replace(fs,fileName,EFileWrite);
if (err==KErrNone)
{
writer<<soundBuf;
writer.PushL();
writer.CommitL();
writer.Close();
CleanupStack::Pop(); // writer
}
}
and then call:
CMdaAudioPlayerUtility::NewFilePlayerL(filename, *this);
but again I get the KErrNotSupported error in the callback:
MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aIntv)
Comparing the contents of a WAV file (which does work) with CMdaAudioPlayerUtility and the MIDI file (which doesn't), I see that the WAV file header info is:
"RIFFÃEWAVEfmt..."
whereas the MIDI file header is much longer:
"<MThd`MTrkuÿXÿQ©€Ã¿The Music in the Numbersÿ-Created with MusiNum 2.08 (C) Lars Kindermannÿ..."
This leads me to believe that only WAV files and not MIDI files cannot be passed into CMdaAudioPlayerUtility::NewFilePlayerL. Can anyone confirm this or tell me what I'm doing wrong?
Cheers
Rob
Forum posts: 23
#if WINS
// Play dummy wav file
#else
// Play real mid file
#endif
to my game code. Seems to work well.
Hope this helps.
Alex
Forum posts: 2
Cheers
Rob