Configurable FDD sound emulation timings (#6263)

* Initial spindle emulation working for windows atleast

* Spingle motor spin-up, spin-down implemented with smooth transitions to motor-on loop.

* Moved fdd audio emulation to a separate file

* Multiple drives sound emulation

* Single sector movement sound emulations implemented

* Rename project to Immersive86Box and update details

Updated README to reflect the new project name and added details about the Immersive86Box features and future plans.

* Revise contribution guidelines in CONTRIBUTING.md

* Update vulnerability reporting instructions

* System fan-sound next feature after basic fdd sound emulation is ready

* v0.5 multitrack audio seek sfx

* Removed unnecessary stuff

* no .vs folder for git

* Added currently used fdd sound effects and readme.txt for source of the files and intallation instructions

* Add audio emulation installation instructions

Added instructions for audio emulation installation.

* Code and audio samples merged

* Simplify audio emulation installation instructions

* FDC seeking fixed, not instant anymore drive is set to busy during the operation and when it's finished at call fdc to set the appropriate fdc flags.

Also added time logic to fdd to calculate seek duration and a callback function for it.

* FDD sound samples volume control

* Menu options to enable / disable fdd sound for all drives.
DISABLE_FDD_AUDIO definition added, to disable the feature via cmake/build.

* Revert readme etc. changes

* Revert "Revise contribution guidelines in CONTRIBUTING.md"

This reverts commit 98a0478225.

* Revert "Update vulnerability reporting instructions"

This reverts commit 7d32cb659b.

* Fixed merge issue

* Removed excess files

* Fixed PCJr seeking not to break the FDC implementation. Now seeking will take the "correct" amount of time for each system and the seek time is based on the track count. E.g. 40 track FDD system causes 40 track seek time to be 80/40 * 6ms * 40 tracks + 50ms = 480ms + 50ms -> 530ms.

80 track system full seek is 80/80 * 6ms * 80 + 50ms = 530ms, 40 track seek would take 240 + 50 = 290ms.

* Fixed PS/1, PS/2 and PS/55 FDD issues.

* FDD_AUDIO: Updating samples looked in executablePath/samples and if now found there, looks in the executable directory

* Updated installation instructions

* Removed samples path strcat use

* fdd_audio 5.25 samples and support added

* FDD audio timing/volume tunings

* Timing fixes for authentity and special longer timings for PCJr

* Fixed second drive motor keeps running when first drive is only accessed.

* Fixed PCJr random failure issue, timings

* CodeQL fix for load_wav-function. Check the filename to be proper filename

* Revert "Fixed second drive motor keeps running when first drive is only accessed."

This reverts commit 307b173ae7.

* Teac 5.25" drive samples added. Added per drive audio selection to FDD settings.

* Fixed merge issue

* Fixed readme to include only Mitsumi samples under CC-BY license

* Fixes merge problem

* Fixes #6220: OS/2 Warp 3.0 install disk issue and NT 3.1 floppy disk issues. Changed the fdc->stat bit to 0x10 which states fdc busy. Previous implementation with seek time 0, set the ready flag 0x80 immediadely - which was correct for that time, but now as the drive is busy during seek, the value should 0x10. Implemented a backup for fdd commands during fdd seek to be processes after the seek is completed.

* Fixed FDD reset

* Floppy disk audio now gets settings from fdd_audio_profiles.cfg stored in roms/floppy -directory. Floppy settings audio seledtions are also populated by the settings from this config.

* Changed samples per track, not seek_duration_per_track

* Removed commented code.
Returned total_track in configration

* Fixed CodeQL errors

---------

Co-authored-by: Toni Riikonen <domppari@hotmail.com>
This commit is contained in:
Toni Riikonen
2025-10-01 22:07:23 +03:00
committed by GitHub
parent 4af766092f
commit 0beb22722a
7 changed files with 636 additions and 330 deletions

View File

@@ -25,13 +25,6 @@
#define FLOPPY_IMAGE_HISTORY 10
#define SEEK_RECALIBRATE -999
/* Per-drive audio profiles */
#define FDD_AUDIO_PROFILE_NONE 0
#define FDD_AUDIO_PROFILE_MITSUMI 1
#define FDD_AUDIO_PROFILE_PANASONIC 2
#define FDD_AUDIO_PROFILE_TEAC 3
#define FDD_AUDIO_PROFILE_MAX 4
#ifdef __cplusplus
extern "C" {
#endif

View File

@@ -23,6 +23,32 @@ extern "C" {
#ifndef DISABLE_FDD_AUDIO
/* Audio sample configuration structure */
typedef struct {
char filename[512];
float volume;
} audio_sample_config_t;
/* Drive type specific audio configuration */
typedef struct {
int id;
char name[128];
char internal_name[64];
audio_sample_config_t spindlemotor_start;
audio_sample_config_t spindlemotor_loop;
audio_sample_config_t spindlemotor_stop;
audio_sample_config_t single_track_step;
audio_sample_config_t multi_track_seek;
int total_tracks;
int samples_per_track;
double initial_seek_time;
double initial_seek_time_pcjr;
double track_seek_time;
double track_seek_time_pcjr;
} fdd_audio_profile_config_t;
#define FDD_AUDIO_PROFILE_MAX 64
/* Motor sound states */
typedef enum {
MOTOR_STATE_STOPPED = 0,
@@ -52,12 +78,29 @@ typedef struct {
#define FADE_DURATION_MS 75
#define FADE_SAMPLES (48000 * FADE_DURATION_MS / 1000)
/* Functions for configuration management */
extern void fdd_audio_load_profiles(void);
extern int fdd_audio_get_profile_count(void);
extern const fdd_audio_profile_config_t* fdd_audio_get_profile(int id);
extern const char* fdd_audio_get_profile_name(int id);
extern const char* fdd_audio_get_profile_internal_name(int id);
extern int fdd_audio_get_profile_by_internal_name(const char* internal_name);
extern double fdd_audio_get_seek_time(int drive, int is_initial, int track_count);
#else
typedef enum {
MOTOR_STATE_STOPPED = 0
} motor_state_t;
typedef struct {
int id;
char name[128];
char internal_name[64];
} fdd_audio_profile_config_t;
#define FDD_AUDIO_PROFILE_MAX 1
#endif /* DISABLE_FDD_AUDIO */
/* FDD audio initialization and cleanup */
@@ -76,9 +119,6 @@ extern void fdd_audio_play_multi_track_seek(int drive, int from_track, int to_tr
/* Audio callback function */
extern void fdd_audio_callback(int16_t *buffer, int length);
/* State name helper function */
extern const char *fdd_audio_motor_state_name(motor_state_t state);
#ifdef __cplusplus
}
#endif