summaryrefslogtreecommitdiff
path: root/src/audioin.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2012-08-02 20:43:30 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2012-08-02 20:43:30 +0200
commit90fb73a91936ede98ccedda073929397ddf842b1 (patch)
treec83b8f8ebdfdea527f01b6afede8f90d03bd0fa4 /src/audioin.cc
parentf83b395168155d0421dbc093a37bd075dc51ed53 (diff)
New portaudio approach.HEADmaster
Diffstat (limited to 'src/audioin.cc')
-rw-r--r--src/audioin.cc17
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)