History

Tiny cleanup

Olav Sørensen committed 3 years ago

Commit 4f81f151 parent 17448352 files · +5 −12Browse files

Showing the changes to src (2 of 2 files). Show all

Unified · Split

2 files
  1. src/modloaders/pt2_load_mod15.c +5 −9
  2. src/modloaders/pt2_load_mod31.c +0 −3
src/modloaders/pt2_load_mod15.c+5−9
@@ -49,7 +49,7 @@ module_t *loadMod15(uint8_t *buffer, uint32_t filesize) · 48 unmodified lines
49 if (s->length > 9999)49 if (s->length > 9999)
50 lateSTKVerFlag = true;50 lateSTKVerFlag = true;
51 51
52 p++; // Hi-byte of volume, no finetune in STK/UST modules. Skip it.52 p++; // hi-byte of volume, no finetune in STK/UST modules. Skip it.
53 s->volume = *p++;53 s->volume = *p++;
54 54
55 // in The Ultimate SoundTracker, sample loop start is in bytes, not words55 // in The Ultimate SoundTracker, sample loop start is in bytes, not words
@@ -89,10 +89,9 @@ module_t *loadMod15(uint8_t *buffer, uint32_t filesize) · 33 unmodified lines
89 // convert UST tempo to BPM89 // convert UST tempo to BPM
90 uint16_t ciaPeriod = (240 - initTempo) * 122;90 uint16_t ciaPeriod = (240 - initTempo) * 122;
91 91
92 double dHz = (double)CIA_PAL_CLK / (ciaPeriod+1); // +1, CIA triggers on underflow92 const double dHz = (double)CIA_PAL_CLK / (ciaPeriod+1); // +1, CIA triggers on underflow
93 int32_t BPM = (int32_t)((dHz * (125.0 / 50.0)) + 0.5);
94 93
95 m->header.initialTempo = (uint16_t)BPM;94 m->header.initialTempo = (uint16_t)((dHz * (125.0 / 50.0)) + 0.5);
96 }95 }
97 96
98 // read orders and count number of patterns97 // read orders and count number of patterns
@@ -221,7 +220,7 @@ module_t *loadMod15(uint8_t *buffer, uint32_t filesize) · 122 unmodified lines
221 s = m->samples;220 s = m->samples;
222 for (int32_t i = 0; i < 15; i++, s++)221 for (int32_t i = 0; i < 15; i++, s++)
223 {222 {
224 // For Ultimate SoundTracker modules, only the loop area of a looped sample is played.223 // for Ultimate SoundTracker modules, only the loop area of a looped sample is played.
225 if (s->loopStart > 0 && s->loopLength < s->length)224 if (s->loopStart > 0 && s->loopLength < s->length)
226 {225 {
227 s->length -= s->loopStart;226 s->length -= s->loopStart;
@@ -229,14 +228,11 @@ module_t *loadMod15(uint8_t *buffer, uint32_t filesize) · 1 unmodified line
229 s->loopStart = 0;228 s->loopStart = 0;
230 }229 }
231 230
232 /* We don't support loading samples bigger than 65534 bytes in our PT2 clone,
233 ** so skip overflown data in .MOD file if present.
234 */
235 int32_t bytesToSkip = 0;231 int32_t bytesToSkip = 0;
236 if (realSampleLengths[i] > config.maxSampleLength)232 if (realSampleLengths[i] > config.maxSampleLength)
237 bytesToSkip = realSampleLengths[i] - config.maxSampleLength;233 bytesToSkip = realSampleLengths[i] - config.maxSampleLength;
238 234
239 // For Ultimate SoundTracker modules, don't load sample data after loop end235 // for Ultimate SoundTracker modules, don't load sample data after loop end
240 int32_t loopEnd = s->loopStart + s->loopLength;236 int32_t loopEnd = s->loopStart + s->loopLength;
241 if (loopEnd > 2 && s->length > loopEnd)237 if (loopEnd > 2 && s->length > loopEnd)
242 {238 {
src/modloaders/pt2_load_mod31.c+0−3
@@ -178,9 +178,6 @@ module_t *loadMod31(uint8_t *buffer, uint32_t filesize) · 177 unmodified lines
178 s = m->samples;178 s = m->samples;
179 for (int32_t i = 0; i < MOD_SAMPLES; i++, s++)179 for (int32_t i = 0; i < MOD_SAMPLES; i++, s++)
180 {180 {
181 /* We don't support loading samples bigger than 65534 bytes in our PT2 clone,
182 ** so skip overflown data in .MOD file if present.
183 */
184 int32_t bytesToSkip = 0;181 int32_t bytesToSkip = 0;
185 if (realSampleLengths[i] > config.maxSampleLength)182 if (realSampleLengths[i] > config.maxSampleLength)
186 bytesToSkip = realSampleLengths[i] - config.maxSampleLength;183 bytesToSkip = realSampleLengths[i] - config.maxSampleLength;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t