diff options
-rw-r--r-- | backends/audiocd/audiocd-stream.cpp | 5 | ||||
-rw-r--r-- | backends/audiocd/audiocd-stream.h | 2 | ||||
-rw-r--r-- | backends/audiocd/linux/linux-audiocd.cpp | 4 | ||||
-rw-r--r-- | backends/audiocd/win32/win32-audiocd.cpp | 4 |
4 files changed, 11 insertions, 4 deletions
diff --git a/backends/audiocd/audiocd-stream.cpp b/backends/audiocd/audiocd-stream.cpp index 17be5f6dc6..3c0d0957da 100644 --- a/backends/audiocd/audiocd-stream.cpp +++ b/backends/audiocd/audiocd-stream.cpp @@ -170,8 +170,11 @@ void AudioCDStream::onTimer() { } } -void AudioCDStream::startTimer() { +void AudioCDStream::startTimer(bool fillBuffer) { _forceStop = false; + if (fillBuffer) { + onTimer(); + } g_system->getTimerManager()->installTimerProc(timerProc, 10 * 1000, this, "AudioCDStream"); } diff --git a/backends/audiocd/audiocd-stream.h b/backends/audiocd/audiocd-stream.h index 706c1e9095..dbc6a6321b 100644 --- a/backends/audiocd/audiocd-stream.h +++ b/backends/audiocd/audiocd-stream.h @@ -67,7 +67,7 @@ protected: virtual uint getEndFrame() const = 0; virtual bool readFrame(int frame, int16 *buffer) = 0; - void startTimer(); + void startTimer(bool fillBuffer = false); void stopTimer(); enum { diff --git a/backends/audiocd/linux/linux-audiocd.cpp b/backends/audiocd/linux/linux-audiocd.cpp index f557e00d6d..a86860106a 100644 --- a/backends/audiocd/linux/linux-audiocd.cpp +++ b/backends/audiocd/linux/linux-audiocd.cpp @@ -117,7 +117,9 @@ private: LinuxAudioCDStream::LinuxAudioCDStream(int fd, const cdrom_tocentry &startEntry, const cdrom_tocentry &endEntry) : _fd(fd), _startEntry(startEntry), _endEntry(endEntry) { - startTimer(); + // We fill the buffer here already to prevent any out of sync issues due + // to the CD not yet having spun up. + startTimer(true); } LinuxAudioCDStream::~LinuxAudioCDStream() { diff --git a/backends/audiocd/win32/win32-audiocd.cpp b/backends/audiocd/win32/win32-audiocd.cpp index 2fbf9c8810..97c45a4946 100644 --- a/backends/audiocd/win32/win32-audiocd.cpp +++ b/backends/audiocd/win32/win32-audiocd.cpp @@ -96,7 +96,9 @@ private: Win32AudioCDStream::Win32AudioCDStream(HANDLE handle, const TRACK_DATA &startEntry, const TRACK_DATA &endEntry) : _driveHandle(handle), _startEntry(startEntry), _endEntry(endEntry), _buffer(), _frame(0), _bufferPos(kSamplesPerFrame), _bufferFrame(0) { - startTimer(); + // We fill the buffer here already to prevent any out of sync issues due + // to the CD not yet having spun up. + startTimer(true); } Win32AudioCDStream::~Win32AudioCDStream() { |