Skip to content
Permalink
Browse files
front: Added temporary options for configuring audio-sles buffer size…
… + buffer number
  • Loading branch information
Gillou68310 committed Apr 30, 2015
1 parent f96c9f0 commit a92ce9fc999310d3ab1308c5bc5e5500a0e76981
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 39 deletions.
@@ -329,19 +329,53 @@

<string name="audioPlugin_default" translatable="false">libmupen64plus-audio-sdl.so</string>

<!-- Audio Buffer Size -->
<string-array name="audioBufferSize_entries" translatable="false">
<item>@string/audioBufferSize_entry2048</item>
<item>@string/audioBufferSize_entry128</item>
<item>@string/audioBufferSize_entry8</item>
<!-- Audio SDL Buffer Size -->
<string-array name="audioSDLBufferSize_entries" translatable="false">
<item>@string/audioSDLBufferSize_entry2048</item>
<item>@string/audioSDLBufferSize_entry128</item>
<item>@string/audioSDLBufferSize_entry8</item>
</string-array>
<string-array name="audioBufferSize_values" translatable="false">
<string-array name="audioSDLBufferSize_values" translatable="false">
<item>2048</item>
<item>128</item>
<item>8</item>
</string-array>
</string-array>

<string name="audioSDLBufferSize_default" translatable="false">8</string>

<!-- Audio SLES Buffer Size -->
<string-array name="audioSLESBufferSize_entries" translatable="false">
<item>@string/audioSLESBufferSize_entry2048</item>
<item>@string/audioSLESBufferSize_entry1024</item>
<item>@string/audioSLESBufferSize_entry512</item>
<item>@string/audioSLESBufferSize_entry256</item>
<item>@string/audioSLESBufferSize_entry128</item>
</string-array>
<string-array name="audioSLESBufferSize_values" translatable="false">
<item>2048</item>
<item>1024</item>
<item>512</item>
<item>256</item>
<item>128</item>
</string-array>

<string name="audioBufferSize_default" translatable="false">8</string>
<string name="audioSLESBufferSize_default" translatable="false">1024</string>

<!-- Audio SLES Buffer Number -->
<string-array name="audioSLESBufferNbr_entries" translatable="false">
<item>@string/audioSLESBufferNbr_entry2</item>
<item>@string/audioSLESBufferNbr_entry3</item>
<item>@string/audioSLESBufferNbr_entry4</item>
<item>@string/audioSLESBufferNbr_entry5</item>
</string-array>
<string-array name="audioSLESBufferNbr_values" translatable="false">
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
</string-array>

<string name="audioSLESBufferNbr_default" translatable="false">2</string>

<!-- R4300 Emulator -->
<string-array name="r4300Emulator_entries" translatable="false">
@@ -353,10 +353,23 @@
<string name="audioPlugin_entrySdl">mupen64plus-audio-sdl, v2.0</string>
<string name="audioPlugin_entrySles">mupen64plus-audio-sles, v2.0</string>

<string name="audioBufferSize_title">Audio buffer size</string>
<string name="audioBufferSize_entry2048">Default</string>
<string name="audioBufferSize_entry128">Low-latency (experimental)</string>
<string name="audioBufferSize_entry8">Ultra-low latency (experimental)</string>
<string name="audioSDLBufferSize_title">Audio buffer size</string>
<string name="audioSDLBufferSize_entry2048">Default</string>
<string name="audioSDLBufferSize_entry128">Low-latency (experimental)</string>
<string name="audioSDLBufferSize_entry8">Ultra-low latency (experimental)</string>

<string name="audioSLESBufferSize_title">Audio buffer size</string>
<string name="audioSLESBufferSize_entry2048">2048</string>
<string name="audioSLESBufferSize_entry1024">1024</string>
<string name="audioSLESBufferSize_entry512">512</string>
<string name="audioSLESBufferSize_entry256">256</string>
<string name="audioSLESBufferSize_entry128">128</string>

