From b4e0b4544aeefc5ccf79dc0d4583068f55615005 Mon Sep 17 00:00:00 2001 From: Masanao Izumo Date: Tue, 21 Sep 1999 23:18:29 +0900 Subject: [PATCH] TiMidity++-2.6.0 --- ChangeLog | 36 ++++++++++++++++++++++++++++++++++++ Makefile.in | 1 + NEWS | 3 ++- configs/msc-config.h | 2 +- configure | 4 ++-- configure.in | 4 ++-- interface/vt100_c.c | 8 ++++++-- timidity/aq.c | 9 +++++++++ timidity/oss_a.c | 8 ++++---- timidity/playmidi.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++- timidity/playmidi.h | 1 + timidity/rcp.c | 14 +++++++++----- timidity/sun_a.c | 36 ++++++++++++++++++++++++++++++++++++ timidity/timidity.c | 10 ++++++++-- 14 files changed, 164 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 791681bb..1a522a12 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,39 @@ +1999-09/21 Masanao Izumo + + * Version 2.6.0 released. + +1999-09/21 Masanao Izumo + + * timidity/rcp.c: Bug fix of SameMeassure. + * interface/vt100_c.c (ctl_current_time): Bug fix of displaying bold. + +1999-09/20 Masanao Izumo + + * timidity/aq.c (aq_samples): Save PM_REQ_GETSAMPLES value if the acntl() + succeeds. + * timidity/sun_a.c: Implement PM_REQ_GETFILLED and PM_REQ_GETSAMPLES of + acntl(). + +1999-09/17 Eric A. Welsh + + * timidity/{timidity.c,playmidi.c,playmidi.h} (new_chorus_voice_alternate): + To use the surround sound instead of detuned chorus. + It is enabled with -EFchorus=2 or -EFchorus=2,level option + (level := [0..63]) + +1999-09-14 Masanao Izumo + + * timidity/timidity.c (set_channel_flag): Bug fixed + +1999-09-12 Shusuke Nisiyama + + * timidity/timidity.c (fpsetmask): On FreeBSD, remove FP_X_DZ frag + from fp mask. + +1999-09-10 Norikatsu Shigemura + + * configure.in: Use $CC instead of ld for $SHLD of NetBSD. + 1999-09-09 Masanao Izumo * Version 2.6.0-beta4 released for test version. diff --git a/Makefile.in b/Makefile.in index bd6ff779..1eecb1ab 100644 --- a/Makefile.in +++ b/Makefile.in @@ -350,6 +350,7 @@ distdir: $(DISTFILES) fi; \ done $(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook + info-am: info: info-recursive dvi-am: diff --git a/NEWS b/NEWS index 3a451217..bb49a85d 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ -??/??, 1999 +9/21, 1999 * Version 2.6.0 released. * Some configurations and installations are changed. + * -EFchorus=2 for the surround sound instead of detuned chorus. * Bug fix. 8/27, 1999 diff --git a/configs/msc-config.h b/configs/msc-config.h index 8db2b72f..0672511b 100644 --- a/configs/msc-config.h +++ b/configs/msc-config.h @@ -217,7 +217,7 @@ #define HAVE_MMSYSTEM_H /* In VDS Macro AAA=BBB is not available. */ -#define TIMID_VERSION "2.6.0-beta4" +#define TIMID_VERSION "2.6.0" #define DEFAULT_PATH ".\\" #define AU_W32 #define WINSOCK diff --git a/configure b/configure index b01d8703..470b31d3 100755 --- a/configure +++ b/configure @@ -881,7 +881,7 @@ fi PACKAGE=TiMidity++ -VERSION=2.6.0-beta4 +VERSION=2.6.0 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } @@ -1502,7 +1502,7 @@ case "$target" in so="so" ;; *-*-netbsd*) - test -n "$SHLD" || SHLD="ld -Bforcearchive -Bshareable" + test -n "$SHLD" || SHLD="$CC -shared -nostartfiles" so="so" ;; diff --git a/configure.in b/configure.in index 4f76be8e..708a7945 100644 --- a/configure.in +++ b/configure.in @@ -55,7 +55,7 @@ dnl AC_INIT(timidity/timidity.c) SHELL=${CONFIG_SHELL-/bin/sh} AC_CANONICAL_SYSTEM -AM_INIT_AUTOMAKE(TiMidity++, 2.6.0-beta4, no-define) +AM_INIT_AUTOMAKE(TiMidity++, 2.6.0, no-define) dnl To use CONTAINS() macro (See acinclude.m4) CONTAINS_INIT @@ -150,7 +150,7 @@ case "$target" in so="so" ;; *-*-netbsd*) - test -n "$SHLD" || SHLD="ld -Bforcearchive -Bshareable" + test -n "$SHLD" || SHLD="$CC -shared -nostartfiles" so="so" ;; diff --git a/interface/vt100_c.c b/interface/vt100_c.c index a81c513c..0ae8622e 100644 --- a/interface/vt100_c.c +++ b/interface/vt100_c.c @@ -196,7 +196,7 @@ static void ctl_file_name(char *name) static void ctl_current_time(int secs, int v) { - int mins; + int mins, bold_flag = 0; static int last_voices = -1, last_secs = -1; if(last_secs != secs) @@ -207,15 +207,19 @@ static void ctl_current_time(int secs, int v) vt100_move(4, 6); vt100_set_attr(VT100_ATTR_BOLD); printf("%3d:%02d", mins, secs); + bold_flag = 1; } if(!ctl.trace_playing || midi_trace.flush_flag) { - vt100_reset_attr(); + if(bold_flag) + vt100_reset_attr(); return; } vt100_move(4, 47); + if(!bold_flag) + vt100_set_attr(VT100_ATTR_BOLD); printf("%3d", v); vt100_reset_attr(); diff --git a/timidity/aq.c b/timidity/aq.c index b8ab96a0..a7e3f4f5 100644 --- a/timidity/aq.c +++ b/timidity/aq.c @@ -407,7 +407,16 @@ int32 aq_samples(void) int s; if(play_mode->acntl(PM_REQ_GETSAMPLES, &s) != -1) + { + /* Reset counter & timer */ + if(play_counter) + { + play_start_time = get_current_calender_time(); + play_offset_counter = s; + play_counter = 0; + } return s; + } if(!IS_STREAM_TRACE) return -1; diff --git a/timidity/oss_a.c b/timidity/oss_a.c index 1e1eaa8a..db45ca42 100644 --- a/timidity/oss_a.c +++ b/timidity/oss_a.c @@ -71,7 +71,7 @@ static int open_output(void); /* 0=success, 1=warning, -1=fatal error */ static void close_output(void); static int output_data(char *buf, int32 nbytes); static int acntl(int request, void *arg); -static int output_counter, counter_offset; +static int output_counter; static int total_bytes; /* Maximum buffer size in bytes */ /* export the playback mode */ @@ -235,7 +235,7 @@ static int open_output(void) total_bytes = -1; /* Unknown */ dpm.fd = fd; - output_counter = counter_offset = 0; + output_counter = 0; return warnings; } @@ -288,11 +288,11 @@ static int acntl(int request, void *arg) switch(request) { case PM_REQ_DISCARD: - counter_offset = output_counter = 0; + output_counter = 0; return ioctl(dpm.fd, SNDCTL_DSP_RESET); case PM_REQ_FLUSH: - counter_offset = output_counter = 0; + output_counter = 0; return ioctl(dpm.fd, SNDCTL_DSP_SYNC); case PM_REQ_RATE: diff --git a/timidity/playmidi.c b/timidity/playmidi.c index ab6515b8..dcd18259 100644 --- a/timidity/playmidi.c +++ b/timidity/playmidi.c @@ -141,6 +141,7 @@ int opt_chorus_control = 1; #else int opt_chorus_control = 0; #endif /* CHORUS_CONTROL_ALLOW */ +int opt_surround_chorus = 0; #ifdef GM_CHANNEL_PRESSURE_ALLOW int opt_channel_pressure = 1; @@ -1572,6 +1573,46 @@ static void new_chorus_voice(int v, int level) recompute_freq(cv); } +/* Yet another chorus implementation + * by Eric A. Welsh . + */ +static void new_chorus_voice_alternate(int v, int level) +{ + int cv, ch; + uint8 vol, pan; + + if((cv = find_free_voice()) == -1) + return; + ch = voice[v].channel; + + vol = voice[v].velocity; + voice[cv] = voice[v]; + voice[v].velocity = (uint8)(vol * CHORUS_VELOCITY_TUNING1); + voice[cv].velocity = (uint8)(vol * CHORUS_VELOCITY_TUNING2); + + /* set panning & delay */ + if(play_mode->encoding & PE_MONO) + voice[cv].delay = 0; + else + { + double delay; + + pan = voice[v].panning; + if (pan - level < 0) level = pan; + if (pan + level > 127) level = 127 - pan; + voice[v].panning -= level; + voice[cv].panning += level; + delay = DEFAULT_CHORUS_DELAY2; + + voice[cv].delay = (int)(play_mode->rate * delay); + } + + recompute_amp(v); + apply_envelope_to_amp(v); + recompute_amp(cv); + apply_envelope_to_amp(cv); +} + static void note_on(MidiEvent *e) { int i, nv, v, ch; @@ -1587,7 +1628,12 @@ static void note_on(MidiEvent *e) v = vlist[i]; start_note(e, v, vid, nv - i - 1); if(channel[ch].chorus_level && voice[v].sample->sample_rate) - new_chorus_voice(v, channel[ch].chorus_level); + { + if(opt_surround_chorus) + new_chorus_voice_alternate(v, channel[ch].chorus_level); + else + new_chorus_voice(v, channel[ch].chorus_level); + } } } diff --git a/timidity/playmidi.h b/timidity/playmidi.h index 94dee25f..327f8b8f 100644 --- a/timidity/playmidi.h +++ b/timidity/playmidi.h @@ -302,6 +302,7 @@ extern int opt_portamento; extern int opt_nrpn_vibrato; extern int opt_reverb_control; extern int opt_chorus_control; +extern int opt_surround_chorus; extern int opt_channel_pressure; extern int opt_overlap_voice_allow; extern int noise_sharp_type; diff --git a/timidity/rcp.c b/timidity/rcp.c index 6d0acf98..cc5f4774 100644 --- a/timidity/rcp.c +++ b/timidity/rcp.c @@ -1072,12 +1072,16 @@ static int read_rcp_track(struct timidity_file *tf, int trackno, int gfmt) if(!gfmt) { jmp = (long)a | ((long)b << 8); -#if 1 + if(jmp & 0x03) /* ##?? */ - continue; -#else - jmp &= ~3; /* jmp=(jmp/4)*4 */ -#endif + { + /* What do these two bits mean? */ + /* Clear them here. */ + ctl->cmsg(CMSG_WARNING, VERB_DEBUG, + "Jump %d is changed to %d", + jmp, jmp & ~3); + jmp &= ~3; /* jmp=(jmp/4)*4 */ + } } else { diff --git a/timidity/sun_a.c b/timidity/sun_a.c index c2832e3f..4ba6ceb9 100644 --- a/timidity/sun_a.c +++ b/timidity/sun_a.c @@ -78,6 +78,7 @@ static int open_output(void); /* 0=success, 1=warning, -1=fatal error */ static void close_output(void); static int output_data(char *buf, int32 bytes); static int acntl(int request, void *arg); +static int output_counter, play_samples_offset; /* export the playback mode */ #define dpm sun_play_mode @@ -137,6 +138,8 @@ static int open_output(void) struct stat sb; audio_info_t auinfo; + output_counter = play_samples_offset = 0; + /* Open the audio device */ if((audioctl_fd = open(AUDIO_CTLDEV, O_RDWR)) < 0) { @@ -267,6 +270,8 @@ int output_data(char *buff, int32 nbytes) return -1; } + output_counter += n; + return n; } @@ -299,11 +304,42 @@ static int sun_discard_playing(void) static int acntl(int request, void *arg) { + audio_info_t auinfo; + int i; + switch(request) { + case PM_REQ_GETFILLED: + if(ioctl(audioctl_fd, AUDIO_GETINFO, &auinfo) < 0) + return -1; + if(auinfo.play.samples == play_samples_offset) + return -1; /* auinfo.play.samples is not active */ + i = output_counter; + if(!(dpm.encoding & PE_MONO)) i >>= 1; + if(dpm.encoding & PE_16BIT) i >>= 1; + *((int *)arg) = i - (auinfo.play.samples - play_samples_offset); + return 0; + + case PM_REQ_GETSAMPLES: + if(ioctl(audioctl_fd, AUDIO_GETINFO, &auinfo) < 0) + return -1; + if(auinfo.play.samples == play_samples_offset) + return -1; /* auinfo.play.samples is not active */ + *((int *)arg) = auinfo.play.samples - play_samples_offset; + return 0; + case PM_REQ_DISCARD: + if(ioctl(audioctl_fd, AUDIO_GETINFO, &auinfo) != -1) + play_samples_offset = auinfo.play.samples; + output_counter = 0; return sun_discard_playing(); + case PM_REQ_FLUSH: + if(ioctl(audioctl_fd, AUDIO_GETINFO, &auinfo) != -1) + play_samples_offset = auinfo.play.samples; + output_counter = 0; + return 0; + case PM_REQ_RATE: { audio_info_t auinfo; int rate; diff --git a/timidity/timidity.c b/timidity/timidity.c index 5073f616..72928bb6 100644 --- a/timidity/timidity.c +++ b/timidity/timidity.c @@ -531,6 +531,8 @@ NULL " -EFchorus=0 : Disable MIDI chorus effect control" NLS " -EFchorus=1[,level] : Enable MIDI chorus effect control" NLS " `level' is optional to specify chorus level [0..127]" NLS +" -EFchorus=2[,level] : Use the surround sound instead of detuned chorus." NLS +" `level' is optional to specify level [0..63]" NLS " -EFreverb=0 : Disable MIDI reverb effect control" NLS " -EFreverb=1[,level] : Enable MIDI reverb effect control" NLS " `level' is optional to specify reverb level [0..127]" NLS @@ -591,7 +593,7 @@ static int set_channel_flag(ChannelBitMask *flags, int32 i, char *name) if(i > 0) SET_CHANNELMASK(*flags, i - 1); else - UNSET_CHANNELMASK(*flags, -(i - 1)); + UNSET_CHANNELMASK(*flags, -i - 1); } return 0; } @@ -2168,8 +2170,12 @@ static int parse_effect_option(char *effect_opts) { case '0': opt_chorus_control = 0; + opt_surround_chorus = 0; break; + case '1': + case '2': + opt_surround_chorus = (*effect_opts == 2); if(*(effect_opts + 1) == ',') opt_chorus_control = -(atoi(effect_opts + 2) & 0x7f); else @@ -2728,7 +2734,7 @@ MAIN_INTERFACE void timidity_start_initialize(void) fp_except_t fpexp; fpexp = fpgetmask(); - fpsetmask(fpexp & ~FP_X_INV); + fpsetmask(fpexp & ~(FP_X_INV|FP_X_DZ)); #endif if(!output_text_code) -- 2.11.0