@@ -44,99 +44,361 @@


public class MainActivity extends Activity {
Button play,stop,record;
Button p1, p2, p3, p4, stop,stop2,stop3,stop4, play, play2, play3, play4, full;
private MediaRecorder myAudioRecorder;
private MediaRecorder myAudioRecorder2;
private MediaRecorder myAudioRecorder3;
private MediaRecorder myAudioRecorder4;
private String outputFile = null;
private String outputFile2 = null;
private String outputFile3 = null;
private String outputFile4 = null;
private MediaPlayer a;
private MediaPlayer a2;
private MediaPlayer a3;
private MediaPlayer a4;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

play=(Button)findViewById(R.id.button3);
stop=(Button)findViewById(R.id.button2);
record=(Button)findViewById(R.id.button);
play = (Button) findViewById(R.id.button3);
play2 = (Button) findViewById(R.id.button10);
play3 = (Button) findViewById(R.id.button11);
play4 = (Button) findViewById(R.id.button12);
stop = (Button) findViewById(R.id.button2);
stop2 = (Button) findViewById(R.id.button7);
stop3 = (Button) findViewById(R.id.button8);
stop4 = (Button) findViewById(R.id.button9);
p1 = (Button) findViewById(R.id.button);
p2 = (Button) findViewById(R.id.button4);
p3 = (Button) findViewById(R.id.button5);
p4 = (Button) findViewById(R.id.button6);
full = (Button) findViewById(R.id.button13);

stop.setEnabled(false);
stop2.setEnabled(false);
stop3.setEnabled(false);
stop4.setEnabled(false);
play.setEnabled(false);
play2.setEnabled(false);
play3.setEnabled(false);
play4.setEnabled(false);
p2.setEnabled(false);
p3.setEnabled(false);
p4.setEnabled(false);
outputFile = Environment.getExternalStorageDirectory().getAbsolutePath() + "/recording.wav";;
outputFile2 = Environment.getExternalStorageDirectory().getAbsolutePath() + "/recording2.wav";
outputFile3 = Environment.getExternalStorageDirectory().getAbsolutePath() + "/recording3.wav";
outputFile4 = Environment.getExternalStorageDirectory().getAbsolutePath() + "/recording4.wav";

myAudioRecorder=new MediaRecorder();


myAudioRecorder = new MediaRecorder();
myAudioRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
myAudioRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
myAudioRecorder.setAudioEncoder(MediaRecorder.OutputFormat.AMR_NB);
myAudioRecorder.setOutputFile(outputFile);

record.setOnClickListener(new View.OnClickListener() {
myAudioRecorder2 = new MediaRecorder();
myAudioRecorder2.setAudioSource(MediaRecorder.AudioSource.MIC);
myAudioRecorder2.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
myAudioRecorder2.setAudioEncoder(MediaRecorder.OutputFormat.AMR_NB);
myAudioRecorder3 = new MediaRecorder();
myAudioRecorder3.setAudioSource(MediaRecorder.AudioSource.MIC);
myAudioRecorder3.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
myAudioRecorder3.setAudioEncoder(MediaRecorder.OutputFormat.AMR_NB);
myAudioRecorder4 = new MediaRecorder();
myAudioRecorder4.setAudioSource(MediaRecorder.AudioSource.MIC);
myAudioRecorder4.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
myAudioRecorder4.setAudioEncoder(MediaRecorder.OutputFormat.AMR_NB);


p1.setOnClickListener(new View.OnClickListener() {
@Override

public void onClick(View v) {
try {
myAudioRecorder.setOutputFile(outputFile);
myAudioRecorder.prepare();
myAudioRecorder.start();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//makePostRequest();
p1.setEnabled(false);
stop.setEnabled(true);


Toast.makeText(getApplicationContext(), "Recording started", Toast.LENGTH_LONG).show();
}
});

catch (IllegalStateException e) {
p2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
myAudioRecorder2.setOutputFile(outputFile2);
myAudioRecorder2.prepare();
myAudioRecorder2.start();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//makePostRequest();
p2.setEnabled(false);
stop2.setEnabled(true);

catch (IOException e) {


Toast.makeText(getApplicationContext(), "Recording started", Toast.LENGTH_LONG).show();
}
});
p3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
myAudioRecorder3.setOutputFile(outputFile3);
myAudioRecorder3.prepare();
myAudioRecorder3.start();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//makePostRequest();
record.setEnabled(false);
stop.setEnabled(true);
p3.setEnabled(false);
stop3.setEnabled(true);


Toast.makeText(getApplicationContext(), "Recording started", Toast.LENGTH_LONG).show();


}


});
p4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
myAudioRecorder4.setOutputFile(outputFile4);
myAudioRecorder4.prepare();
myAudioRecorder4.start();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//makePostRequest();
p4.setEnabled(false);
stop4.setEnabled(true);

Toast.makeText(getApplicationContext(), "Recording started", Toast.LENGTH_LONG).show();


}



});

stop.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
myAudioRecorder.stop();
myAudioRecorder.release();
myAudioRecorder = null;
myAudioRecorder.stop();
myAudioRecorder.release();
myAudioRecorder = null;

