Add code to try to save your ears by handling a situation where the player volume was set very high some time ago and you have forgotten.
In that situation currenctly, when you play something, it will come out at the last volume set on the device, which will be that very high volume. This could happen, for example, the morning after a loud party :). The new code works as follows: If nothing has been played for a period, say a few hours, and the volume is higher than a threshold, new connections that ask for the current volume setting will be offered the default (low) volume rather than the current (very high) one. Most players, including the HomePod mini, iOS and iPadOS use this to set their initial volume. The Mac Music app retains its own setting, and the Mac System Sounds preference sometimes seems to take its setting from the Music app, but at least you can see the settings they will apply. Existing connections are unaffected, so this facility should be unobtrusive.
This commit is contained in:
@@ -224,8 +224,8 @@ typedef struct {
|
||||
pthread_mutex_t ab_mutex, flush_mutex, volume_control_mutex;
|
||||
|
||||
int fix_volume;
|
||||
double initial_airplay_volume;
|
||||
int initial_airplay_volume_set;
|
||||
double own_airplay_volume;
|
||||
int own_airplay_volume_set;
|
||||
|
||||
uint32_t timestamp_epoch, last_timestamp,
|
||||
maximum_timestamp_interval; // timestamp_epoch of zero means not initialised, could start at 2
|
||||
@@ -448,4 +448,6 @@ int64_t monotonic_timestamp(uint32_t timestamp,
|
||||
// assumes, without checking, that successive timestamps in a series always span an interval of less
|
||||
// than one minute.
|
||||
|
||||
double suggested_volume(rtsp_conn_info *conn); // volume suggested for the connection
|
||||
|
||||
#endif //_PLAYER_H
|
||||
|
||||
Reference in New Issue
Block a user