00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef SPECTMORPH_NOISE_DECODER_HH
00020 #define SPECTMORPH_NOISE_DECODER_HH
00021
00022 #include "smrandom.hh"
00023 #include "smnoisebandpartition.hh"
00024 #include "smaudio.hh"
00025
00026 namespace SpectMorph
00027 {
00028
00032 class NoiseDecoder
00033 {
00034 double orig_mix_freq;
00035 double mix_freq;
00036 size_t block_size;
00037
00038 float *cos_window;
00039
00040 Random random_gen;
00041 NoiseBandPartition *noise_band_partition;
00042
00043 void apply_window (float *spectrum, float *fft_buffer);
00044
00045 public:
00046 NoiseDecoder (double orig_mix_freq,
00047 double mix_freq,
00048 size_t block_size);
00049 ~NoiseDecoder();
00050
00051 enum OutputMode { REPLACE, ADD, FFT_SPECTRUM, DEBUG_UNWINDOWED, DEBUG_NO_OUTPUT };
00052
00053 void set_seed (int seed);
00054 void process (const AudioBlock& audio_block,
00055 float *samples,
00056 OutputMode output_mode = REPLACE);
00057
00058 static size_t preferred_block_size (double mix_freq);
00059 };
00060
00061 }
00062
00063 #endif