Merge pull request #231 from tinywombat765/master

Add gain adjustment
This commit is contained in:
dkanada 2023-03-04 20:21:21 +09:00 committed by GitHub
commit 9cc0356c21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 0 deletions

View file

@ -238,6 +238,7 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
playback = new LocalPlayer(this); playback = new LocalPlayer(this);
playback.setListener(playbackCallbacks); playback.setListener(playbackCallbacks);
playback.setVolume(PreferenceUtil.getInstance(this).getGainOffset());
queueManager = new QueueManager(this, queueCallbacks); queueManager = new QueueManager(this, queueCallbacks);
@ -674,6 +675,9 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
initNotification(); initNotification();
updateNotification(); updateNotification();
break; break;
case PreferenceUtil.GAIN_OFFSET:
playback.setVolume(PreferenceUtil.getInstance(this).getGainOffset());
break;
} }
} }

View file

@ -81,6 +81,7 @@ public final class PreferenceUtil {
public static final String MAXIMUM_BITRATE = "maximum_bitrate"; public static final String MAXIMUM_BITRATE = "maximum_bitrate";
public static final String REMEMBER_SHUFFLE = "remember_shuffle"; public static final String REMEMBER_SHUFFLE = "remember_shuffle";
public static final String REMEMBER_QUEUE = "remember_queue"; public static final String REMEMBER_QUEUE = "remember_queue";
public static final String GAIN_OFFSET = "gain_offset";
public static final String LOCATION_DOWNLOAD = "location_download"; public static final String LOCATION_DOWNLOAD = "location_download";
public static final String LOCATION_CACHE = "location_cache"; public static final String LOCATION_CACHE = "location_cache";
@ -254,6 +255,10 @@ public final class PreferenceUtil {
return mPreferences.getBoolean(REMEMBER_QUEUE, true); return mPreferences.getBoolean(REMEMBER_QUEUE, true);
} }
public final int getGainOffset() {
return mPreferences.getInt(GAIN_OFFSET, 100);
}
public final boolean getShowAlbumCover() { public final boolean getShowAlbumCover() {
return mPreferences.getBoolean(SHOW_ALBUM_COVER, false); return mPreferences.getBoolean(SHOW_ALBUM_COVER, false);
} }

View file

@ -128,6 +128,7 @@
<string name="pref_title_download_location">Download Location</string> <string name="pref_title_download_location">Download Location</string>
<string name="pref_title_image_cache_size">Images</string> <string name="pref_title_image_cache_size">Images</string>
<string name="pref_title_media_cache_size">Media</string> <string name="pref_title_media_cache_size">Media</string>
<string name="pref_title_gain_adjustment">Gain Adjustment</string>
<string name="pref_summary_primary_color">The primary theme color for control elements.</string> <string name="pref_summary_primary_color">The primary theme color for control elements.</string>
<string name="pref_summary_accent_color">An alternate color used to accent elements.</string> <string name="pref_summary_accent_color">An alternate color used to accent elements.</string>
@ -141,6 +142,7 @@
<string name="pref_summary_remember_tab">Go to the last opened tab on launch.</string> <string name="pref_summary_remember_tab">Go to the last opened tab on launch.</string>
<string name="pref_summary_categories">Configure visibility and order of display categories.</string> <string name="pref_summary_categories">Configure visibility and order of display categories.</string>
<string name="pref_summary_direct_play_codecs">Disable direct play codecs to force transcoding.</string> <string name="pref_summary_direct_play_codecs">Disable direct play codecs to force transcoding.</string>
<string name="pref_summary_gain_adjustment">Adjust the gain of the music player\'s output</string>
<string name="delete_action">Delete</string> <string name="delete_action">Delete</string>
<string name="remove_action">Remove</string> <string name="remove_action">Remove</string>

View file

@ -45,6 +45,13 @@
android:summary="@string/pref_summary_remember_queue" android:summary="@string/pref_summary_remember_queue"
android:title="@string/pref_title_remember_queue" /> android:title="@string/pref_title_remember_queue" />
<SeekBarPreference
app:iconSpaceReserved="false"
android:defaultValue="100"
android:key="gain_offset"
android:summary="@string/pref_summary_gain_adjustment"
android:title="@string/pref_title_gain_adjustment"/>
</com.dkanada.gramophone.views.settings.JellyPreferenceCategory> </com.dkanada.gramophone.views.settings.JellyPreferenceCategory>
</androidx.preference.PreferenceScreen> </androidx.preference.PreferenceScreen>