mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-01 11:06:30 -04:00
Improved audio beep tone (#2014)
* Improved sine wave beep tone * Prevent divide-by-zero
This commit is contained in:
parent
308573918c
commit
807c76346b
2 changed files with 26 additions and 2 deletions
|
@ -27,6 +27,7 @@
|
|||
// Functions for audio beep (used by Sonde RSSI)
|
||||
void ToneGen::configure_beep(const uint32_t freq, const uint32_t sample_rate) {
|
||||
f_delta_ = (float)(freq * sizeof(sine_table_i8)) / sample_rate;
|
||||
f_tone_phase_ = 0.0;
|
||||
}
|
||||
|
||||
int16_t ToneGen::process_beep() {
|
||||
|
@ -44,6 +45,7 @@ int16_t ToneGen::process_beep() {
|
|||
|
||||
void ToneGen::configure(const uint32_t delta, const float tone_mix_weight) {
|
||||
delta_ = delta;
|
||||
tone_phase_ = 0;
|
||||
tone_mix_weight_ = tone_mix_weight;
|
||||
input_mix_weight_ = 1.0 - tone_mix_weight;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue