| 1 | // for finding memory leaks in debug mode with Visual Studio cxx . . $ `<file>/src/pt2_sampler.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 <stdlib.h> |
| 9 | #include <stdint.h> |
| 10 | #include <stdbool.h> |
| 11 | #include <string.h> |
| 12 | #include "pt2_helpers.h"cxx . . $ `<file>/src/pt2_helpers.h`/ |
| 13 | #include "pt2_textout.h"cxx . . $ `<file>/src/pt2_textout.h`/ |
| 14 | #include "pt2_audio.h"cxx . . $ `<file>/src/pt2_audio.h`/ |
| 15 | #include "pt2_tables.h"cxx . . $ `<file>/src/pt2_tables.h`/ |
| 16 | #include "pt2_visuals.h"cxx . . $ `<file>/src/pt2_visuals.h`/ |
| 17 | #include "pt2_scopes.h"cxx . . $ `<file>/src/pt2_scopes.h`/ |
| 18 | #include "pt2_sampler.h"cxx . . $ `<file>/src/pt2_sampler.h`/ |
| 19 | #include "pt2_config.h"cxx . . $ `<file>/src/pt2_config.h`/ |
| 20 | #include "pt2_bmp.h"cxx . . $ `<file>/src/pt2_bmp.h`/ |
| 21 | #include "pt2_rcfilters.h"cxx . . $ `<file>/src/pt2_rcfilters.h`/ |
| 22 | #include "pt2_chordmaker.h"cxx . . $ `<file>/src/pt2_chordmaker.h`/ |
| 23 | #include "pt2_replayer.h"cxx . . $ `<file>/src/pt2_replayer.h`/ |
| 24 | #include "pt2_visuals_sync.h"cxx . . $ `<file>/src/pt2_visuals_sync.h`/ |
| 25 | #include "pt2_askbox.h"cxx . . $ `<file>/src/pt2_askbox.h`/ |
| 26 | |
| 27 | #define CENTER_LINE_COLORcxx . . $ `src/pt2_sampler.c:27:9`! 0x303030 |
| 28 | #define MARK_COLOR_1cxx . . $ `src/pt2_sampler.c:28:9`! 0x666666 /* inverted background */ |
| 29 | #define MARK_COLOR_2cxx . . $ `src/pt2_sampler.c:29:9`! 0xCCCCCC /* inverted waveform */ |
| 30 | #define MARK_COLOR_3cxx . . $ `src/pt2_sampler.c:30:9`! 0x7D7D7D /* inverted center line */ |
| 31 | |
| 32 | #define SAMPLE_AREA_Y_CENTERcxx . . $ `src/pt2_sampler.c:32:9`! 169 |
| 33 | #define SAMPLE_AREA_HEIGHTcxx . . $ `src/pt2_sampler.c:33:9`! 64 |
| 34 | |
| 35 | static int32_tcxx . . $ int32_t# samOffsetScaledcxx . . $ samOffsetScaled., lastDrawXcxx . . $ lastDrawX., lastDrawYcxx . . $ lastDrawY.; |
| 36 | static uint16_tcxx . . $ uint16_t# TToneBitcxx . . $ TToneBit.; |
| 37 | static uint32_tcxx . . $ uint32_t# waveInvertTablecxx . . $ waveInvertTable.[8]; |
| 38 | |
| 39 | sampler_tcxx . . $ sampler_t# samplercxx . . $ sampler.; // globalized |
| 40 | |
| 41 | static const int8_tcxx . . $ int8_t# tuneToneDatacxx . . $ tuneToneData.[32] = // Tuning Tone (sine, regenerated with 127-scale instead of 128) |
| 42 | { |
| 43 | 0, 25, 49, 71, 90, 106, 117, 125, |
| 44 | 127, 125, 117, 106, 90, 71, 49, 25, |
| 45 | 0, -25, -49, -71, -90, -106, -117, -125, |
| 46 | -127, -125, -117, -106, -90, -71, -49, -25 |
| 47 | }; |
| 48 | |
| 49 | void killSamplecxx . . $ killSample(49f6e7a06ebc5aa8).(void) |
| 50 | { |
| 51 | if (editorcxx . . $ editor..sampleZerocxx . . $ editor_t#sampleZero.) |
| 52 | { |
| 53 | statusNotSampleZerocxx . . $ statusNotSampleZero(49f6e7a06ebc5aa8).(); |
| 54 | return; |
| 55 | } |
| 56 | |
| 57 | turnOffVoicescxx . . $ turnOffVoices(49f6e7a06ebc5aa8).(); |
| 58 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 59 | |
| 60 | s->fineTunecxx . . $ moduleSample_t#fineTune. = 0; |
| 61 | s->volumecxx . . $ moduleSample_t#volume. = 0; |
| 62 | s->lengthcxx . . $ moduleSample_t#length. = 0; |
| 63 | s->loopStartcxx . . $ moduleSample_t#loopStart. = 0; |
| 64 | s->loopLengthcxx . . $ moduleSample_t#loopLength. = 2; |
| 65 | |
| 66 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(s->textcxx . . $ moduleSample_t#text., 0, sizeof (s->textcxx . . $ moduleSample_t#text.)); |
| 67 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(&songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[(editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample. * configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.)], 0, configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.); |
| 68 | |
| 69 | editorcxx . . $ editor..samplePoscxx . . $ editor_t#samplePos. = 0; |
| 70 | updateCurrSamplecxx . . $ updateCurrSample(49f6e7a06ebc5aa8).(); |
| 71 | |
| 72 | uicxx . . $ ui..updateSongSizecxx . . $ ui_t#updateSongSize. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 73 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 74 | } |
| 75 | |
| 76 | void upSamplecxx . . $ upSample(49f6e7a06ebc5aa8).(void) |
| 77 | { |
| 78 | if (editorcxx . . $ editor..sampleZerocxx . . $ editor_t#sampleZero.) |
| 79 | { |
| 80 | statusNotSampleZerocxx . . $ statusNotSampleZero(49f6e7a06ebc5aa8).(); |
| 81 | return; |
| 82 | } |
| 83 | |
| 84 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 85 | |
| 86 | int32_tcxx . . $ int32_t# newLength = (s->lengthcxx . . $ moduleSample_t#length. >> 1) & configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.; |
| 87 | if (newLength < 2) |
| 88 | return; |
| 89 | |
| 90 | turnOffVoicescxx . . $ turnOffVoices(49f6e7a06ebc5aa8).(); |
| 91 | |
| 92 | // upsample |
| 93 | int8_tcxx . . $ int8_t# *ptr8 = &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.]; |
| 94 | for (int32_tcxx . . $ int32_t# i = 0; i < newLength; i++) |
| 95 | ptr8[i] = ptr8[i << 1]; |
| 96 | |
| 97 | // clear junk after shrunk sample |
| 98 | if (newLength < configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.) |
| 99 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(&ptr8[newLength], 0, configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength. - newLength); |
| 100 | |
| 101 | s->lengthcxx . . $ moduleSample_t#length. = newLength; |
| 102 | s->loopStartcxx . . $ moduleSample_t#loopStart. = (s->loopStartcxx . . $ moduleSample_t#loopStart. >> 1) & ~1; |
| 103 | s->loopLengthcxx . . $ moduleSample_t#loopLength. = (s->loopLengthcxx . . $ moduleSample_t#loopLength. >> 1) & ~1; |
| 104 | |
| 105 | if (s->loopLengthcxx . . $ moduleSample_t#loopLength. < 2) |
| 106 | { |
| 107 | s->loopStartcxx . . $ moduleSample_t#loopStart. = 0; |
| 108 | s->loopLengthcxx . . $ moduleSample_t#loopLength. = 2; |
| 109 | } |
| 110 | |
| 111 | fixSampleBeepcxx . . $ fixSampleBeep(60146f4515acbace).(s); |
| 112 | updateCurrSamplecxx . . $ updateCurrSample(49f6e7a06ebc5aa8).(); |
| 113 | |
| 114 | uicxx . . $ ui..updateSongSizecxx . . $ ui_t#updateSongSize. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 115 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 116 | } |
| 117 | |
| 118 | void downSamplecxx . . $ downSample(49f6e7a06ebc5aa8).(void) |
| 119 | { |
| 120 | if (editorcxx . . $ editor..sampleZerocxx . . $ editor_t#sampleZero.) |
| 121 | { |
| 122 | statusNotSampleZerocxx . . $ statusNotSampleZero(49f6e7a06ebc5aa8).(); |
| 123 | return; |
| 124 | } |
| 125 | |
| 126 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 127 | |
| 128 | int32_tcxx . . $ int32_t# newLength = s->lengthcxx . . $ moduleSample_t#length. << 1; |
| 129 | if (newLength > configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.) |
| 130 | newLength = configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.; |
| 131 | |
| 132 | turnOffVoicescxx . . $ turnOffVoices(49f6e7a06ebc5aa8).(); |
| 133 | |
| 134 | // downsample |
| 135 | |
| 136 | int8_tcxx . . $ int8_t# *ptr8 = &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.]; |
| 137 | int8_tcxx . . $ int8_t# *ptr8_2 = ptr8 - 1; |
| 138 | for (int32_tcxx . . $ int32_t# i = s->lengthcxx . . $ moduleSample_t#length.-1; i > 0; i--) |
| 139 | { |
| 140 | ptr8[i<<1] = ptr8[i]; |
| 141 | ptr8_2[i<<1] = ptr8_2[i]; |
| 142 | } |
| 143 | |
| 144 | s->lengthcxx . . $ moduleSample_t#length. = newLength; |
| 145 | |
| 146 | if (s->loopLengthcxx . . $ moduleSample_t#loopLength. > 2) |
| 147 | { |
| 148 | int32_tcxx . . $ int32_t# loopStart = s->loopStartcxx . . $ moduleSample_t#loopStart. << 1; |
| 149 | int32_tcxx . . $ int32_t# loopLength = s->loopLengthcxx . . $ moduleSample_t#loopLength. << 1; |
| 150 | |
| 151 | if (loopStart+loopLength > s->lengthcxx . . $ moduleSample_t#length.) |
| 152 | { |
| 153 | loopStart = 0; |
| 154 | loopLength = 2; |
| 155 | } |
| 156 | |
| 157 | s->loopStartcxx . . $ moduleSample_t#loopStart. = loopStart; |
| 158 | s->loopLengthcxx . . $ moduleSample_t#loopLength. = loopLength; |
| 159 | } |
| 160 | |
| 161 | fixSampleBeepcxx . . $ fixSampleBeep(60146f4515acbace).(s); |
| 162 | updateCurrSamplecxx . . $ updateCurrSample(49f6e7a06ebc5aa8).(); |
| 163 | |
| 164 | uicxx . . $ ui..updateSongSizecxx . . $ ui_t#updateSongSize. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 165 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 166 | } |
| 167 | |
| 168 | void createSampleMarkTablecxx . . $ createSampleMarkTable(49f6e7a06ebc5aa8).(void) |
| 169 | { |
| 170 | // used for invertRange() (sample data marking) |
| 171 | |
| 172 | waveInvertTablecxx . . $ waveInvertTable.[0] = 0x00000000 | videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_BACKGRDcxx . . $ PAL_BACKGRD.]; |
| 173 | waveInvertTablecxx . . $ waveInvertTable.[1] = 0x01000000 | videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_QADSCPcxx . . $ PAL_QADSCP.]; |
| 174 | waveInvertTablecxx . . $ waveInvertTable.[2] = 0x02000000 | CENTER_LINE_COLORcxx . . $ `src/pt2_sampler.c:27:9`!; |
| 175 | waveInvertTablecxx . . $ waveInvertTable.[3] = 0x03000000; // spacer, not used |
| 176 | waveInvertTablecxx . . $ waveInvertTable.[4] = 0x04000000 | MARK_COLOR_1cxx . . $ `src/pt2_sampler.c:28:9`!; |
| 177 | waveInvertTablecxx . . $ waveInvertTable.[5] = 0x05000000 | MARK_COLOR_2cxx . . $ `src/pt2_sampler.c:29:9`!; |
| 178 | waveInvertTablecxx . . $ waveInvertTable.[6] = 0x06000000 | MARK_COLOR_3cxx . . $ `src/pt2_sampler.c:30:9`!; |
| 179 | waveInvertTablecxx . . $ waveInvertTable.[7] = 0x07000000; // spacer, not used |
| 180 | } |
| 181 | |
| 182 | static void updateSamOffsetcxx . . $ updateSamOffset(49f6e7a06ebc5aa8).(void) |
| 183 | { |
| 184 | if (samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. == 0) |
| 185 | samOffsetScaledcxx . . $ samOffsetScaled. = 0; |
| 186 | else |
| 187 | samOffsetScaledcxx . . $ samOffsetScaled. = (samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset. * SAMPLE_AREA_WIDTHcxx . . $ `src/pt2_header.h:39:9`!) / samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay.; // truncate here |
| 188 | } |
| 189 | |
| 190 | void fixSampleBeepcxx . . $ fixSampleBeep(60146f4515acbace).(moduleSample_tcxx . . $ moduleSample_t# *s) |
| 191 | { |
| 192 | if (s->lengthcxx . . $ moduleSample_t#length. >= 2 && s->loopStartcxx . . $ moduleSample_t#loopStart.+s->loopLengthcxx . . $ moduleSample_t#loopLength. <= 2) |
| 193 | { |
| 194 | songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.+0] = 0; |
| 195 | songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.+1] = 0; |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | void updateSamplePoscxx . . $ updateSamplePos(49f6e7a06ebc5aa8).(void) |
| 200 | { |
| 201 | moduleSample_tcxx . . $ moduleSample_t# *s; |
| 202 | |
| 203 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(editor.currSample >= 0 && editor.currSample <= 30); |
| 204 | if (editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample. >= 0 && editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample. <= 30) |
| 205 | { |
| 206 | s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 207 | if (editorcxx . . $ editor..samplePoscxx . . $ editor_t#samplePos. > s->lengthcxx . . $ moduleSample_t#length.) |
| 208 | editorcxx . . $ editor..samplePoscxx . . $ editor_t#samplePos. = s->lengthcxx . . $ moduleSample_t#length.; |
| 209 | |
| 210 | if (uicxx . . $ ui..editOpScreenShowncxx . . $ ui_t#editOpScreenShown. && uicxx . . $ ui..editOpScreencxx . . $ ui_t#editOpScreen. == 2) |
| 211 | uicxx . . $ ui..updatePosTextcxx . . $ ui_t#updatePosText. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | void fillSampleFilterUndoBuffercxx . . $ fillSampleFilterUndoBuffer(49f6e7a06ebc5aa8).(void) |
| 216 | { |
| 217 | moduleSample_tcxx . . $ moduleSample_t# *s; |
| 218 | |
| 219 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(editor.currSample >= 0 && editor.currSample <= 30); |
| 220 | if (editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample. >= 0 && editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample. <= 30) |
| 221 | { |
| 222 | s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 223 | memcpycxx . . $ memcpy(cc817cb175f282d).(samplercxx . . $ sampler..sampleUndoCopycxx . . $ sampler_t#sampleUndoCopy., &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.], s->lengthcxx . . $ moduleSample_t#length.); |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | void sampleLinecxx . . $ sampleLine(748afa4755bc9595).(int32_tcxx . . $ int32_t# line_x1, int32_tcxx . . $ int32_t# line_x2, int32_tcxx . . $ int32_t# line_y1, int32_tcxx . . $ int32_t# line_y2) |
| 228 | { |
| 229 | const uint32_tcxx . . $ uint32_t# color = 0x01000000 | videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_QADSCPcxx . . $ PAL_QADSCP.]; // set alpha to 0x10 ( used for invertRange() as a hack ) |
| 230 | |
| 231 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(line_x1 >= 0 || line_x2 >= 0 || line_x1 < SCREEN_W || line_x2 < SCREEN_W); |
| 232 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(line_y1 >= 0 || line_y2 >= 0 || line_y1 < SCREEN_H || line_y2 < SCREEN_H); |
| 233 | |
| 234 | int32_tcxx . . $ int32_t# dx = line_x2 - line_x1; |
| 235 | int32_tcxx . . $ int32_t# ax = ABScxx . . $ `src/pt2_helpers.h:33:9`!(dx) * 2; |
| 236 | int32_tcxx . . $ int32_t# sx = SGNcxx . . $ `src/pt2_helpers.h:32:9`!(dx); |
| 237 | int32_tcxx . . $ int32_t# dy = line_y2 - line_y1; |
| 238 | int32_tcxx . . $ int32_t# ay = ABScxx . . $ `src/pt2_helpers.h:33:9`!(dy) * 2; |
| 239 | int32_tcxx . . $ int32_t# sy = SGNcxx . . $ `src/pt2_helpers.h:32:9`!(dy); |
| 240 | int32_tcxx . . $ int32_t# x = line_x1; |
| 241 | int32_tcxx . . $ int32_t# y = line_y1; |
| 242 | |
| 243 | if (ax > ay) |
| 244 | { |
| 245 | int32_tcxx . . $ int32_t# d = ay - ((uint16_tcxx . . $ uint16_t#)ax >> 1); |
| 246 | while (truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!) |
| 247 | { |
| 248 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(y >= 0 || x >= 0 || y < SCREEN_H || x < SCREEN_W); |
| 249 | |
| 250 | videocxx . . $ video..frameBuffercxx . . $ video_t#frameBuffer.[(y * SCREEN_Wcxx . . $ `src/pt2_header.h:41:9`!) + x] = color; |
| 251 | |
| 252 | if (x == line_x2) |
| 253 | break; |
| 254 | |
| 255 | if (d >= 0) |
| 256 | { |
| 257 | y += sy; |
| 258 | d -= ax; |
| 259 | } |
| 260 | |
| 261 | x += sx; |
| 262 | d += ay; |
| 263 | } |
| 264 | } |
| 265 | else |
| 266 | { |
| 267 | int32_tcxx . . $ int32_t# d = ax - ((uint16_tcxx . . $ uint16_t#)ay >> 1); |
| 268 | while (truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!) |
| 269 | { |
| 270 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(y >= 0 || x >= 0 || y < SCREEN_H || x < SCREEN_W); |
| 271 | |
| 272 | videocxx . . $ video..frameBuffercxx . . $ video_t#frameBuffer.[(y * SCREEN_Wcxx . . $ `src/pt2_header.h:41:9`!) + x] = color; |
| 273 | |
| 274 | if (y == line_y2) |
| 275 | break; |
| 276 | |
| 277 | if (d >= 0) |
| 278 | { |
| 279 | x += sx; |
| 280 | d -= ay; |
| 281 | } |
| 282 | |
| 283 | y += sy; |
| 284 | d += ax; |
| 285 | } |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | static void setDragBarcxx . . $ setDragBar(49f6e7a06ebc5aa8).(void) |
| 290 | { |
| 291 | // clear drag bar background |
| 292 | fillRectcxx . . $ fillRect(6fb2c7d311165c4f).(4, 206, 312, 4, videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_BACKGRDcxx . . $ PAL_BACKGRD.]); |
| 293 | |
| 294 | if (samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength. > 0 && samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. != samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.) |
| 295 | { |
| 296 | const int32_tcxx . . $ int32_t# roundingBias = samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength. >> 1; |
| 297 | |
| 298 | // update drag bar coordinates |
| 299 | int32_tcxx . . $ int32_t# pos = 4 + (((samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset. * 311) + roundingBias) / samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.); |
| 300 | samplercxx . . $ sampler..dragStartcxx . . $ sampler_t#dragStart. = (uint16_tcxx . . $ uint16_t#)CLAMPcxx . . $ `src/pt2_helpers.h:36:9`!(pos, 4, 315); |
| 301 | |
| 302 | pos = 5 + ((((samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. + samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset.) * 311) + roundingBias) / samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.); |
| 303 | samplercxx . . $ sampler..dragEndcxx . . $ sampler_t#dragEnd. = (uint16_tcxx . . $ uint16_t#)CLAMPcxx . . $ `src/pt2_helpers.h:36:9`!(pos, 5, 316); |
| 304 | |
| 305 | if (samplercxx . . $ sampler..dragStartcxx . . $ sampler_t#dragStart. > samplercxx . . $ sampler..dragEndcxx . . $ sampler_t#dragEnd.-1) |
| 306 | samplercxx . . $ sampler..dragStartcxx . . $ sampler_t#dragStart. = samplercxx . . $ sampler..dragEndcxx . . $ sampler_t#dragEnd.-1; |
| 307 | |
| 308 | // draw drag bar |
| 309 | |
| 310 | const uint32_tcxx . . $ uint32_t# dragWidth = samplercxx . . $ sampler..dragEndcxx . . $ sampler_t#dragEnd. - samplercxx . . $ sampler..dragStartcxx . . $ sampler_t#dragStart.; |
| 311 | if (dragWidth > 0) |
| 312 | fillRectcxx . . $ fillRect(6fb2c7d311165c4f).(samplercxx . . $ sampler..dragStartcxx . . $ sampler_t#dragStart., 206, dragWidth, 4, videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_QADSCPcxx . . $ PAL_QADSCP.]); |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | static int8_tcxx . . $ int8_t# getScaledSamplecxx . . $ getScaledSample(3fa411ac91d07532).(int32_tcxx . . $ int32_t# index) |
| 317 | { |
| 318 | if (samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength. <= 0 || index < 0 || index > samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.) |
| 319 | return 0; |
| 320 | |
| 321 | const int8_tcxx . . $ int8_t# *ptr8 = samplercxx . . $ sampler..samStartcxx . . $ sampler_t#samStart.; |
| 322 | if (ptr8 == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 323 | return 0; |
| 324 | |
| 325 | return ptr8[index] >> 2; |
| 326 | } |
| 327 | |
| 328 | int32_tcxx . . $ int32_t# smpPos2Scrcxx . . $ smpPos2Scr(7864480464b09eea).(int32_tcxx . . $ int32_t# pos) // sample pos -> screen x pos |
| 329 | { |
| 330 | if (samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. == 0) |
| 331 | return 0; |
| 332 | |
| 333 | const uint32_tcxx . . $ uint32_t# roundingBias = (const uint32_tcxx . . $ uint32_t#)samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. >> 1; |
| 334 | |
| 335 | pos = (((uint32_tcxx . . $ uint32_t#)pos * SAMPLE_AREA_WIDTHcxx . . $ `src/pt2_header.h:39:9`!) + roundingBias) / (uint32_tcxx . . $ uint32_t#)samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay.; // rounded |
| 336 | pos -= samOffsetScaledcxx . . $ samOffsetScaled.; |
| 337 | |
| 338 | return pos; |
| 339 | } |
| 340 | |
| 341 | int32_tcxx . . $ int32_t# scr2SmpPoscxx . . $ scr2SmpPos(7864480464b09eea).(int32_tcxx . . $ int32_t# x) // screen x pos -> sample pos |
| 342 | { |
| 343 | if (samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. == 0) |
| 344 | return 0; |
| 345 | |
| 346 | if (x < 0) |
| 347 | x = 0; |
| 348 | |
| 349 | x += samOffsetScaledcxx . . $ samOffsetScaled.; |
| 350 | x = (uint32_tcxx . . $ uint32_t#)(x * samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay.) / SAMPLE_AREA_WIDTHcxx . . $ `src/pt2_header.h:39:9`!; // truncate here |
| 351 | |
| 352 | if (x > samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.) |
| 353 | x = samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.; |
| 354 | |
| 355 | return x; |
| 356 | } |
| 357 | |
| 358 | static void getSampleDataPeakcxx . . $ getSampleDataPeak(5c635374ce0d8c13).(int8_tcxx . . $ int8_t# *smpPtr, int32_tcxx . . $ int32_t# numBytes, int16_tcxx . . $ int16_t# *outMin, int16_tcxx . . $ int16_t# *outMax) |
| 359 | { |
| 360 | int8_tcxx . . $ int8_t# smpMin = 127; |
| 361 | int8_tcxx . . $ int8_t# smpMax = -128; |
| 362 | |
| 363 | for (int32_tcxx . . $ int32_t# i = 0; i < numBytes; i++) |
| 364 | { |
| 365 | int8_tcxx . . $ int8_t# smp = smpPtr[i]; |
| 366 | if (smp < smpMin) smpMin = smp; |
| 367 | if (smp > smpMax) smpMax = smp; |
| 368 | } |
| 369 | |
| 370 | *outMin = SAMPLE_AREA_Y_CENTERcxx . . $ `src/pt2_sampler.c:32:9`! - (smpMin >> 2); |
| 371 | *outMax = SAMPLE_AREA_Y_CENTERcxx . . $ `src/pt2_sampler.c:32:9`! - (smpMax >> 2); |
| 372 | } |
| 373 | |
| 374 | void renderSampleDatacxx . . $ renderSampleData(49f6e7a06ebc5aa8).(void) |
| 375 | { |
| 376 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 377 | |
| 378 | // clear sample data background |
| 379 | fillRectcxx . . $ fillRect(6fb2c7d311165c4f).(3, 138, SAMPLE_AREA_WIDTHcxx . . $ `src/pt2_header.h:39:9`!, SAMPLE_VIEW_HEIGHTcxx . . $ `src/pt2_header.h:38:9`!, videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_BACKGRDcxx . . $ PAL_BACKGRD.]); |
| 380 | |
| 381 | // display center line (if enabled) |
| 382 | if (configcxx . . $ config..waveformCenterLinecxx . . $ config_t#waveformCenterLine.) |
| 383 | { |
| 384 | uint32_tcxx . . $ uint32_t# *dstPtr = &videocxx . . $ video..frameBuffercxx . . $ video_t#frameBuffer.[(SAMPLE_AREA_Y_CENTERcxx . . $ `src/pt2_sampler.c:32:9`! * SCREEN_Wcxx . . $ `src/pt2_header.h:41:9`!) + 3]; |
| 385 | for (int32_tcxx . . $ int32_t# x = 0; x < SAMPLE_AREA_WIDTHcxx . . $ `src/pt2_header.h:39:9`!; x++) |
| 386 | dstPtr[x] = 0x02000000 | CENTER_LINE_COLORcxx . . $ `src/pt2_sampler.c:27:9`!; |
| 387 | } |
| 388 | |
| 389 | // render sample data |
| 390 | if (samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. >= 0 && samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. <= configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.) |
| 391 | { |
| 392 | int16_tcxx . . $ int16_t# y1 = SAMPLE_AREA_Y_CENTERcxx . . $ `src/pt2_sampler.c:32:9`! - getScaledSamplecxx . . $ getScaledSample(3fa411ac91d07532).(scr2SmpPoscxx . . $ scr2SmpPos(7864480464b09eea).(0)); |
| 393 | |
| 394 | if (samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. <= SAMPLE_AREA_WIDTHcxx . . $ `src/pt2_header.h:39:9`!) |
| 395 | { |
| 396 | // 1:1 or zoomed in |
| 397 | for (int32_tcxx . . $ int32_t# x = 1; x < SAMPLE_AREA_WIDTHcxx . . $ `src/pt2_header.h:39:9`!; x++) |
| 398 | { |
| 399 | int16_tcxx . . $ int16_t# y2 = SAMPLE_AREA_Y_CENTERcxx . . $ `src/pt2_sampler.c:32:9`! - getScaledSamplecxx . . $ getScaledSample(3fa411ac91d07532).(scr2SmpPoscxx . . $ scr2SmpPos(7864480464b09eea).(x)); |
| 400 | sampleLinecxx . . $ sampleLine(748afa4755bc9595).(x + 2, x + 3, y1, y2); |
| 401 | y1 = y2; |
| 402 | } |
| 403 | } |
| 404 | else |
| 405 | { |
| 406 | // zoomed out |
| 407 | |
| 408 | int16_tcxx . . $ int16_t# min, max; |
| 409 | |
| 410 | int16_tcxx . . $ int16_t# oldMin = y1; |
| 411 | int16_tcxx . . $ int16_t# oldMax = y1; |
| 412 | |
| 413 | int8_tcxx . . $ int8_t# *smpPtr = &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.]; |
| 414 | for (int32_tcxx . . $ int32_t# x = 0; x < SAMPLE_AREA_WIDTHcxx . . $ `src/pt2_header.h:39:9`!; x++) |
| 415 | { |
| 416 | int32_tcxx . . $ int32_t# smpIdx = scr2SmpPoscxx . . $ scr2SmpPos(7864480464b09eea).(x); |
| 417 | int32_tcxx . . $ int32_t# smpNum = scr2SmpPoscxx . . $ scr2SmpPos(7864480464b09eea).(x+1) - smpIdx; |
| 418 | |
| 419 | // prevent look-up overflow (yes, this can happen near the end of the sample) |
| 420 | if (smpIdx+smpNum > samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.) |
| 421 | smpNum = samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength. - smpNum; |
| 422 | |
| 423 | if (smpNum < 1) |
| 424 | smpNum = 1; |
| 425 | |
| 426 | getSampleDataPeakcxx . . $ getSampleDataPeak(5c635374ce0d8c13).(&smpPtr[smpIdx], smpNum, &min, &max); |
| 427 | |
| 428 | if (x > 0) |
| 429 | { |
| 430 | if (min > oldMax) sampleLinecxx . . $ sampleLine(748afa4755bc9595).(x + 2, x + 3, oldMax, min); |
| 431 | if (max < oldMin) sampleLinecxx . . $ sampleLine(748afa4755bc9595).(x + 2, x + 3, oldMin, max); |
| 432 | } |
| 433 | |
| 434 | sampleLinecxx . . $ sampleLine(748afa4755bc9595).(x + 3, x + 3, max, min); |
| 435 | |
| 436 | oldMin = min; |
| 437 | oldMax = max; |
| 438 | } |
| 439 | } |
| 440 | } |
| 441 | |
| 442 | if (uicxx . . $ ui..samplingBoxShowncxx . . $ ui_t#samplingBoxShown.) |
| 443 | return; |
| 444 | |
| 445 | // render "sample display" text |
| 446 | |
| 447 | if (configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength. == 0xFFFE) |
| 448 | { |
| 449 | if (samplercxx . . $ sampler..samStartcxx . . $ sampler_t#samStart. == samplercxx . . $ sampler..blankSamplecxx . . $ sampler_t#blankSample.) |
| 450 | printFiveDecimalsBgcxx . . $ printFiveDecimalsBg(a9b0a938867453dc).(272, 214, 0, videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENTXTcxx . . $ PAL_GENTXT.], videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENBKGcxx . . $ PAL_GENBKG.]); |
| 451 | else |
| 452 | printFiveDecimalsBgcxx . . $ printFiveDecimalsBg(a9b0a938867453dc).(272, 214, samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay., videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENTXTcxx . . $ PAL_GENTXT.], videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENBKGcxx . . $ PAL_GENBKG.]); |
| 453 | } |
| 454 | else |
| 455 | { |
| 456 | if (samplercxx . . $ sampler..samStartcxx . . $ sampler_t#samStart. == samplercxx . . $ sampler..blankSamplecxx . . $ sampler_t#blankSample.) |
| 457 | printSixDecimalsBgcxx . . $ printSixDecimalsBg(a9b0a938867453dc).(270, 214, 0, videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENTXTcxx . . $ PAL_GENTXT.], videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENBKGcxx . . $ PAL_GENBKG.]); |
| 458 | else |
| 459 | printSixDecimalsBgcxx . . $ printSixDecimalsBg(a9b0a938867453dc).(270, 214, samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay., videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENTXTcxx . . $ PAL_GENTXT.], videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENBKGcxx . . $ PAL_GENBKG.]); |
| 460 | } |
| 461 | |
| 462 | setDragBarcxx . . $ setDragBar(49f6e7a06ebc5aa8).(); |
| 463 | setLoopSpritescxx . . $ setLoopSprites(49f6e7a06ebc5aa8).(); |
| 464 | } |
| 465 | |
| 466 | void invertRangecxx . . $ invertRange(49f6e7a06ebc5aa8).(void) |
| 467 | { |
| 468 | if (editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. == -1) |
| 469 | return; // no marking |
| 470 | |
| 471 | int32_tcxx . . $ int32_t# start = smpPos2Scrcxx . . $ smpPos2Scr(7864480464b09eea).(editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs.); |
| 472 | int32_tcxx . . $ int32_t# end = smpPos2Scrcxx . . $ smpPos2Scr(7864480464b09eea).(editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs.); |
| 473 | |
| 474 | if (samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. < samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength. && (start >= SAMPLE_AREA_WIDTHcxx . . $ `src/pt2_header.h:39:9`! || end < 0)) |
| 475 | return; // range is outside of view |
| 476 | |
| 477 | start = CLAMPcxx . . $ `src/pt2_helpers.h:36:9`!(start, 0, SAMPLE_AREA_WIDTHcxx . . $ `src/pt2_header.h:39:9`!-1); |
| 478 | end = CLAMPcxx . . $ `src/pt2_helpers.h:36:9`!(end, 0, SAMPLE_AREA_WIDTHcxx . . $ `src/pt2_header.h:39:9`!-1); |
| 479 | |
| 480 | int32_tcxx . . $ int32_t# rangeLen = (end + 1) - start; |
| 481 | if (rangeLen < 1) |
| 482 | rangeLen = 1; |
| 483 | |
| 484 | uint32_tcxx . . $ uint32_t# *dstPtr = &videocxx . . $ video..frameBuffercxx . . $ video_t#frameBuffer.[(138 * SCREEN_Wcxx . . $ `src/pt2_header.h:41:9`!) + (start + 3)]; |
| 485 | for (int32_tcxx . . $ int32_t# y = 0; y < 64; y++) |
| 486 | { |
| 487 | for (int32_tcxx . . $ int32_t# x = 0; x < rangeLen; x++) |
| 488 | dstPtr[x] = waveInvertTablecxx . . $ waveInvertTable.[((dstPtr[x] >> 24) & 7) ^ 4]; // ptr[x]>>24 = wave/invert color number |
| 489 | |
| 490 | dstPtr += SCREEN_Wcxx . . $ `src/pt2_header.h:41:9`!; |
| 491 | } |
| 492 | } |
| 493 | |
| 494 | void displaySamplecxx . . $ displaySample(49f6e7a06ebc5aa8).(void) |
| 495 | { |
| 496 | if (!uicxx . . $ ui..samplerScreenShowncxx . . $ ui_t#samplerScreenShown.) |
| 497 | return; |
| 498 | |
| 499 | renderSampleDatacxx . . $ renderSampleData(49f6e7a06ebc5aa8).(); |
| 500 | if (editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. != -1) |
| 501 | invertRangecxx . . $ invertRange(49f6e7a06ebc5aa8).(); |
| 502 | |
| 503 | uicxx . . $ ui..update9xxPoscxx . . $ ui_t#update9xxPos. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 504 | } |
| 505 | |
| 506 | void redrawSamplecxx . . $ redrawSample(49f6e7a06ebc5aa8).(void) |
| 507 | { |
| 508 | if (!uicxx . . $ ui..samplerScreenShowncxx . . $ ui_t#samplerScreenShown.) |
| 509 | return; |
| 510 | |
| 511 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(editor.currSample >= 0 && editor.currSample <= 30); |
| 512 | if (editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample. >= 0 && editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample. <= 30) |
| 513 | { |
| 514 | editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. = -1; |
| 515 | |
| 516 | samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset. = 0; |
| 517 | updateSamOffsetcxx . . $ updateSamOffset(49f6e7a06ebc5aa8).(); |
| 518 | |
| 519 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 520 | if (s->lengthcxx . . $ moduleSample_t#length. > 0) |
| 521 | { |
| 522 | samplercxx . . $ sampler..samStartcxx . . $ sampler_t#samStart. = &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.]; |
| 523 | samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. = s->lengthcxx . . $ moduleSample_t#length.; |
| 524 | samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength. = s->lengthcxx . . $ moduleSample_t#length.; |
| 525 | } |
| 526 | else |
| 527 | { |
| 528 | // "blank sample" template |
| 529 | samplercxx . . $ sampler..samStartcxx . . $ sampler_t#samStart. = samplercxx . . $ sampler..blankSamplecxx . . $ sampler_t#blankSample.; |
| 530 | samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength. = SAMPLE_AREA_WIDTHcxx . . $ `src/pt2_header.h:39:9`!; |
| 531 | samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. = SAMPLE_AREA_WIDTHcxx . . $ `src/pt2_header.h:39:9`!; |
| 532 | } |
| 533 | |
| 534 | renderSampleDatacxx . . $ renderSampleData(49f6e7a06ebc5aa8).(); |
| 535 | updateSamplePoscxx . . $ updateSamplePos(49f6e7a06ebc5aa8).(); |
| 536 | |
| 537 | uicxx . . $ ui..update9xxPoscxx . . $ ui_t#update9xxPos. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 538 | uicxx . . $ ui..lastSampleOffsetcxx . . $ ui_t#lastSampleOffset. = 0x900; |
| 539 | } |
| 540 | } |
| 541 | |
| 542 | void highPassSamplecxx . . $ highPassSample(d4f767463ce0a6b3).(int32_tcxx . . $ int32_t# cutOff) |
| 543 | { |
| 544 | onePoleFilter_tcxx . . $ onePoleFilter_t# filterHi; |
| 545 | |
| 546 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(editor.currSample >= 0 && editor.currSample <= 30); |
| 547 | |
| 548 | if (editorcxx . . $ editor..sampleZerocxx . . $ editor_t#sampleZero.) |
| 549 | { |
| 550 | statusNotSampleZerocxx . . $ statusNotSampleZero(49f6e7a06ebc5aa8).(); |
| 551 | return; |
| 552 | } |
| 553 | |
| 554 | if (cutOff == 0) |
| 555 | { |
| 556 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("CUTOFF CAN'T BE 0"); |
| 557 | return; |
| 558 | } |
| 559 | |
| 560 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 561 | if (s->lengthcxx . . $ moduleSample_t#length. == 0) |
| 562 | { |
| 563 | statusSampleIsEmptycxx . . $ statusSampleIsEmpty(49f6e7a06ebc5aa8).(); |
| 564 | return; |
| 565 | } |
| 566 | |
| 567 | int32_tcxx . . $ int32_t# from = 0; |
| 568 | int32_tcxx . . $ int32_t# to = s->lengthcxx . . $ moduleSample_t#length.; |
| 569 | |
| 570 | if (editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. != -1) |
| 571 | { |
| 572 | from = editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs.; |
| 573 | to = editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs.; |
| 574 | |
| 575 | if (to > s->lengthcxx . . $ moduleSample_t#length.) |
| 576 | to = s->lengthcxx . . $ moduleSample_t#length.; |
| 577 | |
| 578 | if (from == to || from >= s->lengthcxx . . $ moduleSample_t#length. || to < from) |
| 579 | { |
| 580 | from = 0; |
| 581 | to = s->lengthcxx . . $ moduleSample_t#length.; |
| 582 | } |
| 583 | } |
| 584 | |
| 585 | float *fSampleData = (float *)malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(s->lengthcxx . . $ moduleSample_t#length. * sizeof (float)); |
| 586 | if (fSampleData == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 587 | { |
| 588 | statusOutOfMemorycxx . . $ statusOutOfMemory(49f6e7a06ebc5aa8).(); |
| 589 | return; |
| 590 | } |
| 591 | |
| 592 | fillSampleFilterUndoBuffercxx . . $ fillSampleFilterUndoBuffer(49f6e7a06ebc5aa8).(); |
| 593 | |
| 594 | // setup filter coefficients |
| 595 | |
| 596 | double dBaseFreq = FILTERS_BASE_FREQcxx . . $ `src/pt2_audio.h:8:9`!; |
| 597 | |
| 598 | double dCutOff = (double)cutOff; |
| 599 | if (dCutOff >= dBaseFreq/2.0) |
| 600 | { |
| 601 | dCutOff = dBaseFreq/2.0; |
| 602 | editorcxx . . $ editor..hpCutOffcxx . . $ editor_t#hpCutOff. = (uint16_tcxx . . $ uint16_t#)dCutOff; |
| 603 | } |
| 604 | |
| 605 | setupOnePoleFiltercxx . . $ setupOnePoleFilter(b75bf72749fa347e).(dBaseFreq, dCutOff, &filterHi); |
| 606 | |
| 607 | clearOnePoleFilterStatecxx . . $ clearOnePoleFilterState(f6e1329b7fbf0464).(&filterHi); |
| 608 | if (to <= s->lengthcxx . . $ moduleSample_t#length.) |
| 609 | { |
| 610 | const int8_tcxx . . $ int8_t# *smpPtr = &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.]; |
| 611 | for (int32_tcxx . . $ int32_t# i = from; i < to; i++) |
| 612 | { |
| 613 | float fSmp = smpPtr[i]; |
| 614 | onePoleHPFiltercxx . . $ onePoleHPFilter(6750ec94a31cf12d).(&filterHi, fSmp, &fSampleData[i]); |
| 615 | } |
| 616 | } |
| 617 | |
| 618 | float fAmp = 1.0f; |
| 619 | if (editorcxx . . $ editor..normalizeFiltersFlagcxx . . $ editor_t#normalizeFiltersFlag.) |
| 620 | { |
| 621 | const float fPeak = getFloatPeakcxx . . $ getFloatPeak(5c3cfcb0fda3feba).(fSampleData, s->lengthcxx . . $ moduleSample_t#length.); |
| 622 | if (fPeak > 0.0f) |
| 623 | fAmp = INT8_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:110:10`! / fPeak; |
| 624 | } |
| 625 | |
| 626 | int8_tcxx . . $ int8_t# *smpPtr = &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.]; |
| 627 | for (int32_tcxx . . $ int32_t# i = from; i < to; i++) |
| 628 | { |
| 629 | int16_tcxx . . $ int16_t# smp16 = (int16_tcxx . . $ int16_t#)roundfcxx . . $ roundf(fbcf3211dfe1bfd1).(fSampleData[i] * fAmp); |
| 630 | smpPtr[i] = (int8_tcxx . . $ int8_t#)(CLAMPcxx . . $ `src/pt2_helpers.h:36:9`!(smp16, INT8_MINcxx . . $ `<external>/3415975807581488833/stdint.h:105:10`!, INT8_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:110:10`!)); |
| 631 | } |
| 632 | |
| 633 | freecxx . . $ free(5d22bdacc48458e8).(fSampleData); |
| 634 | |
| 635 | fixSampleBeepcxx . . $ fixSampleBeep(60146f4515acbace).(s); |
| 636 | displaySamplecxx . . $ displaySample(49f6e7a06ebc5aa8).(); |
| 637 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 638 | } |
| 639 | |
| 640 | void lowPassSamplecxx . . $ lowPassSample(d4f767463ce0a6b3).(int32_tcxx . . $ int32_t# cutOff) |
| 641 | { |
| 642 | onePoleFilter_tcxx . . $ onePoleFilter_t# filterLo; |
| 643 | |
| 644 | if (editorcxx . . $ editor..sampleZerocxx . . $ editor_t#sampleZero.) |
| 645 | { |
| 646 | statusNotSampleZerocxx . . $ statusNotSampleZero(49f6e7a06ebc5aa8).(); |
| 647 | return; |
| 648 | } |
| 649 | |
| 650 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(editor.currSample >= 0 && editor.currSample <= 30); |
| 651 | |
| 652 | if (cutOff == 0) |
| 653 | { |
| 654 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("CUTOFF CAN'T BE 0"); |
| 655 | return; |
| 656 | } |
| 657 | |
| 658 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 659 | if (s->lengthcxx . . $ moduleSample_t#length. == 0) |
| 660 | { |
| 661 | statusSampleIsEmptycxx . . $ statusSampleIsEmpty(49f6e7a06ebc5aa8).(); |
| 662 | return; |
| 663 | } |
| 664 | |
| 665 | int32_tcxx . . $ int32_t# from = 0; |
| 666 | int32_tcxx . . $ int32_t# to = s->lengthcxx . . $ moduleSample_t#length.; |
| 667 | |
| 668 | if (editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. != -1) |
| 669 | { |
| 670 | from = editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs.; |
| 671 | to = editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs.; |
| 672 | |
| 673 | if (to > s->lengthcxx . . $ moduleSample_t#length.) |
| 674 | to = s->lengthcxx . . $ moduleSample_t#length.; |
| 675 | |
| 676 | if (from == to || from >= s->lengthcxx . . $ moduleSample_t#length. || to < from) |
| 677 | { |
| 678 | from = 0; |
| 679 | to = s->lengthcxx . . $ moduleSample_t#length.; |
| 680 | } |
| 681 | } |
| 682 | |
| 683 | float *fSampleData = (float *)malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(s->lengthcxx . . $ moduleSample_t#length. * sizeof (float)); |
| 684 | if (fSampleData == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 685 | { |
| 686 | statusOutOfMemorycxx . . $ statusOutOfMemory(49f6e7a06ebc5aa8).(); |
| 687 | return; |
| 688 | } |
| 689 | |
| 690 | fillSampleFilterUndoBuffercxx . . $ fillSampleFilterUndoBuffer(49f6e7a06ebc5aa8).(); |
| 691 | |
| 692 | // setup filter coefficients |
| 693 | |
| 694 | double dBaseFreq = FILTERS_BASE_FREQcxx . . $ `src/pt2_audio.h:8:9`!; |
| 695 | |
| 696 | double dCutOff = (double)cutOff; |
| 697 | if (dCutOff >= dBaseFreq/2.0) |
| 698 | { |
| 699 | dCutOff = dBaseFreq/2.0; |
| 700 | editorcxx . . $ editor..lpCutOffcxx . . $ editor_t#lpCutOff. = (uint16_tcxx . . $ uint16_t#)dCutOff; |
| 701 | } |
| 702 | |
| 703 | setupOnePoleFiltercxx . . $ setupOnePoleFilter(b75bf72749fa347e).(dBaseFreq, dCutOff, &filterLo); |
| 704 | |
| 705 | // copy over sample data to double buffer |
| 706 | for (int32_tcxx . . $ int32_t# i = 0; i < s->lengthcxx . . $ moduleSample_t#length.; i++) |
| 707 | fSampleData[i] = songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.+i]; |
| 708 | |
| 709 | clearOnePoleFilterStatecxx . . $ clearOnePoleFilterState(f6e1329b7fbf0464).(&filterLo); |
| 710 | if (to <= s->lengthcxx . . $ moduleSample_t#length.) |
| 711 | { |
| 712 | const int8_tcxx . . $ int8_t# *smpPtr = &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.]; |
| 713 | for (int32_tcxx . . $ int32_t# i = from; i < to; i++) |
| 714 | { |
| 715 | float fSmp = smpPtr[i]; |
| 716 | onePoleLPFiltercxx . . $ onePoleLPFilter(6750ec94a31cf12d).(&filterLo, fSmp, &fSampleData[i]); |
| 717 | } |
| 718 | } |
| 719 | |
| 720 | float fAmp = 1.0f; |
| 721 | |
| 722 | if (editorcxx . . $ editor..normalizeFiltersFlagcxx . . $ editor_t#normalizeFiltersFlag.) |
| 723 | { |
| 724 | const float fPeak = getFloatPeakcxx . . $ getFloatPeak(5c3cfcb0fda3feba).(fSampleData, s->lengthcxx . . $ moduleSample_t#length.); |
| 725 | if (fPeak > 0.0f) |
| 726 | fAmp = INT8_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:110:10`! / fPeak; |
| 727 | } |
| 728 | |
| 729 | int8_tcxx . . $ int8_t# *smpPtr = &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.]; |
| 730 | for (int32_tcxx . . $ int32_t# i = from; i < to; i++) |
| 731 | { |
| 732 | int16_tcxx . . $ int16_t# smp16 = (int16_tcxx . . $ int16_t#)roundfcxx . . $ roundf(fbcf3211dfe1bfd1).(fSampleData[i] * fAmp); |
| 733 | smpPtr[i] = (int8_tcxx . . $ int8_t#)(CLAMPcxx . . $ `src/pt2_helpers.h:36:9`!(smp16, INT8_MINcxx . . $ `<external>/3415975807581488833/stdint.h:105:10`!, INT8_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:110:10`!)); |
| 734 | } |
| 735 | |
| 736 | freecxx . . $ free(5d22bdacc48458e8).(fSampleData); |
| 737 | |
| 738 | fixSampleBeepcxx . . $ fixSampleBeep(60146f4515acbace).(s); |
| 739 | displaySamplecxx . . $ displaySample(49f6e7a06ebc5aa8).(); |
| 740 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 741 | } |
| 742 | |
| 743 | void redoSampleDatacxx . . $ redoSampleData(4af4fd0e2b26c4ac).(int8_tcxx . . $ int8_t# sample) |
| 744 | { |
| 745 | if (editorcxx . . $ editor..sampleZerocxx . . $ editor_t#sampleZero.) |
| 746 | { |
| 747 | statusNotSampleZerocxx . . $ statusNotSampleZero(49f6e7a06ebc5aa8).(); |
| 748 | return; |
| 749 | } |
| 750 | |
| 751 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(sample >= 0 && sample <= 30); |
| 752 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[sample]; |
| 753 | |
| 754 | turnOffVoicescxx . . $ turnOffVoices(49f6e7a06ebc5aa8).(); |
| 755 | |
| 756 | if (editorcxx . . $ editor..smpRedoBuffercxx . . $ editor_t#smpRedoBuffer.[sample] != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && editorcxx . . $ editor..smpRedoLengthscxx . . $ editor_t#smpRedoLengths.[sample] > 0) |
| 757 | { |
| 758 | memcpycxx . . $ memcpy(cc817cb175f282d).(&songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.], editorcxx . . $ editor..smpRedoBuffercxx . . $ editor_t#smpRedoBuffer.[sample], editorcxx . . $ editor..smpRedoLengthscxx . . $ editor_t#smpRedoLengths.[sample]); |
| 759 | |
| 760 | if (editorcxx . . $ editor..smpRedoLengthscxx . . $ editor_t#smpRedoLengths.[sample] < configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.) |
| 761 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(&songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset. + editorcxx . . $ editor..smpRedoLengthscxx . . $ editor_t#smpRedoLengths.[sample]], 0, configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength. - editorcxx . . $ editor..smpRedoLengthscxx . . $ editor_t#smpRedoLengths.[sample]); |
| 762 | } |
| 763 | else |
| 764 | { |
| 765 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(&songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.], 0, configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.); |
| 766 | } |
| 767 | |
| 768 | s->fineTunecxx . . $ moduleSample_t#fineTune. = editorcxx . . $ editor..smpRedoFinetunescxx . . $ editor_t#smpRedoFinetunes.[sample]; |
| 769 | s->volumecxx . . $ moduleSample_t#volume. = editorcxx . . $ editor..smpRedoVolumescxx . . $ editor_t#smpRedoVolumes.[sample]; |
| 770 | s->lengthcxx . . $ moduleSample_t#length. = editorcxx . . $ editor..smpRedoLengthscxx . . $ editor_t#smpRedoLengths.[sample]; |
| 771 | s->loopStartcxx . . $ moduleSample_t#loopStart. = editorcxx . . $ editor..smpRedoLoopStartscxx . . $ editor_t#smpRedoLoopStarts.[sample]; |
| 772 | s->loopLengthcxx . . $ moduleSample_t#loopLength. = (editorcxx . . $ editor..smpRedoLoopLengthscxx . . $ editor_t#smpRedoLoopLengths.[sample] < 2) ? 2 : editorcxx . . $ editor..smpRedoLoopLengthscxx . . $ editor_t#smpRedoLoopLengths.[sample]; |
| 773 | |
| 774 | displayMsgcxx . . $ displayMsg(85c52e162fed56f9).("SAMPLE RESTORED !"); |
| 775 | |
| 776 | editorcxx . . $ editor..samplePoscxx . . $ editor_t#samplePos. = 0; |
| 777 | updateCurrSamplecxx . . $ updateCurrSample(49f6e7a06ebc5aa8).(); |
| 778 | |
| 779 | // this routine can be called while the sampler toolboxes are open, so redraw them |
| 780 | if (uicxx . . $ ui..samplerScreenShowncxx . . $ ui_t#samplerScreenShown.) |
| 781 | { |
| 782 | if (uicxx . . $ ui..samplerVolBoxShowncxx . . $ ui_t#samplerVolBoxShown.) |
| 783 | renderSamplerVolBoxcxx . . $ renderSamplerVolBox(49f6e7a06ebc5aa8).(); |
| 784 | else if (uicxx . . $ ui..samplerFiltersBoxShowncxx . . $ ui_t#samplerFiltersBoxShown.) |
| 785 | renderSamplerFiltersBoxcxx . . $ renderSamplerFiltersBox(49f6e7a06ebc5aa8).(); |
| 786 | } |
| 787 | } |
| 788 | |
| 789 | void fillSampleRedoBuffercxx . . $ fillSampleRedoBuffer(4af4fd0e2b26c4ac).(int8_tcxx . . $ int8_t# sample) |
| 790 | { |
| 791 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(sample >= 0 && sample <= 30); |
| 792 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[sample]; |
| 793 | |
| 794 | if (editorcxx . . $ editor..smpRedoBuffercxx . . $ editor_t#smpRedoBuffer.[sample] != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 795 | { |
| 796 | freecxx . . $ free(5d22bdacc48458e8).(editorcxx . . $ editor..smpRedoBuffercxx . . $ editor_t#smpRedoBuffer.[sample]); |
| 797 | editorcxx . . $ editor..smpRedoBuffercxx . . $ editor_t#smpRedoBuffer.[sample] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 798 | } |
| 799 | |
| 800 | editorcxx . . $ editor..smpRedoFinetunescxx . . $ editor_t#smpRedoFinetunes.[sample] = s->fineTunecxx . . $ moduleSample_t#fineTune.; |
| 801 | editorcxx . . $ editor..smpRedoVolumescxx . . $ editor_t#smpRedoVolumes.[sample] = s->volumecxx . . $ moduleSample_t#volume.; |
| 802 | editorcxx . . $ editor..smpRedoLengthscxx . . $ editor_t#smpRedoLengths.[sample] = s->lengthcxx . . $ moduleSample_t#length.; |
| 803 | editorcxx . . $ editor..smpRedoLoopStartscxx . . $ editor_t#smpRedoLoopStarts.[sample] = s->loopStartcxx . . $ moduleSample_t#loopStart.; |
| 804 | editorcxx . . $ editor..smpRedoLoopLengthscxx . . $ editor_t#smpRedoLoopLengths.[sample] = s->loopLengthcxx . . $ moduleSample_t#loopLength.; |
| 805 | |
| 806 | if (s->lengthcxx . . $ moduleSample_t#length. > 0) |
| 807 | { |
| 808 | editorcxx . . $ editor..smpRedoBuffercxx . . $ editor_t#smpRedoBuffer.[sample] = (int8_tcxx . . $ int8_t# *)malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(s->lengthcxx . . $ moduleSample_t#length.); |
| 809 | if (editorcxx . . $ editor..smpRedoBuffercxx . . $ editor_t#smpRedoBuffer.[sample] != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 810 | memcpycxx . . $ memcpy(cc817cb175f282d).(editorcxx . . $ editor..smpRedoBuffercxx . . $ editor_t#smpRedoBuffer.[sample], &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.], s->lengthcxx . . $ moduleSample_t#length.); |
| 811 | } |
| 812 | } |
| 813 | |
| 814 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! allocSamplerVarscxx . . $ allocSamplerVars(c9857a73d68e59ba).(void) // must be called after config is loaded |
| 815 | { |
| 816 | samplercxx . . $ sampler..copyBufcxx . . $ sampler_t#copyBuf. = (int8_tcxx . . $ int8_t# *)malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.); |
| 817 | samplercxx . . $ sampler..blankSamplecxx . . $ sampler_t#blankSample. = (int8_tcxx . . $ int8_t# *)calloccxx . . $ calloc(63a7bf2941bfcd7a).(configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength., 1); |
| 818 | samplercxx . . $ sampler..sampleUndoCopycxx . . $ sampler_t#sampleUndoCopy. = (int8_tcxx . . $ int8_t# *)calloccxx . . $ calloc(63a7bf2941bfcd7a).(configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength., 1); |
| 819 | |
| 820 | if (samplercxx . . $ sampler..copyBufcxx . . $ sampler_t#copyBuf. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || samplercxx . . $ sampler..blankSamplecxx . . $ sampler_t#blankSample. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || samplercxx . . $ sampler..sampleUndoCopycxx . . $ sampler_t#sampleUndoCopy. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 821 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 822 | |
| 823 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 824 | } |
| 825 | |
| 826 | void deAllocSamplerVarscxx . . $ deAllocSamplerVars(49f6e7a06ebc5aa8).(void) |
| 827 | { |
| 828 | if (samplercxx . . $ sampler..copyBufcxx . . $ sampler_t#copyBuf. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 829 | { |
| 830 | freecxx . . $ free(5d22bdacc48458e8).(samplercxx . . $ sampler..copyBufcxx . . $ sampler_t#copyBuf.); |
| 831 | samplercxx . . $ sampler..copyBufcxx . . $ sampler_t#copyBuf. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 832 | } |
| 833 | |
| 834 | if (samplercxx . . $ sampler..blankSamplecxx . . $ sampler_t#blankSample. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 835 | { |
| 836 | freecxx . . $ free(5d22bdacc48458e8).(samplercxx . . $ sampler..blankSamplecxx . . $ sampler_t#blankSample.); |
| 837 | samplercxx . . $ sampler..blankSamplecxx . . $ sampler_t#blankSample. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 838 | } |
| 839 | |
| 840 | if (samplercxx . . $ sampler..sampleUndoCopycxx . . $ sampler_t#sampleUndoCopy. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 841 | { |
| 842 | freecxx . . $ free(5d22bdacc48458e8).(samplercxx . . $ sampler..sampleUndoCopycxx . . $ sampler_t#sampleUndoCopy.); |
| 843 | samplercxx . . $ sampler..sampleUndoCopycxx . . $ sampler_t#sampleUndoCopy. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 844 | } |
| 845 | |
| 846 | for (int32_tcxx . . $ int32_t# i = 0; i < MOD_SAMPLEScxx . . $ `src/pt2_header.h:74:9`!; i++) |
| 847 | { |
| 848 | if (editorcxx . . $ editor..smpRedoBuffercxx . . $ editor_t#smpRedoBuffer.[i] != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 849 | { |
| 850 | freecxx . . $ free(5d22bdacc48458e8).(editorcxx . . $ editor..smpRedoBuffercxx . . $ editor_t#smpRedoBuffer.[i]); |
| 851 | editorcxx . . $ editor..smpRedoBuffercxx . . $ editor_t#smpRedoBuffer.[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 852 | } |
| 853 | } |
| 854 | } |
| 855 | |
| 856 | void samplerRemoveDcOffsetcxx . . $ samplerRemoveDcOffset(49f6e7a06ebc5aa8).(void) |
| 857 | { |
| 858 | if (editorcxx . . $ editor..sampleZerocxx . . $ editor_t#sampleZero.) |
| 859 | { |
| 860 | statusNotSampleZerocxx . . $ statusNotSampleZero(49f6e7a06ebc5aa8).(); |
| 861 | return; |
| 862 | } |
| 863 | |
| 864 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(editor.currSample >= 0 && editor.currSample <= 30); |
| 865 | |
| 866 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 867 | if (s->lengthcxx . . $ moduleSample_t#length. == 0) |
| 868 | { |
| 869 | statusSampleIsEmptycxx . . $ statusSampleIsEmpty(49f6e7a06ebc5aa8).(); |
| 870 | return; |
| 871 | } |
| 872 | |
| 873 | int8_tcxx . . $ int8_t# *smpDat = &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.]; |
| 874 | |
| 875 | int32_tcxx . . $ int32_t# from = 0; |
| 876 | int32_tcxx . . $ int32_t# to = s->lengthcxx . . $ moduleSample_t#length.; |
| 877 | |
| 878 | if (editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. != -1) |
| 879 | { |
| 880 | from = editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs.; |
| 881 | to = editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs.; |
| 882 | |
| 883 | if (to > s->lengthcxx . . $ moduleSample_t#length.) |
| 884 | to = s->lengthcxx . . $ moduleSample_t#length.; |
| 885 | |
| 886 | if (from == to || from >= s->lengthcxx . . $ moduleSample_t#length. || to < from) |
| 887 | { |
| 888 | from = 0; |
| 889 | to = s->lengthcxx . . $ moduleSample_t#length.; |
| 890 | } |
| 891 | } |
| 892 | |
| 893 | if (to <= 0) |
| 894 | return; |
| 895 | |
| 896 | // calculate offset value |
| 897 | int32_tcxx . . $ int32_t# offset = 0; |
| 898 | for (int32_tcxx . . $ int32_t# i = from; i < to; i++) |
| 899 | offset += smpDat[i]; |
| 900 | offset /= to; |
| 901 | |
| 902 | // remove DC offset |
| 903 | for (int32_tcxx . . $ int32_t# i = from; i < to; i++) |
| 904 | { |
| 905 | int32_tcxx . . $ int32_t# smp32 = smpDat[i] - offset; |
| 906 | smpDat[i] = (int8_tcxx . . $ int8_t#)(CLAMPcxx . . $ `src/pt2_helpers.h:36:9`!(smp32, INT8_MINcxx . . $ `<external>/3415975807581488833/stdint.h:105:10`!, INT8_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:110:10`!)); |
| 907 | } |
| 908 | |
| 909 | fixSampleBeepcxx . . $ fixSampleBeep(60146f4515acbace).(s); |
| 910 | displaySamplecxx . . $ displaySample(49f6e7a06ebc5aa8).(); |
| 911 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 912 | } |
| 913 | |
| 914 | #define INTRP_LINEAR_TAPScxx . . $ `src/pt2_sampler.c:914:9`! 2 |
| 915 | #define INTRP8_LINEARcxx . . $ `src/pt2_sampler.c:915:9`!(s1, s2, f) /* output: -127..128 */ \ |
| 916 | s2 -= s1; \ |
| 917 | s2 *= (int32_t)(f >> 16); \ |
| 918 | s1 <<= 8; \ |
| 919 | s2 >>= 16-8; \ |
| 920 | s1 += s2; \ |
| 921 | s1 >>= 8; \ |
| 922 | |
| 923 | void samplerResamplecxx . . $ samplerResample(49f6e7a06ebc5aa8).(void) |
| 924 | { |
| 925 | int32_tcxx . . $ int32_t# samples[INTRP_LINEAR_TAPScxx . . $ `src/pt2_sampler.c:914:9`!]; |
| 926 | |
| 927 | if (editorcxx . . $ editor..sampleZerocxx . . $ editor_t#sampleZero.) |
| 928 | { |
| 929 | statusNotSampleZerocxx . . $ statusNotSampleZero(49f6e7a06ebc5aa8).(); |
| 930 | return; |
| 931 | } |
| 932 | |
| 933 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(editor.currSample >= 0 && editor.currSample <= 30); |
| 934 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(editor.tuningNote <= 35 && editor.resampleNote <= 35); |
| 935 | |
| 936 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 937 | if (s->lengthcxx . . $ moduleSample_t#length. == 0) |
| 938 | { |
| 939 | statusSampleIsEmptycxx . . $ statusSampleIsEmpty(49f6e7a06ebc5aa8).(); |
| 940 | return; |
| 941 | } |
| 942 | |
| 943 | // setup resampling variables |
| 944 | int32_tcxx . . $ int32_t# readPos = 0; |
| 945 | int32_tcxx . . $ int32_t# writePos = 0; |
| 946 | int8_tcxx . . $ int8_t# *writeData = &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.]; |
| 947 | int16_tcxx . . $ int16_t# refPeriod = periodTablecxx . . $ periodTable.[editorcxx . . $ editor..tuningNotecxx . . $ editor_t#tuningNote.]; |
| 948 | int16_tcxx . . $ int16_t# newPeriod = periodTablecxx . . $ periodTable.[(37 * (s->fineTunecxx . . $ moduleSample_t#fineTune. & 0xF)) + editorcxx . . $ editor..resampleNotecxx . . $ editor_t#resampleNote.]; |
| 949 | int32_tcxx . . $ int32_t# readLength = s->lengthcxx . . $ moduleSample_t#length.; |
| 950 | int32_tcxx . . $ int32_t# writeLength = (readLength * newPeriod) / refPeriod; |
| 951 | |
| 952 | if (readLength == writeLength) |
| 953 | return; // no resampling needed |
| 954 | |
| 955 | // allocate memory for our sample duplicate |
| 956 | int8_tcxx . . $ int8_t# *readData = (int8_tcxx . . $ int8_t# *)malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(s->lengthcxx . . $ moduleSample_t#length.); |
| 957 | if (readData == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 958 | { |
| 959 | statusOutOfMemorycxx . . $ statusOutOfMemory(49f6e7a06ebc5aa8).(); |
| 960 | return; |
| 961 | } |
| 962 | |
| 963 | if (writeLength <= 0) |
| 964 | { |
| 965 | freecxx . . $ free(5d22bdacc48458e8).(readData); |
| 966 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("RESAMPLE ERROR !"); |
| 967 | return; |
| 968 | } |
| 969 | |
| 970 | uint64_tcxx . . $ uint64_t# delta64 = ((uint64_tcxx . . $ uint64_t#)readLength << 32) / writeLength; |
| 971 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(delta64 != 0); |
| 972 | |
| 973 | writeLength = writeLength & ~1; |
| 974 | if (writeLength > configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.) |
| 975 | writeLength = configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.; |
| 976 | |
| 977 | memcpycxx . . $ memcpy(cc817cb175f282d).(readData, writeData, readLength); |
| 978 | |
| 979 | // resample |
| 980 | |
| 981 | turnOffVoicescxx . . $ turnOffVoices(49f6e7a06ebc5aa8).(); |
| 982 | |
| 983 | uint64_tcxx . . $ uint64_t# frac64 = 0; |
| 984 | while (writePos < writeLength) |
| 985 | { |
| 986 | // collect samples for interpolation |
| 987 | for (int32_tcxx . . $ int32_t# i = 0; i < INTRP_LINEAR_TAPScxx . . $ `src/pt2_sampler.c:914:9`!; i++) |
| 988 | { |
| 989 | int32_tcxx . . $ int32_t# pos = readPos + i; |
| 990 | if (pos >= readLength) |
| 991 | samples[i] = 0; |
| 992 | else |
| 993 | samples[i] = readData[pos]; |
| 994 | } |
| 995 | |
| 996 | INTRP8_LINEARcxx . . $ `src/pt2_sampler.c:915:9`!(samples[0], samples[1], frac64); |
| 997 | writeData[writePos++] = (int8_tcxx . . $ int8_t#)samples[0]; |
| 998 | |
| 999 | frac64 += delta64; |
| 1000 | readPos += frac64 >> 32; |
| 1001 | frac64 &= UINT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:118:10`!; |
| 1002 | } |
| 1003 | freecxx . . $ free(5d22bdacc48458e8).(readData); |
| 1004 | |
| 1005 | // wipe non-used data in new sample |
| 1006 | if (writeLength < configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.) |
| 1007 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(&writeData[writePos], 0, configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength. - writeLength); |
| 1008 | |
| 1009 | // update sample attributes |
| 1010 | s->lengthcxx . . $ moduleSample_t#length. = writeLength; |
| 1011 | s->fineTunecxx . . $ moduleSample_t#fineTune. = 0; |
| 1012 | |
| 1013 | // scale loop points (and deactivate if overflowing) |
| 1014 | if ((s->loopStartcxx . . $ moduleSample_t#loopStart. + s->loopLengthcxx . . $ moduleSample_t#loopLength.) > 2) |
| 1015 | { |
| 1016 | int32_tcxx . . $ int32_t# loopStart = (int32_tcxx . . $ int32_t#)(((uint64_tcxx . . $ uint64_t#)s->loopStartcxx . . $ moduleSample_t#loopStart. << 32) / delta64) & ~1; |
| 1017 | int32_tcxx . . $ int32_t# loopLength = (int32_tcxx . . $ int32_t#)(((uint64_tcxx . . $ uint64_t#)s->loopLengthcxx . . $ moduleSample_t#loopLength. << 32) / delta64) & ~1; |
| 1018 | |
| 1019 | if (loopStart+loopLength > s->lengthcxx . . $ moduleSample_t#length.) |
| 1020 | { |
| 1021 | s->loopStartcxx . . $ moduleSample_t#loopStart. = 0; |
| 1022 | s->loopLengthcxx . . $ moduleSample_t#loopLength. = 2; |
| 1023 | } |
| 1024 | else |
| 1025 | { |
| 1026 | s->loopStartcxx . . $ moduleSample_t#loopStart. = loopStart; |
| 1027 | s->loopLengthcxx . . $ moduleSample_t#loopLength. = loopLength; |
| 1028 | } |
| 1029 | } |
| 1030 | |
| 1031 | fixSampleBeepcxx . . $ fixSampleBeep(60146f4515acbace).(s); |
| 1032 | updateCurrSamplecxx . . $ updateCurrSample(49f6e7a06ebc5aa8).(); |
| 1033 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 1034 | } |
| 1035 | |
| 1036 | // reads two hex chars from pointer and converts them to one byte |
| 1037 | static uint8_tcxx . . $ uint8_t# hexToInteger2cxx . . $ hexToInteger2(7acab6656d28629f).(char *ptr) |
| 1038 | { |
| 1039 | char hi = ptr[0]; |
| 1040 | char lo = ptr[1]; |
| 1041 | |
| 1042 | if (hi >= '0' && hi <= '9') |
| 1043 | hi -= '0'; |
| 1044 | else if (hi >= 'A' && hi <= 'F') |
| 1045 | hi -= 'A'-10; |
| 1046 | else if (hi >= 'a' && hi <= 'f') |
| 1047 | hi -= 'a'-10; |
| 1048 | else |
| 1049 | hi = 0; |
| 1050 | |
| 1051 | if (lo >= '0' && lo <= '9') |
| 1052 | lo -= '0'; |
| 1053 | else if (lo >= 'A' && lo <= 'F') |
| 1054 | lo -= 'A'-10; |
| 1055 | else if (lo >= 'a' && lo <= 'f') |
| 1056 | lo -= 'a'-10; |
| 1057 | else |
| 1058 | lo = 0; |
| 1059 | |
| 1060 | return (hi << 4) | lo; |
| 1061 | } |
| 1062 | |
| 1063 | void doMixcxx . . $ doMix(49f6e7a06ebc5aa8).(void) |
| 1064 | { |
| 1065 | int8_tcxx . . $ int8_t# *fromPtr1, *fromPtr2; |
| 1066 | int32_tcxx . . $ int32_t# mixLength; |
| 1067 | |
| 1068 | uint8_tcxx . . $ uint8_t# smpFrom1 = hexToInteger2cxx . . $ hexToInteger2(7acab6656d28629f).(&editorcxx . . $ editor..mixTextcxx . . $ editor_t#mixText.[4]); |
| 1069 | uint8_tcxx . . $ uint8_t# smpFrom2 = hexToInteger2cxx . . $ hexToInteger2(7acab6656d28629f).(&editorcxx . . $ editor..mixTextcxx . . $ editor_t#mixText.[7]); |
| 1070 | uint8_tcxx . . $ uint8_t# smpTo = hexToInteger2cxx . . $ hexToInteger2(7acab6656d28629f).(&editorcxx . . $ editor..mixTextcxx . . $ editor_t#mixText.[13]); |
| 1071 | |
| 1072 | if (smpFrom1 == 0 || smpFrom1 > 0x1F || smpFrom2 == 0 || smpFrom2 > 0x1F || smpTo == 0 || smpTo > 0x1F) |
| 1073 | { |
| 1074 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("NOT RANGE 01-1F !"); |
| 1075 | return; |
| 1076 | } |
| 1077 | |
| 1078 | smpFrom1--; |
| 1079 | smpFrom2--; |
| 1080 | smpTo--; |
| 1081 | |
| 1082 | moduleSample_tcxx . . $ moduleSample_t# *s1 = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[smpFrom1]; |
| 1083 | moduleSample_tcxx . . $ moduleSample_t# *s2 = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[smpFrom2]; |
| 1084 | moduleSample_tcxx . . $ moduleSample_t# *s3 = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[smpTo]; |
| 1085 | |
| 1086 | if (s1->lengthcxx . . $ moduleSample_t#length. == 0 || s2->lengthcxx . . $ moduleSample_t#length. == 0) |
| 1087 | { |
| 1088 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("EMPTY SAMPLES !!!"); |
| 1089 | return; |
| 1090 | } |
| 1091 | |
| 1092 | if (s1->lengthcxx . . $ moduleSample_t#length. > s2->lengthcxx . . $ moduleSample_t#length.) |
| 1093 | { |
| 1094 | fromPtr1 = &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s1->offsetcxx . . $ moduleSample_t#offset.]; |
| 1095 | fromPtr2 = &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s2->offsetcxx . . $ moduleSample_t#offset.]; |
| 1096 | mixLength = s1->lengthcxx . . $ moduleSample_t#length.; |
| 1097 | } |
| 1098 | else |
| 1099 | { |
| 1100 | fromPtr1 = &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s2->offsetcxx . . $ moduleSample_t#offset.]; |
| 1101 | fromPtr2 = &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s1->offsetcxx . . $ moduleSample_t#offset.]; |
| 1102 | mixLength = s2->lengthcxx . . $ moduleSample_t#length.; |
| 1103 | } |
| 1104 | |
| 1105 | int8_tcxx . . $ int8_t# *mixPtr = (int8_tcxx . . $ int8_t# *)malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(mixLength); |
| 1106 | if (mixPtr == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1107 | { |
| 1108 | statusOutOfMemorycxx . . $ statusOutOfMemory(49f6e7a06ebc5aa8).(); |
| 1109 | return; |
| 1110 | } |
| 1111 | |
| 1112 | turnOffVoicescxx . . $ turnOffVoices(49f6e7a06ebc5aa8).(); |
| 1113 | |
| 1114 | for (int32_tcxx . . $ int32_t# i = 0; i < mixLength; i++) |
| 1115 | { |
| 1116 | int16_tcxx . . $ int16_t# tmp16 = (i < s2->lengthcxx . . $ moduleSample_t#length.) ? (fromPtr1[i] + fromPtr2[i]) : fromPtr1[i]; |
| 1117 | if (editorcxx . . $ editor..halveSampleFlagcxx . . $ editor_t#halveSampleFlag.) |
| 1118 | tmp16 >>= 1; |
| 1119 | |
| 1120 | mixPtr[i] = (int8_tcxx . . $ int8_t#)(CLAMPcxx . . $ `src/pt2_helpers.h:36:9`!(tmp16, INT8_MINcxx . . $ `<external>/3415975807581488833/stdint.h:105:10`!, INT8_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:110:10`!)); |
| 1121 | } |
| 1122 | |
| 1123 | memcpycxx . . $ memcpy(cc817cb175f282d).(&songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s3->offsetcxx . . $ moduleSample_t#offset.], mixPtr, mixLength); |
| 1124 | if (mixLength < configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.) // clear unused part of sample |
| 1125 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(&songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s3->offsetcxx . . $ moduleSample_t#offset. + mixLength], 0, configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength. - mixLength); |
| 1126 | |
| 1127 | freecxx . . $ free(5d22bdacc48458e8).(mixPtr); |
| 1128 | |
| 1129 | s3->lengthcxx . . $ moduleSample_t#length. = mixLength; |
| 1130 | s3->volumecxx . . $ moduleSample_t#volume. = 64; |
| 1131 | s3->fineTunecxx . . $ moduleSample_t#fineTune. = 0; |
| 1132 | s3->loopStartcxx . . $ moduleSample_t#loopStart. = 0; |
| 1133 | s3->loopLengthcxx . . $ moduleSample_t#loopLength. = 2; |
| 1134 | |
| 1135 | editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample. = smpTo; |
| 1136 | editorcxx . . $ editor..samplePoscxx . . $ editor_t#samplePos. = 0; |
| 1137 | |
| 1138 | fixSampleBeepcxx . . $ fixSampleBeep(60146f4515acbace).(s3); |
| 1139 | updateCurrSamplecxx . . $ updateCurrSample(49f6e7a06ebc5aa8).(); |
| 1140 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 1141 | } |
| 1142 | |
| 1143 | // this is actually treble increase |
| 1144 | void boostSamplecxx . . $ boostSample(918ebd27a9ddbad3).(int32_tcxx . . $ int32_t# sample, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! ignoreMark) |
| 1145 | { |
| 1146 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(sample >= 0 && sample <= 30); |
| 1147 | |
| 1148 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[sample]; |
| 1149 | if (s->lengthcxx . . $ moduleSample_t#length. == 0) |
| 1150 | return; // don't display warning/show warning pointer, it is done elsewhere |
| 1151 | |
| 1152 | int8_tcxx . . $ int8_t# *smpDat = &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.]; |
| 1153 | |
| 1154 | int32_tcxx . . $ int32_t# from = 0; |
| 1155 | int32_tcxx . . $ int32_t# to = s->lengthcxx . . $ moduleSample_t#length.; |
| 1156 | |
| 1157 | if (!ignoreMark) |
| 1158 | { |
| 1159 | if (editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. != -1) |
| 1160 | { |
| 1161 | from = editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs.; |
| 1162 | to = editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs.; |
| 1163 | |
| 1164 | if (to > s->lengthcxx . . $ moduleSample_t#length.) |
| 1165 | to = s->lengthcxx . . $ moduleSample_t#length.; |
| 1166 | |
| 1167 | if (from == to || from >= s->lengthcxx . . $ moduleSample_t#length. || to < from) |
| 1168 | { |
| 1169 | from = 0; |
| 1170 | to = s->lengthcxx . . $ moduleSample_t#length.; |
| 1171 | } |
| 1172 | } |
| 1173 | } |
| 1174 | |
| 1175 | int8_tcxx . . $ int8_t# prevSmp = 0; |
| 1176 | for (int32_tcxx . . $ int32_t# i = from; i < to; i++) |
| 1177 | { |
| 1178 | int16_tcxx . . $ int16_t# tmp16 = smpDat[i] - prevSmp; |
| 1179 | |
| 1180 | // hackery to make it ProTracker accurate |
| 1181 | int16_tcxx . . $ int16_t# smp16; |
| 1182 | if (tmp16 < 0) |
| 1183 | smp16 = smpDat[i] - (-tmp16 >> 2); |
| 1184 | else |
| 1185 | smp16 = smpDat[i] + ( tmp16 >> 2); |
| 1186 | |
| 1187 | prevSmp = smpDat[i]; |
| 1188 | |
| 1189 | smpDat[i] = (int8_tcxx . . $ int8_t#)(CLAMPcxx . . $ `src/pt2_helpers.h:36:9`!(smp16, INT8_MINcxx . . $ `<external>/3415975807581488833/stdint.h:105:10`!, INT8_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:110:10`!)); |
| 1190 | } |
| 1191 | |
| 1192 | fixSampleBeepcxx . . $ fixSampleBeep(60146f4515acbace).(s); |
| 1193 | |
| 1194 | // don't redraw sample here, it is done elsewhere |
| 1195 | } |
| 1196 | |
| 1197 | // this is actually treble decrease |
| 1198 | void filterSamplecxx . . $ filterSample(918ebd27a9ddbad3).(int32_tcxx . . $ int32_t# sample, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! ignoreMark) |
| 1199 | { |
| 1200 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(sample >= 0 && sample <= 30); |
| 1201 | |
| 1202 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[sample]; |
| 1203 | if (s->lengthcxx . . $ moduleSample_t#length. == 0) |
| 1204 | return; // don't display warning/show warning pointer, it is done elsewhere |
| 1205 | |
| 1206 | int8_tcxx . . $ int8_t# *smpDat = &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.]; |
| 1207 | |
| 1208 | int32_tcxx . . $ int32_t# from = 1; |
| 1209 | int32_tcxx . . $ int32_t# to = s->lengthcxx . . $ moduleSample_t#length.; |
| 1210 | |
| 1211 | if (!ignoreMark) |
| 1212 | { |
| 1213 | if (editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. != -1) |
| 1214 | { |
| 1215 | from = editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs.; |
| 1216 | to = editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs.; |
| 1217 | |
| 1218 | if (to > s->lengthcxx . . $ moduleSample_t#length.) |
| 1219 | to = s->lengthcxx . . $ moduleSample_t#length.; |
| 1220 | |
| 1221 | if (from == to || from >= s->lengthcxx . . $ moduleSample_t#length. || to < from) |
| 1222 | { |
| 1223 | from = 0; |
| 1224 | to = s->lengthcxx . . $ moduleSample_t#length.; |
| 1225 | } |
| 1226 | } |
| 1227 | } |
| 1228 | |
| 1229 | if (to < 1) |
| 1230 | return; |
| 1231 | |
| 1232 | to--; |
| 1233 | for (int32_tcxx . . $ int32_t# i = from; i < to; i++) |
| 1234 | smpDat[i] = (smpDat[i+0] + smpDat[i+1]) >> 1; |
| 1235 | |
| 1236 | fixSampleBeepcxx . . $ fixSampleBeep(60146f4515acbace).(s); |
| 1237 | // don't redraw sample here, it is done elsewhere |
| 1238 | } |
| 1239 | |
| 1240 | void toggleTuningTonecxx . . $ toggleTuningTone(49f6e7a06ebc5aa8).(void) |
| 1241 | { |
| 1242 | // bugfix: don't allow tuning tone during play (it was very bugged anyway) |
| 1243 | if (editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. == MODE_PLAYcxx . . $ MODE_PLAY. || editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. == MODE_RECORDcxx . . $ MODE_RECORD.) |
| 1244 | return; |
| 1245 | |
| 1246 | editorcxx . . $ editor..tuningToneFlagcxx . . $ editor_t#tuningToneFlag. ^= 1; |
| 1247 | if (editorcxx . . $ editor..tuningToneFlagcxx . . $ editor_t#tuningToneFlag.) |
| 1248 | { |
| 1249 | // turn tuning tone on |
| 1250 | |
| 1251 | const int32_tcxx . . $ int32_t# chNum = (cursorcxx . . $ cursor..channelcxx . . $ cursor_t#channel. + 1) & 3; |
| 1252 | TToneBitcxx . . $ TToneBit. = 1 << chNum; |
| 1253 | |
| 1254 | lockAudiocxx . . $ lockAudio(49f6e7a06ebc5aa8).(); |
| 1255 | |
| 1256 | const uint32_tcxx . . $ uint32_t# voiceAddr = 0xDFF0A0 + (chNum * 16); |
| 1257 | |
| 1258 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(0xDFF096, TToneBitcxx . . $ TToneBit.); // voice DMA off |
| 1259 | |
| 1260 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(voiceAddr + 6, periodTablecxx . . $ periodTable.[editorcxx . . $ editor..tuningNotecxx . . $ editor_t#tuningNote.]); |
| 1261 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(voiceAddr + 8, 64); // volume |
| 1262 | paulaWritePtrcxx . . $ paulaWritePtr(8ed931be62ea155e).(voiceAddr + 0, tuneToneDatacxx . . $ tuneToneData.); |
| 1263 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(voiceAddr + 4, sizeof (tuneToneDatacxx . . $ tuneToneData.) / 2); // length |
| 1264 | |
| 1265 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(0xDFF096, 0x8000 | TToneBitcxx . . $ TToneBit.); // voice DMA on |
| 1266 | |
| 1267 | // update tracker visuals |
| 1268 | setVisualsDMACONcxx . . $ setVisualsDMACON(ed53e3bbd3fa2f69).(TToneBitcxx . . $ TToneBit.); |
| 1269 | setVisualsPeriodcxx . . $ setVisualsPeriod(a7050f1a4cb56049).(chNum, periodTablecxx . . $ periodTable.[editorcxx . . $ editor..tuningNotecxx . . $ editor_t#tuningNote.]); |
| 1270 | setVisualsVolumecxx . . $ setVisualsVolume(a7050f1a4cb56049).(chNum, 64); |
| 1271 | setVisualsDataPtrcxx . . $ setVisualsDataPtr(70eb3de2aab3469c).(chNum, tuneToneDatacxx . . $ tuneToneData.); |
| 1272 | setVisualsLengthcxx . . $ setVisualsLength(a7050f1a4cb56049).(chNum, sizeof (tuneToneDatacxx . . $ tuneToneData.) / 2); |
| 1273 | setVisualsDMACONcxx . . $ setVisualsDMACON(ed53e3bbd3fa2f69).(0x8000 | TToneBitcxx . . $ TToneBit.); |
| 1274 | |
| 1275 | unlockAudiocxx . . $ unlockAudio(49f6e7a06ebc5aa8).(); |
| 1276 | } |
| 1277 | else |
| 1278 | { |
| 1279 | // turn tuning tone off |
| 1280 | |
| 1281 | lockAudiocxx . . $ lockAudio(49f6e7a06ebc5aa8).(); |
| 1282 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(0xDFF096, TToneBitcxx . . $ TToneBit.); // voice DMA off |
| 1283 | setVisualsDMACONcxx . . $ setVisualsDMACON(ed53e3bbd3fa2f69).(TToneBitcxx . . $ TToneBit.); |
| 1284 | unlockAudiocxx . . $ unlockAudio(49f6e7a06ebc5aa8).(); |
| 1285 | } |
| 1286 | } |
| 1287 | |
| 1288 | void sampleMarkerToBegcxx . . $ sampleMarkerToBeg(49f6e7a06ebc5aa8).(void) |
| 1289 | { |
| 1290 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(editor.currSample >= 0 && editor.currSample <= 30); |
| 1291 | |
| 1292 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 1293 | if (s->lengthcxx . . $ moduleSample_t#length. == 0) |
| 1294 | { |
| 1295 | invertRangecxx . . $ invertRange(49f6e7a06ebc5aa8).(); |
| 1296 | editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. = -1; |
| 1297 | editorcxx . . $ editor..samplePoscxx . . $ editor_t#samplePos. = 0; |
| 1298 | } |
| 1299 | else |
| 1300 | { |
| 1301 | invertRangecxx . . $ invertRange(49f6e7a06ebc5aa8).(); |
| 1302 | if (keybcxx . . $ keyb..shiftPressedcxx . . $ keyb_t#shiftPressed. && editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. != -1) |
| 1303 | { |
| 1304 | editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. = samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset.; |
| 1305 | } |
| 1306 | else |
| 1307 | { |
| 1308 | editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. = samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset.; |
| 1309 | editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs. = editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs.; |
| 1310 | } |
| 1311 | invertRangecxx . . $ invertRange(49f6e7a06ebc5aa8).(); |
| 1312 | |
| 1313 | editorcxx . . $ editor..samplePoscxx . . $ editor_t#samplePos. = editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs.; |
| 1314 | } |
| 1315 | |
| 1316 | updateSamplePoscxx . . $ updateSamplePos(49f6e7a06ebc5aa8).(); |
| 1317 | } |
| 1318 | |
| 1319 | void sampleMarkerToCentercxx . . $ sampleMarkerToCenter(49f6e7a06ebc5aa8).(void) |
| 1320 | { |
| 1321 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(editor.currSample >= 0 && editor.currSample <= 30); |
| 1322 | |
| 1323 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 1324 | if (s->lengthcxx . . $ moduleSample_t#length. == 0) |
| 1325 | { |
| 1326 | invertRangecxx . . $ invertRange(49f6e7a06ebc5aa8).(); |
| 1327 | editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. = -1; |
| 1328 | editorcxx . . $ editor..samplePoscxx . . $ editor_t#samplePos. = 0; |
| 1329 | } |
| 1330 | else |
| 1331 | { |
| 1332 | int32_tcxx . . $ int32_t# middlePos = samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset. + ((samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. + 1) / 2); |
| 1333 | |
| 1334 | invertRangecxx . . $ invertRange(49f6e7a06ebc5aa8).(); |
| 1335 | if (keybcxx . . $ keyb..shiftPressedcxx . . $ keyb_t#shiftPressed. && editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. != -1) |
| 1336 | { |
| 1337 | if (editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. < middlePos) |
| 1338 | editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs. = middlePos; |
| 1339 | else if (editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs. > middlePos) |
| 1340 | editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. = middlePos; |
| 1341 | } |
| 1342 | else |
| 1343 | { |
| 1344 | editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. = middlePos; |
| 1345 | editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs. = editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs.; |
| 1346 | } |
| 1347 | invertRangecxx . . $ invertRange(49f6e7a06ebc5aa8).(); |
| 1348 | |
| 1349 | editorcxx . . $ editor..samplePoscxx . . $ editor_t#samplePos. = editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs.; |
| 1350 | } |
| 1351 | |
| 1352 | updateSamplePoscxx . . $ updateSamplePos(49f6e7a06ebc5aa8).(); |
| 1353 | } |
| 1354 | |
| 1355 | void sampleMarkerToEndcxx . . $ sampleMarkerToEnd(49f6e7a06ebc5aa8).(void) |
| 1356 | { |
| 1357 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(editor.currSample >= 0 && editor.currSample <= 30); |
| 1358 | |
| 1359 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 1360 | if (s->lengthcxx . . $ moduleSample_t#length. == 0) |
| 1361 | { |
| 1362 | invertRangecxx . . $ invertRange(49f6e7a06ebc5aa8).(); |
| 1363 | editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. = -1; |
| 1364 | editorcxx . . $ editor..samplePoscxx . . $ editor_t#samplePos. = 0; |
| 1365 | } |
| 1366 | else |
| 1367 | { |
| 1368 | invertRangecxx . . $ invertRange(49f6e7a06ebc5aa8).(); |
| 1369 | if (keybcxx . . $ keyb..shiftPressedcxx . . $ keyb_t#shiftPressed. && editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. != -1) |
| 1370 | { |
| 1371 | editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs. = s->lengthcxx . . $ moduleSample_t#length.; |
| 1372 | } |
| 1373 | else |
| 1374 | { |
| 1375 | editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. = s->lengthcxx . . $ moduleSample_t#length.; |
| 1376 | editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs. = editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs.; |
| 1377 | } |
| 1378 | invertRangecxx . . $ invertRange(49f6e7a06ebc5aa8).(); |
| 1379 | |
| 1380 | editorcxx . . $ editor..samplePoscxx . . $ editor_t#samplePos. = editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs.; |
| 1381 | } |
| 1382 | |
| 1383 | updateSamplePoscxx . . $ updateSamplePos(49f6e7a06ebc5aa8).(); |
| 1384 | } |
| 1385 | |
| 1386 | void samplerSamCopycxx . . $ samplerSamCopy(49f6e7a06ebc5aa8).(void) |
| 1387 | { |
| 1388 | if (editorcxx . . $ editor..sampleZerocxx . . $ editor_t#sampleZero.) |
| 1389 | { |
| 1390 | statusNotSampleZerocxx . . $ statusNotSampleZero(49f6e7a06ebc5aa8).(); |
| 1391 | return; |
| 1392 | } |
| 1393 | |
| 1394 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(editor.currSample >= 0 && editor.currSample <= 30); |
| 1395 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 1396 | |
| 1397 | if (s->lengthcxx . . $ moduleSample_t#length. == 0) |
| 1398 | { |
| 1399 | statusSampleIsEmptycxx . . $ statusSampleIsEmpty(49f6e7a06ebc5aa8).(); |
| 1400 | return; |
| 1401 | } |
| 1402 | |
| 1403 | // copy sample/slice to new sample slot if shift is held down (new PT feature) |
| 1404 | if (keybcxx . . $ keyb..shiftPressedcxx . . $ keyb_t#shiftPressed.) |
| 1405 | { |
| 1406 | // find free sample slot |
| 1407 | int8_tcxx . . $ int8_t# newSmpNum = 0; |
| 1408 | moduleSample_tcxx . . $ moduleSample_t# *dstSmp = songcxx . . $ song.->samplescxx . . $ module_t#samples.; |
| 1409 | for (; newSmpNum < MOD_SAMPLEScxx . . $ `src/pt2_header.h:74:9`!; newSmpNum++, dstSmp++) |
| 1410 | { |
| 1411 | if (dstSmp->lengthcxx . . $ moduleSample_t#length. == 0) |
| 1412 | break; |
| 1413 | } |
| 1414 | |
| 1415 | if (newSmpNum == MOD_SAMPLEScxx . . $ `src/pt2_header.h:74:9`!) |
| 1416 | { |
| 1417 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("NO FREE SMP SLOT!"); |
| 1418 | return; |
| 1419 | } |
| 1420 | |
| 1421 | const int32_tcxx . . $ int32_t# markLength = editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs. - editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs.; |
| 1422 | if (editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. == -1 || markLength <= 0) |
| 1423 | { |
| 1424 | // no sample data marked, copy whole sample |
| 1425 | |
| 1426 | if (!askBoxcxx . . $ askBox(7371ee129cebb502).(ASKBOX_YES_NOcxx . . $ ASKBOX_YES_NO., "CLONE SAMPLE ?")) |
| 1427 | return; |
| 1428 | |
| 1429 | dstSmp->fineTunecxx . . $ moduleSample_t#fineTune. = s->fineTunecxx . . $ moduleSample_t#fineTune.; |
| 1430 | dstSmp->lengthcxx . . $ moduleSample_t#length. = s->lengthcxx . . $ moduleSample_t#length.; |
| 1431 | dstSmp->loopLengthcxx . . $ moduleSample_t#loopLength. = s->loopLengthcxx . . $ moduleSample_t#loopLength.; |
| 1432 | dstSmp->loopStartcxx . . $ moduleSample_t#loopStart. = s->loopStartcxx . . $ moduleSample_t#loopStart.; |
| 1433 | dstSmp->volumecxx . . $ moduleSample_t#volume. = s->volumecxx . . $ moduleSample_t#volume.; |
| 1434 | |
| 1435 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(dstSmp->textcxx . . $ moduleSample_t#text., '\0', sizeof (dstSmp->textcxx . . $ moduleSample_t#text.)); |
| 1436 | strcpycxx . . $ strcpy(b7b3a83273496486).(dstSmp->textcxx . . $ moduleSample_t#text., "[CLONED SAMPLE]"); |
| 1437 | |
| 1438 | // copy over sample data |
| 1439 | memcpycxx . . $ memcpy(cc817cb175f282d).(&songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[dstSmp->offsetcxx . . $ moduleSample_t#offset.], &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.], s->lengthcxx . . $ moduleSample_t#length.); |
| 1440 | } |
| 1441 | else |
| 1442 | { |
| 1443 | // sample data marked, copy slice only |
| 1444 | |
| 1445 | if (!askBoxcxx . . $ askBox(7371ee129cebb502).(ASKBOX_YES_NOcxx . . $ ASKBOX_YES_NO., "COPY SMP SLICE ?")) |
| 1446 | return; |
| 1447 | |
| 1448 | dstSmp->fineTunecxx . . $ moduleSample_t#fineTune. = s->fineTunecxx . . $ moduleSample_t#fineTune.; |
| 1449 | dstSmp->lengthcxx . . $ moduleSample_t#length. = markLength; |
| 1450 | dstSmp->loopLengthcxx . . $ moduleSample_t#loopLength. = 2; |
| 1451 | dstSmp->loopStartcxx . . $ moduleSample_t#loopStart. = 0; |
| 1452 | dstSmp->volumecxx . . $ moduleSample_t#volume. = s->volumecxx . . $ moduleSample_t#volume.; |
| 1453 | |
| 1454 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(dstSmp->textcxx . . $ moduleSample_t#text., '\0', sizeof (dstSmp->textcxx . . $ moduleSample_t#text.)); |
| 1455 | strcpycxx . . $ strcpy(b7b3a83273496486).(dstSmp->textcxx . . $ moduleSample_t#text., "[COPIED SAMPLE SLICE]"); |
| 1456 | |
| 1457 | // copy over sample data slice |
| 1458 | memcpycxx . . $ memcpy(cc817cb175f282d).(&songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[dstSmp->offsetcxx . . $ moduleSample_t#offset.], &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.+editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs.],markLength); |
| 1459 | |
| 1460 | // new data must have its first two bytes zeroed to prevent beep syndrome |
| 1461 | fixSampleBeepcxx . . $ fixSampleBeep(60146f4515acbace).(dstSmp); |
| 1462 | } |
| 1463 | |
| 1464 | editorcxx . . $ editor..samplePoscxx . . $ editor_t#samplePos. = 0; |
| 1465 | editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample. = newSmpNum; |
| 1466 | updateCurrSamplecxx . . $ updateCurrSample(49f6e7a06ebc5aa8).(); |
| 1467 | |
| 1468 | return; |
| 1469 | } |
| 1470 | |
| 1471 | if (editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. == -1) |
| 1472 | { |
| 1473 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("NO RANGE SELECTED"); |
| 1474 | return; |
| 1475 | } |
| 1476 | |
| 1477 | if (editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs.-editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. <= 0) |
| 1478 | { |
| 1479 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("SET LARGER RANGE"); |
| 1480 | return; |
| 1481 | } |
| 1482 | |
| 1483 | samplercxx . . $ sampler..copyBufSizecxx . . $ sampler_t#copyBufSize. = editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs. - editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs.; |
| 1484 | |
| 1485 | if ((int32_tcxx . . $ int32_t#)(editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. + samplercxx . . $ sampler..copyBufSizecxx . . $ sampler_t#copyBufSize.) > configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.) |
| 1486 | { |
| 1487 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("COPY ERROR !"); |
| 1488 | return; |
| 1489 | } |
| 1490 | |
| 1491 | memcpycxx . . $ memcpy(cc817cb175f282d).(samplercxx . . $ sampler..copyBufcxx . . $ sampler_t#copyBuf., &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.+editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs.], samplercxx . . $ sampler..copyBufSizecxx . . $ sampler_t#copyBufSize.); |
| 1492 | } |
| 1493 | |
| 1494 | void samplerSamDeletecxx . . $ samplerSamDelete(ac50b47256ae7414).(uint8_tcxx . . $ uint8_t# cut) |
| 1495 | { |
| 1496 | if (editorcxx . . $ editor..sampleZerocxx . . $ editor_t#sampleZero.) |
| 1497 | { |
| 1498 | statusNotSampleZerocxx . . $ statusNotSampleZero(49f6e7a06ebc5aa8).(); |
| 1499 | return; |
| 1500 | } |
| 1501 | |
| 1502 | if (editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. == -1) |
| 1503 | { |
| 1504 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("NO RANGE SELECTED"); |
| 1505 | return; |
| 1506 | } |
| 1507 | |
| 1508 | if (editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs.-editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. <= 0) |
| 1509 | { |
| 1510 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("SET LARGER RANGE"); |
| 1511 | return; |
| 1512 | } |
| 1513 | |
| 1514 | if (cut) |
| 1515 | samplerSamCopycxx . . $ samplerSamCopy(49f6e7a06ebc5aa8).(); |
| 1516 | |
| 1517 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(editor.currSample >= 0 && editor.currSample <= 30); |
| 1518 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 1519 | |
| 1520 | int32_tcxx . . $ int32_t# sampleLength = s->lengthcxx . . $ moduleSample_t#length.; |
| 1521 | if (sampleLength == 0) |
| 1522 | { |
| 1523 | statusSampleIsEmptycxx . . $ statusSampleIsEmpty(49f6e7a06ebc5aa8).(); |
| 1524 | return; |
| 1525 | } |
| 1526 | |
| 1527 | turnOffVoicescxx . . $ turnOffVoices(49f6e7a06ebc5aa8).(); |
| 1528 | |
| 1529 | // if whole sample is marked, wipe it |
| 1530 | if (editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs.-editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. >= sampleLength) |
| 1531 | { |
| 1532 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(&songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.], 0, configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.); |
| 1533 | |
| 1534 | invertRangecxx . . $ invertRange(49f6e7a06ebc5aa8).(); |
| 1535 | editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. = -1; |
| 1536 | |
| 1537 | samplercxx . . $ sampler..samStartcxx . . $ sampler_t#samStart. = samplercxx . . $ sampler..blankSamplecxx . . $ sampler_t#blankSample.; |
| 1538 | samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. = SAMPLE_AREA_WIDTHcxx . . $ `src/pt2_header.h:39:9`!; |
| 1539 | samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength. = SAMPLE_AREA_WIDTHcxx . . $ `src/pt2_header.h:39:9`!; |
| 1540 | |
| 1541 | s->lengthcxx . . $ moduleSample_t#length. = 0; |
| 1542 | s->loopStartcxx . . $ moduleSample_t#loopStart. = 0; |
| 1543 | s->loopLengthcxx . . $ moduleSample_t#loopLength. = 2; |
| 1544 | s->volumecxx . . $ moduleSample_t#volume. = 0; |
| 1545 | s->fineTunecxx . . $ moduleSample_t#fineTune. = 0; |
| 1546 | |
| 1547 | editorcxx . . $ editor..samplePoscxx . . $ editor_t#samplePos. = 0; |
| 1548 | updateCurrSamplecxx . . $ updateCurrSample(49f6e7a06ebc5aa8).(); |
| 1549 | |
| 1550 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 1551 | return; |
| 1552 | } |
| 1553 | |
| 1554 | int32_tcxx . . $ int32_t# markEnd = (editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs. > sampleLength) ? sampleLength : editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs.; |
| 1555 | int32_tcxx . . $ int32_t# markStart = editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs.; |
| 1556 | |
| 1557 | int32_tcxx . . $ int32_t# copyLength = (editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. + sampleLength) - markEnd; |
| 1558 | if (copyLength < 2 || copyLength > configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.) |
| 1559 | { |
| 1560 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("SAMPLE CUT FAIL !"); |
| 1561 | return; |
| 1562 | } |
| 1563 | |
| 1564 | int8_tcxx . . $ int8_t# *tmpBuf = (int8_tcxx . . $ int8_t# *)malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(copyLength); |
| 1565 | if (tmpBuf == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1566 | { |
| 1567 | statusOutOfMemorycxx . . $ statusOutOfMemory(49f6e7a06ebc5aa8).(); |
| 1568 | return; |
| 1569 | } |
| 1570 | |
| 1571 | // copy start part |
| 1572 | memcpycxx . . $ memcpy(cc817cb175f282d).(tmpBuf, &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.], editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs.); |
| 1573 | |
| 1574 | // copy end part |
| 1575 | if (sampleLength-markEnd > 0) |
| 1576 | memcpycxx . . $ memcpy(cc817cb175f282d).(&tmpBuf[editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs.], &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.+markEnd], sampleLength - markEnd); |
| 1577 | |
| 1578 | // wipe sample data and copy over the result |
| 1579 | memcpycxx . . $ memcpy(cc817cb175f282d).(&songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.], tmpBuf, copyLength); |
| 1580 | |
| 1581 | if (copyLength < configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.) |
| 1582 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(&songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.+copyLength], 0, configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength. - copyLength); |
| 1583 | |
| 1584 | freecxx . . $ free(5d22bdacc48458e8).(tmpBuf); |
| 1585 | |
| 1586 | samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength. = copyLength; |
| 1587 | if (samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset.+samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. >= samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.) |
| 1588 | { |
| 1589 | if (samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. < samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.) |
| 1590 | { |
| 1591 | if (samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.-samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. < 0) |
| 1592 | { |
| 1593 | samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset. = 0; |
| 1594 | samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. = samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.; |
| 1595 | } |
| 1596 | else |
| 1597 | { |
| 1598 | samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset. = samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength. - samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay.; |
| 1599 | } |
| 1600 | } |
| 1601 | else |
| 1602 | { |
| 1603 | samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset. = 0; |
| 1604 | samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. = samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.; |
| 1605 | } |
| 1606 | |
| 1607 | updateSamOffsetcxx . . $ updateSamOffset(49f6e7a06ebc5aa8).(); |
| 1608 | } |
| 1609 | |
| 1610 | if (s->loopStartcxx . . $ moduleSample_t#loopStart.+s->loopLengthcxx . . $ moduleSample_t#loopLength. > 2) // loop enabled? |
| 1611 | { |
| 1612 | if (markEnd > s->loopStartcxx . . $ moduleSample_t#loopStart.) |
| 1613 | { |
| 1614 | if (markStart < s->loopStartcxx . . $ moduleSample_t#loopStart.+s->loopLengthcxx . . $ moduleSample_t#loopLength.) |
| 1615 | { |
| 1616 | // we cut data inside the loop, increase loop length |
| 1617 | int32_tcxx . . $ int32_t# val32 = (s->loopLengthcxx . . $ moduleSample_t#loopLength. - (markEnd - markStart)) & ~1; |
| 1618 | if (val32 < 2) |
| 1619 | val32 = 2; |
| 1620 | |
| 1621 | s->loopLengthcxx . . $ moduleSample_t#loopLength. = val32; |
| 1622 | } |
| 1623 | |
| 1624 | // we cut data after the loop, don't modify loop points |
| 1625 | } |
| 1626 | else |
| 1627 | { |
| 1628 | // we cut data before the loop, adjust loop start point |
| 1629 | int32_tcxx . . $ int32_t# val32 = (s->loopStartcxx . . $ moduleSample_t#loopStart. - (markEnd - markStart)) & ~1; |
| 1630 | if (val32 < 0) |
| 1631 | { |
| 1632 | s->loopStartcxx . . $ moduleSample_t#loopStart. = 0; |
| 1633 | s->loopLengthcxx . . $ moduleSample_t#loopLength. = 2; |
| 1634 | } |
| 1635 | else |
| 1636 | { |
| 1637 | s->loopStartcxx . . $ moduleSample_t#loopStart. = val32; |
| 1638 | } |
| 1639 | } |
| 1640 | } |
| 1641 | |
| 1642 | s->lengthcxx . . $ moduleSample_t#length. = copyLength & ~1; |
| 1643 | |
| 1644 | // disable loop if invalid |
| 1645 | if (s->loopStartcxx . . $ moduleSample_t#loopStart.+s->loopLengthcxx . . $ moduleSample_t#loopLength. > s->lengthcxx . . $ moduleSample_t#length.) |
| 1646 | { |
| 1647 | s->loopStartcxx . . $ moduleSample_t#loopStart. = 0; |
| 1648 | s->loopLengthcxx . . $ moduleSample_t#loopLength. = 2; |
| 1649 | } |
| 1650 | |
| 1651 | if (samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. <= 2) |
| 1652 | { |
| 1653 | samplercxx . . $ sampler..samStartcxx . . $ sampler_t#samStart. = samplercxx . . $ sampler..blankSamplecxx . . $ sampler_t#blankSample.; |
| 1654 | samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength. = SAMPLE_AREA_WIDTHcxx . . $ `src/pt2_header.h:39:9`!; |
| 1655 | samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. = SAMPLE_AREA_WIDTHcxx . . $ `src/pt2_header.h:39:9`!; |
| 1656 | } |
| 1657 | |
| 1658 | invertRangecxx . . $ invertRange(49f6e7a06ebc5aa8).(); |
| 1659 | if (samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. == 0) |
| 1660 | { |
| 1661 | editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. = -1; // clear marking |
| 1662 | } |
| 1663 | else |
| 1664 | { |
| 1665 | if (editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. >= s->lengthcxx . . $ moduleSample_t#length.) |
| 1666 | editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. = s->lengthcxx . . $ moduleSample_t#length. - 1; |
| 1667 | |
| 1668 | editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs. = editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs.; |
| 1669 | invertRangecxx . . $ invertRange(49f6e7a06ebc5aa8).(); |
| 1670 | } |
| 1671 | |
| 1672 | editorcxx . . $ editor..samplePoscxx . . $ editor_t#samplePos. = editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs.; |
| 1673 | fixSampleBeepcxx . . $ fixSampleBeep(60146f4515acbace).(s); |
| 1674 | updateSamplePoscxx . . $ updateSamplePos(49f6e7a06ebc5aa8).(); |
| 1675 | recalcChordLengthcxx . . $ recalcChordLength(49f6e7a06ebc5aa8).(); |
| 1676 | displaySamplecxx . . $ displaySample(49f6e7a06ebc5aa8).(); |
| 1677 | |
| 1678 | uicxx . . $ ui..updateCurrSampleLengthcxx . . $ ui_t#updateCurrSampleLength. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 1679 | uicxx . . $ ui..updateCurrSampleRepeatcxx . . $ ui_t#updateCurrSampleRepeat. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 1680 | uicxx . . $ ui..updateCurrSampleReplencxx . . $ ui_t#updateCurrSampleReplen. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 1681 | uicxx . . $ ui..updateSongSizecxx . . $ ui_t#updateSongSize. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 1682 | |
| 1683 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 1684 | } |
| 1685 | |
| 1686 | void samplerSamPastecxx . . $ samplerSamPaste(49f6e7a06ebc5aa8).(void) |
| 1687 | { |
| 1688 | if (editorcxx . . $ editor..sampleZerocxx . . $ editor_t#sampleZero.) |
| 1689 | { |
| 1690 | statusNotSampleZerocxx . . $ statusNotSampleZero(49f6e7a06ebc5aa8).(); |
| 1691 | return; |
| 1692 | } |
| 1693 | |
| 1694 | if (samplercxx . . $ sampler..copyBufcxx . . $ sampler_t#copyBuf. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || samplercxx . . $ sampler..copyBufSizecxx . . $ sampler_t#copyBufSize. == 0) |
| 1695 | { |
| 1696 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("BUFFER IS EMPTY"); |
| 1697 | return; |
| 1698 | } |
| 1699 | |
| 1700 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(editor.currSample >= 0 && editor.currSample <= 30); |
| 1701 | |
| 1702 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 1703 | if (s->lengthcxx . . $ moduleSample_t#length. > 0 && editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. == -1) |
| 1704 | { |
| 1705 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("SET CURSOR POS"); |
| 1706 | return; |
| 1707 | } |
| 1708 | |
| 1709 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! sampleWasEmpty = (s->lengthcxx . . $ moduleSample_t#length. == 0); |
| 1710 | int32_tcxx . . $ int32_t# markStart = sampleWasEmpty ? 0 : editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs.; |
| 1711 | |
| 1712 | if (s->lengthcxx . . $ moduleSample_t#length.+samplercxx . . $ sampler..copyBufSizecxx . . $ sampler_t#copyBufSize. > configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.) |
| 1713 | { |
| 1714 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("NOT ENOUGH ROOM"); |
| 1715 | return; |
| 1716 | } |
| 1717 | |
| 1718 | int8_tcxx . . $ int8_t# *tmpBuf = (int8_tcxx . . $ int8_t# *)malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.); |
| 1719 | if (tmpBuf == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1720 | { |
| 1721 | statusOutOfMemorycxx . . $ statusOutOfMemory(49f6e7a06ebc5aa8).(); |
| 1722 | return; |
| 1723 | } |
| 1724 | |
| 1725 | uint32_tcxx . . $ uint32_t# readPos = 0; |
| 1726 | turnOffVoicescxx . . $ turnOffVoices(49f6e7a06ebc5aa8).(); |
| 1727 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! wasZooming = (samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. != samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.); |
| 1728 | |
| 1729 | // copy start part |
| 1730 | if (markStart > 0) |
| 1731 | { |
| 1732 | memcpycxx . . $ memcpy(cc817cb175f282d).(&tmpBuf[readPos], &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.], markStart); |
| 1733 | readPos += markStart; |
| 1734 | } |
| 1735 | |
| 1736 | // copy actual buffer |
| 1737 | memcpycxx . . $ memcpy(cc817cb175f282d).(&tmpBuf[readPos], samplercxx . . $ sampler..copyBufcxx . . $ sampler_t#copyBuf., samplercxx . . $ sampler..copyBufSizecxx . . $ sampler_t#copyBufSize.); |
| 1738 | |
| 1739 | // copy end part |
| 1740 | if (markStart >= 0) |
| 1741 | { |
| 1742 | readPos += samplercxx . . $ sampler..copyBufSizecxx . . $ sampler_t#copyBufSize.; |
| 1743 | |
| 1744 | if (s->lengthcxx . . $ moduleSample_t#length.-markStart > 0) |
| 1745 | memcpycxx . . $ memcpy(cc817cb175f282d).(&tmpBuf[readPos], &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.+markStart], s->lengthcxx . . $ moduleSample_t#length. - markStart); |
| 1746 | } |
| 1747 | |
| 1748 | int32_tcxx . . $ int32_t# newLength = (s->lengthcxx . . $ moduleSample_t#length. + samplercxx . . $ sampler..copyBufSizecxx . . $ sampler_t#copyBufSize.) & ~1; |
| 1749 | if (newLength > configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.) |
| 1750 | newLength = configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.; |
| 1751 | |
| 1752 | samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength. = s->lengthcxx . . $ moduleSample_t#length. = newLength; |
| 1753 | |
| 1754 | if (s->loopLengthcxx . . $ moduleSample_t#loopLength. > 2) // loop enabled? |
| 1755 | { |
| 1756 | if (markStart > s->loopStartcxx . . $ moduleSample_t#loopStart.) |
| 1757 | { |
| 1758 | if (markStart < s->loopStartcxx . . $ moduleSample_t#loopStart.+s->loopLengthcxx . . $ moduleSample_t#loopLength.) |
| 1759 | { |
| 1760 | // we pasted data inside the loop, increase loop length |
| 1761 | |
| 1762 | if (s->loopLengthcxx . . $ moduleSample_t#loopLength.+samplercxx . . $ sampler..copyBufSizecxx . . $ sampler_t#copyBufSize. > configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.) |
| 1763 | { |
| 1764 | s->loopStartcxx . . $ moduleSample_t#loopStart. = 0; |
| 1765 | s->loopLengthcxx . . $ moduleSample_t#loopLength. = 2; |
| 1766 | } |
| 1767 | else |
| 1768 | { |
| 1769 | s->loopLengthcxx . . $ moduleSample_t#loopLength. = (s->loopLengthcxx . . $ moduleSample_t#loopLength. + samplercxx . . $ sampler..copyBufSizecxx . . $ sampler_t#copyBufSize.) & configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.; |
| 1770 | if (s->loopStartcxx . . $ moduleSample_t#loopStart.+s->loopLengthcxx . . $ moduleSample_t#loopLength. > s->lengthcxx . . $ moduleSample_t#length.) |
| 1771 | { |
| 1772 | s->loopStartcxx . . $ moduleSample_t#loopStart. = 0; |
| 1773 | s->loopLengthcxx . . $ moduleSample_t#loopLength. = 2; |
| 1774 | } |
| 1775 | } |
| 1776 | } |
| 1777 | |
| 1778 | // we pasted data after the loop, don't modify loop points |
| 1779 | } |
| 1780 | else |
| 1781 | { |
| 1782 | // we pasted data before the loop, adjust loop start point |
| 1783 | if (s->loopStartcxx . . $ moduleSample_t#loopStart.+samplercxx . . $ sampler..copyBufSizecxx . . $ sampler_t#copyBufSize. > configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.) |
| 1784 | { |
| 1785 | s->loopStartcxx . . $ moduleSample_t#loopStart. = 0; |
| 1786 | s->loopLengthcxx . . $ moduleSample_t#loopLength. = 2; |
| 1787 | } |
| 1788 | else |
| 1789 | { |
| 1790 | s->loopStartcxx . . $ moduleSample_t#loopStart. = (s->loopStartcxx . . $ moduleSample_t#loopStart. + samplercxx . . $ sampler..copyBufSizecxx . . $ sampler_t#copyBufSize.) & configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.; |
| 1791 | if (s->loopStartcxx . . $ moduleSample_t#loopStart.+s->loopLengthcxx . . $ moduleSample_t#loopLength. > s->lengthcxx . . $ moduleSample_t#length.) |
| 1792 | { |
| 1793 | s->loopStartcxx . . $ moduleSample_t#loopStart. = 0; |
| 1794 | s->loopLengthcxx . . $ moduleSample_t#loopLength. = 2; |
| 1795 | } |
| 1796 | } |
| 1797 | } |
| 1798 | } |
| 1799 | |
| 1800 | memcpycxx . . $ memcpy(cc817cb175f282d).(&songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.], tmpBuf, s->lengthcxx . . $ moduleSample_t#length.); |
| 1801 | |
| 1802 | // clear data after sample's length (if present) |
| 1803 | if (s->lengthcxx . . $ moduleSample_t#length. < configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.) |
| 1804 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(&songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.+s->lengthcxx . . $ moduleSample_t#length.], 0, configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength. - s->lengthcxx . . $ moduleSample_t#length.); |
| 1805 | |
| 1806 | freecxx . . $ free(5d22bdacc48458e8).(tmpBuf); |
| 1807 | |
| 1808 | invertRangecxx . . $ invertRange(49f6e7a06ebc5aa8).(); |
| 1809 | editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. = -1; |
| 1810 | |
| 1811 | fixSampleBeepcxx . . $ fixSampleBeep(60146f4515acbace).(s); |
| 1812 | updateSamplePoscxx . . $ updateSamplePos(49f6e7a06ebc5aa8).(); |
| 1813 | recalcChordLengthcxx . . $ recalcChordLength(49f6e7a06ebc5aa8).(); |
| 1814 | |
| 1815 | if (wasZooming) |
| 1816 | displaySamplecxx . . $ displaySample(49f6e7a06ebc5aa8).(); |
| 1817 | else |
| 1818 | redrawSamplecxx . . $ redrawSample(49f6e7a06ebc5aa8).(); |
| 1819 | |
| 1820 | // if we pasted into an empty sample, force its volume to max (64) |
| 1821 | if (sampleWasEmpty) |
| 1822 | { |
| 1823 | s->volumecxx . . $ moduleSample_t#volume. = 64; |
| 1824 | uicxx . . $ ui..updateCurrSampleVolumecxx . . $ ui_t#updateCurrSampleVolume. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 1825 | } |
| 1826 | |
| 1827 | uicxx . . $ ui..updateCurrSampleLengthcxx . . $ ui_t#updateCurrSampleLength. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 1828 | uicxx . . $ ui..updateSongSizecxx . . $ ui_t#updateSongSize. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 1829 | |
| 1830 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 1831 | } |
| 1832 | |
| 1833 | static void playCurrSamplecxx . . $ playCurrSample(da4f4e0f7b8222d2).(uint8_tcxx . . $ uint8_t# chn, int32_tcxx . . $ int32_t# startOffset, int32_tcxx . . $ int32_t# endOffset, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! playWaveformFlag) |
| 1834 | { |
| 1835 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(editor.currSample >= 0 && editor.currSample <= 30); |
| 1836 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(chn < PAULA_VOICES); |
| 1837 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(editor.currPlayNote <= 35); |
| 1838 | |
| 1839 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 1840 | moduleChannel_tcxx . . $ moduleChannel_t# *ch = &songcxx . . $ song.->channelscxx . . $ module_t#channels.[chn]; |
| 1841 | |
| 1842 | lockAudiocxx . . $ lockAudio(49f6e7a06ebc5aa8).(); |
| 1843 | |
| 1844 | ch->n_samplenumcxx . . $ moduleChannel_t#n_samplenum. = editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.; |
| 1845 | ch->n_volumecxx . . $ moduleChannel_t#n_volume. = s->volumecxx . . $ moduleSample_t#volume.; |
| 1846 | ch->n_periodcxx . . $ moduleChannel_t#n_period. = periodTablecxx . . $ periodTable.[(37 * (s->fineTunecxx . . $ moduleSample_t#fineTune. & 0xF)) + editorcxx . . $ editor..currPlayNotecxx . . $ editor_t#currPlayNote.]; |
| 1847 | |
| 1848 | if (playWaveformFlag) |
| 1849 | { |
| 1850 | ch->n_startcxx . . $ moduleChannel_t#n_start. = &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.]; |
| 1851 | 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); |
| 1852 | ch->n_loopstartcxx . . $ moduleChannel_t#n_loopstart. = &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset. + s->loopStartcxx . . $ moduleSample_t#loopStart.]; |
| 1853 | ch->n_replencxx . . $ moduleChannel_t#n_replen. = (uint16_tcxx . . $ uint16_t#)(s->loopLengthcxx . . $ moduleSample_t#loopLength. >> 1); |
| 1854 | } |
| 1855 | else |
| 1856 | { |
| 1857 | ch->n_startcxx . . $ moduleChannel_t#n_start. = &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset. + startOffset]; |
| 1858 | ch->n_lengthcxx . . $ moduleChannel_t#n_length. = (uint16_tcxx . . $ uint16_t#)((uint32_tcxx . . $ uint32_t#)(endOffset - startOffset) >> 1); |
| 1859 | ch->n_loopstartcxx . . $ moduleChannel_t#n_loopstart. = &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.]; |
| 1860 | ch->n_replencxx . . $ moduleChannel_t#n_replen. = 1; |
| 1861 | } |
| 1862 | |
| 1863 | if (ch->n_lengthcxx . . $ moduleChannel_t#n_length. == 0) |
| 1864 | ch->n_lengthcxx . . $ moduleChannel_t#n_length. = 1; |
| 1865 | |
| 1866 | const uint32_tcxx . . $ uint32_t# voiceAddr = 0xDFF0A0 + (chn * 16); |
| 1867 | |
| 1868 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(voiceAddr + 8, ch->n_volumecxx . . $ moduleChannel_t#n_volume.); |
| 1869 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(voiceAddr + 6, ch->n_periodcxx . . $ moduleChannel_t#n_period.); |
| 1870 | paulaWritePtrcxx . . $ paulaWritePtr(8ed931be62ea155e).(voiceAddr + 0, ch->n_startcxx . . $ moduleChannel_t#n_start.); |
| 1871 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(voiceAddr + 4, ch->n_lengthcxx . . $ moduleChannel_t#n_length.); |
| 1872 | |
| 1873 | if (!editorcxx . . $ editor..mutedcxx . . $ editor_t#muted.[chn]) |
| 1874 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(0xDFF096, 0x8000 | ch->n_dmabitcxx . . $ moduleChannel_t#n_dmabit.); // voice DMA on |
| 1875 | else |
| 1876 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(0xDFF096, ch->n_dmabitcxx . . $ moduleChannel_t#n_dmabit.); // voice DMA off |
| 1877 | |
| 1878 | // these take effect after the current DMA cycle is done |
| 1879 | if (playWaveformFlag) |
| 1880 | { |
| 1881 | paulaWritePtrcxx . . $ paulaWritePtr(8ed931be62ea155e).(voiceAddr + 0, ch->n_loopstartcxx . . $ moduleChannel_t#n_loopstart.); |
| 1882 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(voiceAddr + 4, ch->n_replencxx . . $ moduleChannel_t#n_replen.); |
| 1883 | } |
| 1884 | else |
| 1885 | { |
| 1886 | paulaWritePtrcxx . . $ paulaWritePtr(8ed931be62ea155e).(voiceAddr + 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); // data |
| 1887 | paulaWriteWordcxx . . $ paulaWriteWord(272d193675e92631).(voiceAddr + 4, 1); // length |
| 1888 | } |
| 1889 | |
| 1890 | // update tracker visuals |
| 1891 | |
| 1892 | setVisualsVolumecxx . . $ setVisualsVolume(a7050f1a4cb56049).(chn, ch->n_volumecxx . . $ moduleChannel_t#n_volume.); |
| 1893 | setVisualsPeriodcxx . . $ setVisualsPeriod(a7050f1a4cb56049).(chn, ch->n_periodcxx . . $ moduleChannel_t#n_period.); |
| 1894 | setVisualsDataPtrcxx . . $ setVisualsDataPtr(70eb3de2aab3469c).(chn, ch->n_startcxx . . $ moduleChannel_t#n_start.); |
| 1895 | setVisualsLengthcxx . . $ setVisualsLength(a7050f1a4cb56049).(chn, ch->n_lengthcxx . . $ moduleChannel_t#n_length.); |
| 1896 | |
| 1897 | if (!editorcxx . . $ editor..mutedcxx . . $ editor_t#muted.[chn]) |
| 1898 | setVisualsDMACONcxx . . $ setVisualsDMACON(ed53e3bbd3fa2f69).(0x8000 | ch->n_dmabitcxx . . $ moduleChannel_t#n_dmabit.); |
| 1899 | else |
| 1900 | setVisualsDMACONcxx . . $ setVisualsDMACON(ed53e3bbd3fa2f69).(ch->n_dmabitcxx . . $ moduleChannel_t#n_dmabit.); |
| 1901 | |
| 1902 | if (playWaveformFlag) |
| 1903 | { |
| 1904 | setVisualsDataPtrcxx . . $ setVisualsDataPtr(70eb3de2aab3469c).(chn, ch->n_loopstartcxx . . $ moduleChannel_t#n_loopstart.); |
| 1905 | setVisualsLengthcxx . . $ setVisualsLength(a7050f1a4cb56049).(chn, ch->n_replencxx . . $ moduleChannel_t#n_replen.); |
| 1906 | } |
| 1907 | else |
| 1908 | { |
| 1909 | setVisualsDataPtrcxx . . $ setVisualsDataPtr(70eb3de2aab3469c).(chn, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 1910 | setVisualsLengthcxx . . $ setVisualsLength(a7050f1a4cb56049).(chn, 1); |
| 1911 | } |
| 1912 | |
| 1913 | unlockAudiocxx . . $ unlockAudio(49f6e7a06ebc5aa8).(); |
| 1914 | |
| 1915 | // PT quirk: spectrum analyzer is still handled here even if channel is muted |
| 1916 | updateSpectrumAnalyzercxx . . $ updateSpectrumAnalyzer(2b0f6589498b1c50).(ch->n_volumecxx . . $ moduleChannel_t#n_volume., ch->n_periodcxx . . $ moduleChannel_t#n_period.); |
| 1917 | } |
| 1918 | |
| 1919 | void samplerPlayWaveformcxx . . $ samplerPlayWaveform(49f6e7a06ebc5aa8).(void) |
| 1920 | { |
| 1921 | playCurrSamplecxx . . $ playCurrSample(da4f4e0f7b8222d2).(cursorcxx . . $ cursor..channelcxx . . $ cursor_t#channel., 0, 0, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!); |
| 1922 | } |
| 1923 | |
| 1924 | void samplerPlayDisplaycxx . . $ samplerPlayDisplay(49f6e7a06ebc5aa8).(void) |
| 1925 | { |
| 1926 | int32_tcxx . . $ int32_t# start = samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset.; |
| 1927 | int32_tcxx . . $ int32_t# end = samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset. + samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay.; |
| 1928 | |
| 1929 | playCurrSamplecxx . . $ playCurrSample(da4f4e0f7b8222d2).(cursorcxx . . $ cursor..channelcxx . . $ cursor_t#channel., start, end, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!); |
| 1930 | } |
| 1931 | |
| 1932 | void samplerPlayRangecxx . . $ samplerPlayRange(49f6e7a06ebc5aa8).(void) |
| 1933 | { |
| 1934 | if (editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. == -1) |
| 1935 | { |
| 1936 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("NO RANGE SELECTED"); |
| 1937 | return; |
| 1938 | } |
| 1939 | |
| 1940 | if (editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs.-editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. < 2) |
| 1941 | { |
| 1942 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("SET LARGER RANGE"); |
| 1943 | return; |
| 1944 | } |
| 1945 | |
| 1946 | playCurrSamplecxx . . $ playCurrSample(da4f4e0f7b8222d2).(cursorcxx . . $ cursor..channelcxx . . $ cursor_t#channel., editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs., editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs., falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!); |
| 1947 | } |
| 1948 | |
| 1949 | void setLoopSpritescxx . . $ setLoopSprites(49f6e7a06ebc5aa8).(void) |
| 1950 | { |
| 1951 | if (!uicxx . . $ ui..samplerScreenShowncxx . . $ ui_t#samplerScreenShown.) |
| 1952 | { |
| 1953 | hideSpritecxx . . $ hideSprite(d4f767463ce0a6b3).(SPRITE_LOOP_PIN_LEFTcxx . . $ SPRITE_LOOP_PIN_LEFT.); |
| 1954 | hideSpritecxx . . $ hideSprite(d4f767463ce0a6b3).(SPRITE_LOOP_PIN_RIGHTcxx . . $ SPRITE_LOOP_PIN_RIGHT.); |
| 1955 | return; |
| 1956 | } |
| 1957 | |
| 1958 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(editor.currSample >= 0 && editor.currSample <= 30); |
| 1959 | |
| 1960 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 1961 | if (s->loopStartcxx . . $ moduleSample_t#loopStart.+s->loopLengthcxx . . $ moduleSample_t#loopLength. > 2) |
| 1962 | { |
| 1963 | if (samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. > 0) |
| 1964 | { |
| 1965 | samplercxx . . $ sampler..loopStartPoscxx . . $ sampler_t#loopStartPos. = (int16_tcxx . . $ int16_t#)smpPos2Scrcxx . . $ smpPos2Scr(7864480464b09eea).(s->loopStartcxx . . $ moduleSample_t#loopStart.); |
| 1966 | if (samplercxx . . $ sampler..loopStartPoscxx . . $ sampler_t#loopStartPos. >= 0 && samplercxx . . $ sampler..loopStartPoscxx . . $ sampler_t#loopStartPos. <= SAMPLE_AREA_WIDTHcxx . . $ `src/pt2_header.h:39:9`!) |
| 1967 | setSpritePoscxx . . $ setSpritePos(b1146eedae1e1d0b).(SPRITE_LOOP_PIN_LEFTcxx . . $ SPRITE_LOOP_PIN_LEFT., samplercxx . . $ sampler..loopStartPoscxx . . $ sampler_t#loopStartPos., 138); |
| 1968 | else |
| 1969 | hideSpritecxx . . $ hideSprite(d4f767463ce0a6b3).(SPRITE_LOOP_PIN_LEFTcxx . . $ SPRITE_LOOP_PIN_LEFT.); |
| 1970 | |
| 1971 | samplercxx . . $ sampler..loopEndPoscxx . . $ sampler_t#loopEndPos. = (int16_tcxx . . $ int16_t#)smpPos2Scrcxx . . $ smpPos2Scr(7864480464b09eea).(s->loopStartcxx . . $ moduleSample_t#loopStart. + s->loopLengthcxx . . $ moduleSample_t#loopLength.); |
| 1972 | |
| 1973 | /* Nasty kludge for where the right loop pin would sometimes disappear |
| 1974 | ** when zoomed in and scrolled all the way to the right. |
| 1975 | */ |
| 1976 | if (samplercxx . . $ sampler..loopEndPoscxx . . $ sampler_t#loopEndPos. == SAMPLE_AREA_WIDTHcxx . . $ `src/pt2_header.h:39:9`!+1) |
| 1977 | samplercxx . . $ sampler..loopEndPoscxx . . $ sampler_t#loopEndPos. = SAMPLE_AREA_WIDTHcxx . . $ `src/pt2_header.h:39:9`!; |
| 1978 | |
| 1979 | if (samplercxx . . $ sampler..loopEndPoscxx . . $ sampler_t#loopEndPos. >= 0 && samplercxx . . $ sampler..loopEndPoscxx . . $ sampler_t#loopEndPos. <= SAMPLE_AREA_WIDTHcxx . . $ `src/pt2_header.h:39:9`!) |
| 1980 | setSpritePoscxx . . $ setSpritePos(b1146eedae1e1d0b).(SPRITE_LOOP_PIN_RIGHTcxx . . $ SPRITE_LOOP_PIN_RIGHT., samplercxx . . $ sampler..loopEndPoscxx . . $ sampler_t#loopEndPos. + 3, 138); |
| 1981 | else |
| 1982 | hideSpritecxx . . $ hideSprite(d4f767463ce0a6b3).(SPRITE_LOOP_PIN_RIGHTcxx . . $ SPRITE_LOOP_PIN_RIGHT.); |
| 1983 | } |
| 1984 | } |
| 1985 | else |
| 1986 | { |
| 1987 | samplercxx . . $ sampler..loopStartPoscxx . . $ sampler_t#loopStartPos. = 0; |
| 1988 | samplercxx . . $ sampler..loopEndPoscxx . . $ sampler_t#loopEndPos. = 0; |
| 1989 | |
| 1990 | hideSpritecxx . . $ hideSprite(d4f767463ce0a6b3).(SPRITE_LOOP_PIN_LEFTcxx . . $ SPRITE_LOOP_PIN_LEFT.); |
| 1991 | hideSpritecxx . . $ hideSprite(d4f767463ce0a6b3).(SPRITE_LOOP_PIN_RIGHTcxx . . $ SPRITE_LOOP_PIN_RIGHT.); |
| 1992 | } |
| 1993 | |
| 1994 | textOutBgcxx . . $ textOutBg(14940e7ead0326d3).(288, 225, (s->loopStartcxx . . $ moduleSample_t#loopStart.+s->loopLengthcxx . . $ moduleSample_t#loopLength. > 2) ? "ON " : "OFF", videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENTXTcxx . . $ PAL_GENTXT.], videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENBKGcxx . . $ PAL_GENBKG.]); |
| 1995 | } |
| 1996 | |
| 1997 | void samplerShowAllcxx . . $ samplerShowAll(49f6e7a06ebc5aa8).(void) |
| 1998 | { |
| 1999 | if (samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. == samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.) |
| 2000 | return; // don't attempt to show all if already showing all! |
| 2001 | |
| 2002 | samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset. = 0; |
| 2003 | samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. = samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.; |
| 2004 | |
| 2005 | updateSamOffsetcxx . . $ updateSamOffset(49f6e7a06ebc5aa8).(); |
| 2006 | displaySamplecxx . . $ displaySample(49f6e7a06ebc5aa8).(); |
| 2007 | } |
| 2008 | |
| 2009 | static void samplerZoomIncxx . . $ samplerZoomIn(3e454b8ccf442868).(int32_tcxx . . $ int32_t# step, int32_tcxx . . $ int32_t# x) |
| 2010 | { |
| 2011 | if (songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.].lengthcxx . . $ moduleSample_t#length. == 0 || samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. <= 2) |
| 2012 | return; |
| 2013 | |
| 2014 | if (step < 1) |
| 2015 | step = 1; |
| 2016 | |
| 2017 | int32_tcxx . . $ int32_t# tmpDisplay = samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. - (step << 1); |
| 2018 | if (tmpDisplay < 2) |
| 2019 | tmpDisplay = 2; |
| 2020 | |
| 2021 | const int32_tcxx . . $ int32_t# roundingBias = SCREEN_Wcxx . . $ `src/pt2_header.h:41:9`! / 4; |
| 2022 | |
| 2023 | step += (((x - (SCREEN_Wcxx . . $ `src/pt2_header.h:41:9`! / 2)) * step) + roundingBias) / (SCREEN_Wcxx . . $ `src/pt2_header.h:41:9`! / 2); |
| 2024 | |
| 2025 | int32_tcxx . . $ int32_t# tmpOffset = samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset. + step; |
| 2026 | if (tmpOffset < 0) |
| 2027 | tmpOffset = 0; |
| 2028 | |
| 2029 | if (tmpOffset+tmpDisplay > samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.) |
| 2030 | tmpOffset = samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.-tmpDisplay; |
| 2031 | |
| 2032 | samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset. = tmpOffset; |
| 2033 | samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. = tmpDisplay; |
| 2034 | |
| 2035 | updateSamOffsetcxx . . $ updateSamOffset(49f6e7a06ebc5aa8).(); |
| 2036 | displaySamplecxx . . $ displaySample(49f6e7a06ebc5aa8).(); |
| 2037 | } |
| 2038 | |
| 2039 | static void samplerZoomOutcxx . . $ samplerZoomOut(3e454b8ccf442868).(int32_tcxx . . $ int32_t# step, int32_tcxx . . $ int32_t# x) |
| 2040 | { |
| 2041 | int32_tcxx . . $ int32_t# tmpOffset; |
| 2042 | |
| 2043 | if (songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.].lengthcxx . . $ moduleSample_t#length. == 0 || samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. == samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.) |
| 2044 | return; |
| 2045 | |
| 2046 | if (step < 1) |
| 2047 | step = 1; |
| 2048 | |
| 2049 | int32_tcxx . . $ int32_t# tmpDisplay = samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. + (step << 1); |
| 2050 | if (tmpDisplay > samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.) |
| 2051 | { |
| 2052 | tmpOffset = 0; |
| 2053 | tmpDisplay = samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.; |
| 2054 | } |
| 2055 | else |
| 2056 | { |
| 2057 | const int32_tcxx . . $ int32_t# roundingBias = SCREEN_Wcxx . . $ `src/pt2_header.h:41:9`! / 4; |
| 2058 | |
| 2059 | step += (((x - (SCREEN_Wcxx . . $ `src/pt2_header.h:41:9`! / 2)) * step) + roundingBias) / (SCREEN_Wcxx . . $ `src/pt2_header.h:41:9`! / 2); |
| 2060 | |
| 2061 | tmpOffset = samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset. - step; |
| 2062 | if (tmpOffset < 0) |
| 2063 | tmpOffset = 0; |
| 2064 | |
| 2065 | if (tmpOffset+tmpDisplay > samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.) |
| 2066 | tmpOffset = samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.-tmpDisplay; |
| 2067 | } |
| 2068 | |
| 2069 | samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset. = tmpOffset; |
| 2070 | samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. = tmpDisplay; |
| 2071 | |
| 2072 | updateSamOffsetcxx . . $ updateSamOffset(49f6e7a06ebc5aa8).(); |
| 2073 | displaySamplecxx . . $ displaySample(49f6e7a06ebc5aa8).(); |
| 2074 | } |
| 2075 | |
| 2076 | void samplerZoomInMouseWheelcxx . . $ samplerZoomInMouseWheel(49f6e7a06ebc5aa8).(void) |
| 2077 | { |
| 2078 | samplerZoomIncxx . . $ samplerZoomIn(3e454b8ccf442868).((samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. + 5) / 10, mousecxx . . $ mouse..xcxx . . $ mouse_t#x.); |
| 2079 | } |
| 2080 | |
| 2081 | void samplerZoomOutMouseWheelcxx . . $ samplerZoomOutMouseWheel(49f6e7a06ebc5aa8).(void) |
| 2082 | { |
| 2083 | samplerZoomOutcxx . . $ samplerZoomOut(3e454b8ccf442868).((samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. + 5) / 10, mousecxx . . $ mouse..xcxx . . $ mouse_t#x.); |
| 2084 | } |
| 2085 | |
| 2086 | void samplerZoomOut2xcxx . . $ samplerZoomOut2x(49f6e7a06ebc5aa8).(void) |
| 2087 | { |
| 2088 | samplerZoomOutcxx . . $ samplerZoomOut(3e454b8ccf442868).((samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. + 1) / 2, SCREEN_Wcxx . . $ `src/pt2_header.h:41:9`! / 2); |
| 2089 | } |
| 2090 | |
| 2091 | void samplerRangeAllcxx . . $ samplerRangeAll(49f6e7a06ebc5aa8).(void) |
| 2092 | { |
| 2093 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(editor.currSample >= 0 && editor.currSample <= 30); |
| 2094 | |
| 2095 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 2096 | if (s->lengthcxx . . $ moduleSample_t#length. == 0) |
| 2097 | { |
| 2098 | invertRangecxx . . $ invertRange(49f6e7a06ebc5aa8).(); |
| 2099 | editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. = -1; |
| 2100 | } |
| 2101 | else |
| 2102 | { |
| 2103 | invertRangecxx . . $ invertRange(49f6e7a06ebc5aa8).(); |
| 2104 | editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. = samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset.; |
| 2105 | editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs. = samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset. + samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay.; |
| 2106 | invertRangecxx . . $ invertRange(49f6e7a06ebc5aa8).(); |
| 2107 | } |
| 2108 | } |
| 2109 | |
| 2110 | void samplerShowRangecxx . . $ samplerShowRange(49f6e7a06ebc5aa8).(void) |
| 2111 | { |
| 2112 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(editor.currSample >= 0 && editor.currSample <= 30); |
| 2113 | |
| 2114 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 2115 | if (s->lengthcxx . . $ moduleSample_t#length. == 0) |
| 2116 | { |
| 2117 | statusSampleIsEmptycxx . . $ statusSampleIsEmpty(49f6e7a06ebc5aa8).(); |
| 2118 | return; |
| 2119 | } |
| 2120 | |
| 2121 | if (editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. == -1) |
| 2122 | { |
| 2123 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("NO RANGE SELECTED"); |
| 2124 | return; |
| 2125 | } |
| 2126 | |
| 2127 | if (editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs.-editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. < 2) |
| 2128 | { |
| 2129 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("SET LARGER RANGE"); |
| 2130 | return; |
| 2131 | } |
| 2132 | |
| 2133 | samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. = editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs. - editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs.; |
| 2134 | samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset. = editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs.; |
| 2135 | |
| 2136 | if (samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay.+samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset. > samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.) |
| 2137 | samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset. = samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.-samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay.; |
| 2138 | |
| 2139 | updateSamOffsetcxx . . $ updateSamOffset(49f6e7a06ebc5aa8).(); |
| 2140 | |
| 2141 | invertRangecxx . . $ invertRange(49f6e7a06ebc5aa8).(); |
| 2142 | editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. = -1; |
| 2143 | |
| 2144 | displaySamplecxx . . $ displaySample(49f6e7a06ebc5aa8).(); |
| 2145 | } |
| 2146 | |
| 2147 | void volBoxBarPressedcxx . . $ volBoxBarPressed(b45ddcbc8423892c).(boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! mouseButtonHeld) |
| 2148 | { |
| 2149 | if (!mouseButtonHeld) |
| 2150 | { |
| 2151 | if (mousecxx . . $ mouse..xcxx . . $ mouse_t#x. >= 72 && mousecxx . . $ mouse..xcxx . . $ mouse_t#x. <= 173) |
| 2152 | { |
| 2153 | if (mousecxx . . $ mouse..ycxx . . $ mouse_t#y. >= 154 && mousecxx . . $ mouse..ycxx . . $ mouse_t#y. <= 174) uicxx . . $ ui..forceVolDragcxx . . $ ui_t#forceVolDrag. = 1; |
| 2154 | if (mousecxx . . $ mouse..ycxx . . $ mouse_t#y. >= 165 && mousecxx . . $ mouse..ycxx . . $ mouse_t#y. <= 175) uicxx . . $ ui..forceVolDragcxx . . $ ui_t#forceVolDrag. = 2; |
| 2155 | } |
| 2156 | } |
| 2157 | else |
| 2158 | { |
| 2159 | if (samplercxx . . $ sampler..lastMouseXcxx . . $ sampler_t#lastMouseX. != mousecxx . . $ mouse..xcxx . . $ mouse_t#x.) |
| 2160 | { |
| 2161 | samplercxx . . $ sampler..lastMouseXcxx . . $ sampler_t#lastMouseX. = mousecxx . . $ mouse..xcxx . . $ mouse_t#x.; |
| 2162 | int32_tcxx . . $ int32_t# mouseX = CLAMPcxx . . $ `src/pt2_helpers.h:36:9`!(sampler.lastMouseX - 107, 0, 60); |
| 2163 | |
| 2164 | if (uicxx . . $ ui..forceVolDragcxx . . $ ui_t#forceVolDrag. == 1) |
| 2165 | { |
| 2166 | editorcxx . . $ editor..vol1cxx . . $ editor_t#vol1. = (int16_tcxx . . $ int16_t#)(((mouseX * 200) + (60/2)) / 60); // rounded |
| 2167 | uicxx . . $ ui..updateVolFromTextcxx . . $ ui_t#updateVolFromText. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 2168 | showVolFromSlidercxx . . $ showVolFromSlider(49f6e7a06ebc5aa8).(); |
| 2169 | } |
| 2170 | else if (uicxx . . $ ui..forceVolDragcxx . . $ ui_t#forceVolDrag. == 2) |
| 2171 | { |
| 2172 | editorcxx . . $ editor..vol2cxx . . $ editor_t#vol2. = (int16_tcxx . . $ int16_t#)(((mouseX * 200) + (60/2)) / 60); // rounded |
| 2173 | uicxx . . $ ui..updateVolToTextcxx . . $ ui_t#updateVolToText. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 2174 | showVolToSlidercxx . . $ showVolToSlider(49f6e7a06ebc5aa8).(); |
| 2175 | } |
| 2176 | } |
| 2177 | } |
| 2178 | } |
| 2179 | |
| 2180 | void samplerBarPressedcxx . . $ samplerBarPressed(b45ddcbc8423892c).(boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! mouseButtonHeld) |
| 2181 | { |
| 2182 | if (!mouseButtonHeld) |
| 2183 | { |
| 2184 | if (mousecxx . . $ mouse..xcxx . . $ mouse_t#x. >= 4 && mousecxx . . $ mouse..xcxx . . $ mouse_t#x. <= 315) |
| 2185 | { |
| 2186 | if (mousecxx . . $ mouse..xcxx . . $ mouse_t#x. < samplercxx . . $ sampler..dragStartcxx . . $ sampler_t#dragStart.) |
| 2187 | { |
| 2188 | int32_tcxx . . $ int32_t# tmp32 = samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset. - samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay.; |
| 2189 | if (tmp32 < 0) |
| 2190 | tmp32 = 0; |
| 2191 | |
| 2192 | if (tmp32 == samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset.) |
| 2193 | return; |
| 2194 | |
| 2195 | samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset. = tmp32; |
| 2196 | |
| 2197 | updateSamOffsetcxx . . $ updateSamOffset(49f6e7a06ebc5aa8).(); |
| 2198 | displaySamplecxx . . $ displaySample(49f6e7a06ebc5aa8).(); |
| 2199 | return; |
| 2200 | } |
| 2201 | |
| 2202 | if (mousecxx . . $ mouse..xcxx . . $ mouse_t#x. > samplercxx . . $ sampler..dragEndcxx . . $ sampler_t#dragEnd.) |
| 2203 | { |
| 2204 | int32_tcxx . . $ int32_t# tmp32 = samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset. + samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay.; |
| 2205 | if (tmp32+samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. <= samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.) |
| 2206 | { |
| 2207 | if (tmp32 == samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset.) |
| 2208 | return; |
| 2209 | |
| 2210 | samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset. = tmp32; |
| 2211 | } |
| 2212 | else |
| 2213 | { |
| 2214 | tmp32 = samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength. - samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay.; |
| 2215 | if (tmp32 == samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset.) |
| 2216 | return; |
| 2217 | |
| 2218 | samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset. = tmp32; |
| 2219 | } |
| 2220 | |
| 2221 | updateSamOffsetcxx . . $ updateSamOffset(49f6e7a06ebc5aa8).(); |
| 2222 | displaySamplecxx . . $ displaySample(49f6e7a06ebc5aa8).(); |
| 2223 | return; |
| 2224 | } |
| 2225 | |
| 2226 | samplercxx . . $ sampler..lastSamPoscxx . . $ sampler_t#lastSamPos. = mousecxx . . $ mouse..xcxx . . $ mouse_t#x.; |
| 2227 | samplercxx . . $ sampler..saveMouseXcxx . . $ sampler_t#saveMouseX. = samplercxx . . $ sampler..lastSamPoscxx . . $ sampler_t#lastSamPos. - samplercxx . . $ sampler..dragStartcxx . . $ sampler_t#dragStart.; |
| 2228 | |
| 2229 | uicxx . . $ ui..forceSampleDragcxx . . $ ui_t#forceSampleDrag. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 2230 | } |
| 2231 | } |
| 2232 | |
| 2233 | if (mousecxx . . $ mouse..xcxx . . $ mouse_t#x. != samplercxx . . $ sampler..lastSamPoscxx . . $ sampler_t#lastSamPos.) |
| 2234 | { |
| 2235 | samplercxx . . $ sampler..lastSamPoscxx . . $ sampler_t#lastSamPos. = mousecxx . . $ mouse..xcxx . . $ mouse_t#x.; |
| 2236 | |
| 2237 | int32_tcxx . . $ int32_t# tmp32 = samplercxx . . $ sampler..lastSamPoscxx . . $ sampler_t#lastSamPos. - samplercxx . . $ sampler..saveMouseXcxx . . $ sampler_t#saveMouseX. - 4; |
| 2238 | tmp32 = CLAMPcxx . . $ `src/pt2_helpers.h:36:9`!(tmp32, 0, SAMPLE_AREA_WIDTHcxx . . $ `src/pt2_header.h:39:9`!); |
| 2239 | |
| 2240 | tmp32 = ((tmp32 * samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.) + (311/2)) / 311; // rounded |
| 2241 | if (tmp32+samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay. <= samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength.) |
| 2242 | { |
| 2243 | if (tmp32 == samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset.) |
| 2244 | return; |
| 2245 | |
| 2246 | samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset. = tmp32; |
| 2247 | } |
| 2248 | else |
| 2249 | { |
| 2250 | tmp32 = samplercxx . . $ sampler..samLengthcxx . . $ sampler_t#samLength. - samplercxx . . $ sampler..samDisplaycxx . . $ sampler_t#samDisplay.; |
| 2251 | if (tmp32 == samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset.) |
| 2252 | return; |
| 2253 | |
| 2254 | samplercxx . . $ sampler..samOffsetcxx . . $ sampler_t#samOffset. = tmp32; |
| 2255 | } |
| 2256 | |
| 2257 | updateSamOffsetcxx . . $ updateSamOffset(49f6e7a06ebc5aa8).(); |
| 2258 | displaySamplecxx . . $ displaySample(49f6e7a06ebc5aa8).(); |
| 2259 | } |
| 2260 | } |
| 2261 | |
| 2262 | static int32_tcxx . . $ int32_t# mouseYToSampleYcxx . . $ mouseYToSampleY(7864480464b09eea).(int32_tcxx . . $ int32_t# my) |
| 2263 | { |
| 2264 | if (my == SAMPLE_AREA_Y_CENTERcxx . . $ `src/pt2_sampler.c:32:9`!) // center |
| 2265 | { |
| 2266 | return 128; |
| 2267 | } |
| 2268 | else |
| 2269 | { |
| 2270 | int32_tcxx . . $ int32_t# tmp32 = my - 138; |
| 2271 | tmp32 = ((tmp32 << 8) + (SAMPLE_AREA_HEIGHTcxx . . $ `src/pt2_sampler.c:33:9`!/2)) / SAMPLE_AREA_HEIGHTcxx . . $ `src/pt2_sampler.c:33:9`!; |
| 2272 | tmp32 = CLAMPcxx . . $ `src/pt2_helpers.h:36:9`!(tmp32, 0, 255); |
| 2273 | tmp32 ^= 0xFF; |
| 2274 | |
| 2275 | return tmp32; |
| 2276 | } |
| 2277 | } |
| 2278 | |
| 2279 | void samplerEditSamplecxx . . $ samplerEditSample(b45ddcbc8423892c).(boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! mouseButtonHeld) |
| 2280 | { |
| 2281 | int32_tcxx . . $ int32_t# p, vl; |
| 2282 | |
| 2283 | if (editorcxx . . $ editor..sampleZerocxx . . $ editor_t#sampleZero.) |
| 2284 | { |
| 2285 | statusNotSampleZerocxx . . $ statusNotSampleZero(49f6e7a06ebc5aa8).(); |
| 2286 | return; |
| 2287 | } |
| 2288 | |
| 2289 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(editor.currSample >= 0 && editor.currSample <= 30); |
| 2290 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 2291 | |
| 2292 | if (s->lengthcxx . . $ moduleSample_t#length. == 0) |
| 2293 | { |
| 2294 | displayErrorMsgcxx . . $ displayErrorMsg(85c52e162fed56f9).("SAMPLE LENGTH = 0"); |
| 2295 | return; |
| 2296 | } |
| 2297 | |
| 2298 | int32_tcxx . . $ int32_t# mx = mousecxx . . $ mouse..xcxx . . $ mouse_t#x.; |
| 2299 | if (mx > 4+SAMPLE_AREA_WIDTHcxx . . $ `src/pt2_header.h:39:9`!) |
| 2300 | mx = 4+SAMPLE_AREA_WIDTHcxx . . $ `src/pt2_header.h:39:9`!; |
| 2301 | |
| 2302 | int32_tcxx . . $ int32_t# my = mousecxx . . $ mouse..ycxx . . $ mouse_t#y.; |
| 2303 | |
| 2304 | if (!mouseButtonHeld) |
| 2305 | { |
| 2306 | lastDrawXcxx . . $ lastDrawX. = scr2SmpPoscxx . . $ scr2SmpPos(7864480464b09eea).(mx); |
| 2307 | lastDrawYcxx . . $ lastDrawY. = mouseYToSampleYcxx . . $ mouseYToSampleY(7864480464b09eea).(my); |
| 2308 | |
| 2309 | uicxx . . $ ui..forceSampleEditcxx . . $ ui_t#forceSampleEdit. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 2310 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 2311 | } |
| 2312 | else if (mx == samplercxx . . $ sampler..lastMouseXcxx . . $ sampler_t#lastMouseX. && my == samplercxx . . $ sampler..lastMouseYcxx . . $ sampler_t#lastMouseY.) |
| 2313 | { |
| 2314 | return; // don't continue if we didn't move the mouse |
| 2315 | } |
| 2316 | |
| 2317 | if (mx != samplercxx . . $ sampler..lastMouseXcxx . . $ sampler_t#lastMouseX.) |
| 2318 | p = scr2SmpPoscxx . . $ scr2SmpPos(7864480464b09eea).(mx); |
| 2319 | else |
| 2320 | p = lastDrawXcxx . . $ lastDrawX.; |
| 2321 | |
| 2322 | if (!keybcxx . . $ keyb..shiftPressedcxx . . $ keyb_t#shiftPressed. && my != samplercxx . . $ sampler..lastMouseYcxx . . $ sampler_t#lastMouseY.) |
| 2323 | vl = mouseYToSampleYcxx . . $ mouseYToSampleY(7864480464b09eea).(my); |
| 2324 | else |
| 2325 | vl = lastDrawYcxx . . $ lastDrawY.; |
| 2326 | |
| 2327 | samplercxx . . $ sampler..lastMouseXcxx . . $ sampler_t#lastMouseX. = mx; |
| 2328 | samplercxx . . $ sampler..lastMouseYcxx . . $ sampler_t#lastMouseY. = my; |
| 2329 | |
| 2330 | int32_tcxx . . $ int32_t# r = p; |
| 2331 | int32_tcxx . . $ int32_t# rvl = vl; |
| 2332 | |
| 2333 | // swap x/y if needed |
| 2334 | if (p > lastDrawXcxx . . $ lastDrawX.) |
| 2335 | { |
| 2336 | // swap x |
| 2337 | int32_tcxx . . $ int32_t# tmp32 = p; |
| 2338 | p = lastDrawXcxx . . $ lastDrawX.; |
| 2339 | lastDrawXcxx . . $ lastDrawX. = tmp32; |
| 2340 | |
| 2341 | // swap y |
| 2342 | tmp32 = lastDrawYcxx . . $ lastDrawY.; |
| 2343 | lastDrawYcxx . . $ lastDrawY. = vl; |
| 2344 | vl = tmp32; |
| 2345 | } |
| 2346 | |
| 2347 | int8_tcxx . . $ int8_t# *ptr8 = &songcxx . . $ song.->sampleDatacxx . . $ module_t#sampleData.[s->offsetcxx . . $ moduleSample_t#offset.]; |
| 2348 | |
| 2349 | int32_tcxx . . $ int32_t# start = p; |
| 2350 | if (start < 0) |
| 2351 | start = 0; |
| 2352 | |
| 2353 | int32_tcxx . . $ int32_t# end = lastDrawXcxx . . $ lastDrawX.+1; |
| 2354 | if (end > s->lengthcxx . . $ moduleSample_t#length.) |
| 2355 | end = s->lengthcxx . . $ moduleSample_t#length.; |
| 2356 | |
| 2357 | if (p == lastDrawXcxx . . $ lastDrawX.) |
| 2358 | { |
| 2359 | const int8_tcxx . . $ int8_t# smpVal = (int8_tcxx . . $ int8_t#)(vl ^ 0x80); |
| 2360 | for (int32_tcxx . . $ int32_t# i = start; i < end; i++) |
| 2361 | ptr8[i] = smpVal; |
| 2362 | } |
| 2363 | else |
| 2364 | { |
| 2365 | int32_tcxx . . $ int32_t# y = lastDrawYcxx . . $ lastDrawY. - vl; |
| 2366 | int32_tcxx . . $ int32_t# x = lastDrawXcxx . . $ lastDrawX. - p; |
| 2367 | |
| 2368 | if (x != 0) |
| 2369 | { |
| 2370 | double dMul = 1.0 / x; |
| 2371 | int32_tcxx . . $ int32_t# i = 0; |
| 2372 | |
| 2373 | for (int32_tcxx . . $ int32_t# rl = start; rl < end; rl++) |
| 2374 | { |
| 2375 | int32_tcxx . . $ int32_t# tvl = y * i; |
| 2376 | tvl = (int32_tcxx . . $ int32_t#)(tvl * dMul); // tvl /= x |
| 2377 | tvl += vl; |
| 2378 | tvl ^= 0x80; |
| 2379 | |
| 2380 | ptr8[rl] = (int8_tcxx . . $ int8_t#)tvl; |
| 2381 | i++; |
| 2382 | } |
| 2383 | } |
| 2384 | } |
| 2385 | |
| 2386 | lastDrawYcxx . . $ lastDrawY. = rvl; |
| 2387 | lastDrawXcxx . . $ lastDrawX. = r; |
| 2388 | |
| 2389 | displaySamplecxx . . $ displaySample(49f6e7a06ebc5aa8).(); |
| 2390 | } |
| 2391 | |
| 2392 | void samplerSamplePressedcxx . . $ samplerSamplePressed(b45ddcbc8423892c).(boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! mouseButtonHeld) |
| 2393 | { |
| 2394 | if (!mouseButtonHeld) |
| 2395 | { |
| 2396 | if (!editorcxx . . $ editor..sampleZerocxx . . $ editor_t#sampleZero. && mousecxx . . $ mouse..ycxx . . $ mouse_t#y. < 142) |
| 2397 | { |
| 2398 | if (mousecxx . . $ mouse..xcxx . . $ mouse_t#x. >= samplercxx . . $ sampler..loopStartPoscxx . . $ sampler_t#loopStartPos. && mousecxx . . $ mouse..xcxx . . $ mouse_t#x. <= samplercxx . . $ sampler..loopStartPoscxx . . $ sampler_t#loopStartPos.+3) |
| 2399 | { |
| 2400 | uicxx . . $ ui..leftLoopPinMovingcxx . . $ ui_t#leftLoopPinMoving. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 2401 | uicxx . . $ ui..rightLoopPinMovingcxx . . $ ui_t#rightLoopPinMoving. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 2402 | uicxx . . $ ui..sampleMarkingPoscxx . . $ ui_t#sampleMarkingPos. = 1; |
| 2403 | samplercxx . . $ sampler..lastMouseXcxx . . $ sampler_t#lastMouseX. = mousecxx . . $ mouse..xcxx . . $ mouse_t#x.; |
| 2404 | return; |
| 2405 | } |
| 2406 | else if (mousecxx . . $ mouse..xcxx . . $ mouse_t#x. >= samplercxx . . $ sampler..loopEndPoscxx . . $ sampler_t#loopEndPos.+3 && mousecxx . . $ mouse..xcxx . . $ mouse_t#x. <= samplercxx . . $ sampler..loopEndPoscxx . . $ sampler_t#loopEndPos.+6) |
| 2407 | { |
| 2408 | uicxx . . $ ui..rightLoopPinMovingcxx . . $ ui_t#rightLoopPinMoving. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 2409 | uicxx . . $ ui..leftLoopPinMovingcxx . . $ ui_t#leftLoopPinMoving. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 2410 | uicxx . . $ ui..sampleMarkingPoscxx . . $ ui_t#sampleMarkingPos. = 1; |
| 2411 | samplercxx . . $ sampler..lastMouseXcxx . . $ sampler_t#lastMouseX. = mousecxx . . $ mouse..xcxx . . $ mouse_t#x.; |
| 2412 | return; |
| 2413 | } |
| 2414 | } |
| 2415 | } |
| 2416 | |
| 2417 | int32_tcxx . . $ int32_t# mouseX = CLAMPcxx . . $ `src/pt2_helpers.h:36:9`!(mouse.x, 0, SCREEN_Wcxx . . $ `src/pt2_header.h:41:9`!+8); // allow some extra pixels outside of the screen |
| 2418 | |
| 2419 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(editor.currSample >= 0 && editor.currSample <= 30); |
| 2420 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 2421 | |
| 2422 | if (uicxx . . $ ui..leftLoopPinMovingcxx . . $ ui_t#leftLoopPinMoving.) |
| 2423 | { |
| 2424 | if (samplercxx . . $ sampler..lastMouseXcxx . . $ sampler_t#lastMouseX. != mouseX) |
| 2425 | { |
| 2426 | samplercxx . . $ sampler..lastMouseXcxx . . $ sampler_t#lastMouseX. = mouseX; |
| 2427 | |
| 2428 | int32_tcxx . . $ int32_t# tmpPos = (scr2SmpPoscxx . . $ scr2SmpPos(7864480464b09eea).(mouseX - 1) - s->loopStartcxx . . $ moduleSample_t#loopStart.) & ~1; |
| 2429 | if (tmpPos > configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.) |
| 2430 | tmpPos = configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength.; |
| 2431 | |
| 2432 | if (s->loopStartcxx . . $ moduleSample_t#loopStart.+tmpPos >= (s->loopStartcxx . . $ moduleSample_t#loopStart.+s->loopLengthcxx . . $ moduleSample_t#loopLength.)-2) |
| 2433 | { |
| 2434 | s->loopStartcxx . . $ moduleSample_t#loopStart. = (s->loopStartcxx . . $ moduleSample_t#loopStart. + s->loopLengthcxx . . $ moduleSample_t#loopLength.) - 2; |
| 2435 | s->loopLengthcxx . . $ moduleSample_t#loopLength. = 2; |
| 2436 | } |
| 2437 | else |
| 2438 | { |
| 2439 | s->loopStartcxx . . $ moduleSample_t#loopStart. = s->loopStartcxx . . $ moduleSample_t#loopStart. + tmpPos; |
| 2440 | |
| 2441 | if (s->loopLengthcxx . . $ moduleSample_t#loopLength.-tmpPos > 2) |
| 2442 | s->loopLengthcxx . . $ moduleSample_t#loopLength. -= tmpPos; |
| 2443 | else |
| 2444 | s->loopLengthcxx . . $ moduleSample_t#loopLength. = 2; |
| 2445 | } |
| 2446 | |
| 2447 | uicxx . . $ ui..updateCurrSampleRepeatcxx . . $ ui_t#updateCurrSampleRepeat. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 2448 | uicxx . . $ ui..updateCurrSampleReplencxx . . $ ui_t#updateCurrSampleReplen. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 2449 | |
| 2450 | setLoopSpritescxx . . $ setLoopSprites(49f6e7a06ebc5aa8).(); |
| 2451 | updatePaulaLoopscxx . . $ updatePaulaLoops(49f6e7a06ebc5aa8).(); |
| 2452 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 2453 | } |
| 2454 | |
| 2455 | return; |
| 2456 | } |
| 2457 | |
| 2458 | if (uicxx . . $ ui..rightLoopPinMovingcxx . . $ ui_t#rightLoopPinMoving.) |
| 2459 | { |
| 2460 | if (samplercxx . . $ sampler..lastMouseXcxx . . $ sampler_t#lastMouseX. != mouseX) |
| 2461 | { |
| 2462 | samplercxx . . $ sampler..lastMouseXcxx . . $ sampler_t#lastMouseX. = mouseX; |
| 2463 | |
| 2464 | s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 2465 | |
| 2466 | int32_tcxx . . $ int32_t# tmpPos = (scr2SmpPoscxx . . $ scr2SmpPos(7864480464b09eea).(mouseX - 4) - s->loopStartcxx . . $ moduleSample_t#loopStart.) & ~1; |
| 2467 | tmpPos = CLAMPcxx . . $ `src/pt2_helpers.h:36:9`!(tmpPos, 2, config.maxSampleLength); |
| 2468 | |
| 2469 | s->loopLengthcxx . . $ moduleSample_t#loopLength. = tmpPos; |
| 2470 | |
| 2471 | uicxx . . $ ui..updateCurrSampleRepeatcxx . . $ ui_t#updateCurrSampleRepeat. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 2472 | uicxx . . $ ui..updateCurrSampleReplencxx . . $ ui_t#updateCurrSampleReplen. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 2473 | |
| 2474 | setLoopSpritescxx . . $ setLoopSprites(49f6e7a06ebc5aa8).(); |
| 2475 | updatePaulaLoopscxx . . $ updatePaulaLoops(49f6e7a06ebc5aa8).(); |
| 2476 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 2477 | } |
| 2478 | |
| 2479 | return; |
| 2480 | } |
| 2481 | |
| 2482 | if (!mouseButtonHeld) |
| 2483 | { |
| 2484 | if (mouseX < 0 || mouseX >= SCREEN_Wcxx . . $ `src/pt2_header.h:41:9`!) |
| 2485 | return; |
| 2486 | |
| 2487 | uicxx . . $ ui..sampleMarkingPoscxx . . $ ui_t#sampleMarkingPos. = (int16_tcxx . . $ int16_t#)mouseX; |
| 2488 | samplercxx . . $ sampler..lastSamPoscxx . . $ sampler_t#lastSamPos. = uicxx . . $ ui..sampleMarkingPoscxx . . $ ui_t#sampleMarkingPos.; |
| 2489 | |
| 2490 | invertRangecxx . . $ invertRange(49f6e7a06ebc5aa8).(); |
| 2491 | if (s->lengthcxx . . $ moduleSample_t#length. == 0) |
| 2492 | { |
| 2493 | editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. = -1; // clear marking |
| 2494 | } |
| 2495 | else |
| 2496 | { |
| 2497 | editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. = scr2SmpPoscxx . . $ scr2SmpPos(7864480464b09eea).(uicxx . . $ ui..sampleMarkingPoscxx . . $ ui_t#sampleMarkingPos. - 3); |
| 2498 | editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs. = scr2SmpPoscxx . . $ scr2SmpPos(7864480464b09eea).(uicxx . . $ ui..sampleMarkingPoscxx . . $ ui_t#sampleMarkingPos. - 3); |
| 2499 | |
| 2500 | if (editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs. > s->lengthcxx . . $ moduleSample_t#length.) |
| 2501 | editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs. = s->lengthcxx . . $ moduleSample_t#length.; |
| 2502 | |
| 2503 | invertRangecxx . . $ invertRange(49f6e7a06ebc5aa8).(); |
| 2504 | } |
| 2505 | |
| 2506 | if (s->lengthcxx . . $ moduleSample_t#length. == 0) |
| 2507 | { |
| 2508 | editorcxx . . $ editor..samplePoscxx . . $ editor_t#samplePos. = 0; |
| 2509 | } |
| 2510 | else |
| 2511 | { |
| 2512 | int32_tcxx . . $ int32_t# tmpPos = scr2SmpPoscxx . . $ scr2SmpPos(7864480464b09eea).(mouseX - 3); |
| 2513 | if (tmpPos > s->lengthcxx . . $ moduleSample_t#length.) |
| 2514 | tmpPos = s->lengthcxx . . $ moduleSample_t#length.; |
| 2515 | |
| 2516 | editorcxx . . $ editor..samplePoscxx . . $ editor_t#samplePos. = tmpPos; |
| 2517 | } |
| 2518 | |
| 2519 | updateSamplePoscxx . . $ updateSamplePos(49f6e7a06ebc5aa8).(); |
| 2520 | |
| 2521 | return; |
| 2522 | } |
| 2523 | |
| 2524 | mouseX = CLAMPcxx . . $ `src/pt2_helpers.h:36:9`!(mouseX, 3, SCREEN_Wcxx . . $ `src/pt2_header.h:41:9`!); |
| 2525 | |
| 2526 | if (mouseX != samplercxx . . $ sampler..lastSamPoscxx . . $ sampler_t#lastSamPos.) |
| 2527 | { |
| 2528 | samplercxx . . $ sampler..lastSamPoscxx . . $ sampler_t#lastSamPos. = mouseX; |
| 2529 | |
| 2530 | invertRangecxx . . $ invertRange(49f6e7a06ebc5aa8).(); |
| 2531 | if (s->lengthcxx . . $ moduleSample_t#length. == 0) |
| 2532 | { |
| 2533 | editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. = -1; // clear marking |
| 2534 | } |
| 2535 | else |
| 2536 | { |
| 2537 | if (samplercxx . . $ sampler..lastSamPoscxx . . $ sampler_t#lastSamPos. > uicxx . . $ ui..sampleMarkingPoscxx . . $ ui_t#sampleMarkingPos.) |
| 2538 | { |
| 2539 | editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. = scr2SmpPoscxx . . $ scr2SmpPos(7864480464b09eea).(uicxx . . $ ui..sampleMarkingPoscxx . . $ ui_t#sampleMarkingPos. - 3); |
| 2540 | editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs. = scr2SmpPoscxx . . $ scr2SmpPos(7864480464b09eea).(samplercxx . . $ sampler..lastSamPoscxx . . $ sampler_t#lastSamPos. - 3); |
| 2541 | } |
| 2542 | else |
| 2543 | { |
| 2544 | editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. = scr2SmpPoscxx . . $ scr2SmpPos(7864480464b09eea).(samplercxx . . $ sampler..lastSamPoscxx . . $ sampler_t#lastSamPos. - 3); |
| 2545 | editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs. = scr2SmpPoscxx . . $ scr2SmpPos(7864480464b09eea).(uicxx . . $ ui..sampleMarkingPoscxx . . $ ui_t#sampleMarkingPos. - 3); |
| 2546 | } |
| 2547 | |
| 2548 | if (editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs. > s->lengthcxx . . $ moduleSample_t#length.) |
| 2549 | editorcxx . . $ editor..markEndOfscxx . . $ editor_t#markEndOfs. = s->lengthcxx . . $ moduleSample_t#length.; |
| 2550 | |
| 2551 | invertRangecxx . . $ invertRange(49f6e7a06ebc5aa8).(); |
| 2552 | } |
| 2553 | } |
| 2554 | |
| 2555 | if (s->lengthcxx . . $ moduleSample_t#length. == 0) |
| 2556 | { |
| 2557 | editorcxx . . $ editor..samplePoscxx . . $ editor_t#samplePos. = 0; |
| 2558 | } |
| 2559 | else |
| 2560 | { |
| 2561 | int32_tcxx . . $ int32_t# tmpPos = scr2SmpPoscxx . . $ scr2SmpPos(7864480464b09eea).(mouseX - 3); |
| 2562 | if (tmpPos > s->lengthcxx . . $ moduleSample_t#length.) |
| 2563 | tmpPos = s->lengthcxx . . $ moduleSample_t#length.; |
| 2564 | |
| 2565 | editorcxx . . $ editor..samplePoscxx . . $ editor_t#samplePos. = tmpPos; |
| 2566 | } |
| 2567 | |
| 2568 | updateSamplePoscxx . . $ updateSamplePos(49f6e7a06ebc5aa8).(); |
| 2569 | } |
| 2570 | |
| 2571 | void samplerLoopTogglecxx . . $ samplerLoopToggle(49f6e7a06ebc5aa8).(void) |
| 2572 | { |
| 2573 | if (editorcxx . . $ editor..sampleZerocxx . . $ editor_t#sampleZero.) |
| 2574 | { |
| 2575 | statusNotSampleZerocxx . . $ statusNotSampleZero(49f6e7a06ebc5aa8).(); |
| 2576 | return; |
| 2577 | } |
| 2578 | |
| 2579 | ASSERTcxx . . $ `src/pt2_header.h:25:9`!(editor.currSample >= 0 && editor.currSample <= 30); |
| 2580 | |
| 2581 | moduleSample_tcxx . . $ moduleSample_t# *s = &songcxx . . $ song.->samplescxx . . $ module_t#samples.[editorcxx . . $ editor..currSamplecxx . . $ editor_t#currSample.]; |
| 2582 | if (s->lengthcxx . . $ moduleSample_t#length. < 2) |
| 2583 | return; |
| 2584 | |
| 2585 | turnOffVoicescxx . . $ turnOffVoices(49f6e7a06ebc5aa8).(); |
| 2586 | |
| 2587 | if (s->loopStartcxx . . $ moduleSample_t#loopStart.+s->loopLengthcxx . . $ moduleSample_t#loopLength. > 2) |
| 2588 | { |
| 2589 | // disable loop |
| 2590 | |
| 2591 | samplercxx . . $ sampler..tmpLoopStartcxx . . $ sampler_t#tmpLoopStart. = s->loopStartcxx . . $ moduleSample_t#loopStart.; |
| 2592 | samplercxx . . $ sampler..tmpLoopLengthcxx . . $ sampler_t#tmpLoopLength. = s->loopLengthcxx . . $ moduleSample_t#loopLength.; |
| 2593 | |
| 2594 | s->loopStartcxx . . $ moduleSample_t#loopStart. = 0; |
| 2595 | s->loopLengthcxx . . $ moduleSample_t#loopLength. = 2; |
| 2596 | } |
| 2597 | else |
| 2598 | { |
| 2599 | // enable loop |
| 2600 | |
| 2601 | if (samplercxx . . $ sampler..tmpLoopStartcxx . . $ sampler_t#tmpLoopStart. == 0 && samplercxx . . $ sampler..tmpLoopLengthcxx . . $ sampler_t#tmpLoopLength. == 0) |
| 2602 | { |
| 2603 | s->loopStartcxx . . $ moduleSample_t#loopStart. = 0; |
| 2604 | s->loopLengthcxx . . $ moduleSample_t#loopLength. = s->lengthcxx . . $ moduleSample_t#length.; |
| 2605 | } |
| 2606 | else |
| 2607 | { |
| 2608 | s->loopStartcxx . . $ moduleSample_t#loopStart. = samplercxx . . $ sampler..tmpLoopStartcxx . . $ sampler_t#tmpLoopStart.; |
| 2609 | s->loopLengthcxx . . $ moduleSample_t#loopLength. = samplercxx . . $ sampler..tmpLoopLengthcxx . . $ sampler_t#tmpLoopLength.; |
| 2610 | |
| 2611 | if (s->loopStartcxx . . $ moduleSample_t#loopStart.+s->loopLengthcxx . . $ moduleSample_t#loopLength. > s->lengthcxx . . $ moduleSample_t#length.) |
| 2612 | { |
| 2613 | s->loopStartcxx . . $ moduleSample_t#loopStart. = 0; |
| 2614 | s->loopLengthcxx . . $ moduleSample_t#loopLength. = s->lengthcxx . . $ moduleSample_t#length.; |
| 2615 | } |
| 2616 | } |
| 2617 | } |
| 2618 | |
| 2619 | uicxx . . $ ui..updateCurrSampleRepeatcxx . . $ ui_t#updateCurrSampleRepeat. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 2620 | uicxx . . $ ui..updateCurrSampleReplencxx . . $ ui_t#updateCurrSampleReplen. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 2621 | |
| 2622 | displaySamplecxx . . $ displaySample(49f6e7a06ebc5aa8).(); |
| 2623 | updatePaulaLoopscxx . . $ updatePaulaLoops(49f6e7a06ebc5aa8).(); |
| 2624 | recalcChordLengthcxx . . $ recalcChordLength(49f6e7a06ebc5aa8).(); |
| 2625 | updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.); |
| 2626 | } |
| 2627 | |
| 2628 | void exitFromSamcxx . . $ exitFromSam(49f6e7a06ebc5aa8).(void) |
| 2629 | { |
| 2630 | uicxx . . $ ui..samplerScreenShowncxx . . $ ui_t#samplerScreenShown. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 2631 | memcpycxx . . $ memcpy(cc817cb175f282d).(&videocxx . . $ video..frameBuffercxx . . $ video_t#frameBuffer.[121 * SCREEN_Wcxx . . $ `src/pt2_header.h:41:9`!], &trackerFrameBMPcxx . . $ trackerFrameBMP.[121 * SCREEN_Wcxx . . $ `src/pt2_header.h:41:9`!], 320 * 134 * sizeof (int32_tcxx . . $ int32_t#)); |
| 2632 | |
| 2633 | updateCursorPoscxx . . $ updateCursorPos(49f6e7a06ebc5aa8).(); |
| 2634 | setLoopSpritescxx . . $ setLoopSprites(49f6e7a06ebc5aa8).(); |
| 2635 | |
| 2636 | uicxx . . $ ui..updateStatusTextcxx . . $ ui_t#updateStatusText. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 2637 | uicxx . . $ ui..updateSongSizecxx . . $ ui_t#updateSongSize. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 2638 | uicxx . . $ ui..updateSongTimingcxx . . $ ui_t#updateSongTiming. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 2639 | uicxx . . $ ui..updateSongBPMcxx . . $ ui_t#updateSongBPM. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 2640 | uicxx . . $ ui..updateCurrPattTextcxx . . $ ui_t#updateCurrPattText. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 2641 | uicxx . . $ ui..updatePatternDatacxx . . $ ui_t#updatePatternData. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 2642 | |
| 2643 | editorcxx . . $ editor..markStartOfscxx . . $ editor_t#markStartOfs. = -1; |
| 2644 | } |
| 2645 | |
| 2646 | void samplerScreencxx . . $ samplerScreen(49f6e7a06ebc5aa8).(void) |
| 2647 | { |
| 2648 | if (uicxx . . $ ui..samplerScreenShowncxx . . $ ui_t#samplerScreenShown.) |
| 2649 | { |
| 2650 | exitFromSamcxx . . $ exitFromSam(49f6e7a06ebc5aa8).(); |
| 2651 | return; |
| 2652 | } |
| 2653 | |
| 2654 | uicxx . . $ ui..samplerScreenShowncxx . . $ ui_t#samplerScreenShown. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 2655 | memcpycxx . . $ memcpy(cc817cb175f282d).(&videocxx . . $ video..frameBuffercxx . . $ video_t#frameBuffer.[(121 * SCREEN_Wcxx . . $ `src/pt2_header.h:41:9`!)], samplerScreenBMPcxx . . $ samplerScreenBMP., 320 * 134 * sizeof (int32_tcxx . . $ int32_t#)); |
| 2656 | hideSpritecxx . . $ hideSprite(d4f767463ce0a6b3).(SPRITE_PATTERN_CURSORcxx . . $ SPRITE_PATTERN_CURSOR.); |
| 2657 | |
| 2658 | uicxx . . $ ui..updateStatusTextcxx . . $ ui_t#updateStatusText. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 2659 | uicxx . . $ ui..updateSongSizecxx . . $ ui_t#updateSongSize. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 2660 | uicxx . . $ ui..updateSongTimingcxx . . $ ui_t#updateSongTiming. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 2661 | uicxx . . $ ui..updateResampleNotecxx . . $ ui_t#updateResampleNote. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 2662 | uicxx . . $ ui..update9xxPoscxx . . $ ui_t#update9xxPos. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 2663 | |
| 2664 | redrawSamplecxx . . $ redrawSample(49f6e7a06ebc5aa8).(); |
| 2665 | } |
| 2666 | |
| 2667 | void drawSamplerLinecxx . . $ drawSamplerLine(49f6e7a06ebc5aa8).(void) |
| 2668 | { |
| 2669 | hideSpritecxx . . $ hideSprite(d4f767463ce0a6b3).(SPRITE_SAMPLING_POS_LINEcxx . . $ SPRITE_SAMPLING_POS_LINE.); |
| 2670 | if (!uicxx . . $ ui..samplerScreenShowncxx . . $ ui_t#samplerScreenShown. || uicxx . . $ ui..samplerVolBoxShowncxx . . $ ui_t#samplerVolBoxShown. || uicxx . . $ ui..samplerFiltersBoxShowncxx . . $ ui_t#samplerFiltersBoxShown.) |
| 2671 | return; |
| 2672 | |
| 2673 | for (int32_tcxx . . $ int32_t# ch = 0; ch < PAULA_VOICEScxx . . $ `src/pt2_paula.h:13:9`!; ch++) |
| 2674 | { |
| 2675 | int32_tcxx . . $ int32_t# pos = getSampleReadPoscxx . . $ getSampleReadPos(7864480464b09eea).(ch); |
| 2676 | if (pos >= 0) |
| 2677 | { |
| 2678 | pos = 3 + smpPos2Scrcxx . . $ smpPos2Scr(7864480464b09eea).(pos); |
| 2679 | if (pos >= 3 && pos <= 316) |
| 2680 | setSpritePoscxx . . $ setSpritePos(b1146eedae1e1d0b).(SPRITE_SAMPLING_POS_LINEcxx . . $ SPRITE_SAMPLING_POS_LINE., pos, 138); |
| 2681 | } |
| 2682 | } |
| 2683 | } |