mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 23:33:00 +00:00
Update DUMB to revision 15b780d08f2ee6f50a9843dc7479349f4deee5a7
- Fixed most effects applying to background voices SVN r4095 (trunk)
This commit is contained in:
parent
25542b11bd
commit
e1ec8df32d
1 changed files with 224 additions and 103 deletions
|
@ -1032,6 +1032,15 @@ static void update_retrig(DUMB_IT_SIGRENDERER *sigrenderer, IT_CHANNEL *channel)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void update_smooth_effects_playing(IT_PLAYING *playing)
|
||||||
|
{
|
||||||
|
playing->vibrato_time += playing->vibrato_n *
|
||||||
|
(playing->vibrato_speed << 2);
|
||||||
|
playing->tremolo_time += playing->tremolo_speed << 2;
|
||||||
|
playing->panbrello_time += playing->panbrello_speed;
|
||||||
|
if (playing->panbrello_waveform == 3)
|
||||||
|
playing->panbrello_random = (rand() % 129) - 64;
|
||||||
|
}
|
||||||
|
|
||||||
static void update_smooth_effects(DUMB_IT_SIGRENDERER *sigrenderer)
|
static void update_smooth_effects(DUMB_IT_SIGRENDERER *sigrenderer)
|
||||||
{
|
{
|
||||||
|
@ -1042,12 +1051,15 @@ static void update_smooth_effects(DUMB_IT_SIGRENDERER *sigrenderer)
|
||||||
IT_PLAYING *playing = channel->playing;
|
IT_PLAYING *playing = channel->playing;
|
||||||
|
|
||||||
if (playing) {
|
if (playing) {
|
||||||
playing->vibrato_time += playing->vibrato_n *
|
update_smooth_effects_playing(playing);
|
||||||
(playing->vibrato_speed << 2);
|
}
|
||||||
playing->tremolo_time += playing->tremolo_speed << 2;
|
}
|
||||||
playing->panbrello_time += playing->panbrello_speed;
|
|
||||||
if (playing->panbrello_waveform == 3)
|
for (i = 0; i < DUMB_IT_N_NNA_CHANNELS; i++) {
|
||||||
playing->panbrello_random = (rand() % 129) - 64;
|
IT_PLAYING *playing = sigrenderer->playing[i];
|
||||||
|
|
||||||
|
if (playing) {
|
||||||
|
update_smooth_effects_playing(playing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1083,7 +1095,7 @@ static void update_invert_loop(IT_CHANNEL *channel, IT_SAMPLE *sample)
|
||||||
|
|
||||||
static void update_effects(DUMB_IT_SIGRENDERER *sigrenderer)
|
static void update_effects(DUMB_IT_SIGRENDERER *sigrenderer)
|
||||||
{
|
{
|
||||||
int i;
|
int i, j;
|
||||||
|
|
||||||
if (sigrenderer->globalvolslide) {
|
if (sigrenderer->globalvolslide) {
|
||||||
sigrenderer->globalvolume += sigrenderer->globalvolslide;
|
sigrenderer->globalvolume += sigrenderer->globalvolslide;
|
||||||
|
@ -1167,6 +1179,10 @@ static void update_effects(DUMB_IT_SIGRENDERER *sigrenderer)
|
||||||
}
|
}
|
||||||
if (channel->playing)
|
if (channel->playing)
|
||||||
channel->playing->channel_volume = channel->channelvolume;
|
channel->playing->channel_volume = channel->channelvolume;
|
||||||
|
for (j = 0; j < DUMB_IT_N_NNA_CHANNELS; j++) {
|
||||||
|
if (sigrenderer->playing[j] && sigrenderer->playing[j]->channel == channel)
|
||||||
|
sigrenderer->playing[j]->channel_volume = channel->channelvolume;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
update_tremor(channel);
|
update_tremor(channel);
|
||||||
|
@ -1177,20 +1193,41 @@ static void update_effects(DUMB_IT_SIGRENDERER *sigrenderer)
|
||||||
|
|
||||||
if (channel->inv_loop_speed) update_invert_loop(channel, playing ? playing->sample : NULL);
|
if (channel->inv_loop_speed) update_invert_loop(channel, playing ? playing->sample : NULL);
|
||||||
|
|
||||||
if (playing) {
|
for (j = 0; j < DUMB_IT_N_NNA_CHANNELS; j++) {
|
||||||
playing->slide += channel->portamento;
|
if (sigrenderer->playing[j] && sigrenderer->playing[j]->channel == channel) break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (playing || j < DUMB_IT_N_NNA_CHANNELS) {
|
||||||
|
if (playing) playing->slide += channel->portamento;
|
||||||
|
for (j = 0; j < DUMB_IT_N_NNA_CHANNELS; j++) {
|
||||||
|
if (sigrenderer->playing[j] && sigrenderer->playing[j]->channel == channel)
|
||||||
|
sigrenderer->playing[j]->slide += channel->portamento;
|
||||||
|
}
|
||||||
|
|
||||||
if (channel->okt_toneslide) {
|
if (channel->okt_toneslide) {
|
||||||
if (channel->okt_toneslide--) {
|
if (channel->okt_toneslide--) {
|
||||||
|
if (playing) {
|
||||||
playing->note += channel->toneslide;
|
playing->note += channel->toneslide;
|
||||||
if (playing->note >= 120) {
|
if (playing->note >= 120) {
|
||||||
if (channel->toneslide < 0) playing->note = 0;
|
if (channel->toneslide < 0) playing->note = 0;
|
||||||
else playing->note = 119;
|
else playing->note = 119;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (j = 0; j < DUMB_IT_N_NNA_CHANNELS; j++) {
|
||||||
|
if (sigrenderer->playing[j] && sigrenderer->playing[j]->channel == channel) {
|
||||||
|
IT_PLAYING *playing = sigrenderer->playing[j];
|
||||||
|
playing->note += channel->toneslide;
|
||||||
|
if (playing->note >= 120) {
|
||||||
|
if (channel->toneslide < 0) playing->note = 0;
|
||||||
|
else playing->note = 119;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (channel->ptm_toneslide) {
|
} else if (channel->ptm_toneslide) {
|
||||||
if (--channel->toneslide_tick == 0) {
|
if (--channel->toneslide_tick == 0) {
|
||||||
channel->toneslide_tick = channel->ptm_toneslide;
|
channel->toneslide_tick = channel->ptm_toneslide;
|
||||||
|
if (playing) {
|
||||||
playing->note += channel->toneslide;
|
playing->note += channel->toneslide;
|
||||||
if (playing->note >= 120) {
|
if (playing->note >= 120) {
|
||||||
if (channel->toneslide < 0) playing->note = 0;
|
if (channel->toneslide < 0) playing->note = 0;
|
||||||
|
@ -1205,8 +1242,32 @@ static void update_effects(DUMB_IT_SIGRENDERER *sigrenderer)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (j = 0; j < DUMB_IT_N_NNA_CHANNELS; j++) {
|
||||||
|
if (sigrenderer->playing[j] && sigrenderer->playing[j]->channel == channel) {
|
||||||
|
IT_PLAYING *playing = sigrenderer->playing[j];
|
||||||
|
playing->note += channel->toneslide;
|
||||||
|
if (playing->note >= 120) {
|
||||||
|
if (channel->toneslide < 0) playing->note = 0;
|
||||||
|
else playing->note = 119;
|
||||||
|
}
|
||||||
|
if (channel->toneslide_retrig) {
|
||||||
|
it_playing_reset_resamplers(playing, 0);
|
||||||
|
#ifdef END_RAMPING
|
||||||
|
playing->declick_stage = 0;
|
||||||
|
playing->declick_volume = 1.f / 256.f;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (j = -1; j < DUMB_IT_N_NNA_CHANNELS; j++) {
|
||||||
|
if (j >= 0) {
|
||||||
|
playing = sigrenderer->playing[j];
|
||||||
|
if (!playing || playing->channel != channel) continue;
|
||||||
|
}
|
||||||
|
if (playing) {
|
||||||
if (sigrenderer->sigdata->flags & IT_LINEAR_SLIDES) {
|
if (sigrenderer->sigdata->flags & IT_LINEAR_SLIDES) {
|
||||||
if (channel->toneporta && channel->destnote < 120) {
|
if (channel->toneporta && channel->destnote < 120) {
|
||||||
int currpitch = ((playing->note - 60) << 8) + playing->slide;
|
int currpitch = ((playing->note - 60) << 8) + playing->slide;
|
||||||
|
@ -1257,6 +1318,8 @@ static void update_effects(DUMB_IT_SIGRENDERER *sigrenderer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
update_smooth_effects(sigrenderer);
|
update_smooth_effects(sigrenderer);
|
||||||
}
|
}
|
||||||
|
@ -1985,6 +2048,8 @@ const char mod_convert_vibrato[] = {
|
||||||
static int process_effects(DUMB_IT_SIGRENDERER *sigrenderer, IT_ENTRY *entry, int ignore_cxx)
|
static int process_effects(DUMB_IT_SIGRENDERER *sigrenderer, IT_ENTRY *entry, int ignore_cxx)
|
||||||
{
|
{
|
||||||
DUMB_IT_SIGDATA *sigdata = sigrenderer->sigdata;
|
DUMB_IT_SIGDATA *sigdata = sigrenderer->sigdata;
|
||||||
|
IT_PLAYING *playing;
|
||||||
|
int i;
|
||||||
|
|
||||||
IT_CHANNEL *channel = &sigrenderer->channel[(int)entry->channel];
|
IT_CHANNEL *channel = &sigrenderer->channel[(int)entry->channel];
|
||||||
|
|
||||||
|
@ -2041,10 +2106,17 @@ Yxy This uses a table 4 times larger (hence 4 times slower) than
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IT_VOLSLIDE_VIBRATO:
|
case IT_VOLSLIDE_VIBRATO:
|
||||||
if (channel->playing) {
|
for (i = -1; i < DUMB_IT_N_NNA_CHANNELS; i++) {
|
||||||
channel->playing->vibrato_speed = channel->lastHspeed;
|
if (i < 0) playing = channel->playing;
|
||||||
channel->playing->vibrato_depth = channel->lastHdepth;
|
else {
|
||||||
channel->playing->vibrato_n++;
|
playing = sigrenderer->playing[i];
|
||||||
|
if (!playing || playing->channel != channel) continue;
|
||||||
|
}
|
||||||
|
if (playing) {
|
||||||
|
playing->vibrato_speed = channel->lastHspeed;
|
||||||
|
playing->vibrato_depth = channel->lastHdepth;
|
||||||
|
playing->vibrato_n++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* Fall through and process volume slide. */
|
/* Fall through and process volume slide. */
|
||||||
case IT_VOLUME_SLIDE:
|
case IT_VOLUME_SLIDE:
|
||||||
|
@ -2140,17 +2212,24 @@ Yxy This uses a table 4 times larger (hence 4 times slower) than
|
||||||
v = channel->lastEF;
|
v = channel->lastEF;
|
||||||
channel->lastEF = v;
|
channel->lastEF = v;
|
||||||
}
|
}
|
||||||
if (channel->playing) {
|
for (i = -1; i < DUMB_IT_N_NNA_CHANNELS; i++) {
|
||||||
|
if (i < 0) playing = channel->playing;
|
||||||
|
else {
|
||||||
|
playing = sigrenderer->playing[i];
|
||||||
|
if (!playing || playing->channel != channel) continue;
|
||||||
|
}
|
||||||
|
if (playing) {
|
||||||
if ((v & 0xF0) == 0xF0)
|
if ((v & 0xF0) == 0xF0)
|
||||||
channel->playing->slide -= (v & 15) << 4;
|
playing->slide -= (v & 15) << 4;
|
||||||
else if ((v & 0xF0) == 0xE0)
|
else if ((v & 0xF0) == 0xE0)
|
||||||
channel->playing->slide -= (v & 15) << 2;
|
playing->slide -= (v & 15) << 2;
|
||||||
else if (sigdata->flags & IT_WAS_A_669)
|
else if (i < 0 && sigdata->flags & IT_WAS_A_669)
|
||||||
channel->portamento -= v << 3;
|
channel->portamento -= v << 3;
|
||||||
else
|
else if (i < 0)
|
||||||
channel->portamento -= v << 4;
|
channel->portamento -= v << 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case IT_PORTAMENTO_UP:
|
case IT_PORTAMENTO_UP:
|
||||||
{
|
{
|
||||||
|
@ -2175,17 +2254,24 @@ Yxy This uses a table 4 times larger (hence 4 times slower) than
|
||||||
v = channel->lastEF;
|
v = channel->lastEF;
|
||||||
channel->lastEF = v;
|
channel->lastEF = v;
|
||||||
}
|
}
|
||||||
|
for (i = -1; i < DUMB_IT_N_NNA_CHANNELS; i++) {
|
||||||
|
if (i < 0) playing = channel->playing;
|
||||||
|
else {
|
||||||
|
playing = sigrenderer->playing[i];
|
||||||
|
if (!playing || playing->channel != channel) continue;
|
||||||
|
}
|
||||||
if (channel->playing) {
|
if (channel->playing) {
|
||||||
if ((v & 0xF0) == 0xF0)
|
if ((v & 0xF0) == 0xF0)
|
||||||
channel->playing->slide += (v & 15) << 4;
|
channel->playing->slide += (v & 15) << 4;
|
||||||
else if ((v & 0xF0) == 0xE0)
|
else if ((v & 0xF0) == 0xE0)
|
||||||
channel->playing->slide += (v & 15) << 2;
|
channel->playing->slide += (v & 15) << 2;
|
||||||
else if (sigdata->flags & IT_WAS_A_669)
|
else if (i < 0 && sigdata->flags & IT_WAS_A_669)
|
||||||
channel->portamento += v << 3;
|
channel->portamento += v << 3;
|
||||||
else
|
else if (i < 0)
|
||||||
channel->portamento += v << 4;
|
channel->portamento += v << 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case IT_XM_PORTAMENTO_DOWN:
|
case IT_XM_PORTAMENTO_DOWN:
|
||||||
{
|
{
|
||||||
|
@ -2232,10 +2318,17 @@ Yxy This uses a table 4 times larger (hence 4 times slower) than
|
||||||
depth <<= 2;
|
depth <<= 2;
|
||||||
channel->lastHdepth = depth;
|
channel->lastHdepth = depth;
|
||||||
}
|
}
|
||||||
if (channel->playing) {
|
for (i = -1; i < DUMB_IT_N_NNA_CHANNELS; i++) {
|
||||||
channel->playing->vibrato_speed = speed;
|
if (i < 0) playing = channel->playing;
|
||||||
channel->playing->vibrato_depth = depth;
|
else {
|
||||||
channel->playing->vibrato_n++;
|
playing = sigrenderer->playing[i];
|
||||||
|
if (!playing || playing->channel != channel) continue;
|
||||||
|
}
|
||||||
|
if (playing) {
|
||||||
|
playing->vibrato_speed = speed;
|
||||||
|
playing->vibrato_depth = depth;
|
||||||
|
playing->vibrato_n++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2291,8 +2384,15 @@ Yxy This uses a table 4 times larger (hence 4 times slower) than
|
||||||
else
|
else
|
||||||
channel->channelvolume = 64;
|
channel->channelvolume = 64;
|
||||||
#endif
|
#endif
|
||||||
if (channel->playing)
|
for (i = -1; i < DUMB_IT_N_NNA_CHANNELS; i++) {
|
||||||
channel->playing->channel_volume = channel->channelvolume;
|
if (i < 0) playing = channel->playing;
|
||||||
|
else {
|
||||||
|
playing = sigrenderer->playing[i];
|
||||||
|
if (!playing || playing->channel != channel) continue;
|
||||||
|
}
|
||||||
|
if (playing)
|
||||||
|
playing->channel_volume = channel->channelvolume;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case IT_CHANNEL_VOLUME_SLIDE:
|
case IT_CHANNEL_VOLUME_SLIDE:
|
||||||
{
|
{
|
||||||
|
@ -2313,8 +2413,15 @@ Yxy This uses a table 4 times larger (hence 4 times slower) than
|
||||||
if (channel->channelvolume > 64) channel->channelvolume = 0;
|
if (channel->channelvolume > 64) channel->channelvolume = 0;
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
if (channel->playing)
|
for (i = -1; i < DUMB_IT_N_NNA_CHANNELS; i++) {
|
||||||
channel->playing->channel_volume = channel->channelvolume;
|
if (i < 0) playing = channel->playing;
|
||||||
|
else {
|
||||||
|
playing = sigrenderer->playing[i];
|
||||||
|
if (!playing || playing->channel != channel) continue;
|
||||||
|
}
|
||||||
|
if (playing)
|
||||||
|
playing->channel_volume = channel->channelvolume;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2467,9 +2574,16 @@ Yxy This uses a table 4 times larger (hence 4 times slower) than
|
||||||
depth = channel->lastRdepth;
|
depth = channel->lastRdepth;
|
||||||
channel->lastRdepth = depth;
|
channel->lastRdepth = depth;
|
||||||
}
|
}
|
||||||
if (channel->playing) {
|
for (i = -1; i < DUMB_IT_N_NNA_CHANNELS; i++) {
|
||||||
channel->playing->tremolo_speed = speed;
|
if (i < 0) playing = channel->playing;
|
||||||
channel->playing->tremolo_depth = depth;
|
else {
|
||||||
|
playing = sigrenderer->playing[i];
|
||||||
|
if (!playing || playing->channel != channel) continue;
|
||||||
|
}
|
||||||
|
if (playing) {
|
||||||
|
playing->tremolo_speed = speed;
|
||||||
|
playing->tremolo_depth = depth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2690,10 +2804,17 @@ Yxy This uses a table 4 times larger (hence 4 times slower) than
|
||||||
depth <<= 1;
|
depth <<= 1;
|
||||||
channel->lastHdepth = depth;
|
channel->lastHdepth = depth;
|
||||||
}
|
}
|
||||||
if (channel->playing) {
|
for (i = -1; i < DUMB_IT_N_NNA_CHANNELS; i++) {
|
||||||
channel->playing->vibrato_speed = speed;
|
if (i < 0) playing = channel->playing;
|
||||||
channel->playing->vibrato_depth = depth;
|
else {
|
||||||
channel->playing->vibrato_n++;
|
playing = sigrenderer->playing[i];
|
||||||
|
if (!playing || playing->channel != channel) continue;
|
||||||
|
}
|
||||||
|
if (playing) {
|
||||||
|
playing->vibrato_speed = speed;
|
||||||
|
playing->vibrato_depth = depth;
|
||||||
|
playing->vibrato_n++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -3580,7 +3701,7 @@ static int it_envelope_end(IT_PLAYING *playing, IT_ENVELOPE *envelope, IT_PLAYIN
|
||||||
/* Returns 1 when fading should be initiated for a volume envelope. */
|
/* Returns 1 when fading should be initiated for a volume envelope. */
|
||||||
static int update_it_envelope(IT_PLAYING *playing, IT_ENVELOPE *envelope, IT_PLAYING_ENVELOPE *pe, int flags)
|
static int update_it_envelope(IT_PLAYING *playing, IT_ENVELOPE *envelope, IT_PLAYING_ENVELOPE *pe, int flags)
|
||||||
{
|
{
|
||||||
if (!(playing->enabled_envelopes & flags))
|
if (!(playing->enabled_envelopes & flags) || !envelope->n_nodes)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ASSERT(envelope->n_nodes > 0);
|
ASSERT(envelope->n_nodes > 0);
|
||||||
|
@ -4323,7 +4444,7 @@ static float calculate_volume(DUMB_IT_SIGRENDERER *sigrenderer, IT_PLAYING *play
|
||||||
volume *= 1.0f / ((64 << 5) * 64.0f * 64.0f * 128.0f * 128.0f);
|
volume *= 1.0f / ((64 << 5) * 64.0f * 64.0f * 128.0f * 128.0f);
|
||||||
|
|
||||||
if (volume && playing->instrument) {
|
if (volume && playing->instrument) {
|
||||||
if (playing->enabled_envelopes & IT_ENV_VOLUME) {
|
if (playing->enabled_envelopes & IT_ENV_VOLUME && playing->env_instrument->volume_envelope.n_nodes) {
|
||||||
volume *= envelope_get_y(&playing->env_instrument->volume_envelope, &playing->volume_envelope);
|
volume *= envelope_get_y(&playing->env_instrument->volume_envelope, &playing->volume_envelope);
|
||||||
volume *= 1.0f / (64 << IT_ENVELOPE_SHIFT);
|
volume *= 1.0f / (64 << IT_ENVELOPE_SHIFT);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue