Yes, the conversion of music time to reference time is determined by the tempo. If you are trying to sequence music as part of the Performance Layer, then you really should be doing with your own track that is inserted within a segment that can then have a tempo track. Then, you can take advantage of all the DirectMusic technologies, like styles and scripting, etc. And, the tempo is all taken care of for you. But, it looks like you are working at a lower a level, essentially writing your own sequencing engine, which is also what we expected some people would want to do. In that case you don't need the performance at all. But, one responsibility of a sequencing engine is to maintain its own tempo map and do its own reference to music time conversions. Todor -----Original Message----- From: directmusic-bounce@xxxxxxxxxxxxx [mailto:directmusic-bounce@xxxxxxxxxxxxx] On Behalf Of Ziggy Sent: Tuesday, December 31, 2002 2:48 AM To: directmusic@xxxxxxxxxxxxx Subject: [directmusic] Reference_Time & Tempo Hello, Since Todor told me i can't get a periodic advise from the clock , i try to use the ReferenceTime timestamp on my midi events. But there is few things I want to know: When the midi in port receive an event, I record it into a "Pattern" (Own made) with the reference_Time given by the clock REFERENCE_TIME rt; DWORD dwGroup; DWORD cb; BYTE* pb; while (m_pBuffer->GetNextEvent(&rt, &dwGroup, &cb, &pb) == S_OK) { if (pb[0] != 0x1A && pb[0] != 0xFE) { CALL_EVENTS( MidiInEvent, (this, DMMidiEvent(rt, dwGroup, cb, pb[0], pb[1], pb[2])) ); // here I create my MidiEvent and call an event } } //--------------------- OnInitRecord() { m_rtStartTime = m_pDirectMusic->GetMasterClock()->GetTime(&rt); //this is for retrieve the time when record start } //-------------------- So after recording my Midievents I have to set the reference time correctly: //-------------------- For (int I = 0; I < MyPattern.GetMidiEventCount(); i++) { // assume pEvent is a valid MidiEvent in the list // --- Convert Current time to music time --- // MUSIC_TIME Mt = 0; m_pDMusic->GetPerformanceInterface()->ReferenceToMusicTime(pEvent->m_Ref Time, &Mt); // --- convert the Start Time to music time --- // MUSIC_TIME StartMt = 0; m_pDMusic->GetPerformanceInterface()->ReferenceToMusicTime(m_llPlayTime, &StartMt); // --- Set the relative time --- // pEvent->reftime = pEvent->reftime - m_rtStartTime; //now I have a relative time // --- Set the relative Musictime --- // pEvent->m_MusiTime = Mt - StartMt; } for playing I'm doing the same reversed function: // assume pEvent is a valid MidiEvent in the list REFERENCE_TIME rt = 0; MUSIC_TIME MtOrigine = 0; MUSIC_TIME MtTotale = 0; MtOrigine = pEvent->m_MusiTime; MtTotale = StartMt + MtOrigine; //Convert total to REFERENCE_TIME m_pDMusic->GetPerformanceInterface()->MusicToReferenceTime(MtTotale, &rt); // now send the event to the port // assume dwMsg is a valid DWORD msg hr = m_pBuffer->PackStructured(rt, 1,dwMsg); hr = m_pPort->PlayBuffer(m_pBuffer); this work pretty well, the probleme is for playing, it play well but I can't change the tempo, if I do: // assume fTempo is ok hr = m_pDirectMusic->GetPerformanceInterface()->SetGlobalParam( GUID_PerfMasterTempo, (void*)&fTempo, sizeof(float)); So My question is : Why the tempo of the playback never change ? does the convertion from MUSIC-TIME to REFERENCE_TIME is dependant of the performance tempo ? If not what can I do ? Please HELP !!! Thanks in advance