Commits

kunstmusik committed 2a7bed0

initial commit

Comments (0)

Files changed (27)

+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="gen"/>
+	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+	<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+	<classpathentry kind="output" path="bin/classes"/>
+</classpath>
+*DS_Store
+obj
+libs
+bin
+gen
+src/csnd*
+*swp
+jni/csound_orc*
+jni/csound_prelex.c
+jni/java_interface*
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>Vt</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.android.ide.eclipse.adt.ApkBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

.settings/org.eclipse.jdt.core.prefs

+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.source=1.5

AndroidManifest.xml

+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.kunstmusik.touchvoice"
+    android:versionCode="1"
+    android:versionName="1.0" >
+
+    <uses-sdk
+        android:minSdkVersion="8"
+        android:targetSdkVersion="15" />
+
+    <application
+        android:icon="@drawable/ic_launcher"
+        android:label="@string/app_name"
+        android:theme="@style/AppTheme" >
+        
+        <activity
+            android:name=".MainActivity"
+            android:label="@string/title_activity_main"
+            android:screenOrientation="landscape"
+            android:configChanges="orientation|keyboardHidden" >
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+    </application>
+
+</manifest>

ic_launcher-web.png

Added
New image
+<?xml version="1.0" encoding="UTF-8"?>
+<lint>
+</lint>

proguard-project.txt

+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}

project.properties

+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-16
+android.library.reference.1=../../../work/csound/csound5/android/CsoundAndroid

res/drawable-hdpi/ic_action_search.png

Added
New image

res/drawable-hdpi/ic_launcher.png

Added
New image

res/drawable-ldpi/ic_launcher.png

Added
New image

res/drawable-mdpi/ic_action_search.png

Added
New image

res/drawable-mdpi/ic_launcher.png

Added
New image

res/drawable-xhdpi/ic_action_search.png

Added
New image

res/drawable-xhdpi/ic_launcher.png

Added
New image

res/layout/activity_main.xml

+<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/LinearLayout1"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:orientation="horizontal" >
+
+    <TableRow
+        android:id="@+id/tableRow1"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent" >
+
+        <com.kunstmusik.touchvoice.MultiTouchView
+            android:id="@+id/view1"
+            android:layout_weight="50"
+            android:background="@color/bgcolor" />
+
+        <com.kunstmusik.touchvoice.MultiTouchView
+            android:id="@+id/view2"
+            android:layout_weight="50" />
+    </TableRow>
+	
+</TableLayout>

res/menu/activity_main.xml

+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:id="@+id/menu_settings"
+        android:title="@string/menu_settings"
+        android:orderInCategory="100"
+        android:showAsAction="never" />
+</menu>

res/raw/multitouch_xy.csd

