Skip to content

Commit

Permalink
Implement sawtooth wave
Browse files Browse the repository at this point in the history
  • Loading branch information
aceiii committed Apr 25, 2024
1 parent 321a0cd commit 6f395d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static inline float triangle_wave(float idx) {
}

static inline float sawtooth_wave(float idx) {
return 0;
return std::abs(fmod(idx * 2, 1.0f)) * 2 - 1;
}

void WaveGeneratorSource::gen_sound_data(bool play_sound, short buffer[], size_t buffer_size) {
Expand Down

0 comments on commit 6f395d3

Please sign in to comment.