setVolumeGain method

Future<void> setVolumeGain(
  1. double gainDb
)
inherited

Sets volume gain in dB (pre-amplification on top of setVolume).

Takes -150 to +150 dB: mpv refuses a value outside it, and the call throws MpvCommandException. setVolumeGainMin and setVolumeGainMax do not cap this call: they bound mpv's relative steps (add, cycle) only. 0 dB = unity. Values above about +6 dB risk clipping unless setReplayGain or a downstream limiter is in the chain.

Implementation

Future<void> setVolumeGain(double gainDb) async {
  _checkFinite(gainDb, 'gainDb');
  await _gate();
  final value = canonicalFloat(gainDb);
  await _calls.prop('volume-gain', value.toString());
  _updateField(
    (s) => s.copyWith(volumeGain: value),
    _reactives.volumeGain,
    value,
  );
}