SpectMorph
|
00001 /* 00002 * Copyright (C) 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_LPC_ZTRANS_HH 00020 #define SPECTMORPH_LPC_ZTRANS_HH 00021 00022 #include <complex> 00023 #include <vector> 00024 #include <gdk-pixbuf/gdk-pixbuf.h> 00025 #include "smlpc.hh" 00026 00027 namespace SpectMorph 00028 { 00029 00030 struct LPCZFunction 00031 { 00032 virtual double eval (std::complex<double> z) const = 0; 00033 }; 00034 00035 struct LPCZFunctionLPC : public LPCZFunction 00036 { 00037 std::vector<double> a; 00038 00039 LPCZFunctionLPC (const std::vector<double>& a) 00040 : a (a) 00041 { 00042 } 00043 double 00044 eval (std::complex<double> z) const 00045 { 00046 return LPC::eval_z (a, z); 00047 } 00048 }; 00049 00050 00051 GdkPixbuf *lpc_z_transform (const LPCZFunction& zfunc, const std::vector< std::complex<double> >& roots); 00052 GdkPixbuf *lpc_z_transform (const std::vector<double>& a, const std::vector< std::complex<double> >& roots); 00053 00054 } 00055 00056 #endif