diff options
author | Paweł Kołodziejski | 2009-02-21 17:23:28 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2009-02-21 17:23:28 +0000 |
commit | f18d5500b1a3fc78c3190c8c2dbce8c6abf5095c (patch) | |
tree | f587a8190988b05a93df7464af5b19c676ebf7d1 /engines/sci/sfx/softseq | |
parent | a0cc744aab81339653ad0b185cfb90bb90cf4410 (diff) | |
download | scummvm-rg350-f18d5500b1a3fc78c3190c8c2dbce8c6abf5095c.tar.gz scummvm-rg350-f18d5500b1a3fc78c3190c8c2dbce8c6abf5095c.tar.bz2 scummvm-rg350-f18d5500b1a3fc78c3190c8c2dbce8c6abf5095c.zip |
formating
svn-id: r38709
Diffstat (limited to 'engines/sci/sfx/softseq')
-rw-r--r-- | engines/sci/sfx/softseq/SN76496.cpp | 27 | ||||
-rw-r--r-- | engines/sci/sfx/softseq/amiga.cpp | 42 | ||||
-rw-r--r-- | engines/sci/sfx/softseq/opl2.cpp | 24 | ||||
-rw-r--r-- | engines/sci/sfx/softseq/pcspeaker.cpp | 24 | ||||
-rw-r--r-- | engines/sci/sfx/softseq/softsequencers.cpp | 3 |
5 files changed, 40 insertions, 80 deletions
diff --git a/engines/sci/sfx/softseq/SN76496.cpp b/engines/sci/sfx/softseq/SN76496.cpp index f128be2d00..3f9c076a43 100644 --- a/engines/sci/sfx/softseq/SN76496.cpp +++ b/engines/sci/sfx/softseq/SN76496.cpp @@ -46,23 +46,19 @@ extern sfx_softseq_t sfx_softseq_pcspeaker; /* Forward-declare the sequencer we are defining here */ -static int -SN76496_set_option(sfx_softseq_t *self, const char *name, const char *value) { +static int SN76496_set_option(sfx_softseq_t *self, const char *name, const char *value) { return SFX_ERROR; } -static int -SN76496_init(sfx_softseq_t *self, byte *patch, int patch_len, byte *patch2, +static int SN76496_init(sfx_softseq_t *self, byte *patch, int patch_len, byte *patch2, int patch2_len) { return SFX_OK; } -static void -SN76496_exit(sfx_softseq_t *self) { +static void SN76496_exit(sfx_softseq_t *self) { } -static void -SN76496_event(sfx_softseq_t *self, byte command, int argc, byte *argv) { +static void SN76496_event(sfx_softseq_t *self, byte command, int argc, byte *argv) { int i; int chan = -1; #if 0 @@ -136,8 +132,7 @@ SN76496_event(sfx_softseq_t *self, byte command, int argc, byte *argv) { #define BASE_NOTE 129 /* A10 */ #define BASE_OCTAVE 10 /* A10, as I said */ -static int -freq_table[12] = { /* A4 is 440Hz, halftone map is x |-> ** 2^(x/12) */ +static int freq_table[12] = { /* A4 is 440Hz, halftone map is x |-> ** 2^(x/12) */ 28160, /* A10 */ 29834, 31608, @@ -152,8 +147,7 @@ freq_table[12] = { /* A4 is 440Hz, halftone map is x |-> ** 2^(x/12) */ 53159 }; -static inline int -get_freq(int note) { +static inline int get_freq(int note) { int halftone_delta = note - BASE_NOTE; int oct_diff = ((halftone_delta + BASE_OCTAVE * 12) / 12) - BASE_OCTAVE; int halftone_index = (halftone_delta + (12 * 100)) % 12 ; @@ -163,8 +157,7 @@ get_freq(int note) { } -void -SN76496_poll(sfx_softseq_t *self, byte *dest, int len) { +void SN76496_poll(sfx_softseq_t *self, byte *dest, int len) { gint16 *buf = (gint16 *) dest; int i; int chan; @@ -206,15 +199,13 @@ SN76496_poll(sfx_softseq_t *self, byte *dest, int len) { } -void -SN76496_allstop(sfx_softseq_t *self) { +void SN76496_allstop(sfx_softseq_t *self) { int i; for (i = 0; i < CHANNELS_NR; i++) notes[i] = 0; } -void -SN76496_volume(sfx_softseq_t *self, int new_volume) { +void SN76496_volume(sfx_softseq_t *self, int new_volume) { global_volume = new_volume; } diff --git a/engines/sci/sfx/softseq/amiga.cpp b/engines/sci/sfx/softseq/amiga.cpp index 815d84f17f..4ceb0d311e 100644 --- a/engines/sci/sfx/softseq/amiga.cpp +++ b/engines/sci/sfx/softseq/amiga.cpp @@ -131,8 +131,7 @@ static int freq_table[] = { 59932, 63496, 67271, 71271, 75509, 80000, 84757, 89796 }; -static void -set_envelope(channel_t *channel, envelope_t *envelope, int phase) { +static void set_envelope(channel_t *channel, envelope_t *envelope, int phase) { channel->envelope = phase; channel->envelope_samples = envelope[phase].length; @@ -142,16 +141,14 @@ set_envelope(channel_t *channel, envelope_t *envelope, int phase) { channel->velocity = envelope[phase - 1].target; } -static inline int -interpolate(sbyte *samples, frac_t offset) { +static inline int interpolate(sbyte *samples, frac_t offset) { int x = fracToInt(offset); int diff = (samples[x + 1] - samples[x]) << 8; return (samples[x] << 8) + fracToInt(diff * (offset & FRAC_LO_MASK)); } -static void -play_instrument(gint16 *dest, channel_t *channel, int count) { +static void play_instrument(gint16 *dest, channel_t *channel, int count) { int index = 0; int vol = hw_channels[channel->hw_channel].volume; instrument_t *instrument = bank.instruments[channel->instrument]; @@ -253,8 +250,7 @@ play_instrument(gint16 *dest, channel_t *channel, int count) { } } -static void -change_instrument(int channel, int instrument) { +static void change_instrument(int channel, int instrument) { #ifdef DEBUG if (bank.instruments[instrument]) sciprintf("[sfx:seq:amiga] Setting channel %i to \"%s\" (%i)\n", channel, bank.instruments[instrument]->name, instrument); @@ -264,8 +260,7 @@ change_instrument(int channel, int instrument) { hw_channels[channel].instrument = instrument; } -static void -stop_channel(int ch) { +static void stop_channel(int ch) { int i; /* Start decay phase for note on this hw channel, if any */ @@ -278,8 +273,7 @@ stop_channel(int ch) { } } -static void -stop_note(int ch, int note) { +static void stop_note(int ch, int note) { int channel; instrument_t *instrument; @@ -301,8 +295,7 @@ stop_note(int ch, int note) { set_envelope(&channels[channel], instrument->envelope, 2); } -static void -start_note(int ch, int note, int velocity) { +static void start_note(int ch, int note, int velocity) { instrument_t *instrument; int channel; @@ -453,13 +446,11 @@ static instrument_t *read_instrument(FILE *file, int *id) { return instrument; } -static int -ami_set_option(sfx_softseq_t *self, const char *name, const char *value) { +static int ami_set_option(sfx_softseq_t *self, const char *name, const char *value) { return SFX_ERROR; } -static int -ami_init(sfx_softseq_t *self, byte *patch, int patch_len, byte *patch2, int patch2_len) { +static int ami_init(sfx_softseq_t *self, byte *patch, int patch_len, byte *patch2, int patch2_len) { FILE *file; byte header[40]; int i; @@ -520,8 +511,7 @@ ami_init(sfx_softseq_t *self, byte *patch, int patch_len, byte *patch2, int patc return SFX_OK; } -static void -ami_exit(sfx_softseq_t *self) { +static void ami_exit(sfx_softseq_t *self) { int i; for (i = 0; i < bank.size; i++) { @@ -532,8 +522,7 @@ ami_exit(sfx_softseq_t *self) { } } -static void -ami_event(sfx_softseq_t *self, byte command, int argc, byte *argv) { +static void ami_event(sfx_softseq_t *self, byte command, int argc, byte *argv) { int channel, oper; channel = command & 0x0f; @@ -578,8 +567,7 @@ ami_event(sfx_softseq_t *self, byte command, int argc, byte *argv) { } } -void -ami_poll(sfx_softseq_t *self, byte *dest, int len) { +void ami_poll(sfx_softseq_t *self, byte *dest, int len) { int i, j; gint16 *buf = (gint16 *) dest; gint16 *buffers = (gint16*)malloc(len * 2 * CHANNELS_NR); @@ -607,13 +595,11 @@ ami_poll(sfx_softseq_t *self, byte *dest, int len) { } } -void -ami_volume(sfx_softseq_t *self, int new_volume) { +void ami_volume(sfx_softseq_t *self, int new_volume) { volume = new_volume; } -void -ami_allstop(sfx_softseq_t *self) { +void ami_allstop(sfx_softseq_t *self) { int i; for (i = 0; i < HW_CHANNELS_NR; i++) stop_channel(i); diff --git a/engines/sci/sfx/softseq/opl2.cpp b/engines/sci/sfx/softseq/opl2.cpp index 4ca05412d7..3a607a3188 100644 --- a/engines/sci/sfx/softseq/opl2.cpp +++ b/engines/sci/sfx/softseq/opl2.cpp @@ -403,8 +403,7 @@ int adlibemu_start_note(int chn, int note, int velocity) { return 0; } -static -void adlibemu_update_pitch(int chn, int note, int newpitch) { +static void adlibemu_update_pitch(int chn, int note, int newpitch) { int i; int matched = 0; @@ -469,8 +468,7 @@ void test_adlib(void) { /* count is # of FRAMES, not bytes. We assume 16-bit stereo frames (ie 4 bytes) */ -static void -opl2_poll(sfx_softseq_t *self, byte *dest, int count) { +static void opl2_poll(sfx_softseq_t *self, byte *dest, int count) { gint16 *buffer = (gint16 *) dest; gint16 *ptr = buffer; @@ -517,8 +515,7 @@ opl2_poll(sfx_softseq_t *self, byte *dest, int count) { } } -static int -opl2_init(sfx_softseq_t *self, byte *data_ptr, int data_length, byte *data2_ptr, +static int opl2_init(sfx_softseq_t *self, byte *data_ptr, int data_length, byte *data2_ptr, int data2_length) { int i; @@ -550,8 +547,7 @@ opl2_init(sfx_softseq_t *self, byte *data_ptr, int data_length, byte *data2_ptr, } -static void -opl2_exit(sfx_softseq_t *self) { +static void opl2_exit(sfx_softseq_t *self) { FM_OPL *opl = ym3812_L; ym3812_L = NULL; OPLDestroy(opl); @@ -562,8 +558,7 @@ opl2_exit(sfx_softseq_t *self) { // XXX deregister with pcm layer. } -static void -opl2_allstop(sfx_softseq_t *self) { +static void opl2_allstop(sfx_softseq_t *self) { // printf("AdlibEmu: Reset\n"); if (! ready) return; @@ -655,8 +650,7 @@ int midi_adlibemu_event2(guint8 command, guint8 param, guint32 delta) { return 0; } -static void -opl2_volume(sfx_softseq_t *self, int volume) { +static void opl2_volume(sfx_softseq_t *self, int volume) { guint8 i; i = (guint8)volume * 15 / 100; @@ -668,13 +662,11 @@ opl2_volume(sfx_softseq_t *self, int volume) { #endif } -int -opl2_set_option(sfx_softseq_t *self, const char *name, const char *value) { +int opl2_set_option(sfx_softseq_t *self, const char *name, const char *value) { return SFX_ERROR; } -void -opl2_event(sfx_softseq_t *self, byte cmd, int argc, byte *argv) { +void opl2_event(sfx_softseq_t *self, byte cmd, int argc, byte *argv) { if (argc == 1) midi_adlibemu_event2(cmd, argv[0], 0); else if (argc == 2) diff --git a/engines/sci/sfx/softseq/pcspeaker.cpp b/engines/sci/sfx/softseq/pcspeaker.cpp index 3f4bb0f332..2b5bea3fbe 100644 --- a/engines/sci/sfx/softseq/pcspeaker.cpp +++ b/engines/sci/sfx/softseq/pcspeaker.cpp @@ -40,23 +40,19 @@ extern sfx_softseq_t sfx_softseq_pcspeaker; /* Forward-declare the sequencer we are defining here */ -static int -sps_set_option(sfx_softseq_t *self, const char *name, const char *value) { +static int sps_set_option(sfx_softseq_t *self, const char *name, const char *value) { return SFX_ERROR; } -static int -sps_init(sfx_softseq_t *self, byte *patch, int patch_len, byte *patch2, +static int sps_init(sfx_softseq_t *self, byte *patch, int patch_len, byte *patch2, int patch2_len) { return SFX_OK; } -static void -sps_exit(sfx_softseq_t *self) { +static void sps_exit(sfx_softseq_t *self) { } -static void -sps_event(sfx_softseq_t *self, byte command, int argc, byte *argv) { +static void sps_event(sfx_softseq_t *self, byte command, int argc, byte *argv) { #if 0 fprintf(stderr, "Note [%02x : %02x %02x]\n", command, argc ? argv[0] : 0, (argc > 1) ? argv[1] : 0); #endif @@ -93,8 +89,7 @@ sps_event(sfx_softseq_t *self, byte command, int argc, byte *argv) { #define BASE_NOTE 129 /* A10 */ #define BASE_OCTAVE 10 /* A10, as I said */ -static int -freq_table[12] = { /* A4 is 440Hz, halftone map is x |-> ** 2^(x/12) */ +static int freq_table[12] = { /* A4 is 440Hz, halftone map is x |-> ** 2^(x/12) */ 28160, /* A10 */ 29834, 31608, @@ -110,8 +105,7 @@ freq_table[12] = { /* A4 is 440Hz, halftone map is x |-> ** 2^(x/12) */ }; -void -sps_poll(sfx_softseq_t *self, byte *dest, int len) { +void sps_poll(sfx_softseq_t *self, byte *dest, int len) { int halftone_delta = note - BASE_NOTE; int oct_diff = ((halftone_delta + BASE_OCTAVE * 12) / 12) - BASE_OCTAVE; int halftone_index = (halftone_delta + (12 * 100)) % 12 ; @@ -146,13 +140,11 @@ sps_poll(sfx_softseq_t *self, byte *dest, int len) { } -void -sps_volume(sfx_softseq_t *self, int new_volume) { +void sps_volume(sfx_softseq_t *self, int new_volume) { volume = new_volume << 4; } -void -sps_allstop(sfx_softseq_t *self) { +void sps_allstop(sfx_softseq_t *self) { note = 0; } diff --git a/engines/sci/sfx/softseq/softsequencers.cpp b/engines/sci/sfx/softseq/softsequencers.cpp index e43e9b8cda..8ab3aa61ab 100644 --- a/engines/sci/sfx/softseq/softsequencers.cpp +++ b/engines/sci/sfx/softseq/softsequencers.cpp @@ -51,8 +51,7 @@ static sfx_softseq_t *sw_sequencers[] = { }; -sfx_softseq_t * -sfx_find_softseq(const char *name) { +sfx_softseq_t *sfx_find_softseq(const char *name) { if (!name) return sw_sequencers[0]; else { |