stop.setEnabled(false);
play.setEnabled(true);
stop.setEnabled(false);
play.setEnabled(true);
p2.setEnabled(true);

Toast.makeText(getApplicationContext(), "Audio recorded successfully",Toast.LENGTH_LONG).show();
}
Toast.makeText(getApplicationContext(), "Audio recorded successfully", Toast.LENGTH_LONG).show();
}
});
stop2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
myAudioRecorder2.stop();
myAudioRecorder2.release();
myAudioRecorder2 = null;

stop2.setEnabled(false);
play2.setEnabled(true);
p3.setEnabled(true);

Toast.makeText(getApplicationContext(), "Audio recorded successfully", Toast.LENGTH_LONG).show();
}
});
stop3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
myAudioRecorder3.stop();
myAudioRecorder3.release();
myAudioRecorder3 = null;

stop3.setEnabled(false);
play3.setEnabled(true);
p4.setEnabled(true);

Toast.makeText(getApplicationContext(), "Audio recorded successfully", Toast.LENGTH_LONG).show();
}
});
stop4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
myAudioRecorder4.stop();
myAudioRecorder4.release();
myAudioRecorder4 = null;

stop4.setEnabled(false);
play4.setEnabled(true);

Toast.makeText(getApplicationContext(), "Audio recorded successfully", Toast.LENGTH_LONG).show();
}
});

play.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) throws IllegalArgumentException,SecurityException,IllegalStateException {
MediaPlayer m = new MediaPlayer();
public void onClick(View v) throws IllegalArgumentException, SecurityException, IllegalStateException {
MediaPlayer m = new MediaPlayer();

try {
m.setDataSource(outputFile);
}
try {
m.setDataSource(outputFile);
} catch (IOException e) {
e.printStackTrace();
}

catch (IOException e) {
e.printStackTrace();
}
try {
m.prepare();
} catch (IOException e) {
e.printStackTrace();
}

m.start();

Toast.makeText(getApplicationContext(), "Playing audio", Toast.LENGTH_LONG).show();
}
});

play2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) throws IllegalArgumentException, SecurityException, IllegalStateException {
MediaPlayer m = new MediaPlayer();

try {
m.setDataSource(outputFile2);
} catch (IOException e) {
e.printStackTrace();
}

try {
m.prepare();
} catch (IOException e) {
e.printStackTrace();
}

m.start();

Toast.makeText(getApplicationContext(), "Playing audio", Toast.LENGTH_LONG).show();
}
});

play3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) throws IllegalArgumentException, SecurityException, IllegalStateException {
MediaPlayer m = new MediaPlayer();

try {
m.setDataSource(outputFile3);
} catch (IOException e) {
e.printStackTrace();
}

try {
m.prepare();
} catch (IOException e) {
e.printStackTrace();
}

m.start();

Toast.makeText(getApplicationContext(), "Playing audio", Toast.LENGTH_LONG).show();
}
});

play4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) throws IllegalArgumentException, SecurityException, IllegalStateException {
MediaPlayer m = new MediaPlayer();

try {
m.setDataSource(outputFile4);
} catch (IOException e) {
e.printStackTrace();
}

try {
m.prepare();
} catch (IOException e) {
e.printStackTrace();
}

m.start();

Toast.makeText(getApplicationContext(), "Playing audio", Toast.LENGTH_LONG).show();
}
});

full.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) throws IllegalArgumentException, SecurityException, IllegalStateException {
a = new MediaPlayer();
a2 = new MediaPlayer();
a3 = new MediaPlayer();
a4 = new MediaPlayer();
try {
m.prepare();
a.setDataSource(outputFile);
a2.setDataSource(outputFile2);
a3.setDataSource(outputFile3);
a4.setDataSource(outputFile4);
} catch (IOException e) {
e.printStackTrace();
}

catch (IOException e) {
try {
a.prepare();
a2.prepare();
a3.prepare();
a4.prepare();
} catch (IOException e) {
e.printStackTrace();
}

m.start();
a.start();

a2.start();

a3.start();

a4.start();


Toast.makeText(getApplicationContext(), "Playing audio", Toast.LENGTH_LONG).show();
}
});

}


@@ -42,12 +42,12 @@
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Record"
android:text="P1"
android:id="@+id/button"
android:layout_below="@+id/imageView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="59dp" />
android:layout_alignRight="@+id/button4"
android:layout_alignEnd="@+id/button4" />


