[Scummvm-git-logs] scummvm master -> 412c17e237bb5d55ad16d0b4025eb43a03ba2b7b

mikrosk noreply at scummvm.org
Fri Apr 24 13:11:04 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:
412c17e237 AUDIO: Native YM2149 for Atari backend


Commit: 412c17e237bb5d55ad16d0b4025eb43a03ba2b7b
    https://github.com/scummvm/scummvm/commit/412c17e237bb5d55ad16d0b4025eb43a03ba2b7b
Author: Miro Kropacek (miro.kropacek at gmail.com)
Date: 2026-04-24T23:10:45+10:00

Commit Message:
AUDIO: Native YM2149 for Atari backend

Changed paths:
  A audio/atari_ym2149.cpp
  A audio/atari_ym2149.h
    audio/module.mk
    audio/ym2149.cpp


diff --git a/audio/atari_ym2149.cpp b/audio/atari_ym2149.cpp
new file mode 100644
index 00000000000..c45a3c3e71b
--- /dev/null
+++ b/audio/atari_ym2149.cpp
@@ -0,0 +1,91 @@
+/* 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/>.
+ *
+ */
+
+/* Adapted from Hatari - https://framagit.org/hatari/hatari/
+ * 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 Soft-
+ * ware Foundation; either version 2 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 <https://www.gnu.org/licenses/>.
+ *
+ * Linking Hatari statically or dynamically with other modules is making a
+ * combined work based on Hatari. Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+
+ *
+ * In addition, as a special exception, the copyright holders of Hatari give you
+ * permission to combine Hatari with free software programs or libraries that are
+ * released under the GNU LGPL and with code included in the standard release
+ * of the IPF support library (a.k.a. libcapsimage) under the Software Preservation
+ * Society Licence Agreement.
+ */
+
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+#include "audio/atari_ym2149.h"
+
+#include <mint/falcon.h>
+#include <mint/osbind.h>
+
+namespace Audio {
+
+YM2149Atari::YM2149Atari() {
+	for (int r = 0; r < 14; r++) {
+		_savedRegs[r] = Giaccess(0, r);
+	}
+}
+
+YM2149Atari::~YM2149Atari() {
+	for (int r = 0; r < 14; r++) {
+		Giaccess(_savedRegs[r], r | 0x80);
+	}
+}
+
+bool YM2149Atari::init() {
+	// route both PSG channels to the ADC instead of the microphone
+	Soundcmd(ADCINPUT, ADCLT|ADCRT);
+	// enable and mix both sources (ADC and connection matrix) to the output
+	Soundcmd(ADDERIN, MATIN|ADCIN);
+	return true;
+}
+
+void YM2149Atari::reset() {
+	// silence channels/envelope, but keep ports as outputs
+	writeReg(7, 0xFF);	// all tone+noise off, PA/PB output
+	writeReg(8, 0);		// volume A
+	writeReg(9, 0);		// volume B
+	writeReg(10, 0);	// volume C
+	// skip reg 13 (envelope shape) — writing it retriggers the envelope
+}
+
+void YM2149Atari::writeReg(int r, uint8 v) {
+	if (r == 7)
+		v |= 0xC0;	// keep Port A/B as outputs
+	Giaccess(v, r | 0x80);
+}
+
+} // End of namespace Audio
diff --git a/audio/atari_ym2149.h b/audio/atari_ym2149.h
new file mode 100644
index 00000000000..838c6b24883
--- /dev/null
+++ b/audio/atari_ym2149.h
@@ -0,0 +1,46 @@
+/* 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_SOFTSYNTH_YM2149_H
+#define AUDIO_SOFTSYNTH_YM2149_H
+
+#include "audio/ym2149.h"
+
+namespace Audio {
+
+class YM2149Atari : public YM2149::YM2149, public Audio::RealChip {
+public:
+	YM2149Atari();
+	~YM2149Atari() override;
+
+	bool init() override;
+
+	void reset() override;
+
+	void writeReg(int r, uint8 v) override;
+
+private:
+	uint8 _savedRegs[14];
+};
+
+} // End of namespace Audio
+
+#endif
diff --git a/audio/module.mk b/audio/module.mk
index bff9dc36696..9841aa55a69 100644
--- a/audio/module.mk
+++ b/audio/module.mk
@@ -70,8 +70,7 @@ MODULE_OBJS := \
 	softsynth/fluidsynth.o \
 	softsynth/eas.o \
 	softsynth/pcspk.o \
-	softsynth/ay8912.o \
-	softsynth/ym2149.o
+	softsynth/ay8912.o
 
 ifndef DISABLE_NUKED_OPL
 MODULE_OBJS += \
@@ -88,6 +87,14 @@ MODULE_OBJS += \
 	alsa_opl.o
 endif
 
+ifeq ($(BACKEND),atari)
+MODULE_OBJS += \
+	atari_ym2149.o
+else
+MODULE_OBJS += \
+	softsynth/ym2149.o
+endif
+
 ifdef USE_FMTOWNS_PC98_AUDIO
 MODULE_OBJS += \
 	softsynth/fmtowns_pc98/pc98_audio.o \
diff --git a/audio/ym2149.cpp b/audio/ym2149.cpp
index c0403d8a165..676b4f116b9 100644
--- a/audio/ym2149.cpp
+++ b/audio/ym2149.cpp
@@ -20,14 +20,22 @@
  */
 
 #include "audio/ym2149.h"
+#ifdef ATARI
+#include "audio/atari_ym2149.h"
+#else
 #include "audio/softsynth/ym2149.h"
+#endif
 
 #include "common/textconsole.h"
 
 namespace YM2149 {
 
 YM2149 *Config::create() {
+#ifdef ATARI
+	return new Audio::YM2149Atari();
+#else
 	return new Audio::YM2149Emu();
+#endif
 }
 
 bool YM2149::_hasInstance = false;




More information about the Scummvm-git-logs mailing list