1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-20 14:29:11 +00:00

Provide full clock to audio.

This commit is contained in:
Thomas Harte 2025-01-08 21:17:48 -05:00
parent 6fa29c204b
commit 65307186dc
2 changed files with 5 additions and 3 deletions

View File

@ -19,6 +19,8 @@ namespace Commodore::Plus4 {
// 111860.78125 = NTSC
// 110840.46875 = PAL
//
class Audio: public Outputs::Speaker::BufferSource<Audio, false> {
public:
Audio(Concurrency::AsyncTaskQueue<false> &audio_queue) :
@ -92,7 +94,7 @@ public:
void set_divider(const uint8_t value) {
audio_queue_.enqueue([this, value] {
frequency_multiplier_ = value & 0x40 ? 4 : 5;
frequency_multiplier_ = 32 * (value & 0x40 ? 4 : 5);
});
}

View File

@ -146,7 +146,7 @@ public:
const auto clock = clock_rate(false);
media_divider_ = Cycles(clock);
set_clock_rate(clock);
speaker_.set_input_rate(float(clock) / 32.0f);
speaker_.set_input_rate(float(clock));
// TODO: decide whether to attach a 1541 for real.
const bool has_c1541 = true;
@ -544,7 +544,7 @@ private:
Cycles time_since_audio_update_;
Outputs::Speaker::PullLowpass<Audio> speaker_;
void update_audio() {
speaker_.run_for(audio_queue_, time_since_audio_update_.divide(Cycles(32)));
speaker_.run_for(audio_queue_, time_since_audio_update_.flush<Cycles>());
}
// MARK: - MappedKeyboardMachine.