Skip to content

Commit

Permalink
Fix: note 0 is also a valid note (C-0).
Browse files Browse the repository at this point in the history
  • Loading branch information
Artefact2 committed Oct 23, 2014
1 parent 24e497f commit b95ae54
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/play.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,6 @@ static void xm_handle_note_and_instrument(xm_context_t* ctx, xm_channel_context_
if(s->instrument > 0) {
if(HAS_TONE_PORTAMENTO(ch->current) && ch->instrument != NULL && ch->sample != NULL) {
/* Tone portamento in effect, unclear stuff happens */
if(ch->note == 0) ch->note = 1;
xm_trigger_note(ctx, ch, XM_TRIGGER_KEEP_PERIOD | XM_TRIGGER_KEEP_SAMPLE_POSITION);
} else if(s->instrument > ctx->module.num_instruments) {
/* Invalid instrument, Cut current note */
Expand Down Expand Up @@ -1188,7 +1187,7 @@ static void xm_tick(xm_context_t* ctx) {
}

static float xm_next_of_sample(xm_channel_context_t* ch) {
if(ch->note == 0 || ch->instrument == NULL || ch->sample == NULL || ch->sample_position < 0) {
if(ch->instrument == NULL || ch->sample == NULL || ch->sample_position < 0) {
if(XM_RAMPING && ch->frame_count < XM_SAMPLE_RAMPING_POINTS) {
return XM_LERP(ch->end_of_previous_sample[ch->frame_count], .0f,
(float)ch->frame_count / (float)XM_SAMPLE_RAMPING_POINTS);
Expand Down Expand Up @@ -1300,7 +1299,7 @@ static void xm_sample(xm_context_t* ctx, float* left, float* right) {
if(XM_RAMPING)
ch->frame_count++;

if(ch->note == 0 || ch->instrument == NULL || ch->sample == NULL || ch->sample_position < 0) {
if(ch->instrument == NULL || ch->sample == NULL || ch->sample_position < 0) {
continue;
}

Expand Down

0 comments on commit b95ae54

Please sign in to comment.