Code example for AudioTrack

Methods: getPlayStatestop

5
	public void connect() { 
		Log.i("Connection","connect: "+server+":"+port);
		try { 
			socket = new Socket();
			socket.connect(new InetSocketAddress(server,port),5000);
			inputStream = socket.getInputStream();
			outputStream = socket.getOutputStream();
		 
		 
		    audioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, 8000,
				AudioFormat.CHANNEL_CONFIGURATION_MONO,
				AudioFormat.ENCODING_PCM_16BIT, AUDIO_BUFFER_SIZE * 2,
				AudioTrack.MODE_STREAM);
		 
		    audioTrack.play();
		     
		    sendCommand("setClient aHPSDR(v1.1)"); 
		     
		} catch (Exception e) {
			Log.e("Connection", "Error creating socket for " + server + ":"
					+ port + "'" + e.getMessage() + "'");