List of usage examples for android.media AudioFormat CHANNEL_CONFIGURATION_DEFAULT
int CHANNEL_CONFIGURATION_DEFAULT
To view the source code for android.media AudioFormat CHANNEL_CONFIGURATION_DEFAULT.
Click Source Link
From source file:Main.java
/** * Convert integers to AudioFormat.CHANNEL_CONFIGURATION constants * //ww w . j a v a 2 s .c om * @param numChannels * number of channels, typically 1 or 2 */ public static int getAndroidChannelConfig(int numChannels) { switch (numChannels) { case 1: return AudioFormat.CHANNEL_CONFIGURATION_MONO; case 2: return AudioFormat.CHANNEL_CONFIGURATION_STEREO; default: return AudioFormat.CHANNEL_CONFIGURATION_DEFAULT; } }
From source file:re.serialout.MainScreen.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);/* ww w .j a v a2 s . com*/ //Set up patient tracking dbhelper = new PatientDbHelper(this); //Set up communications AudioSerialOutMono.activate(); AudioSerialOutMono.context = this.getApplicationContext(); for (int rate : new int[] { 8000, 11025, 16000, 22050, 44100 }) { //Just here to make sure that the buffer types we are using are ok for the phone. //Debug thing. int bufferSize = AudioRecord.getMinBufferSize(rate, AudioFormat.CHANNEL_CONFIGURATION_DEFAULT, AudioFormat.ENCODING_PCM_16BIT); if (bufferSize > 0) { System.out.println("Buffer size not 0 for rate: " + rate); } } am = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE); am.registerMediaButtonEventReceiver(new ComponentName(this, ButtonReciver.class)); setUpFreqSlider(); // playSine.start(); playSine.adjustFreq(14000); TextView pHoutput = (TextView) findViewById(R.id.instrText); //Check for pateint ID and log patient in commandInterface = new CommandInterface(buadRate, this.getApplicationContext(), pHoutput); if (savedInstanceState != null) { idSet = savedInstanceState.getBoolean("idSet"); if (idSet) { idText = savedInstanceState.getString("idText"); hideIDViews(); settings = dbhelper.getSettings(Integer.parseInt(idText)); if (settings.isFirstTime()) { Intent intent = new Intent(this, DemographicActivity.class); intent.putExtra("patientID", idText); startActivity(intent); } if (settings.isSurveyReady()) { (findViewById(R.id.startSurvey)).setVisibility(View.VISIBLE); } } } SharedPreferences sharedPreferences = getPreferences(MODE_PRIVATE); clincMode = sharedPreferences.getBoolean("clincMode", false); if (!clincMode) { System.out.println("Not in clinic mode"); idSet = sharedPreferences.getBoolean("idSet", false); if (idSet) { idText = sharedPreferences.getString("idText", ""); System.out.println("id is: " + idText); hideIDViews(); } } // new checkForUpdates().execute(); }