Commit 496ee5b02a58fd1f2743cf88e0424a79d9299490
Fixed crash from using un-initialized data in voice. Now replaced with click at start of song.
anonymous authored on 1/2/2016, 12:02:17 PMChristopher Snowhill committed on 6/13/2018, 12:10:58 AM
Parent: 35be14a0dc3813bc918cb0d5b0f62f224b88f6af
Files changed
src/syntrax/syntrax.c | changed |
src/syntrax/syntrax.c | ||
---|---|---|
@@ -8,8 +8,21 @@ | ||
8 | 8 | |
9 | 9 | |
10 | 10 | |
11 | 11 | |
12 | + | |
13 | +static int initVoice(Voice *v) | |
14 | +{ | |
15 | + memset(v, 0, sizeof(Voice)); | |
16 | + //v-> | |
17 | + | |
18 | + v->resampler[0] = resampler_create(); | |
19 | + v->resampler[1] = resampler_create(); | |
20 | + if (!v->resampler[0] || !v->resampler[1]) return 0; | |
21 | + | |
22 | + return 1; | |
23 | +} | |
24 | + | |
12 | 25 | static void reset(Player *p) |
13 | 26 | { |
14 | 27 | int i, j; |
15 | 28 | |
@@ -179,11 +192,10 @@ | ||
179 | 192 | if (!p->voices) goto FAIL; |
180 | 193 | |
181 | 194 | for (i = 0; i < SE_MAXCHANS; i++) |
182 | 195 | { |
183 | - p->voices[i].resampler[0] = resampler_create(); | |
184 | - p->voices[i].resampler[1] = resampler_create(); | |
185 | - if (!p->voices[i].resampler[0] || !p->voices[i].resampler[1]) goto FAIL; | |
196 | + //clear the damned thing up before using it | |
197 | + if (!initVoice(&p->voices[i])) goto FAIL; | |
186 | 198 | } |
187 | 199 | |
188 | 200 | reset(p); |
189 | 201 | |
@@ -1764,9 +1776,9 @@ | ||
1764 | 1776 | |
1765 | 1777 | for (i=0; i < p->channelNumber; ++i ) |
1766 | 1778 | { |
1767 | 1779 | v = &p->voices[i]; tc = &p->tuneChannels[i]; |
1768 | - | |
1780 | + | |
1769 | 1781 | insNum = tc->insNum; |
1770 | 1782 | if ( insNum == -1 ) |
1771 | 1783 | { |
1772 | 1784 | v->waveBuff = p->silentBuffer; |
Built with git-ssb-web