<string name="audioSLESBufferNbr_title">Audio buffer number</string>
<string name="audioSLESBufferNbr_entry2">2</string>
<string name="audioSLESBufferNbr_entry3">3</string>
<string name="audioSLESBufferNbr_entry4">4</string>
<string name="audioSLESBufferNbr_entry5">5</string>

<string name="localeOverride_entrySystemDefault">System default</string>

@@ -155,13 +155,26 @@
android:summary="@string/selectedValue"
android:title="@string/audioPlugin_title" />
<paulscode.android.mupen64plusae.preference.CompatibleListPreference
android:defaultValue="@string/audioBufferSize_default"
android:entries="@array/audioBufferSize_entries"
android:entryValues="@array/audioBufferSize_values"
android:key="audioBufferSize"
android:defaultValue="@string/audioSDLBufferSize_default"
android:entries="@array/audioSDLBufferSize_entries"
android:entryValues="@array/audioSDLBufferSize_values"
android:key="audioSDLBufferSize"
android:summary="@string/selectedValue"
android:title="@string/audioBufferSize_title" />

android:title="@string/audioSDLBufferSize_title" />
<paulscode.android.mupen64plusae.preference.CompatibleListPreference
android:defaultValue="@string/audioSLESBufferSize_default"
android:entries="@array/audioSLESBufferSize_entries"
android:entryValues="@array/audioSLESBufferSize_values"
android:key="audioSLESBufferSize"
android:summary="@string/selectedValue"
android:title="@string/audioSLESBufferSize_title" />
<paulscode.android.mupen64plusae.preference.CompatibleListPreference
android:defaultValue="@string/audioSLESBufferNbr_default"
android:entries="@array/audioSLESBufferNbr_entries"
android:entryValues="@array/audioSLESBufferNbr_values"
android:key="audioSLESBufferNbr"
android:summary="@string/selectedValue"
android:title="@string/audioSLESBufferNbr_title" />
<CheckBoxPreference
android:defaultValue="true"
android:key="audioSynchronize"
@@ -59,7 +59,9 @@ public class SettingsGlobalActivity extends PreferenceActivity implements OnPref
private static final String VIDEO_POLYGON_OFFSET = "videoPolygonOffset";
private static final String VIDEO_HARDWARE_TYPE = "videoHardwareType";
private static final int VIDEO_HARDWARE_TYPE_CUSTOM = 999;
private static final String AUDIO_BUFFER_SIZE = "audioBufferSize";
private static final String AUDIO_SDL_BUFFER_SIZE = "audioSDLBufferSize";
private static final String AUDIO_SLES_BUFFER_SIZE = "audioSLESBufferSize";
private static final String AUDIO_SLES_BUFFER_NBR = "audioSLESBufferNbr";
private static final String AUDIO_SYNCHRONIZE = "audioSynchronize";
private static final String AUDIO_SWAP_CHANNELS = "audioSwapChannels";
private static final String TOUCHSCREEN_FEEDBACK = "touchscreenFeedback";
@@ -69,6 +71,9 @@ public class SettingsGlobalActivity extends PreferenceActivity implements OnPref
private static final String ACTION_RELOAD_ASSETS = "actionReloadAssets";
private static final String ACTION_RESET_USER_PREFS = "actionResetUserPrefs";

private static final String AUDIO_SDL_PLUGIN = "libmupen64plus-audio-sdl.so";
private static final String AUDIO_SLES_PLUGIN = "libmupen64plus-audio-sles.so";

// App data and user preferences
private AppData mAppData = null;
private UserPrefs mUserPrefs = null;
@@ -175,7 +180,9 @@ private void refreshViews()
PrefUtil.enablePreference( this, VIDEO_POLYGON_OFFSET, mUserPrefs.videoHardwareType == VIDEO_HARDWARE_TYPE_CUSTOM );

