[Scummvm-git-logs] scummvm master -> 4e0bfecefe7b1aed20b4613d689fef27a7a64dbb
bluegr
noreply at scummvm.org
Sun Feb 1 19:29:14 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
4e0bfecefe AUDIO: Make the SID emulator a subclass of Audio::Chip
Commit: 4e0bfecefe7b1aed20b4613d689fef27a7a64dbb
https://github.com/scummvm/scummvm/commit/4e0bfecefe7b1aed20b4613d689fef27a7a64dbb
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2026-02-01T21:29:10+02:00
Commit Message:
AUDIO: Make the SID emulator a subclass of Audio::Chip
Changed paths:
A audio/sid.cpp
A audio/sid.h
audio/module.mk
audio/softsynth/sid.cpp
audio/softsynth/sid.h
engines/freescape/games/driller/c64.cpp
engines/freescape/games/driller/c64.music.cpp
engines/freescape/games/driller/c64.music.h
engines/freescape/games/driller/driller.h
engines/scumm/players/player_sid.cpp
engines/scumm/players/player_sid.h
engines/scumm/scumm.cpp
diff --git a/audio/module.mk b/audio/module.mk
index 14fc47c208e..0a3720755ae 100644
--- a/audio/module.mk
+++ b/audio/module.mk
@@ -27,6 +27,7 @@ MODULE_OBJS := \
musicplugin.o \
null.o \
rate.o \
+ sid.o \
timestamp.o \
decoders/3do.o \
decoders/aac.o \
diff --git a/audio/sid.cpp b/audio/sid.cpp
new file mode 100644
index 00000000000..4c1c0357b01
--- /dev/null
+++ b/audio/sid.cpp
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "audio/sid.h"
+#include "audio/softsynth/sid.h"
+
+#include "common/textconsole.h"
+
+namespace SID {
+
+SID *Config::create(SidType type) {
+#ifdef USE_SID_AUDIO
+ // For now this is fixed to the ReSID emulator.
+ Resid::SID *sid = new Resid::SID(type);
+ return sid;
+#else
+ return nullptr;
+#endif
+}
+
+bool SID::_hasInstance = false;
+
+SID::SID() {
+ if (_hasInstance)
+ error("There are multiple SID output instances running.");
+ _hasInstance = true;
+}
+
+SID::~SID() {
+ _hasInstance = false;
+}
+
+} // End of namespace SID
diff --git a/audio/sid.h b/audio/sid.h
new file mode 100644
index 00000000000..e7c77efbcc9
--- /dev/null
+++ b/audio/sid.h
@@ -0,0 +1,75 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef AUDIO_SID_H
+#define AUDIO_SID_H
+
+#include "audio/chip.h"
+
+namespace SID {
+
+class SID;
+
+class Config {
+public:
+ enum SidType {
+ kSidPAL,
+ kSidNTSC
+ };
+
+ /**
+ * Creates a SID driver.
+ */
+ static SID *create(SidType type);
+};
+
+class SID : virtual public Audio::Chip {
+private:
+ static bool _hasInstance;
+
+public:
+ SID();
+ virtual ~SID();
+
+ /**
+ * Initializes the SID emulator.
+ *
+ * @return true on success, false on failure
+ */
+ virtual bool init() = 0;
+
+ /**
+ * Reinitializes the SID emulator
+ */
+ virtual void reset() = 0;
+
+ /**
+ * Function to directly write to a specific SID register.
+ *
+ * @param r hardware register number to write to
+ * @param v value, which will be written
+ */
+ virtual void writeReg(int r, int v) = 0;
+};
+
+} // End of namespace SID
+
+#endif
diff --git a/audio/softsynth/sid.cpp b/audio/softsynth/sid.cpp
index 73c65b1e9c6..dca5018e6e5 100644
--- a/audio/softsynth/sid.cpp
+++ b/audio/softsynth/sid.cpp
@@ -1093,16 +1093,27 @@ void Voice::reset() {
}
+struct TimingProps {
+ double clockFreq;
+ int cyclesPerFrame;
+};
+
+static const TimingProps timingProps[2] = {
+ { 17734472.0 / 18, 312 * 63 }, // PAL: 312*63 cycles/frame @ 985248 Hz (~50Hz)
+ { 14318180.0 / 14, 263 * 65 } // NTSC: 263*65 cycles/frame @ 1022727 Hz (~60Hz)
+};
+
/*
* SID
*/
-SID::SID() {
+SID::SID(::SID::Config::SidType videoSystem) : _videoSystem(videoSystem), _cpuCyclesLeft(0) {
voice[0].set_sync_source(&voice[2]);
voice[1].set_sync_source(&voice[0]);
voice[2].set_sync_source(&voice[1]);
- set_sampling_parameters(985248, 44100);
+ set_sampling_parameters(timingProps[videoSystem].clockFreq, getRate());
+ enable_filter(true);
bus_value = 0;
bus_value_ttl = 0;
@@ -1110,6 +1121,11 @@ SID::SID() {
SID::~SID() {}
+bool SID::init() {
+ reset();
+ return true;
+}
+
void SID::reset() {
for (int i = 0; i < 3; i++) {
voice[i].reset();
@@ -1166,7 +1182,7 @@ reg8 SID::read(reg8 offset) {
}
}
-void SID::write(reg8 offset, reg8 value) {
+void SID::writeReg(int offset, int value) {
bus_value = value;
bus_value_ttl = 0x2000;
@@ -1422,6 +1438,21 @@ int SID::updateClock(cycle_count& delta_t, short* buf, int n, int interleave) {
return s;
}
+void SID::generateSamples(int16 *buffer, const int numSamples) {
+ int samplesLeft = numSamples;
+
+ while (samplesLeft > 0) {
+ // update SID status after each frame
+ if (_cpuCyclesLeft <= 0) {
+ _cpuCyclesLeft = timingProps[_videoSystem].cyclesPerFrame;
+ }
+ // fetch samples
+ int sampleCount = updateClock(_cpuCyclesLeft, (short *)buffer, samplesLeft);
+ samplesLeft -= sampleCount;
+ buffer += sampleCount;
+ }
+}
+
}
// Plugin interface
diff --git a/audio/softsynth/sid.h b/audio/softsynth/sid.h
index d834e6c4c07..c4bbb460a1d 100644
--- a/audio/softsynth/sid.h
+++ b/audio/softsynth/sid.h
@@ -27,7 +27,7 @@
#ifndef AUDIO_SOFTSYNTH_SID_H
#define AUDIO_SOFTSYNTH_SID_H
-#include "common/scummsys.h"
+#include "audio/sid.h"
// Inlining on/off.
#define RESID_INLINE inline
@@ -302,9 +302,9 @@ protected:
};
-class SID {
+class SID final : public ::SID::SID, public Audio::EmulatedChip {
public:
- SID();
+ SID(::SID::Config::SidType videoSystem);
~SID();
void enable_filter(bool enable);
@@ -315,16 +315,22 @@ public:
void updateClock(cycle_count delta_t);
int updateClock(cycle_count& delta_t, short* buf, int n, int interleave = 1);
- void reset();
+
+ bool init() override;
+ void reset() override;
// Read/write registers.
reg8 read(reg8 offset);
- void write(reg8 offset, reg8 value);
+ void writeReg(int offset, int value) override;
// 16-bit output (AUDIO OUT).
int output();
+ bool isStereo() const override { return false; }
+
protected:
+ void generateSamples(int16 *buffer, int numSamples) override;
+
Voice voice[3];
Filter filter;
ExternalFilter extfilt;
@@ -342,6 +348,9 @@ protected:
cycle_count cycles_per_sample;
cycle_count sample_offset;
short sample_prev;
+
+ ::SID::Config::SidType _videoSystem;
+ cycle_count _cpuCyclesLeft;
};
}
diff --git a/engines/freescape/games/driller/c64.cpp b/engines/freescape/games/driller/c64.cpp
index 43804769fe8..cca4fd71a0a 100644
--- a/engines/freescape/games/driller/c64.cpp
+++ b/engines/freescape/games/driller/c64.cpp
@@ -158,7 +158,7 @@ void DrillerEngine::loadAssetsC64FullGame() {
} else
error("Unknown C64 release");
- _playerSid = new DrillerSIDPlayer(_mixer);
+ _playerSid = new DrillerSIDPlayer();
}
diff --git a/engines/freescape/games/driller/c64.music.cpp b/engines/freescape/games/driller/c64.music.cpp
index 0be99b024d2..357f4a05af8 100644
--- a/engines/freescape/games/driller/c64.music.cpp
+++ b/engines/freescape/games/driller/c64.music.cpp
@@ -21,6 +21,8 @@
#include "engines/freescape/games/driller/c64.music.h"
+#include "common/textconsole.h"
+
// --- Driller Music Data (Embedded from Disassembly) ---
namespace Freescape {
@@ -178,12 +180,7 @@ const int voice_sid_offset[] = {0, 7, 14};
// Debug log levels
#define DEBUG_LEVEL 4 // 0: Minimal, 1: Basic Flow, 2: Detailed State
-DrillerSIDPlayer::DrillerSIDPlayer(Audio::Mixer *mixer) : _sid(nullptr),
- _mixer(mixer),
- _soundHandle(), // Default initialize
- _sampleRate(mixer->getOutputRate()),
- _cyclesPerSample(0.0f),
- _cycleCounter(0.0),
+DrillerSIDPlayer::DrillerSIDPlayer() : _sid(nullptr),
_playState(STOPPED),
_targetTuneIndex(0),
_globalTempo(3), // Default tempo
@@ -192,24 +189,15 @@ DrillerSIDPlayer::DrillerSIDPlayer(Audio::Mixer *mixer) : _sid(nullptr),
{
initSID();
- // Calculate cycles per sample for timing in readBuffer
- // Using PAL clock rate for C64 SID
- const double PAL_CLOCK_FREQ = 985248.0; // Use PAL C64 clock
- _cyclesPerSample = PAL_CLOCK_FREQ / _sampleRate;
-
- // Start the stream via the mixer
- // Pass address of _soundHandle for it to be filled by playStream
- _mixer->playStream(Audio::Mixer::kMusicSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
- debug(DEBUG_LEVEL >= 1, "Driller SID Player Initialized (Sample Rate: %d Hz)", _sampleRate);
+ debug(DEBUG_LEVEL >= 1, "Driller SID Player Initialized");
}
DrillerSIDPlayer::~DrillerSIDPlayer() {
- // Check if sound handle is valid before stopping (might not be if playStream failed)
- // A better check might involve a dedicated flag or checking if handle is non-zero/default
- if (_mixer) { // Ensure mixer exists
- _mixer->stopHandle(_soundHandle); // Pass handle by value
+ if (_sid) {
+ _sid->stop();
+ delete _sid;
}
- delete _sid;
+
debug(DEBUG_LEVEL >= 1, "Driller SID Player Destroyed");
}
@@ -239,61 +227,23 @@ void DrillerSIDPlayer::stopMusic() {
}
}
-// --- AudioStream API ---
-int DrillerSIDPlayer::readBuffer(int16 *buffer, const int numSamples) {
- if (!_sid) { // Safety check if SID initialization failed
- memset(buffer, 0, numSamples * sizeof(int16));
- return numSamples;
- }
-
- int samplesGenerated = 0;
- while (samplesGenerated < numSamples) {
- // Determine how many SID cycles until the next C64 frame tick (approx 50Hz for PAL)
- const double CYCLES_PER_FRAME = 985248.0 / 50.0; // PAL C64 clock / 50Hz VSync
-
- // How many cycles to run SID for this iteration?
- double cyclesToRun = CYCLES_PER_FRAME - _cycleCounter;
- int samplesToGenerate = MIN((int)ceil(cyclesToRun / _cyclesPerSample), numSamples - samplesGenerated);
- if (samplesToGenerate <= 0)
- samplesToGenerate = 1; // Ensure progress
-
- // Prevent requesting more samples than the buffer has space for
- samplesToGenerate = MIN(samplesToGenerate, numSamples - samplesGenerated);
-
- double cyclesForThisStep = samplesToGenerate * _cyclesPerSample;
-
- // Run the SID emulation
- Resid::cycle_count x = static_cast<Resid::cycle_count>(cyclesForThisStep);
- // Use the standard reSID clock method
- _sid->updateClock(x, buffer + samplesGenerated, samplesToGenerate);
-
- _cycleCounter += cyclesForThisStep;
- samplesGenerated += samplesToGenerate;
-
- // If a frame boundary is crossed, run the player logic
- if (_cycleCounter >= CYCLES_PER_FRAME) {
- _cycleCounter -= CYCLES_PER_FRAME; // Keep track of remainder cycles
- playFrame();
- }
- }
- return numSamples; // We always fill the buffer requested
-}
-
// --- SID Interaction ---
void DrillerSIDPlayer::SID_Write(int reg, uint8_t data) {
if (_sid) {
debug(DEBUG_LEVEL >= 3, "SID Write: Reg $%02X = $%02X", reg, data);
- _sid->write(reg, data);
+ _sid->writeReg(reg, data);
}
}
void DrillerSIDPlayer::initSID() {
- delete _sid; // Delete previous instance if any
- _sid = new Resid::SID();
- // Use PAL clock rate
- _sid->set_sampling_parameters(985248.0, _sampleRate);
- _sid->enable_filter(true); // Enable filter emulation
- _sid->reset();
+ if (_sid) {
+ _sid->stop();
+ delete _sid; // Delete previous instance if any
+ }
+
+ _sid = SID::Config::create(SID::Config::kSidPAL);
+ if (!_sid || !_sid->init())
+ error("Failed to initialise SID emulator");
// Reset SID registers (like 0x0910 - reset_voices)
SID_Write(0x04, 0); // V1 Ctrl = 0
@@ -303,10 +253,12 @@ void DrillerSIDPlayer::initSID() {
SID_Write(0x16, 0); // Filter Cutoff Hi = 0
SID_Write(0x17, 0); // Filter Res/Ctrl = 0
SID_Write(0x18, 0x0F); // Volume & Filter Mode = Max Volume
+
+ _sid->start(new Common::Functor0Mem<void, DrillerSIDPlayer>(this, &DrillerSIDPlayer::onTimer), 50);
}
// --- Player Logic (Called once per C64 frame) ---
-void DrillerSIDPlayer::playFrame() {
+void DrillerSIDPlayer::onTimer() {
// Handle global state changes first (STOPPED, CHANGING_TUNE)
if (_playState == STOPPED) {
debug(DEBUG_LEVEL >= 2, "Driller: Frame - Music Stopped");
diff --git a/engines/freescape/games/driller/c64.music.h b/engines/freescape/games/driller/c64.music.h
index c2b138f8dcc..0ecd3127b80 100644
--- a/engines/freescape/games/driller/c64.music.h
+++ b/engines/freescape/games/driller/c64.music.h
@@ -19,14 +19,12 @@
*
*/
-#include "audio/audiostream.h"
-#include "audio/mixer.h"
-#include "audio/softsynth/sid.h"
+#include "audio/sid.h"
#include "common/debug.h"
namespace Freescape {
-class DrillerSIDPlayer : public Audio::AudioStream {
+class DrillerSIDPlayer {
// --- Voice State Structure ---
struct VoiceState {
@@ -199,12 +197,7 @@ class DrillerSIDPlayer : public Audio::AudioStream {
};
// --- Member Variables ---
- Resid::SID *_sid;
- Audio::Mixer *_mixer;
- Audio::SoundHandle _soundHandle; // Changed from pointer
- int _sampleRate;
- float _cyclesPerSample;
- double _cycleCounter;
+ SID::SID *_sid;
// Player State
enum PlayState { STOPPED,
@@ -226,21 +219,15 @@ class DrillerSIDPlayer : public Audio::AudioStream {
// uint8_t _tempControl1; // Temp storage from instrument data (0xD11)
public:
- DrillerSIDPlayer(Audio::Mixer *mixer);
+ DrillerSIDPlayer();
~DrillerSIDPlayer();
void startMusic(int tuneIndex = 1);
void stopMusic();
- int readBuffer(int16 *buffer, const int numSamples) override;
-
- bool isStereo() const override { return false; }
- bool endOfData() const override { return false; }
- int getRate() const override { return _sampleRate; }
-
private:
void SID_Write(int reg, uint8_t data);
void initSID();
- void playFrame();
+ void onTimer();
void handleChangeTune(int tuneIndex);
void handleResetVoices();
void playVoice(int voiceIndex);
diff --git a/engines/freescape/games/driller/driller.h b/engines/freescape/games/driller/driller.h
index 5d0ab47deef..ac9281c9097 100644
--- a/engines/freescape/games/driller/driller.h
+++ b/engines/freescape/games/driller/driller.h
@@ -21,7 +21,6 @@
#include "audio/audiostream.h"
#include "audio/mixer.h"
-#include "audio/softsynth/sid.h"
#include "engines/freescape/games/driller/c64.music.h"
diff --git a/engines/scumm/players/player_sid.cpp b/engines/scumm/players/player_sid.cpp
index 2047d18dd08..7213b2b24d6 100644
--- a/engines/scumm/players/player_sid.cpp
+++ b/engines/scumm/players/player_sid.cpp
@@ -29,7 +29,7 @@
namespace Scumm {
/*
- * The player's update() routine is called once per (NTSC/PAL) frame as it is
+ * The player's onTimer() routine is called once per (NTSC/PAL) frame as it is
* called by the VIC Rasterline interrupt handler which is in turn called
* approx. 50 (PAL) or 60 (NTSC) times per second.
* The SCUMM V0/V1 music playback routines or sound data have not been adjusted
@@ -46,16 +46,6 @@ namespace Scumm {
* - https://www.c64-wiki.de/wiki/VIC (German)
*/
-struct TimingProps {
- double clockFreq;
- int cyclesPerFrame;
-};
-
-static const TimingProps timingProps[2] = {
- { 17734472.0 / 18, 312 * 63 }, // PAL: 312*63 cycles/frame @ 985248 Hz (~50Hz)
- { 14318180.0 / 14, 263 * 65 } // NTSC: 263*65 cycles/frame @ 1022727 Hz (~60Hz)
-};
-
static const uint8 BITMASK[7] = {
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40
};
@@ -265,7 +255,7 @@ void Player_SID::resetSID() { // $48D8
resetPlayerState();
}
-void Player_SID::update() { // $481B
+void Player_SID::onTimer() { // $481B
if (initializing)
return;
@@ -1132,7 +1122,7 @@ void Player_SID::unused1() { // $50AF
#define ZEROMEM(a) memset(a, 0, sizeof(a))
-Player_SID::Player_SID(ScummEngine *scumm, Audio::Mixer *mixer) {
+Player_SID::Player_SID(ScummEngine *scumm) {
/*
* clear memory
*/
@@ -1245,26 +1235,17 @@ Player_SID::Player_SID(ScummEngine *scumm, Audio::Mixer *mixer) {
_music_timer = 0;
- _mixer = mixer;
- _sampleRate = _mixer->getOutputRate();
_vm = scumm;
- // sound speed is slightly different on NTSC and PAL machines
- // as the SID clock depends on the frame rate.
- // ScummVM does not distinguish between NTSC and PAL targets
- // so we use the NTSC timing here as the music was composed for
- // NTSC systems (music on PAL systems is slower).
- _videoSystem = NTSC;
- _cpuCyclesLeft = 0;
initSID();
resetSID();
-
- _mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
}
Player_SID::~Player_SID() {
- _mixer->stopHandle(_soundHandle);
+ Common::StackLock lock(_mutex);
+
+ _sid->stop();
delete _sid;
}
@@ -1281,45 +1262,29 @@ uint8 *Player_SID::getResource(int resID) {
}
}
-int Player_SID::readBuffer(int16 *buffer, const int numSamples) {
- int samplesLeft = numSamples;
-
- Common::StackLock lock(_mutex);
-
- while (samplesLeft > 0) {
- // update SID status after each frame
- if (_cpuCyclesLeft <= 0) {
- update();
- _cpuCyclesLeft = timingProps[_videoSystem].cyclesPerFrame;
- }
- // fetch samples
- int sampleCount = _sid->updateClock(_cpuCyclesLeft, (short *)buffer, samplesLeft);
- samplesLeft -= sampleCount;
- buffer += sampleCount;
- }
-
- return numSamples;
-}
-
void Player_SID::SID_Write(int reg, uint8 data) {
- _sid->write(reg, data);
+ _sid->writeReg(reg, data);
}
void Player_SID::initSID() {
- _sid = new Resid::SID();
- _sid->set_sampling_parameters(
- timingProps[_videoSystem].clockFreq,
- _sampleRate);
- _sid->enable_filter(true);
+ // sound speed is slightly different on NTSC and PAL machines
+ // as the SID clock depends on the frame rate.
+ // ScummVM does not distinguish between NTSC and PAL targets
+ // so we use the NTSC timing here as the music was composed for
+ // NTSC systems (music on PAL systems is slower).
+ _sid = SID::Config::create(SID::Config::kSidNTSC);
+ if (!_sid || !_sid->init())
+ error("Failed to initialise SID emulator");
- _sid->reset();
// Synchronize the waveform generators (must occur after reset)
- _sid->write( 4, 0x08);
- _sid->write(11, 0x08);
- _sid->write(18, 0x08);
- _sid->write( 4, 0x00);
- _sid->write(11, 0x00);
- _sid->write(18, 0x00);
+ SID_Write( 4, 0x08);
+ SID_Write(11, 0x08);
+ SID_Write(18, 0x08);
+ SID_Write( 4, 0x00);
+ SID_Write(11, 0x00);
+ SID_Write(18, 0x00);
+
+ _sid->start(new Common::Functor0Mem<void, Player_SID>(this, &Player_SID::onTimer), 60);
}
void Player_SID::startSound(int nr) {
diff --git a/engines/scumm/players/player_sid.h b/engines/scumm/players/player_sid.h
index 9ecaaa264dd..2ba9427446d 100644
--- a/engines/scumm/players/player_sid.h
+++ b/engines/scumm/players/player_sid.h
@@ -25,9 +25,7 @@
#include "common/mutex.h"
#include "common/scummsys.h"
#include "scumm/music.h"
-#include "audio/audiostream.h"
-#include "audio/mixer.h"
-#include "audio/softsynth/sid.h"
+#include "audio/sid.h"
namespace Scumm {
@@ -43,16 +41,11 @@ enum sid_reg_t {
PULSE_VOICE3
};
-enum VideoStandard {
- PAL,
- NTSC
-};
-
class ScummEngine;
-class Player_SID : public Audio::AudioStream, public MusicEngine {
+class Player_SID : public MusicEngine {
public:
- Player_SID(ScummEngine *scumm, Audio::Mixer *mixer);
+ Player_SID(ScummEngine *scumm);
~Player_SID() override;
void setMusicVolume(int vol) override { _maxvol = vol; }
@@ -62,30 +55,16 @@ public:
int getSoundStatus(int sound) const override;
int getMusicTimer() override;
- // AudioStream API
- int readBuffer(int16 *buffer, const int numSamples) override;
- bool isStereo() const override { return false; }
- bool endOfData() const override { return false; }
- int getRate() const override { return _sampleRate; }
-
private:
- Resid::SID *_sid;
+ SID::SID *_sid;
void SID_Write(int reg, uint8 data);
void initSID();
uint8 *getResource(int resID);
- // number of cpu cycles until next frame update
- Resid::cycle_count _cpuCyclesLeft;
-
ScummEngine *_vm;
- Audio::Mixer *_mixer;
- Audio::SoundHandle _soundHandle;
- int _sampleRate;
int _maxvol;
Common::Mutex _mutex;
- VideoStandard _videoSystem;
-
int _music_timer;
uint8* _music;
@@ -96,7 +75,7 @@ private:
void stopMusic_intern(); // $4CAA
void resetSID(); // $48D8
- void update(); // $481B
+ void onTimer(); // $481B
void handleMusicBuffer();
int setupSongFileData(); // $36cb
void func_3674(int channel); // $3674
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index d8b20048a11..4ad63d89546 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -2389,7 +2389,7 @@ void ScummEngine::setupMusic(int midi) {
_musicEngine = new Player_AppleII(this, _mixer);
} else if (_game.platform == Common::kPlatformC64 && _game.version <= 1) {
#ifdef USE_SID_AUDIO
- _musicEngine = new Player_SID(this, _mixer);
+ _musicEngine = new Player_SID(this);
#endif
} else if (_game.platform == Common::kPlatformNES && _game.version == 1) {
#ifndef DISABLE_NES_APU
More information about the Scummvm-git-logs
mailing list