- Added the writewave command to write the internal TiMidity's output to a

wave file.
- Changed the default channel velocity for MUS files from 64 to 100 to
  better match apparent MIDI practice. (Would like to know what this is
  supposed to be.)
- Changed the mus2midi channel assignments to match the internal player's.
- Fixed: apply_envelope_to_amp() should clamp the mix levels to 0.


SVN r926 (trunk)
This commit is contained in:
Randy Heit 2008-04-19 21:36:53 +00:00
commit effe9427fd
12 changed files with 320 additions and 48 deletions

View file

@ -82,8 +82,8 @@ void apply_envelope_to_amp(Voice *v)
env_vol *= v->envelope_volume / float(1 << 30);
}
// Note: The pan offsets are negative.
v->left_mix = (float)calc_gf1_amp(env_vol + v->left_offset) * final_amp;
v->right_mix = (float)calc_gf1_amp(env_vol + v->right_offset) * final_amp;
v->left_mix = MAX(0.f, (float)calc_gf1_amp(env_vol + v->left_offset) * final_amp);
v->right_mix = MAX(0.f, (float)calc_gf1_amp(env_vol + v->right_offset) * final_amp);
}
static int update_envelope(Voice *v)
@ -440,7 +440,7 @@ void mix_voice(Renderer *song, float *buf, Voice *v, int c)
{
return;
}
if (v->left_offset == 0) // All the way to the left
if (v->right_mix == 0) // All the way to the left
{
if (v->envelope_increment != 0 || v->tremolo_phase_increment != 0)
{
@ -451,7 +451,7 @@ void mix_voice(Renderer *song, float *buf, Voice *v, int c)
mix_single_left(sp, buf, v, count);
}
}
else if (v->right_offset == 0) // All the way to the right
else if (v->left_mix == 0) // All the way to the right
{
if (v->envelope_increment != 0 || v->tremolo_phase_increment != 0)
{

View file

@ -215,6 +215,17 @@ void Renderer::recompute_amp(Voice *v)
void Renderer::compute_pan(int panning, float &left_offset, float &right_offset)
{
// Round the left- and right-most positions to their extremes, since
// most songs only do coarse panning.
if (panning < 128)
{
panning = 0;
}
else if (panning > 127*128)
{
panning = 32767;
}
if (panning == 0)
{
left_offset = 0;
@ -355,6 +366,12 @@ void Renderer::kill_note(int i)
/* Only one instance of a note can be playing on a single channel. */
void Renderer::note_on(int chan, int note, int vel)
{
if (vel == 0)
{
note_off(chan, note, 0);
return;
}
int i = voices, lowest = -1;
float lv = 1e10, v;
@ -574,14 +591,7 @@ void Renderer::HandleEvent(int status, int parm1, int parm2)
switch (command)
{
case ME_NOTEON:
if (parm2 == 0)
{
note_off(chan, parm1, 0);
}
else
{
note_on(chan, parm1, parm2);
}
note_on(chan, parm1, parm2);
break;
case ME_NOTEOFF:

View file

@ -66,7 +66,7 @@ config.h
/* For some reason the sample volume is always set to maximum in all
patch files. Define this for a crude adjustment that may help
equalize instrument volumes. */
#define ADJUST_SAMPLE_VOLUMES
//#define ADJUST_SAMPLE_VOLUMES
/* The number of samples to use for ramping out a dying note. Affects
click removal. */