fix(alarm): cap the ring at the configured volume instead of the device max
The ring-scoped media override forced STREAM_MUSIC to the hardware maximum, so the alarm's configured percentage was applied on top of a maxed speaker: "50%" meant 50% of the phone's absolute maximum and the fade rode against that ceiling, far louder than the device- relative level users were used to. On-device logcat also showed the just_audio player emitting one buffer at volume 1.0 before the 5% pre-start took effect, a full-scale click on the maxed stream. The stream is now capped at the alarm's configured volume (still independent of the device's own level, so it rings at device-volume 0), and the player ramps from ~5% up to its full range under that cap. Perceived peak is the configured fraction of the device maximum, reached gradually; the opening click drops to the configured fraction instead of full scale.
This commit is contained in:
+8
-1
@@ -378,8 +378,15 @@ class _PaginaPrincipalState extends State<_PaginaPrincipal> {
|
||||
// effect for the whole ring, including fallback-WAV-only alarms that
|
||||
// never reach the station-playback branch below (Requirement:
|
||||
// Ring-scoped device-volume override).
|
||||
//
|
||||
// The media stream is capped at the alarm's CONFIGURED volume, not the
|
||||
// device max: this makes the ring independent of the device's own volume
|
||||
// (audible even at 0) while keeping "50%" meaning 50% of the phone's
|
||||
// maximum. The player then ramps from ~5% up to full under this cap, so
|
||||
// the perceived peak is exactly the configured fraction of max, reached
|
||||
// gradually — not the device-relative level, and not a full-blast max.
|
||||
await context.read<EstadoAlarmas>().android.forzarVolumenMediaParaAlarma(
|
||||
1.0,
|
||||
alarma.volumen.clamp(0.0, 1.0),
|
||||
);
|
||||
if (!mounted) return;
|
||||
final emisora = alarma.emisora;
|
||||
|
||||
Reference in New Issue
Block a user