Initial HDD sound implementation using IBM example drive

This commit is contained in:
Domppari
2026-01-03 21:24:33 +02:00
parent 2f1e155b75
commit ebe651761b
15 changed files with 523 additions and 143 deletions

View File

@@ -71,23 +71,6 @@ typedef enum {
MOTOR_STATE_STOPPING
} motor_state_t;
/* WAV header structure */
typedef struct {
char riff[4];
uint32_t size;
char wave[4];
char fmt[4];
uint32_t fmt_size;
uint16_t audio_format;
uint16_t num_channels;
uint32_t sample_rate;
uint32_t byte_rate;
uint16_t block_align;
uint16_t bits_per_sample;
char data[4];
uint32_t data_size;
} wav_header_t;
/* Audio sample structure */
typedef struct {
char filename[512];

View File

@@ -0,0 +1,6 @@
#include <stdint.h>
#include <86box/hdd.h>
extern void hdd_audio_init(void);
extern void hdd_audio_callback(int16_t *buffer, int length);
extern void hdd_audio_seek(hard_disk_t *hdd, uint32_t new_cylinder);

View File

@@ -103,6 +103,9 @@ extern void sound_cd_thread_reset(void);
extern void sound_fdd_thread_init(void);
extern void sound_fdd_thread_end(void);
extern void sound_hdd_thread_init(void);
extern void sound_hdd_thread_end(void);
extern void closeal(void);
extern void inital(void);
extern void givealbuffer(const void *buf);
@@ -110,6 +113,7 @@ extern void givealbuffer_music(const void *buf);
extern void givealbuffer_wt(const void *buf);
extern void givealbuffer_cd(const void *buf);
extern void givealbuffer_fdd(const void *buf, const uint32_t size);
extern void givealbuffer_hdd(const void *buf, const uint32_t size);
#define sb_vibra16c_onboard_relocate_base sb_vibra16s_onboard_relocate_base
#define sb_vibra16cl_onboard_relocate_base sb_vibra16s_onboard_relocate_base

View File

@@ -0,0 +1,28 @@
#ifndef SOUND_UTIL_H
#define SOUND_UTIL_H
#include <stdint.h>
/* WAV file header structure */
typedef struct wav_header_t {
char riff[4];
uint32_t file_size;
char wave[4];
char fmt[4];
uint32_t fmt_size;
uint16_t audio_format;
uint16_t num_channels;
uint32_t sample_rate;
uint32_t byte_rate;
uint16_t block_align;
uint16_t bits_per_sample;
char data[4];
uint32_t data_size;
} wav_header_t;
/* Load a WAV file and return stereo 16-bit samples
* Returns allocated buffer (caller must free) or NULL on error
* sample_count receives the number of stereo sample pairs */
int16_t *sound_load_wav(const char *filename, int *sample_count);
#endif /* SOUND_UTIL_H */