+<CsoundSynthesizer>
+<CsOptions>
+-o dac -+rtaudio=null -d   -b512
+</CsOptions>
+<CsInstruments>
+nchnls=2
+0dbfs=1
+ksmps=64
+sr = 44100
+
+ga1 init 0
+
+	opcode vowel2,a,aki
+
+asig,kmorf,imode xin
+
+imorf	ftgentmp 0, 0, 16, 10, 1; must be 16 elements long because vowels are in tables of length 16
+ifenv	ftgentmp 0, 0, 4096, 19, .5, .5, 270, .5
+ivib	ftgentmp 0, 0, 4096, 10, 1
+
+itables chnget "vowel2.tables"
+
+
+if(itables == 0) then
+
+ibass_a		ftgen 0, 0, 16, -2, 600, 1040, 2250, 2450, 2750, 0,  -7,  -9,  -9, -20, 60, 70, 110, 120, 130
+ibass_e		ftgen 0, 0, 16, -2, 400, 1620, 2400, 2800, 3100, 0, -12,  -9, -12, -18, 40, 80, 100, 120, 120
+ibass_i		ftgen 0, 0, 16, -2, 350, 1700, 2700, 3700, 4950, 0, -20, -30, -22, -28, 60, 90, 100, 120, 120
+ibass_o		ftgen 0, 0, 16, -2, 450, 800,  2830, 3500, 4950, 0, -11, -21, -20, -40, 40, 80, 100, 120, 120
+ibass_u		ftgen 0, 0, 16, -2, 325, 700,  2530, 3500, 4950, 0, -20, -32, -28, -36, 40, 80, 100, 120, 120
+
+itenor_a	ftgen 0, 0, 16, -2, 650, 1080, 2650, 2900, 3250, 0,  -6,  -7,  -8, -22, 80, 90, 120, 130, 140	
+itenor_e	ftgen 0, 0, 16, -2, 400, 1700, 2600, 3200, 3580, 0, -14, -12, -14, -20, 70, 80, 100, 120, 120	
+itenor_i	ftgen 0, 0, 16, -2, 290, 1870, 2800, 3250, 3540, 0, -15, -18, -20, -30, 40, 90, 100, 120, 120	
+itenor_o	ftgen 0, 0, 16, -2, 400,  800, 2600, 2800, 3000, 0, -10, -12, -12, -26, 70, 80, 100, 130, 135	
+itenor_u	ftgen 0, 0, 16, -2, 350,  600, 2700, 2900, 3300, 0, -20, -17, -14, -26, 40, 60, 100, 120, 120
+
+icountertenor_a	ftgen 990, 0, 16, -2, 660, 1120, 2750, 3000, 3350, 0,  -6, -23, -24, -38, 80, 90, 120, 130, 140	
+icountertenor_e	ftgen 991, 0, 16, -2, 440, 1800, 2700, 3000, 3300, 0, -14, -18, -20, -20, 70, 80, 100, 120, 120	
+icountertenor_i	ftgen 992, 0, 16, -2, 270, 1850, 2900, 3350, 3590, 0, -24, -24, -36, -36, 40, 90, 100, 120, 120	
+icountertenor_o	ftgen 993, 0, 16, -2, 430,  820, 2700, 3000, 3300, 0, -10, -26, -22, -34, 40, 80, 100, 120, 120	
+icountertenor_u	ftgen 994, 0, 16, -2, 370,  630, 2750, 3000, 3400, 0, -20, -23, -30, -34, 40, 60, 100, 120, 120
+
+ialto_a		ftgen 0, 0, 16, -2, 800, 1150, 2800, 3500, 4950, 0,  -4, -20, -36, -60, 80,  90, 120, 130, 140
+ialto_e		ftgen 0, 0, 16, -2, 400, 1600, 2700, 3300, 4950, 0, -24, -30, -35, -60, 60,  80, 120, 150, 200
+ialto_i		ftgen 0, 0, 16, -2, 350, 1700, 2700, 3700, 4950, 0, -20, -30, -36, -60, 50, 100, 120, 150, 200
+ialto_o		ftgen 0, 0, 16, -2, 450, 800,  2830, 3500, 4950, 0,  -9, -16, -28, -55, 70,  80, 100, 130, 135
+ialto_u		ftgen 0, 0, 16, -2, 325, 700,  2530, 3500, 4950, 0, -12, -30, -40, -64, 50,  60, 170, 180, 200
+
+isoprano_a	ftgen 0, 0, 16, -2, 800, 1150, 2900, 3900, 4950, 0,  -6, -32, -20, -50, 80,  90, 120, 130, 140	
+isoprano_e	ftgen 0, 0, 16, -2, 350, 2000, 2800, 3600, 4950, 0, -20, -15, -40, -56, 60, 100, 120, 150, 200	
+isoprano_i	ftgen 0, 0, 16, -2, 270, 2140, 2950, 3900, 4950, 0, -12, -26, -26, -44, 60,  90, 100, 120, 120	
+isoprano_o	ftgen 0, 0, 16, -2, 450,  800, 2830, 3800, 4950, 0, -11, -22, -22, -50, 40,  80, 100, 120, 120	
+isoprano_u	ftgen 0, 0, 16, -2, 325,  700, 2700, 3800, 4950, 0, -16, -35, -40, -60, 50,  60, 170, 180, 200
+
+itables		ftgen 0, 0, -25, -2, ibass_a, ibass_e, ibass_i, ibass_o, ibass_u, \
+				itenor_a, itenor_e, itenor_i, itenor_o, itenor_u, \
+				icountertenor_a, icountertenor_e, icountertenor_i, icountertenor_o, icountertenor_u, \
+				ialto_a, ialto_e, ialto_i, ialto_o, ialto_u, \
+				isoprano_a, isoprano_e, isoprano_i, isoprano_o, isoprano_u
+
+chnset itables, "vowel2.tables"
+
+endif
+
+istartIndex = imode * 5
+ia table istartIndex, itables
+ie table istartIndex + 1, itables
+ii table istartIndex + 2, itables
+io table istartIndex + 3, itables
+iu table istartIndex + 4, itables
+
+index	ftgentmp 0, 0, 16, -2, ia, ie, ii, ia, io, iu, ie, io, ii, iu, ia, io, ia, ia, ia, ia, ia
+
+	ftmorf	kmorf, index, imorf
+
+kfx	=	0
+kform1	table	kfx,   imorf
+kform2	table	kfx+1, imorf
+kform3	table	kfx+2, imorf
+kform4	table	kfx+3, imorf
+kform5	table	kfx+4, imorf
+kamp1	table	kfx+5, imorf
+kamp2	table	kfx+6, imorf
+kamp3	table	kfx+7, imorf
+kamp4	table	kfx+8, imorf
+kamp5	table	kfx+9, imorf
+kbw1	table	kfx+10,imorf
+kbw2	table	kfx+11,imorf
+kbw3	table	kfx+12, imorf
+kbw4	table	kfx+13, imorf
+kbw5	table	kfx+14, imorf
+
+;iolaps	=	200
+
+a1 butbp asig*db(kamp1), kform1, kbw1
+a2 butbp asig*db(kamp2), kform2, kbw2
+a3 butbp asig*db(kamp3), kform3, kbw3
+a4 butbp asig*db(kamp4), kform4, kbw4
+a5 butbp asig*db(kamp5), kform5, kbw5
+
+asig	=	a1+a2+a3+a4+a5
+
+	xout	asig
+
+
+	endop
+
+instr 1
+itie tival
+i_instanceNum = p4
+S_xName sprintf "touch.%d.x", i_instanceNum
+S_yName sprintf "touch.%d.y", i_instanceNum
+
+kx chnget S_xName
+ky chnget S_yName
+
+kenv linsegr 0, .001, 1, .1, 1, .25, 0
+a1 vco2 ky * .5 * kenv, 60 + (log(1 - kx) * 3000), 0
+
+ga1 = ga1 + a1
+
+endin
+
+instr 2
+
+ibp_max_width = 200
+
+kbp_freq0 chnget "touch.0.bp_freq"
+kbp_freq1 chnget "touch.1.bp_freq"
+kbp_freq2 chnget "touch.2.bp_freq"
+kbp_freq3 chnget "touch.3.bp_freq"
+kbp_freq4 chnget "touch.4.bp_freq"
+
+kbp_width0 chnget "touch.0.bp_width"
+kbp_width1 chnget "touch.1.bp_width"
+kbp_width2 chnget "touch.2.bp_width"
+kbp_width3 chnget "touch.3.bp_width"
+kbp_width4 chnget "touch.4.bp_width"
+
+#define BP(num) #
+if(kbp_width$num > 0) then
+	a$num butterbp ga1, 60 + (log(1 - kbp_freq$num) * 3000), kbp_width$num * ibp_max_width
+else
+	a$num = 0
+endif
+#
+
+$BP(0)
+$BP(1)
+$BP(2)
+$BP(3)
+$BP(4)
+
+;a2 butterbp ga1, 60 + (log(1 - kbp_freq1) * 3000), kbp_width1 * ibp_max_width
+;a3 butterbp ga1, 60 + (log(1 - kbp_freq2) * 3000), kbp_width2 * ibp_max_width
+;a4 butterbp ga1, 60 + (log(1 - kbp_freq3) * 3000), kbp_width3 * ibp_max_width
+;a5 butterbp ga1, 60 + (log(1 - kbp_freq4) * 3000), kbp_width4 * ibp_max_width
+
+asum sum a0, a1, a2, a3, a4
+
+asum balance asum, ga1
+
+;a1 moogladder ga1, kcutoff, kresonance
+
+aL, aR reverbsc asum, asum, .72, 5000
+
+outs aL, aR
+
+ga1 = 0
+
+endin
+
+
+</CsInstruments>
+<CsScore>
+f1 0 16384 10 1
+
+i2 0 360000
+ 
+</CsScore>
+</CsoundSynthesizer>

