From 9509699116775c08d2f5472b03f1ecd6e6242353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Sun, 25 Jan 2009 18:11:31 +0000 Subject: [PATCH] BSoundPlayer changes: * calls the notifier in Start() and Stop() * calls SetHasData() with true in Start() like BeOS does * starts the timesource if not running in Start() git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29012 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/media/SoundPlayer.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/kits/media/SoundPlayer.cpp b/src/kits/media/SoundPlayer.cpp index 2d37612e2d..542e7c2b51 100644 --- a/src/kits/media/SoundPlayer.cpp +++ b/src/kits/media/SoundPlayer.cpp @@ -335,6 +335,11 @@ BSoundPlayer::Start() return B_ERROR; } + if (!fPlayerNode->TimeSource()->IsRunning()) { + roster->StartTimeSource(fPlayerNode->TimeSource()->Node(), + fPlayerNode->TimeSource()->RealTime()); + } + // Add latency and a few ms to the nodes current time to // make sure that we give the producer enough time to run // buffers through the node chain, otherwise it'll start @@ -345,7 +350,11 @@ BSoundPlayer::Start() TRACE("BSoundPlayer::Start: StartNode failed, %ld", err); return err; } + + if (fNotifierFunc) + fNotifierFunc(fCookie, B_STARTED, this); + SetHasData(true); atomic_or(&fFlags, F_IS_STARTED); return B_OK; @@ -389,6 +398,10 @@ BSoundPlayer::Stop(bool block, // wait until all buffers on the way to the physical output have been played snooze(Latency() + 2000); } + + if (fNotifierFunc) + fNotifierFunc(fCookie, B_STOPPED, this); + }