Hi,

Previously my softphone could not change mic gain which is
caused by gain range mismatch.
Though MpCodec_setGain() looks like to expect a value from 1 to 10
which is described in CpMediaInterfaceFactoryImpl.h,
sipxAudioSetGain() passes 100 scale value to MpCodec_setGain().
Since 10 scale is rough, how about changing to 100 scale?
(why they starts with 1, not 0?)

These are several magic numbers (like 1.0f, 9.0f) in MpCodec_setGain(),
they should be symbols. If we use float conversion (As dwMaximum is
typically 0xFFFF, I think it is not essential) the correspond code can be
as follows;
  #define GAIN_MIN 1
  #define GAIN_MAX 100
  pUnsigned[0].dwValue = pUnsigned[cChannels - 1].dwValue =
      pmxctrl->Bounds.dwMinimum + (DWORD)(
        ((float)(pmxctrl->Bounds.dwMaximum -
pmxctrl->Bounds.dwMinimum) * (float)(level - GAIN_MIN))
        / (float)(GAIN_MAX - GAIN_MIN)
      );

Regards,
Kenichi Aramaki
_______________________________________________
sipxtapi-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipxtapi-dev/

Reply via email to