mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 10:07:38 -04:00
sound: update global volume state in sound_set_volume()
Instead of calling sound_set_volume() and then manually setting global_status.volume to match, update the global volume state directly in sound_set_volume(). This makes things a bit simpler and less error-prone. Change-Id: I4db4d60ae1a72bd051ef49c90b1ae7f5ba59e535
This commit is contained in:
parent
ae001cb60c
commit
b19b95c00f
10 changed files with 7 additions and 18 deletions
|
@ -594,9 +594,6 @@ bool option_screen(const struct settings_list *setting,
|
|||
if (!cb_on_changed || (*variable != oldvalue))
|
||||
{
|
||||
function(*variable);
|
||||
/* if the volume is changing we need to let the skins know */
|
||||
if (function == sound_get_fn(SOUND_VOLUME))
|
||||
global_status.last_volume_change = current_tick;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -877,9 +877,8 @@ void setvol(void)
|
|||
volume = max_vol;
|
||||
if (volume > global_settings.volume_limit)
|
||||
volume = global_settings.volume_limit;
|
||||
global_status.volume = volume;
|
||||
|
||||
sound_set_volume(volume);
|
||||
global_status.last_volume_change = current_tick;
|
||||
status_save(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -606,7 +606,6 @@ int beatboxmain()
|
|||
{
|
||||
vol++;
|
||||
rb->sound_set(SOUND_VOLUME, vol);
|
||||
rb->global_status->volume = vol;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -617,7 +616,6 @@ int beatboxmain()
|
|||
{
|
||||
vol--;
|
||||
rb->sound_set(SOUND_VOLUME, vol);
|
||||
rb->global_status->volume = vol;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -878,7 +878,6 @@ void M_SystemVol(int choice)
|
|||
{
|
||||
systemvol-=5;
|
||||
rb->sound_set(SOUND_VOLUME, systemvol);
|
||||
rb->global_status->volume = systemvol;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
|
@ -886,7 +885,6 @@ void M_SystemVol(int choice)
|
|||
{
|
||||
systemvol+=5;
|
||||
rb->sound_set(SOUND_VOLUME, systemvol);
|
||||
rb->global_status->volume = systemvol;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -601,7 +601,6 @@ static int midimain(const void * filename)
|
|||
{
|
||||
vol++;
|
||||
rb->sound_set(SOUND_VOLUME, vol);
|
||||
rb->global_status->volume = vol;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -614,7 +613,6 @@ static int midimain(const void * filename)
|
|||
{
|
||||
vol--;
|
||||
rb->sound_set(SOUND_VOLUME, vol);
|
||||
rb->global_status->volume = vol;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1897,10 +1897,8 @@ static void osd_set_volume(int delta)
|
|||
}
|
||||
|
||||
/* Sync the global settings */
|
||||
if (vol != rb->global_status->volume) {
|
||||
if (vol != rb->global_status->volume)
|
||||
rb->sound_set(SOUND_VOLUME, vol);
|
||||
rb->global_status->volume = vol;
|
||||
}
|
||||
|
||||
/* Update the volume display */
|
||||
osd_refresh(OSD_REFRESH_VOLUME);
|
||||
|
|
|
@ -2131,7 +2131,6 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
{
|
||||
vol++;
|
||||
rb->sound_set(SOUND_VOLUME, vol);
|
||||
rb->global_status->volume = vol;
|
||||
}
|
||||
|
||||
osc_popupmsg(OSC_MSG_VOLUME, vol);
|
||||
|
@ -2147,7 +2146,6 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
{
|
||||
vol--;
|
||||
rb->sound_set(SOUND_VOLUME, vol);
|
||||
rb->global_status->volume = vol;
|
||||
}
|
||||
|
||||
osc_popupmsg(OSC_MSG_VOLUME, vol);
|
||||
|
|
|
@ -174,7 +174,6 @@ static void set_frequency(int index)
|
|||
#ifndef HAVE_VOLUME_IN_LIST
|
||||
static void set_volume(int value)
|
||||
{
|
||||
rb->global_status->volume = value;
|
||||
rb->sound_set(SOUND_VOLUME, value);
|
||||
}
|
||||
|
||||
|
|
|
@ -654,7 +654,6 @@ static void change_volume(int delta) {
|
|||
else if (vol < minvol) vol = minvol;
|
||||
if (vol != rb->global_status->volume) {
|
||||
rb->sound_set(SOUND_VOLUME, vol);
|
||||
rb->global_status->volume = vol;
|
||||
rb->lcd_putsxyf(0,0, "%d", vol);
|
||||
rb->lcd_update();
|
||||
rb->sleep(HZ/12);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue