Files
qmk/quantum/audio/voices.h
T

70 lines
2.0 KiB
C
Raw Normal View History

2017-03-28 15:20:36 -07:00
/* Copyright 2016 Jack Humbert
2021-02-14 14:40:38 -08:00
* Copyright 2020 JohSchneider
2017-03-28 15:20:36 -07:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
2016-04-21 00:37:45 -04:00
#include <stdint.h>
#include <stdbool.h>
2017-09-29 16:17:30 -07:00
#if defined(__AVR__)
2019-08-30 11:19:03 -07:00
# include <avr/io.h>
2017-09-29 16:17:30 -07:00
#endif
#include "wait.h"
2016-05-03 12:56:40 -05:00
#include "luts.h"
2016-04-21 00:37:45 -04:00
float voice_envelope(float frequency);
typedef enum {
2016-04-21 00:40:00 -04:00
default_voice,
#ifdef AUDIO_VOICES
2021-02-14 14:40:38 -08:00
vibrating,
2016-12-12 15:39:07 -05:00
something,
2016-12-19 11:18:18 -05:00
drums,
2016-04-21 00:40:00 -04:00
butts_fader,
octave_crunch,
duty_osc,
2016-04-21 23:10:47 -04:00
duty_octave_down,
2016-04-26 01:16:47 -04:00
delayed_vibrato,
2019-08-30 11:19:03 -07:00
// delayed_vibrato_octave,
// duty_fifth_down,
// duty_fourth_down,
// duty_third_down,
// duty_fifth_third_down,
#endif
2019-08-30 11:19:03 -07:00
number_of_voices // important that this is last
2016-04-21 00:37:45 -04:00
} voice_type;
void set_voice(voice_type v);
2016-04-22 00:01:38 -05:00
void voice_iterate(void);
void voice_deiterate(void);
2021-02-14 14:40:38 -08:00
// Vibrato functions
void voice_set_vibrato_rate(float rate);
void voice_increase_vibrato_rate(float change);
void voice_decrease_vibrato_rate(float change);
void voice_set_vibrato_strength(float strength);
void voice_increase_vibrato_strength(float change);
void voice_decrease_vibrato_strength(float change);
// Timbre functions
/**
* @brief set the global timbre for tones to be played
* @note: only applies to pwm implementations - where it adjusts the duty-cycle
* @note: using any instrument from voices.[ch] other than 'default' may override the set value
* @param[in]: timbre: valid range is (0,100)
*/
void voice_set_timbre(uint8_t timbre);
uint8_t voice_get_timbre(void);