diff --git a/examples/DSPE_examples.h b/examples/DSPE_examples.h index 5bd1f3c5e2806f862dd60ed578223c15d34de1ec..bbaa0df1b52d6a90b66a56fb94fd35cb18e91e78 100644 --- a/examples/DSPE_examples.h +++ b/examples/DSPE_examples.h @@ -9,7 +9,7 @@ #define EXAMPLES_DSPE_EXAMPLES_H_ int test_hello(void); -int test_sound_input(void); +int test_sound_input(bool use_audio_output = true); #endif /* EXAMPLES_DSPE_EXAMPLES_H_ */ diff --git a/examples/sound_input.cpp b/examples/sound_input.cpp index d25e3966adbf53907aabf4909884c9fab0c4cfec..da1364f234ba12f3b3ab5ae11461f2767f8d751e 100644 --- a/examples/sound_input.cpp +++ b/examples/sound_input.cpp @@ -7,11 +7,14 @@ #ifndef INCLUDE_DSPE_EXAMPLES int main(void) +{ + bool use_audio_output = true; #else #include "DSPE_examples.h" -int test_sound_input(void) -#endif // INCLUDE_DSPE_EXAMPLES +int test_sound_input(bool use_audio_output) { +#endif // INCLUDE_DSPE_EXAMPLES + DSP::Clock_ptr MasterClock, AudioInClock; string tekst; int temp; @@ -33,9 +36,13 @@ int test_sound_input(void) Fp = WaveIn.GetSamplingRate(); - DSP::u::AudioOutput AudioOut(Fp); + std::shared_ptr<DSP::Block> AudioOut = nullptr; + if (use_audio_output == true) + AudioOut.reset(new DSP::u::AudioOutput(Fp)); + else + AudioOut.reset(new DSP::u::Vacuum(1U)); - WaveIn.Output("out") >> AudioOut.Input("in"); + WaveIn.Output("out") >> AudioOut->Input("in"); Fp2 = 8000; long Fp_gcd = DSP::f::gcd(Fp, Fp2); @@ -56,8 +63,9 @@ int test_sound_input(void) DSP::log << "MAIN" << DSP::e::LogMode::second << temp << endl; temp++; } - while (WaveIn.GetBytesRead() != 0); + while ((temp <= 8) || (WaveIn.GetBytesRead() != 0)); + AudioOut.reset(); DSP::Clock::FreeClocks(); DSP::log << DSP::e::LogMode::Error << "MAIN" << DSP::e::LogMode::second << "end" << endl; diff --git a/src/Main.cpp b/src/Main.cpp index eb68ee86d67e33bfc0599c522f4989e4bedfef81..333f2403aec0ea66342d53119a60e1c013dfc132 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -2977,7 +2977,8 @@ int main(int argc, char*argv[]) DSP::log << DSP::e::LogMode::Error << "Finished test_hello" << endl; DSP::log << "Starting test_sound_input" << endl; - test_sound_input(); + bool use_audio_output = false; + test_sound_input(use_audio_output); DSP::log << DSP::e::LogMode::Error << "Finished test_sound_input" << endl; #endif // INCLUDE_DSPE_EXAMPLES