<Button
android:layout_width="wrap_content"
@@ -65,5 +65,87 @@
android:layout_alignTop="@+id/button2"
android:layout_alignRight="@+id/textView"
android:layout_alignEnd="@+id/textView" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="P2"
android:id="@+id/button4"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@id/button"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="P3"
android:id="@+id/button5"
android:layout_below="@id/button4"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="P4"
android:id="@+id/button6"
android:layout_below="@+id/button5"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Stop"
android:id="@+id/button7"
android:layout_below="@+id/button2"
android:layout_centerHorizontal="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Stop"
android:id="@+id/button8"
android:layout_below="@+id/button7"
android:layout_centerHorizontal="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Stop"
android:id="@+id/button9"
android:layout_below="@+id/button8"
android:layout_centerHorizontal="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="play"
android:id="@+id/button10"
android:layout_below="@+id/button2"
android:layout_alignRight="@+id/textView"
android:layout_alignEnd="@+id/textView" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="play"
android:id="@+id/button11"
android:layout_below="@+id/button10"
android:layout_alignRight="@+id/textView"
android:layout_alignEnd="@+id/textView" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="play"
android:id="@+id/button12"
android:layout_below="@+id/button11"
android:layout_alignRight="@+id/textView"
android:layout_alignEnd="@+id/textView" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Play Full Song"
android:id="@+id/button13"
android:layout_below="@+id/button9"
android:layout_centerHorizontal="true"
android:layout_marginTop="50dp"/>



</RelativeLayout>
@@ -2,11 +2,11 @@
<items version="2" >

<item
jar="C:\Users\lazy7\.gradle\caches\modules-2\files-2.1\com.google.code.gson\gson\2.3\5fc52c41ef0239d1093a1eb7c3697036183677ce\gson-2.3.jar"
jar="C:\Users\lazy7\.gradle\caches\modules-2\files-2.1\com.microsoft.azure\azure-mobile-services-android-sdk\2.0.3\5de03bab93697321e5654831bb98df11ad4c19ac\azure-mobile-services-android-sdk-2.0.3.jar"
jumboMode="false"
revision="19.1.0"
sha1="5fc52c41ef0239d1093a1eb7c3697036183677ce">
<dex dex="C:\Projects\TamuATeam\ChorusTamu\app\build\intermediates\pre-dexed\debug\gson-2.3-d7874edbfd6b9bd1a64295ef1d763475beef089b.jar" />
sha1="5de03bab93697321e5654831bb98df11ad4c19ac">
<dex dex="C:\Projects\TamuATeam\ChorusTamu\app\build\intermediates\pre-dexed\debug\azure-mobile-services-android-sdk-2.0.3-59e3462134b7313992713d56ea659bebddeb9acf.jar" />
</item>
<item
jar="C:\Users\lazy7\.gradle\caches\modules-2\files-2.1\com.microsoft.azure\azure-notifications-handler\1.0.1\c322af100020e6db539f2aa367698d4b88fc453f\azure-notifications-handler-1.0.1.jar"
@@ -16,18 +16,18 @@
<dex dex="C:\Projects\TamuATeam\ChorusTamu\app\build\intermediates\pre-dexed\debug\azure-notifications-handler-1.0.1-fab278ecdc666fb4753fec1a84965a5892066006.jar" />
</item>
<item
jar="C:\Users\lazy7\.gradle\caches\modules-2\files-2.1\com.google.guava\guava\18.0\cce0823396aa693798f8882e64213b1772032b09\guava-18.0.jar"
jar="C:\Users\lazy7\.gradle\caches\modules-2\files-2.1\com.google.code.gson\gson\2.3\5fc52c41ef0239d1093a1eb7c3697036183677ce\gson-2.3.jar"
jumboMode="false"
revision="19.1.0"
sha1="cce0823396aa693798f8882e64213b1772032b09">
<dex dex="C:\Projects\TamuATeam\ChorusTamu\app\build\intermediates\pre-dexed\debug\guava-18.0-5cfe2cb44676f612873999ba3a6df5252ebd3897.jar" />
sha1="5fc52c41ef0239d1093a1eb7c3697036183677ce">
<dex dex="C:\Projects\TamuATeam\ChorusTamu\app\build\intermediates\pre-dexed\debug\gson-2.3-d7874edbfd6b9bd1a64295ef1d763475beef089b.jar" />
</item>
<item
jar="C:\Users\lazy7\.gradle\caches\modules-2\files-2.1\com.microsoft.azure\azure-mobile-services-android-sdk\2.0.3\5de03bab93697321e5654831bb98df11ad4c19ac\azure-mobile-services-android-sdk-2.0.3.jar"
jar="C:\Users\lazy7\.gradle\caches\modules-2\files-2.1\com.google.guava\guava\18.0\cce0823396aa693798f8882e64213b1772032b09\guava-18.0.jar"
jumboMode="false"
revision="19.1.0"
sha1="5de03bab93697321e5654831bb98df11ad4c19ac">
<dex dex="C:\Projects\TamuATeam\ChorusTamu\app\build\intermediates\pre-dexed\debug\azure-mobile-services-android-sdk-2.0.3-59e3462134b7313992713d56ea659bebddeb9acf.jar" />
sha1="cce0823396aa693798f8882e64213b1772032b09">
<dex dex="C:\Projects\TamuATeam\ChorusTamu\app\build\intermediates\pre-dexed\debug\guava-18.0-5cfe2cb44676f612873999ba3a6df5252ebd3897.jar" />
</item>

</items>
Binary file not shown.
@@ -7,5 +7,5 @@
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Sat Oct 10 04:40:17 CDT 2015
#Sat Oct 10 05:50:31 CDT 2015
sdk.dir=C\:\\Users\\lazy7\\AppData\\Local\\Android\\sdk