Skip to content

Commit 1388bc9

Browse files
committed
read desc
fix FM modulator vibrato and base note, add 0-ff range commands for note cut, note delay and retrigger, add commands for vib, trem, pwm, panbr LFO shapes, correct dummy furnace import routine, add extended note cut, note delay, retrigger commands to import functions if needed, exxx to e0xx to free some address space for other commands
1 parent 82e99e8 commit 1388bc9

File tree

6 files changed

+53
-15
lines changed

6 files changed

+53
-15
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ $(eval $(call directory_defs,,))
190190
# subdirs (src/*/*.c)
191191
$(foreach dir,$(DIRS),$(eval $(call directory_defs,$(dir)/,$(dir)_)))
192192

193-
# subdirs (src/*/*.c)
193+
# subsubdirs (src/*/*/*.c) (yes, hacky and hard-coded to src/import/*/*.c now)
194194
$(foreach dir,$(SUBDIRS),$(eval $(call subdirectory_defs,$(dir)/,$(dir)_)))
195195

196196
# themes

src/command.c

+23-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static const InstructionDesc instruction_desc[] =
5656
{MUS_FX_SET_FREQUENCY_LOWER_BYTE, 0xff00, "Set frequency higher byte (0xFF0000)", "FreqHighByte", -1, -1},*/
5757

5858
{MUS_FX_SET_NOISE_CONSTANT_PITCH, 0xff00, "Set noise note in \"LOCK NOISE PITCH\" mode", "NoiPitNote", 0, FREQ_TAB_SIZE - 1}, //wasn't there
59-
{MUS_FX_PITCH, 0xff00, "Finetune: 0x80=0, 0=-127, 0xff=+128; 256 steps=semitone", "FineTune", 0, 0xff},
59+
{MUS_FX_PITCH, 0xff00, "Finetune: 0x80=0, 0=-127, 0xff=+128; 128 steps=semitone", "FineTune", 0, 0xff},
6060
{MUS_FX_ARPEGGIO_ABS, 0xff00, "Set absolute arpeggio note", "AbsArp", 0, FREQ_TAB_SIZE - 1},
6161
{MUS_FX_SET_EXT_ARP, 0xff00, "Set external arpeggio notes", "ExtArp", -1, -1},
6262
{MUS_FX_PORTA_UP, 0xff00, "Portamento up", "PortUp", -1, -1},
@@ -73,6 +73,15 @@ static const InstructionDesc instruction_desc[] =
7373
{MUS_FX_FM_VIBRATO, 0xff00, "FM modulator vibrato", "FM vib", -1, -1}, //wasn't there
7474
{MUS_FX_FM_TREMOLO, 0xff00, "FM modulator tremolo", "FM trem", -1, -1}, //wasn't there
7575
{MUS_FX_PWM, 0xff00, "Pulse width modification", "PWM", -1, -1}, //wasn't there
76+
77+
{MUS_FX_VIBRATO_SHAPE, 0xfff0, "Set vibrato shape", "VibShape", 0, 6}, //wasn't there
78+
{MUS_FX_TREMOLO_SHAPE, 0xfff0, "Set tremolo shape", "TremShape", 0, 6}, //wasn't there
79+
{MUS_FX_PWM_SHAPE, 0xfff0, "Set PWM shape", "PWMshape", 0, 6}, //wasn't there
80+
{MUS_FX_PANBRELLO_SHAPE, 0xfff0, "Set panbrello shape", "PanbrShape", 0, 6}, //wasn't there
81+
82+
{MUS_FX_FM_VIBRATO_SHAPE, 0xfff0, "Set FM modulator vibrato shape", "FmVibShape", 0, 6}, //wasn't there
83+
{MUS_FX_FM_TREMOLO_SHAPE, 0xfff0, "Set FM modulator tremolo shape", "FmTremShape", 0, 6}, //wasn't there
84+
7685
{MUS_FX_SLIDE, 0xff00, "Slide", "Slide", -1, -1},
7786
{MUS_FX_FAST_SLIDE, 0xff00, "Fast slide (16x faster)", "FastSlide", -1, -1},
7887
{MUS_FX_PORTA_UP_SEMI, 0xff00, "Portamento up (semitones)", "PortUpST", -1, -1},
@@ -137,7 +146,13 @@ static const InstructionDesc instruction_desc[] =
137146
{MUS_FX_EXT_FINE_PORTA_DN, 0xfff0, "Extra fine portamento down", "PortDnExtraFine", 0, 0xf},
138147
{MUS_FX_GLISSANDO_CONTROL, 0xfff0, "Glissando control (0=off, 1-F=on)", "Glissando", 0, 0xf},
139148
{MUS_FX_EXT_NOTE_CUT, 0xfff0, "Note cut", "NoteCut", 0, 0xf},
149+
150+
{MUS_FX_NOTE_CUT_EXTENDED, 0xff00, "Note cut (extended: on tick XX)", "NoteCutExt", 0, 0xff},
151+
{MUS_FX_NOTE_DELAY_EXTENDED, 0xff00, "Note delay (extended: on tick XX)", "NoteDelayExt", 0, 0xff},
152+
140153
{MUS_FX_EXT_RETRIGGER, 0xfff0, "Retrigger", "Retrig", 0, 0xf},
154+
155+
{MUS_FX_RETRIGGER_EXTENDED, 0xff00, "Retrigger (extended: each XX ticks)", "RetrigExt", 0, 0xff},
141156

