Просмотр исходного кода

properly display external arp notes in program editor

LTVA1 2 лет назад
Родитель
Сommit
0723a07628
3 измененных файлов с 27 добавлено и 7 удалено
  1. 4 4
      sound_engine/sound_engine_filter.c
  2. 9 1
      view/instrument_editor.c
  3. 14 2
      view/pattern_editor.c

+ 4 - 4
sound_engine/sound_engine_filter.c

@@ -8,7 +8,7 @@ void sound_engine_filter_set_coeff(SoundEngineFilter *flt, uint32_t frequency, u
 
 void sound_engine_filter_cycle(SoundEngineFilter *flt, int32_t input) // don't ask me how it works, stolen from Furnace tracker TSU synth
 {
-    input /= 4;
+    input /= 8;
     flt->low = flt->low + ((flt->cutoff * flt->band) >> 16);
     flt->high = input - flt->low - (((256 - flt->resonance) * flt->band) >> 8);
     flt->band = ((flt->cutoff * flt->high) >> 16) + flt->band;
@@ -16,15 +16,15 @@ void sound_engine_filter_cycle(SoundEngineFilter *flt, int32_t input) // don't a
 
 int32_t sound_engine_output_lowpass(SoundEngineFilter *flt)
 {
-    return flt->low * 4;
+    return flt->low * 8;
 }
 
 int32_t sound_engine_output_highpass(SoundEngineFilter *flt)
 {
-    return flt->high * 4;
+    return flt->high * 8;
 }
 
 int32_t sound_engine_output_bandpass(SoundEngineFilter *flt)
 {
-    return flt->band * 4;
+    return flt->band * 8;
 }

+ 9 - 1
view/instrument_editor.c

@@ -273,7 +273,15 @@ void draw_program_step(Canvas *canvas, uint8_t y, FlizzerTrackerApp *tracker, ui
     {
         if ((opcode & 0x7f00) == TE_EFFECT_ARPEGGIO)
         {
-            snprintf(buffer, sizeof(buffer), "%01X %c%02X %s", index, command_get_char(opcode & 0x7fff), (opcode & 0xff), notename((opcode & 0xff) + tracker->song.instrument[tracker->current_instrument]->base_note));
+            if ((opcode & 0xff) != 0xf0 && (opcode & 0xff) != 0xf1)
+            {
+                snprintf(buffer, sizeof(buffer), "%01X %c%02X %s", index, command_get_char(opcode & 0x7fff), (opcode & 0xff), notename(my_min(12 * 7 + 11, (opcode & 0xff) + tracker->song.instrument[tracker->current_instrument]->base_note)));
+            }
+
+            else
+            {
+                snprintf(buffer, sizeof(buffer), "%01X %c%02X %s", index, command_get_char(opcode & 0x7fff), (opcode & 0xff), notename((opcode & 0xff)));
+            }
         }
 
         else if ((opcode & 0x7f00) == TE_EFFECT_ARPEGGIO_ABS)

+ 14 - 2
view/pattern_editor.c

@@ -23,7 +23,7 @@ static const char *notenames[] =
 
 char *notename(uint8_t note)
 {
-    static char buffer[4];
+    static char buffer[6];
 
     if (note == MUS_NOTE_CUT)
     {
@@ -33,7 +33,19 @@ char *notename(uint8_t note)
 
     if (note == MUS_NOTE_RELEASE)
     {
-        snprintf(buffer, sizeof(buffer), "   ");
+        snprintf(buffer, sizeof(buffer), "%s", "   ");
+        return buffer;
+    }
+
+    if(note == 0xf0) //external arpeggio notes
+    {
+        snprintf(buffer, sizeof(buffer), "%s", "EXT.0");
+        return buffer;
+    }
+
+    if(note == 0xf1)
+    {
+        snprintf(buffer, sizeof(buffer), "%s", "EXT.1");
         return buffer;
     }