From 11b92ae72b9d600281b9511018d9525935eebf65 Mon Sep 17 00:00:00 2001 From: beveloper Date: Tue, 3 Jun 2003 01:15:18 +0000 Subject: [PATCH] next event calculation properly based on frames played in performace time now git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3401 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp | 4 ++-- src/kits/media/SoundPlayNode.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp b/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp index 1f956290d6..c1de319c93 100644 --- a/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp +++ b/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp @@ -1242,7 +1242,7 @@ AudioMixer::HandleEvent( const media_timed_event *event, bigtime_t lateness, boo // if this is the first buffer, mark with the start time // we need this to calculate the other buffer times if (fStartTime == 0) { - fStartTime = TimeSource()->RealTimeFor(event->event_time, 0); + fStartTime = event->event_time; } // count frames that have been played @@ -1252,7 +1252,7 @@ AudioMixer::HandleEvent( const media_timed_event *event, bigtime_t lateness, boo fFramesSent += framesperbuffer; // calculate the start time for the next event and add the event - bigtime_t nextevent = TimeSource()->PerformanceTimeFor(bigtime_t(fStartTime + double(fFramesSent / fOutput.format.u.raw_audio.frame_rate) * 1000000.0)); + bigtime_t nextevent = bigtime_t(fStartTime + double(fFramesSent / fOutput.format.u.raw_audio.frame_rate) * 1000000.0); media_timed_event nextBufferEvent(nextevent, SEND_NEW_BUFFER_EVENT); EventQueue()->AddEvent(nextBufferEvent); break; diff --git a/src/kits/media/SoundPlayNode.cpp b/src/kits/media/SoundPlayNode.cpp index 153ebe5af5..66f83b0fad 100644 --- a/src/kits/media/SoundPlayNode.cpp +++ b/src/kits/media/SoundPlayNode.cpp @@ -608,7 +608,7 @@ _SoundPlayNode::SendNewBuffer(const media_timed_event *event, bigtime_t lateness // The buffer is on its way; now schedule the next one to go // nextEvent is the time at which the buffer should arrive at it's destination - bigtime_t nextEvent = TimeSource()->PerformanceTimeFor(mStartTime + bigtime_t((1000000LL * mFramesSent) / mOutput.format.u.raw_audio.frame_rate)); + bigtime_t nextEvent = mStartTime + bigtime_t((1000000LL * mFramesSent) / mOutput.format.u.raw_audio.frame_rate); media_timed_event nextBufferEvent(nextEvent, SEND_NEW_BUFFER_EVENT); EventQueue()->AddEvent(nextBufferEvent); @@ -650,7 +650,7 @@ _SoundPlayNode::HandleStart( // and fire off the first "produce a buffer" event. mFramesSent = 0; - mStartTime = TimeSource()->RealTimeFor(event->event_time, 0); + mStartTime = event->event_time; media_timed_event firstBufferEvent(event->event_time, SEND_NEW_BUFFER_EVENT); // Alternatively, we could call HandleEvent() directly with this event, to avoid a trip through