git ssb

0+

kode54 / syntrax-c



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 PM
Christopher Snowhill committed on 6/13/2018, 12:10:58 AM
Parent: 35be14a0dc3813bc918cb0d5b0f62f224b88f6af

Files changed

src/syntrax/syntrax.cchanged
src/syntrax/syntrax.cView
@@ -8,8 +8,21 @@
88 #include "syntrax.h"
99 #include "file.h"
1010 #include "resampler.h"
1111
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+
1225 static void reset(Player *p)
1326 {
1427 int i, j;
1528
@@ -179,11 +192,10 @@
179192 if (!p->voices) goto FAIL;
180193
181194 for (i = 0; i < SE_MAXCHANS; i++)
182195 {
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;
186198 }
187199
188200 reset(p);
189201
@@ -1764,9 +1776,9 @@
17641776
17651777 for (i=0; i < p->channelNumber; ++i )
17661778 {
17671779 v = &p->voices[i]; tc = &p->tuneChannels[i];
1768-
1780+
17691781 insNum = tc->insNum;
17701782 if ( insNum == -1 )
17711783 {
17721784 v->waveBuff = p->silentBuffer;

Built with git-ssb-web