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


DirectMusic help

Recommended Posts

FyReWaLL    122
I''m currently developing an audio class and in it I have a set of functions to easily create a soundtrack but in order to create the sound track I have to constantly check weather the file is playing and if it has stopped, to play the next song. I''m having trouble determening if the wav/midi/ is playing or not. Due to latency, IsPlaying is completely unreliable... I tried checking if it''s playing at intervals with length equal to the latency time but that doesn''t work very well... MUSIC_TIME LatencyTime, PerformanceTime; REFERENCE_TIME LatencyRef; HRESULT hr; char lpBuffer[32]; m_pPerformance->GetLatencyTime(&LatencyRef); m_pPerformance->ReferenceToMusicTime(LatencyRef, &LatencyTime); m_pPerformance->GetTime(NULL, &PerformanceTime); LatencyTime -= PerformanceTime; hr = m_pPerformance->IsPlaying(m_pTracks[m_TrackNo],m_pTrackStates[m_TrackNo]); if(PerformanceTime % (LatencyTime*100) == 1 && hr == S_OK) NextTrack(); I have that in a member function called "TrackManage" which is inside the program loop. Any help is very much appreciated. Thanks in advance.

Share this post

Link to post
Share on other sites