• Advertisement

Archived

This topic is now archived and is closed to further replies.

DirectMusic is speed insane !

This topic is 5498 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When I play midis with DirectMusic (segments to audiopath to performance), they play at a crazy fast tempo... insane ! But unlike my graphics engine, I don''t need speed like this. I would like my midi to be playing their original speed... how ?
/* Bullmax */ ------------- Reality has many forms : good and evil, black and white, yin and yang.

Share this post


Link to post
Share on other sites
Advertisement
I do not have this problem.

What is the code you are using? as by default Direct Music plays according to the "written" tempo.


Techlead
www.myran.com/enilno

Share this post


Link to post
Share on other sites

    
// INITIALIZATION //

//

CoInitialize( NULL );
//

if (FAILED( CoCreateInstance( CLSID_DirectMusicLoader, NULL, CLSCTX_INPROC, IID_IDirectMusicLoader8, (VOID**) &m_pLoader ) ))
return( Error( "Could not create media loader" ) );
//

if (FAILED( CoCreateInstance( CLSID_DirectMusicPerformance, NULL, CLSCTX_INPROC, IID_IDirectMusicPerformance8, (VOID**) &m_pPerformance ) ))
return( Error( "Could not create sound mixer" ) );
//

if (FAILED( m_pPerformance->InitAudio( NULL, NULL, Window.hWindow(), DMUS_APATH_SHARED_STEREOPLUSREVERB, 64, DMUS_AUDIOF_ALL, NULL ) ))
return( Error( "Could not prepare sound mixer" ) );
//

if (FAILED( m_pPerformance->GetDefaultAudioPath( &m_pAudioPath ) ))
return( Error( "Could not get audio path" ) );
//

if (FAILED( m_pAudioPath->SetVolume( 0, 0 ) ))
Error( "Could not set default volume" );
//

//

//

// LOADING //

WCHAR strFilename[256];
MltiByteToWideChar( CP_ACP, MB_PRECOMPOSED, _strPath, -1, strFilename, MAX_PATH );
//

if (FAILED( m_pLoader->LoadObjectFromFile( CLSID_DirectMusicSegment, IID_IDirectMusicSegment8, strFilename, (VOID**) &pSegment ) ))
return( Error( "Could not load wave from file" ) );
//

if (FAILED( pSegment->Download( m_pPerformance ) ))
return( Error( "Could not load wave into mixer" ) );
//

//

//

// PLAYING //

m_pPerformance->PlaySegmentEx( m_lstMidis[_indSound], NULL, NULL, DMUS_SEGF_DEFAULT | DMUS_SEGF_SECONDARY, 0, NULL, NULL, NULL );


[edited by - Bullmax on January 30, 2003 11:44:06 PM]

Share this post


Link to post
Share on other sites
I am wondering if it is :

m_pPerformance->PlaySegmentEx( m_lstMidis[_indSound], NULL, NULL, DMUS_SEGF_DEFAULT | DMUS_SEGF_SECONDARY, 0, NULL, NULL, NULL );

that cause the problem. I don''t know if by using the DMUS_SEGF_DEFAULT and DMUS_SEGF_SECONDARY flags, I am soing something wrong...



/* Bullmax */
-------------
Reality has many forms : good and evil, black and white, yin and yang.

Share this post


Link to post
Share on other sites
I''ve found it !
The problem was has I suspected. It was the DMUS_SEGF_SECONDARY flag that caused all this speed deformation. Thank you RhoneRanger for your post.



/* Bullmax */
-------------
Reality has many forms : good and evil, black and white, yin and yang.

Share this post


Link to post
Share on other sites

  • Advertisement