Fixes to the floppy samples work.
This commit is contained in:
@@ -24,6 +24,8 @@
|
|||||||
#include <86box/timer.h>
|
#include <86box/timer.h>
|
||||||
#include <86box/fdd.h>
|
#include <86box/fdd.h>
|
||||||
#include <86box/fdd_audio.h>
|
#include <86box/fdd_audio.h>
|
||||||
|
#include <86box/mem.h>
|
||||||
|
#include <86box/rom.h>
|
||||||
#include <86box/sound.h>
|
#include <86box/sound.h>
|
||||||
#include <86box/plat.h>
|
#include <86box/plat.h>
|
||||||
#include <86box/path.h>
|
#include <86box/path.h>
|
||||||
@@ -65,23 +67,23 @@ typedef struct {
|
|||||||
/* 5.25" Teac FD-55GFR sample set */
|
/* 5.25" Teac FD-55GFR sample set */
|
||||||
static drive_audio_samples_t samples_teac = {
|
static drive_audio_samples_t samples_teac = {
|
||||||
.spindlemotor_start = {
|
.spindlemotor_start = {
|
||||||
.filename = "TeacFD-55GFR_5.25_1.2MB_motor_start_48000_16_1_PCM.wav",
|
.filename = "roms/floppy/samples/TeacFD-55GFR_5.25_1.2MB_motor_start_48000_16_1_PCM.wav",
|
||||||
.buffer = NULL, .samples = 0, .volume = 3.0f
|
.buffer = NULL, .samples = 0, .volume = 3.0f
|
||||||
},
|
},
|
||||||
.spindlemotor_loop = {
|
.spindlemotor_loop = {
|
||||||
.filename = "TeacFD-55GFR_5.25_1.2MB_motor_loop_48000_16_1_PCM.wav",
|
.filename = "roms/floppy/samples/TeacFD-55GFR_5.25_1.2MB_motor_loop_48000_16_1_PCM.wav",
|
||||||
.buffer = NULL, .samples = 0, .volume = 3.0f
|
.buffer = NULL, .samples = 0, .volume = 3.0f
|
||||||
},
|
},
|
||||||
.spindlemotor_stop = {
|
.spindlemotor_stop = {
|
||||||
.filename = "TeacFD-55GFR_5.25_1.2MB_motor_stop_48000_16_1_PCM.wav",
|
.filename = "roms/floppy/samples/TeacFD-55GFR_5.25_1.2MB_motor_stop_48000_16_1_PCM.wav",
|
||||||
.buffer = NULL, .samples = 0, .volume = 3.0f
|
.buffer = NULL, .samples = 0, .volume = 3.0f
|
||||||
},
|
},
|
||||||
.single_track_step = {
|
.single_track_step = {
|
||||||
.filename = "TeacFD-55GFR_5.25_1.2MB_track_step_48000_16_1_PCM.wav",
|
.filename = "roms/floppy/samples/TeacFD-55GFR_5.25_1.2MB_track_step_48000_16_1_PCM.wav",
|
||||||
.buffer = NULL, .samples = 0, .volume = 2.0f
|
.buffer = NULL, .samples = 0, .volume = 2.0f
|
||||||
},
|
},
|
||||||
.multi_track_seek = {
|
.multi_track_seek = {
|
||||||
.filename = "TeacFD-55GFR_5.25_1.2MB_seekupdown_80_tracks1100ms_48000_16_1_PCM.wav",
|
.filename = "roms/floppy/samples/TeacFD_55GFR_5.25_1.2MB_seekupdown_80_tracks1100ms_48000_16_1_PCM.wav",
|
||||||
.buffer = NULL, .samples = 0, .volume = 2.0f
|
.buffer = NULL, .samples = 0, .volume = 2.0f
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -89,23 +91,23 @@ static drive_audio_samples_t samples_teac = {
|
|||||||
/* 3.5" drive audio samples (Mitsumi) */
|
/* 3.5" drive audio samples (Mitsumi) */
|
||||||
static drive_audio_samples_t samples_35 = {
|
static drive_audio_samples_t samples_35 = {
|
||||||
.spindlemotor_start = {
|
.spindlemotor_start = {
|
||||||
.filename = "mitsumi_spindle_motor_start_48000_16_1_PCM.wav",
|
.filename = "roms/floppy/samples/mitsumi_spindle_motor_start_48000_16_1_PCM.wav",
|
||||||
.buffer = NULL, .samples = 0, .volume = 0.2f
|
.buffer = NULL, .samples = 0, .volume = 0.2f
|
||||||
},
|
},
|
||||||
.spindlemotor_loop = {
|
.spindlemotor_loop = {
|
||||||
.filename = "mitsumi_spindle_motor_loop_48000_16_1_PCM.wav",
|
.filename = "roms/floppy/samples/mitsumi_spindle_motor_loop_48000_16_1_PCM.wav",
|
||||||
.buffer = NULL, .samples = 0, .volume = 0.2f
|
.buffer = NULL, .samples = 0, .volume = 0.2f
|
||||||
},
|
},
|
||||||
.spindlemotor_stop = {
|
.spindlemotor_stop = {
|
||||||
.filename = "mitsumi_spindle_motor_stop_48000_16_1_PCM.wav",
|
.filename = "roms/floppy/samples/mitsumi_spindle_motor_stop_48000_16_1_PCM.wav",
|
||||||
.buffer = NULL, .samples = 0, .volume = 0.2f
|
.buffer = NULL, .samples = 0, .volume = 0.2f
|
||||||
},
|
},
|
||||||
.single_track_step = {
|
.single_track_step = {
|
||||||
.filename = "mitsumi_track_step_48000_16_1_PCM.wav",
|
.filename = "roms/floppy/samples/mitsumi_track_step_48000_16_1_PCM.wav",
|
||||||
.buffer = NULL, .samples = 0, .volume = 1.0f
|
.buffer = NULL, .samples = 0, .volume = 1.0f
|
||||||
},
|
},
|
||||||
.multi_track_seek = {
|
.multi_track_seek = {
|
||||||
.filename = "mitsumi_seek_80_tracks_495ms_48000_16_1_PCM.wav",
|
.filename = "roms/floppy/samples/mitsumi_seek_80_tracks_495ms_48000_16_1_PCM.wav",
|
||||||
.buffer = NULL, .samples = 0, .volume = 1.0f
|
.buffer = NULL, .samples = 0, .volume = 1.0f
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -113,23 +115,23 @@ static drive_audio_samples_t samples_35 = {
|
|||||||
/* 5.25" drive audio samples (Panasonic) */
|
/* 5.25" drive audio samples (Panasonic) */
|
||||||
static drive_audio_samples_t samples_525 = {
|
static drive_audio_samples_t samples_525 = {
|
||||||
.spindlemotor_start = {
|
.spindlemotor_start = {
|
||||||
.filename = "Panasonic_JU-475-5_5.25_1.2MB_motor_start_48000_16_1_PCM.wav",
|
.filename = "roms/floppy/samples/Panasonic_JU-475-5_5.25_1.2MB_motor_start_48000_16_1_PCM.wav",
|
||||||
.buffer = NULL, .samples = 0, .volume = 1.0f
|
.buffer = NULL, .samples = 0, .volume = 1.0f
|
||||||
},
|
},
|
||||||
.spindlemotor_loop = {
|
.spindlemotor_loop = {
|
||||||
.filename = "Panasonic_JU-475-5_5.25_1.2MB_motor_loop_48000_16_1_PCM.wav",
|
.filename = "roms/floppy/samples/Panasonic_JU-475-5_5.25_1.2MB_motor_loop_48000_16_1_PCM.wav",
|
||||||
.buffer = NULL, .samples = 0, .volume = 1.0f
|
.buffer = NULL, .samples = 0, .volume = 1.0f
|
||||||
},
|
},
|
||||||
.spindlemotor_stop = {
|
.spindlemotor_stop = {
|
||||||
.filename = "Panasonic_JU-475-5_5.25_1.2MB_motor_stop_48000_16_1_PCM.wav",
|
.filename = "roms/floppy/samples/Panasonic_JU-475-5_5.25_1.2MB_motor_stop_48000_16_1_PCM.wav",
|
||||||
.buffer = NULL, .samples = 0, .volume = 1.0f
|
.buffer = NULL, .samples = 0, .volume = 1.0f
|
||||||
},
|
},
|
||||||
.single_track_step = {
|
.single_track_step = {
|
||||||
.filename = "Panasonic_JU-475-5_5.25_1.2MB_track_step_48000_16_1_PCM.wav",
|
.filename = "roms/floppy/samples/Panasonic_JU-475-5_5.25_1.2MB_track_step_48000_16_1_PCM.wav",
|
||||||
.buffer = NULL, .samples = 0, .volume = 2.0f
|
.buffer = NULL, .samples = 0, .volume = 2.0f
|
||||||
},
|
},
|
||||||
.multi_track_seek = {
|
.multi_track_seek = {
|
||||||
.filename = "Panasonic_JU-475-5_5.25_1.2MB_seekup_40_tracks_285ms_5ms_per_track_48000_16_1_PCM.wav",
|
.filename = "roms/floppy/samples/Panasonic_JU-475-5_5.25_1.2MB_seekup_40_tracks_285ms_5ms_per_track_48000_16_1_PCM.wav",
|
||||||
.buffer = NULL, .samples = 0, .volume = 2.0f
|
.buffer = NULL, .samples = 0, .volume = 2.0f
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -174,34 +176,16 @@ static int16_t *
|
|||||||
load_wav(const char *filename, int *sample_count)
|
load_wav(const char *filename, int *sample_count)
|
||||||
{
|
{
|
||||||
FILE *f = NULL;
|
FILE *f = NULL;
|
||||||
char full_path[2048];
|
|
||||||
|
|
||||||
if (!filename || strlen(filename) == 0) {
|
if ((filename == NULL) || (strlen(filename) == 0))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
if (strstr(filename, "..") != NULL || strchr(filename, '/') != NULL || strchr(filename, '\\') != NULL) {
|
if (strstr(filename, "..") != NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
for (const char *p = filename; *p; p++) {
|
f = rom_fopen(filename, "rb");
|
||||||
if (!isalnum(*p) && *p != '.' && *p != '_' && *p != '-') {
|
if (f == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
path_append_filename(full_path, exe_path, "roms");
|
|
||||||
path_append_filename(full_path, full_path, "samples");
|
|
||||||
path_append_filename(full_path, full_path, "fdd");
|
|
||||||
path_append_filename(full_path, full_path, filename);
|
|
||||||
f = fopen(full_path, "rb");
|
|
||||||
if (!f) {
|
|
||||||
path_append_filename(full_path, exe_path, "samples");
|
|
||||||
path_append_filename(full_path, full_path, filename);
|
|
||||||
f = fopen(full_path, "rb");
|
|
||||||
if (!f)
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
wav_header_t hdr;
|
wav_header_t hdr;
|
||||||
if (fread(&hdr, sizeof(hdr), 1, f) != 1) {
|
if (fread(&hdr, sizeof(hdr), 1, f) != 1) {
|
||||||
|
|||||||
@@ -66,69 +66,48 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="floppyControls" native="true">
|
<widget class="QWidget" name="floppyControls" native="true">
|
||||||
<layout class="QVBoxLayout" name="floppyVerticalLayout">
|
<layout class="QGridLayout" name="floppyLayout">
|
||||||
<item>
|
<item row="0" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<widget class="QLabel" name="labelFloppyType">
|
||||||
<item>
|
<property name="text">
|
||||||
<widget class="QLabel" name="labelFloppyType">
|
<string>Type:</string>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>Type:</string>
|
</widget>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboBoxFloppyType">
|
|
||||||
<property name="maxVisibleItems">
|
|
||||||
<number>30</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBoxTurboTimings">
|
|
||||||
<property name="text">
|
|
||||||
<string>Turbo timings</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBoxCheckBPB">
|
|
||||||
<property name="text">
|
|
||||||
<string>Check BPB</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="0" column="1">
|
||||||
<layout class="QHBoxLayout" name="audioLayout">
|
<widget class="QComboBox" name="comboBoxFloppyType">
|
||||||
<item>
|
<property name="maxVisibleItems">
|
||||||
<widget class="QLabel" name="labelFloppyAudio">
|
<number>30</number>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>Audio:</string>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
</widget>
|
<item row="0" column="2">
|
||||||
</item>
|
<widget class="QCheckBox" name="checkBoxTurboTimings">
|
||||||
<item>
|
<property name="text">
|
||||||
<widget class="QComboBox" name="comboBoxFloppyAudio">
|
<string>Turbo timings</string>
|
||||||
<property name="maxVisibleItems">
|
</property>
|
||||||
<number>10</number>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
</widget>
|
<item row="0" column="3">
|
||||||
</item>
|
<widget class="QCheckBox" name="checkBoxCheckBPB">
|
||||||
<item>
|
<property name="text">
|
||||||
<spacer name="audioSpacer">
|
<string>Check BPB</string>
|
||||||
<property name="orientation">
|
</property>
|
||||||
<enum>Qt::Horizontal</enum>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
<property name="sizeHint" stdset="0">
|
<item row="1" column="0">
|
||||||
<size>
|
<widget class="QLabel" name="labelFloppyAudio">
|
||||||
<width>40</width>
|
<property name="text">
|
||||||
<height>20</height>
|
<string>Audio:</string>
|
||||||
</size>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
</spacer>
|
</item>
|
||||||
</item>
|
<item row="1" column="1">
|
||||||
</layout>
|
<widget class="QComboBox" name="comboBoxFloppyAudio">
|
||||||
|
<property name="maxVisibleItems">
|
||||||
|
<number>30</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
|||||||
@@ -93,7 +93,6 @@ static int cd_thread_enable = 0;
|
|||||||
static thread_t *sound_fdd_thread_h;
|
static thread_t *sound_fdd_thread_h;
|
||||||
static event_t *sound_fdd_event;
|
static event_t *sound_fdd_event;
|
||||||
static event_t *sound_fdd_start_event;
|
static event_t *sound_fdd_start_event;
|
||||||
static int16_t fdd_out_buffer[SOUNDBUFLEN * 2];
|
|
||||||
static volatile int fddaudioon = 0;
|
static volatile int fddaudioon = 0;
|
||||||
static int fdd_thread_enable = 0;
|
static int fdd_thread_enable = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user