Audio-->2 problem with MIDI

Started by
5 comments, last by BlueChip 20 years, 10 months ago
Hi folks =) I''ve 2 problems to play midi files: first: the midi reproduction is too many fast.... and with directmusic I can''t change it.... second: Only few effects are reproduct.... like the drums.. but not flautes.. guitars ecc... there are solutions?? do you want see my source first? thanks once again =)
Advertisement
Do you mean that you are unable to play the MIDI files on your system, or using your code? If they play correctly using a program such as the media player, then you might not be downloading the sounds via a call to IDirectMusicSegment8::Download.
Hi
yes... I''m able to play the MIDI files on my system (for exemple with MediaPlayer) but if I use my code, a lot of sounds aren''t reproduct....

I call IDirectMusicSegment8::Download ....
if I don''t call it, nothig is played ...

I''ve do many test, but it doesn''t work again...

Any help?? =)

byezzzzzzzzz






Now put some code to help you for to help me ^__^

This is the way that I follow:
1)CoCreateInstance( CLSID_DirectMusicLoader, NULL, CLSCTX_INPROC, IID_IDirectMusicLoader8, (void**)&m_pLoader )2)CoCreateInstance( CLSID_DirectMusicPerformance, NULL, CLSCTX_INPROC, IID_IDirectMusicPerformance8, (void**)&m_pPerformance )3)m_pPerformance->InitAudio( NULL, ppDirectSound, hWnd, DMUS_APATH_DYNAMIC_STEREO,   128, DMUS_AUDIOF_ALL, NULL )4)m_pLoader->GetObject( &objdesc,  IID_IDirectMusicSegment8, (void**)&pSegment )where objdesc is:    ZeroMemory(&objdesc,sizeof(DMUS_OBJECTDESC));    objdesc.dwSize = sizeof(DMUS_OBJECTDESC);    objdesc.dwValidData = DMUS_OBJ_MEMORY | DMUS_OBJ_CLASS;    objdesc.guidClass = CLSID_DirectMusicSegment;    objdesc.llMemLength =(LONGLONG)dwSize;    objdesc.pbMemData = (BYTE*)pMem;5)*ppSegment = new CMusicSegment( m_pPerformance, m_pLoader, pSegment )Next  2 steps are optional ... I call they only if I must play a MIDI file6)pSegment->SetParam( GUID_StandardMIDIFile,  0xFFFFFFFF, 0, 0, NULL ) 7)*ppSegment)->Download()8 )m_pPerformance->CreateStandardAudioPath( DMUS_APATH_DYNAMIC_MONO, 1024, TRUE, &m_pEmbeddedAudioPath);9)m_pPerformance->PlaySegmentEx( m_pSegment, 0, NULL, DMUS_SEGF_SECONDARY,  0, 0, NULL, pAudioPath ) 

Ok this is my iter... Have I forget something?
I don''t think... this is very very very similar at the code of MS SDK....
All right, I''ve found the problem.... and fixed it
but I don''t understand the reason....

I must put two time the line:
6)pSegment->SetParam( GUID_StandardMIDIFile, 0xFFFFFFFF, 0, 0, NULL )

and all works fine.... why?
You have to have that to tell DirectMusic that it''s a standard MIDI file and not a special DirectMusic or other type. This guarantees that all of the data gets interpretted correctly (tempo, band selects, etc).
Hi ...


all right... I know that the line do....
but Why I must to write 2 times the line:
pSegment->SetParam( GUID_StandardMIDIFile, 0xFFFFFFFF, 0, 0, NULL )


If I wite it only 1 time, the code doesn''t work....

bye bye ^__^

This topic is closed to new replies.

Advertisement