Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | QonDonion |
so
void Oscillator::genSine() {
float interval = Oscillator::freq / Oscillator::stream.get_mix_rate();
int left = Oscillator::waveData.size();
int i = 0;
for (int i = 0; i < left; i++) {
Oscillator::waveData[i][0] = sin((Oscillator::waveTime)*Math_TAU);
Oscillator::waveData[i][1] = sin((Oscillator::waveTime)*Math_TAU);
Oscillator::waveTime = fmod(Oscillator::waveTime + interval, 1.0);
i++;
}
uh huh
and then
//in a thread
void Oscillator::writeWave() {
while (1) {
int emptys = Oscillator::playback->get_frames_available();
while (emptys > 0) {
Oscillator::waveDataIndex = Oscillator::waveDataIndex % Oscillator::waveData.size();
if (Oscillator::waveDataIndex == 0) {
genSine();
}
Oscillator::playback->push_frame(Vector2(Oscillator::waveData[Oscillator::waveDataIndex][0], Oscillator::waveData[Oscillator::waveDataIndex][1]));
emptys -= 1;
Oscillator::waveDataIndex++;
}
}
}
so why does it do this?
[ Screenshot_75.png - Google Drive ]
i wanted sine not sigh
am i shtupid <:(
EDITS:
edit1:
look at this nasties (???)
[ Screenshot_76.png - Google Drive ]
sigh, seentooth, and swear
edit2:
please help :(((
edit3:
even though the freq is different, the amonolies still lines up
[ Screenshot_77.png - Google Drive ]
writeWave error
edit4:
damg it odfino i’m peepoo brained
actually i feel like i make more mistakes than ever before!!! (ecstatic!)
you know
the i++
the thing in genSine
y- yo- you you know???
when the i
i the var
haha…
is…
i++ in for (int i = 0; i < left; i++)
and then a-again??? yes, again???
in the for loop???
beloww… Oscillator::waveTime = fmod(Oscillator::waveTime + interval, 1.0);???
kaskml why…
ow…