Mercurial > hg > wabletios
comparison scanpath.mm @ 13:426d645d8e69
Changed max min audio, saving now saves rest lump positions.
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Wed, 26 Jun 2013 17:23:30 +0100 |
parents | 0e03760cf2d9 |
children | 4ba81a12b008 |
comparison
equal
deleted
inserted
replaced
12:5bf377b4c780 | 13:426d645d8e69 |
---|---|
293 } | 293 } |
294 | 294 |
295 double sample = (1 - frameInterpolator)*oldsample + frameInterpolator*newsample; | 295 double sample = (1 - frameInterpolator)*oldsample + frameInterpolator*newsample; |
296 //cout << sample << endl; | 296 //cout << sample << endl; |
297 // keep within the bounds of acceptability | 297 // keep within the bounds of acceptability |
298 sample = sample*3.0; | |
299 | |
298 if(sample > 0.99){ | 300 if(sample > 0.99){ |
299 // cout << "OUCH\n"; | 301 cout << "BIG" << endl; |
302 | |
300 sample = 0.99; | 303 sample = 0.99; |
301 }else if(sample < -0.99){ | 304 }else if(sample < -0.0){ |
302 sample = -0.99; | 305 cout << "SMALL" << endl; |
306 sample = 0.0; | |
303 } | 307 } |
304 return sample; | 308 return sample; |
305 | 309 |
306 } | 310 } |
307 //---------------------------------------------------------------- | 311 //---------------------------------------------------------------- |
308 // get next sample | 312 // get next sample: just one sample at a time at sample rate |
309 double ScanPath::getNextSample(){ | 313 double ScanPath::getNextSample(){ |
310 // move along wavetable, no interpolation ie: length of path is pitch | 314 // move along wavetable, no interpolation ie: length of path is pitch |
311 static int n = 0; | 315 static int n = 0; |
312 double oldsample = wavetableOld[n]; | 316 double oldsample = wavetableOld[n]; |
313 | 317 |
322 //cout << "frame interp > 1\n"; | 326 //cout << "frame interp > 1\n"; |
323 frameInterpolator = 1.0; // just stays outputting new | 327 frameInterpolator = 1.0; // just stays outputting new |
324 } | 328 } |
325 | 329 |
326 double sample = (1 - frameInterpolator)*oldsample + frameInterpolator*newsample; | 330 double sample = (1 - frameInterpolator)*oldsample + frameInterpolator*newsample; |
327 return sample*3.0; | 331 // beef up |
332 sample = sample*10.0; | |
333 | |
334 if(sample > 0.99){ | |
335 cout << "BIG" << endl; | |
336 | |
337 sample = 0.99; | |
338 }else if(sample < -0.0){ | |
339 cout << "SMALL" << endl; | |
340 sample = 0.0; | |
341 } | |
328 | 342 |
329 } | 343 } |
330 //---------------------------------------------------------------- | 344 //---------------------------------------------------------------- |
331 //---------------------------------------------------------------- | 345 //---------------------------------------------------------------- |
332 // get next sample with cubic interpolation | 346 // get next sample with cubic interpolation |
393 double sample = (1 - frameInterpolator)*oldsample + frameInterpolator*newsample; | 407 double sample = (1 - frameInterpolator)*oldsample + frameInterpolator*newsample; |
394 //cout << sample << endl; | 408 //cout << sample << endl; |
395 // keep within the bounds of acceptability | 409 // keep within the bounds of acceptability |
396 | 410 |
397 // beef up | 411 // beef up |
398 sample = sample*3.0; | 412 sample = sample*10.0; |
399 | 413 |
400 if(sample > 0.99){ | 414 if(sample > 0.99){ |
415 cout << "BIG" << endl; | |
416 | |
401 sample = 0.99; | 417 sample = 0.99; |
402 }else if(sample < -0.99){ | 418 }else if(sample < -0.0){ |
403 sample = -0.99; | 419 cout << "SMALL" << endl; |
420 sample = 0.0; | |
404 } | 421 } |
405 | 422 |
406 return sample; | 423 return sample; |
407 | 424 |
408 } | 425 } |