clang-format in src/sound/
This commit is contained in:
@@ -563,4 +563,4 @@ const device_t fluidsynth_device = {
|
|||||||
.config = fluidsynth_config
|
.config = fluidsynth_config
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*USE_FLUIDSYNTH*/
|
#endif/*USE_FLUIDSYNTH*/
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
extern void givealbuffer_midi(void *buf, uint32_t size);
|
extern void givealbuffer_midi(void *buf, uint32_t size);
|
||||||
extern void al_set_midi(int freq, int buf_size);
|
extern void al_set_midi(int freq, int buf_size);
|
||||||
|
|
||||||
|
|
||||||
static mt32emu_report_handler_version get_mt32_report_handler_version(mt32emu_report_handler_i i);
|
static mt32emu_report_handler_version get_mt32_report_handler_version(mt32emu_report_handler_i i);
|
||||||
static void display_mt32_message(void *instance_data, const char *message);
|
static void display_mt32_message(void *instance_data, const char *message);
|
||||||
|
|
||||||
@@ -377,7 +376,7 @@ mt32_close(void *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const device_config_t mt32_config[] = {
|
static const device_config_t mt32_config[] = {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
{
|
{
|
||||||
.name = "output_gain",
|
.name = "output_gain",
|
||||||
.description = "Output Gain",
|
.description = "Output Gain",
|
||||||
|
|||||||
@@ -28,8 +28,7 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#include <86box/86box.h>
|
#include <86box/86box.h>
|
||||||
#include <86box/device.h>
|
#include <86box/device.h>
|
||||||
#include <86box/midi.h>
|
#include <86box/midi.h>
|
||||||
@@ -69,7 +68,7 @@ rtmidi_play_sysex(uint8_t *sysex, unsigned int len)
|
|||||||
midiout->sendMessage(sysex, len);
|
midiout->sendMessage(sysex, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void*
|
void *
|
||||||
rtmidi_output_init(const device_t *info)
|
rtmidi_output_init(const device_t *info)
|
||||||
{
|
{
|
||||||
midi_device_t *dev = (midi_device_t *) malloc(sizeof(midi_device_t));
|
midi_device_t *dev = (midi_device_t *) malloc(sizeof(midi_device_t));
|
||||||
@@ -152,7 +151,7 @@ rtmidi_input_callback(double timeStamp, std::vector<unsigned char> *message, voi
|
|||||||
midi_in_msg(message->data(), message->size());
|
midi_in_msg(message->data(), message->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void*
|
void *
|
||||||
rtmidi_input_init(const device_t *info)
|
rtmidi_input_init(const device_t *info)
|
||||||
{
|
{
|
||||||
midi_device_t *dev = (midi_device_t *) malloc(sizeof(midi_device_t));
|
midi_device_t *dev = (midi_device_t *) malloc(sizeof(midi_device_t));
|
||||||
@@ -273,7 +272,7 @@ static const device_config_t midi_input_config[] = {
|
|||||||
.default_int = 1
|
.default_int = 1
|
||||||
},
|
},
|
||||||
{ .name = "", .description = "", .type = CONFIG_END }
|
{ .name = "", .description = "", .type = CONFIG_END }
|
||||||
// clang-format on
|
// clang-format on
|
||||||
};
|
};
|
||||||
|
|
||||||
const device_t rtmidi_output_device = {
|
const device_t rtmidi_output_device = {
|
||||||
|
|||||||
@@ -637,7 +637,7 @@ ac97_codec_get(int model)
|
|||||||
if ((model >= 0) && (model < (sizeof(ac97_codecs) / sizeof(ac97_codecs[0]))))
|
if ((model >= 0) && (model < (sizeof(ac97_codecs) / sizeof(ac97_codecs[0]))))
|
||||||
return ac97_codecs[model].device;
|
return ac97_codecs[model].device;
|
||||||
else
|
else
|
||||||
return &cs4297a_device; /* fallback */
|
return &cs4297a_device;/* fallback */
|
||||||
}
|
}
|
||||||
|
|
||||||
const device_t ad1881_device = {
|
const device_t ad1881_device = {
|
||||||
|
|||||||
@@ -1005,7 +1005,7 @@ adgold_close(void *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const device_config_t adgold_config[] = {
|
static const device_config_t adgold_config[] = {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
{
|
{
|
||||||
.name = "irq",
|
.name = "irq",
|
||||||
.description = "IRQ",
|
.description = "IRQ",
|
||||||
|
|||||||
@@ -2053,7 +2053,7 @@ es1371_speed_changed(void *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const device_config_t es1371_config[] = {
|
static const device_config_t es1371_config[] = {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
{
|
{
|
||||||
.name = "codec",
|
.name = "codec",
|
||||||
.description = "CODEC",
|
.description = "CODEC",
|
||||||
@@ -2090,11 +2090,11 @@ static const device_config_t es1371_config[] = {
|
|||||||
.default_int = 1
|
.default_int = 1
|
||||||
},
|
},
|
||||||
{ .name = "", .description = "", .type = CONFIG_END }
|
{ .name = "", .description = "", .type = CONFIG_END }
|
||||||
// clang-format on
|
// clang-format on
|
||||||
};
|
};
|
||||||
|
|
||||||
static const device_config_t es1371_onboard_config[] = {
|
static const device_config_t es1371_onboard_config[] = {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
{
|
{
|
||||||
.name = "receive_input",
|
.name = "receive_input",
|
||||||
.description = "Receive input (MIDI)",
|
.description = "Receive input (MIDI)",
|
||||||
|
|||||||
@@ -1488,7 +1488,7 @@ static const device_config_t azt2316a_config[] = {
|
|||||||
.default_int = 0
|
.default_int = 0
|
||||||
},
|
},
|
||||||
{ .name = "", .description = "", .type = CONFIG_END }
|
{ .name = "", .description = "", .type = CONFIG_END }
|
||||||
// clang-format on
|
// clang-format on
|
||||||
};
|
};
|
||||||
|
|
||||||
const device_t azt2316a_device = {
|
const device_t azt2316a_device = {
|
||||||
|
|||||||
@@ -1474,7 +1474,7 @@ static const device_config_t cmi8738_config[] = {
|
|||||||
.default_int = 1
|
.default_int = 1
|
||||||
},
|
},
|
||||||
{ .name = "", .description = "", .type = CONFIG_END }
|
{ .name = "", .description = "", .type = CONFIG_END }
|
||||||
// clang-format on
|
// clang-format on
|
||||||
};
|
};
|
||||||
|
|
||||||
const device_t cmi8338_device = {
|
const device_t cmi8338_device = {
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ static const device_config_t cms_config[] = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ .name = "", .description = "", .type = CONFIG_END }
|
{ .name = "", .description = "", .type = CONFIG_END }
|
||||||
// clang-format on
|
// clang-format on
|
||||||
};
|
};
|
||||||
|
|
||||||
const device_t cms_device = {
|
const device_t cms_device = {
|
||||||
|
|||||||
@@ -1958,7 +1958,7 @@ static const device_config_t mpu401_standalone_mca_config[] = {
|
|||||||
.default_int = 1
|
.default_int = 1
|
||||||
},
|
},
|
||||||
{ .name = "", .description = "", .type = CONFIG_END }
|
{ .name = "", .description = "", .type = CONFIG_END }
|
||||||
// clang-format on
|
// clang-format on
|
||||||
};
|
};
|
||||||
|
|
||||||
const device_t mpu401_device = {
|
const device_t mpu401_device = {
|
||||||
|
|||||||
@@ -36,7 +36,8 @@
|
|||||||
static uint32_t fm_dev_inst[FM_DRV_MAX][FM_MAX];
|
static uint32_t fm_dev_inst[FM_DRV_MAX][FM_MAX];
|
||||||
|
|
||||||
uint8_t
|
uint8_t
|
||||||
fm_driver_get(int chip_id, fm_drv_t *drv) {
|
fm_driver_get(int chip_id, fm_drv_t *drv)
|
||||||
|
{
|
||||||
switch (chip_id) {
|
switch (chip_id) {
|
||||||
case FM_YM3812:
|
case FM_YM3812:
|
||||||
if (fm_driver == FM_DRV_NUKED) {
|
if (fm_driver == FM_DRV_NUKED) {
|
||||||
|
|||||||
@@ -1456,7 +1456,7 @@ nuked_timer_2(void *priv)
|
|||||||
static void
|
static void
|
||||||
nuked_drv_set_do_cycles(void *priv, int8_t do_cycles)
|
nuked_drv_set_do_cycles(void *priv, int8_t do_cycles)
|
||||||
{
|
{
|
||||||
nuked_drv_t *dev = (nuked_drv_t *)priv;
|
nuked_drv_t *dev = (nuked_drv_t *) priv;
|
||||||
|
|
||||||
if (do_cycles)
|
if (do_cycles)
|
||||||
dev->flags |= FLAG_CYCLES;
|
dev->flags |= FLAG_CYCLES;
|
||||||
@@ -1486,14 +1486,14 @@ nuked_drv_init(const device_t *info)
|
|||||||
static void
|
static void
|
||||||
nuked_drv_close(void *priv)
|
nuked_drv_close(void *priv)
|
||||||
{
|
{
|
||||||
nuked_drv_t *dev = (nuked_drv_t *)priv;
|
nuked_drv_t *dev = (nuked_drv_t *) priv;
|
||||||
free(dev);
|
free(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t *
|
static int32_t *
|
||||||
nuked_drv_update(void *priv)
|
nuked_drv_update(void *priv)
|
||||||
{
|
{
|
||||||
nuked_drv_t *dev = (nuked_drv_t *)priv;
|
nuked_drv_t *dev = (nuked_drv_t *) priv;
|
||||||
|
|
||||||
if (dev->pos >= sound_pos_global)
|
if (dev->pos >= sound_pos_global)
|
||||||
return dev->buffer;
|
return dev->buffer;
|
||||||
@@ -1536,7 +1536,7 @@ nuked_drv_read(uint16_t port, void *priv)
|
|||||||
static void
|
static void
|
||||||
nuked_drv_write(uint16_t port, uint8_t val, void *priv)
|
nuked_drv_write(uint16_t port, uint8_t val, void *priv)
|
||||||
{
|
{
|
||||||
nuked_drv_t *dev = (nuked_drv_t *)priv;
|
nuked_drv_t *dev = (nuked_drv_t *) priv;
|
||||||
nuked_drv_update(dev);
|
nuked_drv_update(dev);
|
||||||
|
|
||||||
if ((port & 0x0001) == 0x0001) {
|
if ((port & 0x0001) == 0x0001) {
|
||||||
@@ -1574,8 +1574,9 @@ nuked_drv_write(uint16_t port, uint8_t val, void *priv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nuked_drv_reset_buffer(void *priv) {
|
nuked_drv_reset_buffer(void *priv)
|
||||||
nuked_drv_t *dev = (nuked_drv_t *)priv;
|
{
|
||||||
|
nuked_drv_t *dev = (nuked_drv_t *) priv;
|
||||||
|
|
||||||
dev->pos = 0;
|
dev->pos = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,11 +34,12 @@ enum {
|
|||||||
FLAG_CYCLES = (1 << 0)
|
FLAG_CYCLES = (1 << 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
class YMFMChipBase
|
class YMFMChipBase {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
YMFMChipBase(uint32_t clock, fm_type type, uint32_t samplerate)
|
YMFMChipBase(uint32_t clock, fm_type type, uint32_t samplerate)
|
||||||
: m_buf_pos(0), m_flags(0), m_type(type)
|
: m_buf_pos(0)
|
||||||
|
, m_flags(0)
|
||||||
|
, m_type(type)
|
||||||
{
|
{
|
||||||
memset(m_buffer, 0, sizeof(m_buffer));
|
memset(m_buffer, 0, sizeof(m_buffer));
|
||||||
}
|
}
|
||||||
@@ -50,7 +51,7 @@ public:
|
|||||||
fm_type type() const { return m_type; }
|
fm_type type() const { return m_type; }
|
||||||
int8_t flags() const { return m_flags; }
|
int8_t flags() const { return m_flags; }
|
||||||
void set_do_cycles(int8_t do_cycles) { do_cycles ? m_flags |= FLAG_CYCLES : m_flags &= ~FLAG_CYCLES; }
|
void set_do_cycles(int8_t do_cycles) { do_cycles ? m_flags |= FLAG_CYCLES : m_flags &= ~FLAG_CYCLES; }
|
||||||
int32_t *buffer() const { return (int32_t *)m_buffer; }
|
int32_t *buffer() const { return (int32_t *) m_buffer; }
|
||||||
void reset_buffer() { m_buf_pos = 0; }
|
void reset_buffer() { m_buf_pos = 0; }
|
||||||
|
|
||||||
virtual uint32_t sample_rate() const = 0;
|
virtual uint32_t sample_rate() const = 0;
|
||||||
@@ -58,7 +59,7 @@ public:
|
|||||||
virtual void write(uint16_t addr, uint8_t data) = 0;
|
virtual void write(uint16_t addr, uint8_t data) = 0;
|
||||||
virtual void generate(int32_t *data, uint32_t num_samples) = 0;
|
virtual void generate(int32_t *data, uint32_t num_samples) = 0;
|
||||||
virtual void generate_resampled(int32_t *data, uint32_t num_samples) = 0;
|
virtual void generate_resampled(int32_t *data, uint32_t num_samples) = 0;
|
||||||
virtual int32_t * update() = 0;
|
virtual int32_t *update() = 0;
|
||||||
virtual uint8_t read(uint16_t addr) = 0;
|
virtual uint8_t read(uint16_t addr) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -69,8 +70,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename ChipType>
|
template <typename ChipType>
|
||||||
class YMFMChip : public YMFMChipBase, public ymfm::ymfm_interface
|
class YMFMChip : public YMFMChipBase, public ymfm::ymfm_interface {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
YMFMChip(uint32_t clock, fm_type type, uint32_t samplerate)
|
YMFMChip(uint32_t clock, fm_type type, uint32_t samplerate)
|
||||||
: YMFMChipBase(clock, type, samplerate)
|
: YMFMChipBase(clock, type, samplerate)
|
||||||
@@ -126,7 +126,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void generate_resampled(int32_t *data, uint32_t num_samples) override
|
virtual void generate_resampled(int32_t *data, uint32_t num_samples) override
|
||||||
{
|
{
|
||||||
for (uint32_t i = 0; i < num_samples; i++) {
|
for (uint32_t i = 0; i < num_samples; i++) {
|
||||||
while (m_samplecnt >= m_rateratio) {
|
while (m_samplecnt >= m_rateratio) {
|
||||||
@@ -210,8 +210,7 @@ private:
|
|||||||
int32_t m_samples[2];
|
int32_t m_samples[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -271,7 +270,7 @@ ymfm_drv_close(void *priv)
|
|||||||
YMFMChipBase *drv = (YMFMChipBase *) priv;
|
YMFMChipBase *drv = (YMFMChipBase *) priv;
|
||||||
|
|
||||||
if (drv != NULL)
|
if (drv != NULL)
|
||||||
delete(drv);
|
delete (drv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t
|
static uint8_t
|
||||||
@@ -300,14 +299,16 @@ ymfm_drv_write(uint16_t port, uint8_t val, void *priv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32_t *
|
static int32_t *
|
||||||
ymfm_drv_update(void *priv) {
|
ymfm_drv_update(void *priv)
|
||||||
|
{
|
||||||
YMFMChipBase *drv = (YMFMChipBase *) priv;
|
YMFMChipBase *drv = (YMFMChipBase *) priv;
|
||||||
|
|
||||||
return drv->update();
|
return drv->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ymfm_drv_reset_buffer(void *priv) {
|
ymfm_drv_reset_buffer(void *priv)
|
||||||
|
{
|
||||||
YMFMChipBase *drv = (YMFMChipBase *) priv;
|
YMFMChipBase *drv = (YMFMChipBase *) priv;
|
||||||
|
|
||||||
drv->reset_buffer();
|
drv->reset_buffer();
|
||||||
@@ -370,5 +371,4 @@ const fm_drv_t ymfm_drv {
|
|||||||
&ymfm_drv_set_do_cycles,
|
&ymfm_drv_set_do_cycles,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ pssj_close(void *p)
|
|||||||
|
|
||||||
#if defined(DEV_BRANCH) && defined(USE_TANDY_ISA)
|
#if defined(DEV_BRANCH) && defined(USE_TANDY_ISA)
|
||||||
static const device_config_t pssj_isa_config[] = {
|
static const device_config_t pssj_isa_config[] = {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
{
|
{
|
||||||
.name = "base",
|
.name = "base",
|
||||||
.description = "Address",
|
.description = "Address",
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ sn76489_device_close(void *p)
|
|||||||
|
|
||||||
#if defined(DEV_BRANCH) && defined(USE_TANDY_ISA)
|
#if defined(DEV_BRANCH) && defined(USE_TANDY_ISA)
|
||||||
static const device_config_t tndy_config[] = {
|
static const device_config_t tndy_config[] = {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
{
|
{
|
||||||
.name = "base",
|
.name = "base",
|
||||||
.description = "Address",
|
.description = "Address",
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ ssi2001_close(void *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const device_config_t ssi2001_config[] = {
|
static const device_config_t ssi2001_config[] = {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
{
|
{
|
||||||
.name = "base",
|
.name = "base",
|
||||||
.description = "Address",
|
.description = "Address",
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ wss_speed_changed(void *priv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const device_config_t wss_config[] = {
|
static const device_config_t wss_config[] = {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
{
|
{
|
||||||
.name = "base",
|
.name = "base",
|
||||||
.description = "Address",
|
.description = "Address",
|
||||||
|
|||||||
Reference in New Issue
Block a user