| 1 | // for finding memory leaks in debug mode with Visual Studiocxx . . $ `<file>/src/pt2_mod2wav.c`/ |
| 2 | #if defined _DEBUG && defined _MSC_VER |
| 3 | #include <crtdbg.h> |
| 4 | #endif |
| 5 | |
| 6 | #include <math.h> |
| 7 | #include <stdio.h> |
| 8 | #include <stdint.h> |
| 9 | #include <stdbool.h> |
| 10 | #include <string.h> |
| 11 | #include <sys/stat.h> // stat() |
| 12 | #ifndef _WIN32 |
| 13 | #include <unistd.h> // chdir() |
| 14 | #endif |
| 15 | #include "pt2_audio.h"cxx . . $ `<file>/src/pt2_audio.h`/ |
| 16 | #include "pt2_mouse.h"cxx . . $ `<file>/src/pt2_mouse.h`/ |
| 17 | #include "pt2_textout.h"cxx . . $ `<file>/src/pt2_textout.h`/ |
| 18 | #include "pt2_visuals.h"cxx . . $ `<file>/src/pt2_visuals.h`/ |
| 19 | #include "pt2_mod2wav.h"cxx . . $ `<file>/src/pt2_mod2wav.h`/ |
| 20 | #include "pt2_downsample2x.h"cxx . . $ `<file>/src/pt2_downsample2x.h`/ |
| 21 | #include "pt2_config.h"cxx . . $ `<file>/src/pt2_config.h`/ |
| 22 | #include "pt2_askbox.h"cxx . . $ `<file>/src/pt2_askbox.h`/ |
| 23 | #include "pt2_replayer.h"cxx . . $ `<file>/src/pt2_replayer.h`/ |
| 24 | |
| 25 | #define FADEOUT_CHUNK_SAMPLEScxx . . $ `src/pt2_mod2wav.c:25:9`! 16384 |
| 26 | #define TICKS_PER_RENDER_CHUNKcxx . . $ `src/pt2_mod2wav.c:26:9`! 64 |
| 27 | |
| 28 | static int16_tcxx . . $ int16_t# *mod2WavBuffercxx . . $ mod2WavBuffer., fadeOutBuffercxx . . $ fadeOutBuffer.[FADEOUT_CHUNK_SAMPLEScxx . . $ `src/pt2_mod2wav.c:25:9`! * 2]; |
| 29 | static char lastFilenamecxx . . $ lastFilename.[PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`! + 1]; |
| 30 | |
| 31 | static void calcMod2WavTotalRowscxx . . $ calcMod2WavTotalRows(49f6e7a06ebc5aa8).(void); |
| 32 | |
| 33 | void mod2WavDrawFadeoutTogglecxx . . $ mod2WavDrawFadeoutToggle(49f6e7a06ebc5aa8).(void) |
| 34 | { |
| 35 | fillRectcxx . . $ fillRect(6fb2c7d311165c4f).(143, 50, FONT_CHAR_Wcxx . . $ `src/pt2_header.h:70:9`!, FONT_CHAR_Hcxx . . $ `src/pt2_header.h:71:9`!, videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENBKGcxx . . $ PAL_GENBKG.]); |
| 36 | if (editorcxx . . $ editor..mod2WavFadeOutcxx . . $ editor_t#mod2WavFadeOut.) |
| 37 | charOutcxx . . $ charOut(e6c1e39bfc2b37).(143, 50, 'X', videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENTXTcxx . . $ PAL_GENTXT.]); |
| 38 | } |
| 39 | |
| 40 | void mod2WavDrawFadeoutSecondscxx . . $ mod2WavDrawFadeoutSeconds(49f6e7a06ebc5aa8).(void) |
| 41 | { |
| 42 | fillRectcxx . . $ fillRect(6fb2c7d311165c4f).(259, 61, FONT_CHAR_Wcxx . . $ `src/pt2_header.h:70:9`!*2, FONT_CHAR_Hcxx . . $ `src/pt2_header.h:71:9`!+1, videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENBKGcxx . . $ PAL_GENBKG.]); |
| 43 | charOutcxx . . $ charOut(e6c1e39bfc2b37).(259, 62, '0' + ((editorcxx . . $ editor..mod2WavFadeOutSecondscxx . . $ editor_t#mod2WavFadeOutSeconds. / 10) % 10), videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENTXTcxx . . $ PAL_GENTXT.]); |
| 44 | charOutcxx . . $ charOut(e6c1e39bfc2b37).(267, 62, '0' + ( editorcxx . . $ editor..mod2WavFadeOutSecondscxx . . $ editor_t#mod2WavFadeOutSeconds. % 10), videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENTXTcxx . . $ PAL_GENTXT.]); |
| 45 | } |
| 46 | |
| 47 | void mod2WavDrawLoopCountcxx . . $ mod2WavDrawLoopCount(49f6e7a06ebc5aa8).(void) |
| 48 | { |
| 49 | fillRectcxx . . $ fillRect(6fb2c7d311165c4f).(259, 72, FONT_CHAR_Wcxx . . $ `src/pt2_header.h:70:9`!*2, FONT_CHAR_Hcxx . . $ `src/pt2_header.h:71:9`!+1, videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENBKGcxx . . $ PAL_GENBKG.]); |
| 50 | charOutcxx . . $ charOut(e6c1e39bfc2b37).(259, 73, '0' + ((editorcxx . . $ editor..mod2WavNumLoopscxx . . $ editor_t#mod2WavNumLoops. / 10) % 10), videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENTXTcxx . . $ PAL_GENTXT.]); |
| 51 | charOutcxx . . $ charOut(e6c1e39bfc2b37).(267, 73, '0' + ( editorcxx . . $ editor..mod2WavNumLoopscxx . . $ editor_t#mod2WavNumLoops. % 10), videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENTXTcxx . . $ PAL_GENTXT.]); |
| 52 | } |
| 53 | |
| 54 | void toggleMod2WavFadeoutcxx . . $ toggleMod2WavFadeout(49f6e7a06ebc5aa8).(void) |
| 55 | { |
| 56 | editorcxx . . $ editor..mod2WavFadeOutcxx . . $ editor_t#mod2WavFadeOut. ^= 1; |
| 57 | mod2WavDrawFadeoutTogglecxx . . $ mod2WavDrawFadeoutToggle(49f6e7a06ebc5aa8).(); |
| 58 | } |
| 59 | |
| 60 | void mod2WavFadeoutUpcxx . . $ mod2WavFadeoutUp(49f6e7a06ebc5aa8).(void) |
| 61 | { |
| 62 | if (editorcxx . . $ editor..mod2WavFadeOutSecondscxx . . $ editor_t#mod2WavFadeOutSeconds. < 60) |
| 63 | { |
| 64 | editorcxx . . $ editor..mod2WavFadeOutSecondscxx . . $ editor_t#mod2WavFadeOutSeconds.++; |
| 65 | mod2WavDrawFadeoutSecondscxx . . $ mod2WavDrawFadeoutSeconds(49f6e7a06ebc5aa8).(); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | void mod2WavFadeoutDowncxx . . $ mod2WavFadeoutDown(49f6e7a06ebc5aa8).(void) |
| 70 | { |
| 71 | if (editorcxx . . $ editor..mod2WavFadeOutSecondscxx . . $ editor_t#mod2WavFadeOutSeconds. > 1) |
| 72 | { |
| 73 | editorcxx . . $ editor..mod2WavFadeOutSecondscxx . . $ editor_t#mod2WavFadeOutSeconds.--; |
| 74 | mod2WavDrawFadeoutSecondscxx . . $ mod2WavDrawFadeoutSeconds(49f6e7a06ebc5aa8).(); |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | void mod2WavLoopCountUpcxx . . $ mod2WavLoopCountUp(49f6e7a06ebc5aa8).(void) |
| 79 | { |
| 80 | if (editorcxx . . $ editor..mod2WavNumLoopscxx . . $ editor_t#mod2WavNumLoops. < 50) |
| 81 | { |
| 82 | editorcxx . . $ editor..mod2WavNumLoopscxx . . $ editor_t#mod2WavNumLoops.++; |
| 83 | mod2WavDrawLoopCountcxx . . $ mod2WavDrawLoopCount(49f6e7a06ebc5aa8).(); |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | void mod2WavLoopCountDowncxx . . $ mod2WavLoopCountDown(49f6e7a06ebc5aa8).(void) |
| 88 | { |
| 89 | if (editorcxx . . $ editor..mod2WavNumLoopscxx . . $ editor_t#mod2WavNumLoops. > 0) |
| 90 | { |
| 91 | editorcxx . . $ editor..mod2WavNumLoopscxx . . $ editor_t#mod2WavNumLoops.--; |
| 92 | mod2WavDrawLoopCountcxx . . $ mod2WavDrawLoopCount(49f6e7a06ebc5aa8).(); |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | void drawMod2WavProgressDialogcxx . . $ drawMod2WavProgressDialog(49f6e7a06ebc5aa8).(void) |
| 97 | { |
| 98 | drawFramework3cxx . . $ drawFramework3(748afa4755bc9595).(120, 44, 200, 55); |
| 99 | textOut2cxx . . $ textOut2(be85f8883e7b25d0).(150, 53, "- RENDERING MODULE -"); |
| 100 | |
| 101 | const int32_tcxx . . $ int32_t# buttonW = (MOD2WAV_CANCEL_BTN_X2cxx . . $ `src/pt2_mod2wav.h:6:9`! - MOD2WAV_CANCEL_BTN_X1cxx . . $ `src/pt2_mod2wav.h:5:9`!)+1; |
| 102 | const int32_tcxx . . $ int32_t# buttonH = (MOD2WAV_CANCEL_BTN_Y2cxx . . $ `src/pt2_mod2wav.h:8:9`! - MOD2WAV_CANCEL_BTN_Y1cxx . . $ `src/pt2_mod2wav.h:7:9`!)+1; |
| 103 | drawButton1cxx . . $ drawButton1(8c3222651be003c9).(MOD2WAV_CANCEL_BTN_X1cxx . . $ `src/pt2_mod2wav.h:5:9`!, MOD2WAV_CANCEL_BTN_Y1cxx . . $ `src/pt2_mod2wav.h:7:9`!, buttonW, buttonH, "CANCEL"); |
| 104 | } |
| 105 | |
| 106 | static void showMod2WavProgresscxx . . $ showMod2WavProgress(49f6e7a06ebc5aa8).(void) |
| 107 | { |
| 108 | char percText[16]; |
| 109 | |
| 110 | if (songcxx . . $ song.->rowsInTotalcxx . . $ module_t#rowsInTotal. == 0) |
| 111 | return; |
| 112 | |
| 113 | // render progress bar |
| 114 | |
| 115 | int32_tcxx . . $ int32_t# percent = (songcxx . . $ song.->rowsCountercxx . . $ module_t#rowsCounter. * 100) / songcxx . . $ song.->rowsInTotalcxx . . $ module_t#rowsInTotal.; |
| 116 | if (percent > 100) |
| 117 | percent = 100; |
| 118 | |
| 119 | const int32_tcxx . . $ int32_t# x = 130; |
| 120 | const int32_tcxx . . $ int32_t# y = 66; |
| 121 | const int32_tcxx . . $ int32_t# w = 180; |
| 122 | const int32_tcxx . . $ int32_t# h = 11; |
| 123 | |
| 124 | // foreground (progress) |
| 125 | const int32_tcxx . . $ int32_t# progressBarWidth = (percent * w) / 100; |
| 126 | if (progressBarWidth > 0) |
| 127 | fillRectcxx . . $ fillRect(6fb2c7d311165c4f).(x, y, progressBarWidth, h, videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENBKG2cxx . . $ PAL_GENBKG2.]); // foreground (progress) |
| 128 | |
| 129 | // background |
| 130 | int32_tcxx . . $ int32_t# bgWidth = w - progressBarWidth; |
| 131 | if (bgWidth > 0) |
| 132 | fillRectcxx . . $ fillRect(6fb2c7d311165c4f).(x+progressBarWidth, y, bgWidth, h, videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_BORDERcxx . . $ PAL_BORDER.]); |
| 133 | |
| 134 | // draw percentage text |
| 135 | sprintfcxx . . $ sprintf(26c8642d26409d6d).(percText, "%d%%", percent); |
| 136 | const int32_tcxx . . $ int32_t# percTextW = (int32_tcxx . . $ int32_t#)strlencxx . . $ strlen(751346f8406fd082).(percText) * (FONT_CHAR_Wcxx . . $ `src/pt2_header.h:70:9`!-1); |
| 137 | textOutTightcxx . . $ textOutTight(ecc378a7b29cfb5a).(x + ((w - percTextW) / 2), y + ((h - FONT_CHAR_Hcxx . . $ `src/pt2_header.h:71:9`!) / 2), percText, videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENTXTcxx . . $ PAL_GENTXT.]); |
| 138 | } |
| 139 | |
| 140 | static void resetAudiocxx . . $ resetAudio(49f6e7a06ebc5aa8).(void) |
| 141 | { |
| 142 | audiocxx . . $ audio..oversamplingFlagcxx . . $ audio_t#oversamplingFlag. = (audiocxx . . $ audio..outputRatecxx . . $ audio_t#outputRate. < 96000); |
| 143 | const int32_tcxx . . $ int32_t# paulaMixFrequency = audiocxx . . $ audio..oversamplingFlagcxx . . $ audio_t#oversamplingFlag. ? audiocxx . . $ audio..outputRatecxx . . $ audio_t#outputRate.*2 : audiocxx . . $ audio..outputRatecxx . . $ audio_t#outputRate.; |
| 144 | paulaSetupcxx . . $ paulaSetup(29649c4b077a0f6).(paulaMixFrequency, audiocxx . . $ audio..amigaModelcxx . . $ audio_t#amigaModel.); |
| 145 | generateBpmTablecxx . . $ generateBpmTable(e7c9417f9c54f86f).(audiocxx . . $ audio..outputRatecxx . . $ audio_t#outputRate., editorcxx . . $ editor..timingModecxx . . $ editor_t#timingMode. == TEMPO_MODE_VBLANKcxx . . $ TEMPO_MODE_VBLANK.); |
| 146 | clearDownsample2xStatescxx . . $ clearDownsample2xStates(49f6e7a06ebc5aa8).(); |
| 147 | modSetTempocxx . . $ modSetTempo(918ebd27a9ddbad3).(songcxx . . $ song.->currBPMcxx . . $ module_t#currBPM., truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!); // update BPM (samples per tick) with the tracker's audio frequency |
| 148 | } |
| 149 | |
| 150 | static void handleMod2WavEndcxx . . $ handleMod2WavEnd(49f6e7a06ebc5aa8).(void) |
| 151 | { |
| 152 | pointerSetModecxx . . $ pointerSetMode(f2ac3508b56cd10).(POINTER_MODE_IDLEcxx . . $ POINTER_MODE_IDLE., DO_CARRYcxx . . $ DO_CARRY.); |
| 153 | |
| 154 | if (editorcxx . . $ editor..abortMod2Wavcxx . . $ editor_t#abortMod2Wav.) |
| 155 | { |
| 156 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("MOD2WAV ABORTED!"); |
| 157 | } |
| 158 | else |
| 159 | { |
| 160 | displayMsgcxx . . $ displayMsg(85c52e162fed56f9).("MOD RENDERED!"); |
| 161 | setMsgPointercxx . . $ setMsgPointer(49f6e7a06ebc5aa8).(); |
| 162 | } |
| 163 | |
| 164 | removeAskBoxcxx . . $ removeAskBox(49f6e7a06ebc5aa8).(); |
| 165 | resetAudiocxx . . $ resetAudio(49f6e7a06ebc5aa8).(); |
| 166 | |
| 167 | editorcxx . . $ editor..mod2WavOngoingcxx . . $ editor_t#mod2WavOngoing. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; // must be set before calling resetSong() ! |
| 168 | resetSongcxx . . $ resetSong(49f6e7a06ebc5aa8).(); |
| 169 | } |
| 170 | |
| 171 | void updateMod2WavDialogcxx . . $ updateMod2WavDialog(49f6e7a06ebc5aa8).(void) |
| 172 | { |
| 173 | if (uicxx . . $ ui..updateMod2WavDialogcxx . . $ ui_t#updateMod2WavDialog.) |
| 174 | { |
| 175 | uicxx . . $ ui..updateMod2WavDialogcxx . . $ ui_t#updateMod2WavDialog. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 176 | |
| 177 | if (editorcxx . . $ editor..mod2WavOngoingcxx . . $ editor_t#mod2WavOngoing.) |
| 178 | { |
| 179 | if (uicxx . . $ ui..mod2WavFinishedcxx . . $ ui_t#mod2WavFinished.) |
| 180 | { |
| 181 | uicxx . . $ ui..mod2WavFinishedcxx . . $ ui_t#mod2WavFinished. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 182 | handleMod2WavEndcxx . . $ handleMod2WavEnd(49f6e7a06ebc5aa8).(); |
| 183 | } |
| 184 | else |
| 185 | { |
| 186 | showMod2WavProgresscxx . . $ showMod2WavProgress(49f6e7a06ebc5aa8).(); |
| 187 | } |
| 188 | } |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | static int32_tcxx . . $ int32_t# mod2WavThreadFunccxx . . $ mod2WavThreadFunc(dedf1e9b1c614a07).(void *ptr) |
| 193 | { |
| 194 | wavHeader_tcxx . . $ wavHeader_t# wavHeader; |
| 195 | |
| 196 | FILEcxx . . $ FILE# *f = (FILEcxx . . $ FILE# *)ptr; |
| 197 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(mod2WavBuffer != NULL && f != NULL); |
| 198 | |
| 199 | // skip wav header place, render data first |
| 200 | fseekcxx . . $ fseek(543fae30d249f6b1).(f, sizeof (wavHeader_tcxx . . $ wavHeader_t#), SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!); |
| 201 | |
| 202 | uint32_tcxx . . $ uint32_t# sampleCounter = 0; |
| 203 | uint64_tcxx . . $ uint64_t# samplesToMixFrac = 0; |
| 204 | int8_tcxx . . $ int8_t# numLoops = editorcxx . . $ editor..mod2WavNumLoopscxx . . $ editor_t#mod2WavNumLoops.; |
| 205 | |
| 206 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! renderDone = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 207 | while (!renderDone) |
| 208 | { |
| 209 | uint32_tcxx . . $ uint32_t# samplesInChunk = 0; |
| 210 | |
| 211 | // render several ticks at once to prevent frequent disk I/O (speeds up the process) |
| 212 | int16_tcxx . . $ int16_t# *ptr16 = mod2WavBuffercxx . . $ mod2WavBuffer.; |
| 213 | for (uint32_tcxx . . $ uint32_t# i = 0; i < TICKS_PER_RENDER_CHUNKcxx . . $ `src/pt2_mod2wav.c:26:9`!; i++) |
| 214 | { |
| 215 | if (!editorcxx . . $ editor..mod2WavOngoingcxx . . $ editor_t#mod2WavOngoing. || renderDone || editorcxx . . $ editor..abortMod2Wavcxx . . $ editor_t#abortMod2Wav.) |
| 216 | { |
| 217 | renderDone = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 218 | break; |
| 219 | } |
| 220 | |
| 221 | /* Handle replayer tick (also sets audio.samplesPerTickInt and audio.samplesPerTickFrac). |
| 222 | ** Returns false on end of song. |
| 223 | */ |
| 224 | if (!tickReplayercxx . . $ tickReplayer(c9857a73d68e59ba).()) |
| 225 | { |
| 226 | if (--numLoops < 0) |
| 227 | { |
| 228 | renderDone = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; // this tick is the last tick |
| 229 | } |
| 230 | else |
| 231 | { |
| 232 | // clear the "last visisted rows" table and let the song continue playing (loop) |
| 233 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(editorcxx . . $ editor..rowVisitTablecxx . . $ editor_t#rowVisitTable., 0, 128 * MOD_ROWScxx . . $ `src/pt2_header.h:73:9`!); |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | uint32_tcxx . . $ uint32_t# samplesToMix = audiocxx . . $ audio..samplesPerTickIntcxx . . $ audio_t#samplesPerTickInt.; |
| 238 | |
| 239 | samplesToMixFrac += audiocxx . . $ audio..samplesPerTickFraccxx . . $ audio_t#samplesPerTickFrac.; |
| 240 | if (samplesToMixFrac >= BPM_FRAC_SCALEcxx . . $ `src/pt2_audio.h:13:9`!) |
| 241 | { |
| 242 | samplesToMixFrac &= BPM_FRAC_MASKcxx . . $ `src/pt2_audio.h:14:9`!; |
| 243 | samplesToMix++; |
| 244 | } |
| 245 | |
| 246 | outputAudiocxx . . $ outputAudio(4683f455c3e046d4).(ptr16, samplesToMix); |
| 247 | ptr16 += samplesToMix * 2; // *2 for stereo |
| 248 | |
| 249 | samplesInChunk += samplesToMix; |
| 250 | sampleCounter += samplesToMix; |
| 251 | |
| 252 | uicxx . . $ ui..updateMod2WavDialogcxx . . $ ui_t#updateMod2WavDialog. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 253 | } |
| 254 | |
| 255 | // write buffer to disk |
| 256 | if (samplesInChunk > 0) |
| 257 | fwritecxx . . $ fwrite(ab0609fa07c47d6e).(mod2WavBuffercxx . . $ mod2WavBuffer., sizeof (int16_tcxx . . $ int16_t#), samplesInChunk * 2, f); |
| 258 | } |
| 259 | |
| 260 | uicxx . . $ ui..updateMod2WavDialogcxx . . $ ui_t#updateMod2WavDialog. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 261 | |
| 262 | uint32_tcxx . . $ uint32_t# endOfDataOffset = ftellcxx . . $ ftell(1dcafcd8ef4c6e6c).(f); |
| 263 | |
| 264 | freecxx . . $ free(5d22bdacc48458e8).(mod2WavBuffercxx . . $ mod2WavBuffer.); |
| 265 | |
| 266 | uint32_tcxx . . $ uint32_t# totalRiffChunkLen = (uint32_tcxx . . $ uint32_t#)ftellcxx . . $ ftell(1dcafcd8ef4c6e6c).(f) - 8; |
| 267 | |
| 268 | // go back and fill in WAV header |
| 269 | rewindcxx . . $ rewind(8d4262d45fc644ab).(f); |
| 270 | |
| 271 | wavHeader.chunkIDcxx . . $ wavHeader_t#chunkID. = 0x46464952; // "RIFF" |
| 272 | wavHeader.chunkSizecxx . . $ wavHeader_t#chunkSize. = totalRiffChunkLen; |
| 273 | wavHeader.formatcxx . . $ wavHeader_t#format. = 0x45564157; // "WAVE" |
| 274 | wavHeader.subchunk1IDcxx . . $ wavHeader_t#subchunk1ID. = 0x20746D66; // "fmt " |
| 275 | wavHeader.subchunk1Sizecxx . . $ wavHeader_t#subchunk1Size. = 16; |
| 276 | wavHeader.audioFormatcxx . . $ wavHeader_t#audioFormat. = 1; |
| 277 | wavHeader.numChannelscxx . . $ wavHeader_t#numChannels. = 2; |
| 278 | wavHeader.sampleRatecxx . . $ wavHeader_t#sampleRate. = configcxx . . $ config..mod2WavOutputFreqcxx . . $ config_t#mod2WavOutputFreq.; |
| 279 | wavHeader.bitsPerSamplecxx . . $ wavHeader_t#bitsPerSample. = 16; |
| 280 | wavHeader.byteRatecxx . . $ wavHeader_t#byteRate. = (wavHeader.sampleRatecxx . . $ wavHeader_t#sampleRate. * wavHeader.numChannelscxx . . $ wavHeader_t#numChannels. * wavHeader.bitsPerSamplecxx . . $ wavHeader_t#bitsPerSample.) / 8; |
| 281 | wavHeader.blockAligncxx . . $ wavHeader_t#blockAlign. = (wavHeader.numChannelscxx . . $ wavHeader_t#numChannels. * wavHeader.bitsPerSamplecxx . . $ wavHeader_t#bitsPerSample.) / 8; |
| 282 | wavHeader.subchunk2IDcxx . . $ wavHeader_t#subchunk2ID. = 0x61746164; // "data" |
| 283 | wavHeader.subchunk2Sizecxx . . $ wavHeader_t#subchunk2Size. = sampleCounter * sizeof (int16_tcxx . . $ int16_t#) * 2; |
| 284 | |
| 285 | // write main header |
| 286 | fwritecxx . . $ fwrite(ab0609fa07c47d6e).(&wavHeader, sizeof (wavHeader_tcxx . . $ wavHeader_t#), 1, f); |
| 287 | fclosecxx . . $ fclose(89bc1efcdac0ca22).(f); |
| 288 | |
| 289 | // apply fadeout (if enabled) |
| 290 | if (editorcxx . . $ editor..mod2WavFadeOutcxx . . $ editor_t#mod2WavFadeOut.) |
| 291 | { |
| 292 | uint32_tcxx . . $ uint32_t# numFadeOutSamples = configcxx . . $ config..mod2WavOutputFreqcxx . . $ config_t#mod2WavOutputFreq. * editorcxx . . $ editor..mod2WavFadeOutSecondscxx . . $ editor_t#mod2WavFadeOutSeconds.; |
| 293 | if (numFadeOutSamples > sampleCounter) |
| 294 | numFadeOutSamples = sampleCounter; |
| 295 | |
| 296 | f = fopencxx . . $ fopen(82ec0787cd37e0a3).(lastFilenamecxx . . $ lastFilename., "r+b"); |
| 297 | |
| 298 | const double dFadeOutDelta = 1.0 / numFadeOutSamples; |
| 299 | double dFadeOutVal = 1.0; |
| 300 | |
| 301 | fseekcxx . . $ fseek(543fae30d249f6b1).(f, endOfDataOffset - (numFadeOutSamples * sizeof (int16_tcxx . . $ int16_t#) * 2), SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!); |
| 302 | |
| 303 | uint32_tcxx . . $ uint32_t# samplesLeft = numFadeOutSamples; |
| 304 | while (samplesLeft > 0) |
| 305 | { |
| 306 | uint32_tcxx . . $ uint32_t# samplesTodo = FADEOUT_CHUNK_SAMPLEScxx . . $ `src/pt2_mod2wav.c:25:9`!; |
| 307 | if (samplesTodo > samplesLeft) |
| 308 | samplesTodo = samplesLeft; |
| 309 | |
| 310 | freadcxx . . $ fread(738fc8ac1d711e58).(fadeOutBuffercxx . . $ fadeOutBuffer., sizeof (int16_tcxx . . $ int16_t#), samplesTodo * 2, f); |
| 311 | fseekcxx . . $ fseek(543fae30d249f6b1).(f, 0 - (samplesTodo * sizeof (int16_tcxx . . $ int16_t#) * 2), SEEK_CURcxx . . $ `<external>/232824719582829767/stdio.h:111:9`!); |
| 312 | |
| 313 | // apply fadeout |
| 314 | for (uint32_tcxx . . $ uint32_t# i = 0; i < samplesTodo; i++) |
| 315 | { |
| 316 | fadeOutBuffercxx . . $ fadeOutBuffer.[(i*2)+0] = (int16_tcxx . . $ int16_t#)(fadeOutBuffercxx . . $ fadeOutBuffer.[(i*2)+0] * dFadeOutVal); // L |
| 317 | fadeOutBuffercxx . . $ fadeOutBuffer.[(i*2)+1] = (int16_tcxx . . $ int16_t#)(fadeOutBuffercxx . . $ fadeOutBuffer.[(i*2)+1] * dFadeOutVal); // R |
| 318 | dFadeOutVal -= dFadeOutDelta; |
| 319 | } |
| 320 | |
| 321 | fwritecxx . . $ fwrite(ab0609fa07c47d6e).(fadeOutBuffercxx . . $ fadeOutBuffer., sizeof (int16_tcxx . . $ int16_t#), samplesTodo * 2, f); |
| 322 | |
| 323 | samplesLeft -= samplesTodo; |
| 324 | } |
| 325 | |
| 326 | fclosecxx . . $ fclose(89bc1efcdac0ca22).(f); |
| 327 | } |
| 328 | |
| 329 | uicxx . . $ ui..mod2WavFinishedcxx . . $ ui_t#mod2WavFinished. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 330 | uicxx . . $ ui..updateMod2WavDialogcxx . . $ ui_t#updateMod2WavDialog. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 331 | |
| 332 | if (editorcxx . . $ editor..abortMod2Wavcxx . . $ editor_t#abortMod2Wav.) |
| 333 | editorcxx . . $ editor..mod2WavOngoingcxx . . $ editor_t#mod2WavOngoing. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 334 | |
| 335 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 336 | } |
| 337 | |
| 338 | static void assureModulesDircxx . . $ assureModulesDir(49f6e7a06ebc5aa8).(void) |
| 339 | { |
| 340 | // if we're in samples mode in Disk Op., set dir to current modules dir |
| 341 | if (diskopcxx . . $ diskop..modecxx . . $ diskop_t#mode. == DISKOP_MODE_SMPcxx . . $ DISKOP_MODE_SMP. && editorcxx . . $ editor..modulesPathUcxx . . $ editor_t#modulesPathU. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 342 | UNICHAR_CHDIRcxx . . $ `src/pt2_unicode.h:36:9`!(editor.modulesPathU); |
| 343 | } |
| 344 | |
| 345 | static void setBackDirIfNeededcxx . . $ setBackDirIfNeeded(49f6e7a06ebc5aa8).(void) |
| 346 | { |
| 347 | // if we're in samples mode in Disk Op., set dir back to current samples dir |
| 348 | if (diskopcxx . . $ diskop..modecxx . . $ diskop_t#mode. == DISKOP_MODE_SMPcxx . . $ DISKOP_MODE_SMP. && editorcxx . . $ editor..samplesPathUcxx . . $ editor_t#samplesPathU. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 349 | UNICHAR_CHDIRcxx . . $ `src/pt2_unicode.h:36:9`!(editor.samplesPathU); |
| 350 | } |
| 351 | |
| 352 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! mod2WavRendercxx . . $ mod2WavRender(c6b7e35ff6de5671).(char *filename) |
| 353 | { |
| 354 | struct statcxx . . $ stat# statBuffer; |
| 355 | |
| 356 | lastFilenamecxx . . $ lastFilename.[0] = '\0'; // for rendering-thread |
| 357 | |
| 358 | assureModulesDircxx . . $ assureModulesDir(49f6e7a06ebc5aa8).(); |
| 359 | |
| 360 | if (statcxx . . $ stat(a9cd1e23e96f423c).(filename, &statBuffer) == 0) |
| 361 | { |
| 362 | if (!askBoxcxx . . $ askBox(7371ee129cebb502).(ASKBOX_YES_NOcxx . . $ ASKBOX_YES_NO., "OVERWRITE FILE?")) |
| 363 | { |
| 364 | setBackDirIfNeededcxx . . $ setBackDirIfNeeded(49f6e7a06ebc5aa8).(); |
| 365 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 366 | } |
| 367 | } |
| 368 | |
| 369 | FILEcxx . . $ FILE# *fOut = fopencxx . . $ fopen(82ec0787cd37e0a3).(filename, "wb"); |
| 370 | if (fOut == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 371 | { |
| 372 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("FILE I/O ERROR"); |
| 373 | setBackDirIfNeededcxx . . $ setBackDirIfNeeded(49f6e7a06ebc5aa8).(); |
| 374 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 375 | } |
| 376 | |
| 377 | setBackDirIfNeededcxx . . $ setBackDirIfNeeded(49f6e7a06ebc5aa8).(); |
| 378 | |
| 379 | strncpycxx . . $ strncpy(255158a415b673b0).(lastFilenamecxx . . $ lastFilename., filename, PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!-1); // for rendering-thread |
| 380 | |
| 381 | const int32_tcxx . . $ int32_t# paulaMixFrequency = configcxx . . $ config..mod2WavOutputFreqcxx . . $ config_t#mod2WavOutputFreq. * 2; // *2 for oversampling (we always do oversampling in MOD2WAV) |
| 382 | int32_tcxx . . $ int32_t# maxSamplesPerTick = (int32_tcxx . . $ int32_t#)ceil(paulaMixFrequency / (MIN_BPMcxx . . $ `src/pt2_replayer.h:7:9`! / 2.5)) + 1; |
| 383 | |
| 384 | mod2WavBuffercxx . . $ mod2WavBuffer. = (int16_tcxx . . $ int16_t# *)malloccxx . . $ malloc(bfcfa4d6b7f7ef64).((TICKS_PER_RENDER_CHUNKcxx . . $ `src/pt2_mod2wav.c:26:9`! * maxSamplesPerTick) * sizeof (int16_tcxx . . $ int16_t#) * 2); |
| 385 | if (mod2WavBuffercxx . . $ mod2WavBuffer. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 386 | { |
| 387 | fclosecxx . . $ fclose(89bc1efcdac0ca22).(fOut); |
| 388 | statusOutOfMemorycxx . . $ statusOutOfMemory(49f6e7a06ebc5aa8).(); |
| 389 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 390 | } |
| 391 | |
| 392 | // wait for main audio callback to catch MOD2WAV flag |
| 393 | editorcxx . . $ editor..mod2WavOngoingcxx . . $ editor_t#mod2WavOngoing. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 394 | while (audiocxx . . $ audio..callbackOngoingcxx . . $ audio_t#callbackOngoing.) |
| 395 | SDL_Delaycxx . . $ SDL_Delay(cb2f890c2fdad230).(5); |
| 396 | |
| 397 | // do some prep work |
| 398 | audiocxx . . $ audio..oversamplingFlagcxx . . $ audio_t#oversamplingFlag. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 399 | generateBpmTablecxx . . $ generateBpmTable(e7c9417f9c54f86f).(configcxx . . $ config..mod2WavOutputFreqcxx . . $ config_t#mod2WavOutputFreq., editorcxx . . $ editor..timingModecxx . . $ editor_t#timingMode. == TEMPO_MODE_VBLANKcxx . . $ TEMPO_MODE_VBLANK.); |
| 400 | paulaSetupcxx . . $ paulaSetup(29649c4b077a0f6).(paulaMixFrequency, audiocxx . . $ audio..amigaModelcxx . . $ audio_t#amigaModel.); |
| 401 | storeTempVariablescxx . . $ storeTempVariables(49f6e7a06ebc5aa8).(); |
| 402 | calcMod2WavTotalRowscxx . . $ calcMod2WavTotalRows(49f6e7a06ebc5aa8).(); |
| 403 | restartSongcxx . . $ restartSong(49f6e7a06ebc5aa8).(); // this also updates BPM (samples per tick) with the MOD2WAV audio output rate |
| 404 | clearDownsample2xStatescxx . . $ clearDownsample2xStates(49f6e7a06ebc5aa8).(); |
| 405 | |
| 406 | drawMod2WavProgressDialogcxx . . $ drawMod2WavProgressDialog(49f6e7a06ebc5aa8).(); |
| 407 | editorcxx . . $ editor..abortMod2Wavcxx . . $ editor_t#abortMod2Wav. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 408 | |
| 409 | pointerSetModecxx . . $ pointerSetMode(f2ac3508b56cd10).(POINTER_MODE_MSG2cxx . . $ POINTER_MODE_MSG2., NO_CARRYcxx . . $ NO_CARRY.); |
| 410 | setStatusMessagecxx . . $ setStatusMessage(90ef5b561fbcb8de).("RENDERING MOD...", NO_CARRYcxx . . $ NO_CARRY.); |
| 411 | |
| 412 | editorcxx . . $ editor..mod2WavThreadcxx . . $ editor_t#mod2WavThread. = SDL_CreateThreadcxx . . $ SDL_CreateThread(6bda6645e1e04984).(mod2WavThreadFunccxx . . $ mod2WavThreadFunc(dedf1e9b1c614a07)., "MOD2WAV thread", fOut); |
| 413 | if (editorcxx . . $ editor..mod2WavThreadcxx . . $ editor_t#mod2WavThread. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 414 | { |
| 415 | fclosecxx . . $ fclose(89bc1efcdac0ca22).(fOut); |
| 416 | freecxx . . $ free(5d22bdacc48458e8).(mod2WavBuffercxx . . $ mod2WavBuffer.); |
| 417 | |
| 418 | doStopItcxx . . $ doStopIt(b45ddcbc8423892c).(truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!); |
| 419 | |
| 420 | editorcxx . . $ editor..mod2WavOngoingcxx . . $ editor_t#mod2WavOngoing. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; // must be set before calling resetAudio() |
| 421 | resetAudiocxx . . $ resetAudio(49f6e7a06ebc5aa8).(); |
| 422 | |
| 423 | removeAskBoxcxx . . $ removeAskBox(49f6e7a06ebc5aa8).(); |
| 424 | pointerSetModecxx . . $ pointerSetMode(f2ac3508b56cd10).(POINTER_MODE_IDLEcxx . . $ POINTER_MODE_IDLE., DO_CARRYcxx . . $ DO_CARRY.); |
| 425 | |
| 426 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("THREAD ERROR !"); |
| 427 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 428 | } |
| 429 | |
| 430 | SDL_DetachThreadcxx . . $ SDL_DetachThread(892b99e67b469720).(editorcxx . . $ editor..mod2WavThreadcxx . . $ editor_t#mod2WavThread.); |
| 431 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 432 | } |
| 433 | |
| 434 | #define CALC__END_OF_SONGcxx . . $ `src/pt2_mod2wav.c:434:9`! \ |
| 435 | if (--numLoops < 0) \ |
| 436 | { \ |
| 437 | calcingRows = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; \ |
| 438 | break; \ |
| 439 | } \ |
| 440 | else \ |
| 441 | { \ |
| 442 | memset(editor.rowVisitTable, 0, 128 * MOD_ROWScxx . . $ `src/pt2_header.h:73:9`!); \ |
| 443 | } |
| 444 | |
| 445 | // ONLY used for a visual percentage counter, so accuracy is not very important |
| 446 | static void calcMod2WavTotalRowscxx . . $ calcMod2WavTotalRows(49f6e7a06ebc5aa8).(void) |
| 447 | { |
| 448 | int8_tcxx . . $ int8_t# n_pattpos[PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!], n_loopcount[PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!]; |
| 449 | |
| 450 | // for pattern loop |
| 451 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(n_pattpos, 0, sizeof (n_pattpos)); |
| 452 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(n_loopcount, 0, sizeof (n_loopcount)); |
| 453 | |
| 454 | songcxx . . $ song.->rowsCountercxx . . $ module_t#rowsCounter. = songcxx . . $ song.->rowsInTotalcxx . . $ module_t#rowsInTotal. = 0; |
| 455 | |
| 456 | uint8_tcxx . . $ uint8_t# modRow = 0; |
| 457 | int16_tcxx . . $ int16_t# modPos = 0; |
| 458 | uint16_tcxx . . $ uint16_t# modPattern = songcxx . . $ song.->headercxx . . $ module_t#header..patternTablecxx . . $ moduleHeader_t#patternTable.[0]; |
| 459 | uint8_tcxx . . $ uint8_t# pBreakPosition = 0; |
| 460 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! posJumpAssert = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 461 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! pBreakFlag = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 462 | |
| 463 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(editorcxx . . $ editor..rowVisitTablecxx . . $ editor_t#rowVisitTable., 0, 128 * MOD_ROWScxx . . $ `src/pt2_header.h:73:9`!); |
| 464 | |
| 465 | int8_tcxx . . $ int8_t# numLoops = editorcxx . . $ editor..mod2WavNumLoopscxx . . $ editor_t#mod2WavNumLoops.; // make a copy |
| 466 | |
| 467 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! calcingRows = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 468 | while (calcingRows) |
| 469 | { |
| 470 | editorcxx . . $ editor..rowVisitTablecxx . . $ editor_t#rowVisitTable.[(modPos * MOD_ROWScxx . . $ `src/pt2_header.h:73:9`!) + modRow] = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 471 | |
| 472 | for (int32_tcxx . . $ int32_t# ch = 0; ch < PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!; ch++) |
| 473 | { |
| 474 | note_tcxx . . $ note_t# *note = &songcxx . . $ song.->patternscxx . . $ module_t#patterns.[modPattern][(modRow * PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!) + ch]; |
| 475 | if (note->commandcxx . . $ note_t#command. == 0x0B) // Bxx - Position Jump |
| 476 | { |
| 477 | modPos = note->paramcxx . . $ note_t#param. - 1; |
| 478 | pBreakPosition = 0; |
| 479 | posJumpAssert = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 480 | } |
| 481 | else if (note->commandcxx . . $ note_t#command. == 0x0D) // Dxx - Pattern Break |
| 482 | { |
| 483 | pBreakPosition = (((note->paramcxx . . $ note_t#param. >> 4) * 10) + (note->paramcxx . . $ note_t#param. & 0x0F)); |
| 484 | if (pBreakPosition > 63) |
| 485 | pBreakPosition = 0; |
| 486 | |
| 487 | posJumpAssert = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 488 | } |
| 489 | else if (note->commandcxx . . $ note_t#command. == 0x0F && note->paramcxx . . $ note_t#param. == 0) // F00 - Set Speed 0 (stop) |
| 490 | { |
| 491 | CALC__END_OF_SONGcxx . . $ `src/pt2_mod2wav.c:434:9`! |
| 492 | } |
| 493 | else if (note->commandcxx . . $ note_t#command. == 0x0E && (note->paramcxx . . $ note_t#param. >> 4) == 0x06) // E6x - Pattern Loop |
| 494 | { |
| 495 | uint8_tcxx . . $ uint8_t# pos = note->paramcxx . . $ note_t#param. & 0x0F; |
| 496 | if (pos == 0) |
| 497 | { |
| 498 | n_pattpos[ch] = modRow; |
| 499 | } |
| 500 | else if (n_loopcount[ch] == 0) |
| 501 | { |
| 502 | n_loopcount[ch] = pos; |
| 503 | |
| 504 | pBreakPosition = n_pattpos[ch]; |
| 505 | pBreakFlag = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 506 | |
| 507 | for (pos = pBreakPosition; pos <= modRow; pos++) |
| 508 | editorcxx . . $ editor..rowVisitTablecxx . . $ editor_t#rowVisitTable.[(modPos * MOD_ROWScxx . . $ `src/pt2_header.h:73:9`!) + pos] = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 509 | } |
| 510 | else if (--n_loopcount[ch]) |
| 511 | { |
| 512 | pBreakPosition = n_pattpos[ch]; |
| 513 | pBreakFlag = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 514 | |
| 515 | for (pos = pBreakPosition; pos <= modRow; pos++) |
| 516 | editorcxx . . $ editor..rowVisitTablecxx . . $ editor_t#rowVisitTable.[(modPos * MOD_ROWScxx . . $ `src/pt2_header.h:73:9`!) + pos] = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 517 | } |
| 518 | } |
| 519 | } |
| 520 | |
| 521 | modRow++; |
| 522 | songcxx . . $ song.->rowsInTotalcxx . . $ module_t#rowsInTotal.++; |
| 523 | |
| 524 | if (pBreakFlag) |
| 525 | { |
| 526 | modRow = pBreakPosition; |
| 527 | pBreakPosition = 0; |
| 528 | pBreakFlag = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 529 | } |
| 530 | |
| 531 | if (modRow >= MOD_ROWScxx . . $ `src/pt2_header.h:73:9`! || posJumpAssert) |
| 532 | { |
| 533 | modRow = pBreakPosition; |
| 534 | pBreakPosition = 0; |
| 535 | posJumpAssert = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 536 | |
| 537 | modPos = (modPos + 1) & 127; |
| 538 | if (modPos >= songcxx . . $ song.->headercxx . . $ module_t#header..songLengthcxx . . $ moduleHeader_t#songLength.) |
| 539 | { |
| 540 | modPos = 0; |
| 541 | CALC__END_OF_SONGcxx . . $ `src/pt2_mod2wav.c:434:9`! |
| 542 | } |
| 543 | |
| 544 | modPattern = songcxx . . $ song.->headercxx . . $ module_t#header..patternTablecxx . . $ moduleHeader_t#patternTable.[modPos]; |
| 545 | if (modPattern > MAX_PATTERNScxx . . $ `src/pt2_header.h:75:9`!-1) |
| 546 | modPattern = MAX_PATTERNScxx . . $ `src/pt2_header.h:75:9`!-1; |
| 547 | } |
| 548 | |
| 549 | if (calcingRows && editorcxx . . $ editor..rowVisitTablecxx . . $ editor_t#rowVisitTable.[(modPos * MOD_ROWScxx . . $ `src/pt2_header.h:73:9`!) + modRow]) |
| 550 | { |
| 551 | // row has been visited before, we're now done! |
| 552 | CALC__END_OF_SONGcxx . . $ `src/pt2_mod2wav.c:434:9`! |
| 553 | } |
| 554 | } |
| 555 | } |