1 // Licensed GNU LGPL v3 or later: http://www.gnu.org/licenses/lgpl.html 2 3 #ifndef SPECTMORPH_MORPH_UTILS_HH 4 #define SPECTMORPH_MORPH_UTILS_HH 5 6 #include <algorithm> 7 #include <vector> 8 #include <stdint.h> 9 10 #include "smaudio.hh" 11 #include "smlivedecoder.hh" 12 13 namespace SpectMorph 14 { 15 16 namespace MorphUtils 17 { 18 19 struct FreqState 20 { 21 float freq_f; 22 int used; 23 }; 24 25 bool find_match (float freq, const FreqState *freq_state, size_t freq_state_size, size_t *index); 26 void init_freq_state (const std::vector<uint16_t>& fint, FreqState *freq_state); 27 28 AudioBlock* get_normalized_block_ptr (LiveDecoderSource *source, double time_ms); 29 bool get_normalized_block (LiveDecoderSource *source, double time_ms, AudioBlock& out_audio_block); 30 31 } 32 33 } 34 35 #endif 36