0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 20:03:10 +02:00

ao_coreaudio: remove volume multiplication by 4

kHALOutputParam_Volume is the linear gain so it should be at maximum 1 to
keep the audio quality good. No idea why it was more than that.
This commit is contained in:
Stefano Pigozzi 2013-07-02 08:07:15 +02:00
parent a2d106cb31
commit 6d2f9a2804

View File

@ -152,7 +152,7 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg)
kAudioUnitScope_Global, 0, &vol); kAudioUnitScope_Global, 0, &vol);
CHECK_CA_ERROR("could not get HAL output volume"); CHECK_CA_ERROR("could not get HAL output volume");
control_vol->left = control_vol->right = vol * 100.0 / 4.0; control_vol->left = control_vol->right = vol * 100.0;
return CONTROL_TRUE; return CONTROL_TRUE;
case AOCONTROL_SET_VOLUME: case AOCONTROL_SET_VOLUME:
@ -174,7 +174,7 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg)
return CONTROL_TRUE; return CONTROL_TRUE;
} }
vol = (control_vol->left + control_vol->right) * 4.0 / 200.0; vol = (control_vol->left + control_vol->right) / 200.0;
err = AudioUnitSetParameter(p->audio_unit, kHALOutputParam_Volume, err = AudioUnitSetParameter(p->audio_unit, kHALOutputParam_Volume,
kAudioUnitScope_Global, 0, vol, 0); kAudioUnitScope_Global, 0, vol, 0);