res/values-v11/styles.xml

+<resources>
+
+    <style name="AppTheme" parent="android:Theme.Holo.Light" />
+
+</resources>

res/values-v14/styles.xml

+<resources>
+
+    <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar" />
+
+</resources>

res/values/colors.xml

+
+    <resources>
+        <color name="bgcolor">#00FF00</color>
+    </resources>

res/values/strings.xml

+<resources>
+
+    <string name="app_name">Vt</string>
+    <string name="hello_world">Hello world!</string>
+    <string name="menu_settings">Settings</string>
+    <string name="title_activity_main">VoiceTouch</string>
+
+</resources>

res/values/styles.xml

+<resources>
+
+    <style name="AppTheme" parent="android:Theme.Light" />
+
+</resources>

src/com/kunstmusik/touchvoice/BaseCsoundActivity.java

+/* 
+ 
+ BaseCsoundActivity.java:
+ 
+ Copyright (C) 2011 Victor Lazzarini, Steven Yi
+ 
+ This file is part of Csound Android Examples.
+ 
+ The Csound Android Examples is free software; you can redistribute it
+ and/or modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.   
+ 
+ Csound is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU Lesser General Public License for more details.
+ 
+ You should have received a copy of the GNU Lesser General Public
+ License along with Csound; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA
+ 
+ */
+
+
+package com.kunstmusik.touchvoice;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.os.Handler;
+import android.widget.SeekBar;
+
+import com.csounds.CsoundObj;
+
+public class BaseCsoundActivity extends Activity {
+	
+	protected CsoundObj csoundObj = new CsoundObj();
+	protected Handler handler = new Handler();
+	
+	@Override
+	public void onCreate(Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+	}
+	
+	@Override
+	protected void onDestroy() {
+		// TODO Auto-generated method stub
+		super.onDestroy();
+		csoundObj.stopCsound();
+		
+	}
+	
+	public void setSeekBarValue(SeekBar seekBar, double min, double max, double value) {
+		double range = max - min;
+		double percent = (value - min) / range;
+		
+		seekBar.setProgress((int)(percent * seekBar.getMax()));
+	}
+
+	
+	protected String getResourceFileAsString(int resId) {
+		StringBuilder str = new StringBuilder();
+		
+		InputStream is = getResources().openRawResource(resId);
+		BufferedReader r = new BufferedReader(new InputStreamReader(is));
+		String line;
+		
+		try {
+			while ((line = r.readLine()) != null) {
+				str.append(line).append("\n");
+			}
+		} catch (IOException ios) {
+
+		}
+		
+		return str.toString();
+	}
+
+	protected File createTempFile(String csd) {
+		File f = null;
+		
+		try {
+			f = File.createTempFile("temp", ".csd", this.getCacheDir());
+			FileOutputStream fos = new FileOutputStream(f);
+			fos.write(csd.getBytes());
+			fos.close();
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		
+		return f;
+	}
+}

src/com/kunstmusik/touchvoice/MainActivity.java

+package com.kunstmusik.touchvoice;
+
+import java.io.File;
+
+import android.os.Bundle;
+import android.view.Menu;
+
+import com.csounds.CsoundObj;
+
+public class MainActivity extends BaseCsoundActivity {
+
+	MultiTouchView view1, view2;
+
+	/** Called when the activity is first created. */
+	@Override
+	public void onCreate(Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		setContentView(R.layout.activity_main);
+
+		view1 = (MultiTouchView) findViewById(R.id.view1);
+		view2 = (MultiTouchView) findViewById(R.id.view2);
+		
+		view1.initTouch(csoundObj, 
+				null, 
+				null,
+				"touch.%d.bp_freq", 
+				"touch.%d.bp_width");
+		
+		view2.initTouch(csoundObj, 
+				"i1.%d 0 -2 %d", 
+				"i-1.%d 0 0 %d",
+				"touch.%d.x", 
+				"touch.%d.y");
+
+		
+		String csd = getResourceFileAsString(R.raw.multitouch_xy);
+		File f = createTempFile(csd);
+
+		csoundObj.addValueCacheable(view1);
+		csoundObj.addValueCacheable(view2);
+
+		csoundObj.startCsound(f);
+	}
+
+	public void csoundObjComplete(CsoundObj csoundObj) {
+
+	}
+
+	@Override
+	public boolean onCreateOptionsMenu(Menu menu) {
+		getMenuInflater().inflate(R.menu.activity_main, menu);
+		return true;
+	}
+}

src/com/kunstmusik/touchvoice/MultiTouchView.java

+package com.kunstmusik.touchvoice;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.view.View;
+
+import com.csounds.CsoundObj;
+import com.csounds.valueCacheable.CsoundValueCacheable;
+
+import csnd.CsoundMYFLTArray;
+
+public class MultiTouchView extends View implements CsoundValueCacheable {
+	
+	private static final int TOUCH_MAX = 5;
+	
+	int touchIds[] = new int[TOUCH_MAX];
+	float touchX[] = new float[TOUCH_MAX];
+	float touchY[] = new float[TOUCH_MAX];
+	CsoundMYFLTArray touchXPtr[] = new CsoundMYFLTArray[TOUCH_MAX];
+	CsoundMYFLTArray touchYPtr[] = new CsoundMYFLTArray[TOUCH_MAX];
+
+	private CsoundObj csoundObj = null;
+
+	private String scoreDownString = null;
+
+	private String scoreUpString = null;
+	
+	private String touchXString = null;
+	private String touchYString = null;
+
+	public MultiTouchView(Context context) {
+		super(context);
+	}
+	
+	public MultiTouchView(Context context, AttributeSet attr) {
+		super(context, attr);
+	}
+	
+	public MultiTouchView(Context context, AttributeSet attr, int style) {
+		super(context, attr, style);
+	}
+	
+	public void initTouch(CsoundObj csObj, String scoreDownStr, String scoreUpStr,
+			String touchXStr, String touchYStr) {
+		this.csoundObj = csObj;
+		this.scoreDownString = scoreDownStr;
+		this.scoreUpString = scoreUpStr;
+		this.touchXString = touchXStr;
+		this.touchYString = touchYStr;
+		
+		for (int i = 0; i < touchIds.length; i++) {
+			touchIds[i] = -1;
+			touchX[i] = -1;
+			touchY[i] = -1;
+		}
+
+		setOnTouchListener(new OnTouchListener() {
+
+			public boolean onTouch(View v, MotionEvent event) {
+				final int action = event.getAction() & MotionEvent.ACTION_MASK;
+				switch (action) {
+				case MotionEvent.ACTION_DOWN:
+				case MotionEvent.ACTION_POINTER_DOWN:
+
+					for (int i = 0; i < event.getPointerCount(); i++) {
+						int pointerId = event.getPointerId(i);
+						int id = getTouchId(pointerId);
+
+						if (id == -1) {
+
+							id = getTouchIdAssignment();
+
+							if (id != -1) {
+								touchIds[id] = pointerId;
+								touchX[id] = event.getX(i)
+										/ getWidth();
+								touchY[id] = 1 - (event.getY(i) / 
+										getHeight());
+
+								if (touchXPtr[id] != null) {
+									touchXPtr[id].SetValue(0, touchX[id]);
+									touchYPtr[id].SetValue(0, touchY[id]);
+
+									if(scoreDownString != null) {
+										csoundObj.sendScore(String.format(
+												scoreDownString, id, id));
+									}
+								}
+							}
+						}
+
+					}
+
+					break;
+				case MotionEvent.ACTION_MOVE:
+
+					for (int i = 0; i < event.getPointerCount(); i++) {
+						int pointerId = event.getPointerId(i);
+						int id = getTouchId(pointerId);
+
+						if (id != -1) {
+							touchX[id] = event.getX(i)
+									/ getWidth();
+							touchY[id] = 1 - (event.getY(i) / getHeight());
+						}
+
+					}
+					break;
+				case MotionEvent.ACTION_POINTER_UP:
+				case MotionEvent.ACTION_UP: {
+					int activePointerIndex = event.getActionIndex();
+					int pointerId = event.getPointerId(activePointerIndex);
+
+					int id = getTouchId(pointerId);
+					if (id != -1) {
+						touchIds[id] = -1;
+						if(scoreUpString != null) {
+							csoundObj.sendScore(String.format(
+									scoreUpString, id,
+									id));
+						}
+					}
+
+				}
+					break;
+				}
+				return true;
+			}
+
+		});
+	}
+
+	
+	protected int getTouchIdAssignment() {
+		for (int i = 0; i < touchIds.length; i++) {
+			if (touchIds[i] == -1) {
+				return i;
+			}
+		}
+		return -1;
+	}
+
+	protected int getTouchId(int touchId) {
+		for (int i = 0; i < touchIds.length; i++) {
+			if (touchIds[i] == touchId) {
+				return i;
+			}
+		}
+		return -1;
+	}
+
+
+
+	// VALUE CACHEABLE
+
+	public void setup(CsoundObj csoundObj) {
+		for (int i = 0; i < touchIds.length; i++) {
+			touchXPtr[i] = csoundObj.getInputChannelPtr(String.format(
+					touchXString, i));
+			touchYPtr[i] = csoundObj.getInputChannelPtr(String.format(
+					touchYString, i));
+		}
+	}
+
+	public void updateValuesToCsound() {
+		for (int i = 0; i < touchX.length; i++) {
+			touchXPtr[i].SetValue(0, touchX[i]);
+			touchYPtr[i].SetValue(0, touchY[i]);
+		}
+
+	}
+
+	public void updateValuesFromCsound() {
+	}
+
+	public void cleanup() {
+		for (int i = 0; i < touchIds.length; i++) {
+			touchXPtr[i].Clear();
+			touchXPtr[i] = null;
+			touchYPtr[i].Clear();
+			touchYPtr[i] = null;
+		}
+	}
+}