restore octave/sfx/volume only for new notes
This commit is contained in:
parent
d979fa5d8d
commit
d58c774c2c
23
src/music.c
23
src/music.c
|
@ -329,6 +329,8 @@ static void doTab(Music* music)
|
||||||
s32 channel = (music->tracker.col / CHANNEL_COLS + 1) % TIC_SOUND_CHANNELS;
|
s32 channel = (music->tracker.col / CHANNEL_COLS + 1) % TIC_SOUND_CHANNELS;
|
||||||
|
|
||||||
music->tracker.col = channel * CHANNEL_COLS + music->tracker.col % CHANNEL_COLS;
|
music->tracker.col = channel * CHANNEL_COLS + music->tracker.col % CHANNEL_COLS;
|
||||||
|
|
||||||
|
updateTracker(music);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void upFrame(Music* music)
|
static void upFrame(Music* music)
|
||||||
|
@ -452,14 +454,14 @@ static void setStopNote(Music* music)
|
||||||
pattern->rows[music->tracker.row].octave = 0;
|
pattern->rows[music->tracker.row].octave = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setNote(Music* music, s32 note, s32 octave, s32 volume)
|
static void setNote(Music* music, s32 note, s32 octave, s32 volume, s32 sfx)
|
||||||
{
|
{
|
||||||
tic_track_pattern* pattern = getChannelPattern(music);
|
tic_track_pattern* pattern = getChannelPattern(music);
|
||||||
|
|
||||||
pattern->rows[music->tracker.row].note = note + NoteStart;
|
pattern->rows[music->tracker.row].note = note + NoteStart;
|
||||||
pattern->rows[music->tracker.row].octave = octave;
|
pattern->rows[music->tracker.row].octave = octave;
|
||||||
pattern->rows[music->tracker.row].volume = volume;
|
pattern->rows[music->tracker.row].volume = volume;
|
||||||
setSfxId(pattern, music->tracker.row, music->tracker.last.sfx);
|
setSfxId(pattern, music->tracker.row, sfx);
|
||||||
|
|
||||||
playNote(music);
|
playNote(music);
|
||||||
}
|
}
|
||||||
|
@ -815,19 +817,34 @@ static void processTrackerKeydown(Music* music, SDL_Keysym* keysum)
|
||||||
downRow(music);
|
downRow(music);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
tic_track_pattern* pattern = getChannelPattern(music);
|
||||||
|
|
||||||
for (s32 i = 0; i < COUNT_OF(Piano); i++)
|
for (s32 i = 0; i < COUNT_OF(Piano); i++)
|
||||||
{
|
{
|
||||||
if (scancode == Piano[i])
|
if (scancode == Piano[i])
|
||||||
{
|
{
|
||||||
s32 note = i % NOTES;
|
s32 note = i % NOTES;
|
||||||
|
|
||||||
|
if(pattern->rows[music->tracker.row].note > NoteNone)
|
||||||
|
{
|
||||||
|
pattern->rows[music->tracker.row].note = note + NoteStart;
|
||||||
|
playNote(music);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
s32 octave = i / NOTES + music->tracker.last.octave;
|
s32 octave = i / NOTES + music->tracker.last.octave;
|
||||||
s32 volume = music->tracker.last.volume;
|
s32 volume = music->tracker.last.volume;
|
||||||
|
s32 sfx = music->tracker.last.sfx;
|
||||||
|
setNote(music, note, octave, volume, sfx);
|
||||||
|
}
|
||||||
|
|
||||||
setNote(music, note, octave, volume);
|
|
||||||
downRow(music);
|
downRow(music);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ColumnOctave:
|
case ColumnOctave:
|
||||||
|
|
Loading…
Reference in New Issue