Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv5659 Modified Files: acorr.cc c2mpir.cc excite.cc fft.cc fftr.cc freqt.cc gnorm.cc ifft.cc ignorm.cc input_source_from_stream.cc levdur.cc levinson_durbin_recursion.cc levinson_durbin_recursion.h lpc.cc lpc2c.cc lpc2lsp.cc lpc2par.cc ltcdf.cc mgc2mgc.cc mgc2sp.cc mseq.cc nan.cc nrand.cc poledf.cc sptk_utils.cc sptk_utils.h zerodf.cc Log Message: use getopt_long instead of getopt Index: mgc2mgc.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/mgc2mgc.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mgc2mgc.cc 23 Jan 2017 00:41:23 -0000 1.4 --- mgc2mgc.cc 15 Mar 2017 13:38:04 -0000 1.5 *************** *** 9,13 **** // Science and Engineering // // // ! // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // --- 9,13 ---- // Science and Engineering // // // ! // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // *************** *** 43,47 **** // ----------------------------------------------------------------- // ! #include <unistd.h> #include <fstream> #include <iostream> --- 43,47 ---- // ----------------------------------------------------------------- // ! #include <getopt.h> #include <fstream> #include <iostream> *************** *** 116,120 **** for (;;) { ! const char option_char(getopt(argc, argv, "m:a:g:c:nuM:A:G:C:NUh")); if (-1 == option_char) break; --- 116,121 ---- for (;;) { ! const int option_char( ! getopt_long(argc, argv, "m:a:g:c:nuM:A:G:C:NUh", NULL, NULL)); if (-1 == option_char) break; *************** *** 261,265 **** std::vector<double> transformed_generalized_cepstrum(output_length); ! while (sptk::ReadStream(false, input_length, &generalized_cepstrum, &input_stream)) { // input modification: 1+g*mgc[0] -> mgc[0] --- 262,266 ---- std::vector<double> transformed_generalized_cepstrum(output_length); ! while (sptk::ReadStream(false, 0, 0, input_length, &generalized_cepstrum, &input_stream)) { // input modification: 1+g*mgc[0] -> mgc[0] *************** *** 271,275 **** generalized_cepstrum, &transformed_generalized_cepstrum, &buffer)) { std::ostringstream error_message; ! error_message << "Failed to run the transform"; sptk::PrintErrorMessage("mgc2mgc", error_message); return 1; --- 272,276 ---- generalized_cepstrum, &transformed_generalized_cepstrum, &buffer)) { std::ostringstream error_message; ! error_message << "Failed to run generalized cepstral transformation"; sptk::PrintErrorMessage("mgc2mgc", error_message); return 1; *************** *** 280,287 **** *(transformed_generalized_cepstrum.begin()) * output_gamma + 1.0; // write results ! if (!sptk::WriteStream(output_length, transformed_generalized_cepstrum, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write an output sequence"; sptk::PrintErrorMessage("mgc2mgc", error_message); return 1; --- 281,288 ---- *(transformed_generalized_cepstrum.begin()) * output_gamma + 1.0; // write results ! if (!sptk::WriteStream(0, output_length, transformed_generalized_cepstrum, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write generalized cepstrum"; sptk::PrintErrorMessage("mgc2mgc", error_message); return 1; Index: lpc2par.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/lpc2par.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lpc2par.cc 2 Feb 2017 05:25:50 -0000 1.2 --- lpc2par.cc 15 Mar 2017 13:38:04 -0000 1.3 *************** *** 43,47 **** // ----------------------------------------------------------------- // ! #include <unistd.h> #include <fstream> #include <iostream> --- 43,47 ---- // ----------------------------------------------------------------- // ! #include <getopt.h> #include <fstream> #include <iostream> *************** *** 63,67 **** const int kDefaultNumOrder(25); const double kDefaultGamma(1.0); ! const int kDefaultBehaviorForUnstableCoefficient(kIgnore); void PrintUsage(std::ostream* stream) { --- 63,68 ---- const int kDefaultNumOrder(25); const double kDefaultGamma(1.0); ! const BehaviorForUnstableCoefficients kDefaultBehaviorForUnstableCoefficients( ! kIgnore); void PrintUsage(std::ostream* stream) { *************** *** 76,80 **** *stream << " -g g : gamma of generalized cepstrum [" << kDefaultGamma << "]" << std::endl; // NOLINT *stream << " -c c : gamma of generalized cepstrum = -1 / (int) c" << std::endl; // NOLINT ! *stream << " -e e : check whether the derived PARCOR [" << kDefaultBehaviorForUnstableCoefficient << "]" << std::endl; // NOLINT *stream << " coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; --- 77,81 ---- *stream << " -g g : gamma of generalized cepstrum [" << kDefaultGamma << "]" << std::endl; // NOLINT *stream << " -c c : gamma of generalized cepstrum = -1 / (int) c" << std::endl; // NOLINT ! *stream << " -e e : check whether the derived PARCOR [" << kDefaultBehaviorForUnstableCoefficients << "]" << std::endl; // NOLINT *stream << " coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; *************** *** 103,111 **** double gamma(kDefaultGamma); BehaviorForUnstableCoefficients behavior( ! static_cast<BehaviorForUnstableCoefficients>( ! kDefaultBehaviorForUnstableCoefficient)); for (;;) { ! const char option_char(getopt(argc, argv, "m:g:c:e:h")); if (-1 == option_char) break; --- 104,111 ---- double gamma(kDefaultGamma); BehaviorForUnstableCoefficients behavior( ! kDefaultBehaviorForUnstableCoefficients); for (;;) { ! const int option_char(getopt_long(argc, argv, "m:g:c:e:h", NULL, NULL)); if (-1 == option_char) break; *************** *** 198,202 **** for (int frame_index(0); sptk::ReadStream( ! false, length, &linear_predictive_coefficients, &input_stream); ++frame_index) { bool is_stable(false); --- 198,202 ---- for (int frame_index(0); sptk::ReadStream( ! false, 0, 0, length, &linear_predictive_coefficients, &input_stream); ++frame_index) { bool is_stable(false); *************** *** 218,222 **** } ! if (!sptk::WriteStream(length, parcor_coefficients, &std::cout)) { std::ostringstream error_message; error_message << "Failed to write PARCOR coefficients"; --- 218,222 ---- } ! if (!sptk::WriteStream(0, length, parcor_coefficients, &std::cout)) { std::ostringstream error_message; error_message << "Failed to write PARCOR coefficients"; Index: sptk_utils.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/sptk_utils.cc,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** sptk_utils.cc 26 Jan 2017 10:33:54 -0000 1.13 --- sptk_utils.cc 15 Mar 2017 13:38:04 -0000 1.14 *************** *** 9,13 **** // Science and Engineering // // // ! // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // --- 9,13 ---- // Science and Engineering // // // ! // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // *************** *** 45,61 **** #include "sptk_utils.h" ! #include <algorithm> // std::fill #include <cerrno> // errno, ERANGE #include <cmath> // std::ceil #include <cstdlib> // std::size_t, std::strtol. std::strtod ! namespace sptk { ! bool ReadStream(double* read_data, std::istream* input_stream) { ! if (NULL == read_data || NULL == input_stream) { ! return false; ! } ! if (input_stream->eof()) { return false; } --- 45,62 ---- #include "sptk_utils.h" ! #include <algorithm> // std::fill_n #include <cerrno> // errno, ERANGE #include <cmath> // std::ceil + #include <cstdint> // int8_t, etc. #include <cstdlib> // std::size_t, std::strtol. std::strtod ! #include "int24_t.h" ! #include "uint24_t.h" ! namespace sptk { ! template <typename T> ! bool ReadStream(T* read_data, std::istream* input_stream) { ! if (NULL == read_data || NULL == input_stream || input_stream->eof()) { return false; } *************** *** 67,92 **** } ! bool ReadStream(bool zero_padding, int read_size, ! std::vector<double>* sequence_to_read, std::istream* input_stream) { ! if (read_size <= 0 || NULL == sequence_to_read || NULL == input_stream) { return false; } ! if (input_stream->eof()) { ! return false; } ! if (sequence_to_read->size() < static_cast<std::size_t>(read_size)) { ! sequence_to_read->resize(read_size); } ! const int type_byte(sizeof((*sequence_to_read)[0])); ! const int num_bytes(type_byte * read_size); ! input_stream->read(reinterpret_cast<char*>(&((*sequence_to_read)[0])), ! num_bytes); const int gcount(input_stream->gcount()); ! if (num_bytes == gcount) { return !input_stream->fail(); } else if (zero_padding && 0 < gcount) { --- 68,99 ---- } ! template <typename T> ! bool ReadStream(bool zero_padding, int stream_skip, int read_point, ! int read_size, std::vector<T>* sequence_to_read, std::istream* input_stream) { ! if (stream_skip < 0 || read_point < 0 || read_size <= 0 || ! NULL == sequence_to_read || NULL == input_stream || input_stream->eof()) { return false; } ! const int type_byte(sizeof((*sequence_to_read)[0])); ! ! if (0 < stream_skip) { ! input_stream->ignore(type_byte * stream_skip); ! if (input_stream->eof()) return false; } ! const int end(read_point + read_size); ! if (sequence_to_read->size() < static_cast<std::size_t>(end)) { ! sequence_to_read->resize(end); } ! const int num_read_bytes(type_byte * read_size); ! input_stream->read( ! reinterpret_cast<char*>(&((*sequence_to_read)[0]) + read_point), ! num_read_bytes); const int gcount(input_stream->gcount()); ! if (num_read_bytes == gcount) { return !input_stream->fail(); } else if (zero_padding && 0 < gcount) { *************** *** 94,104 **** // as gcount may not be a multiple of sizeof(double). const int num_zeros( ! std::ceil(static_cast<double>(num_bytes - gcount) / type_byte)); if (num_zeros < 0) { return false; // Something wrong! } ! std::fill(sequence_to_read->end() - num_zeros, sequence_to_read->end(), ! 0.0); return !input_stream->bad(); --- 101,110 ---- // as gcount may not be a multiple of sizeof(double). const int num_zeros( ! std::ceil(static_cast<double>(num_read_bytes - gcount) / type_byte)); if (num_zeros < 0) { return false; // Something wrong! } ! std::fill_n(sequence_to_read->begin() + end - num_zeros, num_zeros, 0.0); return !input_stream->bad(); *************** *** 108,112 **** } ! bool WriteStream(double data_to_write, std::ostream* output_stream) { if (NULL == output_stream) { return false; --- 114,119 ---- } ! template <typename T> ! bool WriteStream(T data_to_write, std::ostream* output_stream) { if (NULL == output_stream) { return false; *************** *** 119,134 **** } ! bool WriteStream(int write_size, const std::vector<double>& sequence_to_write, ! std::ostream* output_stream) { ! return WriteStream(0, write_size, sequence_to_write, output_stream); ! } ! ! bool WriteStream(int begin, int end, ! const std::vector<double>& sequence_to_write, std::ostream* output_stream) { ! if (begin < 0 || end <= begin || NULL == output_stream) { return false; } if (sequence_to_write.size() < static_cast<std::size_t>(end)) { return false; --- 126,138 ---- } ! template <typename T> ! bool WriteStream(int write_point, int write_size, ! const std::vector<T>& sequence_to_write, std::ostream* output_stream) { ! if (write_point < 0 || write_size <= 0 || NULL == output_stream) { return false; } + const int end(write_point + write_size); if (sequence_to_write.size() < static_cast<std::size_t>(end)) { return false; *************** *** 136,141 **** output_stream->write( ! reinterpret_cast<const char*>(&(sequence_to_write[0]) + begin), ! sizeof(sequence_to_write[0]) * (end - begin)); return !output_stream->fail(); --- 140,145 ---- output_stream->write( ! reinterpret_cast<const char*>(&(sequence_to_write[0]) + write_point), ! sizeof(sequence_to_write[0]) * write_size); return !output_stream->fail(); *************** *** 147,151 **** bool ConvertStringToInteger(const std::string& input, int* output) { ! if (NULL == output) { return false; } --- 151,155 ---- bool ConvertStringToInteger(const std::string& input, int* output) { ! if (input.empty() || NULL == output) { return false; } *************** *** 163,167 **** bool ConvertStringToDouble(const std::string& input, double* output) { ! if (NULL == output) { return false; } --- 167,171 ---- bool ConvertStringToDouble(const std::string& input, double* output) { ! if (input.empty() || NULL == output) { return false; } *************** *** 182,187 **** } ! // check whether a number is a power of two, 2^p where p is a non-negative ! // integer. bool IsPowerOfTwo(int num) { return !((num < 1) || (num & (num - 1))); --- 186,191 ---- } ! // check whether the given number is a power of two, 2^p where p is a ! // non-negative integer. bool IsPowerOfTwo(int num) { return !((num < 1) || (num & (num - 1))); *************** *** 191,197 **** const std::ostringstream& message) { std::ostringstream stream; ! stream << program_name << " : " << message.str() << "!" << std::endl; std::cerr << stream.str(); } } // namespace sptk --- 195,232 ---- const std::ostringstream& message) { std::ostringstream stream; ! stream << program_name << ": " << message.str() << "!" << std::endl; std::cerr << stream.str(); } + // clang-format off + template bool ReadStream<double>(double*, std::istream*); + template bool ReadStream<int8_t>(bool, int, int, int, std::vector<int8_t>*, std::istream*); // NOLINT + template bool ReadStream<int16_t>(bool, int, int, int, std::vector<int16_t>*, std::istream*); // NOLINT + template bool ReadStream<sptk::int24_t>(bool, int, int, int, std::vector<sptk::int24_t>*, std::istream*); // NOLINT + template bool ReadStream<int32_t>(bool, int, int, int, std::vector<int32_t>*, std::istream*); // NOLINT + template bool ReadStream<int64_t>(bool, int, int, int, std::vector<int64_t>*, std::istream*); // NOLINT + template bool ReadStream<uint8_t>(bool, int, int, int, std::vector<uint8_t>*, std::istream*); // NOLINT + template bool ReadStream<uint16_t>(bool, int, int, int, std::vector<uint16_t>*, std::istream*); // NOLINT + template bool ReadStream<sptk::uint24_t>(bool, int, int, int, std::vector<sptk::uint24_t>*, std::istream*); // NOLINT + template bool ReadStream<uint32_t>(bool, int, int, int, std::vector<uint32_t>*, std::istream*); // NOLINT + template bool ReadStream<uint64_t>(bool, int, int, int, std::vector<uint64_t>*, std::istream*); // NOLINT + template bool ReadStream<float>(bool, int, int, int, std::vector<float>*, std::istream*); // NOLINT + template bool ReadStream<double>(bool, int, int, int, std::vector<double>*, std::istream*); // NOLINT + template bool ReadStream<long double>(bool, int, int, int, std::vector<long double>*, std::istream*); // NOLINT + template bool WriteStream<double>(double, std::ostream*); + template bool WriteStream<int8_t>(int, int, const std::vector<int8_t>&, std::ostream*); // NOLINT + template bool WriteStream<int16_t>(int, int, const std::vector<int16_t>&, std::ostream*); // NOLINT + template bool WriteStream<sptk::int24_t>(int, int, const std::vector<sptk::int24_t>&, std::ostream*); // NOLINT + template bool WriteStream<int32_t>(int, int, const std::vector<int32_t>&, std::ostream*); // NOLINT + template bool WriteStream<int64_t>(int, int, const std::vector<int64_t>&, std::ostream*); // NOLINT + template bool WriteStream<uint8_t>(int, int, const std::vector<uint8_t>&, std::ostream*); // NOLINT + template bool WriteStream<uint16_t>(int, int, const std::vector<uint16_t>&, std::ostream*); // NOLINT + template bool WriteStream<sptk::uint24_t>(int, int, const std::vector<sptk::uint24_t>&, std::ostream*); // NOLINT + template bool WriteStream<uint32_t>(int, int, const std::vector<uint32_t>&, std::ostream*); // NOLINT + template bool WriteStream<uint64_t>(int, int, const std::vector<uint64_t>&, std::ostream*); // NOLINT + template bool WriteStream<float>(int, int, const std::vector<float>&, std::ostream*); // NOLINT + template bool WriteStream<double>(int, int, const std::vector<double>&, std::ostream*); // NOLINT + template bool WriteStream<long double>(int, int, const std::vector<long double>&, std::ostream*); // NOLINT + // clang-format on + } // namespace sptk Index: nrand.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/nrand.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** nrand.cc 12 Oct 2016 12:14:38 -0000 1.4 --- nrand.cc 15 Mar 2017 13:38:04 -0000 1.5 *************** *** 9,13 **** // Science and Engineering // // // ! // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // --- 9,13 ---- // Science and Engineering // // // ! // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // *************** *** 43,47 **** // ----------------------------------------------------------------- // ! #include <unistd.h> #include <cmath> // std::sqrt #include <iostream> --- 43,47 ---- // ----------------------------------------------------------------- // ! #include <getopt.h> #include <cmath> // std::sqrt #include <iostream> *************** *** 91,95 **** for (;;) { ! const char option_char(getopt(argc, argv, "l:s:m:v:d:h")); if (-1 == option_char) break; --- 91,95 ---- for (;;) { ! const int option_char(getopt_long(argc, argv, "l:s:m:v:d:h", NULL, NULL)); if (-1 == option_char) break; *************** *** 160,164 **** if (!generator.Get(&output)) { std::ostringstream error_message; ! error_message << "Failed to generate M sequence"; sptk::PrintErrorMessage("nrand", error_message); return 1; --- 160,164 ---- if (!generator.Get(&output)) { std::ostringstream error_message; ! error_message << "Failed to generate random values"; sptk::PrintErrorMessage("nrand", error_message); return 1; *************** *** 167,171 **** if (!sptk::WriteStream(output, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write an output sequence"; sptk::PrintErrorMessage("nrand", error_message); return 1; --- 167,171 ---- if (!sptk::WriteStream(output, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write random values"; sptk::PrintErrorMessage("nrand", error_message); return 1; Index: levinson_durbin_recursion.h =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/levinson_durbin_recursion.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** levinson_durbin_recursion.h 26 Dec 2016 07:41:20 -0000 1.6 --- levinson_durbin_recursion.h 15 Mar 2017 13:38:04 -0000 1.7 *************** *** 89,94 **** // bool Run(const std::vector<double>& autocorrelation_sequence, ! std::vector<double>* linear_predictive_coefficients, ! bool* is_stable, LevinsonDurbinRecursion::Buffer* buffer) const; private: --- 89,94 ---- // bool Run(const std::vector<double>& autocorrelation_sequence, ! std::vector<double>* linear_predictive_coefficients, bool* is_stable, ! LevinsonDurbinRecursion::Buffer* buffer) const; private: Index: acorr.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/acorr.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** acorr.cc 12 Oct 2016 12:14:38 -0000 1.4 --- acorr.cc 15 Mar 2017 13:38:04 -0000 1.5 *************** *** 9,13 **** // Science and Engineering // // // ! // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // --- 9,13 ---- // Science and Engineering // // // ! // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // *************** *** 43,47 **** // ----------------------------------------------------------------- // ! #include <unistd.h> #include <fstream> #include <iostream> --- 43,47 ---- // ----------------------------------------------------------------- // ! #include <getopt.h> #include <fstream> #include <iostream> *************** *** 85,89 **** for (;;) { ! const char option_char(getopt(argc, argv, "l:m:h")); if (-1 == option_char) break; --- 85,89 ---- for (;;) { ! const int option_char(getopt_long(argc, argv, "l:m:h", NULL, NULL)); if (-1 == option_char) break; *************** *** 139,143 **** if (!autocorrelation.SetNumOrder(num_order)) { std::ostringstream error_message; ! error_message << "Failed to set the order of autocorrelation sequences"; sptk::PrintErrorMessage("acorr", error_message); return 1; --- 139,143 ---- if (!autocorrelation.SetNumOrder(num_order)) { std::ostringstream error_message; ! error_message << "Failed to set the order of autocorrelation sequence"; sptk::PrintErrorMessage("acorr", error_message); return 1; *************** *** 148,163 **** std::vector<double> output_sequence(output_length); ! while ( ! sptk::ReadStream(false, frame_length, &input_sequence, &input_stream)) { if (!autocorrelation.Run(input_sequence, &output_sequence)) { std::ostringstream error_message; ! error_message << "Failed to obtain an autocorrelation sequence"; sptk::PrintErrorMessage("acorr", error_message); return 1; } ! if (!sptk::WriteStream(output_length, output_sequence, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write an autocorrelation sequence"; sptk::PrintErrorMessage("acorr", error_message); return 1; --- 148,163 ---- std::vector<double> output_sequence(output_length); ! while (sptk::ReadStream(false, 0, 0, frame_length, &input_sequence, ! &input_stream)) { if (!autocorrelation.Run(input_sequence, &output_sequence)) { std::ostringstream error_message; ! error_message << "Failed to obtain autocorrelation sequence"; sptk::PrintErrorMessage("acorr", error_message); return 1; } ! if (!sptk::WriteStream(0, output_length, output_sequence, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write autocorrelation sequence"; sptk::PrintErrorMessage("acorr", error_message); return 1; Index: levdur.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/levdur.cc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** levdur.cc 2 Feb 2017 05:25:50 -0000 1.8 --- levdur.cc 15 Mar 2017 13:38:04 -0000 1.9 *************** *** 9,13 **** // Science and Engineering // // // ! // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // --- 9,13 ---- // Science and Engineering // // // ! // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // *************** *** 43,47 **** // ----------------------------------------------------------------- // ! #include <unistd.h> #include <fstream> #include <iostream> --- 43,47 ---- // ----------------------------------------------------------------- // ! #include <getopt.h> #include <fstream> #include <iostream> *************** *** 63,67 **** const int kDefaultNumOrder(25); const double kDefaultEpsilon(1.0e-6); ! const int kDefaultBehaviorForUnstableCoefficient(kIgnore); void PrintUsage(std::ostream* stream) { --- 63,68 ---- const int kDefaultNumOrder(25); const double kDefaultEpsilon(1.0e-6); ! const BehaviorForUnstableCoefficients kDefaultBehaviorForUnstableCoefficients( ! kIgnore); void PrintUsage(std::ostream* stream) { *************** *** 76,81 **** *stream << " -m m : order of autocorrelation [" << kDefaultNumOrder << "]" << std::endl; // NOLINT *stream << " -f f : minimum value of the determinant of [" << kDefaultEpsilon << "]" << std::endl; // NOLINT ! *stream << " the normal matrix" << std::endl; ! *stream << " -e e : check whether the derived linear [" << kDefaultBehaviorForUnstableCoefficient << "]" << std::endl; // NOLINT *stream << " predictive coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; --- 77,82 ---- *stream << " -m m : order of autocorrelation [" << kDefaultNumOrder << "]" << std::endl; // NOLINT *stream << " -f f : minimum value of the determinant of [" << kDefaultEpsilon << "]" << std::endl; // NOLINT ! *stream << " normal matrix" << std::endl; ! *stream << " -e e : check whether the derived linear [" << kDefaultBehaviorForUnstableCoefficients << "]" << std::endl; // NOLINT *stream << " predictive coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; *************** *** 102,110 **** double epsilon(kDefaultEpsilon); BehaviorForUnstableCoefficients behavior( ! static_cast<BehaviorForUnstableCoefficients>( ! kDefaultBehaviorForUnstableCoefficient)); for (;;) { ! const char option_char(getopt(argc, argv, "m:f:e:h")); if (-1 == option_char) break; --- 103,110 ---- double epsilon(kDefaultEpsilon); BehaviorForUnstableCoefficients behavior( ! kDefaultBehaviorForUnstableCoefficients); for (;;) { ! const int option_char(getopt_long(argc, argv, "m:f:e:h", NULL, NULL)); if (-1 == option_char) break; *************** *** 175,179 **** if (!recursion.SetEpsilon(epsilon)) { std::ostringstream error_message; ! error_message << "Failed to set the minimum value of the determinant"; sptk::PrintErrorMessage("levdur", error_message); return 1; --- 175,179 ---- if (!recursion.SetEpsilon(epsilon)) { std::ostringstream error_message; ! error_message << "Failed to set minimum value of determinant"; sptk::PrintErrorMessage("levdur", error_message); return 1; *************** *** 185,189 **** for (int frame_index(0); sptk::ReadStream( ! false, length, &autocorrelation_sequence, &input_stream); ++frame_index) { bool is_stable(false); --- 185,189 ---- for (int frame_index(0); sptk::ReadStream( ! false, 0, 0, length, &autocorrelation_sequence, &input_stream); ++frame_index) { bool is_stable(false); *************** *** 191,195 **** &linear_predictive_coefficients, &is_stable, &buffer)) { std::ostringstream error_message; ! error_message << "Failed to solve an autocorrelation normal equation"; sptk::PrintErrorMessage("levdur", error_message); return 1; --- 191,195 ---- &linear_predictive_coefficients, &is_stable, &buffer)) { std::ostringstream error_message; ! error_message << "Failed to solve autocorrelation normal equations"; sptk::PrintErrorMessage("levdur", error_message); return 1; *************** *** 203,207 **** } ! if (!sptk::WriteStream(length, linear_predictive_coefficients, &std::cout)) { std::ostringstream error_message; --- 203,207 ---- } ! if (!sptk::WriteStream(0, length, linear_predictive_coefficients, &std::cout)) { std::ostringstream error_message; Index: lpc.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/lpc.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** lpc.cc 2 Feb 2017 05:25:50 -0000 1.7 --- lpc.cc 15 Mar 2017 13:38:04 -0000 1.8 *************** *** 9,13 **** // Science and Engineering // // // ! // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // --- 9,13 ---- // Science and Engineering // // // ! // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // *************** *** 43,47 **** // ----------------------------------------------------------------- // ! #include <unistd.h> #include <fstream> #include <iostream> --- 43,47 ---- // ----------------------------------------------------------------- // ! #include <getopt.h> #include <fstream> #include <iostream> *************** *** 65,69 **** const int kDefaultNumOrder(25); const double kDefaultEpsilon(1.0e-6); ! const int kDefaultBehaviorForUnstableCoefficient(kIgnore); void PrintUsage(std::ostream* stream) { --- 65,70 ---- const int kDefaultNumOrder(25); const double kDefaultEpsilon(1.0e-6); ! const BehaviorForUnstableCoefficients kDefaultBehaviorForUnstableCoefficients( ! kIgnore); void PrintUsage(std::ostream* stream) { *************** *** 79,83 **** *stream << " -f f : minimum value of the determinant of [" << kDefaultEpsilon << "]" << std::endl; // NOLINT *stream << " the normal matrix" << std::endl; ! *stream << " -e e : check whether the derived linear [" << kDefaultBehaviorForUnstableCoefficient << "]" << std::endl; // NOLINT *stream << " predictive coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; --- 80,84 ---- *stream << " -f f : minimum value of the determinant of [" << kDefaultEpsilon << "]" << std::endl; // NOLINT *stream << " the normal matrix" << std::endl; ! *stream << " -e e : check whether the derived linear [" << kDefaultBehaviorForUnstableCoefficients << "]" << std::endl; // NOLINT *stream << " predictive coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; *************** *** 105,113 **** double epsilon(kDefaultEpsilon); BehaviorForUnstableCoefficients behavior( ! static_cast<BehaviorForUnstableCoefficients>( ! kDefaultBehaviorForUnstableCoefficient)); for (;;) { ! const char option_char(getopt(argc, argv, "l:m:f:e:h")); if (-1 == option_char) break; --- 106,113 ---- double epsilon(kDefaultEpsilon); BehaviorForUnstableCoefficients behavior( ! kDefaultBehaviorForUnstableCoefficients); for (;;) { ! const int option_char(getopt_long(argc, argv, "l:m:f:e:h", NULL, NULL)); if (-1 == option_char) break; *************** *** 188,192 **** if (!autocorrelation.SetNumOrder(num_order)) { std::ostringstream error_message; ! error_message << "Failed to set the number of orders"; sptk::PrintErrorMessage("lpc", error_message); return 1; --- 188,192 ---- if (!autocorrelation.SetNumOrder(num_order)) { std::ostringstream error_message; ! error_message << "Failed to set the order of autocorrelation sequence"; sptk::PrintErrorMessage("lpc", error_message); return 1; *************** *** 197,201 **** if (!recursion.SetEpsilon(epsilon)) { std::ostringstream error_message; ! error_message << "Failed to set the minimum value of the determinant"; sptk::PrintErrorMessage("lpc", error_message); return 1; --- 197,201 ---- if (!recursion.SetEpsilon(epsilon)) { std::ostringstream error_message; ! error_message << "Failed to set the minimum value of determinant"; sptk::PrintErrorMessage("lpc", error_message); return 1; *************** *** 207,216 **** std::vector<double> linear_predictive_coefficients(output_length); ! for (int frame_index(0); ! sptk::ReadStream(false, frame_length, &windowed_sequence, &input_stream); ++frame_index) { if (!autocorrelation.Run(windowed_sequence, &autocorrelation_sequence)) { std::ostringstream error_message; ! error_message << "Failed to obtain an autocorrelation sequence"; sptk::PrintErrorMessage("lpc", error_message); return 1; --- 207,216 ---- std::vector<double> linear_predictive_coefficients(output_length); ! for (int frame_index(0); sptk::ReadStream(false, 0, 0, frame_length, ! &windowed_sequence, &input_stream); ++frame_index) { if (!autocorrelation.Run(windowed_sequence, &autocorrelation_sequence)) { std::ostringstream error_message; ! error_message << "Failed to obtain autocorrelation sequence"; sptk::PrintErrorMessage("lpc", error_message); return 1; *************** *** 221,225 **** &linear_predictive_coefficients, &is_stable, &buffer)) { std::ostringstream error_message; ! error_message << "Failed to solve an autocorrelation normal equation"; sptk::PrintErrorMessage("lpc", error_message); return 1; --- 221,225 ---- &linear_predictive_coefficients, &is_stable, &buffer)) { std::ostringstream error_message; ! error_message << "Failed to solve autocorrelation normal equations"; sptk::PrintErrorMessage("lpc", error_message); return 1; *************** *** 233,237 **** } ! if (!sptk::WriteStream(output_length, linear_predictive_coefficients, &std::cout)) { std::ostringstream error_message; --- 233,237 ---- } ! if (!sptk::WriteStream(0, output_length, linear_predictive_coefficients, &std::cout)) { std::ostringstream error_message; Index: ifft.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/ifft.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ifft.cc 2 Feb 2017 05:25:50 -0000 1.7 --- ifft.cc 15 Mar 2017 13:38:04 -0000 1.8 *************** *** 9,13 **** // Science and Engineering // // // ! // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // --- 9,13 ---- // Science and Engineering // // // ! // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // *************** *** 43,47 **** // ----------------------------------------------------------------- // ! #include <unistd.h> #include <fstream> #include <iostream> --- 43,47 ---- // ----------------------------------------------------------------- // ! #include <getopt.h> #include <fstream> #include <iostream> *************** *** 62,66 **** const int kDefaultFftSize(256); ! const int kDefaultOutputFormat(kOutputRealAndImaginaryParts); void PrintUsage(std::ostream* stream) { --- 62,66 ---- const int kDefaultFftSize(256); ! const OutputFormats kDefaultOutputFormat(kOutputRealAndImaginaryParts); void PrintUsage(std::ostream* stream) { *************** *** 92,99 **** int main(int argc, char* argv[]) { int fft_size(kDefaultFftSize); ! OutputFormats output_format(static_cast<OutputFormats>(kDefaultOutputFormat)); for (;;) { ! const char option_char(getopt(argc, argv, "l:o:h")); if (-1 == option_char) break; --- 92,99 ---- int main(int argc, char* argv[]) { int fft_size(kDefaultFftSize); ! OutputFormats output_format(kDefaultOutputFormat); for (;;) { ! const int option_char(getopt_long(argc, argv, "l:o:h", NULL, NULL)); if (-1 == option_char) break; *************** *** 162,170 **** std::vector<double> output_y(fft_size); ! while (sptk::ReadStream(false, fft_size, &input_x, &input_stream) && ! sptk::ReadStream(false, fft_size, &input_y, &input_stream)) { if (!fft.Run(input_x, input_y, &output_x, &output_y)) { std::ostringstream error_message; ! error_message << "Failed to run the inverse fast Fourier transform"; sptk::PrintErrorMessage("ifft", error_message); return 1; --- 162,170 ---- std::vector<double> output_y(fft_size); ! while (sptk::ReadStream(false, 0, 0, fft_size, &input_x, &input_stream) && ! sptk::ReadStream(false, 0, 0, fft_size, &input_y, &input_stream)) { if (!fft.Run(input_x, input_y, &output_x, &output_y)) { std::ostringstream error_message; ! error_message << "Failed to run inverse fast Fourier transform"; sptk::PrintErrorMessage("ifft", error_message); return 1; *************** *** 172,178 **** if (kOutputImaginaryPart != output_format && ! !sptk::WriteStream(fft_size, output_x, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write an output sequence"; sptk::PrintErrorMessage("ifft", error_message); return 1; --- 172,178 ---- if (kOutputImaginaryPart != output_format && ! !sptk::WriteStream(0, fft_size, output_x, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write real parts"; sptk::PrintErrorMessage("ifft", error_message); return 1; *************** *** 181,187 **** if ((kOutputRealAndImaginaryParts == output_format || kOutputImaginaryPart == output_format) && ! !sptk::WriteStream(fft_size, output_y, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write an output sequence"; sptk::PrintErrorMessage("ifft", error_message); return 1; --- 181,187 ---- if ((kOutputRealAndImaginaryParts == output_format || kOutputImaginaryPart == output_format) && ! !sptk::WriteStream(0, fft_size, output_y, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write imaginary parts"; sptk::PrintErrorMessage("ifft", error_message); return 1; Index: c2mpir.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/c2mpir.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** c2mpir.cc 12 Oct 2016 12:14:38 -0000 1.4 --- c2mpir.cc 15 Mar 2017 13:38:04 -0000 1.5 *************** *** 9,13 **** // Science and Engineering // // // ! // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // --- 9,13 ---- // Science and Engineering // // // ! // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // *************** *** 43,47 **** // ----------------------------------------------------------------- // ! #include <unistd.h> #include <fstream> #include <iostream> --- 43,47 ---- // ----------------------------------------------------------------- // ! #include <getopt.h> #include <fstream> #include <iostream> *************** *** 86,90 **** for (;;) { ! const char option_char(getopt(argc, argv, "m:M:l:h")); if (-1 == option_char) break; --- 86,90 ---- for (;;) { ! const int option_char(getopt_long(argc, argv, "m:M:l:h", NULL, NULL)); if (-1 == option_char) break; *************** *** 144,148 **** std::ostringstream error_message; error_message << "Cannot open file " << input_file; ! sptk::PrintErrorMessage("freqt", error_message); return 1; } --- 144,148 ---- std::ostringstream error_message; error_message << "Cannot open file " << input_file; ! sptk::PrintErrorMessage("c2mpir", error_message); return 1; } *************** *** 165,169 **** std::vector<double> minimum_phase_impulse_response(output_length); ! while (sptk::ReadStream(false, input_length, &cepstrum, &input_stream)) { if (!cepstrum_to_minimum_phase_impulse_response.Run( cepstrum, &minimum_phase_impulse_response)) { --- 165,170 ---- std::vector<double> minimum_phase_impulse_response(output_length); ! while ( ! sptk::ReadStream(false, 0, 0, input_length, &cepstrum, &input_stream)) { if (!cepstrum_to_minimum_phase_impulse_response.Run( cepstrum, &minimum_phase_impulse_response)) { *************** *** 175,182 **** } ! if (!sptk::WriteStream(output_length, minimum_phase_impulse_response, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write an output sequence"; sptk::PrintErrorMessage("c2mpir", error_message); return 1; --- 176,183 ---- } ! if (!sptk::WriteStream(0, output_length, minimum_phase_impulse_response, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write minimum phase impulse response"; sptk::PrintErrorMessage("c2mpir", error_message); return 1; Index: excite.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/excite.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** excite.cc 12 Oct 2016 12:27:53 -0000 1.5 --- excite.cc 15 Mar 2017 13:38:04 -0000 1.6 *************** *** 9,13 **** // Science and Engineering // // // ! // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // --- 9,13 ---- // Science and Engineering // // // ! // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // *************** *** 43,47 **** // ----------------------------------------------------------------- // ! #include <unistd.h> #include <fstream> #include <iostream> --- 43,47 ---- // ----------------------------------------------------------------- // ! #include <getopt.h> #include <fstream> #include <iostream> *************** *** 99,103 **** for (;;) { ! const char option_char(getopt(argc, argv, "p:i:nsh")); if (-1 == option_char) break; --- 99,103 ---- for (;;) { ! const int option_char(getopt_long(argc, argv, "p:i:nsh", NULL, NULL)); if (-1 == option_char) break; *************** *** 198,202 **** if (!excitation_generation.IsValid()) { std::ostringstream error_message; ! error_message << "Failed to set the condition for excitation generation"; sptk::PrintErrorMessage("excite", error_message); delete random_generation; --- 198,202 ---- if (!excitation_generation.IsValid()) { std::ostringstream error_message; ! error_message << "Failed to set condition for excitation generation"; sptk::PrintErrorMessage("excite", error_message); delete random_generation; *************** *** 208,212 **** if (!sptk::WriteStream(excitation, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write an excitation"; sptk::PrintErrorMessage("excite", error_message); delete random_generation; --- 208,212 ---- if (!sptk::WriteStream(excitation, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write excitation"; sptk::PrintErrorMessage("excite", error_message); delete random_generation; Index: levinson_durbin_recursion.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/levinson_durbin_recursion.cc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** levinson_durbin_recursion.cc 26 Dec 2016 07:41:20 -0000 1.8 --- levinson_durbin_recursion.cc 15 Mar 2017 13:38:04 -0000 1.9 *************** *** 52,57 **** bool LevinsonDurbinRecursion::Run( const std::vector<double>& autocorrelation_sequence, ! std::vector<double>* linear_predictive_coefficients, ! bool* is_stable, LevinsonDurbinRecursion::Buffer* buffer) const { // check inputs if (autocorrelation_sequence.empty() || --- 52,57 ---- bool LevinsonDurbinRecursion::Run( const std::vector<double>& autocorrelation_sequence, ! std::vector<double>* linear_predictive_coefficients, bool* is_stable, ! LevinsonDurbinRecursion::Buffer* buffer) const { // check inputs if (autocorrelation_sequence.empty() || Index: ltcdf.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/ltcdf.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ltcdf.cc 26 Oct 2016 08:18:58 -0000 1.1 --- ltcdf.cc 15 Mar 2017 13:38:04 -0000 1.2 *************** *** 9,13 **** // Science and Engineering // // // ! // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // --- 9,13 ---- // Science and Engineering // // // ! // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // *************** *** 43,47 **** // ----------------------------------------------------------------- // ! #include <unistd.h> #include <fstream> #include <iostream> --- 43,47 ---- // ----------------------------------------------------------------- // ! #include <getopt.h> #include <fstream> #include <iostream> *************** *** 96,100 **** for (;;) { ! const char option_char(getopt(argc, argv, "m:p:i:tkh")); if (-1 == option_char) break; --- 96,100 ---- for (;;) { ! const int option_char(getopt_long(argc, argv, "m:p:i:tkh", NULL, NULL)); if (-1 == option_char) break; *************** *** 151,155 **** std::ostringstream error_message; error_message ! << "Interpolation period should not be greater than half frame period"; sptk::PrintErrorMessage("ltcdf", error_message); return 1; --- 151,155 ---- std::ostringstream error_message; error_message ! << "Interpolation period must not be greater than half frame period"; sptk::PrintErrorMessage("ltcdf", error_message); return 1; *************** *** 215,219 **** if (!interpolation.IsValid() || !filter.IsValid()) { std::ostringstream error_message; ! error_message << "Failed to set the conditions for filtering"; sptk::PrintErrorMessage("ltcdf", error_message); return 1; --- 215,219 ---- if (!interpolation.IsValid() || !filter.IsValid()) { std::ostringstream error_message; ! error_message << "Failed to set condition for filtering"; sptk::PrintErrorMessage("ltcdf", error_message); return 1; Index: sptk_utils.h =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/sptk_utils.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** sptk_utils.h 26 Jan 2017 10:33:54 -0000 1.9 --- sptk_utils.h 15 Mar 2017 13:38:04 -0000 1.10 *************** *** 9,13 **** // Science and Engineering // // // ! // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // --- 9,13 ---- // Science and Engineering // // // ! // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // *************** *** 64,76 **** static const double kNp(8.685889638065035); // 1 Np = 20 / ln(10) dB ! bool ReadStream(double* data_to_read, std::istream* input_stream); ! bool ReadStream(bool zero_padding, int read_size, ! std::vector<double>* sequence_to_read, std::istream* input_stream); ! bool WriteStream(double data_to_write, std::ostream* output_stream); ! bool WriteStream(int write_size, const std::vector<double>& sequence_to_write, ! std::ostream* output_stream); ! bool WriteStream(int begin, int end, ! const std::vector<double>& sequence_to_write, std::ostream* output_stream); const char* ConvertBooleanToString(bool input); --- 64,78 ---- static const double kNp(8.685889638065035); // 1 Np = 20 / ln(10) dB ! template <typename T> ! bool ReadStream(T* data_to_read, std::istream* input_stream); ! template <typename T> ! bool ReadStream(bool zero_padding, int stream_skip, int read_point, ! int read_size, std::vector<T>* sequence_to_read, std::istream* input_stream); ! template <typename T> ! bool WriteStream(T data_to_write, std::ostream* output_stream); ! template <typename T> ! bool WriteStream(int write_point, int write_size, ! const std::vector<T>& sequence_to_write, std::ostream* output_stream); const char* ConvertBooleanToString(bool input); Index: mgc2sp.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/mgc2sp.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mgc2sp.cc 2 Feb 2017 05:25:50 -0000 1.2 --- mgc2sp.cc 15 Mar 2017 13:38:04 -0000 1.3 *************** *** 9,13 **** // Science and Engineering // // // ! // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // --- 9,13 ---- // Science and Engineering // // // ! // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // *************** *** 43,47 **** // ----------------------------------------------------------------- // ! #include <unistd.h> #include <algorithm> #include <cmath> --- 43,47 ---- // ----------------------------------------------------------------- // ! #include <getopt.h> #include <algorithm> #include <cmath> *************** *** 74,78 **** const bool kDefaultMultiplicationFlag(false); const int kDefaultFftSize(256); ! const int kDefaultOutputFormat(kLogAmplitudeSpectrumInDecibels); void PrintUsage(std::ostream* stream) { --- 74,78 ---- const bool kDefaultMultiplicationFlag(false); const int kDefaultFftSize(256); ! const OutputFormats kDefaultOutputFormat(kLogAmplitudeSpectrumInDecibels); void PrintUsage(std::ostream* stream) { *************** *** 123,130 **** bool multiplication_flag(kDefaultMultiplicationFlag); int fft_size(kDefaultFftSize); ! OutputFormats output_format(static_cast<OutputFormats>(kDefaultOutputFormat)); for (;;) { ! const char option_char(getopt(argc, argv, "m:a:g:c:nul:o:h")); if (-1 == option_char) break; --- 123,131 ---- bool multiplication_flag(kDefaultMultiplicationFlag); int fft_size(kDefaultFftSize); ! OutputFormats output_format(kDefaultOutputFormat); for (;;) { ! const int option_char( ! getopt_long(argc, argv, "m:a:g:c:nul:o:h", NULL, NULL)); if (-1 == option_char) break; *************** *** 235,239 **** if (!generalized_cepstrum_to_spectrum.IsValid()) { std::ostringstream error_message; ! error_message << "Failed to set the condition"; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; --- 236,240 ---- if (!generalized_cepstrum_to_spectrum.IsValid()) { std::ostringstream error_message; ! error_message << "Failed to set condition for transformation"; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; *************** *** 246,250 **** std::vector<double> phase_spectrum(fft_size); ! while (sptk::ReadStream(false, input_length, &generalized_cepstrum, &input_stream)) { // input modification --- 247,251 ---- std::vector<double> phase_spectrum(fft_size); ! while (sptk::ReadStream(false, 0, 0, input_length, &generalized_cepstrum, &input_stream)) { // input modification *************** *** 259,263 **** &phase_spectrum, &buffer)) { std::ostringstream error_message; ! error_message << "Failed to transform"; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; --- 260,265 ---- &phase_spectrum, &buffer)) { std::ostringstream error_message; ! error_message ! << "Failed to transform mel-generalized ceptrum to spectrum"; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; *************** *** 317,321 **** case kAmplitudeSpectrum: case kPowerSpectrum: { ! if (!sptk::WriteStream(output_length, amplitude_spectrum, &std::cout)) { std::ostringstream error_message; error_message << "Failed to write amplitude spectrum"; --- 319,324 ---- case kAmplitudeSpectrum: case kPowerSpectrum: { ! if (!sptk::WriteStream(0, output_length, amplitude_spectrum, ! &std::cout)) { std::ostringstream error_message; error_message << "Failed to write amplitude spectrum"; ***... [truncated message content] |