142157
{MUS_FX_PHASE_RESET, 0xfff0, "Oscillator phase reset on tick X", "OscPhRes", 0, 0xf},
143158
{MUS_FX_NOISE_PHASE_RESET, 0xfff0, "Noise osc. ph. reset (in LOCK NOI PITCH mode)", "NoiPhRes", 0, 0xf},
@@ -150,7 +165,7 @@ static const InstructionDesc instruction_desc[] =
150165
{MUS_FX_WAVETABLE_OFFSET_UP_FINE, 0xfff0, "Wavetable offset up (fine)", "WaveOffsUpFine", 0, 0xf}, //wasn't there
151166
{MUS_FX_WAVETABLE_OFFSET_DOWN_FINE, 0xfff0, "Wavetable offset down (fine)", "WaveOffsDnFine", 0, 0xf}, //wasn't there
152167

153-
{MUS_FX_WAVETABLE_END_POINT, 0xf000, "Wavetable end offset", "WaveEndOffs", 0, 0xfff}, //wasn't there
168+
{MUS_FX_WAVETABLE_END_POINT, 0xff00, "Wavetable end offset", "WaveEndOffs", 0, 0xff}, //wasn't there
154169
{MUS_FX_WAVETABLE_END_POINT_UP, 0xff00, "Wavetable end offset up", "WaveEndOffsUp", 0, 0xff}, //wasn't there
155170
{MUS_FX_WAVETABLE_END_POINT_DOWN, 0xff00, "Wavetable end offset down", "WaveEndOffsDn", 0, 0xff}, //wasn't there
156171
{MUS_FX_WAVETABLE_END_POINT_UP_FINE, 0xfff0, "Wavetable end offset up (fine)", "WaveEndOffsUpFine", 0, 0xf}, //wasn't there
@@ -437,6 +452,12 @@ void get_command_desc(char *text, size_t buffer_size, Uint16 inst)
437452
{
438453
snprintf(text, buffer_size, "%s (%s)", name, (inst & 0xf) ? "enable" : "disable");
439454
}
455+
456+
else if ((fi & 0xfff0) == MUS_FX_VIBRATO_SHAPE || (fi & 0xfff0) == MUS_FX_TREMOLO_SHAPE || (fi & 0xfff0) == MUS_FX_PWM_SHAPE ||
457+
(fi & 0xfff0) == MUS_FX_PANBRELLO_SHAPE || (fi & 0xfff0) == MUS_FX_FM_VIBRATO_SHAPE || (fi & 0xfff0) == MUS_FX_FM_TREMOLO_SHAPE)
458+
{
459+
snprintf(text, buffer_size, "%s (%c)", name, (inst & 0xf) < 5 ? MAKEPTR((inst & 0xf) + 0xf4) : MAKEPTR((inst & 0xf) + 0xed));
460+
}
440461

