[Scummvm-git-logs] scummvm master -> c54b79a6d749896dc33c2cd7c41ef902fdbdf484

mikrosk noreply at scummvm.org
Mon Sep 14 13:16:18 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:
c54b79a6d7 BACKENDS: ATARI: Don't enable mixing of mic input unconditionally


Commit: c54b79a6d749896dc33c2cd7c41ef902fdbdf484
    https://github.com/scummvm/scummvm/commit/c54b79a6d749896dc33c2cd7c41ef902fdbdf484
Author: Miro Kropacek (miro.kropacek at gmail.com)
Date: 2026-09-14T23:15:57+10:00

Commit Message:
BACKENDS: ATARI: Don't enable mixing of mic input unconditionally

Now it is done only if we are sure that an CD DA track is about to be
played.

Avoids random noise when someone has an active mic input present.

Changed paths:
    audio/atari_ym2149.cpp
    backends/audiocd/atari/atari-audiocd.cpp
    backends/audiocd/atari/atari-audiocd.h
    backends/mixer/atari/atari-mixer.cpp


diff --git a/audio/atari_ym2149.cpp b/audio/atari_ym2149.cpp
index 5ee2e7ded04..b0f4ad5f003 100644
--- a/audio/atari_ym2149.cpp
+++ b/audio/atari_ym2149.cpp
@@ -38,6 +38,9 @@ YM2149Atari::~YM2149Atari() {
 	for (int r = 0; r < 14; r++) {
 		Giaccess(_savedRegs[r], r | 0x80);
 	}
+
+	// mix only the connection matrix to the ouput
+	Soundcmd(ADDERIN, MATIN);
 }
 
 bool YM2149Atari::init() {
diff --git a/backends/audiocd/atari/atari-audiocd.cpp b/backends/audiocd/atari/atari-audiocd.cpp
index b6e2b61a929..532d02b5b0b 100644
--- a/backends/audiocd/atari/atari-audiocd.cpp
+++ b/backends/audiocd/atari/atari-audiocd.cpp
@@ -28,6 +28,8 @@
 #include <errno.h>
 #include <string.h>
 
+#include <mint/falcon.h>
+
 #include "common/config-manager.h"
 #include "common/debug.h"
 #include "common/str.h"
@@ -70,6 +72,7 @@ AtariAudioCDManager::AtariAudioCDManager()
 	: _numDrives(0),
 	  _drive(-1),
 	  _log2phys(nullptr),
+	  _adcRouted(false),
 	  _cdTrack(0),
 	  _cdNumLoops(0),
 	  _cdStartFrame(0),
@@ -160,12 +163,33 @@ void AtariAudioCDManager::close() {
 		_drive = -1;
 	}
 
+	routeADC(false);
+
 	_tocEntries.clear();
 	_cdNumLoops = 0;
 	_cdEndTime = 0;
 	_cdStopTime = 0;
 }
 
+// The drive's analog audio output is wired to the Falcon's mic input, which
+// reaches the output through the A/D converter.
+void AtariAudioCDManager::routeADC(bool enable) {
+	if (enable == _adcRouted)
+		return;
+
+	if (enable) {
+		// route both mic channels to the ADC
+		Soundcmd(ADCINPUT, 0);
+		// enable and mix both sources (ADC and connection matrix) to the output
+		Soundcmd(ADDERIN, MATIN|ADCIN);
+	} else {
+		// mix only the connection matrix to the output
+		Soundcmd(ADDERIN, MATIN);
+	}
+
+	_adcRouted = enable;
+}
+
 int AtariAudioCDManager::ioctl(int command, void *arg) const {
 	if (_drive < 0)
 		return -1;
@@ -227,6 +251,9 @@ bool AtariAudioCDManager::startPlayback(int track, int startFrame, int duration)
 		return false;
 	}
 
+	// The disc is spinning now, so let its audio through
+	routeADC(true);
+
 	const int playFrames = endAbs - startAbs;
 	_cdEndTime = g_system->getMillis() + (uint32)playFrames * 1000u / kFramesPerSecond;
 	return true;
@@ -349,14 +376,21 @@ void AtariAudioCDManager::update() {
 
 	if (_cdStopTime != 0 && now >= _cdStopTime) {
 		ioctl(CDROMSTOP, nullptr);
+		routeADC(false);
 		_cdNumLoops = 0;
 		_cdStopTime = 0;
 		return;
 	}
 
-	if (_cdNumLoops == 0 || now < _cdEndTime)
+	if (now < _cdEndTime)
 		return;
 
+	if (_cdNumLoops == 0) {
+		// a track played once has reached its end on its own
+		routeADC(false);
+		return;
+	}
+
 	// Make sure the drive has really finished before we restart the track
 	cdrom_subchnl info;
 	info.cdsc_format = CDROM_MSF;
@@ -374,4 +408,7 @@ void AtariAudioCDManager::update() {
 
 	if (_cdNumLoops != 0)
 		startPlayback(_cdTrack, _cdStartFrame, _cdDuration);
+	else
+		// the drive has run out of tracks to play on its own
+		routeADC(false);
 }
diff --git a/backends/audiocd/atari/atari-audiocd.h b/backends/audiocd/atari/atari-audiocd.h
index d6e75a95079..3d71ec7ce28 100644
--- a/backends/audiocd/atari/atari-audiocd.h
+++ b/backends/audiocd/atari/atari-audiocd.h
@@ -61,6 +61,7 @@ private:
 	bool loadTOC();
 	int ioctl(int command, void *arg) const;
 	bool startPlayback(int track, int startFrame, int duration);
+	void routeADC(bool enable);
 
 	Drive _drives[kMaxDrives];
 	int _numDrives;
@@ -72,6 +73,8 @@ private:
 
 	Common::Array<cdrom_tocentry> _tocEntries;  // Includes the leadout as the final entry
 
+	bool _adcRouted;  // True while the ADC is added to the output for us
+
 	int _cdTrack;
 	int _cdNumLoops;
 	int _cdStartFrame;
diff --git a/backends/mixer/atari/atari-mixer.cpp b/backends/mixer/atari/atari-mixer.cpp
index 63947b95e1c..541bdaa86b9 100644
--- a/backends/mixer/atari/atari-mixer.cpp
+++ b/backends/mixer/atari/atari-mixer.cpp
@@ -167,10 +167,7 @@ void AtariMixerManager::init() {
 	Xbtimer(XB_TIMERA, 1<<3, 1, timerA);	// event count mode, count to '1'
 	Jenabint(MFP_TIMERA);
 
-	// route both mic channels to the ADC
-	Soundcmd(ADCINPUT, 0);
-	// enable and mix both sources (ADC and connection matrix) to the output
-	Soundcmd(ADDERIN, MATIN|ADCIN);
+	Soundcmd(ADDERIN, MATIN);
 
 	_sampleBufferSize = _samples * _outputChannels * 4;	// always 32-bit
 	_sampleBuffer = new uint8[_sampleBufferSize];




More information about the Scummvm-git-logs mailing list