summaryrefslogtreecommitdiffstats
path: root/src_effects/com/cyngn/audiofx/backends/EffectsFactory.java
diff options
context:
space:
mode:
Diffstat (limited to 'src_effects/com/cyngn/audiofx/backends/EffectsFactory.java')
-rw-r--r--src_effects/com/cyngn/audiofx/backends/EffectsFactory.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/src_effects/com/cyngn/audiofx/backends/EffectsFactory.java b/src_effects/com/cyngn/audiofx/backends/EffectsFactory.java
new file mode 100644
index 0000000..e33f5f5
--- /dev/null
+++ b/src_effects/com/cyngn/audiofx/backends/EffectsFactory.java
@@ -0,0 +1,35 @@
+package com.cyngn.audiofx.backends;
+
+import com.cyngn.audiofx.Constants;
+
+import android.content.Context;
+import android.media.AudioDeviceInfo;
+
+/**
+ * Creates an EffectSet appropriate for the current device
+ */
+public class EffectsFactory implements IEffectFactory {
+
+ private static final String TAG = "AudioFx-EffectsFactory";
+
+ private static int sBrand = -1; // cached value to not hit io every time we need a new effect
+
+ public EffectSet createEffectSet(Context context, int sessionId,
+ AudioDeviceInfo currentDevice) {
+ // if this throws, we're screwed, don't bother to recover. these
+ // are the standard effects that every android device must have,
+ // and if they don't exist we have bigger problems.
+ return new AndroidEffects(sessionId, currentDevice);
+ }
+
+ public static int getBrand() {
+ if (sBrand == -1) {
+ sBrand = getBrandInternal();
+ }
+ return sBrand;
+ }
+
+ private static int getBrandInternal() {
+ return Constants.EFFECT_TYPE_ANDROID;
+ }
+}