diff options
Diffstat (limited to 'src/audioin.cc')
-rw-r--r-- | src/audioin.cc | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/audioin.cc b/src/audioin.cc index 3792ae2..b15666f 100644 --- a/src/audioin.cc +++ b/src/audioin.cc @@ -29,6 +29,7 @@ AudioIn::AudioIn(std::string device, std::string mixer_interface, unsigned int srate, int ch) { + /* frames = 940; elem = NULL; @@ -78,6 +79,7 @@ AudioIn::AudioIn(std::string device, std::string mixer_interface, if (rc < 0) throw UnableToSetHWParams(); mixhnd = NULL; + */ /* // // Set up mixer @@ -138,8 +140,20 @@ AudioIn::~AudioIn() if(mixhnd) snd_mixer_close(mixhnd); } +#define TEST +#ifdef TEST +#include <math.h> +#endif/*TEST*/ size_t AudioIn::read(sample_t *buf, size_t size) { +#ifdef TEST + static unsigned int x = 0; + for(size_t i = 0; i < size; i++) { + buf[i] = sin((float)x / 50.0); + x++; + } + return size; +#else int rc; if(size < frames * channels) { @@ -157,8 +171,9 @@ size_t AudioIn::read(sample_t *buf, size_t size) } else if (rc != (int)frames) { throw ShortRead(); } - + printf("rc: %d\n", rc); return rc * channels; +#endif/*TEST*/ } int AudioIn::set_level(unsigned int channel, float level) |