Hi:
I want to control the USB Audio device's Volume.
And I can adjust it's output volume (use
AudioDeviceSetProperty directly)
But I can't adjust it's Input volume (use
AudioDeviceSetProperty too)
I don't know why , I wrote code like
this:
//---------------------------------------------------------------------------
// Change output's volume and successfully
!
float theValue = 0.8;
Boolean isWritable; err =
AudioDeviceGetPropertyInfo ( outputDeviceID, 1,
false, // channel: 1 =
left channel; 2 = right channel
kAudioDevicePropertyVolumeScalar, NULL, &isWritable
);
if ( (err == kAudioHardwareNoError)&& isWritable)
{ err = AudioDeviceSetProperty (
outputDeviceID, NULL, 1, false,
kAudioDevicePropertyVolumeScalar, sizeof(float),
&theValue );
}
err = AudioDeviceGetPropertyInfo
( outputDeviceID, 2, false,
// channel: 1 = left channel; 2 = right
channel
kAudioDevicePropertyVolumeScalar, NULL,
&isWritable); if ( (err == kAudioHardwareNoError)&&
isWritable) { err = AudioDeviceSetProperty
( outputDeviceID, NULL, 2, false,
kAudioDevicePropertyVolumeScalar, sizeof(float),
&theValue ); }
// Change input's volume and failed !
err = AudioDeviceGetPropertyInfo (
inputDevice,
1, // I have tryed set channel form 0 to 100, but everytime
returned by "err = 2003332927"
false,
kAudioDevicePropertyVolumeScalar, NULL,
&isWritable);
//----------------------------------------------------------
Who can help me ??? Help me
~~~~
|