summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSpike Sprague <spikuru@google.com>2014-09-24 01:47:39 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-09-24 01:47:39 +0000
commitd8dbf53c7235456fc2fd3e0e77e50e5d6c00a753 (patch)
tree732f0b2a516e414cc9772b842afd1f6578d2714f
parentc89420a6c2e44b17a7dcc556f9a633db58ba4ab5 (diff)
parenteeeed4fa00ed842050bc7e0edd3b37c262802a5b (diff)
downloadandroid_packages_apps_Camera2-d8dbf53c7235456fc2fd3e0e77e50e5d6c00a753.tar.gz
android_packages_apps_Camera2-d8dbf53c7235456fc2fd3e0e77e50e5d6c00a753.tar.bz2
android_packages_apps_Camera2-d8dbf53c7235456fc2fd3e0e77e50e5d6c00a753.zip
am eeeed4fa: new sounds for timer ticker and pano / photosphere intermediate captures
* commit 'eeeed4fa00ed842050bc7e0edd3b37c262802a5b': new sounds for timer ticker and pano / photosphere intermediate captures
-rw-r--r--res/raw/beep_once.oggbin6656 -> 0 bytes
-rw-r--r--res/raw/beep_twice.oggbin6979 -> 0 bytes
-rw-r--r--res/raw/shutter.oggbin0 -> 7014 bytes
-rw-r--r--res/raw/staged_shot_complete.oggbin0 -> 12171 bytes
-rw-r--r--res/raw/timer_final_second.oggbin0 -> 7617 bytes
-rw-r--r--res/raw/timer_increment.oggbin0 -> 7755 bytes
-rw-r--r--sounds/shutter.wavbin0 -> 79340 bytes
-rw-r--r--sounds/staged_shot_complete.wavbin0 -> 200012 bytes
-rw-r--r--sounds/timer_final_second.wavbin0 -> 125360 bytes
-rw-r--r--sounds/timer_increment.wavbin0 -> 125360 bytes
-rw-r--r--src/com/android/camera/CaptureModule.java12
-rw-r--r--src/com/android/camera/PhotoModule.java48
-rw-r--r--src/com/android/camera/SoundClips.java4
13 files changed, 53 insertions, 11 deletions
diff --git a/res/raw/beep_once.ogg b/res/raw/beep_once.ogg
deleted file mode 100644
index 06e8be898..000000000
--- a/res/raw/beep_once.ogg
+++ /dev/null
Binary files differ
diff --git a/res/raw/beep_twice.ogg b/res/raw/beep_twice.ogg
deleted file mode 100644
index 94a7c141f..000000000
--- a/res/raw/beep_twice.ogg
+++ /dev/null
Binary files differ
diff --git a/res/raw/shutter.ogg b/res/raw/shutter.ogg
new file mode 100644
index 000000000..503991b6b
--- /dev/null
+++ b/res/raw/shutter.ogg
Binary files differ
diff --git a/res/raw/staged_shot_complete.ogg b/res/raw/staged_shot_complete.ogg
new file mode 100644
index 000000000..89882eaae
--- /dev/null
+++ b/res/raw/staged_shot_complete.ogg
Binary files differ
diff --git a/res/raw/timer_final_second.ogg b/res/raw/timer_final_second.ogg
new file mode 100644
index 000000000..79945f28f
--- /dev/null
+++ b/res/raw/timer_final_second.ogg
Binary files differ
diff --git a/res/raw/timer_increment.ogg b/res/raw/timer_increment.ogg
new file mode 100644
index 000000000..e8d9d023c
--- /dev/null
+++ b/res/raw/timer_increment.ogg
Binary files differ
diff --git a/sounds/shutter.wav b/sounds/shutter.wav
new file mode 100644
index 000000000..dfb26af9f
--- /dev/null
+++ b/sounds/shutter.wav
Binary files differ
diff --git a/sounds/staged_shot_complete.wav b/sounds/staged_shot_complete.wav
new file mode 100644
index 000000000..da6f2ef10
--- /dev/null
+++ b/sounds/staged_shot_complete.wav
Binary files differ
diff --git a/sounds/timer_final_second.wav b/sounds/timer_final_second.wav
new file mode 100644
index 000000000..350929ae9
--- /dev/null
+++ b/sounds/timer_final_second.wav
Binary files differ
diff --git a/sounds/timer_increment.wav b/sounds/timer_increment.wav
new file mode 100644
index 000000000..af9229863
--- /dev/null
+++ b/sounds/timer_increment.wav
Binary files differ
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index 07d779a35..af1fb06fa 100644
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -395,9 +395,9 @@ public class CaptureModule extends CameraModule
@Override
public void onRemainingSecondsChanged(int remainingSeconds) {
if (remainingSeconds == 1) {
- mCountdownSoundPlayer.play(R.raw.beep_twice, 0.6f);
+ mCountdownSoundPlayer.play(R.raw.timer_final_second, 0.6f);
} else if (remainingSeconds == 2 || remainingSeconds == 3) {
- mCountdownSoundPlayer.play(R.raw.beep_once, 0.6f);
+ mCountdownSoundPlayer.play(R.raw.timer_increment, 0.6f);
}
}
@@ -561,8 +561,8 @@ public class CaptureModule extends CameraModule
initSurface(mPreviewTexture);
}
- mCountdownSoundPlayer.loadSound(R.raw.beep_once);
- mCountdownSoundPlayer.loadSound(R.raw.beep_twice);
+ mCountdownSoundPlayer.loadSound(R.raw.timer_final_second);
+ mCountdownSoundPlayer.loadSound(R.raw.timer_increment);
}
@Override
@@ -571,8 +571,8 @@ public class CaptureModule extends CameraModule
cancelCountDown();
resetTextureBufferSize();
closeCamera();
- mCountdownSoundPlayer.unloadSound(R.raw.beep_once);
- mCountdownSoundPlayer.unloadSound(R.raw.beep_twice);
+ mCountdownSoundPlayer.unloadSound(R.raw.timer_final_second);
+ mCountdownSoundPlayer.unloadSound(R.raw.timer_increment);
// Remove delayed resume trigger, if it hasn't been executed yet.
mMainHandler.removeCallbacksAndMessages(null);
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index 8f42014bd..878bc00bc 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -29,7 +29,9 @@ import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.location.Location;
+import android.media.AudioManager;
import android.media.CameraProfile;
+import android.media.SoundPool;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
@@ -1583,9 +1585,9 @@ public class PhotoModule
@Override
public void onRemainingSecondsChanged(int remainingSeconds) {
if (remainingSeconds == 1) {
- mCountdownSoundPlayer.play(R.raw.beep_twice, 0.6f);
+ mCountdownSoundPlayer.play(R.raw.timer_final_second, 0.6f);
} else if (remainingSeconds == 2 || remainingSeconds == 3) {
- mCountdownSoundPlayer.play(R.raw.beep_once, 0.6f);
+ mCountdownSoundPlayer.play(R.raw.timer_increment, 0.6f);
}
}
@@ -1609,8 +1611,8 @@ public class PhotoModule
}
Log.v(TAG, "Executing onResumeTasks.");
- mCountdownSoundPlayer.loadSound(R.raw.beep_once);
- mCountdownSoundPlayer.loadSound(R.raw.beep_twice);
+ mCountdownSoundPlayer.loadSound(R.raw.timer_final_second);
+ mCountdownSoundPlayer.loadSound(R.raw.timer_increment);
if (mFocusManager != null) {
// If camera is not open when resume is called, focus manager will
// not be initialized yet, in which case it will start listening to
@@ -2469,4 +2471,42 @@ public class PhotoModule
}
});
}
+
+ /**
+ * This class manages the loading/releasing/playing of the sounds needed for
+ * countdown timer.
+ */
+ private class CountdownSoundPlayer {
+ private SoundPool mSoundPool;
+ private int mTimerIncrement;
+ private int mTimerFinalSecond;
+
+ void loadSounds() {
+ // Load the sounds.
+ if (mSoundPool == null) {
+ mSoundPool = new SoundPool(1, AudioManager.STREAM_NOTIFICATION, 0);
+ mTimerIncrement = mSoundPool.load(mAppController.getAndroidContext(), R.raw.timer_increment, 1);
+ mTimerFinalSecond = mSoundPool.load(mAppController.getAndroidContext(), R.raw.timer_final_second, 1);
+ }
+ }
+
+ void onRemainingSecondsChanged(int newVal) {
+ if (mSoundPool == null) {
+ Log.e(TAG, "Cannot play sound - they have not been loaded.");
+ return;
+ }
+ if (newVal == 1) {
+ mSoundPool.play(mTimerFinalSecond, 1.0f, 1.0f, 0, 0, 1.0f);
+ } else if (newVal == 2 || newVal == 3) {
+ mSoundPool.play(mTimerIncrement, 1.0f, 1.0f, 0, 0, 1.0f);
+ }
+ }
+
+ void release() {
+ if (mSoundPool != null) {
+ mSoundPool.release();
+ mSoundPool = null;
+ }
+ }
+ }
}
diff --git a/src/com/android/camera/SoundClips.java b/src/com/android/camera/SoundClips.java
index ac06be87c..5315a847f 100644
--- a/src/com/android/camera/SoundClips.java
+++ b/src/com/android/camera/SoundClips.java
@@ -114,13 +114,15 @@ public class SoundClips {
private static final int[] SOUND_RES = { // Soundtrack res IDs.
R.raw.focus_complete,
R.raw.video_record,
+ R.raw.video_record,
+ R.raw.shutter
};
// ID returned by load() should be non-zero.
private static final int ID_NOT_LOADED = 0;
// Maps a sound action to the id;
- private final int[] mSoundRes = {0, 1, 1, 1};
+ private final int[] mSoundRes = {0, 1, 2, 3};
// Store the context for lazy loading.
private Context mContext;
// mSoundPool is created every time load() is called and cleared every