diff --git a/src/86box.c b/src/86box.c
index 0b5a26131..c822b8534 100644
--- a/src/86box.c
+++ b/src/86box.c
@@ -237,6 +237,7 @@ char monitor_edid_path[1024] = { 0 }; /* (C) Path to
double video_gl_input_scale = 1.0; /* (C) OpenGL 3.x input scale */
int video_gl_input_scale_mode = FULLSCR_SCALE_FULL; /* (C) OpenGL 3.x input stretch mode */
int color_scheme = 0; /* (C) Color scheme of UI (Windows-only) */
+int fdd_sounds_enabled = 1; /* (C) Floppy drive sounds enabled */
// Accelerator key array
struct accelKey acc_keys[NUM_ACCELS];
diff --git a/src/config.c b/src/config.c
index d3bc0c2de..335b71e2a 100644
--- a/src/config.c
+++ b/src/config.c
@@ -265,6 +265,7 @@ load_general(void)
do_auto_pause = ini_section_get_int(cat, "do_auto_pause", 0);
force_constant_mouse = ini_section_get_int(cat, "force_constant_mouse", 0);
+ fdd_sounds_enabled = ini_section_get_int(cat, "fdd_sounds_enabled", 1);
p = ini_section_get_string(cat, "uuid", NULL);
if (p != NULL)
@@ -2479,6 +2480,11 @@ save_general(void)
else
ini_section_delete_var(cat, "force_constant_mouse");
+ if (fdd_sounds_enabled == 1)
+ ini_section_delete_var(cat, "fdd_sounds_enabled");
+ else
+ ini_section_set_int(cat, "fdd_sounds_enabled", fdd_sounds_enabled);
+
char cpu_buf[128] = { 0 };
plat_get_cpu_string(cpu_buf, 128);
ini_section_set_string(cat, "host_cpu", cpu_buf);
diff --git a/src/floppy/fdc.c b/src/floppy/fdc.c
index 57bee9f2e..47602f0b7 100644
--- a/src/floppy/fdc.c
+++ b/src/floppy/fdc.c
@@ -13,9 +13,11 @@
*
* Authors: Sarah Walker,
* Miran Grca,
+ * Toni Riikonen,
*
* Copyright 2008-2020 Sarah Walker.
* Copyright 2016-2020 Miran Grca.
+ * Copyright 2025 Toni Riikonen.
*/
#include
#include
diff --git a/src/floppy/fdd.c b/src/floppy/fdd.c
index 41e3ba216..16ef075bd 100644
--- a/src/floppy/fdd.c
+++ b/src/floppy/fdd.c
@@ -13,10 +13,12 @@
* Authors: Sarah Walker,
* Miran Grca,
* Fred N. van Kempen,
+ * Toni Riikonen,
*
* Copyright 2008-2019 Sarah Walker.
* Copyright 2016-2019 Miran Grca.
* Copyright 2018-2019 Fred N. van Kempen.
+ * Copyright 2025 Toni Riikonen.
*/
#include
#include
@@ -752,7 +754,9 @@ fdd_init(void)
fdd_load(i, floppyfns[i]);
}
- fdd_audio_init();
+ if (fdd_sounds_enabled) {
+ fdd_audio_init();
+ }
}
void
diff --git a/src/floppy/fdd_audio.c b/src/floppy/fdd_audio.c
index 6ab377bbf..dd363cd71 100644
--- a/src/floppy/fdd_audio.c
+++ b/src/floppy/fdd_audio.c
@@ -32,8 +32,10 @@
// OK 4. Single sector read/write sound emulation
// OK 5. Multi-track seek sound emulation
// OK 6. Volume control for drive sounds
-// 7. Limit sound emulation only for 3,5" 300 rpm drives, until we have sound samples for other rpm drives
-// 8. Configuration option to enable/disable drive sounds
+// OK 7. Multi drive support
+// OK 8. Configuration option to enable/disable drive sounds
+
+#ifndef DISABLE_FDD_AUDIO
/* Audio sample structure */
typedef struct {
@@ -111,23 +113,6 @@ extern uint64_t motoron[FDD_NUM];
/* Forward declaration */
static int16_t *load_wav(const char *filename, int *sample_count);
-const char *
-fdd_audio_motor_state_name(motor_state_t state)
-{
- switch (state) {
- case MOTOR_STATE_STOPPED:
- return "STOPPED";
- case MOTOR_STATE_STARTING:
- return "STARTING";
- case MOTOR_STATE_RUNNING:
- return "RUNNING";
- case MOTOR_STATE_STOPPING:
- return "STOPPING";
- default:
- return "UNKNOWN";
- }
-}
-
static int16_t *
load_wav(const char *filename, int *sample_count)
{
@@ -268,6 +253,9 @@ fdd_audio_close(void)
void
fdd_audio_set_motor_enable(int drive, int motor_enable)
{
+ if (!fdd_sounds_enabled)
+ return;
+
if (motor_enable && !motoron[drive]) {
/* Motor starting up */
if (spindlemotor_state[drive] == MOTOR_STATE_STOPPING) {
@@ -295,6 +283,9 @@ fdd_audio_set_motor_enable(int drive, int motor_enable)
void
fdd_audio_play_single_track_step(int drive, int from_track, int to_track)
{
+ if (!fdd_sounds_enabled)
+ return;
+
if (drive < 0 || drive >= FDD_NUM)
return;
if (abs(from_track - to_track) != 1)
@@ -307,6 +298,9 @@ fdd_audio_play_single_track_step(int drive, int from_track, int to_track)
void
fdd_audio_play_multi_track_seek(int drive, int from_track, int to_track)
{
+ if (!fdd_sounds_enabled)
+ return;
+
if (drive < 0 || drive >= FDD_NUM)
return;
@@ -345,7 +339,6 @@ fdd_audio_callback(int16_t *buffer, int length)
{
/* Clear buffer */
memset(buffer, 0, length * sizeof(int16_t));
-
/* Check if any motor is running or transitioning, or any audio is active */
int any_audio_active = 0;
for (int drive = 0; drive < FDD_NUM; drive++) {
@@ -495,4 +488,14 @@ fdd_audio_callback(int16_t *buffer, int length)
float_buffer[i * 2 + 1] += right_sample;
}
}
-}
\ No newline at end of file
+}
+#else
+
+void fdd_audio_init(void) {}
+void fdd_audio_close(void) {}
+void fdd_audio_set_motor_enable(int drive, int motor_enable) { (void) drive; (void) motor_enable; }
+void fdd_audio_play_single_track_step(int drive, int from_track, int to_track) { (void) drive; (void) from_track; (void) to_track; }
+void fdd_audio_play_multi_track_seek(int drive, int from_track, int to_track) { (void) drive; (void) from_track; (void) to_track; }
+void fdd_audio_callback(int16_t *buffer, int length) { memset(buffer, 0, length * sizeof(int16_t)); }
+
+#endif /* DISABLE_FDD_AUDIO */
\ No newline at end of file
diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h
index ce39652bc..3000a15ee 100644
--- a/src/include/86box/86box.h
+++ b/src/include/86box/86box.h
@@ -207,6 +207,7 @@ extern int monitor_edid; /* (C) Which EDID to use. 0=default,
extern char monitor_edid_path[1024]; /* (C) Path to custom EDID */
extern int color_scheme; /* (C) Color scheme of UI (Windows-only) */
+extern int fdd_sounds_enabled; /* (C) Enable floppy drive sounds */
#ifndef USE_NEW_DYNAREC
extern FILE *stdlog; /* file to log output to */
diff --git a/src/include/86box/fdc.h b/src/include/86box/fdc.h
index d5d0022f1..06ccafa39 100644
--- a/src/include/86box/fdc.h
+++ b/src/include/86box/fdc.h
@@ -14,10 +14,12 @@
* Authors: Sarah Walker,
* Miran Grca,
* Fred N. van Kempen,
+ * Toni Riikonen,
*
* Copyright 2008-2020 Sarah Walker.
* Copyright 2016-2020 Miran Grca.
* Copyright 2018-2020 Fred N. van Kempen.
+ * Copyright 2025 Toni Riikonen.
*/
#ifndef EMU_FDC_H
#define EMU_FDC_H
diff --git a/src/include/86box/fdd.h b/src/include/86box/fdd.h
index d6ade3bc6..c4d63746a 100644
--- a/src/include/86box/fdd.h
+++ b/src/include/86box/fdd.h
@@ -11,10 +11,12 @@
* Authors: Sarah Walker,
* Miran Grca,
* Fred N. van Kempen,
+ * Toni Riikonen,
*
* Copyright 2008-2025 Sarah Walker.
* Copyright 2016-2025 Miran Grca.
* Copyright 2018-2025 Fred N. van Kempen.
+ * Copyright 2025 Toni Riikonen.
*/
#ifndef EMU_FDD_H
#define EMU_FDD_H
diff --git a/src/include/86box/fdd_audio.h b/src/include/86box/fdd_audio.h
index 9cf163bb8..acd4e9350 100644
--- a/src/include/86box/fdd_audio.h
+++ b/src/include/86box/fdd_audio.h
@@ -21,6 +21,8 @@
extern "C" {
#endif
+#ifndef DISABLE_FDD_AUDIO
+
/* Motor sound states */
typedef enum {
MOTOR_STATE_STOPPED = 0,
@@ -50,6 +52,14 @@ typedef struct {
#define FADE_DURATION_MS 75
#define FADE_SAMPLES (48000 * FADE_DURATION_MS / 1000)
+#else
+
+typedef enum {
+ MOTOR_STATE_STOPPED = 0
+} motor_state_t;
+
+#endif /* DISABLE_FDD_AUDIO */
+
/* FDD audio initialization and cleanup */
extern void fdd_audio_init(void);
extern void fdd_audio_close(void);
diff --git a/src/qt/qt_settingsfloppycdrom.cpp b/src/qt/qt_settingsfloppycdrom.cpp
index f597aebe6..b3888ab00 100644
--- a/src/qt/qt_settingsfloppycdrom.cpp
+++ b/src/qt/qt_settingsfloppycdrom.cpp
@@ -213,6 +213,12 @@ SettingsFloppyCDROM::SettingsFloppyCDROM(QWidget *parent)
ui->comboBoxCDROMType->setEnabled(eligibleRows > 1);
ui->comboBoxCDROMType->setCurrentIndex(-1);
ui->comboBoxCDROMType->setCurrentIndex(selectedTypeRow);
+#ifndef DISABLE_FDD_AUDIO
+ ui->checkBoxFloppySounds->setVisible(true);
+ ui->checkBoxFloppySounds->setChecked(fdd_sounds_enabled > 0);
+#else
+ ui->checkBoxFloppySounds->setVisible(false);
+#endif
}
SettingsFloppyCDROM::~SettingsFloppyCDROM()
@@ -245,6 +251,12 @@ SettingsFloppyCDROM::save()
cdrom[i].speed = model->index(i, 1).data(Qt::UserRole).toUInt();
cdrom_set_type(i, model->index(i, 2).data(Qt::UserRole).toInt());
}
+
+#ifdef DISABLE_FDD_AUDIO
+ fdd_sounds_enabled = 0;
+#else
+ fdd_sounds_enabled = ui->checkBoxFloppySounds->isChecked() ? 1 : 0;
+#endif
}
void
@@ -325,6 +337,12 @@ SettingsFloppyCDROM::on_checkBoxCheckBPB_stateChanged(int arg1)
tr("On") : tr("Off"));
}
+void
+SettingsFloppyCDROM::on_checkBoxFloppySounds_stateChanged(int arg1)
+{
+ fdd_sounds_enabled = (arg1 == Qt::Checked) ? 1 : 0;
+}
+
void
SettingsFloppyCDROM::on_comboBoxFloppyType_activated(int index)
{
diff --git a/src/qt/qt_settingsfloppycdrom.hpp b/src/qt/qt_settingsfloppycdrom.hpp
index 063942201..ddf82345e 100644
--- a/src/qt/qt_settingsfloppycdrom.hpp
+++ b/src/qt/qt_settingsfloppycdrom.hpp
@@ -25,6 +25,7 @@ private slots:
void on_comboBoxFloppyType_activated(int index);
void on_checkBoxTurboTimings_stateChanged(int arg1);
void on_checkBoxCheckBPB_stateChanged(int arg1);
+ void on_checkBoxFloppySounds_stateChanged(int arg1);
void onCDROMRowChanged(const QModelIndex ¤t);
void on_comboBoxBus_activated(int index);
diff --git a/src/qt/qt_settingsfloppycdrom.ui b/src/qt/qt_settingsfloppycdrom.ui
index 6b1036b5c..b5a45dff5 100644
--- a/src/qt/qt_settingsfloppycdrom.ui
+++ b/src/qt/qt_settingsfloppycdrom.ui
@@ -66,32 +66,43 @@
-
-
+
-
-
-
- Type:
-
-
+
+
-
+
+
+ Type:
+
+
+
+ -
+
+
+ 30
+
+
+
+ -
+
+
+ Turbo timings
+
+
+
+ -
+
+
+ Check BPB
+
+
+
+
-
-
-
- 30
-
-
-
- -
-
+
- Turbo timings
-
-
-
- -
-
-
- Check BPB
+ Enable floppy sounds for all drives
@@ -205,6 +216,7 @@
comboBoxFloppyType
checkBoxTurboTimings
checkBoxCheckBPB
+ checkBoxFloppySounds
tableViewCDROM
comboBoxBus
comboBoxChannel
diff --git a/src/sound/sound.c b/src/sound/sound.c
index a57dc1d3d..74acf5667 100644
--- a/src/sound/sound.c
+++ b/src/sound/sound.c
@@ -791,12 +791,6 @@ sound_cd_thread_reset(void)
cd_thread_enable = available_cdrom_drives ? 1 : 0;
}
-static void
-sound_fdd_clean_buffers(void)
-{
- memset(fdd_out_buffer, 0, SOUNDBUFLEN * 2);
-}
-
static void
sound_fdd_thread(UNUSED(void *param))
{