441462
else if ((fi & 0xff00) == MUS_FX_SET_PANNING)
442463
{

src/import/famitracker.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,7 @@ void ft_convert_command(Uint16 val, MusStep* step, Uint16 song_pos, Uint8 channe
15161516

15171517
case FT_EF_DELAY:
15181518
{
1519-
step->command[column] = MUS_FX_EXT_NOTE_DELAY | (param & 0xf);
1519+
step->command[column] = MUS_FX_NOTE_DELAY_EXTENDED | param;
15201520
break;
15211521
}
15221522

@@ -1651,13 +1651,13 @@ void ft_convert_command(Uint16 val, MusStep* step, Uint16 song_pos, Uint8 channe
16511651

16521652
case FT_EF_NOTE_CUT:
16531653
{
1654-
step->command[column] = MUS_FX_EXT_NOTE_CUT | (param & 0xf);
1654+
step->command[column] = MUS_FX_NOTE_CUT_EXTENDED | param;
16551655
break;
16561656
}
16571657

16581658
case FT_EF_RETRIGGER:
16591659
{
1660-
step->command[column] = MUS_FX_EXT_RETRIGGER | (param & 0xf);
1660+
step->command[column] = MUS_FX_RETRIGGER_EXTENDED | param;
16611661
break;
16621662
}
16631663

src/import/fur.c

+20-3
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,27 @@ int import_fur(FILE *f)
157157
if(inflate_furnace_module(f, uncompressed_module) == Z_OK)
158158
{
159159
debug("successfully unpacked module");
160-
fseek(uncompressed_module, 0, SEEK_SET);
161-
import_furnace_module(uncompressed_module);
160+
162161
fclose(uncompressed_module);
162+
uncompressed_module = fopen(file_path, "rb");
163+
164+
fread(header, 1, strlen(FUR_HEADER_SIG), uncompressed_module);
165+
166+
if(strcmp(header, FUR_HEADER_SIG) != 0) //maybe module is compressed with zlib?
167+
{
168+
debug("uncompressed module is corrupt?");
169+
fclose(uncompressed_module);
170+
//remove(file_path);
171+
172+
return 0;
173+
}
174+
175+
else
176+
{
177+
import_furnace_module(uncompressed_module);
178+
fclose(uncompressed_module);
179+
}
180+
163181
//remove(file_path);
164182
}
165183

@@ -176,7 +194,6 @@ int import_fur(FILE *f)
176194
else //module isn't compressed!
177195
{
178196
debug("Module is uncompressed, proceeding...");
179-
fseek(f, 0, SEEK_SET);
180197
import_furnace_module(f);
181198
}
182199

src/import/importutil.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -896,13 +896,13 @@ void find_command_s3m(Uint16 command, MusStep* step)
896896
break;
897897
}
898898

899-
case 0xC: //SBx
899+
case 0xC: //SCx
900900
{
901901
step->command[find_empty_command_column(step)] = MUS_FX_EXT_NOTE_CUT | (param & 0xf);
902902
break;
903903
}
904904

905-
case 0xD: //SBx
905+
case 0xD: //SDx
906906
{
907907
step->command[find_empty_command_column(step)] = MUS_FX_EXT_NOTE_DELAY | (param & 0xf);
908908
break;
@@ -1079,7 +1079,7 @@ void find_command_furnace(Uint16 command, MusStep* step, Uint8 command_index, Ui
10791079

10801080
case FUR_EFF_RETRIGGER:
10811081
{
1082-
step->command[command_index] = MUS_FX_EXT_RETRIGGER | param_4bit;
1082+
step->command[command_index] = MUS_FX_RETRIGGER_EXTENDED | param_8bit;
10831083
break;
10841084
}
10851085

@@ -1151,13 +1151,13 @@ void find_command_furnace(Uint16 command, MusStep* step, Uint8 command_index, Ui
11511151

11521152
case FUR_EFF_NOTE_CUT:
11531153
{
1154-
step->command[command_index] = MUS_FX_EXT_NOTE_CUT | param_4bit;
1154+
step->command[command_index] = MUS_FX_NOTE_CUT_EXTENDED | param_8bit;
11551155
break;
11561156
}
11571157

11581158
case FUR_EFF_NOTE_DELAY:
11591159
{
1160-
step->command[command_index] = MUS_FX_EXT_NOTE_DELAY | param_4bit;
1160+
step->command[command_index] = MUS_FX_NOTE_DELAY_EXTENDED | param_8bit;
11611161
break;
11621162
}
11631163

0 commit comments

Comments
 (0)