From e669aa1a0d5abc5e3cdcc3eff4c1c0e05aa5f494 Mon Sep 17 00:00:00 2001 From: Joel Yliluoma Date: Mon, 15 Sep 2008 16:09:04 +0300 Subject: [PATCH] Added bendmode parameter to GM_SetFreqAndVol. This can be used to extend the pitch bending range a bit. --- modplug/snd_gm.cpp | 11 ++++++++++- modplug/snd_gm.h | 15 ++++++++++++++- modplug/sndmix.cpp | 8 +++++++- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/modplug/snd_gm.cpp b/modplug/snd_gm.cpp index 9f37bac..9142fc7 100644 --- a/modplug/snd_gm.cpp +++ b/modplug/snd_gm.cpp @@ -425,7 +425,7 @@ static double log2(double d) } #endif -void GM_SetFreqAndVol(int c, int Hertz, int Vol) // for keyons and pitch bending alike +void GM_SetFreqAndVol(int c, int Hertz, int Vol, MidiBendMode bend_mode) { //fprintf(stderr, "GM_SetFreqAndVol(%d,%d,%d)\n", c,Hertz,Vol); if(c < 0 || ((unsigned int)c) >= MAXCHN) return; @@ -460,6 +460,8 @@ void GM_SetFreqAndVol(int c, int Hertz, int Vol) // for keyons and pitch bending */ double midinote = 69 + 12.0 * log2(Hertz/440.0); + // Reduce by a couple of octaves... Apparently the hertz + // value that comes from SchismTracker is upscaled by some 2^5. midinote -= 12*5; int note = S3Mchans[c].note; // what's playing on the channel right now? @@ -469,7 +471,14 @@ void GM_SetFreqAndVol(int c, int Hertz, int Vol) // for keyons and pitch bending { // If the note is not active, activate it first. // Choose the nearest note to Hertz. + note = (int)(midinote + 0.5); + + // If we are expecting a bend exclusively in either direction, + // prepare to utilize the full extent of available pitch bending. + if(bend_mode == MIDI_BEND_DOWN) note += (int)(0x2000 / semitone_bend_depth); + if(bend_mode == MIDI_BEND_UP) note -= (int)(0x2000 / semitone_bend_depth); + if(note < 1) note = 1; if(note > 127) note = 127; GM_KeyOn(c, note, Vol); diff --git a/modplug/snd_gm.h b/modplug/snd_gm.h index ee576ba..1a0e0d4 100644 --- a/modplug/snd_gm.h +++ b/modplug/snd_gm.h @@ -17,7 +17,20 @@ void GM_Reset(void); void GM_Pan(int ch, signed char val); // param: -128..+127 -void GM_SetFreqAndVol(int c, int Hertz, int Vol); // for keyons, touches and pitch bending +// This function is the core function for MIDI updates. +// It handles keyons, touches and pitch bending. +// channel = IT channel on which the event happens +// Hertz = The hertz value for this note at the present moment +// Vol = The volume for this note at this present moment +// bend_mode = This parameter can provide a hint for the tone calculator +// for deciding the note to play. If it is to be expected that +// a large bend up will follow, it may be a good idea to start +// from a low bend to utilize the maximum bending scale. +// +// Note that vibrato etc. are emulated by issuing multiple SetFreqAndVol +// commands; they are not translated into MIDI vibrato operator calls. +typedef enum { MIDI_BEND_NORMAL, MIDI_BEND_DOWN, MIDI_BEND_UP } MidiBendMode; +void GM_SetFreqAndVol(int channel, int Hertz, int Vol, MidiBendMode bend_mode); #ifdef __cplusplus } diff --git a/modplug/sndmix.cpp b/modplug/sndmix.cpp index 1d97163..0181905 100644 --- a/modplug/sndmix.cpp +++ b/modplug/sndmix.cpp @@ -967,7 +967,13 @@ BOOL CSoundFile::ReadNote() && (pChn->pHeader) && (pChn->pHeader->nMidiChannel > 0)) { - GM_SetFreqAndVol(nChn, freq, (vol * pChn->nInsVol * 63 / (1<<20))); + MidiBendMode BendMode = MIDI_BEND_NORMAL; + /* TODO: If we're expecting a large bend exclusively + * in either direction, update BendMode to indicate so. + * This can be used to extend the range of MIDI pitch bending. + */ + GM_SetFreqAndVol(nChn, freq, (vol * pChn->nInsVol * 63 / (1<<20)), + BendMode); } else if((pChn->dwFlags & CHN_ADLIB) && !(pChn->dwFlags & CHN_NOTEFADE)) { -- 1.5.6.3 From ff1974b86359e3e91bb229d412c1b9019d382048 Mon Sep 17 00:00:00 2001 From: Joel Yliluoma Date: Mon, 15 Sep 2008 16:09:38 +0300 Subject: [PATCH] fixed the volume clamping of percussion instruments --- modplug/snd_gm.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modplug/snd_gm.cpp b/modplug/snd_gm.cpp index 9142fc7..d8184bb 100644 --- a/modplug/snd_gm.cpp +++ b/modplug/snd_gm.cpp @@ -500,12 +500,12 @@ void GM_SetFreqAndVol(int c, int Hertz, int Vol, MidiBendMode bend_mode) if(bend < 0) bend = 0; if(bend > 0x3FFF) bend = 0x3FFF; - if(Vol < 0) Vol = 0; - if(Vol > 127) Vol = 127; - GM_Bend(c, bend); } + if(Vol < 0) Vol = 0; + if(Vol > 127) Vol = 127; + //if(!new_note) GM_Touch(c, Vol); } -- 1.5.6.3 From e00ae7b77d4f3d177c31b7f08beaac03867f2e8a Mon Sep 17 00:00:00 2001 From: Joel Yliluoma Date: Mon, 15 Sep 2008 16:12:52 +0300 Subject: [PATCH] Added configurable pitch bender (extends the range to an octave) --- modplug/snd_gm.cpp | 77 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 69 insertions(+), 8 deletions(-) diff --git a/modplug/snd_gm.cpp b/modplug/snd_gm.cpp index d8184bb..4d39811 100644 --- a/modplug/snd_gm.cpp +++ b/modplug/snd_gm.cpp @@ -17,6 +17,13 @@ static const unsigned MAXCHN = 256; static const bool LinearMidiVol = true; static const unsigned PitchBendCenter = 0x2000; +// The range of bending equivalent to 1 semitone. +// 0x2000 is the value used in TiMiDity++. +// In this module, we prefer a full range of octave, to support a reasonable +// range of pitch-bends used in tracker modules, and we reprogram the MIDI +// synthesizer to support that range. So we specify it as such: +static const int semitone_bend_depth = 0x2000/12; // one octave in either direction + /* GENERAL MIDI (GM) COMMANDS: 8x 1000xxxx nn vv Note off (key is released) nn=note number @@ -50,10 +57,28 @@ About the controllers... In AWE32 they are: 1=Modulation Wheel(Vibrato)10=Pan Position 64=Sustain Pedal 6=Data Entry MSB 38=Data Entry LSB 91=Effects Depth(Reverb) 120=All Sound Off 123=All Notes Off 93=Chorus Depth - 100=reg'd param # LSB 101=reg'd param # LSB - 98=!reg'd param # LSB 99=!reg'd param # LSB + 100=RPN # LSB 101=RPN # MSB + 98=NRPN # LSB 99=NRPN # MSB 1=Vibrato, 121=reset vibrato,bend + + To set RPNs (registered parameters): + control 101 <- param number MSB + control 100 <- param number LSB + control 6 <- value number MSB + optional + For NRPNs, the procedure is the same, but you use 98,99 instead of 100,101. + + param 0 = pitch bend sensitivity + param 1 = finetuning + param 2 = coarse tuning + param 3 = tuning program select + param 4 = tuning bank select + param 0x4080 = reset (value omitted) + + References: + - SoundBlaster AWE32 documentation + - http://www.philrees.co.uk/nrpnq.htm */ static unsigned RunningStatus = 0; @@ -116,7 +141,31 @@ static void MPU_NoteOff(int c, int k, int v) MPU_SendCommand(buf, 3, c); } } - +static void MPU_SendPN(int ch, + unsigned portindex, + unsigned param, unsigned valuehi, unsigned valuelo=0) +{ + MPU_Ctrl(ch, portindex+1, param>>7); + MPU_Ctrl(ch, portindex+0, param & 0x80); + if(param != 0x4080) + { + MPU_Ctrl(ch, 6, valuehi); + if(valuelo) MPU_Ctrl(ch, 38, valuelo); + } +} +static void MPU_SendNRPN(int ch, unsigned param, unsigned valuehi, unsigned valuelo=0) UNUSED; +static void MPU_SendNRPN(int ch, unsigned param, unsigned valuehi, unsigned valuelo) +{ + MPU_SendPN(ch, 98, param, valuehi, valuelo); +} +static void MPU_SendRPN(int ch, unsigned param, unsigned valuehi, unsigned valuelo=0) +{ + MPU_SendPN(ch, 100, param, valuehi, valuelo); +} +static void MPU_ResetPN(int ch) +{ + MPU_SendRPN(ch, 0x4080, 0); +} static const unsigned char GMVol[64] = /* This converts Adlib volume into MIDI volume */ { @@ -387,13 +436,25 @@ void GM_Reset(void) GM_KeyOff(a); S3Mchans[a].patch = S3Mchans[a].bank = S3Mchans[a].pan = 0; } + + // How many semitones fit in the full 0x4000 bending range? + // We scale the number by 128, because the RPN allows for finetuning. + int n_semitones_times_128 = 128 * 0x4000 / semitone_bend_depth; + for(a=0; a<16; a++) { - MPU_Ctrl(a, 0x7B, 0); // turn off all notes + MPU_Ctrl(a, 120, 0); // turn off all sounds + MPU_Ctrl(a, 123, 0); // turn off all notes + MPU_Ctrl(a, 121, 0); // reset vibrato, bend MIDIchans[a].SetPan(a, 0); // reset pan position MIDIchans[a].SetVolume(a, 127); // set channel volume MIDIchans[a].SetPitchBend(a, PitchBendCenter);// reset pitch bends MIDIchans[a].KnowNothing(); + + // Reprogram the pitch bending sensitivity to our desired depth. + MPU_SendRPN(a, 0, n_semitones_times_128 / 128, + n_semitones_times_128 % 128); + MPU_ResetPN(a); } } @@ -486,17 +547,17 @@ void GM_SetFreqAndVol(int c, int Hertz, int Vol, MidiBendMode bend_mode) if(!S3Mchans[c].IsPercussion()) // give us a break, don't bend percussive instruments { - const int semitone_bend_depth = 0x2000; // The range of bending equivalent to 1 semitone - double notediff = midinote-note; // The difference is our bend value int bend = (int)(notediff * semitone_bend_depth) + PitchBendCenter; - bend = (bend / 82) * 82; // Because the log2 calculation does not always give pure notes, // and in fact, gives a lot of variation, we reduce the bending // precision to 100 cents. This is accurate enough for almost // all purposes, but will significantly reduce the bend event load. - + const int bend_artificial_inaccuracy = semitone_bend_depth / 100; + bend = (bend / bend_artificial_inaccuracy) * bend_artificial_inaccuracy; + + // Clamp the bending value so that we won't break the protocol if(bend < 0) bend = 0; if(bend > 0x3FFF) bend = 0x3FFF; -- 1.5.6.3 From 72e3c7f89cd53a9d447ff2514f3896888037d6bc Mon Sep 17 00:00:00 2001 From: Joel Yliluoma Date: Mon, 15 Sep 2008 16:14:42 +0300 Subject: [PATCH] Added a "quitting" flag to MIDI reseting; this change back-propagates to song_stop_unlocked() --- include/song.h | 2 +- modplug/snd_gm.cpp | 10 +++++++++- modplug/snd_gm.h | 2 +- modplug/sndmix.cpp | 2 +- schism/audio_loadsave.cc | 4 ++-- schism/audio_playback.cc | 10 +++++----- schism/main.c | 2 +- schism/mplink.cc | 2 +- schism/page_config.c | 2 +- schism/page_orderpan.c | 2 +- 10 files changed, 23 insertions(+), 15 deletions(-) diff --git a/include/song.h b/include/song.h index 33f1a04..c7a025b 100644 --- a/include/song.h +++ b/include/song.h @@ -510,7 +510,7 @@ int song_keyup(int s,int ins, int n, int c, int *mm); void song_start(void); void song_start_once(void); void song_stop(void); -void song_stop_unlocked(void); +void song_stop_unlocked(int quitting); void song_loop_pattern(int pattern, int row); void song_start_at_order(int order, int row); void song_start_at_pattern(int pattern, int row); diff --git a/modplug/snd_gm.cpp b/modplug/snd_gm.cpp index 4d39811..f4af73c 100644 --- a/modplug/snd_gm.cpp +++ b/modplug/snd_gm.cpp @@ -427,7 +427,7 @@ void GM_Bend(int c, unsigned Count) } } -void GM_Reset(void) +void GM_Reset(int quitting) { unsigned int a; //fprintf(stderr, "GM_Reset\n"); @@ -440,6 +440,14 @@ void GM_Reset(void) // How many semitones fit in the full 0x4000 bending range? // We scale the number by 128, because the RPN allows for finetuning. int n_semitones_times_128 = 128 * 0x4000 / semitone_bend_depth; + if(quitting) + { + // When quitting, we reprogram the pitch bend sensitivity into + // the range of 1 semitone (TiMiDity++'s default, which is + // probably a default on other devices as well), instead of + // what we preferred for IT playback. + n_semitones_times_128 = 128; + } for(a=0; a<16; a++) { diff --git a/modplug/snd_gm.h b/modplug/snd_gm.h index 1a0e0d4..2772d30 100644 --- a/modplug/snd_gm.h +++ b/modplug/snd_gm.h @@ -13,7 +13,7 @@ void GM_Touch(int c, unsigned char Vol); void GM_KeyOn(int c, unsigned char key, unsigned char Vol); void GM_KeyOff(int c); void GM_Bend(int c, unsigned Count); -void GM_Reset(void); +void GM_Reset(int quitting); // 0=settings that work for us, 1=normal settings void GM_Pan(int ch, signed char val); // param: -128..+127 diff --git a/modplug/sndmix.cpp b/modplug/sndmix.cpp index 0181905..7105d54 100644 --- a/modplug/sndmix.cpp +++ b/modplug/sndmix.cpp @@ -106,7 +106,7 @@ BOOL CSoundFile::InitPlayer(BOOL bReset) Fmdrv_Init(gdwMixingFreq); OPL_Reset(); - GM_Reset(); + GM_Reset(0); return TRUE; } diff --git a/schism/audio_loadsave.cc b/schism/audio_loadsave.cc index 92a5edf..fb645bb 100644 --- a/schism/audio_loadsave.cc +++ b/schism/audio_loadsave.cc @@ -302,7 +302,7 @@ void song_new(int flags) song_lock_audio(); - song_stop_unlocked(); + song_stop_unlocked(0); status.flags &= ~PLAIN_TEXTEDIT; if ((flags & KEEP_PATTERNS) == 0) { @@ -401,7 +401,7 @@ int song_load_unchecked(const char *file) mp = newsong; mp->SetRepeatCount(-1); fix_song(); - song_stop_unlocked(); + song_stop_unlocked(0); song_unlock_audio(); diff --git a/schism/audio_playback.cc b/schism/audio_playback.cc index 91cce0a..090c9e7 100644 --- a/schism/audio_playback.cc +++ b/schism/audio_playback.cc @@ -89,7 +89,7 @@ static void audio_callback(UNUSED void *qq, Uint8 * stream, int len) || status.vis_style == VIS_FFT) { vis_work_8m(0,0); } - song_stop_unlocked(); + song_stop_unlocked(0); goto POST_EVENT; } @@ -102,7 +102,7 @@ static void audio_callback(UNUSED void *qq, Uint8 * stream, int len) || status.vis_style == VIS_FFT) { vis_work_8m(0,0); } - song_stop_unlocked(); + song_stop_unlocked(0); goto POST_EVENT; } samples_played += n; @@ -558,7 +558,7 @@ void song_start() void song_stop() { song_lock_audio(); - song_stop_unlocked(); + song_stop_unlocked(0); song_unlock_audio(); main_song_mode_changed_cb(); } @@ -574,7 +574,7 @@ static int was_bankhi[16]; static const MODCOMMAND *last_row[64]; static int last_row_number = -1; -void song_stop_unlocked() +void song_stop_unlocked(int quitting) { if (!mp) return; @@ -613,7 +613,7 @@ void song_stop_unlocked() } OPL_Reset(); /* Also stop all OPL sounds */ - GM_Reset(); + GM_Reset(quitting); memset(last_row,0,sizeof(last_row)); last_row_number = -1; diff --git a/schism/main.c b/schism/main.c index 0bc5c79..9991d8a 100644 --- a/schism/main.c +++ b/schism/main.c @@ -1077,7 +1077,7 @@ static void schism_shutdown(void) #endif if (shutdown_process & EXIT_SDLQUIT) { song_lock_audio(); - song_stop_unlocked(); + song_stop_unlocked(1); song_unlock_audio(); video_shutdown(); diff --git a/schism/mplink.cc b/schism/mplink.cc index 3cd57a2..d11c9ff 100644 --- a/schism/mplink.cc +++ b/schism/mplink.cc @@ -422,7 +422,7 @@ void song_pattern_resize(int pattern, int newsize) int oldsize = mp->PatternAllocSize[pattern]; status.flags |= SONG_NEEDS_SAVE; - if (oldsize > newsize) song_stop_unlocked(); + if (oldsize > newsize) song_stop_unlocked(0); if (!mp->Patterns[pattern] && newsize != 64) { mp->Patterns[pattern] = CSoundFile::AllocatePattern(newsize, 64); diff --git a/schism/page_config.c b/schism/page_config.c index 742dfb4..f512fe0 100644 --- a/schism/page_config.c +++ b/schism/page_config.c @@ -91,7 +91,7 @@ static void change_ui_settings(void) } kbd_sharp_flat_toggle(widgets_config[6].d.menutoggle.state); - GM_Reset(); + GM_Reset(0); if (widgets_config[8].d.toggle.state) { status.flags |= MIDI_LIKE_TRACKER; } else { diff --git a/schism/page_orderpan.c b/schism/page_orderpan.c index d5b10c9..772ca53 100644 --- a/schism/page_orderpan.c +++ b/schism/page_orderpan.c @@ -333,7 +333,7 @@ static void orderlist_reorder(void) status.flags |= NEED_UPDATE; - song_stop_unlocked(); + song_stop_unlocked(0); song_unlock_audio(); } -- 1.5.6.3 From a355f5be161e650ec55c6f8e203ecd4ade242d7f Mon Sep 17 00:00:00 2001 From: Joel Yliluoma Date: Mon, 15 Sep 2008 16:17:10 +0300 Subject: [PATCH] autogen.sh should be executable --- 0 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 autogen.sh diff --git a/autogen.sh b/autogen.sh old mode 100644 new mode 100755 -- 1.5.6.3 From 006d5cf390db08b6ab12722395d0b22ddd8490b0 Mon Sep 17 00:00:00 2001 From: Joel Yliluoma Date: Mon, 15 Sep 2008 16:41:13 +0300 Subject: [PATCH] const/signed char changes to remove a wadload of unnecessary casts all over the code --- include/draw-char.h | 10 ++-- include/util.h | 10 ++-- schism/dialog.c | 2 +- schism/diskwriter_dialog.c | 8 +- schism/draw-char.c | 12 ++-- schism/itf.c | 22 ++++---- schism/keyboard.c | 2 +- schism/menu.c | 4 +- schism/page.c | 72 +++++++++++----------- schism/page_about.c | 20 +++--- schism/page_config.c | 34 +++++----- schism/page_help.c | 6 +- schism/page_info.c | 100 ++++++++++++++++---------------- schism/page_instruments.c | 140 ++++++++++++++++++++++---------------------- schism/page_loadinst.c | 16 +++--- schism/page_loadmodule.c | 26 ++++---- schism/page_loadsample.c | 70 +++++++++++----------- schism/page_log.c | 4 +- schism/page_message.c | 84 +++++++++++++------------- schism/page_midi.c | 42 +++++++------- schism/page_midiout.c | 38 ++++++------ schism/page_orderpan.c | 26 ++++---- schism/page_palette.c | 6 +- schism/page_patedit.c | 64 ++++++++++---------- schism/page_preferences.c | 40 ++++++------ schism/page_samples.c | 80 +++++++++++++------------- schism/page_vars.c | 34 +++++----- schism/pattern-view.c | 107 +++++++++++++++------------------ schism/sample-view.c | 10 ++-- schism/status.c | 44 +++++++------- schism/util.c | 28 +++++----- schism/widget-keyhandler.c | 2 +- schism/widget.c | 46 +++++++------- 33 files changed, 600 insertions(+), 609 deletions(-) diff --git a/include/draw-char.h b/include/draw-char.h index 37c60a4..49f8aa8 100644 --- a/include/draw-char.h +++ b/include/draw-char.h @@ -27,16 +27,16 @@ /* --------------------------------------------------------------------- */ -void draw_char(unsigned int c, int x, int y, Uint32 fg, Uint32 bg); +void draw_char(unsigned char c, int x, int y, Uint32 fg, Uint32 bg); /* return value is the number of characters drawn */ -int draw_text(const byte * text, int x, int y, Uint32 fg, Uint32 bg); -int draw_text_bios(const byte * text, int x, int y, Uint32 fg, Uint32 bg); +int draw_text(const char * text, int x, int y, Uint32 fg, Uint32 bg); +int draw_text_bios(const char * text, int x, int y, Uint32 fg, Uint32 bg); /* return value is the length of text drawn * (so len - return is the number of spaces) */ -int draw_text_len(const byte * text, int len, int x, int y, Uint32 fg, Uint32 bg); -int draw_text_bios_len(const byte * text, int len, int x, int y, Uint32 fg, Uint32 bg); +int draw_text_len(const char * text, int len, int x, int y, Uint32 fg, Uint32 bg); +int draw_text_bios_len(const char * text, int len, int x, int y, Uint32 fg, Uint32 bg); void draw_fill_chars(int xs, int ys, int xe, int ye, Uint32 color); diff --git a/include/util.h b/include/util.h index 118b91a..181a848 100644 --- a/include/util.h +++ b/include/util.h @@ -120,11 +120,11 @@ extern void mem_free(void *); /* formatting */ /* for get_{time,date}_string, buf should be (at least) 27 chars; anything past that isn't used. */ -unsigned char *get_date_string(time_t when, unsigned char *buf); -unsigned char *get_time_string(time_t when, unsigned char *buf); -unsigned char *numtostr(int digits, unsigned int n, unsigned char *buf); -unsigned char *numtostr_signed(int digits, int n, unsigned char *buf); -unsigned char *num99tostr(int n, unsigned char *buf); +char *get_date_string(time_t when, char *buf); +char *get_time_string(time_t when, char *buf); +char *numtostr(int digits, unsigned int n, char *buf); +char *numtostr_signed(int digits, int n, char *buf); +char *num99tostr(int n, char *buf); /* string handling */ const char *get_basename(const char *filename); diff --git a/schism/dialog.c b/schism/dialog.c index 0463a08..10b4a9e 100644 --- a/schism/dialog.c +++ b/schism/dialog.c @@ -72,7 +72,7 @@ void dialog_draw(void) if (dialogs[d].draw_const) dialogs[d].draw_const(); if (dialogs[d].text) - draw_text((const unsigned char *)dialogs[d].text, dialogs[d].text_x, 27, 0, 2); + draw_text(dialogs[d].text, dialogs[d].text_x, 27, 0, 2); n = dialogs[d].total_widgets; while (n) { diff --git a/schism/diskwriter_dialog.c b/schism/diskwriter_dialog.c index 4fa4537..6f76efe 100644 --- a/schism/diskwriter_dialog.c +++ b/schism/diskwriter_dialog.c @@ -38,12 +38,12 @@ static int dg_progress = 0; static void _diskwriter_draw_const(void) { if (dg_progress >= 63) { - draw_text((const unsigned char *)"Finishing up...", 32, 27, 0, 2); + draw_text("Finishing up...", 32, 27, 0, 2); } else if (status.flags & DISKWRITER_ACTIVE_PATTERN) { - draw_text((const unsigned char *)"Updating sample...", 30, 27, 0, 2); - draw_text((const unsigned char *)"Please wait...", 34, 33, 0, 2); /* no cancel button */ + draw_text("Updating sample...", 30, 27, 0, 2); + draw_text("Please wait...", 34, 33, 0, 2); /* no cancel button */ } else { - draw_text((const unsigned char *)"Writing song to disk...", 28, 27, 0, 2); + draw_text("Writing song to disk...", 28, 27, 0, 2); } draw_fill_chars(24,30,55,30,0); diff --git a/schism/draw-char.c b/schism/draw-char.c index 02b9323..ba3f1da 100644 --- a/schism/draw-char.c +++ b/schism/draw-char.c @@ -592,13 +592,13 @@ void vgamem_ovl_drawline(struct vgamem_overlay *n, int xs, #undef SIZE #undef BPP -void draw_char(unsigned int c, int x, int y, Uint32 fg, Uint32 bg) +void draw_char(unsigned char c, int x, int y, Uint32 fg, Uint32 bg) { assert(x >= 0 && y >= 0 && x < 80 && y < 50); vgamem[x + (y*80)] = c | (fg << 8) | (bg << 12); } -int draw_text(const byte * text, int x, int y, Uint32 fg, Uint32 bg) +int draw_text(const char * text, int x, int y, Uint32 fg, Uint32 bg) { int n = 0; @@ -610,7 +610,7 @@ int draw_text(const byte * text, int x, int y, Uint32 fg, Uint32 bg) return n; } -int draw_text_bios(const byte * text, int x, int y, Uint32 fg, Uint32 bg) +int draw_text_bios(const char * text, int x, int y, Uint32 fg, Uint32 bg) { int n = 0; @@ -638,7 +638,7 @@ void draw_fill_chars(int xs, int ys, int xe, int ye, Uint32 color) } while (ye >= 0); } -int draw_text_len(const byte * text, int len, int x, int y, Uint32 fg, Uint32 bg) +int draw_text_len(const char * text, int len, int x, int y, Uint32 fg, Uint32 bg) { int n = 0; @@ -650,12 +650,12 @@ int draw_text_len(const byte * text, int len, int x, int y, Uint32 fg, Uint32 bg draw_fill_chars(x + n, y, x + len - 1, y, bg); return n; } -int draw_text_bios_len(const byte * text, int len, int x, int y, Uint32 fg, Uint32 bg) +int draw_text_bios_len(const char * text, int len, int x, int y, Uint32 fg, Uint32 bg) { int n = 0; while (*text && n < len) { - draw_char(*text|0x10000000, x + n, y, fg, bg); + draw_char(0x10000000|*text, x + n, y, fg, bg); n++; text++; } diff --git a/schism/itf.c b/schism/itf.c index b859aa6..8ac0ffe 100644 --- a/schism/itf.c +++ b/schism/itf.c @@ -192,10 +192,10 @@ static byte clipboard[8] = { 0 }; /* if this is nonzero, the screen will be redrawn. none of the functions * except main should call draw_anything -- set this instead. */ -static void draw_frame(const byte * name, int x, int y, int inner_width, int inner_height, int active) +static void draw_frame(const char* name, int x, int y, int inner_width, int inner_height, int active) { int n, c; - int len = strlen((char*)name); + int len = strlen(name); if (len > inner_width + 2) len = inner_width + 2; @@ -260,7 +260,7 @@ static inline void draw_editbox(void) draw_char(current_char, INNER_X(EDITBOX_X), INNER_Y(EDITBOX_Y), 5, 0); sprintf(buf, "%3d $%02X", current_char, current_char); - draw_text((unsigned char *) buf, INNER_X(EDITBOX_X) + 2, INNER_Y(EDITBOX_Y), 5, 0); + draw_text(buf, INNER_X(EDITBOX_X) + 2, INNER_Y(EDITBOX_Y), 5, 0); } static inline void draw_charmap(void) @@ -407,7 +407,7 @@ static inline void draw_helptext(void) ptr++; } #define M "(c) 2003-2008 Storlek and Mrs. Brisby" - draw_text((unsigned char *) M, 78-sizeof(M), 46, 1, 0); + draw_text(M, 78-sizeof(M), 46, 1, 0); #undef M } @@ -415,30 +415,30 @@ static inline void draw_time(void) { char buf[16]; sprintf(buf, "%.2d:%.2d:%.2d", status.h, status.m, status.s); - draw_text((unsigned char *) buf, 3, 46, 1, 0); + draw_text(buf, 3, 46, 1, 0); } extern unsigned int color_set[16]; static void draw_screen(void) { - draw_frame((unsigned char *) "Edit Box", EDITBOX_X, EDITBOX_Y, 9, 11, !!(selected_item == EDITBOX)); + draw_frame("Edit Box", EDITBOX_X, EDITBOX_Y, 9, 11, !!(selected_item == EDITBOX)); draw_editbox(); - draw_frame((unsigned char *) "Current Font", CHARMAP_X, CHARMAP_Y, 16, 16, !!(selected_item == CHARMAP)); + draw_frame("Current Font", CHARMAP_X, CHARMAP_Y, 16, 16, !!(selected_item == CHARMAP)); draw_charmap(); - draw_frame((unsigned char *) "Preview", ITFMAP_X, ITFMAP_Y, 16, 15, !!(selected_item == ITFMAP)); + draw_frame("Preview", ITFMAP_X, ITFMAP_Y, 16, 15, !!(selected_item == ITFMAP)); draw_itfmap(); switch (fontlist_mode) { case MODE_LOAD: - draw_frame((unsigned char *) "Load/Browse", FONTLIST_X, FONTLIST_Y, 9, + draw_frame("Load/Browse", FONTLIST_X, FONTLIST_Y, 9, VISIBLE_FONTS, !!(selected_item == FONTLIST)); draw_fontlist(); break; case MODE_SAVE: - draw_frame((unsigned char *) "Save As...", FONTLIST_X, FONTLIST_Y, 9, + draw_frame("Save As...", FONTLIST_X, FONTLIST_Y, 9, VISIBLE_FONTS, !!(selected_item == FONTLIST)); draw_fontlist(); break; @@ -446,7 +446,7 @@ static void draw_screen(void) break; } - draw_frame((unsigned char *) "Quick Help", HELPTEXT_X, HELPTEXT_Y, 74, 12, -1); + draw_frame("Quick Help", HELPTEXT_X, HELPTEXT_Y, 74, 12, -1); draw_helptext(); draw_time(); diff --git a/schism/keyboard.c b/schism/keyboard.c index 5d80a77..5bb2dbe 100644 --- a/schism/keyboard.c +++ b/schism/keyboard.c @@ -348,7 +348,7 @@ char *get_volume_string(int volume, int volume_effect, char *buf) /* Yeah, a bit confusing :) * The display stuff makes the distinction here with * a different color for panning. */ - numtostr(2, volume, (unsigned char *) buf); + numtostr(2, volume, buf); break; default: buf[0] = cmd_table[volume_effect]; diff --git a/schism/menu.c b/schism/menu.c index ee00e22..eac9a19 100644 --- a/schism/menu.c +++ b/schism/menu.c @@ -165,7 +165,7 @@ static void _draw_menu(struct menu *menu) 5 + menu->x + menu->w, 6 + menu->y + 3 * n, BOX_THIN | BOX_CORNER | (n == menu->active_item ? BOX_INSET : BOX_OUTSET)); - draw_text_len((const unsigned char *)menu->items[n], menu->w, 4 + menu->x, 5 + menu->y + 3 * n, + draw_text_len(menu->items[n], menu->w, 4 + menu->x, 5 + menu->y + 3 * n, (n == menu->selected_item ? 3 : 0), 2); draw_char(0, 3 + menu->x, 5 + menu->y + 3 * n, 0, 2); @@ -179,7 +179,7 @@ static void _draw_menu(struct menu *menu) draw_box(menu->x + 1, menu->y + 1, menu->x + menu->w + 6, menu->y + h - 2, BOX_THIN | BOX_OUTER | BOX_FLAT_DARK); draw_fill_chars(menu->x + 2, menu->y + 2, menu->x + menu->w + 5, menu->y + 3, 2); - draw_text((const unsigned char *)menu->title, menu->x + 6, menu->y + 2, 3, 2); + draw_text(menu->title, menu->x + 6, menu->y + 2, 3, 2); } void menu_draw(void) diff --git a/schism/page.c b/schism/page.c index f276492..424305b 100644 --- a/schism/page.c +++ b/schism/page.c @@ -161,7 +161,7 @@ static inline void draw_time(void) * who on earth leaves a tracker running for 41 days? */ sprintf(buf, "%3d:%02d:%02d", current_time.h % 1000, current_time.m % 60, current_time.s % 60); - draw_text((const unsigned char *)buf, 69, 9, 0, 2); + draw_text(buf, 69, 9, 0, 2); } /* --------------------------------------------------------------------- */ @@ -176,7 +176,7 @@ static void draw_page_title(void) for (x = 1; x < tpos - 1; x++) draw_char(154, x, 11, 1, 2); draw_char(0, tpos - 1, 11, 1, 2); - draw_text((const unsigned char *)ACTIVE_PAGE.title, tpos, 11, 0, 2); + draw_text(ACTIVE_PAGE.title, tpos, 11, 0, 2); draw_char(0, tpos + tlen, 11, 1, 2); for (x = tpos + tlen + 1; x < 79; x++) draw_char(154, x, 11, 1, 2); @@ -251,11 +251,11 @@ static void new_song_ok(UNUSED void *data) static void new_song_draw_const(void) { - draw_text((const unsigned char *)"New Song", 36, 21, 3, 2); - draw_text((const unsigned char *)"Patterns", 26, 24, 0, 2); - draw_text((const unsigned char *)"Samples", 27, 27, 0, 2); - draw_text((const unsigned char *)"Instruments", 23, 30, 0, 2); - draw_text((const unsigned char *)"Order List", 24, 33, 0, 2); + draw_text("New Song", 36, 21, 3, 2); + draw_text("Patterns", 26, 24, 0, 2); + draw_text("Samples", 27, 27, 0, 2); + draw_text("Instruments", 23, 30, 0, 2); + draw_text("Order List", 24, 33, 0, 2); } void new_song_dialog(void) @@ -329,7 +329,7 @@ static void _mp_draw(void) } i = strlen(name); draw_fill_chars(_mp_text_x, _mp_text_y, _mp_text_x + 17, _mp_text_y, 2); - draw_text_len((const unsigned char *) name, 17, _mp_text_x, _mp_text_y, 0, 2); + draw_text_len( name, 17, _mp_text_x, _mp_text_y, 0, 2); if (i < 17 && name == (void *) _mp_text) { draw_char(':', _mp_text_x + i, _mp_text_y, 0, 2); } @@ -1239,19 +1239,19 @@ static void draw_top_info_const(void) br = 3; } - draw_text((const unsigned char *)schism_banner(), + draw_text(schism_banner(), (80 - strlen(schism_banner())) / 2, 1, 0, 2); - draw_text((const unsigned char *)"Song Name", 2, 3, 0, 2); - draw_text((const unsigned char *)"File Name", 2, 4, 0, 2); - draw_text((const unsigned char *)"Order", 6, 5, 0, 2); - draw_text((const unsigned char *)"Pattern", 4, 6, 0, 2); - draw_text((const unsigned char *)"Row", 8, 7, 0, 2); + draw_text("Song Name", 2, 3, 0, 2); + draw_text("File Name", 2, 4, 0, 2); + draw_text("Order", 6, 5, 0, 2); + draw_text("Pattern", 4, 6, 0, 2); + draw_text("Row", 8, 7, 0, 2); - draw_text((const unsigned char *)"Speed/Tempo", 38, 4, 0, 2); - draw_text((const unsigned char *)"Octave", 43, 5, 0, 2); + draw_text("Speed/Tempo", 38, 4, 0, 2); + draw_text("Octave", 43, 5, 0, 2); - draw_text((const unsigned char *)"F1...Help F9.....Load", 21, 6, 0, 2); - draw_text((const unsigned char *)"ESC..Main Menu F5/F8..Play / Stop", 21, 7, 0, 2); + draw_text("F1...Help F9.....Load", 21, 6, 0, 2); + draw_text("ESC..Main Menu F5/F8..Play / Stop", 21, 7, 0, 2); /* the neat-looking (but incredibly ugly to draw) borders */ draw_char(128, 30, 4, br, 2); @@ -1309,7 +1309,7 @@ static void draw_top_info_const(void) draw_char(129, 58 + n, 4, br, 2); } - draw_text((const unsigned char *)"Time", 63, 9, 0, 2); + draw_text("Time", 63, 9, 0, 2); draw_char('/', 15, 5, 1, 0); draw_char('/', 15, 6, 1, 0); draw_char('/', 15, 7, 1, 0); @@ -1335,21 +1335,21 @@ void update_current_instrument(void) ins_mode = song_is_instrument_mode(); if (ins_mode) { - draw_text((const unsigned char *)"Instrument", 39, 3, 0, 2); + draw_text("Instrument", 39, 3, 0, 2); n = instrument_get_current(); song_get_instrument(n, &name); } else { - draw_text((const unsigned char *)" Sample", 39, 3, 0, 2); + draw_text(" Sample", 39, 3, 0, 2); n = sample_get_current(); song_get_sample(n, &name); } if (n > 0) { - draw_text(num99tostr(n, (unsigned char *) buf), 50, 3, 5, 0); - draw_text_len((const unsigned char *)name, 25, 53, 3, 5, 0); + draw_text(num99tostr(n, buf), 50, 3, 5, 0); + draw_text_len(name, 25, 53, 3, 5, 0); } else { - draw_text((const unsigned char *)"..", 50, 3, 5, 0); - draw_text((const unsigned char *)".........................", 53, 3, 5, 0); + draw_text("..", 50, 3, 5, 0); + draw_text(".........................", 53, 3, 5, 0); } } @@ -1359,15 +1359,15 @@ static void redraw_top_info(void) update_current_instrument(); - draw_text_len((const unsigned char *)song_get_basename(), 18, 12, 4, 5, 0); - draw_text_len((const unsigned char *)song_get_title(), 25, 12, 3, 5, 0); + draw_text_len(song_get_basename(), 18, 12, 4, 5, 0); + draw_text_len(song_get_title(), 25, 12, 3, 5, 0); update_current_order(); update_current_pattern(); update_current_row(); - draw_text(numtostr(3, song_get_current_speed(), (unsigned char *) buf), 50, 4, 5, 0); - draw_text(numtostr(3, song_get_current_tempo(), (unsigned char *) buf), 54, 4, 5, 0); + draw_text(numtostr(3, song_get_current_speed(), buf), 50, 4, 5, 0); + draw_text(numtostr(3, song_get_current_tempo(), buf), 54, 4, 5, 0); draw_char('0' + kbd_get_current_octave(), 50, 5, 5, 0); } @@ -1480,18 +1480,18 @@ static void vis_fakemem(void) ems >>= 10; sprintf(buf, "FreeMem %uk", conv); - draw_text((const unsigned char *)buf, 63, 6, 0, 2); + draw_text(buf, 63, 6, 0, 2); sprintf(buf, "FreeEMS %uk", ems); - draw_text((const unsigned char *)buf, 63, 7, 0, 2); + draw_text(buf, 63, 7, 0, 2); } else { sprintf(buf, " Song %uk", (unsigned)( (memused_patterns() +memused_instruments() +memused_songmessage()) >> 10)); - draw_text((const unsigned char *)buf, 63, 6, 0, 2); + draw_text(buf, 63, 6, 0, 2); sprintf(buf, "Samples %uk", (unsigned)(memused_samples() >> 10)); - draw_text((const unsigned char *)buf, 63, 7, 0, 2); + draw_text(buf, 63, 7, 0, 2); } } @@ -1547,9 +1547,9 @@ void redraw_screen(void) if (!ACTIVE_PAGE.draw_full) { draw_vis(); draw_time(); - draw_text(numtostr(3, song_get_current_speed(), (unsigned char *) buf), + draw_text(numtostr(3, song_get_current_speed(), buf), 50, 4, 5, 0); - draw_text(numtostr(3, song_get_current_tempo(), (unsigned char *) buf), + draw_text(numtostr(3, song_get_current_tempo(), buf), 54, 4, 5, 0); status_text_redraw(); @@ -1820,7 +1820,7 @@ static int _timejump_keyh(struct key_event *k) } static void _timejump_draw(void) { - draw_text((const unsigned char *)"Jump to time:", 30, 26, 0, 2); + draw_text("Jump to time:", 30, 26, 0, 2); draw_char(':', 46, 26, 3, 0); draw_box(43, 25, 49, 27, BOX_THIN | BOX_INNER | BOX_INSET); diff --git a/schism/page_about.c b/schism/page_about.c index 1797d27..5ee4d94 100644 --- a/schism/page_about.c +++ b/schism/page_about.c @@ -114,31 +114,31 @@ static void about_draw_const(void) if (status.flags & CLASSIC_MODE) { draw_box(25,25, 56, 30, BOX_THIN | BOX_OUTER | BOX_FLAT_DARK); - draw_text((unsigned char *) "Sound Card Setup", 32, 26, 0, 2); + draw_text("Sound Card Setup", 32, 26, 0, 2); if (strcasecmp((char *) song_audio_driver(), "nosound") == 0) { - draw_text((unsigned char *) "No sound card detected", 29, 28, 0, 2); + draw_text("No sound card detected", 29, 28, 0, 2); } else { switch (fake_driver) { case 0: - draw_text((unsigned char *) "Sound Blaster 16 detected", 26, 28, 0, 2); - draw_text((unsigned char *) "Port 220h, IRQ 7, DMA 5", 26, 29, 0, 2); + draw_text("Sound Blaster 16 detected", 26, 28, 0, 2); + draw_text("Port 220h, IRQ 7, DMA 5", 26, 29, 0, 2); break; case 1: - draw_text((unsigned char *) "Gravis UltraSound detected", 26, 28, 0, 2); - draw_text((unsigned char *) "Port 240h, IRQ 5, 1024k RAM", 26, 29, 0, 2); + draw_text("Gravis UltraSound detected", 26, 28, 0, 2); + draw_text("Port 240h, IRQ 5, 1024k RAM", 26, 29, 0, 2); break; }; } } else { snprintf(buf, 80, "Using %s on %s", song_audio_driver(), video_driver_name()); buf[80] = 0; - draw_text((unsigned char *) buf, (80 - strlen(buf)) / 2, 25, 0, 2); + draw_text(buf, (80 - strlen(buf)) / 2, 25, 0, 2); /* build date? */ - draw_text((unsigned char *) "Copyright (C) 2003-2008 Storlek and Mrs. Brisby", 15, 27, 1, 2); - draw_text((unsigned char *) "Based on Impulse Tracker by Jeffrey Lim aka Pulse", 15, 28, 1, 2); + draw_text("Copyright (C) 2003-2008 Storlek and Mrs. Brisby", 15, 27, 1, 2); + draw_text("Based on Impulse Tracker by Jeffrey Lim aka Pulse", 15, 28, 1, 2); /* XXX if we allow key remapping, need to reflect the *real* log viewer key here */ - draw_text((unsigned char *) "Press Ctrl-F11 for copyright and full credits", 15, 29, 1, 2); + draw_text("Press Ctrl-F11 for copyright and full credits", 15, 29, 1, 2); } vgamem_ovl_apply(&logo_image); } diff --git a/schism/page_config.c b/schism/page_config.c index f512fe0..3fcfb2d 100644 --- a/schism/page_config.c +++ b/schism/page_config.c @@ -144,13 +144,13 @@ static void video_dialog_draw_const(void) } } - draw_text((unsigned char *) "Your video settings have been changed.", 21,19,0,2); + draw_text("Your video settings have been changed.", 21,19,0,2); sprintf(buf, "In %2d seconds, your changes will be", countdown); - draw_text((unsigned char *) buf, 23, 21, 0, 2); - draw_text((unsigned char *) "reverted to the last known-good", 21, 22, 0, 2); - draw_text((unsigned char *) "settings.", 21, 23, 0, 2); - draw_text((unsigned char *) "To use the new video mode, and make", 21, 24, 0, 2); - draw_text((unsigned char *) "it default, press select OK below.", 21, 25, 0, 2); + draw_text(buf, 23, 21, 0, 2); + draw_text("reverted to the last known-good", 21, 22, 0, 2); + draw_text("settings.", 21, 23, 0, 2); + draw_text("To use the new video mode, and make", 21, 24, 0, 2); + draw_text("it default, press select OK below.", 21, 25, 0, 2); } static struct widget video_dialog_widgets[2]; @@ -222,20 +222,20 @@ static void config_draw_const(void) { int n; - draw_text((unsigned char *) "Channel Limit",4,15, 0, 2); - draw_text((unsigned char *) "Mixing Rate",6,16, 0, 2); - draw_text((unsigned char *) "Sample Size",6,17, 0, 2); - draw_text((unsigned char *) "Output Channels",2,18, 0, 2); + draw_text("Channel Limit",4,15, 0, 2); + draw_text("Mixing Rate",6,16, 0, 2); + draw_text("Sample Size",6,17, 0, 2); + draw_text("Output Channels",2,18, 0, 2); - draw_text((unsigned char *) "Visualization",4,20, 0, 2); - draw_text((unsigned char *) "Classic Mode",5,21, 0, 2); - draw_text((unsigned char *) "Accidentals",6,22, 0, 2); - draw_text((unsigned char *) "Time Display",5,23, 0, 2); + draw_text("Visualization",4,20, 0, 2); + draw_text("Classic Mode",5,21, 0, 2); + draw_text("Accidentals",6,22, 0, 2); + draw_text("Time Display",5,23, 0, 2); - draw_text((unsigned char *) "MIDI mode", 8,25, 0, 2); + draw_text("MIDI mode", 8,25, 0, 2); - draw_text((unsigned char *) "Video Driver:", 2, 28, 0, 2); - draw_text((unsigned char *) "Full Screen:", 38, 28, 0, 2); + draw_text("Video Driver:", 2, 28, 0, 2); + draw_text("Full Screen:", 38, 28, 0, 2); draw_fill_chars(18, 15, 34, 25, 0); draw_box(17,14,35,26, BOX_THIN | BOX_INNER | BOX_INSET); diff --git a/schism/page_help.c b/schism/page_help.c index 8b4ea2c..654ddf0 100644 --- a/schism/page_help.c +++ b/schism/page_help.c @@ -78,15 +78,15 @@ static void help_redraw(void) lp = strcspn(*ptr+1, "\015\012"); if (lp > 76) lp = 76; if (**ptr == ';') { - draw_text_bios_len((const unsigned char *) *ptr + 1, lp, 2, pos, 6, 0); + draw_text_bios_len(*ptr + 1, lp, 2, pos, 6, 0); } else { - draw_text_len((const unsigned char *) *ptr + 1, lp, 2, pos, 6, 0); + draw_text_len(*ptr + 1, lp, 2, pos, 6, 0); } break; case '#': /* hidden line */ lp = strcspn(*ptr+1, "\015\012"); if (lp > 76) lp = 76; - draw_text_len((const unsigned char *) *ptr + 1, + draw_text_len(*ptr + 1, lp, 2, pos, 7, 0); break; diff --git a/schism/page_info.c b/schism/page_info.c index 012b6dc..c9ced2f 100644 --- a/schism/page_info.c +++ b/schism/page_info.c @@ -97,24 +97,24 @@ static void info_draw_technical(int base, int height, UNUSED int active, int fir if (song_is_instrument_mode()) { draw_fill_chars(59, base + 1, 65, base + height - 2, 0); draw_box(58, base, 66, base + height - 1, BOX_THICK | BOX_INNER | BOX_INSET); - draw_text((const unsigned char *)"NNA", 59, base, 2, 1); /* --- Cut Fde Con Off */ - draw_text((const unsigned char *)"Tot", 63, base, 2, 1); /* number of samples playing here */ + draw_text("NNA", 59, base, 2, 1); /* --- Cut Fde Con Off */ + draw_text("Tot", 63, base, 2, 1); /* number of samples playing here */ song_get_playing_samples(smplist); } - draw_text((const unsigned char *)"Frequency",6, base, 2,1); - draw_text((const unsigned char *)"Position",17, base, 2,1); - draw_text((const unsigned char *)"Smp",27, base, 2,1); /* number */ + draw_text("Frequency",6, base, 2,1); + draw_text("Position",17, base, 2,1); + draw_text("Smp",27, base, 2,1); /* number */ - draw_text((const unsigned char *)"FVI",32, base, 2,1); /* final volume (0-128 i think) */ - draw_text((const unsigned char *)"VI",36, base, 2,1); /* volume immediate? instrument? */ - draw_text((const unsigned char *)"CV",39, base, 2,1); /* channel volume */ - draw_text((const unsigned char *)"SV",42, base, 2,1); /* sample/set volume? (global volume from sample?) */ - draw_text((const unsigned char *)"VE",45, base, 2,1); /* volume end? (target volume?) */ - draw_text((const unsigned char *)"Fde",48, base, 2,1); /* fade 0-512 ; so int val /2 */ - draw_text((const unsigned char *)"Pn",52, base, 2,1); /* panning now */ - draw_text((const unsigned char *)"PE",55, base, 2,1); /* target pan (pan end?) */ + draw_text("FVI",32, base, 2,1); /* final volume (0-128 i think) */ + draw_text("VI",36, base, 2,1); /* volume immediate? instrument? */ + draw_text("CV",39, base, 2,1); /* channel volume */ + draw_text("SV",42, base, 2,1); /* sample/set volume? (global volume from sample?) */ + draw_text("VE",45, base, 2,1); /* volume end? (target volume?) */ + draw_text("Fde",48, base, 2,1); /* fade 0-512 ; so int val /2 */ + draw_text("Pn",52, base, 2,1); /* panning now */ + draw_text("PE",55, base, 2,1); /* target pan (pan end?) */ for (pos = base + 1; pos < base + height - 1; pos++, c++) { @@ -129,15 +129,15 @@ static void info_draw_technical(int base, int height, UNUSED int active, int fir else fg = active ? 1 : 0; } - draw_text(num99tostr(c, (unsigned char *) buf), 2, pos, fg, 2); /* channel number */ + draw_text(num99tostr(c, buf), 2, pos, fg, 2); /* channel number */ if (mixchan->sample_freq) { sprintf(buf, "%10d", mixchan->sample_freq); - draw_text((const unsigned char *)buf, 5, pos, 2, 0); + draw_text(buf, 5, pos, 2, 0); } if (mixchan->sample_freq | mixchan->topnote_offset) { sprintf(buf, "%10d", mixchan->topnote_offset); - draw_text((const unsigned char *)buf, 16, pos, 2, 0); + draw_text(buf, 16, pos, 2, 0); } // again with the hacks... @@ -152,21 +152,21 @@ static void info_draw_technical(int base, int height, UNUSED int active, int fir } if (smp) { - draw_text(numtostr(3, smp, (unsigned char *) buf), 27, pos, 2, 0); + draw_text(numtostr(3, smp, buf), 27, pos, 2, 0); - draw_text(numtostr(3, mixchan->final_volume / 128, (unsigned char *) buf), 32, pos, 2, 0); - draw_text(numtostr(2, mixchan->volume >> 2, (unsigned char *) buf), 36, pos, 2, 0); + draw_text(numtostr(3, mixchan->final_volume / 128, buf), 32, pos, 2, 0); + draw_text(numtostr(2, mixchan->volume >> 2, buf), 36, pos, 2, 0); - draw_text(numtostr(2, mixchan->nGlobalVol, (unsigned char *) buf), 39, pos, 2, 0); + draw_text(numtostr(2, mixchan->nGlobalVol, buf), 39, pos, 2, 0); draw_text(numtostr(2, mixchan->sample - ? mixchan->sample->global_volume : 64, (unsigned char *) buf), + ? mixchan->sample->global_volume : 64, buf), 42, pos, 2, 0); - draw_text(numtostr(2, mixchan->nInsVol, (unsigned char *) buf), 45, pos, 2, 0); + draw_text(numtostr(2, mixchan->nInsVol, buf), 45, pos, 2, 0); - draw_text(numtostr(3, mixchan->nFadeOutVol / 128, (unsigned char *) buf), 48, pos, 2, 0); + draw_text(numtostr(3, mixchan->nFadeOutVol / 128, buf), 48, pos, 2, 0); - draw_text(numtostr(2, mixchan->panning >> 2, (unsigned char *) buf), 52, pos, 2, 0); - draw_text(numtostr(2, mixchan->final_panning >> 2, (unsigned char *) buf), 55, pos, 2, 0); + draw_text(numtostr(2, mixchan->panning >> 2, buf), 52, pos, 2, 0); + draw_text(numtostr(2, mixchan->final_panning >> 2, buf), 55, pos, 2, 0); } if (song_is_instrument_mode()) { switch (mixchan->nNNA) { @@ -176,8 +176,8 @@ static void info_draw_technical(int base, int height, UNUSED int active, int fir case 4: ptr = "Fde"; break; default: ptr = "---"; break; }; - draw_text((unsigned char *) ptr, 59, pos, 2, 0); - draw_text(numtostr(3, smplist[smp], (unsigned char *) buf), 63, pos, 2, 0); + draw_text(ptr, 59, pos, 2, 0); + draw_text(numtostr(3, smplist[smp], buf), 63, pos, 2, 0); } draw_char(168, 15, pos, 2, 0); @@ -226,7 +226,7 @@ static void info_draw_samples(int base, int height, int active, int first_channe continue; fg = active ? 1 : 0; } - draw_text(numtostr(2, c, (unsigned char *) buf), 2, pos, fg, 2); + draw_text(numtostr(2, c, buf), 2, pos, fg, 2); } return; } @@ -263,10 +263,10 @@ static void info_draw_samples(int base, int height, int active, int first_channe } if (smp) { - draw_text(num99tostr(smp, (unsigned char *) buf), 31, pos, 6, 0); + draw_text(num99tostr(smp, buf), 31, pos, 6, 0); if (ins) { draw_char('/', 33, pos, 6, 0); - draw_text(num99tostr(ins, (unsigned char *) buf), 34, pos, 6, 0); + draw_text(num99tostr(ins, buf), 34, pos, 6, 0); n = 36; } else { n = 33; @@ -282,16 +282,16 @@ static void info_draw_samples(int base, int height, int active, int first_channe ptr = channel->instrument->name; else song_get_sample(smp, &ptr); - draw_text_len((const unsigned char *) ptr, 25, n, pos, 6, 0); + draw_text_len( ptr, 25, n, pos, 6, 0); } else if (ins && channel->instrument && channel->instrument->midi_channel) { if (channel->instrument->midi_channel > 16) { - draw_text(numtostr(2, ((c-1) % 16)+1, (unsigned char *)buf), 31, pos, 6, 0); + draw_text(numtostr(2, ((c-1) % 16)+1, buf), 31, pos, 6, 0); } else { draw_text(numtostr(2, channel->instrument->midi_channel, - (unsigned char *)buf), 31, pos, 6, 0); + buf), 31, pos, 6, 0); } draw_char('/', 33, pos, 6, 0); - draw_text(num99tostr(ins, (unsigned char *) buf), 34, pos, 6, 0); + draw_text(num99tostr(ins, buf), 34, pos, 6, 0); n = 36; if (channel->volume == 0) fg = 4; @@ -301,7 +301,7 @@ static void info_draw_samples(int base, int height, int active, int first_channe fg = 6; draw_char(':', n++, pos, fg, 0); ptr = channel->instrument->name; - draw_text_len((const unsigned char *) ptr, 25, n, pos, 6, 0); + draw_text_len( ptr, 25, n, pos, 6, 0); } else { inuse = 0; } @@ -312,11 +312,11 @@ static void info_draw_samples(int base, int height, int active, int first_channe if (!channel->sample) { /* nothing... */ } else if (channel->flags & CHN_SURROUND) { - draw_text((const unsigned char *)"Surround", 64, pos, 2, 0); + draw_text("Surround", 64, pos, 2, 0); } else if (channel->final_panning >> 2 == 0) { - draw_text((const unsigned char *)"Left", 64, pos, 2, 0); + draw_text("Left", 64, pos, 2, 0); } else if ((channel->final_panning + 3) >> 2 == 64) { - draw_text((const unsigned char *)"Right", 68, pos, 2, 0); + draw_text("Right", 68, pos, 2, 0); } else { draw_thumb_bar(64, pos, 9, 0, 256, channel->final_panning, 0); } @@ -330,7 +330,7 @@ static void info_draw_samples(int base, int height, int active, int first_channe continue; fg = active ? 1 : 0; } - draw_text(numtostr(2, c, (unsigned char *) buf), 2, pos, fg, 2); + draw_text(numtostr(2, c, buf), 2, pos, fg, 2); } } @@ -399,7 +399,7 @@ static void _draw_track_view(int base, int height, int first_channel, int num_ch total_rows = prev_pattern_rows; row = total_rows - 1; } - draw_text(numtostr(3, row, (unsigned char *) buf), 1, row_pos, 0, 2); + draw_text(numtostr(3, row, buf), 1, row_pos, 0, 2); note = pattern + 64 * row + first_channel - 1; for (chan_pos = 0; chan_pos < num_channels - 1; chan_pos++) { draw_note(5 + channel_width * chan_pos, row_pos, note, -1, 6, 0); @@ -416,7 +416,7 @@ static void _draw_track_view(int base, int height, int first_channel, int num_ch pattern = cur_pattern; total_rows = cur_pattern_rows; row_pos = base + rows_before + 1; - draw_text(numtostr(3, current_row, (unsigned char *) buf), 1, row_pos, 0, 2); + draw_text(numtostr(3, current_row, buf), 1, row_pos, 0, 2); note = pattern + 64 * current_row + first_channel - 1; for (chan_pos = 0; chan_pos < num_channels - 1; chan_pos++) { draw_note(5 + channel_width * chan_pos, row_pos, note, -1, 6, 14); @@ -439,7 +439,7 @@ static void _draw_track_view(int base, int height, int first_channel, int num_ch total_rows = next_pattern_rows; row = 0; } - draw_text(numtostr(3, row, (unsigned char *) buf), 1, row_pos, 0, 2); + draw_text(numtostr(3, row, buf), 1, row_pos, 0, 2); note = pattern + 64 * row + first_channel - 1; for (chan_pos = 0; chan_pos < num_channels - 1; chan_pos++) { draw_note(5 + channel_width * chan_pos, row_pos, note, -1, 6, 0); @@ -488,7 +488,7 @@ static void info_draw_track_10(int base, int height, int active, int first_chann fg = (chan == selected_channel ? 3 : (active ? 2 : 0)); draw_char(0, 5 + 7 * chan_pos, base, 1, 1); draw_char(0, 5 + 7 * chan_pos + 1, base, 1, 1); - draw_text(numtostr(2, chan, (unsigned char *) buf), 5 + 7 * chan_pos + 2, base, fg, 1); + draw_text(numtostr(2, chan, buf), 5 + 7 * chan_pos + 2, base, fg, 1); draw_char(0, 5 + 7 * chan_pos + 4, base, 1, 1); draw_char(0, 5 + 7 * chan_pos + 5, base, 1, 1); } @@ -510,7 +510,7 @@ static void info_draw_track_12(int base, int height, int active, int first_chann fg = (chan == selected_channel ? 3 : (active ? 2 : 0)); /* draw_char(0, 5 + 6 * chan_pos, base, 1, 1); */ draw_char(0, 5 + 6 * chan_pos + 1, base, 1, 1); - draw_text(numtostr(2, chan, (unsigned char *) buf), 5 + 6 * chan_pos + 2, base, fg, 1); + draw_text(numtostr(2, chan, buf), 5 + 6 * chan_pos + 2, base, fg, 1); draw_char(0, 5 + 6 * chan_pos + 4, base, 1, 1); /* draw_char(0, 5 + 6 * chan_pos + 5, base, 1, 1); */ } @@ -530,7 +530,7 @@ static void info_draw_track_18(int base, int height, int active, int first_chann fg = (chan == selected_channel ? 6 : 1); else fg = (chan == selected_channel ? 3 : (active ? 2 : 0)); - draw_text(numtostr(2, chan, (unsigned char *) buf), 5 + 4 * chan_pos + 1, base, fg, 1); + draw_text(numtostr(2, chan, buf), 5 + 4 * chan_pos + 1, base, fg, 1); } _draw_track_view(base, height, first_channel, 18, 3, 1, draw_note_3); } @@ -548,7 +548,7 @@ static void info_draw_track_24(int base, int height, int active, int first_chann fg = (chan == selected_channel ? 6 : 1); else fg = (chan == selected_channel ? 3 : (active ? 2 : 0)); - draw_text(numtostr(2, chan, (unsigned char *) buf), 5 + 3 * chan_pos + 1, base, fg, 1); + draw_text(numtostr(2, chan, buf), 5 + 3 * chan_pos + 1, base, fg, 1); } _draw_track_view(base, height, first_channel, 24, 3, 0, draw_note_3); } @@ -566,7 +566,7 @@ static void info_draw_track_36(int base, int height, int active, int first_chann fg = (chan == selected_channel ? 6 : 1); else fg = (chan == selected_channel ? 3 : (active ? 2 : 0)); - draw_text(numtostr(2, chan, (unsigned char *) buf), 5 + 2 * chan_pos, base, fg, 1); + draw_text(numtostr(2, chan, buf), 5 + 2 * chan_pos, base, fg, 1); } _draw_track_view(base, height, first_channel, 36, 2, 0, draw_note_2); } @@ -605,10 +605,10 @@ static void info_draw_channels(int base, UNUSED int height, int active, UNUSED i int fg = (active ? 3 : 0); snprintf(buf, 32, "Active Channels: %d (%d)", song_get_playing_channels(), song_get_max_channels()); - draw_text((const unsigned char *)buf, 2, base, fg, 2); + draw_text(buf, 2, base, fg, 2); snprintf(buf, 32, "Global Volume: %d", song_get_current_global_volume()); - draw_text((const unsigned char *)buf, 4, base + 1, fg, 2); + draw_text(buf, 4, base + 1, fg, 2); } /* "Screw you guys, I'm going home." @@ -685,7 +685,7 @@ static void info_draw_note_dots(int base, int height, int active, int first_chan continue; fg = active ? 1 : 0; } - draw_text(numtostr(2, c, (unsigned char *) buf), 2, pos + base + 1, fg, 2); + draw_text(numtostr(2, c, buf), 2, pos + base + 1, fg, 2); } } /* --------------------------------------------------------------------- */ diff --git a/schism/page_instruments.c b/schism/page_instruments.c index 6793771..1c48652 100644 --- a/schism/page_instruments.c +++ b/schism/page_instruments.c @@ -360,8 +360,8 @@ static void do_swap_instrument(UNUSED void *data) static void swap_instrument_draw_const(void) { - draw_text((const unsigned char *)"Swap instrument with:", 29, 25, 0, 2); - draw_text((const unsigned char *)"Instrument", 31, 27, 0, 2); + draw_text("Swap instrument with:", 29, 25, 0, 2); + draw_text("Instrument", 31, 27, 0, 2); draw_box(41, 26, 45, 28, BOX_THICK | BOX_INNER | BOX_INSET); } @@ -389,8 +389,8 @@ static void do_exchange_instrument(UNUSED void *data) static void exchange_instrument_draw_const(void) { - draw_text((const unsigned char *)"Exchange instrument with:", 28, 25, 0, 2); - draw_text((const unsigned char *)"Instrument", 31, 27, 0, 2); + draw_text("Exchange instrument with:", 28, 25, 0, 2); + draw_text("Instrument", 31, 27, 0, 2); draw_box(41, 26, 45, 28, BOX_THICK | BOX_INNER | BOX_INSET); } @@ -419,8 +419,8 @@ static void do_copy_instrument(UNUSED void *data) static void copy_instrument_draw_const(void) { - draw_text((const unsigned char *)"Copy instrument:", 31, 25, 0, 2); - draw_text((const unsigned char *)"Instrument", 31, 27, 0, 2); + draw_text("Copy instrument:", 31, 25, 0, 2); + draw_text("Instrument", 31, 27, 0, 2); draw_box(41, 26, 45, 28, BOX_THICK | BOX_INNER | BOX_INSET); } @@ -447,7 +447,7 @@ static void instrument_list_draw_list(void) int is_current; int ss, cl = 0, cr = 0; int is_playing[100]; - byte buf[4]; + char buf[4]; if (clippy_owner(CLIPPY_SELECT) == widgets_general) { cl = widgets_general[0].clip_start % 25; @@ -475,22 +475,22 @@ static void instrument_list_draw_list(void) if (instrument_cursor_pos < 25) { /* it's in edit mode */ if (is_current) { - draw_text_len((const unsigned char *)ins->name, 25, 5, 13 + pos, 6, 14); + draw_text_len(ins->name, 25, 5, 13 + pos, 6, 14); if (selected) { draw_char(ins->name[instrument_cursor_pos], 5 + instrument_cursor_pos, 13 + pos, 0, 3); } } else { - draw_text_len((const unsigned char *)ins->name, 25, 5, 13 + pos, 6, 0); + draw_text_len(ins->name, 25, 5, 13 + pos, 6, 0); } } else { - draw_text_len((const unsigned char *)ins->name, 25, 5, 13 + pos, + draw_text_len(ins->name, 25, 5, 13 + pos, ((is_current && selected) ? 0 : 6), (is_current ? (selected ? 3 : 14) : 0)); } if (ss == n) { - draw_text_len((const unsigned char *)ins->name + cl, (cr-cl)+1, + draw_text_len(ins->name + cl, (cr-cl)+1, 5 + cl, 13 + pos, (is_current ? 3 : 11), 8); } @@ -727,7 +727,7 @@ static void note_trans_draw(void) int is_selected = (ACTIVE_PAGE.selected_widget == 5); int bg, sel_bg = (is_selected ? 14 : 0); song_instrument *ins = song_get_instrument(current_instrument, NULL); - byte buf[4]; + char buf[4]; for (pos = 0, n = note_trans_top_line; pos < 32; pos++, n++) { bg = ((n == note_trans_sel_line) ? sel_bg : 0); @@ -736,9 +736,9 @@ static void note_trans_draw(void) if (ins->note_map[n] < 1 || ins->note_map[n] > 120) ins->note_map[n] = n + 1; - draw_text((unsigned char *) get_note_string(n + 1, (char *) buf), 32, 16 + pos, 2, bg); + draw_text(get_note_string(n + 1, buf), 32, 16 + pos, 2, bg); draw_char(168, 35, 16 + pos, 2, bg); - draw_text((unsigned char *) get_note_string(ins->note_map[n], (char *) buf), 36, 16 + pos, 2, bg); + draw_text(get_note_string(ins->note_map[n], buf), 36, 16 + pos, 2, bg); if (is_selected && n == note_trans_sel_line) { if (note_trans_cursor_pos == 0) draw_char(buf[0], 36, 16 + pos, 0, 3); @@ -752,7 +752,7 @@ static void note_trans_draw(void) buf[0] = buf[1] = 173; buf[2] = 0; } - draw_text((const unsigned char *)buf, 40, 16 + pos, 2, bg); + draw_text(buf, 40, 16 + pos, 2, bg); if (is_selected && n == note_trans_sel_line) { if (note_trans_cursor_pos == 2) draw_char(buf[0], 40, 16 + pos, 0, 3); @@ -1146,7 +1146,7 @@ static void _env_draw(const song_envelope *env, int middle, int current_node, { song_mix_channel *channel; unsigned int *channel_list; - byte buf[16]; + char buf[16]; unsigned int envpos[3]; int x, y, n, m, c; int last_x = 0, last_y = 0; @@ -1213,12 +1213,12 @@ static void _env_draw(const song_envelope *env, int middle, int current_node, draw_fill_chars(65, 18, 76, 25, 0); vgamem_ovl_apply(&env_overlay); - sprintf((char *) buf, "Node %d/%d", current_node, env->nodes); - draw_text((const unsigned char *)buf, 66, 19, 2, 0); - sprintf((char *) buf, "Tick %d", env->ticks[current_node]); - draw_text((const unsigned char *)buf, 66, 21, 2, 0); - sprintf((char *) buf, "Value %d", (int)(env->values[current_node] - (middle ? 32 : 0))); - draw_text((const unsigned char *)buf, 66, 23, 2, 0); + sprintf(buf, "Node %d/%d", current_node, env->nodes); + draw_text(buf, 66, 19, 2, 0); + sprintf(buf, "Tick %d", env->ticks[current_node]); + draw_text(buf, 66, 21, 2, 0); + sprintf(buf, "Value %d", (int)(env->values[current_node] - (middle ? 32 : 0))); + draw_text(buf, 66, 23, 2, 0); } /* return: the new current node */ @@ -1700,10 +1700,10 @@ static void _draw_env_label(const char *env_name, int is_selected) { int pos = 33; - pos += draw_text((const unsigned char *)env_name, pos, 16, is_selected ? 3 : 0, 2); - pos += draw_text((const unsigned char *)" Envelope", pos, 16, is_selected ? 3 : 0, 2); + pos += draw_text(env_name, pos, 16, is_selected ? 3 : 0, 2); + pos += draw_text(" Envelope", pos, 16, is_selected ? 3 : 0, 2); if (envelope_edit_mode || envelope_mouse_edit) - draw_text((const unsigned char *)" (Edit)", pos, 16, is_selected ? 3 : 0, 2); + draw_text(" (Edit)", pos, 16, is_selected ? 3 : 0, 2); } static void volume_envelope_draw(void) @@ -1844,7 +1844,7 @@ static void pitch_pan_center_draw(void) int selected = (ACTIVE_PAGE.selected_widget == 16); song_instrument *ins = song_get_instrument(current_instrument, NULL); - draw_text((const unsigned char *)get_note_string(ins->pitch_pan_center + 1, buf), 54, 45, selected ? 3 : 2, 0); + draw_text(get_note_string(ins->pitch_pan_center + 1, buf), 54, 45, selected ? 3 : 2, 0); } /* --------------------------------------------------------------------------------------------------------- */ @@ -2367,14 +2367,14 @@ static void instrument_list_general_draw_const(void) /* Kind of a hack, and not really useful, but... :) */ if (status.flags & CLASSIC_MODE) { draw_box(55, 46, 73, 48, BOX_THICK | BOX_INNER | BOX_INSET); - draw_text((const unsigned char *)" ", 69, 47, 1, 0); + draw_text(" ", 69, 47, 1, 0); } else { draw_box(55, 46, 69, 48, BOX_THICK | BOX_INNER | BOX_INSET); } - draw_text((const unsigned char *)"New Note Action", 54, 17, 0, 2); - draw_text((const unsigned char *)"Duplicate Check Type & Action", 47, 32, 0, 2); - draw_text((const unsigned char *)"Filename", 47, 47, 0, 2); + draw_text("New Note Action", 54, 17, 0, 2); + draw_text("Duplicate Check Type & Action", 47, 32, 0, 2); + draw_text("Filename", 47, 47, 0, 2); for (n = 0; n < 35; n++) { draw_char(134, 44 + n, 15, 0, 2); @@ -2398,17 +2398,17 @@ static void instrument_list_volume_draw_const(void) draw_box(53, 41, 71, 44, BOX_THICK | BOX_INNER | BOX_INSET); draw_box(53, 45, 71, 47, BOX_THICK | BOX_INNER | BOX_INSET); - draw_text((const unsigned char *)"Volume Envelope", 38, 28, 0, 2); - draw_text((const unsigned char *)"Carry", 48, 29, 0, 2); - draw_text((const unsigned char *)"Envelope Loop", 40, 32, 0, 2); - draw_text((const unsigned char *)"Loop Begin", 43, 33, 0, 2); - draw_text((const unsigned char *)"Loop End", 45, 34, 0, 2); - draw_text((const unsigned char *)"Sustain Loop", 41, 37, 0, 2); - draw_text((const unsigned char *)"SusLoop Begin", 40, 38, 0, 2); - draw_text((const unsigned char *)"SusLoop End", 42, 39, 0, 2); - draw_text((const unsigned char *)"Global Volume", 40, 42, 0, 2); - draw_text((const unsigned char *)"Fadeout", 46, 43, 0, 2); - draw_text((const unsigned char *)"Volume Swing %", 39, 46, 0, 2); + draw_text("Volume Envelope", 38, 28, 0, 2); + draw_text("Carry", 48, 29, 0, 2); + draw_text("Envelope Loop", 40, 32, 0, 2); + draw_text("Loop Begin", 43, 33, 0, 2); + draw_text("Loop End", 45, 34, 0, 2); + draw_text("Sustain Loop", 41, 37, 0, 2); + draw_text("SusLoop Begin", 40, 38, 0, 2); + draw_text("SusLoop End", 42, 39, 0, 2); + draw_text("Global Volume", 40, 42, 0, 2); + draw_text("Fadeout", 46, 43, 0, 2); + draw_text("Volume Swing %", 39, 46, 0, 2); } static void instrument_list_panning_draw_const(void) @@ -2426,26 +2426,26 @@ static void instrument_list_panning_draw_const(void) draw_box(53, 36, 63, 40, BOX_THICK | BOX_INNER | BOX_INSET); draw_box(53, 41, 63, 48, BOX_THICK | BOX_INNER | BOX_INSET); - draw_text((const unsigned char *)"Panning Envelope", 37, 28, 0, 2); - draw_text((const unsigned char *)"Carry", 48, 29, 0, 2); - draw_text((const unsigned char *)"Envelope Loop", 40, 32, 0, 2); - draw_text((const unsigned char *)"Loop Begin", 43, 33, 0, 2); - draw_text((const unsigned char *)"Loop End", 45, 34, 0, 2); - draw_text((const unsigned char *)"Sustain Loop", 41, 37, 0, 2); - draw_text((const unsigned char *)"SusLoop Begin", 40, 38, 0, 2); - draw_text((const unsigned char *)"SusLoop End", 42, 39, 0, 2); - draw_text((const unsigned char *)"Default Pan", 42, 42, 0, 2); - draw_text((const unsigned char *)"Pan Value", 44, 43, 0, 2); - draw_text((const unsigned char *)"Pitch-Pan Center", 37, 45, 0, 2); - draw_text((const unsigned char *)"Pitch-Pan Separation", 33, 46, 0, 2); + draw_text("Panning Envelope", 37, 28, 0, 2); + draw_text("Carry", 48, 29, 0, 2); + draw_text("Envelope Loop", 40, 32, 0, 2); + draw_text("Loop Begin", 43, 33, 0, 2); + draw_text("Loop End", 45, 34, 0, 2); + draw_text("Sustain Loop", 41, 37, 0, 2); + draw_text("SusLoop Begin", 40, 38, 0, 2); + draw_text("SusLoop End", 42, 39, 0, 2); + draw_text("Default Pan", 42, 42, 0, 2); + draw_text("Pan Value", 44, 43, 0, 2); + draw_text("Pitch-Pan Center", 37, 45, 0, 2); + draw_text("Pitch-Pan Separation", 33, 46, 0, 2); if (status.flags & CLASSIC_MODE) { /* Hmm. The 's' in swing isn't capitalised. ;) */ - draw_text((const unsigned char *)"Pan swing", 44, 47, 0, 2); + draw_text("Pan swing", 44, 47, 0, 2); } else { - draw_text((const unsigned char *)"Pan Swing", 44, 47, 0, 2); + draw_text("Pan Swing", 44, 47, 0, 2); } - draw_text((const unsigned char *)"\x9a\x9a\x9a\x9a\x9a\x9a\x9a\x9a\x9a", 54, 44, 2, 0); + draw_text("\x9a\x9a\x9a\x9a\x9a\x9a\x9a\x9a\x9a", 54, 44, 2, 0); } static void instrument_list_pitch_draw_const(void) @@ -2462,20 +2462,20 @@ static void instrument_list_pitch_draw_const(void) draw_box(53, 36, 63, 40, BOX_THICK | BOX_INNER | BOX_INSET); draw_box(53, 41, 71, 48, BOX_THICK | BOX_INNER | BOX_INSET); - draw_text((const unsigned char *)"Frequency Envelope", 35, 28, 0, 2); - draw_text((const unsigned char *)"Carry", 48, 29, 0, 2); - draw_text((const unsigned char *)"Envelope Loop", 40, 32, 0, 2); - draw_text((const unsigned char *)"Loop Begin", 43, 33, 0, 2); - draw_text((const unsigned char *)"Loop End", 45, 34, 0, 2); - draw_text((const unsigned char *)"Sustain Loop", 41, 37, 0, 2); - draw_text((const unsigned char *)"SusLoop Begin", 40, 38, 0, 2); - draw_text((const unsigned char *)"SusLoop End", 42, 39, 0, 2); - draw_text((const unsigned char *)"Default Cutoff", 36, 42, 0, 2); - draw_text((const unsigned char *)"Default Resonance", 36, 43, 0, 2); - draw_text((const unsigned char *)"MIDI Channel", 36, 44, 0, 2); - draw_text((const unsigned char *)"MIDI Program", 36, 45, 0, 2); - draw_text((const unsigned char *)"MIDI Bank Low", 36, 46, 0, 2); - draw_text((const unsigned char *)"MIDI Bank High", 36, 47, 0, 2); + draw_text("Frequency Envelope", 35, 28, 0, 2); + draw_text("Carry", 48, 29, 0, 2); + draw_text("Envelope Loop", 40, 32, 0, 2); + draw_text("Loop Begin", 43, 33, 0, 2); + draw_text("Loop End", 45, 34, 0, 2); + draw_text("Sustain Loop", 41, 37, 0, 2); + draw_text("SusLoop Begin", 40, 38, 0, 2); + draw_text("SusLoop End", 42, 39, 0, 2); + draw_text("Default Cutoff", 36, 42, 0, 2); + draw_text("Default Resonance", 36, 43, 0, 2); + draw_text("MIDI Channel", 36, 44, 0, 2); + draw_text("MIDI Program", 36, 45, 0, 2); + draw_text("MIDI Bank Low", 36, 46, 0, 2); + draw_text("MIDI Bank High", 36, 47, 0, 2); } /* --------------------------------------------------------------------- */ diff --git a/schism/page_loadinst.c b/schism/page_loadinst.c index bf05bbc..0255f00 100644 --- a/schism/page_loadinst.c +++ b/schism/page_loadinst.c @@ -225,11 +225,11 @@ static void file_list_draw(void) bg = 0; } - draw_text(numtostr(3, n, (unsigned char *) buf), 2, pos, 0, 2); - draw_text_len((unsigned char *) (file->title ? file->title : ""), + draw_text(numtostr(3, n, buf), 2, pos, 0, 2); + draw_text_len((file->title ? file->title : ""), 25, 6, pos, fg, bg); draw_char(168, 31, pos, 2, bg); - draw_text_len((unsigned char *) (file->base ? file->base : ""), + draw_text_len((file->base ? file->base : ""), 18, 32, pos, fg, bg); if (file->base && slash_search_mode > -1) { @@ -244,13 +244,13 @@ static void file_list_draw(void) if (file->sampsize > 1) { sprintf(sbuf, "%u Samples", file->sampsize); - draw_text_len((unsigned char *) sbuf, 10, 51, pos, fg, bg); + draw_text_len(sbuf, 10, 51, pos, fg, bg); } else if (file->sampsize == 1) { - draw_text((unsigned char *) "1 Sample ", 51, pos, fg, bg); + draw_text("1 Sample ", 51, pos, fg, bg); } else if (file->type & TYPE_MODULE_MASK) { - draw_text((unsigned char *) "\x9a\x9a""Module\x9a\x9a", 51, pos, fg, bg); + draw_text("\x9a\x9a""Module\x9a\x9a", 51, pos, fg, bg); } else { - draw_text((unsigned char *) " ", 51, pos, fg, bg); + draw_text(" ", 51, pos, fg, bg); } if (file->filesize > 1048576) { sprintf(sbuf, "%lum", (unsigned long)(file->filesize / 1048576)); @@ -261,7 +261,7 @@ static void file_list_draw(void) } else { *sbuf = 0; } - draw_text_len((unsigned char *) sbuf, 6, 62, pos, fg, bg); + draw_text_len(sbuf, 6, 62, pos, fg, bg); } /* draw the info for the current file (or directory...) */ diff --git a/schism/page_loadmodule.c b/schism/page_loadmodule.c index 92d0e37..e693994 100644 --- a/schism/page_loadmodule.c +++ b/schism/page_loadmodule.c @@ -388,7 +388,7 @@ static int search_text_length = 0; /* same as strlen(search_text) */ static void search_redraw(void) { draw_fill_chars(51, 37, 76, 37, 0); - draw_text_len((unsigned char *) search_text + search_first_char, 25, 51, 37, 5, 0); + draw_text_len(search_text + search_first_char, 25, 51, 37, 5, 0); /* draw the cursor if it's on the dir/file list */ if (ACTIVE_PAGE.selected_widget == 0 || ACTIVE_PAGE.selected_widget == 1) { @@ -500,8 +500,8 @@ static int change_dir(const char *dir) static void load_module_draw_const(void) { - draw_text((unsigned char *) "Filename", 4, 46, 0, 2); - draw_text((unsigned char *) "Directory", 3, 47, 0, 2); + draw_text("Filename", 4, 46, 0, 2); + draw_text("Directory", 3, 47, 0, 2); draw_char(0, 51, 37, 0, 6); draw_box(2, 12, 47, 44, BOX_THICK | BOX_INNER | BOX_INSET); draw_box(49, 12, 68, 34, BOX_THICK | BOX_INNER | BOX_INSET); @@ -547,28 +547,28 @@ static void file_list_draw(void) bg = 0; } - draw_text_len((unsigned char *) file->base, 18, 3, pos, fg1, bg); + draw_text_len(file->base, 18, 3, pos, fg1, bg); draw_char(168, 21, pos, 2, bg); - draw_text_len((unsigned char *) file->title, 25, 22, pos, fg2, bg); + draw_text_len(file->title, 25, 22, pos, fg2, bg); } /* info for the current file */ if (current_file >= 0 && current_file < flist.num_files) { file = flist.files[current_file]; - draw_text_len((unsigned char *) (file->description ? file->description : ""), 26, 51, 40, 5, 0); + draw_text_len((file->description ? file->description : ""), 26, 51, 40, 5, 0); sprintf(buf, "%09lu", (unsigned long)file->filesize); - draw_text_len((unsigned char *) buf, 26, 51, 41, 5, 0); - draw_text_len((unsigned char *) get_date_string(file->timestamp, (unsigned char *) buf), 26, 51, 42, 5, 0); - draw_text_len((unsigned char *) get_time_string(file->timestamp, (unsigned char *) buf), 26, 51, 43, 5, 0); + draw_text_len(buf, 26, 51, 41, 5, 0); + draw_text_len(get_date_string(file->timestamp, buf), 26, 51, 42, 5, 0); + draw_text_len(get_time_string(file->timestamp, buf), 26, 51, 43, 5, 0); } } else { if (ACTIVE_PAGE.selected_widget == 0) { - draw_text((unsigned char *) "No files.", 3, 13, 0, 3); + draw_text("No files.", 3, 13, 0, 3); draw_fill_chars(12, 13, 46, 13, 3); draw_char(168, 21, 13, 2, 3); pos = 14; } else { - draw_text((unsigned char *) "No files.", 3, 13, 7, 0); + draw_text("No files.", 3, 13, 7, 0); pos = 13; } draw_fill_chars(51, 40, 76, 43, 0); @@ -725,9 +725,9 @@ static void dir_list_draw(void) if (n >= dlist.num_dirs) break; if (n == current_dir && ACTIVE_PAGE.selected_widget == 1) - draw_text_len((unsigned char *) dlist.dirs[n]->base, 18, 50, pos, 0, 3); + draw_text_len(dlist.dirs[n]->base, 18, 50, pos, 0, 3); else - draw_text_len((unsigned char *) dlist.dirs[n]->base, 18, 50, pos, 5, 0); + draw_text_len(dlist.dirs[n]->base, 18, 50, pos, 5, 0); } /* bleh */ diff --git a/schism/page_loadsample.c b/schism/page_loadsample.c index c03ef1b..ac55279 100644 --- a/schism/page_loadsample.c +++ b/schism/page_loadsample.c @@ -253,69 +253,69 @@ static void load_sample_draw_const(void) f = flist.files[current_file]; sprintf(sbuf, "%07d", f->smp_length); - draw_text_len((unsigned char *) sbuf, 13, 64, 22, 2, 0); + draw_text_len(sbuf, 13, 64, 22, 2, 0); if (!f->smp_length && !f->smp_filename && !f->smp_flags) { - draw_text_len((unsigned char *) "No sample",13, 64, 21, 2, 0); + draw_text_len("No sample",13, 64, 21, 2, 0); } else if (f->smp_flags & SAMP_STEREO) { - draw_text_len((unsigned char *) + draw_text_len( (f->smp_flags & SAMP_16_BIT ? "16 bit Stereo" : "8 bit Stereo"), 13, 64, 21, 2, 0); } else { - draw_text_len((unsigned char *) + draw_text_len( (f->smp_flags & SAMP_16_BIT ? "16 bit" : "8 bit"), 13, 64, 21, 2, 0); } if (f->description) { - draw_text_len((unsigned char *)f->description, + draw_text_len(f->description, 18, 59, 44, 5, 0); } else { switch (f->type) { case TYPE_DIRECTORY: - draw_text((unsigned char *)"Directory", + draw_text("Directory", 59, 44, 5, 0); break; default: - draw_text((unsigned char *)"Unknown format", + draw_text("Unknown format", 59, 44, 5, 0); break; }; } sprintf(sbuf, "%07ld", (long)f->filesize); - draw_text((unsigned char *)sbuf, 59, 45, 5,0); - get_date_string(f->timestamp, (unsigned char *)sbuf); - draw_text((unsigned char *)sbuf, 59, 46, 5,0); - get_time_string(f->timestamp, (unsigned char *)sbuf); - draw_text((unsigned char *)sbuf, 59, 47, 5,0); + draw_text(sbuf, 59, 45, 5,0); + get_date_string(f->timestamp, sbuf); + draw_text(sbuf, 59, 46, 5,0); + get_time_string(f->timestamp, sbuf); + draw_text(sbuf, 59, 47, 5,0); } /* these are exactly the same as in page_samples.c, apart from * 'quality' and 'length' being one line higher */ - draw_text((unsigned char *) "Filename", 55, 13, 0, 2); - draw_text((unsigned char *) "Speed", 58, 14, 0, 2); - draw_text((unsigned char *) "Loop", 59, 15, 0, 2); - draw_text((unsigned char *) "LoopBeg", 56, 16, 0, 2); - draw_text((unsigned char *) "LoopEnd", 56, 17, 0, 2); - draw_text((unsigned char *) "SusLoop", 56, 18, 0, 2); - draw_text((unsigned char *) "SusLBeg", 56, 19, 0, 2); - draw_text((unsigned char *) "SusLEnd", 56, 20, 0, 2); - draw_text((unsigned char *) "Quality", 56, 21, 0, 2); - draw_text((unsigned char *) "Length", 57, 22, 0, 2); + draw_text("Filename", 55, 13, 0, 2); + draw_text("Speed", 58, 14, 0, 2); + draw_text("Loop", 59, 15, 0, 2); + draw_text("LoopBeg", 56, 16, 0, 2); + draw_text("LoopEnd", 56, 17, 0, 2); + draw_text("SusLoop", 56, 18, 0, 2); + draw_text("SusLBeg", 56, 19, 0, 2); + draw_text("SusLEnd", 56, 20, 0, 2); + draw_text("Quality", 56, 21, 0, 2); + draw_text("Length", 57, 22, 0, 2); /* these abbreviations are sucky and lame. any suggestions? */ - draw_text((unsigned char *) "Def. Vol.", 53, 33, 0, 2); - draw_text((unsigned char *) "Glb. Vol.", 53, 34, 0, 2); - draw_text((unsigned char *) "Vib.Speed", 53, 37, 0, 2); - draw_text((unsigned char *) "Vib.Depth", 53, 38, 0, 2); - draw_text((unsigned char *) "Vib. Rate", 53, 39, 0, 2); + draw_text("Def. Vol.", 53, 33, 0, 2); + draw_text("Glb. Vol.", 53, 34, 0, 2); + draw_text("Vib.Speed", 53, 37, 0, 2); + draw_text("Vib.Depth", 53, 38, 0, 2); + draw_text("Vib. Rate", 53, 39, 0, 2); - draw_text((unsigned char *) "Format", 52, 44, 0, 2); - draw_text((unsigned char *) "Size", 54, 45, 0, 2); - draw_text((unsigned char *) "Date", 54, 46, 0, 2); - draw_text((unsigned char *) "Time", 54, 47, 0, 2); + draw_text("Format", 52, 44, 0, 2); + draw_text("Size", 54, 45, 0, 2); + draw_text("Date", 54, 46, 0, 2); + draw_text("Time", 54, 47, 0, 2); if (fake_slot > -1) { s = song_get_sample(fake_slot, 0); @@ -401,11 +401,11 @@ static void file_list_draw(void) fg = get_type_color(file->type); bg = 0; } - draw_text(numtostr(3, n+1, (unsigned char *) buf), 2, pos, 0, 2); - draw_text_len((unsigned char *) (file->title ? file->title : ""), + draw_text(numtostr(3, n+1, buf), 2, pos, 0, 2); + draw_text_len((file->title ? file->title : ""), 25, 6, pos, fg, bg); draw_char(168, 31, pos, 2, bg); - draw_text_len((unsigned char *) (file->base ? file->base : ""), + draw_text_len((file->base ? file->base : ""), 18, 32, pos, fg, bg); if (file->base && slash_search_mode > -1) { if (strncasecmp(file->base,slash_search_str,slash_search_mode) == 0) { @@ -499,7 +499,7 @@ static void stereo_cvt_complete_both(void) } static void stereo_cvt_dialog(void) { - draw_text((unsigned char *) "Loading Stereo Sample", 30, 27, 0, 2); + draw_text("Loading Stereo Sample", 30, 27, 0, 2); } static int stereo_cvt_hk(struct key_event *k) { diff --git a/schism/page_log.c b/schism/page_log.c index bdd43da..ae8d7ca 100644 --- a/schism/page_log.c +++ b/schism/page_log.c @@ -99,11 +99,11 @@ static void log_redraw(void) for (n = 0; n <= last_line && n < 33; n++, i++) { if (!lines[i].text) continue; if (lines[i].bios_font) { - draw_text_bios_len((unsigned char *) lines[i].text, + draw_text_bios_len(lines[i].text, 74, 3, 14 + n, lines[i].color, 0); } else { - draw_text_len((unsigned char *) lines[i].text, + draw_text_len(lines[i].text, 74, 3, 14 + n, lines[i].color, 0); } diff --git a/schism/page_message.c b/schism/page_message.c index a760738..b1480fe 100644 --- a/schism/page_message.c +++ b/schism/page_message.c @@ -47,7 +47,7 @@ static int cursor_char = 0; * (should be updated whenever cursor_line/cursor_char change) */ static int cursor_pos = 0; -unsigned char *message = NULL; +char *message = NULL; int edit_mode = 0; /* nonzero => message should use the alternate font */ @@ -71,9 +71,9 @@ static int message_handle_key_viewmode(struct key_event * k); * lines, ptr is set to the \0 at the end of the string, and the * function returns -1. note: if *ptr == text, weird things will * probably happen, so don't do that. */ -static int get_nth_line(unsigned char *text, int n, unsigned char **ptr) +static int get_nth_line(char *text, int n, char **ptr) { - unsigned char *tmp; + char *tmp; if (!text) { *ptr = NULL; @@ -83,9 +83,9 @@ static int get_nth_line(unsigned char *text, int n, unsigned char **ptr) *ptr = text; while (n > 0) { n--; - *ptr = (unsigned char *)strpbrk((char*)*ptr, "\xd\xa"); + *ptr = strpbrk(*ptr, "\xd\xa"); if (!(*ptr)) { - *ptr = text + strlen((char*)text); + *ptr = text + strlen(text); return -1; } if ((*ptr)[0] == 13 && (*ptr)[1] == 10) @@ -94,13 +94,13 @@ static int get_nth_line(unsigned char *text, int n, unsigned char **ptr) (*ptr)++; } - tmp = (unsigned char *)strpbrk((char*)*ptr, "\xd\xa"); - return (tmp ? (unsigned) (tmp - *ptr) : strlen((char*)*ptr)); + tmp = strpbrk(*ptr, "\xd\xa"); + return (tmp ? (unsigned) (tmp - *ptr) : strlen(*ptr)); } -static void set_absolute_position(unsigned char *text, int pos, int *line, int *ch) +static void set_absolute_position(char *text, int pos, int *line, int *ch) { int len; - unsigned char *ptr; + char *ptr; *line = *ch = 0; ptr = 0; @@ -127,10 +127,10 @@ static void set_absolute_position(unsigned char *text, int pos, int *line, int * } } } -static int get_absolute_position(unsigned char *text, int line, int character) +static int get_absolute_position(char *text, int line, int character) { int len; - unsigned char *ptr; + char *ptr; ptr = 0; len = get_nth_line(text, line, &ptr); @@ -157,7 +157,7 @@ static void message_reposition(void) /* returns 1 if a character was actually added */ static int message_add_char(int newchar, int position) { - int len = strlen((char*)message); + int len = strlen(message); if (len == 8000) { dialog_create(DIALOG_OK, " Song message too long! ", NULL, NULL, 0, NULL); @@ -175,22 +175,22 @@ static int message_add_char(int newchar, int position) } /* this returns the new length of the line */ -static int message_wrap_line(unsigned char *bol_ptr) +static int message_wrap_line(char *bol_ptr) { - unsigned char *eol_ptr; - unsigned char *last_space = NULL; - unsigned char *tmp = bol_ptr; + char *eol_ptr; + char *last_space = NULL; + char *tmp = bol_ptr; if (!bol_ptr) /* shouldn't happen, but... */ return 0; - eol_ptr = (unsigned char *)strpbrk((char*)bol_ptr, "\xd\xa"); + eol_ptr = strpbrk(bol_ptr, "\xd\xa"); if (!eol_ptr) - eol_ptr = bol_ptr + strlen((char*)bol_ptr); + eol_ptr = bol_ptr + strlen(bol_ptr); for (;;) { - tmp = (unsigned char *)strpbrk((char*)(tmp + 1), " \t"); + tmp = strpbrk((tmp + 1), " \t"); if (tmp == NULL || tmp > eol_ptr || tmp - bol_ptr > LINE_WRAP) break; @@ -212,9 +212,9 @@ static int message_wrap_line(unsigned char *bol_ptr) } /* --------------------------------------------------------------------- */ -static void text(unsigned char *line, int len, int n) +static void text(char *line, int len, int n) { - unsigned int ch; + unsigned char ch; int fg = (message_extfont ? 12 : 6); int i; @@ -232,7 +232,7 @@ static void text(unsigned char *line, int len, int n) static void message_draw(void) { - unsigned char *line, *prevline = message; + char *line, *prevline = message; int len = get_nth_line(message, top_line, &line); int n, cp, clipl, clipr; int skipc, cutc; @@ -274,9 +274,9 @@ static void message_draw(void) if (cutc > (len-skipc)) cutc = (len-skipc); if (cutc > 0 && skipc < len) { if (message_extfont) - draw_text_bios_len((unsigned char *) line+skipc, cutc, 2+skipc, 13 + n, 6, 8); + draw_text_bios_len(line+skipc, cutc, 2+skipc, 13 + n, 6, 8); else - draw_text_len((unsigned char *) line+skipc, cutc, 2+skipc, 13 + n, 6, 8); + draw_text_len(line+skipc, cutc, 2+skipc, 13 + n, 6, 8); } } } @@ -343,7 +343,7 @@ static inline void message_set_viewmode(void) static void message_insert_char(int c) { - unsigned char *ptr; + char *ptr; int n; if (!edit_mode) @@ -380,7 +380,7 @@ static void message_insert_char(int c) } } if (get_nth_line(message, cursor_line, &ptr) >= LINE_WRAP) { - message_wrap_line((unsigned char *)ptr); + message_wrap_line(ptr); } if (cursor_char >= LINE_WRAP) { cursor_char = get_nth_line(message, ++cursor_line, &ptr); @@ -395,8 +395,8 @@ static void message_insert_char(int c) static void message_delete_char(void) { - int len = strlen((char*)message); - unsigned char *ptr; + int len = strlen(message); + char *ptr; if (cursor_pos == 0) return; @@ -417,7 +417,7 @@ static void message_delete_char(void) static void message_delete_next_char(void) { - int len = strlen((char*)message); + int len = strlen(message); if (cursor_pos == len) return; @@ -432,14 +432,14 @@ static void message_delete_line(void) { int len; int movelen; - unsigned char *ptr; + char *ptr; len = get_nth_line(message, cursor_line, &ptr); if (len < 0) return; if (ptr[len] == 13 && ptr[len + 1] == 10) len++; - movelen = (message + strlen((char*)message) - ptr); + movelen = (message + strlen(message) - ptr); if (movelen == 0) return; memmove((void *) ptr, ptr + len + 1, movelen); @@ -506,7 +506,7 @@ static int message_handle_key_viewmode(struct key_event * k) break; case SDLK_END: if (k->state) return 0; - top_line = get_num_lines((char*)message) - 34; + top_line = get_num_lines(message) - 34; break; case SDLK_t: if (k->state) return 0; @@ -532,7 +532,7 @@ static int message_handle_key_viewmode(struct key_event * k) } static void _delete_selection(void) { - int len = strlen((char*)message); + int len = strlen(message); int eat; cursor_pos = widgets_message[0].clip_start; @@ -559,7 +559,7 @@ static int message_handle_key_editmode(struct key_event * k) int line_len, num_lines = -1; int new_cursor_line = cursor_line; int new_cursor_char = cursor_char; - unsigned char *ptr; + char *ptr; int doing_drag = 0; int clipl, clipr, cp; @@ -636,7 +636,7 @@ static int message_handle_key_editmode(struct key_event * k) case SDLK_END: if (k->state) return 1; if (k->mod & KMOD_CTRL) { - num_lines = get_num_lines((char*)message); + num_lines = get_num_lines(message); new_cursor_line = num_lines; } else { new_cursor_char = line_len; @@ -714,7 +714,7 @@ static int message_handle_key_editmode(struct key_event * k) if (new_cursor_line != cursor_line) { if (num_lines == -1) - num_lines = get_num_lines((char*)message); + num_lines = get_num_lines(message); if (new_cursor_line < 0) new_cursor_line = 0; @@ -742,7 +742,7 @@ static int message_handle_key_editmode(struct key_event * k) } else if (new_cursor_char > get_nth_line(message, cursor_line, &ptr)) { - if (cursor_line == get_num_lines((char*)message)) { + if (cursor_line == get_num_lines(message)) { new_cursor_char = cursor_char; } else { cursor_line++; @@ -765,7 +765,7 @@ static int message_handle_key_editmode(struct key_event * k) clipl = clipr; clipr = cp; } - clippy_select(widgets_message, (char*)(message+clipl), clipr-clipl); + clippy_select(widgets_message, (message+clipl), clipr-clipl); } status.flags |= NEED_UPDATE; @@ -782,21 +782,21 @@ static void message_draw_const(void) static void song_changed_cb(void) { - unsigned char *line, *prevline; + char *line, *prevline; int len; edit_mode = 0; widgets_message[0].accept_text = 0; widgets_message[0].d.other.handle_key = message_handle_key_viewmode; top_line = 0; - message = (unsigned char *)song_get_message(); + message = (char *)song_get_message(); - len = get_nth_line(message, 0, (unsigned char **)&line); + len = get_nth_line(message, 0, &line); while (len >= 0) { if (len > LINE_WRAP) message_wrap_line(line); prevline = line; - len = get_nth_line(prevline, 1, (unsigned char **)&line); + len = get_nth_line(prevline, 1, &line); } if (status.current_page == PAGE_MESSAGE) diff --git a/schism/page_midi.c b/schism/page_midi.c index 86483b1..98bf4f2 100644 --- a/schism/page_midi.c +++ b/schism/page_midi.c @@ -205,16 +205,16 @@ static void midi_page_redraw(void) time_t now; draw_fill_chars(3, 15, 76, 28, 0); - draw_text((unsigned char *) "Midi ports:", 2, 13, 0, 2); + draw_text("Midi ports:", 2, 13, 0, 2); draw_box(2,14,77,28, BOX_THIN|BOX_INNER|BOX_INSET); - draw_text((unsigned char *) "Tick quantize", 6, 30, 0, 2); - draw_text((unsigned char *) "Base Program 1", 5, 31, 0, 2); - draw_text((unsigned char *) "Record Note-Off", 4, 32, 0, 2); - draw_text((unsigned char *) "Record Velocity", 4, 33, 0, 2); - draw_text((unsigned char *) "Record Aftertouch", 2, 34, 0, 2); - draw_text((unsigned char *) "Record using SDx", 3, 35, 0, 2); - draw_text((unsigned char *) "Cut note off", 7, 36, 0, 2); + draw_text( "Tick quantize", 6, 30, 0, 2); + draw_text( "Base Program 1", 5, 31, 0, 2); + draw_text( "Record Note-Off", 4, 32, 0, 2); + draw_text( "Record Velocity", 4, 33, 0, 2); + draw_text( "Record Aftertouch", 2, 34, 0, 2); + draw_text( "Record using SDx", 3, 35, 0, 2); + draw_text( "Cut note off", 7, 36, 0, 2); draw_fill_chars(23, 30, 24, 36, 0); draw_box(19,29,25,37, BOX_THIN|BOX_INNER|BOX_INSET); @@ -227,13 +227,13 @@ static void midi_page_redraw(void) draw_fill_chars(56, 38, 72, 38, 0); draw_box(52,37,73,39, BOX_THIN|BOX_INNER|BOX_INSET); - draw_text((unsigned char *) "Amplification", 39, 30, 0, 2); - draw_text((unsigned char *) "C-5 Note-value", 38, 31, 0, 2); - draw_text((unsigned char *) "Output MIDI pitch", 35, 34, 0, 2); - draw_text((unsigned char *) "Pitch wheel depth", 35, 35, 0, 2); - draw_text((unsigned char *) "Embed MIDI data", 37, 38, 0, 2); + draw_text( "Amplification", 39, 30, 0, 2); + draw_text( "C-5 Note-value", 38, 31, 0, 2); + draw_text("Output MIDI pitch", 35, 34, 0, 2); + draw_text("Pitch wheel depth", 35, 35, 0, 2); + draw_text( "Embed MIDI data", 37, 38, 0, 2); - draw_text((unsigned char *) "IP MIDI ports", 39, 41, 0, 2); + draw_text( "IP MIDI ports", 39, 41, 0, 2); draw_box(52,40,73,42, BOX_THIN|BOX_INNER|BOX_INSET); time(&now); @@ -258,7 +258,7 @@ static void midi_page_redraw(void) fg = 5; bg = 0; } - draw_text_len((unsigned char *) name, 64, 13, 15+i, 5, 0); + draw_text_len(name, 64, 13, 15+i, 5, 0); /* portability: should use difftime */ if (status.flags & MIDI_EVENT_CHANGED @@ -269,25 +269,25 @@ static void midi_page_redraw(void) sprintf(buffer + n, "%02x ", status.last_midi_event[j]); n += 3; } - draw_text((unsigned char *) buffer, 77 - strlen(buffer), 15+i, + draw_text(buffer, 77 - strlen(buffer), 15+i, status.last_midi_port ? 4 : 10, 0); } switch (p->io) { case 0: - draw_text((unsigned char *) "Disabled ", 3, 15+i, fg, bg); + draw_text("Disabled ", 3, 15+i, fg, bg); break; case MIDI_INPUT: - draw_text((unsigned char *) " Input ", 3, 15+i, fg, bg); + draw_text(" Input ", 3, 15+i, fg, bg); break; case MIDI_OUTPUT: - draw_text((unsigned char *) " Output ", 3, 15+i, fg, bg); + draw_text(" Output ", 3, 15+i, fg, bg); break; case MIDI_INPUT|MIDI_OUTPUT: - draw_text((unsigned char *) " Duplex ", 3, 15+i, fg, bg); + draw_text(" Duplex ", 3, 15+i, fg, bg); break; default: - draw_text((unsigned char *) " Enabled ", 3, 15+i, fg, bg); + draw_text(" Enabled ", 3, 15+i, fg, bg); break; }; } diff --git a/schism/page_midiout.c b/schism/page_midiout.c index 508158f..60cafb2 100644 --- a/schism/page_midiout.c +++ b/schism/page_midiout.c @@ -43,32 +43,32 @@ static void midiout_draw_const(void) char buf[4]; int i; - draw_text((unsigned char *) "MIDI Start", 6, 13, 0, 2); - draw_text((unsigned char *) "MIDI Stop", 7, 14, 0, 2); - draw_text((unsigned char *) "MIDI Tick", 7, 15, 0, 2); - draw_text((unsigned char *) "Note On", 9, 16, 0, 2); - draw_text((unsigned char *) "Note Off", 8, 17, 0, 2); - draw_text((unsigned char *) "Change Volume", 3, 18, 0, 2); - draw_text((unsigned char *) "Change Pan", 6, 19, 0, 2); - draw_text((unsigned char *) "Bank Select", 5, 20, 0, 2); - draw_text((unsigned char *) "Program Change", 2, 21, 0, 2); - - draw_text((unsigned char *) "Macro SF0", 5, 24, 0, 2); - draw_text((unsigned char *) "Setup SF1", 5, 25, 0, 2); + draw_text( "MIDI Start", 6, 13, 0, 2); + draw_text( "MIDI Stop", 7, 14, 0, 2); + draw_text( "MIDI Tick", 7, 15, 0, 2); + draw_text( "Note On", 9, 16, 0, 2); + draw_text( "Note Off", 8, 17, 0, 2); + draw_text( "Change Volume", 3, 18, 0, 2); + draw_text( "Change Pan", 6, 19, 0, 2); + draw_text( "Bank Select", 5, 20, 0, 2); + draw_text("Program Change", 2, 21, 0, 2); + + draw_text( "Macro SF0", 5, 24, 0, 2); + draw_text( "Setup SF1", 5, 25, 0, 2); buf[0] = 'S'; buf[1] = 'F'; buf[3] = '\0'; for (i = 2; i < 10; i++) { buf[2] = i + '0'; - draw_text((unsigned char *) buf, 13, 24+i, 0, 2); + draw_text(buf, 13, 24+i, 0, 2); } - draw_text((unsigned char *) "SFA", 13, 34, 0, 2); - draw_text((unsigned char *) "SFB", 13, 35, 0, 2); - draw_text((unsigned char *) "SFC", 13, 36, 0, 2); - draw_text((unsigned char *) "SFD", 13, 37, 0, 2); - draw_text((unsigned char *) "SFE", 13, 38, 0, 2); - draw_text((unsigned char *) "SFF", 13, 39, 0, 2); + draw_text( "SFA", 13, 34, 0, 2); + draw_text( "SFB", 13, 35, 0, 2); + draw_text( "SFC", 13, 36, 0, 2); + draw_text( "SFD", 13, 37, 0, 2); + draw_text( "SFE", 13, 38, 0, 2); + draw_text( "SFF", 13, 39, 0, 2); draw_box(16, 12, 60, 22, BOX_THIN|BOX_INNER|BOX_INSET); draw_box(16, 23, 60, 40, BOX_THIN|BOX_INNER|BOX_INSET); @@ -76,7 +76,7 @@ static void midiout_draw_const(void) for (i = 0; i < 7; i++) { sprintf(buf, "Z%02X", i+zbuf_top+0x80); - draw_text((unsigned char *) buf, 13, i+42, 0, 2); + draw_text(buf, 13, i+42, 0, 2); } } static void copyout_zbuf(void) diff --git a/schism/page_orderpan.c b/schism/page_orderpan.c index 772ca53..799eb79 100644 --- a/schism/page_orderpan.c +++ b/schism/page_orderpan.c @@ -56,8 +56,8 @@ void update_current_order(void) { char buf[4]; - draw_text(numtostr(3, current_order, (unsigned char *) buf), 12, 5, 5, 0); - draw_text(numtostr(3, song_get_num_orders(), (unsigned char *) buf), 16, 5, 5, 0); + draw_text(numtostr(3, current_order, buf), 12, 5, 5, 0); + draw_text(numtostr(3, song_get_num_orders(), buf), 16, 5, 5, 0); } @@ -163,7 +163,7 @@ static void get_pattern_string(unsigned char pattern, char *buf) buf[3] = 0; break; default: - numtostr(3, pattern, (unsigned char *) buf); + numtostr(3, pattern, buf); break; } } @@ -177,9 +177,9 @@ static void orderlist_draw(void) /* draw the list */ for (pos = 0, n = top_order; pos < 32; pos++, n++) { - draw_text(numtostr(3, n, (unsigned char *) buf), 2, 15 + pos, (n == playing_order ? 3 : 0), 2); + draw_text(numtostr(3, n, buf), 2, 15 + pos, (n == playing_order ? 3 : 0), 2); get_pattern_string(list[n], buf); - draw_text((unsigned char *) buf, 6, 15 + pos, 2, 0); + draw_text(buf, 6, 15 + pos, 2, 0); } /* draw the cursor */ @@ -743,8 +743,8 @@ static void order_pan_vol_draw_const(void) static void orderpan_draw_const(void) { order_pan_vol_draw_const(); - draw_text((unsigned char *) "L M R", 31, 14, 0, 3); - draw_text((unsigned char *) "L M R", 65, 14, 0, 3); + draw_text("L M R", 31, 14, 0, 3); + draw_text("L M R", 65, 14, 0, 3); } static void ordervol_draw_const(void) @@ -757,8 +757,8 @@ static void ordervol_draw_const(void) order_pan_vol_draw_const(); - draw_text((unsigned char *) " Volumes ", 31, 14, 0, 3); - draw_text((unsigned char *) " Volumes ", 65, 14, 0, 3); + draw_text(" Volumes ", 31, 14, 0, 3); + draw_text(" Volumes ", 65, 14, 0, 3); for (n = 1; n <= 32; n++) { fg = 0; @@ -768,8 +768,8 @@ static void ordervol_draw_const(void) } } - numtostr(2, n, (unsigned char *) buf + 8); - draw_text((unsigned char *) buf, 20, 14 + n, fg, 2); + numtostr(2, n, buf + 8); + draw_text(buf, 20, 14 + n, fg, 2); fg = 0; if (!(status.flags & CLASSIC_MODE)) { @@ -778,8 +778,8 @@ static void ordervol_draw_const(void) } } - numtostr(2, n + 32, (unsigned char *) buf + 8); - draw_text((unsigned char *) buf, 54, 14 + n, fg, 2); + numtostr(2, n + 32, buf + 8); + draw_text(buf, 54, 14 + n, fg, 2); } } diff --git a/schism/page_palette.c b/schism/page_palette.c index 24fba28..a47b7c5 100644 --- a/schism/page_palette.c +++ b/schism/page_palette.c @@ -47,7 +47,7 @@ static void palette_draw_const(void) { int n; - draw_text((unsigned char *) "Predefined Palettes", 57, 25, 0, 2); + draw_text("Predefined Palettes", 57, 25, 0, 2); for (n = 0; n < 7; n++) { draw_box(2, 13 + (5 * n), 8, 17 + (5 * n), BOX_THICK | BOX_INNER | BOX_INSET); @@ -100,7 +100,7 @@ static void palette_list_draw(void) bg = 14; } - draw_text_len((unsigned char *) "User Defined", 21, 56, 27, fg, bg); + draw_text_len("User Defined", 21, 56, 27, fg, bg); for (n = 0; n < 19 && palettes[n].name[0]; n++) { fg = 6; bg = 0; @@ -110,7 +110,7 @@ static void palette_list_draw(void) } else if (n == selected_palette) { bg = 14; } - draw_text_len((unsigned char *) palettes[n].name, 21, 56, 28 + n, fg, bg); + draw_text_len(palettes[n].name, 21, 56, 28 + n, fg, bg); } max_palette = n; } diff --git a/schism/page_patedit.c b/schism/page_patedit.c index 25fdd08..ba31a37 100644 --- a/schism/page_patedit.c +++ b/schism/page_patedit.c @@ -134,14 +134,14 @@ struct pattern_snap { int rows; /* used by undo/history only */ - const unsigned char *snap_op; + const char *snap_op; int freesnapop; int x, y; int patternno; }; static struct pattern_snap fast_save = { NULL, 0, 0, - (const unsigned char *) "Fast Pattern Save", + "Fast Pattern Save", 0, 0, 0, -1 }; /* static int fast_save_validity = -1; */ @@ -150,7 +150,7 @@ static void snap_paste(struct pattern_snap *s, int x, int y, int xlate); static struct pattern_snap clipboard = { NULL, 0, 0, - (const unsigned char *) "Clipboard", + "Clipboard", 0, 0, 0, -1 }; static struct pattern_snap undo_history[10]; @@ -269,13 +269,13 @@ static void options_close(void *data) static void options_draw_const(void) { - draw_text((const unsigned char *)"Pattern Editor Options", 28, 19, 0, 2); - draw_text((const unsigned char *)"Base octave", 28, 23, 0, 2); - draw_text((const unsigned char *)"Cursor step", 28, 26, 0, 2); - draw_text((const unsigned char *)"Row hilight minor", 22, 29, 0, 2); - draw_text((const unsigned char *)"Row hilight major", 22, 32, 0, 2); - draw_text((const unsigned char *)"Number of rows in pattern", 14, 35, 0, 2); - draw_text((const unsigned char *)"Command/Value columns", 18, 38, 0, 2); + draw_text("Pattern Editor Options", 28, 19, 0, 2); + draw_text("Base octave", 28, 23, 0, 2); + draw_text("Cursor step", 28, 26, 0, 2); + draw_text("Row hilight minor", 22, 29, 0, 2); + draw_text("Row hilight major", 22, 32, 0, 2); + draw_text("Number of rows in pattern", 14, 35, 0, 2); + draw_text("Command/Value columns", 18, 38, 0, 2); draw_box(39, 22, 42, 24, BOX_THIN | BOX_INNER | BOX_INSET); draw_box(39, 25, 43, 27, BOX_THIN | BOX_INNER | BOX_INSET); @@ -327,10 +327,10 @@ void pattern_editor_display_options(void) static struct widget template_error_widgets[1]; static void template_error_draw(void) { - draw_text((const unsigned char *)"Template Error", 33, 25, 0, 2); - draw_text((const unsigned char *)"No note in the top left position", 23, 27, 0, 2); - draw_text((const unsigned char *)"of the clipboard on which to", 25, 28, 0, 2); - draw_text((const unsigned char *)"base translations.", 31, 29, 0, 2); + draw_text("Template Error", 33, 25, 0, 2); + draw_text("No note in the top left position", 23, 27, 0, 2); + draw_text("of the clipboard on which to", 25, 28, 0, 2); + draw_text("base translations.", 31, 29, 0, 2); } /* --------------------------------------------------------------------------------------------------------- */ @@ -341,10 +341,10 @@ static void length_edit_draw_const(void) draw_box(33,23,56,25, BOX_THIN | BOX_INNER | BOX_INSET); draw_box(33,26,60,29, BOX_THIN | BOX_INNER | BOX_INSET); - draw_text((const unsigned char *)"Set Pattern Length", 31, 21, 0, 2); - draw_text((const unsigned char *)"Pattern Length", 19, 24, 0, 2); - draw_text((const unsigned char *)"Start Pattern", 20, 27, 0, 2); - draw_text((const unsigned char *)"End Pattern", 22, 28, 0, 2); + draw_text("Set Pattern Length", 31, 21, 0, 2); + draw_text("Pattern Length", 19, 24, 0, 2); + draw_text("Start Pattern", 20, 27, 0, 2); + draw_text("End Pattern", 22, 28, 0, 2); } static void length_edit_close(UNUSED void *data) { @@ -422,11 +422,11 @@ static int multichannel_handle_key(struct key_event *k) } static void multichannel_draw_const(void) { - unsigned char sbuf[16]; + char sbuf[16]; int i; for (i = 0; i < 64; i++) { - sprintf((char *) sbuf, "Channel %02d", i+1); + sprintf(sbuf, "Channel %02d", i+1); draw_text(sbuf, 9 + ((i / 16) * 16), /* X */ 22 + (i % 16), /* Y */ @@ -440,7 +440,7 @@ static void multichannel_draw_const(void) 38, BOX_THIN|BOX_INNER|BOX_INSET); } - draw_text((const unsigned char *)"Multichannel Selection", 28, 19, 3, 2); + draw_text("Multichannel Selection", 28, 19, 3, 2); } static void mp_advance_channel(void) { @@ -777,7 +777,7 @@ static void history_draw_const(void) { int i, j; int fg, bg; - draw_text((const unsigned char *)"Undo", 38, 22, 3, 2); + draw_text("Undo", 38, 22, 3, 2); draw_box(19,23,60,34, BOX_THIN | BOX_INNER | BOX_INSET); j = undo_history_top; for (i = 0; i < 10; i++) { @@ -880,7 +880,7 @@ static void fast_volume_setup_cancel(UNUSED void *data) static void fast_volume_setup_draw_const(void) { - draw_text((unsigned char *) "Volume Amplification %", 29, 27, 0, 2); + draw_text("Volume Amplification %", 29, 27, 0, 2); draw_box(32, 29, 44, 31, BOX_THIN | BOX_INNER | BOX_INSET); } @@ -920,7 +920,7 @@ static void fast_volume_attenuate(void) static void volume_setup_draw_const(void) { - draw_text((unsigned char *) "Volume Amplification %", 29, 27, 0, 2); + draw_text("Volume Amplification %", 29, 27, 0, 2); draw_box(25, 29, 52, 31, BOX_THIN | BOX_INNER | BOX_INSET); } @@ -948,7 +948,7 @@ static int current_vary = -1; static void vary_setup_draw_const(void) { - draw_text((unsigned char *) "Vary depth limit %", 31, 27, 0, 2); + draw_text("Vary depth limit %", 31, 27, 0, 2); draw_box(25, 29, 52, 31, BOX_THIN | BOX_INNER | BOX_INSET); } @@ -1843,7 +1843,7 @@ static void pated_history_clear(void) free(undo_history[i].data); memset(&undo_history[i],0,sizeof(struct pattern_snap)); - undo_history[i].snap_op = (const unsigned char *)"Empty"; + undo_history[i].snap_op = "Empty"; undo_history[i].freesnapop = 0; } } @@ -2322,7 +2322,7 @@ static void shift_advance_cursor(struct key_event *k) void update_current_row(void) { - byte buf[4]; + char buf[4]; draw_text(numtostr(3, current_row, buf), 12, 7, 5, 0); draw_text(numtostr(3, song_get_rows_in_pattern(current_pattern), buf), 16, 7, 5, 0); @@ -2356,7 +2356,7 @@ void set_current_row(int row) void update_current_pattern(void) { - byte buf[4]; + char buf[4]; draw_text(numtostr(3, current_pattern, buf), 12, 6, 5, 0); draw_text(numtostr(3, song_get_num_patterns(), buf), 16, 6, 5, 0); @@ -2536,7 +2536,7 @@ static void pattern_editor_redraw(void) { int chan, chan_pos, chan_drawpos = 5; int row, row_pos; - byte buf[4]; + char buf[4]; song_note *pattern, *note; const struct track_view *track_view; int total_rows; @@ -4375,8 +4375,8 @@ static int pattern_editor_handle_key_cb(struct key_event * k) if (k->mod & KMOD_SHIFT) shift_selection_update(); - draw_text(numtostr(3, song_get_num_patterns(), (unsigned char *) buf), 16, 6, 5, 0); - draw_text(numtostr(3, current_row, (unsigned char *) buf), 12, 7, 5, 0); + draw_text(numtostr(3, song_get_num_patterns(), buf), 16, 6, 5, 0); + draw_text(numtostr(3, current_row, buf), 12, 7, 5, 0); status.flags |= NEED_UPDATE; return 1; @@ -4529,7 +4529,7 @@ void pattern_editor_load_page(struct page *page) int i; for (i = 0; i < 10; i++) { memset(&undo_history[i],0,sizeof(struct pattern_snap)); - undo_history[i].snap_op = (const unsigned char *)"Empty"; + undo_history[i].snap_op = "Empty"; undo_history[i].freesnapop = 0; } for (i = 0; i < 64; i++) { diff --git a/schism/page_preferences.c b/schism/page_preferences.c index 7502d03..c021186 100644 --- a/schism/page_preferences.c +++ b/schism/page_preferences.c @@ -58,45 +58,45 @@ static void preferences_draw_const(void) char buf[80]; int i; - draw_text((unsigned char *) "Master Volume Left", 2, 14, 0, 2); - draw_text((unsigned char *) "Master Volume Right", 2, 15, 0, 2); + draw_text("Master Volume Left", 2, 14, 0, 2); + draw_text("Master Volume Right", 2, 15, 0, 2); draw_box(21, 13, 27, 16, BOX_THIN | BOX_INNER | BOX_INSET); sprintf(buf, "Mixing Mode, Playback Frequency: %dHz", audio_settings.sample_rate); - draw_text((unsigned char *) buf, 2, 18, 0, 2); + draw_text(buf, 2, 18, 0, 2); for (i = 0; interpolation_modes[i]; i++); - draw_text((unsigned char *) "Output Equalizer", 2, 21+i*3, 0, 2); - draw_text((unsigned char *) "Low Frequency Band", 7, 23+i*3, 0, 2); - draw_text((unsigned char *) "Med Low Frequency Band", 3, 24+i*3, 0, 2); - draw_text((unsigned char *) "Med High Frequency Band", 2, 25+i*3, 0, 2); - draw_text((unsigned char *) "High Frequency Band", 6, 26+i*3, 0, 2); + draw_text("Output Equalizer", 2, 21+i*3, 0, 2); + draw_text( "Low Frequency Band", 7, 23+i*3, 0, 2); + draw_text( "Med Low Frequency Band", 3, 24+i*3, 0, 2); + draw_text("Med High Frequency Band", 2, 25+i*3, 0, 2); + draw_text( "High Frequency Band", 6, 26+i*3, 0, 2); - draw_text((unsigned char *) "Ramp volume at start of sample",2,29+i*3,0,2); + draw_text("Ramp volume at start of sample",2,29+i*3,0,2); draw_box(25, 22+i*3, 47, 27+i*3, BOX_THIN | BOX_INNER | BOX_INSET); draw_box(52, 22+i*3, 74, 27+i*3, BOX_THIN | BOX_INNER | BOX_INSET); - draw_text((unsigned char *) "Oversampling", 57, 25, 0, 2); - draw_text((unsigned char *) "Noise Reduction", 54, 26, 0, 2); + draw_text("Oversampling", 57, 25, 0, 2); + draw_text("Noise Reduction", 54, 26, 0, 2); draw_fill_chars(73, 24, 77, 26, 0); draw_box(69, 24, 78, 27, BOX_THIN | BOX_INNER | BOX_INSET); draw_fill_chars(73, 29, 77, 31, 0); draw_box(69, 28, 78, 32, BOX_THIN | BOX_INNER | BOX_INSET); - draw_text((unsigned char *) "XBass", 64, 29, 0, 2); - draw_text((unsigned char *) "Reverb", 63, 30, 0, 2); - draw_text((unsigned char *) "Surround", 61, 31, 0, 2); + draw_text("XBass", 64, 29, 0, 2); + draw_text("Reverb", 63, 30, 0, 2); + draw_text("Surround", 61, 31, 0, 2); #define CORNER_BOTTOM "http://rigelseven.com/schism/" #ifndef RELEASE_VERSION #define CORNER_BOTTOM2 "http://sourceforge.net/projects/schismtracker/" - draw_text((unsigned char *) CORNER_BOTTOM2, 78 - strlen(CORNER_BOTTOM2), 48, 1, 2); - draw_text((unsigned char *) CORNER_BOTTOM, 78 - strlen(CORNER_BOTTOM), 47, 1, 2); + draw_text(CORNER_BOTTOM2, 78 - strlen(CORNER_BOTTOM2), 48, 1, 2); + draw_text(CORNER_BOTTOM, 78 - strlen(CORNER_BOTTOM), 47, 1, 2); #else - draw_text((unsigned char *) CORNER_BOTTOM, 78 - strlen(CORNER_BOTTOM), 48, 1, 2); + draw_text(CORNER_BOTTOM, 78 - strlen(CORNER_BOTTOM), 48, 1, 2); #endif } @@ -177,13 +177,13 @@ static void draw_dsp_dialog_const(void) { int len; len = strlen(dsp_dialog_title); - draw_text((unsigned char *) dsp_dialog_title, 40 - (len/2), 24, 0, 2); + draw_text(dsp_dialog_title, 40 - (len/2), 24, 0, 2); len = strlen(dsp_dialog_label1); - draw_text((unsigned char *) dsp_dialog_label1, 29 - len, 27, 0, 2); + draw_text(dsp_dialog_label1, 29 - len, 27, 0, 2); len = strlen(dsp_dialog_label2); - draw_text((unsigned char *) dsp_dialog_label2, 29 - len, 28, 0, 2); + draw_text(dsp_dialog_label2, 29 - len, 28, 0, 2); draw_box(29, 26, 55, 29, BOX_THIN | BOX_INNER | BOX_INSET); } diff --git a/schism/page_samples.c b/schism/page_samples.c index b423b3d..4ff728f 100644 --- a/schism/page_samples.c +++ b/schism/page_samples.c @@ -174,12 +174,12 @@ static void sample_list_draw_list(void) if (sample->played) draw_char(173, 1, 13 + pos, is_playing[n] ? 3 : 1, 2); - draw_text(num99tostr(n, (unsigned char *) buf), 2, 13 + pos, 0, 2); + draw_text(num99tostr(n, buf), 2, 13 + pos, 0, 2); pn = ((unsigned char)name[24]); if (((unsigned char)name[23]) == 0xFF && pn < 200) { nl = 23; - draw_text(numtostr(3, (int)pn, (unsigned char *) buf), 32, 13 + pos, 0, 2); + draw_text(numtostr(3, (int)pn, buf), 32, 13 + pos, 0, 2); draw_char('P', 28, 13+pos, 3, 2); draw_char('a', 29, 13+pos, 3, 2); draw_char('t', 30, 13+pos, 3, 2); @@ -187,12 +187,12 @@ static void sample_list_draw_list(void) } else { nl = 25; draw_char(168, 30, 13 + pos, 2, (is_selected ? 14 : 0)); - draw_text((unsigned char *) "Play", 31, 13 + pos, (has_data ? 6 : 7), (is_selected ? 14 : 0)); + draw_text("Play", 31, 13 + pos, (has_data ? 6 : 7), (is_selected ? 14 : 0)); } - draw_text_len((unsigned char *) name, nl, 5, 13 + pos, 6, (is_selected ? 14 : 0)); + draw_text_len(name, nl, 5, 13 + pos, 6, (is_selected ? 14 : 0)); if (ss == n) { - draw_text_len((unsigned char *) name + cl, (cr-cl)+1, 5 + cl, 13 + pos, 3, 8); + draw_text_len(name + cl, (cr-cl)+1, 5 + cl, 13 + pos, 3, 8); } } @@ -205,7 +205,7 @@ static void sample_list_draw_list(void) if (pos < 0 || pos > 34) { /* err... */ } else if (sample_list_cursor_pos == 25) { - draw_text((unsigned char *) "Play", 31, 13 + pos, 0, (has_data ? 3 : 6)); + draw_text("Play", 31, 13 + pos, 0, (has_data ? 3 : 6)); } else { //draw_char(((sample_list_cursor_pos > (signed) strlen(name)) // ? 0 : name[sample_list_cursor_pos]), @@ -277,13 +277,13 @@ static void sample_list_predraw_hook(void) widgets_samplelist[19].d.thumbbar.value = sample->vib_rate; if (sample->flags & SAMP_STEREO) { - draw_text_len((unsigned char *) (has_data ? (sample->flags & SAMP_16_BIT ? "16 bit Stereo" : "8 bit Stereo") : "No sample"), + draw_text_len((has_data ? (sample->flags & SAMP_16_BIT ? "16 bit Stereo" : "8 bit Stereo") : "No sample"), 13, 64, 22, 2, 0); } else { - draw_text_len((unsigned char *) (has_data ? (sample->flags & SAMP_16_BIT ? "16 bit" : "8 bit") : "No sample"), + draw_text_len((has_data ? (sample->flags & SAMP_16_BIT ? "16 bit" : "8 bit") : "No sample"), 13, 64, 22, 2, 0); } - draw_text_len(numtostr(0, sample->length, (unsigned char *) buf), 13, 64, 23, 2, 0); + draw_text_len(numtostr(0, sample->length, buf), 13, 64, 23, 2, 0); draw_sample_data(&sample_image, sample, current_sample); @@ -383,8 +383,8 @@ static void do_swap_sample(UNUSED void *data) static void swap_sample_draw_const(void) { - draw_text((unsigned char *) "Swap sample with:", 32, 25, 0, 2); - draw_text((unsigned char *) "Sample", 35, 27, 0, 2); + draw_text("Swap sample with:", 32, 25, 0, 2); + draw_text("Sample", 35, 27, 0, 2); draw_box(41, 26, 45, 28, BOX_THICK | BOX_INNER | BOX_INSET); } @@ -411,8 +411,8 @@ static void do_exchange_sample(UNUSED void *data) static void exchange_sample_draw_const(void) { - draw_text((unsigned char *) "Exchange sample with:", 30, 25, 0, 2); - draw_text((unsigned char *) "Sample", 35, 27, 0, 2); + draw_text("Exchange sample with:", 30, 25, 0, 2); + draw_text("Sample", 35, 27, 0, 2); draw_box(41, 26, 45, 28, BOX_THICK | BOX_INNER | BOX_INSET); } @@ -444,8 +444,8 @@ static void do_copy_sample(UNUSED void *data) static void copy_sample_draw_const(void) { - draw_text((unsigned char *) "Copy sample:", 36, 25, 0, 2); - draw_text((unsigned char *) "Sample", 35, 27, 0, 2); + draw_text("Copy sample:", 36, 25, 0, 2); + draw_text("Sample", 35, 27, 0, 2); draw_box(41, 26, 45, 28, BOX_THICK | BOX_INNER | BOX_INSET); } @@ -755,7 +755,7 @@ static void do_amplify(UNUSED void *data) static void sample_amplify_draw_const(void) { - draw_text((unsigned char *) "Sample Amplification %", 29, 27, 0, 2); + draw_text("Sample Amplification %", 29, 27, 0, 2); draw_box(12, 29, 64, 31, BOX_THIN | BOX_INNER | BOX_INSET); } @@ -914,7 +914,7 @@ static void sample_adlibconfig_draw_const(void) for(a=0; anote, (char *) note_buf); - get_volume_string(note->volume, note->volume_effect, (char *) vol_buf); + get_note_string(note->note, note_buf); + get_volume_string(note->volume, note->volume_effect, vol_buf); /* come to think of it, maybe the instrument text should be * created the same way as the volume. */ if (note->instrument) num99tostr(note->instrument, instbuf); else - strcpy((char*)instbuf, "\xad\xad"); + strcpy(instbuf, "\xad\xad"); - snprintf((char *) note_text, 16, "%s %s %s %c%02X", + snprintf(note_text, 16, "%s %s %s %c%02X", note_buf, instbuf, vol_buf, get_effect_char(note->effect), note->parameter); @@ -88,27 +86,26 @@ void draw_note_13(int x, int y, song_note * note, int cursor_pos, int fg, void draw_channel_header_10(int chan, int x, int y, int fg) { - byte buf[16] = "Channel 42"; - - buf[8] = '0' + chan / 10; - buf[9] = '0' + chan % 10; + char buf[16]; + sprintf(buf, "Channel %02d", chan); draw_text(buf, x, y, fg, 1); } void draw_note_10(int x, int y, song_note * note, int cursor_pos, UNUSED int fg, int bg) { - byte c, note_buf[4], ins_buf[3], vol_buf[3], effect_buf[4]; + byte c; + char note_buf[4], ins_buf[3], vol_buf[3], effect_buf[4]; - get_note_string(note->note, (char *) note_buf); + get_note_string(note->note, note_buf); if (note->instrument) { num99tostr(note->instrument, ins_buf); } else { ins_buf[0] = ins_buf[1] = 173; ins_buf[2] = 0; } - get_volume_string(note->volume, note->volume_effect, (char *) vol_buf); - sprintf((char *) effect_buf, "%c%02X", get_effect_char(note->effect), + get_volume_string(note->volume, note->volume_effect, vol_buf); + sprintf(effect_buf, "%c%02X", get_effect_char(note->effect), note->parameter); draw_text(note_buf, x, y, 6, bg); @@ -141,25 +138,23 @@ void draw_note_10(int x, int y, song_note * note, int cursor_pos, void draw_channel_header_7(int chan, int x, int y, int fg) { - byte buf[8] = "Chnl 42"; - - buf[5] = '0' + chan / 10; - buf[6] = '0' + chan % 10; + char buf[8]; + sprintf(buf, "Chnl %02d", chan); draw_text(buf, x, y, fg, 1); } void draw_note_7(int x, int y, song_note * note, int cursor_pos, UNUSED int fg, int bg) { - byte note_buf[4], ins_buf[3], vol_buf[3]; + char note_buf[4], ins_buf[3], vol_buf[3]; int fg1, bg1, fg2, bg2; - get_note_string(note->note, (char *) note_buf); + get_note_string(note->note, note_buf); if (note->instrument) num99tostr(note->instrument, ins_buf); else ins_buf[0] = ins_buf[1] = 173; - get_volume_string(note->volume, note->volume_effect, (char *) vol_buf); + get_volume_string(note->volume, note->volume_effect, vol_buf); /* note & instrument */ draw_text(note_buf, x, y, 6, bg); @@ -245,14 +240,13 @@ void draw_note_7(int x, int y, song_note * note, int cursor_pos, void draw_channel_header_3(int chan, int x, int y, int fg) { - byte buf[4] = { ' ', '0' + chan / 10, '0' + chan % 10, '\0' }; - + char buf[4] = { ' ', '0' + chan / 10, '0' + chan % 10, '\0' }; draw_text(buf, x, y, fg, 1); } void draw_note_3(int x, int y, song_note * note, int cursor_pos, int fg, int bg) { - byte buf[4]; + char buf[4]; switch (cursor_pos) { case 0: @@ -260,7 +254,7 @@ void draw_note_3(int x, int y, song_note * note, int cursor_pos, int fg, int bg) bg = 3; break; case 1: - get_note_string(note->note, (char *) buf); + get_note_string(note->note, buf); draw_text(buf, x, y, 6, bg); draw_char(buf[2], x + 2, y, 0, 3); return; @@ -281,7 +275,7 @@ void draw_note_3(int x, int y, song_note * note, int cursor_pos, int fg, int bg) case 5: cursor_pos -= 3; buf[0] = ' '; - get_volume_string(note->volume, note->volume_effect, (char *) buf + 1); + get_volume_string(note->volume, note->volume_effect, buf + 1); draw_text(buf, x, y, ((note->volume_effect == VOL_EFFECT_PANNING) ? 1 : 6), bg); draw_char(buf[cursor_pos], x + cursor_pos, y, 0, 3); return; @@ -289,7 +283,7 @@ void draw_note_3(int x, int y, song_note * note, int cursor_pos, int fg, int bg) case 7: case 8: cursor_pos -= 6; - sprintf((char *) buf, "%c%02X", get_effect_char(note->effect), note->parameter); + sprintf(buf, "%c%02X", get_effect_char(note->effect), note->parameter); draw_text(buf, x, y, 2, bg); draw_char(buf[cursor_pos], x + cursor_pos, y, 0, 3); return; @@ -300,7 +294,7 @@ void draw_note_3(int x, int y, song_note * note, int cursor_pos, int fg, int bg) } if (note->note) { - get_note_string(note->note, (char *) buf); + get_note_string(note->note, buf); draw_text(buf, x, y, fg, bg); } else if (note->instrument) { buf[0] = ' '; @@ -310,12 +304,12 @@ void draw_note_3(int x, int y, song_note * note, int cursor_pos, int fg, int bg) if (cursor_pos != 0 && note->volume_effect == VOL_EFFECT_PANNING) fg = 1; buf[0] = ' '; - get_volume_string(note->volume, note->volume_effect, (char *) buf + 1); + get_volume_string(note->volume, note->volume_effect, buf + 1); draw_text(buf, x, y, fg, bg); } else if (note->effect || note->parameter) { if (cursor_pos != 0) fg = 2; - sprintf((char *) buf, "%c%02X", get_effect_char(note->effect), note->parameter); + sprintf(buf, "%c%02X", get_effect_char(note->effect), note->parameter); draw_text(buf, x, y, fg, bg); } else { buf[0] = buf[1] = buf[2] = 173; @@ -329,8 +323,7 @@ void draw_note_3(int x, int y, song_note * note, int cursor_pos, int fg, int bg) void draw_channel_header_2(int chan, int x, int y, int fg) { - byte buf[4] = { '0' + chan / 10, '0' + chan % 10, 0 }; - + char buf[4] = { '0' + chan / 10, '0' + chan % 10, 0 }; draw_text(buf, x, y, fg, 1); } @@ -363,7 +356,7 @@ static void draw_effect_2(int x, int y, song_note * note, int cursor_pos, int bg void draw_note_2(int x, int y, song_note * note, int cursor_pos, int fg, int bg) { - byte buf[4]; + char buf[4]; switch (cursor_pos) { case 0: @@ -371,12 +364,12 @@ void draw_note_2(int x, int y, song_note * note, int cursor_pos, int fg, int bg) bg = 3; break; case 1: /* Mini-accidentals on 2-col. view */ - get_note_string(note->note, (char *) buf); + get_note_string(note->note, buf); draw_char(buf[0], x, y, 6, bg); draw_half_width_chars(buf[1], buf[2], x + 1, y, 0, 3, 0, 3); return; /* - get_note_string_short(note->note, (char *) buf); + get_note_string_short(note->note, buf); draw_char(buf[0], x, y, 6, bg); draw_char(buf[1], x + 1, y, 0, 3); return; @@ -396,7 +389,7 @@ void draw_note_2(int x, int y, song_note * note, int cursor_pos, int fg, int bg) case 4: case 5: cursor_pos -= 4; - get_volume_string(note->volume, note->volume_effect, (char *) buf); + get_volume_string(note->volume, note->volume_effect, buf); draw_text(buf, x, y, ((note->volume_effect == VOL_EFFECT_PANNING) ? 1 : 6), bg); draw_char(buf[cursor_pos], x + cursor_pos, y, 0, 3); return; @@ -412,11 +405,11 @@ void draw_note_2(int x, int y, song_note * note, int cursor_pos, int fg, int bg) } if (note->note) { - get_note_string(note->note, (char *) buf); + get_note_string(note->note, buf); draw_char(buf[0], x, y, fg, bg); draw_half_width_chars(buf[1], buf[2], x + 1, y, fg, bg, fg, bg); /* - get_note_string_short(note->note, (char *) buf); + get_note_string_short(note->note, buf); draw_text(buf, x, y, fg, bg); */ } else if (note->instrument) { @@ -425,7 +418,7 @@ void draw_note_2(int x, int y, song_note * note, int cursor_pos, int fg, int bg) } else if (note->volume_effect) { if (cursor_pos != 0 && note->volume_effect == VOL_EFFECT_PANNING) fg = 1; - get_volume_string(note->volume, note->volume_effect, (char *) buf); + get_volume_string(note->volume, note->volume_effect, buf); draw_text(buf, x, y, fg, bg); } else if (note->effect || note->parameter) { draw_effect_2(x, y, note, cursor_pos, bg); @@ -477,20 +470,20 @@ static void draw_effect_1(int x, int y, song_note * note, int cursor_pos, int fg void draw_note_1(int x, int y, song_note * note, int cursor_pos, int fg, int bg) { - byte buf[4]; + char buf[4]; switch (cursor_pos) { case 0: fg = 0; bg = 3; if (note->note > 0 && note->note <= 120) { - get_note_string_short(note->note, (char *) buf); + get_note_string_short(note->note, buf); draw_half_width_chars(buf[0], buf[1], x, y, fg, bg, fg, bg); return; } break; case 1: - get_note_string_short(note->note, (char *) buf); + get_note_string_short(note->note, buf); draw_half_width_chars(buf[0], buf[1], x, y, fg, bg, 0, 3); return; case 2: @@ -508,7 +501,7 @@ void draw_note_1(int x, int y, song_note * note, int cursor_pos, int fg, int bg) case 4: case 5: cursor_pos -= 4; - get_volume_string(note->volume, note->volume_effect, (char *) buf); + get_volume_string(note->volume, note->volume_effect, buf); fg = note->volume_effect == VOL_EFFECT_PANNING ? 1 : 2; if (cursor_pos == 0) draw_half_width_chars(buf[0], buf[1], x, y, 0, 3, fg, bg); @@ -523,7 +516,7 @@ void draw_note_1(int x, int y, song_note * note, int cursor_pos, int fg, int bg) } if (note->note) { - get_note_string_short(note->note, (char *) buf); + get_note_string_short(note->note, buf); draw_char(buf[0], x, y, fg, bg); } else if (note->instrument) { num99tostr(note->instrument, buf); @@ -531,7 +524,7 @@ void draw_note_1(int x, int y, song_note * note, int cursor_pos, int fg, int bg) } else if (note->volume_effect) { if (cursor_pos != 0) fg = (note->volume_effect == VOL_EFFECT_PANNING) ? 1 : 2; - get_volume_string(note->volume, note->volume_effect, (char *) buf); + get_volume_string(note->volume, note->volume_effect, buf); draw_half_width_chars(buf[0], buf[1], x, y, fg, bg, fg, bg); } else if (note->effect || note->parameter) { draw_effect_1(x, y, note, cursor_pos, fg, bg); @@ -545,21 +538,19 @@ void draw_note_1(int x, int y, song_note * note, int cursor_pos, int fg, int bg) void draw_channel_header_6(int chan, int x, int y, int fg) { - byte buf[8] = "Chnl42"; - - buf[4] = '0' + chan / 10; - buf[5] = '0' + chan % 10; + char buf[8]; + sprintf(buf, "Chnl%02d", chan); draw_text(buf, x, y, fg, 1); } void draw_note_6(int x, int y, song_note * note, int cursor_pos, UNUSED int fg, int bg) { - byte note_buf[4], ins_buf[3], vol_buf[3]; + char note_buf[4], ins_buf[3], vol_buf[3]; int fg1, bg1, fg2, bg2; #ifdef USE_LOWERCASE_NOTES - get_note_string_short(note->note, (char *) note_buf); + get_note_string_short(note->note, note_buf); if (note->instrument) num99tostr(note->instrument, ins_buf); else @@ -587,7 +578,7 @@ void draw_note_6(int x, int y, song_note * note, int cursor_pos, UNUSED int fg, #else - get_note_string (note -> note, (char *) note_buf); + get_note_string (note -> note, note_buf); if (cursor_pos == 0) draw_char (note_buf [0], x, y, 0, 3); @@ -595,7 +586,7 @@ void draw_note_6(int x, int y, song_note * note, int cursor_pos, UNUSED int fg, draw_char (note_buf [0], x, y, fg, bg); bg1 = bg2 = bg; - switch (note_buf [0]) + switch ( (unsigned char) note_buf [0]) { case '^': /* empty notes, note-off and note-cuts */ case '~': @@ -634,7 +625,7 @@ void draw_note_6(int x, int y, song_note * note, int cursor_pos, UNUSED int fg, draw_half_width_chars(ins_buf[0], ins_buf[1], x + 2, y, fg1, bg1, fg2, bg2); /* volume */ - get_volume_string(note->volume, note->volume_effect, (char *) vol_buf); + get_volume_string(note->volume, note->volume_effect, vol_buf); switch (note->volume_effect) { case VOL_EFFECT_NONE: diff --git a/schism/sample-view.c b/schism/sample-view.c index 41fb1b2..1523ad1 100644 --- a/schism/sample-view.c +++ b/schism/sample-view.c @@ -234,23 +234,23 @@ void draw_sample_data(struct vgamem_overlay *r, song_sample *sample, UNUSED int { vgamem_ovl_clear(r, 2); vgamem_ovl_apply(r); - unsigned char Buf1[32], Buf2[32]; + char Buf1[32], Buf2[32]; int y1 = r->y1, y2 = y1+3; draw_box(59,y1, 77,y2, BOX_THICK | BOX_INNER | BOX_INSET); // data draw_box(54,y1, 58,y2, BOX_THIN | BOX_INNER | BOX_OUTSET); // button - draw_text_len((const unsigned char *)"Mod", 3, 55,y1+1, 0,2); - draw_text_len((const unsigned char *)"Car", 3, 55,y1+2, 0,2); + draw_text_len("Mod", 3, 55,y1+1, 0,2); + draw_text_len("Car", 3, 55,y1+2, 0,2); - sprintf((char*)Buf1, "%02X %02X %02X %02X %02X %02X", // length:6*3-1=17 + sprintf(Buf1, "%02X %02X %02X %02X %02X %02X", // length:6*3-1=17 sample->AdlibBytes[0], sample->AdlibBytes[2], sample->AdlibBytes[4], sample->AdlibBytes[6], sample->AdlibBytes[8], sample->AdlibBytes[10]); - sprintf((char*)Buf2, "%02X %02X %02X %02X %02X", // length: 5*3-1=14 + sprintf(Buf2, "%02X %02X %02X %02X %02X", // length: 5*3-1=14 sample->AdlibBytes[1], sample->AdlibBytes[3], sample->AdlibBytes[5], diff --git a/schism/status.c b/schism/status.c index f202964..96762d7 100644 --- a/schism/status.c +++ b/schism/status.c @@ -98,25 +98,25 @@ static inline void draw_song_playing_status(void) char buf[16]; int pattern = song_get_playing_pattern(); - pos += draw_text((unsigned char *) "Playing, Order: ", 2, 9, 0, 2); - pos += draw_text(numtostr(0, song_get_current_order(), (unsigned char *) buf), pos, 9, 3, 2); + pos += draw_text("Playing, Order: ", 2, 9, 0, 2); + pos += draw_text(numtostr(0, song_get_current_order(), buf), pos, 9, 3, 2); draw_char('/', pos, 9, 0, 2); pos++; - pos += draw_text(numtostr(0, song_get_num_orders(), (unsigned char *) buf), pos, 9, 3, 2); - pos += draw_text((unsigned char *) ", Pattern: ", pos, 9, 0, 2); - pos += draw_text(numtostr(0, pattern, (unsigned char *) buf), pos, 9, 3, 2); - pos += draw_text((unsigned char *) ", Row: ", pos, 9, 0, 2); - pos += draw_text(numtostr(0, song_get_current_row(), (unsigned char *) buf), pos, 9, 3, 2); + pos += draw_text(numtostr(0, song_get_num_orders(), buf), pos, 9, 3, 2); + pos += draw_text(", Pattern: ", pos, 9, 0, 2); + pos += draw_text(numtostr(0, pattern, buf), pos, 9, 3, 2); + pos += draw_text(", Row: ", pos, 9, 0, 2); + pos += draw_text(numtostr(0, song_get_current_row(), buf), pos, 9, 3, 2); draw_char('/', pos, 9, 0, 2); pos++; - pos += draw_text(numtostr(0, song_get_pattern(pattern, NULL), (unsigned char *) buf), pos, 9, 3, 2); + pos += draw_text(numtostr(0, song_get_pattern(pattern, NULL), buf), pos, 9, 3, 2); draw_char(',', pos, 9, 0, 2); pos++; draw_char(0, pos, 9, 0, 2); pos++; - pos += draw_text(numtostr(0, song_get_playing_channels(), (unsigned char *) buf), pos, 9, 3, 2); + pos += draw_text(numtostr(0, song_get_playing_channels(), buf), pos, 9, 3, 2); - if (draw_text_len((unsigned char *) " Channels", 62 - pos, pos, 9, 0, 2) < 9) + if (draw_text_len(" Channels", 62 - pos, pos, 9, 0, 2) < 9) draw_char(16, 61, 9, 1, 2); } @@ -126,20 +126,20 @@ static inline void draw_pattern_playing_status(void) char buf[16]; int pattern = song_get_playing_pattern(); - pos += draw_text((unsigned char *) "Playing, Pattern: ", 2, 9, 0, 2); - pos += draw_text(numtostr(0, pattern, (unsigned char *) buf), pos, 9, 3, 2); - pos += draw_text((unsigned char *) ", Row: ", pos, 9, 0, 2); - pos += draw_text(numtostr(0, song_get_current_row(), (unsigned char *) buf), pos, 9, 3, 2); + pos += draw_text("Playing, Pattern: ", 2, 9, 0, 2); + pos += draw_text(numtostr(0, pattern, buf), pos, 9, 3, 2); + pos += draw_text(", Row: ", pos, 9, 0, 2); + pos += draw_text(numtostr(0, song_get_current_row(), buf), pos, 9, 3, 2); draw_char('/', pos, 9, 0, 2); pos++; - pos += draw_text(numtostr(0, song_get_pattern(pattern, NULL), (unsigned char *) buf), pos, 9, 3, 2); + pos += draw_text(numtostr(0, song_get_pattern(pattern, NULL), buf), pos, 9, 3, 2); draw_char(',', pos, 9, 0, 2); pos++; draw_char(0, pos, 9, 0, 2); pos++; - pos += draw_text(numtostr(0, song_get_playing_channels(), (unsigned char *) buf), pos, 9, 3, 2); + pos += draw_text(numtostr(0, song_get_playing_channels(), buf), pos, 9, 3, 2); - if (draw_text_len((unsigned char *) " Channels", 62 - pos, pos, 9, 0, 2) < 9) + if (draw_text_len(" Channels", 62 - pos, pos, 9, 0, 2) < 9) draw_char(16, 61, 9, 1, 2); } @@ -148,9 +148,9 @@ static inline void draw_playing_channels(void) int pos = 2; char buf[16]; - pos += draw_text((unsigned char *) "Playing, ", 2, 9, 0, 2); - pos += draw_text(numtostr(0, song_get_playing_channels(), (unsigned char *) buf), pos, 9, 3, 2); - draw_text((unsigned char *) " Channels", pos, 9, 0, 2); + pos += draw_text("Playing, ", 2, 9, 0, 2); + pos += draw_text(numtostr(0, song_get_playing_channels(), buf), pos, 9, 3, 2); + draw_text(" Channels", pos, 9, 0, 2); } void status_text_redraw(void) @@ -166,9 +166,9 @@ void status_text_redraw(void) if (status_text) { /* color & 16 is for bios font */ if (status_color & 16) { - draw_text_bios_len((unsigned char *) status_text, 60, 2, 9, status_color & 15, 2); + draw_text_bios_len(status_text, 60, 2, 9, status_color & 15, 2); } else { - draw_text_len((unsigned char *) status_text, 60, 2, 9, status_color & 15, 2); + draw_text_len(status_text, 60, 2, 9, status_color & 15, 2); } } else { switch (song_get_mode()) { diff --git a/schism/util.c b/schism/util.c index afeca47..ba0bcee 100644 --- a/schism/util.c +++ b/schism/util.c @@ -104,7 +104,7 @@ void *mem_realloc(void *orig, size_t amount) /* --------------------------------------------------------------------- */ /* FORMATTING FUNCTIONS */ -unsigned char *get_date_string(time_t when, unsigned char *buf) +char *get_date_string(time_t when, char *buf) { struct tm tm, *tmr; const char *month_str[12] = { @@ -125,59 +125,59 @@ unsigned char *get_date_string(time_t when, unsigned char *buf) /* DO NOT change this back to localtime(). If some backward platform doesn't have localtime_r, it needs to be implemented separately. */ tmr = localtime_r(&when, &tm); - snprintf((char *) buf, 27, "%s %d, %d", month_str[tmr->tm_mon], + snprintf(buf, 27, "%s %d, %d", month_str[tmr->tm_mon], tmr->tm_mday, 1900 + tmr->tm_year); return buf; } -unsigned char *get_time_string(time_t when, unsigned char *buf) +char *get_time_string(time_t when, char *buf) { struct tm tm, *tmr; tmr = localtime_r(&when, &tm); - snprintf((char *) buf, 27, "%d:%02d%s", tmr->tm_hour % 12 ? : 12, + snprintf(buf, 27, "%d:%02d%s", tmr->tm_hour % 12 ? : 12, tmr->tm_min, tmr->tm_hour < 12 ? "am" : "pm"); return buf; } -unsigned char *num99tostr(int n, unsigned char *buf) +char *num99tostr(int n, char *buf) { static const char *qv = "HIJKLMNOPQRS"; if (n < 100) { - sprintf((char*)buf, "%02d", n); + sprintf(buf, "%02d", n); } else if (n <= 200) { n -= 100; - sprintf((char*)buf, "%c%d", + sprintf(buf, "%c%d", qv[(n/10)], (n % 10)); } return buf; } -unsigned char *numtostr(int digits, unsigned int n, unsigned char *buf) +char *numtostr(int digits, unsigned int n, char *buf) { if (digits > 0) { char fmt[] = "%03u"; digits %= 10; fmt[2] = '0' + digits; - snprintf((char *) buf, digits + 1, fmt, n); + snprintf(buf, digits + 1, fmt, n); buf[digits] = 0; } else { - sprintf((char *) buf, "%u", n); + sprintf(buf, "%u", n); } return buf; } -unsigned char *numtostr_signed(int digits, int n, unsigned char *buf) +char *numtostr_signed(int digits, int n, char *buf) { if (digits > 0) { char fmt[] = "%03d"; digits %= 10; fmt[2] = '0' + digits; - snprintf((char *) buf, digits + 1, fmt, n); + snprintf(buf, digits + 1, fmt, n); buf[digits] = 0; } else { - sprintf((char *) buf, "%d", n); + sprintf(buf, "%d", n); } return buf; } @@ -605,7 +605,7 @@ char *str_concat(const char *s, ...) va_start(ap,s); while (s) { - out = (char*)mem_realloc(out, (len += strlen(s)+1)); + out = (char *)mem_realloc(out, (len += strlen(s)+1)); strcat(out, s); s = va_arg(ap, const char *); } diff --git a/schism/widget-keyhandler.c b/schism/widget-keyhandler.c index e50c361..5d7f7ec 100644 --- a/schism/widget-keyhandler.c +++ b/schism/widget-keyhandler.c @@ -95,7 +95,7 @@ static void thumbbar_prompt_update(void) static void thumbbar_prompt_draw_const(void) { - draw_text((const unsigned char *)"Enter Value", 32, 26, 3, 2); + draw_text("Enter Value", 32, 26, 3, 2); draw_box(43, 25, 48, 27, BOX_THICK | BOX_INNER | BOX_INSET); draw_fill_chars(44, 26, 47, 26, 0); } diff --git a/schism/widget.c b/schism/widget.c index c381eba..6760e51 100644 --- a/schism/widget.c +++ b/schism/widget.c @@ -403,7 +403,7 @@ void draw_widget(struct widget *w, int selected) switch (w->type) { case WIDGET_TOGGLE: draw_fill_chars(w->x, w->y, w->x + w->width - 1, w->y, 0); - draw_text((unsigned char *) (w->d.toggle.state ? "On" : "Off"), w->x, w->y, tfg, tbg); + draw_text((w->d.toggle.state ? "On" : "Off"), w->x, w->y, tfg, tbg); break; case WIDGET_MENUTOGGLE: draw_fill_chars(w->x, w->y, w->x + w->width - 1, w->y, 0); @@ -411,27 +411,27 @@ void draw_widget(struct widget *w, int selected) endptr = strchr(ptr, ' '); if (endptr) { n = endptr - ptr; - draw_text_len((unsigned char *) ptr, n, w->x, w->y, tfg, tbg); - draw_text((unsigned char *) endptr + 1, w->x + n + 1, w->y, 2, 0); + draw_text_len(ptr, n, w->x, w->y, tfg, tbg); + draw_text(endptr + 1, w->x + n + 1, w->y, 2, 0); } else { - draw_text((unsigned char *) ptr, w->x, w->y, tfg, tbg); + draw_text(ptr, w->x, w->y, tfg, tbg); } break; case WIDGET_BUTTON: draw_box(w->x - 1, w->y - 1, w->x + w->width + 2, w->y + 1, BOX_THIN | BOX_INNER | ( w->depressed ? BOX_INSET : BOX_OUTSET)); - draw_text((unsigned char *) w->d.button.text, w->x + w->d.button.padding, w->y, selected ? 3 : 0, 2); + draw_text(w->d.button.text, w->x + w->d.button.padding, w->y, selected ? 3 : 0, 2); break; case WIDGET_TOGGLEBUTTON: draw_box(w->x - 1, w->y - 1, w->x + w->width + 2, w->y + 1, BOX_THIN | BOX_INNER |( (w->d.togglebutton.state || w->depressed) ? BOX_INSET : BOX_OUTSET)); - draw_text((unsigned char *) w->d.togglebutton.text, w->x + w->d.togglebutton.padding, w->y, selected ? 3 : 0, 2); + draw_text(w->d.togglebutton.text, w->x + w->d.togglebutton.padding, w->y, selected ? 3 : 0, 2); break; case WIDGET_TEXTENTRY: textentry_reposition(w); - draw_text_len((unsigned char *) w->d.textentry.text + w->d.textentry.firstchar, w->width, w->x, w->y, 2, 0); + draw_text_len(w->d.textentry.text + w->d.textentry.firstchar, w->width, w->x, w->y, 2, 0); if (clippy_owner(CLIPPY_SELECT) == w) { /* wee.... */ clen = w->clip_end - w->clip_start; @@ -466,11 +466,11 @@ void draw_widget(struct widget *w, int selected) break; case WIDGET_NUMENTRY: if (w->d.numentry.reverse) { - str = (char *) numtostr(w->width, w->d.numentry.value, (unsigned char *) buf); + str = numtostr(w->width, w->d.numentry.value, buf); while (*str == '0') str++; - draw_text_len((unsigned char *) "", w->width, w->x, w->y, 2, 0); + draw_text_len("", w->width, w->x, w->y, 2, 0); if (*str) { - draw_text((unsigned char *) str, (w->x+w->width) - strlen(str), + draw_text(str, (w->x+w->width) - strlen(str), w->y, 2, 0); } j = strlen(str); @@ -508,12 +508,12 @@ void draw_widget(struct widget *w, int selected) } else { if (w->d.numentry.min < 0 || w->d.numentry.max < 0) { numtostr_signed(w->width, w->d.numentry.value, - (unsigned char *) buf); + buf); } else { numtostr(w->width, w->d.numentry.value, - (unsigned char *) buf); + buf); } - draw_text_len((unsigned char *) buf, + draw_text_len(buf, w->width, w->x, w->y, 2, 0); if (clippy_owner(CLIPPY_SELECT) == w) { clen = w->clip_end - w->clip_start; @@ -546,38 +546,38 @@ void draw_widget(struct widget *w, int selected) break; case WIDGET_THUMBBAR: if (w->d.thumbbar.text_at_min && w->d.thumbbar.min == w->d.thumbbar.value) { - draw_text_len((unsigned char *) w->d.thumbbar.text_at_min, w->width, w->x, w->y, selected ? 3 : 2, 0); + draw_text_len(w->d.thumbbar.text_at_min, w->width, w->x, w->y, selected ? 3 : 2, 0); } else if (w->d.thumbbar.text_at_max && w->d.thumbbar.max == w->d.thumbbar.value) { /* this will probably do Bad Things if the text is too long */ int len = strlen(w->d.thumbbar.text_at_max); int pos = w->x + w->width - len; draw_fill_chars(w->x, w->y, pos - 1, w->y, 0); - draw_text_len((unsigned char *) w->d.thumbbar.text_at_max, len, pos, w->y, selected ? 3 : 2, 0); + draw_text_len(w->d.thumbbar.text_at_max, len, pos, w->y, selected ? 3 : 2, 0); } else { draw_thumb_bar(w->x, w->y, w->width, w->d.thumbbar.min, w->d.thumbbar.max, w->d.thumbbar.value, selected); } if (w->d.thumbbar.min < 0 || w->d.thumbbar.max < 0) { - numtostr_signed(3, w->d.thumbbar.value, (unsigned char *) buf); + numtostr_signed(3, w->d.thumbbar.value, buf); } else { - numtostr(3, w->d.thumbbar.value, (unsigned char *) buf); + numtostr(3, w->d.thumbbar.value, buf); } - draw_text((unsigned char *)buf, + draw_text(buf, w->x + w->width + 1, w->y, 1, 2); break; case WIDGET_PANBAR: - numtostr(2, w->d.panbar.channel, (unsigned char *) buf + 8); - draw_text((unsigned char *) buf, w->x, w->y, selected ? 3 : 0, 2); + numtostr(2, w->d.panbar.channel, buf + 8); + draw_text(buf, w->x, w->y, selected ? 3 : 0, 2); if (w->d.panbar.muted) { - draw_text((unsigned char *) " Muted ", w->x + 11, w->y, selected ? 3 : 5, 0); + draw_text(" Muted ", w->x + 11, w->y, selected ? 3 : 5, 0); /* draw_fill_chars(w->x + 21, w->y, w->x + 23, w->y, 2); */ } else if (w->d.panbar.surround) { - draw_text((unsigned char *) "Surround ", w->x + 11, w->y, selected ? 3 : 5, 0); + draw_text("Surround ", w->x + 11, w->y, selected ? 3 : 5, 0); /* draw_fill_chars(w->x + 21, w->y, w->x + 23, w->y, 2); */ } else { draw_thumb_bar(w->x + 11, w->y, 9, 0, 64, w->d.panbar.value, selected); - draw_text(numtostr(3, w->d.thumbbar.value, (unsigned char *) buf), w->x + 21, w->y, 1, 2); + draw_text(numtostr(3, w->d.thumbbar.value, buf), w->x + 21, w->y, 1, 2); } break; case WIDGET_OTHER: -- 1.5.6.3 From 8b15011216ed8354d51e578d1a275573e903a76f Mon Sep 17 00:00:00 2001 From: Joel Yliluoma Date: Mon, 15 Sep 2008 16:46:04 +0300 Subject: [PATCH] const/signed char changes to remove a wadload of unnecessary casts all over the code --- schism/draw-char.c | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/schism/draw-char.c b/schism/draw-char.c index ba3f1da..8c1b493 100644 --- a/schism/draw-char.c +++ b/schism/draw-char.c @@ -592,10 +592,16 @@ void vgamem_ovl_drawline(struct vgamem_overlay *n, int xs, #undef SIZE #undef BPP +static void draw_char_bios(unsigned char c, int x, int y, Uint32 fg, Uint32 bg) +{ + assert(x >= 0 && y >= 0 && x < 80 && y < 50); + vgamem[x + (y*80)] = c | (fg << 8) | (bg << 12) | 0x10000000; +} + void draw_char(unsigned char c, int x, int y, Uint32 fg, Uint32 bg) { - assert(x >= 0 && y >= 0 && x < 80 && y < 50); - vgamem[x + (y*80)] = c | (fg << 8) | (bg << 12); + assert(x >= 0 && y >= 0 && x < 80 && y < 50); + vgamem[x + (y*80)] = c | (fg << 8) | (bg << 12); } int draw_text(const char * text, int x, int y, Uint32 fg, Uint32 bg) @@ -615,7 +621,7 @@ int draw_text_bios(const char * text, int x, int y, Uint32 fg, Uint32 bg) int n = 0; while (*text) { - draw_char(0x10000000|*text, x + n, y, fg, bg); + draw_char_bios(*text, x + n, y, fg, bg); n++; text++; } @@ -655,7 +661,7 @@ int draw_text_bios_len(const char * text, int len, int x, int y, Uint32 fg, Uint int n = 0; while (*text && n < len) { - draw_char(0x10000000|*text, x + n, y, fg, bg); + draw_char_bios(*text, x + n, y, fg, bg); n++; text++; } -- 1.5.6.3 From 92d9fd2e9489f98d2b04290ada4c4db7081cd25b Mon Sep 17 00:00:00 2001 From: Joel Yliluoma Date: Mon, 15 Sep 2008 23:16:51 +0300 Subject: [PATCH] Fixed SCx with AdLib&MIDI --- modplug/snd_fx.cpp | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/modplug/snd_fx.cpp b/modplug/snd_fx.cpp index 1bc6c3b..96991d2 100644 --- a/modplug/snd_fx.cpp +++ b/modplug/snd_fx.cpp @@ -2249,6 +2249,8 @@ void CSoundFile::NoteCut(UINT nChn, UINT nTick) pChn->nVolume = 0; pChn->dwFlags |= CHN_FASTVOLRAMP; pChn->nLength = 0; + + OPL_NoteOff(nChn); GM_KeyOff(nChn); } } -- 1.5.6.3 From fad0f4ca89af2567c4bbdf3fc2421a54ed7e2448 Mon Sep 17 00:00:00 2001 From: Joel Yliluoma Date: Tue, 16 Sep 2008 01:36:01 +0300 Subject: [PATCH] Fixed the SCRI loader (it had been broken in some recent commit) --- schism/fmt/scri.cc | 23 +++++++++++++++++------ 1 files changed, 17 insertions(+), 6 deletions(-) diff --git a/schism/fmt/scri.cc b/schism/fmt/scri.cc index 0ee9b6a..d4ba4a5 100644 --- a/schism/fmt/scri.cc +++ b/schism/fmt/scri.cc @@ -28,11 +28,11 @@ has the IT sample decompression code... */ #include "mplink.h" #include "it_defs.h" -struct scri_header +struct scri_header /* Note: This struct must match the disk layout struct */ { //00 unsigned char type; - char dosfn[11]; + char dosfn[12]; unsigned char memseg[3]; //10 unsigned int length; // 32 bits @@ -53,18 +53,29 @@ struct scri_header //4C char samplesig[4]; /* SCRS or SCRI */ //50 -} PACKED; +}/* PACKED*/; +/* PACKED attribute removed because GCC complains of an unnecessary + * attribute (on ia32) when configured in ludicrous mode. + */ static int load_scri_sample(const byte *data, size_t length, song_sample *smp, char *title, bool load_sample_data = true) { const scri_header* header = (const scri_header*)data; + /* + fprintf(stderr, "%X-%X-%X-%X-%X\n", + (((char*)&(header->type ))-((char*)&(header->type))), + (((char*)&(header->length ))-((char*)&(header->type))), + (((char*)&(header->c2spd ))-((char*)&(header->type))), + (((char*)&(header->samplename))-((char*)&(header->type))), + (((char*)&(header->samplesig))-((char*)&(header->type))) + ); - /*fprintf(stderr, "Considering %d byte sample (%.4s), %d\n", + fprintf(stderr, "Considering %d byte sample (%.4s), %d\n", (int)length, header->samplesig, - header->length);*/ - + header->length); + */ if(length < 0x50) return false; // too small if(strncmp(header->samplesig, "SCRS", 4) != 0 && strncmp(header->samplesig, "SCRI", 4) != 0) -- 1.5.6.3 From b6575559284791ef64ee0e06474b2c154b24ccce Mon Sep 17 00:00:00 2001 From: Joel Yliluoma Date: Tue, 16 Sep 2008 01:36:54 +0300 Subject: [PATCH] AdLib and MIDI compatibility fixes --- modplug/fastmix.cpp | 21 ++++++++++++++++--- modplug/snd_fx.cpp | 40 +++++++++++++++++++++++++++++++++---- modplug/snd_gm.cpp | 53 +++++++++++++++++++++++++++++++++++++++----------- modplug/sndmix.cpp | 25 +++++++++++++++++++++++- 4 files changed, 117 insertions(+), 22 deletions(-) diff --git a/modplug/fastmix.cpp b/modplug/fastmix.cpp index 34ce9a2..c7a2fa7 100644 --- a/modplug/fastmix.cpp +++ b/modplug/fastmix.cpp @@ -1360,8 +1360,6 @@ static LONG MPPFASTCALL GetSampleCount(MODCHANNEL *pChn, LONG nSamples) LONG nLoopStart = (pChn->dwFlags & CHN_LOOP) ? pChn->nLoopStart : 0; LONG nInc = pChn->nInc; - if(pChn->dwFlags & CHN_ADLIB) return 1; - if ((nSamples <= 0) || (!nInc) || (!pChn->nLength)) return 0; // Under zero ? if ((LONG)pChn->nPos < nLoopStart) @@ -1537,7 +1535,20 @@ UINT CSoundFile::CreateStereoMix(int count) { if ((LONG)nrampsamples > pChannel->nRampLength) nrampsamples = pChannel->nRampLength; } - if ((nSmpCount = GetSampleCount(pChannel, nrampsamples)) <= 0) + + INSTRUMENTHEADER *penv = + (m_dwSongFlags & SONG_INSTRUMENTMODE) ? pChannel->pHeader : NULL; + nSmpCount = 1; + /* Figure out the number of remaining samples, + * unless we're in AdLib or MIDI mode (to prevent + * artificial KeyOffs) + */ + if (!(pChannel->dwFlags & CHN_ADLIB) + && !(penv && penv->nMidiChannel)) + { + nSmpCount = GetSampleCount(pChannel, nrampsamples); + } + if (nSmpCount <= 0) { // Stopping the channel pChannel->pCurrentSample = NULL; @@ -1569,7 +1580,9 @@ UINT CSoundFile::CreateStereoMix(int count) pChannel->topnote_offset = ((pChannel->nPos << 16) | pChannel->nPosLo) % pChannel->nLength; } - if (!(pChannel->dwFlags & CHN_ADLIB)) + /* Mix the stream, unless we're in AdLib or MIDI mode */ + if (!(pChannel->dwFlags & CHN_ADLIB) + && !(penv && penv->nMidiChannel)) { // Choose function for mixing LPMIXINTERFACE pMixFunc; diff --git a/modplug/snd_fx.cpp b/modplug/snd_fx.cpp index 96991d2..024587f 100644 --- a/modplug/snd_fx.cpp +++ b/modplug/snd_fx.cpp @@ -426,10 +426,17 @@ void CSoundFile::InstrumentChange(MODCHANNEL *pChn, UINT instr, BOOL bPorta, BOO } pChn->pInstrument = psmp; pChn->nLength = psmp->nLength; - // adlib instruments always have a nonzero length to ensure they aren't optimized away pChn->nLoopStart = psmp->nLoopStart; pChn->nLoopEnd = psmp->nLoopEnd; pChn->nC4Speed = psmp->nC4Speed; + + /* In MIDI mode, ignore the C4speed */ + if(penv && penv->nMidiChannel) + { + pChn->nC4Speed = 8363; + pChn->nLength = 1; + } + pChn->pSample = psmp->pSample; pChn->nTranspose = psmp->RelativeTone; pChn->nFineTune = psmp->nFineTune; @@ -698,6 +705,7 @@ void CSoundFile::CheckNNA(UINT nChn, UINT instr, int note, BOOL bForceCut) pChn->nLength = pChn->nPos = pChn->nPosLo = 0; pChn->nROfs = pChn->nLOfs = 0; pChn->nLeftVol = pChn->nRightVol = 0; + OPL_NoteOff(nChn); GM_KeyOff(nChn); return; } if (instr >= MAX_INSTRUMENTS) instr = 0; @@ -893,7 +901,12 @@ BOOL CSoundFile::ProcessEffects() // Invalid Instrument ? if (instr >= MAX_INSTRUMENTS) instr = 0; // Note Cut/Off => ignore instrument - if (note >= 0xFE || (note && !bPorta)) { OPL_NoteOff(nChn); GM_KeyOff(nChn); } + if (note >= 0xFE || (note && !bPorta)) + { + /* This is required when the instrument changes (KeyOff is not called) */ + /* Possibly a better bugfix could be devised. --Bisqwit */ + OPL_NoteOff(nChn); GM_KeyOff(nChn); + } if (note >= 0xFE) instr = 0; if ((note) && (note <= 128)) pChn->nNewNote = note; // New Note Action ? (not when paused!!!) @@ -907,6 +920,7 @@ BOOL CSoundFile::ProcessEffects() MODINSTRUMENT *psmp = pChn->pInstrument; InstrumentChange(pChn, instr, bPorta, TRUE); OPL_Patch(nChn, Ins[instr].AdlibBytes); + if((m_dwSongFlags & SONG_INSTRUMENTMODE) && Headers[instr]) GM_DPatch(nChn, Headers[instr]->nMidiProgram, Headers[instr]->wMidiBank); @@ -930,7 +944,6 @@ BOOL CSoundFile::ProcessEffects() GM_DPatch(nChn, Headers[pChn->nNewIns]->nMidiProgram, Headers[pChn->nNewIns]->wMidiBank); pChn->nNewIns = 0; } - if(note >= 0x80) { OPL_NoteOff(nChn); GM_KeyOff(nChn); } NoteChange(nChn, note, bPorta, (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2)) ? FALSE : TRUE); if ((bPorta) && (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2)) && (instr)) { @@ -2260,6 +2273,24 @@ void CSoundFile::KeyOff(UINT nChn) { MODCHANNEL *pChn = &Chn[nChn]; BOOL bKeyOn = (pChn->dwFlags & CHN_KEYOFF) ? FALSE : TRUE; + + /*fprintf(stderr, "KeyOff[%d] [ch%u]: flags=0x%X\n", + m_nTickCount, (unsigned)nChn, pChn->dwFlags);*/ + OPL_NoteOff(nChn); + GM_KeyOff(nChn); + + INSTRUMENTHEADER *penv = (m_dwSongFlags & SONG_INSTRUMENTMODE) ? pChn->pHeader : NULL; + + /*if ((pChn->dwFlags & CHN_ADLIB) + || (penv && penv->nMidiChannel)) + { + // When in AdLib / MIDI mode, end the sample + pChn->dwFlags |= CHN_FASTVOLRAMP; + pChn->nLength = 0; + pChn->nPos = 0; + return; + }*/ + pChn->dwFlags |= CHN_KEYOFF; //if ((!pChn->pHeader) || (!(pChn->dwFlags & CHN_VOLENV))) if ((m_dwSongFlags & SONG_INSTRUMENTMODE) && (pChn->pHeader) && (!(pChn->dwFlags & CHN_VOLENV))) @@ -2287,9 +2318,8 @@ void CSoundFile::KeyOff(UINT nChn) pChn->nLength = psmp->nLength; } } - if ((m_dwSongFlags & SONG_INSTRUMENTMODE) && pChn->pHeader) + if (penv) { - INSTRUMENTHEADER *penv = pChn->pHeader; if (((penv->dwFlags & ENV_VOLLOOP) || (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2))) && (penv->nFadeOut)) pChn->dwFlags |= CHN_NOTEFADE; } diff --git a/modplug/snd_gm.cpp b/modplug/snd_gm.cpp index f4af73c..c8d8248 100644 --- a/modplug/snd_gm.cpp +++ b/modplug/snd_gm.cpp @@ -81,20 +81,32 @@ About the controllers... In AWE32 they are: - http://www.philrees.co.uk/nrpnq.htm */ +//#define GM_DEBUG + static unsigned RunningStatus = 0; +#ifdef GM_DEBUG +static bool resetting = false; +#endif static void MPU_SendCommand(const unsigned char* buf, unsigned nbytes, int c) { if(!nbytes) return; if((buf[0] & 0x80) && buf[0] == RunningStatus) { ++buf; --nbytes; } else + { +#ifndef GM_DEBUG RunningStatus = buf[0]; -#if 0 - char Buf[2048],*t=Buf; - t += sprintf(t, "Sending:"); - for(unsigned n=0; nMidiSend(buf, nbytes, c, 0); } @@ -362,6 +374,10 @@ void GM_KeyOn(int c, unsigned char key, unsigned char Vol) if(S3Mchans[c].IsActive()) return; // be sure the channel is deactivated. +#ifdef GM_DEBUG + fprintf(stderr, "GM_KeyOn(%d, %d,%d)\n", c, key,Vol); +#endif + if(S3Mchans[c].IsPercussion()) { // Percussion always uses channel 9. Key (pitch) is ignored. @@ -396,7 +412,9 @@ void GM_KeyOff(int c) if(c < 0 || ((unsigned int)c) >= MAXCHN) return; if(!S3Mchans[c].IsActive()) return; // nothing to do - //fprintf(stderr, "GM_KeyOff(%d)\n", c); +#ifdef GM_DEBUG + fprintf(stderr, "GM_KeyOff(%d)\n", c); +#endif int mc = S3Mchans[c].chan; MPU_NoteOff(mc, @@ -429,6 +447,9 @@ void GM_Bend(int c, unsigned Count) void GM_Reset(int quitting) { +#ifdef GM_DEBUG + resetting=true; +#endif unsigned int a; //fprintf(stderr, "GM_Reset\n"); for(a=0; a= MAXCHN) return; GM_Bank(ch, bank); GM_Patch(ch, GM); @@ -496,7 +523,9 @@ static double log2(double d) void GM_SetFreqAndVol(int c, int Hertz, int Vol, MidiBendMode bend_mode) { - //fprintf(stderr, "GM_SetFreqAndVol(%d,%d,%d)\n", c,Hertz,Vol); +#ifdef GM_DEBUG + fprintf(stderr, "GM_SetFreqAndVol(%d,%d,%d)\n", c,Hertz,Vol); +#endif if(c < 0 || ((unsigned int)c) >= MAXCHN) return; @@ -562,8 +591,8 @@ void GM_SetFreqAndVol(int c, int Hertz, int Vol, MidiBendMode bend_mode) // and in fact, gives a lot of variation, we reduce the bending // precision to 100 cents. This is accurate enough for almost // all purposes, but will significantly reduce the bend event load. - const int bend_artificial_inaccuracy = semitone_bend_depth / 100; - bend = (bend / bend_artificial_inaccuracy) * bend_artificial_inaccuracy; + //const int bend_artificial_inaccuracy = semitone_bend_depth / 100; + //bend = (bend / bend_artificial_inaccuracy) * bend_artificial_inaccuracy; // Clamp the bending value so that we won't break the protocol if(bend < 0) bend = 0; diff --git a/modplug/sndmix.cpp b/modplug/sndmix.cpp index 7105d54..084b261 100644 --- a/modplug/sndmix.cpp +++ b/modplug/sndmix.cpp @@ -737,11 +737,34 @@ BOOL CSoundFile::ReadNote() } } - if (m_dwSongFlags & SONG_AMIGALIMITS) + /*if (m_dwSongFlags & SONG_AMIGALIMITS) { if (period < 113*4) period = 113*4; if (period > 856*4) period = 856*4; } + - According to Storlek, this code should never even be executed, + so I went ahead and disabled it, because it's causing me troubles + in MIDI playback of modules that enable that flag. + -Bisqwit + +0011#schism.Bisqwit Well, this code in sndmix.cpp honors that flag. +0011#schism.Bisqwit So it does matter. +0011#schism.Storlek uhhhh +0012#schism.Storlek that should only be happening if it's not in IT mode +0012#schism.Storlek which we _always_ enable +0012#schism.Storlek if not, that's a bug +0012#schism.Storlek regardless +0012#schism.Bisqwit Huh? +0013#schism.Storlek modplug always runs in impulse tracker mode +0013#schism.Storlek period +0013#schism.Storlek even when playing s3m, mod, xm, whatever +0013#schism.Bisqwit YOu're saying that most of the code in ReadNote() is actually not supposed to be executed, but never documented that way? +0013#schism.Storlek yes +0013#schism.Bisqwit ... +0013#schism.Storlek because to this date all the developers already knew that +0013#schism.Storlek and now that's the case again +0013#schism.Bisqwit Nothing in the code says that! + */ // Pitch/Filter Envelope int envpitch = 0; -- 1.5.6.3