AudioHardware: Dispatch setParameters to input and output master
authorPaul Kocialkowski <contact@paulk.fr>
Tue, 28 Aug 2012 22:21:43 +0000 (00:21 +0200)
committerPaul Kocialkowski <contact@paulk.fr>
Tue, 28 Aug 2012 22:21:43 +0000 (00:21 +0200)
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
AudioHardware.cpp

index 28a8c95..e974671 100644 (file)
@@ -148,9 +148,20 @@ status_t AudioHardware::getMicMute(bool *state)
 
 status_t AudioHardware::setParameters(const String8& keyValuePairs)
 {
-       LOGD("setParameters()");
-
        AudioParameter param = AudioParameter(keyValuePairs);
+       String8 key = String8(AudioParameter::keyRouting);
+       int device;
+
+       LOGD("setParameters(%s)",
+               keyValuePairs.string());
+
+       if(param.getInt(key, device) == NO_ERROR) {
+               if(AudioSystem::isOutputDevice((AudioSystem::audio_devices) device) && mOutput) {
+                       return mOutput->setParameters(keyValuePairs);
+               } else if(AudioSystem::isInputDevice((AudioSystem::audio_devices) device) && mInput) {
+                       return mInput->setParameters(keyValuePairs);
+               }
+       }
 
        return NO_ERROR;
 }