summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuo Jinghua <sunmoon1997@gmail.com>2012-11-27 14:28:36 +0800
committerLuo Jinghua <sunmoon1997@gmail.com>2012-11-27 14:28:36 +0800
commit772d80843fa389f78a1167c69071f2ecd80b47e0 (patch)
treeebf19ef9cb85589864bbc78e2dcf599016fd85dd /src
parent619d51ca8914bd66e63274db074f44cd3180c987 (diff)
Add suppport for more sample rates to extern device
Diffstat (limited to 'src')
-rw-r--r--src/device_extern.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/device_extern.cpp b/src/device_extern.cpp
index 3d61e0f..48c59d0 100644
--- a/src/device_extern.cpp
+++ b/src/device_extern.cpp
@@ -77,8 +77,18 @@ namespace audiere {
!module.init("libExtAudioDevice.so"))
return 0;
- ret = module.open(44100, 2, 16, 1);
- if (ret != 0)
+ int rates[] = { 44100, 48000, 22050, 8000 };
+ int rate = -1;
+ for (size_t i = 0; i < sizeof(rates) / sizeof(rates[0]); i++)
+ {
+ ret = module.open(rates[i], 2, 16, 1);
+ if (ret == 0)
+ {
+ rate = rates[i];
+ break;
+ }
+ }
+ if (rate > 0)
{
ADR_LOG("Unable to open audio device\n");
module.uninit();
@@ -94,7 +104,7 @@ namespace audiere {
return 0;
}
- return new ExternAudioDevice(module, 44100, 4096);
+ return new ExternAudioDevice(module, rate, 4096);
}
ExternAudioDevice::ExternAudioDevice(ExternModule module,