Organya Decoder: Fix up some lambda functions
Change the variable capture of two lambda functions, in one case to silence a warning about deprecation of capturing `this`. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
6211ff6ef4
commit
6b047c0acf
1 changed files with 2 additions and 2 deletions
|
@ -104,7 +104,7 @@ namespace Organya {
|
||||||
auto& c = carrier, &f = frequency, &a = amplitude;
|
auto& c = carrier, &f = frequency, &a = amplitude;
|
||||||
double mainpos = c.offset, maindelta = 256*c.pitch/nsamples;
|
double mainpos = c.offset, maindelta = 256*c.pitch/nsamples;
|
||||||
for(size_t i=0; i<result.size(); ++i) {
|
for(size_t i=0; i<result.size(); ++i) {
|
||||||
auto s = [=](double p=1) { return 256*p*i/nsamples; };
|
auto s = [this,i](double p=1) { return 256*p*i/nsamples; };
|
||||||
// Take sample from each of the three signal generators:
|
// Take sample from each of the three signal generators:
|
||||||
int freqval = f.wave[0xFF & int(f.offset + s(f.pitch))] * f.level;
|
int freqval = f.wave[0xFF & int(f.offset + s(f.pitch))] * f.level;
|
||||||
int ampval = a.wave[0xFF & int(a.offset + s(a.pitch))] * a.level;
|
int ampval = a.wave[0xFF & int(a.offset + s(a.pitch))] * a.level;
|
||||||
|
@ -121,7 +121,7 @@ namespace Organya {
|
||||||
void Load(FILE* fp) { // Load PXT file from disk and initialize synthesizer.
|
void Load(FILE* fp) { // Load PXT file from disk and initialize synthesizer.
|
||||||
/* C++11 simplifies things by a great deal. */
|
/* C++11 simplifies things by a great deal. */
|
||||||
/* This function would be a lot more complex without it. */
|
/* This function would be a lot more complex without it. */
|
||||||
auto f = [=](){ return (int) fgetv(fp); };
|
auto f = [fp](){ return (int) fgetv(fp); };
|
||||||
for(auto&c: channels)
|
for(auto&c: channels)
|
||||||
c = { f() != 0, f(), // enabled, length
|
c = { f() != 0, f(), // enabled, length
|
||||||
{ Waveforms[f()%6], fgetv(fp), f(), f() }, // carrier wave
|
{ Waveforms[f()%6], fgetv(fp), f(), f() }, // carrier wave
|
||||||
|
|
Loading…
Reference in a new issue