SpectMorph

lib/smsinedecoder.hh

00001 /* 
00002  * Copyright (C) 2009-2010 Stefan Westerfeld
00003  *
00004  * This library is free software; you can redistribute it and/or modify it
00005  * under the terms of the GNU Lesser General Public License as published by the
00006  * Free Software Foundation; either version 3 of the License, or (at your
00007  * option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful, but WITHOUT
00010  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
00012  * for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public License
00015  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 
00019 #ifndef SPECTMORPH_SINEDECODER_HH
00020 #define SPECTMORPH_SINEDECODER_HH
00021 
00022 #include "smifftsynth.hh"
00023 #include "smaudio.hh"
00024 #include <vector>
00025 
00026 namespace SpectMorph {
00027 
00034 class SineDecoder
00035 {
00036 public:
00040   enum Mode {
00045     MODE_PHASE_SYNC_OVERLAP,
00050     MODE_PHASE_SYNC_OVERLAP_IFFT,
00056     MODE_TRACKING
00057   };
00058 private:
00059   double mix_freq;
00060   size_t frame_size;
00061   size_t frame_step;
00062   std::vector<double> synth_fixed_phase, next_synth_fixed_phase;
00063   Mode mode;
00064   SpectMorph::IFFTSynth *ifft_synth;
00065 
00066 public:
00067   SineDecoder (double mix_freq, size_t frame_size, size_t frame_step, Mode mode);
00068   ~SineDecoder();
00069 
00070   void process (const AudioBlock& block,
00071                 const AudioBlock& next_block,
00072                 const std::vector<double>& window,
00073                 std::vector<float>& decoded_sines);
00074 };
00075 
00076 }
00077 #endif
 All Classes Functions Variables Enumerations Enumerator