| 1 | // for finding memory leaks in debug mode with Visual Studio cxx . . $ `<file>/src/pt2_edit.c`/ |
| 2 | #if defined _DEBUG && defined _MSC_VER |
| 3 | #include <crtdbg.h> |
| 4 | #endif |
| 5 | |
| 6 | #include <stdint.h> |
| 7 | #include <stdbool.h> |
| 8 | #include <string.h> |
| 9 | #include <fcntl.h> |
| 10 | #include <sys/types.h> |
| 11 | #include <sys/stat.h> |
| 12 | #ifdef _WIN32 |
| 13 | #include <direct.h> |
| 14 | #else |
| 15 | #include <unistd.h> |
| 16 | #endif |
| 17 | #include "pt2_helpers.h"cxx . . $ `<file>/src/pt2_helpers.h`/ |
| 18 | #include "pt2_textout.h"cxx . . $ `<file>/src/pt2_textout.h`/ |
| 19 | #include "pt2_tables.h"cxx . . $ `<file>/src/pt2_tables.h`/ |
| 20 | #include "pt2_diskop.h"cxx . . $ `<file>/src/pt2_diskop.h`/ |
| 21 | #include "pt2_sampler.h"cxx . . $ `<file>/src/pt2_sampler.h`/ |
| 22 | #include "pt2_visuals.h"cxx . . $ `<file>/src/pt2_visuals.h`/ |
| 23 | #include "pt2_keyboard.h"cxx . . $ `<file>/src/pt2_keyboard.h`/ |
| 24 | #include "pt2_config.h"cxx . . $ `<file>/src/pt2_config.h`/ |
| 25 | #include "pt2_audio.h"cxx . . $ `<file>/src/pt2_audio.h`/ |
| 26 | #include "pt2_chordmaker.h"cxx . . $ `<file>/src/pt2_chordmaker.h`/ |
| 27 | #include "pt2_edit.h"cxx . . $ `<file>/src/pt2_edit.h`/ |
| 28 | #include "pt2_replayer.h"cxx . . $ `<file>/src/pt2_replayer.h`/ |
| 29 | #include "pt2_visuals_sync.h"cxx . . $ `<file>/src/pt2_visuals_sync.h`/ |
| 30 | |
| 31 | static const int8_tcxx . . $ int8_t# scancode2NoteLocxx . . $ scancode2NoteLo.[52] = // "USB usage page standard" order |
| 32 | { |
| 33 | 7, 4, 3, 16, -1, 6, 8, 24, |
| 34 | 10, -1, 13, 11, 9, 26, 28, 12, |
| 35 | 17, 1, 19, 23, 5, 14, 2, 21, |
| 36 | 0, -1, 13, 15, -1, 18, 20, 22, |
| 37 | -1, 25, 27, -1, -1, -1, -1, -1, |
| 38 | -1, 30, 29, 31, 30, -1, 15, -1, |
| 39 | -1, 12, 14, 16 |
| 40 | }; |
| 41 | |
| 42 | static const int8_tcxx . . $ int8_t# scancode2NoteHicxx . . $ scancode2NoteHi.[52] = // "USB usage page standard" order |
| 43 | { |
| 44 | 19, 16, 15, 28, -1, 18, 20, -2, |
| 45 | 22, -1, 25, 23, 21, -2, -2, 24, |
| 46 | 29, 13, 31, 35, 17, 26, 14, 33, |
| 47 | 12, -1, 25, 27, -1, 30, 32, 34, |
| 48 | -1, -2, -2, -1, -1, -1, -1, -1, |
| 49 | -1, -2, -2, -2, -2, -1, 27, -1, |
| 50 | -1, 24, 26, 28 |
| 51 | }; |
| 52 | |
| 53 | static uint8_tcxx . . $ uint8_t# quantizeCheckcxx . . $ quantizeCheck(50106d451684defa).(uint8_tcxx . . $ uint8_t# row) |
| 54 | { |
| 55 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(song != NULL); |
| 56 | if (songcxx . . $ song. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 57 | return row; |
| 58 | |
| 59 | const uint8_tcxx . . $ uint8_t# quantize = (uint8_tcxx . . $ uint8_t#)configcxx . . $ config..quantizeValuecxx . . $ config_t#quantizeValue.; |
| 60 | |
| 61 | editorcxx . . $ editor..didQuantizecxx . . $ editor_t#didQuantize. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 62 | if (editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. == MODE_RECORDcxx . . $ MODE_RECORD.) |
| 63 | { |
| 64 | if (quantize == 0) |
| 65 | { |
| 66 | return row; |
| 67 | } |
| 68 | else if (quantize == 1) |
| 69 | { |
| 70 | if (songcxx . . $ song.->tickcxx . . $ module_t#tick. > songcxx . . $ song.->speedcxx . . $ module_t#speed.>>1) |
| 71 | { |
| 72 | row = (row + 1) & 63; |
| 73 | editorcxx . . $ editor..didQuantizecxx . . $ editor_t#didQuantize. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 74 | } |
| 75 | } |
| 76 | else |
| 77 | { |
| 78 | uint8_tcxx . . $ uint8_t# tempRow = ((((quantize >> 1) + row) & 63) / quantize) * quantize; |
| 79 | if (tempRow > row) |
| 80 | editorcxx . . $ editor..didQuantizecxx . . $ editor_t#didQuantize. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 81 | |
| 82 | return tempRow; |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | return row; |
| 87 | } |
| 88 | |
| 89 | static void jamAndPlaceSamplecxx . . $ jamAndPlaceSample(a7e180099d3f0b9c).(SDL_Scancodecxx . . $ SDL_Scancode# scancode, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! normalMode) |
| 90 | { |
| 91 | uint8_tcxx . . $ uint8_t# chNum = cursorcxx . . $ cursor..channelcxx . . $ cursor_t#channel.; |
| 92 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(chNum < PAULA_VOICES); |
| 93 | |
| 94 | moduleChannel_tcxx . . $ moduleChannel_t# *ch = &songcxx . . $ song.->channelscxx . . $ module_t#channels.[chNum]; |
| 95 | note_tcxx . . $ note_t# *note = &songcxx . . $ song.->patternscxx . . $ module_t#patterns.[songcxx . . $ song.->currPatterncxx . . $ module_t#currPattern.][(quantizeCheckcxx . . $ quantizeCheck(50106d451684defa).(songcxx . . $ song.->currRowcxx . . $ module_t#currRow.) * PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!) + chNum]; |
| 96 | |
| 97 | int8_tcxx . . $ int8_t# noteVal = normalMode ? keyToNotecxx . . $ keyToNote(a7fb186c51a7e989).(scancode) : pNoteTablecxx . . $ pNoteTable.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 98 | if (noteVal >= 0) |
| 99 | { |
| 100 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 101 | |
| 102 | int16_tcxx . . $ int16_t# tempPeriod = periodTablecxx . . $ periodTable.[((s->fineTunecxx . . $ moduleSample_t#fineTune. & 0xF) * 37) + noteVal]; |
| 103 | uint16_tcxx . . $ uint16_t# cleanPeriod = periodTablecxx . . $ periodTable.[noteVal]; |
| 104 | |
| 105 | editorcxx . . $ editor..currPlayNotecxx . . $ editor_t#currPlayNote. = noteVal; |
| 106 | |
| 107 | // play current sample |
| 108 | |
| 109 | // don't play sample if we quantized to another row (will be played in modplayer instead) |
| 110 | if (editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. != MODE_RECORDcxx . . $ MODE_RECORD. || !editorcxx . . $ editor..didQuantizecxx . . $ editor_t#didQuantize.) |
| 111 | { |
| 112 | lockAudiocxx . . $ lockAudio(49f6e7a06ebc5aa8).(); |
| 113 | |
| 114 | ch->n_samplenumcxx . . $ moduleChannel_t#n_samplenum. = editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.; |
| 115 | ch->n_volumecxx . . $ moduleChannel_t#n_volume. = s->volumecxx . . $ moduleSample_t#volume.; |
| 116 | ch->n_periodcxx . . $ moduleChannel_t#n_period. = tempPeriod; |
| 117 | ch->n_startcxx . . $ moduleChannel_t#n_start. = &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.]; |
| 118 | ch->n_lengthcxx . . $ moduleChannel_t#n_length. = (uint16_tcxx . . $ uint16_t#)((s->loopStartcxx . . $ moduleSample_t#loopStart. > 0) ? (s->loopStartcxx . . $ moduleSample_t#loopStart. + s->loopLengthcxx . . $ moduleSample_t#loopLength.) >> 1 : s->lengthcxx . . $ moduleSample_t#length. >> 1); |
| 119 | ch->n_loopstartcxx . . $ moduleChannel_t#n_loopstart. = &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset. + s->loopStartcxx . . $ moduleSample_t#loopStart.]; |
| 120 | ch->n_replencxx . . $ moduleChannel_t#n_replen. = (uint16_tcxx . . $ uint16_t#)(s->loopLengthcxx . . $ moduleSample_t#loopLength. >> 1); |
| 121 | |
| 122 | if (ch->n_lengthcxx . . $ moduleChannel_t#n_length. == 0) |
| 123 | ch->n_lengthcxx . . $ moduleChannel_t#n_length. = 1; |
| 124 | |
| 125 | const uint32_tcxx . . $ uint32_t# voiceAddr = 0xDFF0A0 + (chNum * 16); |
| 126 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(voiceAddr + 8, ch->n_volumecxx . . $ moduleChannel_t#n_volume.); |
| 127 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(voiceAddr + 6, ch->n_periodcxx . . $ moduleChannel_t#n_period.); |
| 128 | paulaWritePtrcxx . . $ paulaWritePtr(8ed931be62ea155e).(voiceAddr + 0, ch->n_startcxx . . $ moduleChannel_t#n_start.); |
| 129 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(voiceAddr + 4, ch->n_lengthcxx . . $ moduleChannel_t#n_length.); |
| 130 | |
| 131 | if (!editorcxx . . $ editor..mutedcxx . . $ editor_t#muted.[chNum]) |
| 132 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(0xDFF096, 0x8000 | ch->n_dmabitcxx . . $ moduleChannel_t#n_dmabit.); // voice DMA on |
| 133 | else |
| 134 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(0xDFF096, ch->n_dmabitcxx . . $ moduleChannel_t#n_dmabit.); // voice DMA off |
| 135 | |
| 136 | // these take effect after the current DMA cycle is done |
| 137 | paulaWritePtrcxx . . $ paulaWritePtr(8ed931be62ea155e).(voiceAddr + 0, ch->n_loopstartcxx . . $ moduleChannel_t#n_loopstart.); |
| 138 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(voiceAddr + 4, ch->n_replencxx . . $ moduleChannel_t#n_replen.); |
| 139 | |
| 140 | // update tracker visuals |
| 141 | |
| 142 | setVisualsVolumecxx . . $ setVisualsVolume(a7050f1a4cb56049).(chNum, ch->n_volumecxx . . $ moduleChannel_t#n_volume.); |
| 143 | setVisualsPeriodcxx . . $ setVisualsPeriod(a7050f1a4cb56049).(chNum, ch->n_periodcxx . . $ moduleChannel_t#n_period.); |
| 144 | setVisualsDataPtrcxx . . $ setVisualsDataPtr(70eb3de2aab3469c).(chNum, ch->n_startcxx . . $ moduleChannel_t#n_start.); |
| 145 | setVisualsLengthcxx . . $ setVisualsLength(a7050f1a4cb56049).(chNum, ch->n_lengthcxx . . $ moduleChannel_t#n_length.); |
| 146 | |
| 147 | if (!editorcxx . . $ editor..mutedcxx . . $ editor_t#muted.[chNum]) |
| 148 | setVisualsDMACONcxx . . $ setVisualsDMACON(ed53e3bbd3fa2f69).(0x8000 | ch->n_dmabitcxx . . $ moduleChannel_t#n_dmabit.); |
| 149 | else |
| 150 | setVisualsDMACONcxx . . $ setVisualsDMACON(ed53e3bbd3fa2f69).(ch->n_dmabitcxx . . $ moduleChannel_t#n_dmabit.); |
| 151 | |
| 152 | setVisualsDataPtrcxx . . $ setVisualsDataPtr(70eb3de2aab3469c).(chNum, ch->n_loopstartcxx . . $ moduleChannel_t#n_loopstart.); |
| 153 | setVisualsLengthcxx . . $ setVisualsLength(a7050f1a4cb56049).(chNum, ch->n_replencxx . . $ moduleChannel_t#n_replen.); |
| 154 | |
| 155 | unlockAudiocxx . . $ unlockAudio(49f6e7a06ebc5aa8).(); |
| 156 | } |
| 157 | |
| 158 | // normalMode = normal keys, or else keypad keys (in jam mode) |
| 159 | if (normalMode || editorcxx . . $ editor..pNoteFlagcxx . . $ editor_t#pNoteFlag. != 0) |
| 160 | { |
| 161 | if (normalMode || editorcxx . . $ editor..pNoteFlagcxx . . $ editor_t#pNoteFlag. == 2) |
| 162 | { |
| 163 | // insert note and sample number |
| 164 | if (!uicxx . . $ ui..samplerScreenShowncxx . . $ ui_t#samplerScreenShown. && (editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. == MODE_EDITcxx . . $ MODE_EDIT. || editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. == MODE_RECORDcxx . . $ MODE_RECORD.)) |
| 165 | { |
| 166 | note->samplecxx . . $ note_t#sample. = editorcxx . . $ editor..sampleZerocxx . . $ editor_t#sampleZero. ? 0 : (editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample. + 1); |
| 167 | note->periodcxx . . $ note_t#period. = cleanPeriod; |
| 168 | |
| 169 | if (editorcxx . . $ editor..autoInsFlagcxx . . $ editor_t#autoInsFlag.) |
| 170 | { |
| 171 | note->commandcxx . . $ note_t#command. = editorcxx . . $ editor..effectMacroscxx . . $ editor_t#effectMacros.[editorcxx . . $ editor..autoInsSlotcxx . . $ editor_t#autoInsSlot.] >> 8; |
| 172 | note->paramcxx . . $ note_t#param. = editorcxx . . $ editor..effectMacroscxx . . $ editor_t#effectMacros.[editorcxx . . $ editor..autoInsSlotcxx . . $ editor_t#autoInsSlot.] & 0xFF; |
| 173 | } |
| 174 | |
| 175 | if (editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. != MODE_RECORDcxx . . $ MODE_RECORD.) |
| 176 | modSetPoscxx . . $ modSetPos(af780a7c10c7990f).(DONT_SET_ORDERcxx . . $ DONT_SET_ORDER., (songcxx . . $ song.->currRowcxx . . $ module_t#currRow. + editorcxx . . $ editor..editMoveAddcxx . . $ editor_t#editMoveAdd.) & 63); |
| 177 | |
| 178 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | if (editorcxx . . $ editor..multiFlagcxx . . $ editor_t#multiFlag.) |
| 183 | gotoNextMulticxx . . $ gotoNextMulti(49f6e7a06ebc5aa8).(); |
| 184 | } |
| 185 | |
| 186 | // PT quirk: spectrum analyzer is still handled here even if channel is muted |
| 187 | updateSpectrumAnalyzercxx . . $ updateSpectrumAnalyzer(2b0f6589498b1c50).(s->volumecxx . . $ moduleSample_t#volume., tempPeriod); |
| 188 | } |
| 189 | else if (noteVal == -2) |
| 190 | { |
| 191 | // delete note and sample if illegal note (= -2, -1 = ignore) key was entered |
| 192 | |
| 193 | if (normalMode || editorcxx . . $ editor..pNoteFlagcxx . . $ editor_t#pNoteFlag. == 2) |
| 194 | { |
| 195 | if (!uicxx . . $ ui..samplerScreenShowncxx . . $ ui_t#samplerScreenShown. && (editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. == MODE_EDITcxx . . $ MODE_EDIT. || editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. == MODE_RECORDcxx . . $ MODE_RECORD.)) |
| 196 | { |
| 197 | note->periodcxx . . $ note_t#period. = 0; |
| 198 | note->samplecxx . . $ note_t#sample. = 0; |
| 199 | |
| 200 | if (editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. != MODE_RECORDcxx . . $ MODE_RECORD.) |
| 201 | modSetPoscxx . . $ modSetPos(af780a7c10c7990f).(DONT_SET_ORDERcxx . . $ DONT_SET_ORDER., (songcxx . . $ song.->currRowcxx . . $ module_t#currRow. + editorcxx . . $ editor..editMoveAddcxx . . $ editor_t#editMoveAdd.) & 63); |
| 202 | |
| 203 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 204 | } |
| 205 | } |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | void handleEditKeyscxx . . $ handleEditKeys(a7e180099d3f0b9c).(SDL_Scancodecxx . . $ SDL_Scancode# scancode, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! normalMode) |
| 210 | { |
| 211 | if (uicxx . . $ ui..editTextFlagcxx . . $ ui_t#editTextFlag.) |
| 212 | return; |
| 213 | |
| 214 | if (uicxx . . $ ui..samplerScreenShowncxx . . $ ui_t#samplerScreenShown. || (editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. == MODE_IDLEcxx . . $ MODE_IDLE. || editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. == MODE_PLAYcxx . . $ MODE_PLAY.)) |
| 215 | { |
| 216 | // at this point it will only jam, not place it |
| 217 | if (!keybcxx . . $ keyb..leftAltPressedcxx . . $ keyb_t#leftAltPressed. && !keybcxx . . $ keyb..leftAmigaPressedcxx . . $ keyb_t#leftAmigaPressed. && !keybcxx . . $ keyb..leftCtrlPressedcxx . . $ keyb_t#leftCtrlPressed. && !keybcxx . . $ keyb..shiftPressedcxx . . $ keyb_t#shiftPressed.) |
| 218 | jamAndPlaceSamplecxx . . $ jamAndPlaceSample(a7e180099d3f0b9c).(scancode, normalMode); |
| 219 | |
| 220 | return; |
| 221 | } |
| 222 | |
| 223 | // handle modified (ALT/CTRL/SHIFT etc) keys for editing |
| 224 | if (editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. == MODE_EDITcxx . . $ MODE_EDIT. || editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. == MODE_RECORDcxx . . $ MODE_RECORD.) |
| 225 | { |
| 226 | if (handleSpecialKeyscxx . . $ handleSpecialKeys(701ccd9e525c23ba).(scancode)) |
| 227 | { |
| 228 | if (editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. != MODE_RECORDcxx . . $ MODE_RECORD.) |
| 229 | modSetPoscxx . . $ modSetPos(af780a7c10c7990f).(DONT_SET_ORDERcxx . . $ DONT_SET_ORDER., (songcxx . . $ song.->currRowcxx . . $ module_t#currRow. + editorcxx . . $ editor..editMoveAddcxx . . $ editor_t#editMoveAdd.) & 63); |
| 230 | |
| 231 | return; |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | // are we editing a note, or other stuff? |
| 236 | if (cursorcxx . . $ cursor..modecxx . . $ cursor_t#mode. != CURSOR_NOTEcxx . . $ CURSOR_NOTE.) |
| 237 | { |
| 238 | // if we held down any key modifier at this point, then do nothing |
| 239 | if (keybcxx . . $ keyb..leftAltPressedcxx . . $ keyb_t#leftAltPressed. || keybcxx . . $ keyb..leftAmigaPressedcxx . . $ keyb_t#leftAmigaPressed. || keybcxx . . $ keyb..leftCtrlPressedcxx . . $ keyb_t#leftCtrlPressed. || keybcxx . . $ keyb..shiftPressedcxx . . $ keyb_t#shiftPressed.) |
| 240 | return; |
| 241 | |
| 242 | if (editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. == MODE_EDITcxx . . $ MODE_EDIT. || editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. == MODE_RECORDcxx . . $ MODE_RECORD.) |
| 243 | { |
| 244 | int8_tcxx . . $ int8_t# hexKey, numberKey; |
| 245 | |
| 246 | if (scancode == SDL_SCANCODE_0cxx . . $ SDL_SCANCODE_0.) |
| 247 | numberKey = 0; |
| 248 | else if (scancode >= SDL_SCANCODE_1cxx . . $ SDL_SCANCODE_1. && scancode <= SDL_SCANCODE_9cxx . . $ SDL_SCANCODE_9.) |
| 249 | numberKey = (int8_tcxx . . $ int8_t#)scancode - (SDL_SCANCODE_1cxx . . $ SDL_SCANCODE_1.-1); |
| 250 | else |
| 251 | numberKey = -1; |
| 252 | |
| 253 | if (scancode >= SDL_SCANCODE_Acxx . . $ SDL_SCANCODE_A. && scancode <= SDL_SCANCODE_Fcxx . . $ SDL_SCANCODE_F.) |
| 254 | hexKey = 10 + ((int8_tcxx . . $ int8_t#)scancode - SDL_SCANCODE_Acxx . . $ SDL_SCANCODE_A.); |
| 255 | else |
| 256 | hexKey = -1; |
| 257 | |
| 258 | int8_tcxx . . $ int8_t# key = -1; |
| 259 | if (numberKey != -1) |
| 260 | { |
| 261 | if (key == -1) |
| 262 | key = 0; |
| 263 | |
| 264 | key += numberKey; |
| 265 | } |
| 266 | |
| 267 | if (hexKey != -1) |
| 268 | { |
| 269 | if (key == -1) |
| 270 | key = 0; |
| 271 | |
| 272 | key += hexKey; |
| 273 | } |
| 274 | |
| 275 | note_tcxx . . $ note_t# *note = &songcxx . . $ song.->patternscxx . . $ module_t#patterns.[songcxx . . $ song.->currPatterncxx . . $ module_t#currPattern.][(songcxx . . $ song.->currRowcxx . . $ module_t#currRow. * PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!) + cursorcxx . . $ cursor..channelcxx . . $ cursor_t#channel.]; |
| 276 | switch (cursorcxx . . $ cursor..modecxx . . $ cursor_t#mode.) |
| 277 | { |
| 278 | case CURSOR_SAMPLE1cxx . . $ CURSOR_SAMPLE1.: |
| 279 | { |
| 280 | if (key != -1 && key < 2) |
| 281 | { |
| 282 | note->samplecxx . . $ note_t#sample. = (uint8_tcxx . . $ uint8_t#)((note->samplecxx . . $ note_t#sample. & 0x0F) | (key << 4)); |
| 283 | |
| 284 | if (editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. != MODE_RECORDcxx . . $ MODE_RECORD.) |
| 285 | modSetPoscxx . . $ modSetPos(af780a7c10c7990f).(DONT_SET_ORDERcxx . . $ DONT_SET_ORDER., (songcxx . . $ song.->currRowcxx . . $ module_t#currRow. + editorcxx . . $ editor..editMoveAddcxx . . $ editor_t#editMoveAdd.) & 63); |
| 286 | |
| 287 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 288 | } |
| 289 | } |
| 290 | break; |
| 291 | |
| 292 | case CURSOR_SAMPLE2cxx . . $ CURSOR_SAMPLE2.: |
| 293 | { |
| 294 | if (key != -1 && key < 16) |
| 295 | { |
| 296 | note->samplecxx . . $ note_t#sample. = (uint8_tcxx . . $ uint8_t#)((note->samplecxx . . $ note_t#sample. & 0xF0) | key); |
| 297 | |
| 298 | if (editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. != MODE_RECORDcxx . . $ MODE_RECORD.) |
| 299 | modSetPoscxx . . $ modSetPos(af780a7c10c7990f).(DONT_SET_ORDERcxx . . $ DONT_SET_ORDER., (songcxx . . $ song.->currRowcxx . . $ module_t#currRow. + editorcxx . . $ editor..editMoveAddcxx . . $ editor_t#editMoveAdd.) & 63); |
| 300 | |
| 301 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 302 | } |
| 303 | } |
| 304 | break; |
| 305 | |
| 306 | case CURSOR_CMDcxx . . $ CURSOR_CMD.: |
| 307 | { |
| 308 | if (key != -1 && key < 16) |
| 309 | { |
| 310 | note->commandcxx . . $ note_t#command. = (uint8_tcxx . . $ uint8_t#)key; |
| 311 | |
| 312 | if (editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. != MODE_RECORDcxx . . $ MODE_RECORD.) |
| 313 | modSetPoscxx . . $ modSetPos(af780a7c10c7990f).(DONT_SET_ORDERcxx . . $ DONT_SET_ORDER., (songcxx . . $ song.->currRowcxx . . $ module_t#currRow. + editorcxx . . $ editor..editMoveAddcxx . . $ editor_t#editMoveAdd.) & 63); |
| 314 | |
| 315 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 316 | } |
| 317 | } |
| 318 | break; |
| 319 | |
| 320 | case CURSOR_PARAM1cxx . . $ CURSOR_PARAM1.: |
| 321 | { |
| 322 | if (key != -1 && key < 16) |
| 323 | { |
| 324 | note->paramcxx . . $ note_t#param. = (uint8_tcxx . . $ uint8_t#)((note->paramcxx . . $ note_t#param. & 0x0F) | (key << 4)); |
| 325 | |
| 326 | if (editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. != MODE_RECORDcxx . . $ MODE_RECORD.) |
| 327 | modSetPoscxx . . $ modSetPos(af780a7c10c7990f).(DONT_SET_ORDERcxx . . $ DONT_SET_ORDER., (songcxx . . $ song.->currRowcxx . . $ module_t#currRow. + editorcxx . . $ editor..editMoveAddcxx . . $ editor_t#editMoveAdd.) & 63); |
| 328 | |
| 329 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 330 | } |
| 331 | } |
| 332 | break; |
| 333 | |
| 334 | case CURSOR_PARAM2cxx . . $ CURSOR_PARAM2.: |
| 335 | { |
| 336 | if (key != -1 && key < 16) |
| 337 | { |
| 338 | note->paramcxx . . $ note_t#param. = (uint8_tcxx . . $ uint8_t#)((note->paramcxx . . $ note_t#param. & 0xF0) | key); |
| 339 | |
| 340 | if (editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. != MODE_RECORDcxx . . $ MODE_RECORD.) |
| 341 | modSetPoscxx . . $ modSetPos(af780a7c10c7990f).(DONT_SET_ORDERcxx . . $ DONT_SET_ORDER., (songcxx . . $ song.->currRowcxx . . $ module_t#currRow. + editorcxx . . $ editor..editMoveAddcxx . . $ editor_t#editMoveAdd.) & 63); |
| 342 | |
| 343 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 344 | } |
| 345 | } |
| 346 | break; |
| 347 | |
| 348 | default: break; |
| 349 | } |
| 350 | } |
| 351 | } |
| 352 | else |
| 353 | { |
| 354 | if (scancode == SDL_SCANCODE_DELETEcxx . . $ SDL_SCANCODE_DELETE.) |
| 355 | { |
| 356 | if (editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. == MODE_EDITcxx . . $ MODE_EDIT. || editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. == MODE_RECORDcxx . . $ MODE_RECORD.) |
| 357 | { |
| 358 | note_tcxx . . $ note_t# *note = &songcxx . . $ song.->patternscxx . . $ module_t#patterns.[songcxx . . $ song.->currPatterncxx . . $ module_t#currPattern.][(songcxx . . $ song.->currRowcxx . . $ module_t#currRow. * PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!) + cursorcxx . . $ cursor..channelcxx . . $ cursor_t#channel.]; |
| 359 | |
| 360 | if (!keybcxx . . $ keyb..leftAltPressedcxx . . $ keyb_t#leftAltPressed.) |
| 361 | { |
| 362 | note->samplecxx . . $ note_t#sample. = 0; |
| 363 | note->periodcxx . . $ note_t#period. = 0; |
| 364 | } |
| 365 | |
| 366 | if (keybcxx . . $ keyb..shiftPressedcxx . . $ keyb_t#shiftPressed. || keybcxx . . $ keyb..leftAltPressedcxx . . $ keyb_t#leftAltPressed.) |
| 367 | { |
| 368 | note->commandcxx . . $ note_t#command. = 0; |
| 369 | note->paramcxx . . $ note_t#param. = 0; |
| 370 | } |
| 371 | |
| 372 | if (editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. != MODE_RECORDcxx . . $ MODE_RECORD.) |
| 373 | modSetPoscxx . . $ modSetPos(af780a7c10c7990f).(DONT_SET_ORDERcxx . . $ DONT_SET_ORDER., (songcxx . . $ song.->currRowcxx . . $ module_t#currRow. + editorcxx . . $ editor..editMoveAddcxx . . $ editor_t#editMoveAdd.) & 63); |
| 374 | |
| 375 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 376 | } |
| 377 | } |
| 378 | else |
| 379 | { |
| 380 | // if we held down any key modifier at this point, then do nothing |
| 381 | if (keybcxx . . $ keyb..leftAltPressedcxx . . $ keyb_t#leftAltPressed. || keybcxx . . $ keyb..leftAmigaPressedcxx . . $ keyb_t#leftAmigaPressed. || keybcxx . . $ keyb..leftCtrlPressedcxx . . $ keyb_t#leftCtrlPressed. || keybcxx . . $ keyb..shiftPressedcxx . . $ keyb_t#shiftPressed.) |
| 382 | return; |
| 383 | |
| 384 | jamAndPlaceSamplecxx . . $ jamAndPlaceSample(a7e180099d3f0b9c).(scancode, normalMode); |
| 385 | } |
| 386 | } |
| 387 | } |
| 388 | |
| 389 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! handleSpecialKeyscxx . . $ handleSpecialKeys(701ccd9e525c23ba).(SDL_Scancodecxx . . $ SDL_Scancode# scancode) |
| 390 | { |
| 391 | if (!keybcxx . . $ keyb..leftAltPressedcxx . . $ keyb_t#leftAltPressed.) |
| 392 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 393 | |
| 394 | note_tcxx . . $ note_t# *patt = songcxx . . $ song.->patternscxx . . $ module_t#patterns.[songcxx . . $ song.->currPatterncxx . . $ module_t#currPattern.]; |
| 395 | note_tcxx . . $ note_t# *note = &patt[(songcxx . . $ song.->currRowcxx . . $ module_t#currRow. * PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!) + cursorcxx . . $ cursor..channelcxx . . $ cursor_t#channel.]; |
| 396 | note_tcxx . . $ note_t# *prevNote = &patt[(((songcxx . . $ song.->currRowcxx . . $ module_t#currRow. - 1) & 63) * PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!) + cursorcxx . . $ cursor..channelcxx . . $ cursor_t#channel.]; |
| 397 | |
| 398 | if (scancode >= SDL_SCANCODE_1cxx . . $ SDL_SCANCODE_1. && scancode <= SDL_SCANCODE_0cxx . . $ SDL_SCANCODE_0.) |
| 399 | { |
| 400 | // insert stored effect (buffer[0..8]) |
| 401 | note->commandcxx . . $ note_t#command. = editorcxx . . $ editor..effectMacroscxx . . $ editor_t#effectMacros.[scancode - SDL_SCANCODE_1cxx . . $ SDL_SCANCODE_1.] >> 8; |
| 402 | note->paramcxx . . $ note_t#param. = editorcxx . . $ editor..effectMacroscxx . . $ editor_t#effectMacros.[scancode - SDL_SCANCODE_1cxx . . $ SDL_SCANCODE_1.] & 0xFF; |
| 403 | |
| 404 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 405 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 406 | } |
| 407 | |
| 408 | // copy command+effect from above into current command+effect |
| 409 | if (scancode == SDL_SCANCODE_BACKSLASHcxx . . $ SDL_SCANCODE_BACKSLASH.) |
| 410 | { |
| 411 | note->commandcxx . . $ note_t#command. = prevNote->commandcxx . . $ note_t#command.; |
| 412 | note->paramcxx . . $ note_t#param. = prevNote->paramcxx . . $ note_t#param.; |
| 413 | |
| 414 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 415 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 416 | } |
| 417 | |
| 418 | // copy command+(effect + 1) from above into current command+effect |
| 419 | if (scancode == SDL_SCANCODE_EQUALScxx . . $ SDL_SCANCODE_EQUALS.) |
| 420 | { |
| 421 | note->commandcxx . . $ note_t#command. = prevNote->commandcxx . . $ note_t#command.; |
| 422 | note->paramcxx . . $ note_t#param. = prevNote->paramcxx . . $ note_t#param. + 1; // wraps 0x00..0xFF |
| 423 | |
| 424 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 425 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 426 | } |
| 427 | |
| 428 | // copy command+(effect - 1) from above into current command+effect |
| 429 | if (scancode == SDL_SCANCODE_MINUScxx . . $ SDL_SCANCODE_MINUS.) |
| 430 | { |
| 431 | note->commandcxx . . $ note_t#command. = prevNote->commandcxx . . $ note_t#command.; |
| 432 | note->paramcxx . . $ note_t#param. = prevNote->paramcxx . . $ note_t#param. - 1; // wraps 0x00..0xFF |
| 433 | |
| 434 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 435 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 436 | } |
| 437 | |
| 438 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 439 | } |
| 440 | |
| 441 | void handleSampleJammingcxx . . $ handleSampleJamming(decbd40bd4dd73ad).(SDL_Scancodecxx . . $ SDL_Scancode# scancode) // used for the sampling feature (in SAMPLER) |
| 442 | { |
| 443 | const int32_tcxx . . $ int32_t# chNum = cursorcxx . . $ cursor..channelcxx . . $ cursor_t#channel.; |
| 444 | |
| 445 | if (scancode == SDL_SCANCODE_NONUSBACKSLASHcxx . . $ SDL_SCANCODE_NONUSBACKSLASH.) |
| 446 | { |
| 447 | turnOffVoicescxx . . $ turnOffVoices(49f6e7a06ebc5aa8).(); // magic "kill all voices" button |
| 448 | return; |
| 449 | } |
| 450 | |
| 451 | int8_tcxx . . $ int8_t# noteVal = keyToNotecxx . . $ keyToNote(a7fb186c51a7e989).(scancode); |
| 452 | if (noteVal < 0 || noteVal > 35) |
| 453 | return; |
| 454 | |
| 455 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 456 | if (s->lengthcxx . . $ moduleSample_t#length. <= 1) |
| 457 | return; |
| 458 | |
| 459 | moduleChannel_tcxx . . $ moduleChannel_t# *ch = &songcxx . . $ song.->channelscxx . . $ module_t#channels.[chNum]; |
| 460 | |
| 461 | int8_tcxx . . $ int8_t# *n_start = &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.]; |
| 462 | int8_tcxx . . $ int8_t# vol = 64; |
| 463 | uint16_tcxx . . $ uint16_t# n_length = (uint16_tcxx . . $ uint16_t#)(s->lengthcxx . . $ moduleSample_t#length. >> 1); |
| 464 | uint16_tcxx . . $ uint16_t# period = periodTablecxx . . $ periodTable.[((s->fineTunecxx . . $ moduleSample_t#fineTune. & 0xF) * 37) + noteVal]; |
| 465 | |
| 466 | lockAudiocxx . . $ lockAudio(49f6e7a06ebc5aa8).(); |
| 467 | |
| 468 | ch->n_samplenumcxx . . $ moduleChannel_t#n_samplenum. = editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.; // needed for sample playback/sampling line |
| 469 | |
| 470 | const uint32_tcxx . . $ uint32_t# voiceAddr = 0xDFF0A0 + (chNum * 16); |
| 471 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(voiceAddr + 8, vol); |
| 472 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(voiceAddr + 6, period); |
| 473 | paulaWritePtrcxx . . $ paulaWritePtr(8ed931be62ea155e).(voiceAddr + 0, n_start); |
| 474 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(voiceAddr + 4, n_length); |
| 475 | |
| 476 | if (!editorcxx . . $ editor..mutedcxx . . $ editor_t#muted.[chNum]) |
| 477 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(0xDFF096, 0x8000 | ch->n_dmabitcxx . . $ moduleChannel_t#n_dmabit.); // voice DMA on |
| 478 | else |
| 479 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(0xDFF096, ch->n_dmabitcxx . . $ moduleChannel_t#n_dmabit.); // voice DMA off |
| 480 | |
| 481 | // these take effect after the current DMA cycle is done |
| 482 | paulaWritePtrcxx . . $ paulaWritePtr(8ed931be62ea155e).(voiceAddr + 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); // data |
| 483 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(voiceAddr + 4, 1); // length |
| 484 | |
| 485 | // update tracker visuals |
| 486 | |
| 487 | setVisualsVolumecxx . . $ setVisualsVolume(a7050f1a4cb56049).(chNum, vol); |
| 488 | setVisualsPeriodcxx . . $ setVisualsPeriod(a7050f1a4cb56049).(chNum, period); |
| 489 | setVisualsDataPtrcxx . . $ setVisualsDataPtr(70eb3de2aab3469c).(chNum, n_start); |
| 490 | setVisualsLengthcxx . . $ setVisualsLength(a7050f1a4cb56049).(chNum, n_length); |
| 491 | |
| 492 | if (!editorcxx . . $ editor..mutedcxx . . $ editor_t#muted.[chNum]) |
| 493 | setVisualsDMACONcxx . . $ setVisualsDMACON(ed53e3bbd3fa2f69).(0x8000 | ch->n_dmabitcxx . . $ moduleChannel_t#n_dmabit.); |
| 494 | else |
| 495 | setVisualsDMACONcxx . . $ setVisualsDMACON(ed53e3bbd3fa2f69).(ch->n_dmabitcxx . . $ moduleChannel_t#n_dmabit.); |
| 496 | |
| 497 | setVisualsDataPtrcxx . . $ setVisualsDataPtr(70eb3de2aab3469c).(chNum, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 498 | setVisualsLengthcxx . . $ setVisualsLength(a7050f1a4cb56049).(chNum, 1); |
| 499 | |
| 500 | unlockAudiocxx . . $ unlockAudio(49f6e7a06ebc5aa8).(); |
| 501 | } |
| 502 | |
| 503 | void saveUndocxx . . $ saveUndo(49f6e7a06ebc5aa8).(void) |
| 504 | { |
| 505 | memcpycxx . . $ memcpy(cc817cb175f282d).(editorcxx . . $ editor..undoBuffercxx . . $ editor_t#undoBuffer., songcxx . . $ song.->patternscxx . . $ module_t#patterns.[songcxx . . $ song.->currPatterncxx . . $ module_t#currPattern.], sizeof (note_tcxx . . $ note_t#) * (PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`! * MOD_ROWScxx . . $ `src/pt2_header.h:73:9`!)); |
| 506 | } |
| 507 | |
| 508 | void undoLastChangecxx . . $ undoLastChange(49f6e7a06ebc5aa8).(void) |
| 509 | { |
| 510 | for (uint16_tcxx . . $ uint16_t# i = 0; i < MOD_ROWScxx . . $ `src/pt2_header.h:73:9`! * PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!; i++) |
| 511 | { |
| 512 | note_tcxx . . $ note_t# data = editorcxx . . $ editor..undoBuffercxx . . $ editor_t#undoBuffer.[i]; |
| 513 | editorcxx . . $ editor..undoBuffercxx . . $ editor_t#undoBuffer.[i] = songcxx . . $ song.->patternscxx . . $ module_t#patterns.[songcxx . . $ song.->currPatterncxx . . $ module_t#currPattern.][i]; |
| 514 | songcxx . . $ song.->patternscxx . . $ module_t#patterns.[songcxx . . $ song.->currPatterncxx . . $ module_t#currPattern.][i] = data; |
| 515 | } |
| 516 | |
| 517 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 518 | uicxx . . $ ui..updatePatternDatacxx . . $ ui_t#updatePatternData. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 519 | } |
| 520 | |
| 521 | void copySampleTrackcxx . . $ copySampleTrack(49f6e7a06ebc5aa8).(void) |
| 522 | { |
| 523 | if (editorcxx . . $ editor..trackPattFlagcxx . . $ editor_t#trackPattFlag. == 2) |
| 524 | { |
| 525 | // copy from one sample slot to another |
| 526 | |
| 527 | // never attempt to swap if from and/or to is 0 |
| 528 | if (editorcxx . . $ editor..sampleFromcxx . . $ editor_t#sampleFrom. == 0 || editorcxx . . $ editor..sampleTocxx . . $ editor_t#sampleTo. == 0) |
| 529 | { |
| 530 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("FROM/TO = 0 !"); |
| 531 | return; |
| 532 | } |
| 533 | |
| 534 | moduleSample_tcxx . . $ moduleSample_t# *smpTo = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..sampleTocxx . . $ editor_t#sampleTo. - 1]; |
| 535 | moduleSample_tcxx . . $ moduleSample_t# *smpFrom = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..sampleFromcxx . . $ editor_t#sampleFrom. - 1]; |
| 536 | |
| 537 | turnOffVoicescxx . . $ turnOffVoices(49f6e7a06ebc5aa8).(); |
| 538 | |
| 539 | // copy |
| 540 | uint32_tcxx . . $ uint32_t# tmpOffset = smpTo->offsetcxx . . $ moduleSample_t#offset.; |
| 541 | *smpTo = *smpFrom; |
| 542 | smpTo->offsetcxx . . $ moduleSample_t#offset. = tmpOffset; |
| 543 | |
| 544 | // update the copied sample's GUI text pointers |
| 545 | smpTo->volumeDispcxx . . $ moduleSample_t#volumeDisp. = &smpTo->volumecxx . . $ moduleSample_t#volume.; |
| 546 | smpTo->lengthDispcxx . . $ moduleSample_t#lengthDisp. = &smpTo->lengthcxx . . $ moduleSample_t#length.; |
| 547 | smpTo->loopStartDispcxx . . $ moduleSample_t#loopStartDisp. = &smpTo->loopStartcxx . . $ moduleSample_t#loopStart.; |
| 548 | smpTo->loopLengthDispcxx . . $ moduleSample_t#loopLengthDisp. = &smpTo->loopLengthcxx . . $ moduleSample_t#loopLength.; |
| 549 | |
| 550 | // copy sample data |
| 551 | memcpycxx . . $ memcpy(cc817cb175f282d).(&songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[smpTo->offsetcxx . . $ moduleSample_t#offset.], &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[smpFrom->offsetcxx . . $ moduleSample_t#offset.], configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.); |
| 552 | |
| 553 | updateCurrSamplecxx . . $ updateCurrSample(49f6e7a06ebc5aa8).(); |
| 554 | uicxx . . $ ui..updateSongSizecxx . . $ ui_t#updateSongSize. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 555 | } |
| 556 | else |
| 557 | { |
| 558 | // copy sample number in track/pattern |
| 559 | if (editorcxx . . $ editor..trackPattFlagcxx . . $ editor_t#trackPattFlag. == 0) |
| 560 | { |
| 561 | for (int32_tcxx . . $ int32_t# i = 0; i < MOD_ROWScxx . . $ `src/pt2_header.h:73:9`!; i++) |
| 562 | { |
| 563 | note_tcxx . . $ note_t# *noteSrc = &songcxx . . $ song.->patternscxx . . $ module_t#patterns.[songcxx . . $ song.->currPatterncxx . . $ module_t#currPattern.][(i * PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!) + cursorcxx . . $ cursor..channelcxx . . $ cursor_t#channel.]; |
| 564 | if (noteSrc->samplecxx . . $ note_t#sample. == editorcxx . . $ editor..sampleFromcxx . . $ editor_t#sampleFrom.) |
| 565 | noteSrc->samplecxx . . $ note_t#sample. = editorcxx . . $ editor..sampleTocxx . . $ editor_t#sampleTo.; |
| 566 | } |
| 567 | } |
| 568 | else |
| 569 | { |
| 570 | for (int32_tcxx . . $ int32_t# i = 0; i < PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!; i++) |
| 571 | { |
| 572 | for (int32_tcxx . . $ int32_t# j = 0; j < MOD_ROWScxx . . $ `src/pt2_header.h:73:9`!; j++) |
| 573 | { |
| 574 | note_tcxx . . $ note_t# *noteSrc = &songcxx . . $ song.->patternscxx . . $ module_t#patterns.[songcxx . . $ song.->currPatterncxx . . $ module_t#currPattern.][(j * PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!) + i]; |
| 575 | if (noteSrc->samplecxx . . $ note_t#sample. == editorcxx . . $ editor..sampleFromcxx . . $ editor_t#sampleFrom.) |
| 576 | noteSrc->samplecxx . . $ note_t#sample. = editorcxx . . $ editor..sampleTocxx . . $ editor_t#sampleTo.; |
| 577 | } |
| 578 | } |
| 579 | } |
| 580 | |
| 581 | uicxx . . $ ui..updatePatternDatacxx . . $ ui_t#updatePatternData. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 582 | } |
| 583 | |
| 584 | editorcxx . . $ editor..samplePoscxx . . $ editor_t#samplePos. = 0; |
| 585 | updateSamplePoscxx . . $ updateSamplePos(49f6e7a06ebc5aa8).(); |
| 586 | |
| 587 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 588 | } |
| 589 | |
| 590 | void exchSampleTrackcxx . . $ exchSampleTrack(49f6e7a06ebc5aa8).(void) |
| 591 | { |
| 592 | if (editorcxx . . $ editor..trackPattFlagcxx . . $ editor_t#trackPattFlag. == 2) |
| 593 | { |
| 594 | // exchange sample slots |
| 595 | |
| 596 | // never attempt to swap if from and/or to is 0 |
| 597 | if (editorcxx . . $ editor..sampleFromcxx . . $ editor_t#sampleFrom. == 0 || editorcxx . . $ editor..sampleTocxx . . $ editor_t#sampleTo. == 0) |
| 598 | { |
| 599 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("FROM/TO = 0 !"); |
| 600 | return; |
| 601 | } |
| 602 | |
| 603 | moduleSample_tcxx . . $ moduleSample_t# *smpTo = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..sampleTocxx . . $ editor_t#sampleTo.-1]; |
| 604 | moduleSample_tcxx . . $ moduleSample_t# *smpFrom = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..sampleFromcxx . . $ editor_t#sampleFrom.-1]; |
| 605 | |
| 606 | turnOffVoicescxx . . $ turnOffVoices(49f6e7a06ebc5aa8).(); |
| 607 | |
| 608 | // swap offsets first so that the next swap will leave offsets intact |
| 609 | uint32_tcxx . . $ uint32_t# tmpOffset = smpFrom->offsetcxx . . $ moduleSample_t#offset.; |
| 610 | smpFrom->offsetcxx . . $ moduleSample_t#offset. = smpTo->offsetcxx . . $ moduleSample_t#offset.; |
| 611 | smpTo->offsetcxx . . $ moduleSample_t#offset. = tmpOffset; |
| 612 | |
| 613 | // swap sample (now offsets are left as before) |
| 614 | moduleSample_tcxx . . $ moduleSample_t# smpTmp = *smpFrom; |
| 615 | *smpFrom = *smpTo; |
| 616 | *smpTo = smpTmp; |
| 617 | |
| 618 | // update the swapped sample's GUI text pointers |
| 619 | smpFrom->volumeDispcxx . . $ moduleSample_t#volumeDisp. = &smpFrom->volumecxx . . $ moduleSample_t#volume.; |
| 620 | smpFrom->lengthDispcxx . . $ moduleSample_t#lengthDisp. = &smpFrom->lengthcxx . . $ moduleSample_t#length.; |
| 621 | smpFrom->loopStartDispcxx . . $ moduleSample_t#loopStartDisp. = &smpFrom->loopStartcxx . . $ moduleSample_t#loopStart.; |
| 622 | smpFrom->loopLengthDispcxx . . $ moduleSample_t#loopLengthDisp. = &smpFrom->loopLengthcxx . . $ moduleSample_t#loopLength.; |
| 623 | smpTo->volumeDispcxx . . $ moduleSample_t#volumeDisp. = &smpTo->volumecxx . . $ moduleSample_t#volume.; |
| 624 | smpTo->lengthDispcxx . . $ moduleSample_t#lengthDisp. = &smpTo->lengthcxx . . $ moduleSample_t#length.; |
| 625 | smpTo->loopStartDispcxx . . $ moduleSample_t#loopStartDisp. = &smpTo->loopStartcxx . . $ moduleSample_t#loopStart.; |
| 626 | smpTo->loopLengthDispcxx . . $ moduleSample_t#loopLengthDisp. = &smpTo->loopLengthcxx . . $ moduleSample_t#loopLength.; |
| 627 | |
| 628 | // swap sample data |
| 629 | for (int32_tcxx . . $ int32_t# i = 0; i < configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.; i++) |
| 630 | { |
| 631 | int8_tcxx . . $ int8_t# smp = songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[smpFrom->offsetcxx . . $ moduleSample_t#offset.+i]; |
| 632 | songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[smpFrom->offsetcxx . . $ moduleSample_t#offset.+i] = songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[smpTo->offsetcxx . . $ moduleSample_t#offset.+i]; |
| 633 | songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[smpTo->offsetcxx . . $ moduleSample_t#offset.+i] = smp; |
| 634 | } |
| 635 | |
| 636 | editorcxx . . $ editor..sampleZerocxx . . $ editor_t#sampleZero. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 637 | |
| 638 | updateCurrSamplecxx . . $ updateCurrSample(49f6e7a06ebc5aa8).(); |
| 639 | } |
| 640 | else |
| 641 | { |
| 642 | // exchange sample number in track/pattern |
| 643 | if (editorcxx . . $ editor..trackPattFlagcxx . . $ editor_t#trackPattFlag. == 0) |
| 644 | { |
| 645 | for (int32_tcxx . . $ int32_t# i = 0; i < MOD_ROWScxx . . $ `src/pt2_header.h:73:9`!; i++) |
| 646 | { |
| 647 | note_tcxx . . $ note_t# *noteSrc = &songcxx . . $ song.->patternscxx . . $ module_t#patterns.[songcxx . . $ song.->currPatterncxx . . $ module_t#currPattern.][(i * PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!) + cursorcxx . . $ cursor..channelcxx . . $ cursor_t#channel.]; |
| 648 | |
| 649 | if (noteSrc->samplecxx . . $ note_t#sample. == editorcxx . . $ editor..sampleFromcxx . . $ editor_t#sampleFrom.) noteSrc->samplecxx . . $ note_t#sample. = editorcxx . . $ editor..sampleTocxx . . $ editor_t#sampleTo.; |
| 650 | else if (noteSrc->samplecxx . . $ note_t#sample. == editorcxx . . $ editor..sampleTocxx . . $ editor_t#sampleTo.) noteSrc->samplecxx . . $ note_t#sample. = editorcxx . . $ editor..sampleFromcxx . . $ editor_t#sampleFrom.; |
| 651 | } |
| 652 | } |
| 653 | else |
| 654 | { |
| 655 | for (int32_tcxx . . $ int32_t# i = 0; i < PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!; i++) |
| 656 | { |
| 657 | for (int32_tcxx . . $ int32_t# j = 0; j < MOD_ROWScxx . . $ `src/pt2_header.h:73:9`!; j++) |
| 658 | { |
| 659 | note_tcxx . . $ note_t# *noteSrc = &songcxx . . $ song.->patternscxx . . $ module_t#patterns.[songcxx . . $ song.->currPatterncxx . . $ module_t#currPattern.][(j * PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!) + i]; |
| 660 | |
| 661 | if (noteSrc->samplecxx . . $ note_t#sample. == editorcxx . . $ editor..sampleFromcxx . . $ editor_t#sampleFrom.) noteSrc->samplecxx . . $ note_t#sample. = editorcxx . . $ editor..sampleTocxx . . $ editor_t#sampleTo.; |
| 662 | else if (noteSrc->samplecxx . . $ note_t#sample. == editorcxx . . $ editor..sampleTocxx . . $ editor_t#sampleTo.) noteSrc->samplecxx . . $ note_t#sample. = editorcxx . . $ editor..sampleFromcxx . . $ editor_t#sampleFrom.; |
| 663 | } |
| 664 | } |
| 665 | } |
| 666 | |
| 667 | uicxx . . $ ui..updatePatternDatacxx . . $ ui_t#updatePatternData. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 668 | } |
| 669 | |
| 670 | editorcxx . . $ editor..samplePoscxx . . $ editor_t#samplePos. = 0; |
| 671 | updateSamplePoscxx . . $ updateSamplePos(49f6e7a06ebc5aa8).(); |
| 672 | |
| 673 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 674 | } |
| 675 | |
| 676 | void delSampleTrackcxx . . $ delSampleTrack(49f6e7a06ebc5aa8).(void) |
| 677 | { |
| 678 | saveUndocxx . . $ saveUndo(49f6e7a06ebc5aa8).(); |
| 679 | |
| 680 | if (editorcxx . . $ editor..trackPattFlagcxx . . $ editor_t#trackPattFlag. == 0) |
| 681 | { |
| 682 | for (int32_tcxx . . $ int32_t# i = 0; i < MOD_ROWScxx . . $ `src/pt2_header.h:73:9`!; i++) |
| 683 | { |
| 684 | note_tcxx . . $ note_t# *noteSrc = &songcxx . . $ song.->patternscxx . . $ module_t#patterns.[songcxx . . $ song.->currPatterncxx . . $ module_t#currPattern.][(i * PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!) + cursorcxx . . $ cursor..channelcxx . . $ cursor_t#channel.]; |
| 685 | if (noteSrc->samplecxx . . $ note_t#sample. == editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.+1) |
| 686 | { |
| 687 | noteSrc->periodcxx . . $ note_t#period. = 0; |
| 688 | noteSrc->samplecxx . . $ note_t#sample. = 0; |
| 689 | noteSrc->commandcxx . . $ note_t#command. = 0; |
| 690 | noteSrc->paramcxx . . $ note_t#param. = 0; |
| 691 | } |
| 692 | } |
| 693 | } |
| 694 | else |
| 695 | { |
| 696 | for (int32_tcxx . . $ int32_t# i = 0; i < PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!; i++) |
| 697 | { |
| 698 | for (int32_tcxx . . $ int32_t# j = 0; j < MOD_ROWScxx . . $ `src/pt2_header.h:73:9`!; j++) |
| 699 | { |
| 700 | note_tcxx . . $ note_t# *noteSrc = &songcxx . . $ song.->patternscxx . . $ module_t#patterns.[songcxx . . $ song.->currPatterncxx . . $ module_t#currPattern.][(j * PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!) + i]; |
| 701 | if (noteSrc->samplecxx . . $ note_t#sample. == editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.+1) |
| 702 | { |
| 703 | noteSrc->periodcxx . . $ note_t#period. = 0; |
| 704 | noteSrc->samplecxx . . $ note_t#sample. = 0; |
| 705 | noteSrc->commandcxx . . $ note_t#command. = 0; |
| 706 | noteSrc->paramcxx . . $ note_t#param. = 0; |
| 707 | } |
| 708 | } |
| 709 | } |
| 710 | } |
| 711 | |
| 712 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 713 | uicxx . . $ ui..updatePatternDatacxx . . $ ui_t#updatePatternData. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 714 | } |
| 715 | |
| 716 | void trackNoteUpcxx . . $ trackNoteUp(8f46639a028bea30).(boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! sampleAllFlag, uint8_tcxx . . $ uint8_t# from, uint8_tcxx . . $ uint8_t# to) |
| 717 | { |
| 718 | const uint8_tcxx . . $ uint8_t# transposeSample = editorcxx . . $ editor..sampleZerocxx . . $ editor_t#sampleZero. ? 0 : editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample. + 1; |
| 719 | |
| 720 | if (from > to) |
| 721 | { |
| 722 | uint8_tcxx . . $ uint8_t# old = from; |
| 723 | from = to; |
| 724 | to = old; |
| 725 | } |
| 726 | |
| 727 | saveUndocxx . . $ saveUndo(49f6e7a06ebc5aa8).(); |
| 728 | for (int32_tcxx . . $ int32_t# i = from; i <= to; i++) |
| 729 | { |
| 730 | note_tcxx . . $ note_t# *noteSrc = &songcxx . . $ song.->patternscxx . . $ module_t#patterns.[songcxx . . $ song.->currPatterncxx . . $ module_t#currPattern.][(i * PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!) + cursorcxx . . $ cursor..channelcxx . . $ cursor_t#channel.]; |
| 731 | |
| 732 | if (!sampleAllFlag && noteSrc->samplecxx . . $ note_t#sample. != transposeSample) |
| 733 | continue; |
| 734 | |
| 735 | if (noteSrc->periodcxx . . $ note_t#period.) |
| 736 | { |
| 737 | // period -> note |
| 738 | int32_tcxx . . $ int32_t# j; |
| 739 | for (j = 0; j < 36; j++) |
| 740 | { |
| 741 | if (noteSrc->periodcxx . . $ note_t#period. >= periodTablecxx . . $ periodTable.[j]) |
| 742 | break; |
| 743 | } |
| 744 | |
| 745 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! noteDeleted = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 746 | if (++j > 35) |
| 747 | { |
| 748 | j = 35; |
| 749 | |
| 750 | if (configcxx . . $ config..transDelcxx . . $ config_t#transDel.) |
| 751 | { |
| 752 | noteSrc->periodcxx . . $ note_t#period. = 0; |
| 753 | noteSrc->samplecxx . . $ note_t#sample. = 0; |
| 754 | |
| 755 | noteDeleted = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 756 | } |
| 757 | } |
| 758 | |
| 759 | if (!noteDeleted) |
| 760 | noteSrc->periodcxx . . $ note_t#period. = periodTablecxx . . $ periodTable.[j]; |
| 761 | } |
| 762 | } |
| 763 | |
| 764 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 765 | uicxx . . $ ui..updatePatternDatacxx . . $ ui_t#updatePatternData. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 766 | } |
| 767 | |
| 768 | void trackNoteDowncxx . . $ trackNoteDown(8f46639a028bea30).(boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! sampleAllFlag, uint8_tcxx . . $ uint8_t# from, uint8_tcxx . . $ uint8_t# to) |
| 769 | { |
| 770 | const uint8_tcxx . . $ uint8_t# transposeSample = editorcxx . . $ editor..sampleZerocxx . . $ editor_t#sampleZero. ? 0 : editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample. + 1; |
| 771 | |
| 772 | if (from > to) |
| 773 | { |
| 774 | uint8_tcxx . . $ uint8_t# old = from; |
| 775 | from = to; |
| 776 | to = old; |
| 777 | } |
| 778 | |
| 779 | saveUndocxx . . $ saveUndo(49f6e7a06ebc5aa8).(); |
| 780 | for (int32_tcxx . . $ int32_t# i = from; i <= to; i++) |
| 781 | { |
| 782 | note_tcxx . . $ note_t# *noteSrc = &songcxx . . $ song.->patternscxx . . $ module_t#patterns.[songcxx . . $ song.->currPatterncxx . . $ module_t#currPattern.][(i * PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!) + cursorcxx . . $ cursor..channelcxx . . $ cursor_t#channel.]; |
| 783 | |
| 784 | if (!sampleAllFlag && noteSrc->samplecxx . . $ note_t#sample. != transposeSample) |
| 785 | continue; |
| 786 | |
| 787 | if (noteSrc->periodcxx . . $ note_t#period.) |
| 788 | { |
| 789 | // period -> note |
| 790 | int32_tcxx . . $ int32_t# j; |
| 791 | for (j = 0; j < 36; j++) |
| 792 | { |
| 793 | if (noteSrc->periodcxx . . $ note_t#period. >= periodTablecxx . . $ periodTable.[j]) |
| 794 | break; |
| 795 | } |
| 796 | |
| 797 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! noteDeleted = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 798 | if (--j < 0) |
| 799 | { |
| 800 | j = 0; |
| 801 | |
| 802 | if (configcxx . . $ config..transDelcxx . . $ config_t#transDel.) |
| 803 | { |
| 804 | noteSrc->periodcxx . . $ note_t#period. = 0; |
| 805 | noteSrc->samplecxx . . $ note_t#sample. = 0; |
| 806 | |
| 807 | noteDeleted = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 808 | } |
| 809 | } |
| 810 | |
| 811 | if (!noteDeleted) |
| 812 | noteSrc->periodcxx . . $ note_t#period. = periodTablecxx . . $ periodTable.[j]; |
| 813 | } |
| 814 | } |
| 815 | |
| 816 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 817 | uicxx . . $ ui..updatePatternDatacxx . . $ ui_t#updatePatternData. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 818 | } |
| 819 | |
| 820 | void trackOctaUpcxx . . $ trackOctaUp(8f46639a028bea30).(boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! sampleAllFlag, uint8_tcxx . . $ uint8_t# from, uint8_tcxx . . $ uint8_t# to) |
| 821 | { |
| 822 | const uint8_tcxx . . $ uint8_t# transposeSample = editorcxx . . $ editor..sampleZerocxx . . $ editor_t#sampleZero. ? 0 : editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample. + 1; |
| 823 | |
| 824 | if (from > to) |
| 825 | { |
| 826 | uint8_tcxx . . $ uint8_t# old = from; |
| 827 | from = to; |
| 828 | to = old; |
| 829 | } |
| 830 | |
| 831 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! noteChanged = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 832 | |
| 833 | saveUndocxx . . $ saveUndo(49f6e7a06ebc5aa8).(); |
| 834 | for (int32_tcxx . . $ int32_t# i = from; i <= to; i++) |
| 835 | { |
| 836 | note_tcxx . . $ note_t# *noteSrc = &songcxx . . $ song.->patternscxx . . $ module_t#patterns.[songcxx . . $ song.->currPatterncxx . . $ module_t#currPattern.][(i * PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!) + cursorcxx . . $ cursor..channelcxx . . $ cursor_t#channel.]; |
| 837 | |
| 838 | if (!sampleAllFlag && noteSrc->samplecxx . . $ note_t#sample. != transposeSample) |
| 839 | continue; |
| 840 | |
| 841 | if (noteSrc->periodcxx . . $ note_t#period.) |
| 842 | { |
| 843 | uint16_tcxx . . $ uint16_t# oldPeriod = noteSrc->periodcxx . . $ note_t#period.; |
| 844 | |
| 845 | // period -> note |
| 846 | int32_tcxx . . $ int32_t# j; |
| 847 | for (j = 0; j < 36; j++) |
| 848 | { |
| 849 | if (noteSrc->periodcxx . . $ note_t#period. >= periodTablecxx . . $ periodTable.[j]) |
| 850 | break; |
| 851 | } |
| 852 | |
| 853 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! noteDeleted = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 854 | if (j+12 > 35 && configcxx . . $ config..transDelcxx . . $ config_t#transDel.) |
| 855 | { |
| 856 | noteSrc->periodcxx . . $ note_t#period. = 0; |
| 857 | noteSrc->samplecxx . . $ note_t#sample. = 0; |
| 858 | |
| 859 | noteDeleted = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 860 | } |
| 861 | |
| 862 | if (j <= 23) |
| 863 | j += 12; |
| 864 | |
| 865 | if (!noteDeleted) |
| 866 | noteSrc->periodcxx . . $ note_t#period. = periodTablecxx . . $ periodTable.[j]; |
| 867 | |
| 868 | if (noteSrc->periodcxx . . $ note_t#period. != oldPeriod) |
| 869 | noteChanged = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 870 | } |
| 871 | } |
| 872 | |
| 873 | if (noteChanged) |
| 874 | { |
| 875 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 876 | uicxx . . $ ui..updatePatternDatacxx . . $ ui_t#updatePatternData. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 877 | } |
| 878 | } |
| 879 | |
| 880 | void trackOctaDowncxx . . $ trackOctaDown(8f46639a028bea30).(boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! sampleAllFlag, uint8_tcxx . . $ uint8_t# from, uint8_tcxx . . $ uint8_t# to) |
| 881 | { |
| 882 | const uint8_tcxx . . $ uint8_t# transposeSample = editorcxx . . $ editor..sampleZerocxx . . $ editor_t#sampleZero. ? 0 : editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample. + 1; |
| 883 | |
| 884 | if (from > to) |
| 885 | { |
| 886 | uint8_tcxx . . $ uint8_t# old = from; |
| 887 | from = to; |
| 888 | to = old; |
| 889 | } |
| 890 | |
| 891 | saveUndocxx . . $ saveUndo(49f6e7a06ebc5aa8).(); |
| 892 | for (int32_tcxx . . $ int32_t# i = from; i <= to; i++) |
| 893 | { |
| 894 | note_tcxx . . $ note_t# *noteSrc = &songcxx . . $ song.->patternscxx . . $ module_t#patterns.[songcxx . . $ song.->currPatterncxx . . $ module_t#currPattern.][(i * PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!) + cursorcxx . . $ cursor..channelcxx . . $ cursor_t#channel.]; |
| 895 | |
| 896 | if (!sampleAllFlag && noteSrc->samplecxx . . $ note_t#sample. != transposeSample) |
| 897 | continue; |
| 898 | |
| 899 | if (noteSrc->periodcxx . . $ note_t#period.) |
| 900 | { |
| 901 | // period -> note |
| 902 | int32_tcxx . . $ int32_t# j; |
| 903 | for (j = 0; j < 36; j++) |
| 904 | { |
| 905 | if (noteSrc->periodcxx . . $ note_t#period. >= periodTablecxx . . $ periodTable.[j]) |
| 906 | break; |
| 907 | } |
| 908 | |
| 909 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! noteDeleted = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 910 | if (j-12 < 0 && configcxx . . $ config..transDelcxx . . $ config_t#transDel.) |
| 911 | { |
| 912 | noteSrc->periodcxx . . $ note_t#period. = 0; |
| 913 | noteSrc->samplecxx . . $ note_t#sample. = 0; |
| 914 | |
| 915 | noteDeleted = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 916 | } |
| 917 | |
| 918 | if (j >= 12) |
| 919 | j -= 12; |
| 920 | |
| 921 | if (!noteDeleted) |
| 922 | noteSrc->periodcxx . . $ note_t#period. = periodTablecxx . . $ periodTable.[j]; |
| 923 | } |
| 924 | } |
| 925 | |
| 926 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 927 | uicxx . . $ ui..updatePatternDatacxx . . $ ui_t#updatePatternData. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 928 | } |
| 929 | |
| 930 | void pattNoteUpcxx . . $ pattNoteUp(b45ddcbc8423892c).(boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! sampleAllFlag) |
| 931 | { |
| 932 | const uint8_tcxx . . $ uint8_t# transposeSample = editorcxx . . $ editor..sampleZerocxx . . $ editor_t#sampleZero. ? 0 : editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample. + 1; |
| 933 | |
| 934 | saveUndocxx . . $ saveUndo(49f6e7a06ebc5aa8).(); |
| 935 | for (int32_tcxx . . $ int32_t# i = 0; i < PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!; i++) |
| 936 | { |
| 937 | for (int32_tcxx . . $ int32_t# j = 0; j < MOD_ROWScxx . . $ `src/pt2_header.h:73:9`!; j++) |
| 938 | { |
| 939 | note_tcxx . . $ note_t# *noteSrc = &songcxx . . $ song.->patternscxx . . $ module_t#patterns.[songcxx . . $ song.->currPatterncxx . . $ module_t#currPattern.][(j * PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!) + i]; |
| 940 | |
| 941 | if (!sampleAllFlag && noteSrc->samplecxx . . $ note_t#sample. != transposeSample) |
| 942 | continue; |
| 943 | |
| 944 | if (noteSrc->periodcxx . . $ note_t#period.) |
| 945 | { |
| 946 | // period -> note |
| 947 | int32_tcxx . . $ int32_t# k; |
| 948 | for (k = 0; k < 36; k++) |
| 949 | { |
| 950 | if (noteSrc->periodcxx . . $ note_t#period. >= periodTablecxx . . $ periodTable.[k]) |
| 951 | break; |
| 952 | } |
| 953 | |
| 954 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! noteDeleted = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 955 | if (++k > 35) |
| 956 | { |
| 957 | k = 35; |
| 958 | |
| 959 | if (configcxx . . $ config..transDelcxx . . $ config_t#transDel.) |
| 960 | { |
| 961 | noteSrc->periodcxx . . $ note_t#period. = 0; |
| 962 | noteSrc->samplecxx . . $ note_t#sample. = 0; |
| 963 | |
| 964 | noteDeleted = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 965 | } |
| 966 | } |
| 967 | |
| 968 | if (!noteDeleted) |
| 969 | noteSrc->periodcxx . . $ note_t#period. = periodTablecxx . . $ periodTable.[k]; |
| 970 | } |
| 971 | } |
| 972 | } |
| 973 | |
| 974 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 975 | uicxx . . $ ui..updatePatternDatacxx . . $ ui_t#updatePatternData. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 976 | } |
| 977 | |
| 978 | void pattNoteDowncxx . . $ pattNoteDown(b45ddcbc8423892c).(boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! sampleAllFlag) |
| 979 | { |
| 980 | const uint8_tcxx . . $ uint8_t# transposeSample = editorcxx . . $ editor..sampleZerocxx . . $ editor_t#sampleZero. ? 0 : editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample. + 1; |
| 981 | |
| 982 | saveUndocxx . . $ saveUndo(49f6e7a06ebc5aa8).(); |
| 983 | for (int32_tcxx . . $ int32_t# i = 0; i < PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!; i++) |
| 984 | { |
| 985 | for (int32_tcxx . . $ int32_t# j = 0; j < MOD_ROWScxx . . $ `src/pt2_header.h:73:9`!; j++) |
| 986 | { |
| 987 | note_tcxx . . $ note_t# *noteSrc = &songcxx . . $ song.->patternscxx . . $ module_t#patterns.[songcxx . . $ song.->currPatterncxx . . $ module_t#currPattern.][(j * PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!) + i]; |
| 988 | |
| 989 | if (!sampleAllFlag && noteSrc->samplecxx . . $ note_t#sample. != transposeSample) |
| 990 | continue; |
| 991 | |
| 992 | if (noteSrc->periodcxx . . $ note_t#period.) |
| 993 | { |
| 994 | // period -> note |
| 995 | int32_tcxx . . $ int32_t# k; |
| 996 | for (k = 0; k < 36; k++) |
| 997 | { |
| 998 | if (noteSrc->periodcxx . . $ note_t#period. >= periodTablecxx . . $ periodTable.[k]) |
| 999 | break; |
| 1000 | } |
| 1001 | |
| 1002 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! noteDeleted = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 1003 | if (--k < 0) |
| 1004 | { |
| 1005 | k = 0; |
| 1006 | |
| 1007 | if (configcxx . . $ config..transDelcxx . . $ config_t#transDel.) |
| 1008 | { |
| 1009 | noteSrc->periodcxx . . $ note_t#period. = 0; |
| 1010 | noteSrc->samplecxx . . $ note_t#sample. = 0; |
| 1011 | |
| 1012 | noteDeleted = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 1013 | } |
| 1014 | } |
| 1015 | |
| 1016 | if (!noteDeleted) |
| 1017 | noteSrc->periodcxx . . $ note_t#period. = periodTablecxx . . $ periodTable.[k]; |
| 1018 | } |
| 1019 | } |
| 1020 | } |
| 1021 | |
| 1022 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 1023 | uicxx . . $ ui..updatePatternDatacxx . . $ ui_t#updatePatternData. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 1024 | } |
| 1025 | |
| 1026 | void pattOctaUpcxx . . $ pattOctaUp(b45ddcbc8423892c).(boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! sampleAllFlag) |
| 1027 | { |
| 1028 | const uint8_tcxx . . $ uint8_t# transposeSample = editorcxx . . $ editor..sampleZerocxx . . $ editor_t#sampleZero. ? 0 : editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample. + 1; |
| 1029 | |
| 1030 | saveUndocxx . . $ saveUndo(49f6e7a06ebc5aa8).(); |
| 1031 | for (int32_tcxx . . $ int32_t# i = 0; i < PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!; i++) |
| 1032 | { |
| 1033 | for (int32_tcxx . . $ int32_t# j = 0; j < MOD_ROWScxx . . $ `src/pt2_header.h:73:9`!; j++) |
| 1034 | { |
| 1035 | note_tcxx . . $ note_t# *noteSrc = &songcxx . . $ song.->patternscxx . . $ module_t#patterns.[songcxx . . $ song.->currPatterncxx . . $ module_t#currPattern.][(j * PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!) + i]; |
| 1036 | |
| 1037 | if (!sampleAllFlag && noteSrc->samplecxx . . $ note_t#sample. != transposeSample) |
| 1038 | continue; |
| 1039 | |
| 1040 | if (noteSrc->periodcxx . . $ note_t#period.) |
| 1041 | { |
| 1042 | // period -> note |
| 1043 | int32_tcxx . . $ int32_t# k; |
| 1044 | for (k = 0; k < 36; k++) |
| 1045 | { |
| 1046 | if (noteSrc->periodcxx . . $ note_t#period. >= periodTablecxx . . $ periodTable.[k]) |
| 1047 | break; |
| 1048 | } |
| 1049 | |
| 1050 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! noteDeleted = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 1051 | if (k+12 > 35 && configcxx . . $ config..transDelcxx . . $ config_t#transDel.) |
| 1052 | { |
| 1053 | noteSrc->periodcxx . . $ note_t#period. = 0; |
| 1054 | noteSrc->samplecxx . . $ note_t#sample. = 0; |
| 1055 | |
| 1056 | noteDeleted = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 1057 | } |
| 1058 | |
| 1059 | if (k <= 23) |
| 1060 | k += 12; |
| 1061 | |
| 1062 | if (!noteDeleted) |
| 1063 | noteSrc->periodcxx . . $ note_t#period. = periodTablecxx . . $ periodTable.[k]; |
| 1064 | } |
| 1065 | } |
| 1066 | } |
| 1067 | |
| 1068 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 1069 | uicxx . . $ ui..updatePatternDatacxx . . $ ui_t#updatePatternData. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 1070 | } |
| 1071 | |
| 1072 | void pattOctaDowncxx . . $ pattOctaDown(b45ddcbc8423892c).(boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! sampleAllFlag) |
| 1073 | { |
| 1074 | const uint8_tcxx . . $ uint8_t# transposeSample = editorcxx . . $ editor..sampleZerocxx . . $ editor_t#sampleZero. ? 0 : editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample. + 1; |
| 1075 | |
| 1076 | saveUndocxx . . $ saveUndo(49f6e7a06ebc5aa8).(); |
| 1077 | for (int32_tcxx . . $ int32_t# i = 0; i < PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!; i++) |
| 1078 | { |
| 1079 | for (int32_tcxx . . $ int32_t# j = 0; j < MOD_ROWScxx . . $ `src/pt2_header.h:73:9`!; j++) |
| 1080 | { |
| 1081 | note_tcxx . . $ note_t# *noteSrc = &songcxx . . $ song.->patternscxx . . $ module_t#patterns.[songcxx . . $ song.->currPatterncxx . . $ module_t#currPattern.][(j * PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!) + i]; |
| 1082 | |
| 1083 | if (!sampleAllFlag && noteSrc->samplecxx . . $ note_t#sample. != transposeSample) |
| 1084 | continue; |
| 1085 | |
| 1086 | if (noteSrc->periodcxx . . $ note_t#period.) |
| 1087 | { |
| 1088 | // period -> note |
| 1089 | int32_tcxx . . $ int32_t# k; |
| 1090 | for (k = 0; k < 36; k++) |
| 1091 | { |
| 1092 | if (noteSrc->periodcxx . . $ note_t#period. >= periodTablecxx . . $ periodTable.[k]) |
| 1093 | break; |
| 1094 | } |
| 1095 | |
| 1096 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! noteDeleted = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 1097 | if (k-12 < 0 && configcxx . . $ config..transDelcxx . . $ config_t#transDel.) |
| 1098 | { |
| 1099 | noteSrc->periodcxx . . $ note_t#period. = 0; |
| 1100 | noteSrc->samplecxx . . $ note_t#sample. = 0; |
| 1101 | |
| 1102 | noteDeleted = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 1103 | } |
| 1104 | |
| 1105 | if (k >= 12) |
| 1106 | k -= 12; |
| 1107 | |
| 1108 | if (!noteDeleted) |
| 1109 | noteSrc->periodcxx . . $ note_t#period. = periodTablecxx . . $ periodTable.[k]; |
| 1110 | } |
| 1111 | } |
| 1112 | } |
| 1113 | |
| 1114 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 1115 | uicxx . . $ ui..updatePatternDatacxx . . $ ui_t#updatePatternData. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 1116 | } |
| 1117 | |
| 1118 | int8_tcxx . . $ int8_t# keyToNotecxx . . $ keyToNote(a7fb186c51a7e989).(SDL_Scancodecxx . . $ SDL_Scancode# scancode) |
| 1119 | { |
| 1120 | int8_tcxx . . $ int8_t# note; |
| 1121 | |
| 1122 | if (scancode < SDL_SCANCODE_Bcxx . . $ SDL_SCANCODE_B. || scancode > SDL_SCANCODE_SLASHcxx . . $ SDL_SCANCODE_SLASH.) |
| 1123 | return -1; // not a note key |
| 1124 | |
| 1125 | int32_tcxx . . $ int32_t# lookUpKey = (int32_tcxx . . $ int32_t#)scancode - SDL_SCANCODE_Bcxx . . $ SDL_SCANCODE_B.; |
| 1126 | if (lookUpKey < 0 || lookUpKey >= 52) |
| 1127 | return -1; // just in case |
| 1128 | |
| 1129 | if (editorcxx . . $ editor..keyOctavecxx . . $ editor_t#keyOctave. == OCTAVE_LOWcxx . . $ OCTAVE_LOW.) |
| 1130 | note = scancode2NoteLocxx . . $ scancode2NoteLo.[lookUpKey]; |
| 1131 | else |
| 1132 | note = scancode2NoteHicxx . . $ scancode2NoteHi.[lookUpKey]; |
| 1133 | |
| 1134 | return note; |
| 1135 | } |