// Enable audio prefs if audio is enabled
PrefUtil.enablePreference( this, AUDIO_BUFFER_SIZE, mUserPrefs.audioPlugin.enabled );
PrefUtil.enablePreference( this, AUDIO_SDL_BUFFER_SIZE, mUserPrefs.audioPlugin.name.equals( AUDIO_SDL_PLUGIN ) );
PrefUtil.enablePreference( this, AUDIO_SLES_BUFFER_SIZE, mUserPrefs.audioPlugin.name.equals( AUDIO_SLES_PLUGIN ) );
PrefUtil.enablePreference( this, AUDIO_SLES_BUFFER_NBR, mUserPrefs.audioPlugin.name.equals( AUDIO_SLES_PLUGIN ) );
PrefUtil.enablePreference( this, AUDIO_SYNCHRONIZE, mUserPrefs.audioPlugin.enabled );
PrefUtil.enablePreference( this, AUDIO_SWAP_CHANNELS, mUserPrefs.audioPlugin.enabled );
}
@@ -93,7 +93,9 @@ public class SplashActivity extends Activity implements ExtractAssetsListener
private static final String DISPLAY_SCALING = "displayScaling";
private static final String VIDEO_HARDWARE_TYPE = "videoHardwareType";
private static final String AUDIO_PLUGIN = "audioPlugin";
private static final String AUDIO_BUFFER_SIZE = "audioBufferSize";
private static final String AUDIO_SDL_BUFFER_SIZE = "audioSDLBufferSize";
private static final String AUDIO_SLES_BUFFER_SIZE = "audioSLESBufferSize";
private static final String AUDIO_SLES_BUFFER_NBR = "audioSLESBufferNbr";
private static final String TOUCHSCREEN_STYLE = "touchscreenStyle";
private static final String TOUCHSCREEN_AUTO_HOLD = "touchscreenAutoHold";
private static final String TOUCHPAD_LAYOUT = "touchpadLayout";
@@ -128,7 +130,9 @@ public void onCreate( Bundle savedInstanceState )
PrefUtil.validateListPreference( res, mPrefs, DISPLAY_SCALING, R.string.displayScaling_default, R.array.displayScaling_values );
PrefUtil.validateListPreference( res, mPrefs, VIDEO_HARDWARE_TYPE, R.string.videoHardwareType_default, R.array.videoHardwareType_values );
PrefUtil.validateListPreference( res, mPrefs, AUDIO_PLUGIN, R.string.audioPlugin_default, R.array.audioPlugin_values );
PrefUtil.validateListPreference( res, mPrefs, AUDIO_BUFFER_SIZE, R.string.audioBufferSize_default, R.array.audioBufferSize_values );
PrefUtil.validateListPreference( res, mPrefs, AUDIO_SDL_BUFFER_SIZE, R.string.audioSDLBufferSize_default, R.array.audioSDLBufferSize_values );
PrefUtil.validateListPreference( res, mPrefs, AUDIO_SLES_BUFFER_SIZE, R.string.audioSLESBufferSize_default, R.array.audioSLESBufferSize_values );
PrefUtil.validateListPreference( res, mPrefs, AUDIO_SLES_BUFFER_NBR, R.string.audioSLESBufferNbr_default, R.array.audioSLESBufferNbr_values );
PrefUtil.validateListPreference( res, mPrefs, TOUCHSCREEN_STYLE, R.string.touchscreenStyle_default, R.array.touchscreenStyle_values );
PrefUtil.validateListPreference( res, mPrefs, TOUCHSCREEN_AUTO_HOLD, R.string.touchscreenAutoHold_default, R.array.touchscreenAutoHold_values );
PrefUtil.validateListPreference( res, mPrefs, TOUCHPAD_LAYOUT, R.string.touchpadLayout_default, R.array.touchpadLayout_values );
@@ -53,28 +53,30 @@ public static void syncConfigFiles( GamePrefs game, UserPrefs user, AppData appD

// glide64 config file
ConfigFile glide64_conf = new ConfigFile( appData.glide64mk2_ini );
glide64_conf.put( "DEFAULT", "aspect", "2" ); // Stretch to GameSurface, Java will manage aspect ratio
glide64_conf.put( "DEFAULT", "aspect", "2" ); // Stretch to GameSurface, Java will manage aspect ratio

// Core and rice config file
ConfigFile mupen64plus_cfg = new ConfigFile( game.mupen64plus_cfg );

mupen64plus_cfg.put( "Audio-SDL", "Version", "1.000000" ); // Mupen64Plus SDL Audio Plugin config parameter version number
mupen64plus_cfg.put( "Audio-SDL", "SWAP_CHANNELS", boolToTF( user.audioSwapChannels ) ); // Swaps left and right channels
mupen64plus_cfg.put( "Audio-SDL", "SECONDARY_BUFFER_SIZE", String.valueOf( user.audioSecondaryBufferSize ) ); // Size of secondary buffer in output samples. This is SDL's hardware buffer.
mupen64plus_cfg.put( "Audio-SDL", "Version", "1.000000" ); // Mupen64Plus SDL Audio Plugin config parameter version number
mupen64plus_cfg.put( "Audio-SDL", "SWAP_CHANNELS", boolToTF( user.audioSwapChannels ) ); // Swaps left and right channels
mupen64plus_cfg.put( "Audio-SDL", "SECONDARY_BUFFER_SIZE", String.valueOf( user.audioSDLSecondaryBufferSize ) ); // Size of secondary buffer in output samples. This is SDL's hardware buffer.

mupen64plus_cfg.put( "Audio-OpenSLES", "Version", "1.000000" ); // Mupen64Plus OpenSLES Audio Plugin config parameter version number
mupen64plus_cfg.put( "Audio-OpenSLES", "SWAP_CHANNELS", boolToTF( user.audioSwapChannels ) ); // Swaps left and right channels
mupen64plus_cfg.put( "Audio-OpenSLES", "Version", "1.000000" ); // Mupen64Plus OpenSLES Audio Plugin config parameter version number
mupen64plus_cfg.put( "Audio-OpenSLES", "SWAP_CHANNELS", boolToTF( user.audioSwapChannels ) ); // Swaps left and right channels
mupen64plus_cfg.put( "Audio-OpenSLES", "SECONDARY_BUFFER_SIZE", String.valueOf( user.audioSLESSecondaryBufferSize ) ); // Size of secondary buffer in output samples. This is OpenSLES's hardware buffer.
mupen64plus_cfg.put( "Audio-OpenSLES", "SECONDARY_BUFFER_NBR", String.valueOf( user.audioSLESSecondaryBufferNbr ) ); // Number of secondary buffer.

mupen64plus_cfg.put( "Core", "Version", "1.010000" ); // Mupen64Plus Core config parameter set version number. Please don't change this version number.
mupen64plus_cfg.put( "Core", "OnScreenDisplay", "False" ); // Draw on-screen display if True, otherwise don't draw OSD
mupen64plus_cfg.put( "Core", "R4300Emulator", game.r4300Emulator ); // Use Pure Interpreter if 0, Cached Interpreter if 1, or Dynamic Recompiler if 2 or more
mupen64plus_cfg.put( "Core", "AutoStateSlotIncrement", "False" ); // Increment the save state slot after each save operation
mupen64plus_cfg.put( "Core", "ScreenshotPath", '"' + game.screenshotDir + '"' ); // Path to directory where screenshots are saved. If this is blank, the default value of ${UserConfigPath}/screenshot will be used
mupen64plus_cfg.put( "Core", "SaveStatePath", '"' + game.slotSaveDir + '"' ); // Path to directory where emulator save states (snapshots) are saved. If this is blank, the default value of ${UserConfigPath}/save will be used
mupen64plus_cfg.put( "Core", "SaveSRAMPath", '"' + game.sramDataDir + '"' ); // Path to directory where SRAM/EEPROM data (in-game saves) are stored. If this is blank, the default value of ${UserConfigPath}/save will be used
mupen64plus_cfg.put( "Core", "SharedDataPath", '"' + appData.coreSharedDataDir + '"' ); // Path to a directory to search when looking for shared data files
mupen64plus_cfg.put( "Core", "Version", "1.010000" ); // Mupen64Plus Core config parameter set version number. Please don't change this version number.
mupen64plus_cfg.put( "Core", "OnScreenDisplay", "False" ); // Draw on-screen display if True, otherwise don't draw OSD
mupen64plus_cfg.put( "Core", "R4300Emulator", game.r4300Emulator ); // Use Pure Interpreter if 0, Cached Interpreter if 1, or Dynamic Recompiler if 2 or more
mupen64plus_cfg.put( "Core", "AutoStateSlotIncrement", "False" ); // Increment the save state slot after each save operation
mupen64plus_cfg.put( "Core", "ScreenshotPath", '"' + game.screenshotDir + '"' ); // Path to directory where screenshots are saved. If this is blank, the default value of ${UserConfigPath}/screenshot will be used
mupen64plus_cfg.put( "Core", "SaveStatePath", '"' + game.slotSaveDir + '"' ); // Path to directory where emulator save states (snapshots) are saved. If this is blank, the default value of ${UserConfigPath}/save will be used
mupen64plus_cfg.put( "Core", "SaveSRAMPath", '"' + game.sramDataDir + '"' ); // Path to directory where SRAM/EEPROM data (in-game saves) are stored. If this is blank, the default value of ${UserConfigPath}/save will be used
mupen64plus_cfg.put( "Core", "SharedDataPath", '"' + appData.coreSharedDataDir + '"' ); // Path to a directory to search when looking for shared data files

mupen64plus_cfg.put( "CoreEvents", "Version", "1.000000" ); // Mupen64Plus CoreEvents config parameter set version number. Please don't change this version number.
mupen64plus_cfg.put( "CoreEvents", "Version", "1.000000" ); // Mupen64Plus CoreEvents config parameter set version number. Please don't change this version number.
mupen64plus_cfg.put( "CoreEvents", "Kbd Mapping Stop", EMPTY );
mupen64plus_cfg.put( "CoreEvents", "Kbd Mapping Fullscreen", EMPTY );
mupen64plus_cfg.put( "CoreEvents", "Kbd Mapping Save State", EMPTY );
@@ -214,7 +214,13 @@
public final boolean audioSwapChannels;

/** Size of secondary buffer in output samples. This is SDL's hardware buffer, which directly affects latency. */
public final int audioSecondaryBufferSize;
public final int audioSDLSecondaryBufferSize;

/** Size of secondary buffer in output samples. This is SLES's hardware buffer, which directly affects latency. */
public final int audioSLESSecondaryBufferSize;

/** Number of SLES secondary buffers. */
public final int audioSLESSecondaryBufferNbr;

/** True if big-screen navigation mode is enabled. */
public final boolean isBigScreenMode;
@@ -371,7 +377,10 @@ public UserPrefs( Context context )

// Audio prefs
audioSwapChannels = mPreferences.getBoolean( "audioSwapChannels", false );
audioSecondaryBufferSize = getSafeInt( mPreferences, "audioBufferSize", 2048 );
audioSDLSecondaryBufferSize = getSafeInt( mPreferences, "audioSDLBufferSize", 2048 );
audioSLESSecondaryBufferSize = getSafeInt( mPreferences, "audioSLESBufferSize", 1024 );
audioSLESSecondaryBufferNbr = getSafeInt( mPreferences, "audioSLESBufferNbr", 2 );

if( audioPlugin.enabled )
isFramelimiterEnabled = mPreferences.getBoolean( "audioSynchronize", true );
else

1 comment on commit a92ce9f

@littleguy77
Copy link
Member

@littleguy77 littleguy77 commented on a92ce9f May 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Gillou68310 Any reason not to merge the audio-sles branch into master now? Should we make it the default? If for no reason other than to ensure it gets lots of testers.

Please sign in to comment.