diff options
author | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2013-02-23 01:03:52 +0200 |
---|---|---|
committer | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2013-02-23 01:03:52 +0200 |
commit | 062e947feaadd5754b33f2fc28b252ff050f038d (patch) | |
tree | c14af80377717145b4a61458d363e9276bc0c781 | |
parent | f71be6573531052d960e9d2e69ada4bdb8572cd4 (diff) |
channel count fix (portaudio can give more channels than specified)
-rw-r--r-- | sound_detector/main.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sound_detector/main.cpp b/sound_detector/main.cpp index 6caf280..67edc08 100644 --- a/sound_detector/main.cpp +++ b/sound_detector/main.cpp @@ -251,7 +251,8 @@ void handle_data() int stream_callback(const void *input, void *output, unsigned long frameCount, const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData) { - int16_t *buf = (int16_t*)input; + int16_t **bufs = (int16_t**)input; + int16_t *buf = bufs[0]; lock.lock(); buffer.insert(buffer.end(), buf, buf + frameCount); lock.unlock(); @@ -384,7 +385,7 @@ int main(int argc, char **argv) PaStreamParameters params; memset(¶ms, 0, sizeof(PaStreamParameters)); params.channelCount = 1; - params.sampleFormat = paInt16; + params.sampleFormat = paInt16 | paNonInterleaved; params.device = device; const PaDeviceInfo *info = Pa_GetDeviceInfo(device); params.suggestedLatency = info->defaultHighInputLatency; |