diff --git a/app/src/main/java/xdsopl/robot36/Decoder.java b/app/src/main/java/xdsopl/robot36/Decoder.java
index 05e93f9..a8b4dcc 100644
--- a/app/src/main/java/xdsopl/robot36/Decoder.java
+++ b/app/src/main/java/xdsopl/robot36/Decoder.java
@@ -46,6 +46,7 @@ public class Decoder {
private final int[] savedWidth;
private final int[] savedHeight;
private final float[] volume;
+ private int updateRate = 1;
private final RenderScript rs;
private final Allocation rsDecoderAudioBuffer;
@@ -165,6 +166,9 @@ public class Decoder {
void scottieDX_mode() { rsDecoder.invoke_scottieDX_mode(); }
void wrasseSC2_180_mode() { rsDecoder.invoke_wrasseSC2_180_mode(); }
+
+ void increaseUpdateRate() { updateRate = Math.min(4, updateRate + 1); }
+ void decreaseUpdateRate() { updateRate = Math.max(0, updateRate - 1); }
void updateTitle(int id) { activity.updateTitle(activity.getString(id)); }
void switch_mode(int mode)
@@ -245,7 +249,7 @@ public class Decoder {
}
void decode() {
- int samples = audio.read(audioBuffer, 0, audioBuffer.length);
+ int samples = audio.read(audioBuffer, 0, audioBuffer.length >> updateRate);
if (samples <= 0)
return;
diff --git a/app/src/main/java/xdsopl/robot36/MainActivity.java b/app/src/main/java/xdsopl/robot36/MainActivity.java
index 5d87867..8c4ee58 100644
--- a/app/src/main/java/xdsopl/robot36/MainActivity.java
+++ b/app/src/main/java/xdsopl/robot36/MainActivity.java
@@ -199,6 +199,12 @@ public class MainActivity extends Activity {
decoder.enable_analyzer(enableAnalyzer ^= true);
changeLayoutOrientation(getResources().getConfiguration());
return true;
+ case R.id.action_increase_update_rate:
+ decoder.increaseUpdateRate();
+ return true;
+ case R.id.action_decrease_update_rate:
+ decoder.decreaseUpdateRate();
+ return true;
case R.id.action_raw_mode:
decoder.raw_mode();
return true;
diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml
index a913342..4e8217f 100644
--- a/app/src/main/res/menu/menu_main.xml
+++ b/app/src/main/res/menu/menu_main.xml
@@ -20,6 +20,10 @@
android:orderInCategory="100" android:showAsAction="never" />
+
+
- Toggle Auto Mode
Toggle Debug Mode
Toggle Analyzer
+ Increase Update Rate
+ Decrease Update Rate
Raw Mode
Robot36 Mode
Robot72 Mode