diff options
Diffstat (limited to 'engines/sci/sfx/seq')
-rw-r--r-- | engines/sci/sfx/seq/gm.cpp | 27 | ||||
-rw-r--r-- | engines/sci/sfx/seq/instrument-map.cpp | 51 | ||||
-rw-r--r-- | engines/sci/sfx/seq/instrument-map.h | 18 | ||||
-rw-r--r-- | engines/sci/sfx/seq/map-mt32-to-gm.cpp | 30 | ||||
-rw-r--r-- | engines/sci/sfx/seq/oss-adlib.cpp | 30 |
5 files changed, 52 insertions, 104 deletions
diff --git a/engines/sci/sfx/seq/gm.cpp b/engines/sci/sfx/seq/gm.cpp index 7daa2b9535..bd4a171ed5 100644 --- a/engines/sci/sfx/seq/gm.cpp +++ b/engines/sci/sfx/seq/gm.cpp @@ -32,8 +32,7 @@ namespace Sci { static midi_writer_t *writer = NULL; -static int -midi_gm_open(int patch_len, byte *data, int patch2_len, byte *data2, void *device) { +static int midi_gm_open(int patch_len, byte *data, int patch2_len, byte *data2, void *device) { sfx_instrument_map_t *instrument_map = sfx_instrument_map_load_sci(data, patch_len); if (!instrument_map) { @@ -52,13 +51,11 @@ midi_gm_open(int patch_len, byte *data, int patch2_len, byte *data2, void *devic return SFX_OK; } -static int -midi_gm_close(void) { +static int midi_gm_close(void) { return SFX_OK; } -static int -midi_gm_event(byte command, int argc, byte *argv) { +static int midi_gm_event(byte command, int argc, byte *argv) { byte data[4]; assert(argc < 4); @@ -70,15 +67,13 @@ midi_gm_event(byte command, int argc, byte *argv) { return SFX_OK; } -static int -midi_gm_delay(int ticks) { +static int midi_gm_delay(int ticks) { writer->delay(writer, ticks); return SFX_OK; } -static int -midi_gm_reset_timer(uint32 ts) { +static int midi_gm_reset_timer(uint32 ts) { writer->reset_timer(writer); return SFX_OK; @@ -86,8 +81,7 @@ midi_gm_reset_timer(uint32 ts) { #define MIDI_MASTER_VOLUME_LEN 8 -static int -midi_gm_volume(uint8 volume) { +static int midi_gm_volume(uint8 volume) { byte data[MIDI_MASTER_VOLUME_LEN] = { 0xf0, 0x7f, @@ -106,8 +100,7 @@ midi_gm_volume(uint8 volume) { return SFX_OK; } -static int -midi_gm_allstop(void) { +static int midi_gm_allstop(void) { byte data[3] = { 0xb0, 0x78, /* all sound off */ 0 @@ -125,8 +118,7 @@ midi_gm_allstop(void) { return SFX_OK; } -static int -midi_gm_reverb(int reverb) { +static int midi_gm_reverb(int reverb) { byte data[3] = { 0xb0, 91, /* set reverb */ reverb @@ -145,8 +137,7 @@ midi_gm_reverb(int reverb) { return SFX_OK; } -static int -midi_gm_set_option(char *x, char *y) { +static int midi_gm_set_option(char *x, char *y) { return SFX_ERROR; } diff --git a/engines/sci/sfx/seq/instrument-map.cpp b/engines/sci/sfx/seq/instrument-map.cpp index 07179fbaeb..35b2f9ff05 100644 --- a/engines/sci/sfx/seq/instrument-map.cpp +++ b/engines/sci/sfx/seq/instrument-map.cpp @@ -31,8 +31,7 @@ namespace Sci { -sfx_instrument_map_t * -sfx_instrument_map_new(int velocity_maps_nr) { +sfx_instrument_map_t *sfx_instrument_map_new(int velocity_maps_nr) { sfx_instrument_map_t *map = (sfx_instrument_map_t *)sci_malloc(sizeof(sfx_instrument_map_t)); int i; @@ -67,8 +66,7 @@ sfx_instrument_map_new(int velocity_maps_nr) { return map; } -void -sfx_instrument_map_free(sfx_instrument_map_t *map) { +void sfx_instrument_map_free(sfx_instrument_map_t *map) { if (!map) return; @@ -103,8 +101,7 @@ sfx_instrument_map_free(sfx_instrument_map_t *map) { #define PATCH_MIN_SIZE PATCH_INIT_DATA -static int -patch001_type0_length(byte *data, size_t length) { +static int patch001_type0_length(byte *data, size_t length) { unsigned int pos = 492 + 246 * data[491]; /* printf("timbres %d (post = %04x)\n",data[491], pos);*/ @@ -125,15 +122,13 @@ patch001_type0_length(byte *data, size_t length) { return 0; } -static int -patch001_type1_length(byte *data, size_t length) { +static int patch001_type1_length(byte *data, size_t length) { if ((length >= 1155) && (((data[1154] << 8) + data[1153] + 1155) == (int)length)) return 1; return 0; } -int -sfx_instrument_map_detect(byte *data, size_t length) { +int sfx_instrument_map_detect(byte *data, size_t length) { /* length test */ if (length < 1155) return SFX_MAP_MT32; @@ -149,8 +144,7 @@ sfx_instrument_map_detect(byte *data, size_t length) { } -sfx_instrument_map_t * -sfx_instrument_map_load_sci(byte *data, size_t size) { +sfx_instrument_map_t *sfx_instrument_map_load_sci(byte *data, size_t size) { sfx_instrument_map_t * map; int i, m; @@ -220,40 +214,34 @@ struct decorated_midi_writer_t : public midi_writer_t { }; -static void -init_decorated(struct _midi_writer *self_) { +static void init_decorated(struct _midi_writer *self_) { decorated_midi_writer_t *self = (decorated_midi_writer_t *) self_; self->writer->init(self->writer); } -static void -set_option_decorated(struct _midi_writer *self_, char *name, char *value) { +static void set_option_decorated(struct _midi_writer *self_, char *name, char *value) { decorated_midi_writer_t *self = (decorated_midi_writer_t *) self_; self->writer->set_option(self->writer, name, value); } -static void -delay_decorated(struct _midi_writer *self_, int ticks) { +static void delay_decorated(struct _midi_writer *self_, int ticks) { decorated_midi_writer_t *self = (decorated_midi_writer_t *) self_; self->writer->delay(self->writer, ticks); } -static void -flush_decorated(struct _midi_writer *self_) { +static void flush_decorated(struct _midi_writer *self_) { decorated_midi_writer_t *self = (decorated_midi_writer_t *) self_; if (self->writer->flush) self->writer->flush(self->writer); } -static void -reset_timer_decorated(struct _midi_writer *self_) { +static void reset_timer_decorated(struct _midi_writer *self_) { decorated_midi_writer_t *self = (decorated_midi_writer_t *) self_; self->writer->reset_timer(self->writer); } -static void -close_decorated(decorated_midi_writer_t *self) { +static void close_decorated(decorated_midi_writer_t *self) { sfx_instrument_map_free(self->map); self->map = NULL; self->writer->close(self->writer); @@ -264,16 +252,14 @@ close_decorated(decorated_midi_writer_t *self) { #define BOUND_127(x) (((x) < 0)? 0 : (((x) > 0x7f)? 0x7f : (x))) -static int -bound_hard_127(int i, const char *descr) { +static int bound_hard_127(int i, const char *descr) { int r = BOUND_127(i); if (r != i) fprintf(stderr, "[instrument-map] Hard-clipping %02x to %02x in %s\n", i, r, descr); return r; } -static int -set_bend_range(midi_writer_t *writer, int channel, int range) { +static int set_bend_range(midi_writer_t *writer, int channel, int range) { byte buf[3] = {0xb0, 0x65, 0x00}; buf[0] |= channel & 0xf; @@ -297,8 +283,7 @@ set_bend_range(midi_writer_t *writer, int channel, int range) { return SFX_OK; } -static int -write_decorated(decorated_midi_writer_t *self, byte *buf, int len) { +static int write_decorated(decorated_midi_writer_t *self, byte *buf, int len) { sfx_instrument_map_t *map = self->map; int op = *buf & 0xf0; int chan = *buf & 0x0f; @@ -423,8 +408,7 @@ write_decorated(decorated_midi_writer_t *self, byte *buf, int len) { #define MIDI_BYTES_PER_SECOND 3250 /* This seems to be the minimum guarantee by the standard */ #define MAX_PER_TICK (MIDI_BYTES_PER_SECOND / 60) /* After this, we ought to issue one tick of pause */ -static void -init(midi_writer_t *writer, byte *data, size_t len) { +static void init(midi_writer_t *writer, byte *data, size_t len) { size_t offset = 0; byte status = 0; @@ -489,8 +473,7 @@ init(midi_writer_t *writer, byte *data, size_t len) { #define NAME_SUFFIX "+instruments" -midi_writer_t * -sfx_mapped_writer(midi_writer_t *writer, sfx_instrument_map_t *map) { +midi_writer_t *sfx_mapped_writer(midi_writer_t *writer, sfx_instrument_map_t *map) { int i; decorated_midi_writer_t *retval; diff --git a/engines/sci/sfx/seq/instrument-map.h b/engines/sci/sfx/seq/instrument-map.h index 95233f9099..c223e68a33 100644 --- a/engines/sci/sfx/seq/instrument-map.h +++ b/engines/sci/sfx/seq/instrument-map.h @@ -75,21 +75,18 @@ struct sfx_instrument_map_t { byte *initialisation_block; /* Initial MIDI commands to set up the device */ }; -sfx_instrument_map_t * -sfx_instrument_map_new(int velocity_maps_nr); +sfx_instrument_map_t *sfx_instrument_map_new(int velocity_maps_nr); /* Constructs a new default-initialised velocity map ** Parameters: (int) velocity_maps_nr: Number of velocity maps to allocate ** Returns : (sfx_instrument_map *) an initialised instrument map */ -void -sfx_instrument_map_free(sfx_instrument_map_t *map); +void sfx_instrument_map_free(sfx_instrument_map_t *map); /* Deallocates an instrument map ** Parameters: (sfx_instrument_map *) map: The map to deallocate, or NULL for a no-op */ -sfx_instrument_map_t * -sfx_instrument_map_load_sci(byte *data, size_t length); +sfx_instrument_map_t *sfx_instrument_map_load_sci(byte *data, size_t length); /* Allocate and initialise an instrument map from SCI data ** Parameters: (byte *) Pointer to the data to initialise from ** (size_t) Number of bytes to expect within @@ -98,8 +95,7 @@ sfx_instrument_map_load_sci(byte *data, size_t length); ** If `data' is null, the function will return NULL quietly. */ -sfx_instrument_map_t * -sfx_instrument_map_mt32_to_gm(byte *data, size_t size); +sfx_instrument_map_t *sfx_instrument_map_mt32_to_gm(byte *data, size_t size); /* Allocate and initialise an instrument map from MT-32 patch data ** Parameters: (byte *) Pointer to the MT-32 patch data to initialise from ** (size_t) Number of bytes to expect within @@ -107,8 +103,7 @@ sfx_instrument_map_mt32_to_gm(byte *data, size_t size); ** If `data' is null or invalid, the function will return a default MT-32 to GM map. */ -int -sfx_instrument_map_detect(byte *data, size_t size); +int sfx_instrument_map_detect(byte *data, size_t size); /* Detects the type of patch data ** Parameters: (byte *) Pointer to the patch data ** (size_t) Number of bytes to expect within @@ -116,8 +111,7 @@ sfx_instrument_map_detect(byte *data, size_t size); ** or SFX_MAP_UNKNOWN for unknown. */ -midi_writer_t * -sfx_mapped_writer(midi_writer_t *writer, sfx_instrument_map_t *map); +midi_writer_t *sfx_mapped_writer(midi_writer_t *writer, sfx_instrument_map_t *map); /* Wrap a midi_writer_t into an instrument map ** Parameters: (midi_writer_t *) writer: The writer to wrap ** (sfx_instrument_map_t *) map: The map to apply to all commands going into the writer, or NULL diff --git a/engines/sci/sfx/seq/map-mt32-to-gm.cpp b/engines/sci/sfx/seq/map-mt32-to-gm.cpp index 777409d694..8c909905e1 100644 --- a/engines/sci/sfx/seq/map-mt32-to-gm.cpp +++ b/engines/sci/sfx/seq/map-mt32-to-gm.cpp @@ -32,8 +32,7 @@ namespace Sci { #define DEBUG_MT32_TO_GM -static const char -*GM_Instrument_Names[] = { +static const char *GM_Instrument_Names[] = { /*000*/ "Acoustic Grand Piano", /*001*/ "Bright Acoustic Piano", /*002*/ "Electric Grand Piano", @@ -165,8 +164,7 @@ static const char }; /* The GM Percussion map is downwards compatible to the MT32 map, which is used in SCI */ -static const char -*GM_Percussion_Names[] = { +static const char *GM_Percussion_Names[] = { /*00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*20*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -398,8 +396,7 @@ static struct { /*29*/ {"OpenHiHat2", SFX_MAPPED_TO_RHYTHM, 43} }; -static int8 -MT32_PresetRhythmKeymap[] = { +static int8 MT32_PresetRhythmKeymap[] = { SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, @@ -560,8 +557,7 @@ static struct { {0, 0, 0} }; -static int8 -lookup_instrument(const char *iname) { +static int8 lookup_instrument(const char *iname) { int i = 0; while (MT32_MemoryTimbreMaps[i].name) { @@ -572,8 +568,7 @@ lookup_instrument(const char *iname) { return SFX_UNMAPPED; } -static int8 -lookup_rhythm_key(const char *iname) { +static int8 lookup_rhythm_key(const char *iname) { int i = 0; while (MT32_MemoryTimbreMaps[i].name) { @@ -584,8 +579,7 @@ lookup_rhythm_key(const char *iname) { return SFX_UNMAPPED; } -static void -print_map(int sci, int ins, int rhythm, int mt32) { +static void print_map(int sci, int ins, int rhythm, int mt32) { #ifdef DEBUG_MT32_TO_GM if (ins == SFX_UNMAPPED || (ins == SFX_MAPPED_TO_RHYTHM && rhythm == SFX_UNMAPPED)) { sciprintf("[MT32-to-GM] No mapping available for [%i] `%s' (%i)\n", @@ -606,8 +600,7 @@ print_map(int sci, int ins, int rhythm, int mt32) { #endif } -static void -print_map_mem(int sci, int ins, int rhythm, char *mt32) { +static void print_map_mem(int sci, int ins, int rhythm, char *mt32) { #ifdef DEBUG_MT32_TO_GM char name[11]; @@ -631,8 +624,7 @@ print_map_mem(int sci, int ins, int rhythm, char *mt32) { #endif } -static void -print_map_rhythm(int sci, int ins, int rhythm, int mt32) { +static void print_map_rhythm(int sci, int ins, int rhythm, int mt32) { #ifdef DEBUG_MT32_TO_GM if (ins == SFX_UNMAPPED || (ins == SFX_MAPPED_TO_RHYTHM && rhythm == SFX_UNMAPPED)) { sciprintf("[MT32-to-GM] No mapping available for [%i] `%s' [R] (%i)\n", @@ -653,8 +645,7 @@ print_map_rhythm(int sci, int ins, int rhythm, int mt32) { #endif } -static void -print_map_rhythm_mem(int sci, int rhythm, char *mt32) { +static void print_map_rhythm_mem(int sci, int rhythm, char *mt32) { #ifdef DEBUG_MT32_TO_GM char name[11]; @@ -672,8 +663,7 @@ print_map_rhythm_mem(int sci, int rhythm, char *mt32) { #endif } -sfx_instrument_map_t * -sfx_instrument_map_mt32_to_gm(byte *data, size_t size) { +sfx_instrument_map_t *sfx_instrument_map_mt32_to_gm(byte *data, size_t size) { int memtimbres, patches; uint8 group, number, keyshift, finetune, bender_range; uint8 *patchpointer; diff --git a/engines/sci/sfx/seq/oss-adlib.cpp b/engines/sci/sfx/seq/oss-adlib.cpp index 2222544781..9285fd5a2c 100644 --- a/engines/sci/sfx/seq/oss-adlib.cpp +++ b/engines/sci/sfx/seq/oss-adlib.cpp @@ -143,8 +143,7 @@ int adlib_kill_one_note(int chn) { return oldest; } -static void -adlib_start_note(int chn, int note, int velocity) { +static void adlib_start_note(int chn, int note, int velocity) { int free; struct timeval now; @@ -174,8 +173,7 @@ adlib_start_note(int chn, int note, int velocity) { SEQ_DUMPBUF(); } -static int -midi_adlib_open(int data_length, byte *data_ptr, int data2_length, +static int midi_adlib_open(int data_length, byte *data_ptr, int data2_length, byte *data2_ptr, void *seq) { int nrdevs, i, n; struct synth_info info; @@ -237,15 +235,13 @@ midi_adlib_open(int data_length, byte *data_ptr, int data2_length, } -static int -midi_adlib_close(void) { +static int midi_adlib_close(void) { SEQ_DUMPBUF(); return close(seqfd); } -static int -midi_adlib_allstop(void) { +static int midi_adlib_allstop(void) { int i; for (i = 0; i < ADLIB_VOICES ; i++) { if (oper_chn[i] == 255) @@ -257,14 +253,12 @@ midi_adlib_allstop(void) { return 0; } -static int -midi_adlib_reverb(int param) { +static int midi_adlib_reverb(int param) { printf("reverb NYI %04x \n", param); return 0; } -static inline int -midi_adlib_event1(uint8 command, uint8 note, uint8 velocity) { +static inline int midi_adlib_event1(uint8 command, uint8 note, uint8 velocity) { uint8 channel, oper; channel = command & 0x0f; @@ -297,8 +291,7 @@ midi_adlib_event1(uint8 command, uint8 note, uint8 velocity) { return 0; } -static inline int -midi_adlib_event2(uint8 command, uint8 param) { +static inline int midi_adlib_event2(uint8 command, uint8 param) { uint8 channel; uint8 oper; @@ -320,22 +313,19 @@ midi_adlib_event2(uint8 command, uint8 param) { return 0; } -static int -midi_adlib_event(byte command, int argc, byte *argv) { +static int midi_adlib_event(byte command, int argc, byte *argv) { if (argc > 1) return midi_adlib_event1(command, argv[0], argv[1]); else return midi_adlib_event2(command, argv[0]); } -static int -midi_adlib_delay(int ticks) { +static int midi_adlib_delay(int ticks) { SEQ_DELTA_TIME(ticks); return SFX_OK; } -static int -midi_adlib_set_option(char *name, char *value) { +static int midi_adlib_set_option(char *name, char *value) { return SFX_ERROR; /* No options are supported at this time */ } |