Example usage for android.media ToneGenerator startTone

List of usage examples for android.media ToneGenerator startTone

Introduction

In this page you can find the example usage for android.media ToneGenerator startTone.

Prototype

public native boolean startTone(int toneType, int durationMs);

Source Link

Document

This method starts the playback of a tone of the specified type for the specified duration.

Usage

From source file:com.example.android.camera2video.CameraActivity.java

public static void logEvent(String text) {
    ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_MUSIC, 100);
    //        tg.startTone(ToneGenerator.TONE_CDMA_PIP,150);
    tg.startTone(ToneGenerator.TONE_CDMA_ONE_MIN_BEEP, 300);

    logText(text);/*from  w w  w  .  ja va 2 s.c  o  m*/
}

From source file:uk.org.openseizuredetector.client.SdClientService.java

/**
 * beep for duration miliseconds./*from  ww w. j  a v a 2  s .  co m*/
 */
private void beep(int duration) {
    ToneGenerator toneG = new ToneGenerator(AudioManager.STREAM_ALARM, 100);
    toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, duration);
    Log.v(TAG, "beep()");
}

From source file:com.bangz.shotrecorder.RecordActivity.java

private void doStartRecord() {

    doDelayStart();//  w w w. jav a  2  s. c om

    ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_MUSIC, 100);
    tg.startTone(ToneGenerator.TONE_CDMA_ABBR_ALERT, BEEP_DURATIONMS);
    SystemClock.sleep(BEEP_DURATIONMS - 20);
    tg.stopTone();
    tg.release();

    mState = STATE_RECORDING;
    Intent intent = new Intent(this, RecordService.class);

    intent.putExtra(RecordService.EXTRA_SAMPLERATE, mSampleRate);
    intent.putExtra(RecordService.EXTRA_CHANNLES, mChannels);
    intent.putExtra(RecordService.EXTRA_ENCODDING, mEncoding);

    intent.putExtra(RecordService.EXTRA_MODE, mMode.ordinal());
    intent.putExtra(RecordService.EXTRA_MAXSHOT, this.mMaxShots);
    intent.putExtra(RecordService.EXTRA_MAXPARTIME, (int) (mMaxParTime * 1000));
    intent.putExtra(RecordService.EXTRA_CAPTURESIZE, 128);
    intent.putExtra(RecordService.EXTRA_MAXRECORDTIME, 5 * 60);
    startService(intent);

    doBindService();

    textTIME.setText(R.string.READY);
}

From source file:cl.gisred.android.RepartoActivity.java

private void alertFail() {
    ToneGenerator tgFail = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100);
    tgFail.startTone(ToneGenerator.TONE_CDMA_SOFT_ERROR_LITE, 200);

    Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
    v.vibrate(1000);//from   ww w  .j av  a  2 s  .c o m
}

From source file:com.luanthanhthai.android.liteworkouttimer.TimerFragment.java

/**
 * Sound beep// w  ww .  ja  v a 2s. c o  m
 */
public void countDownBeep(int duration) {
    if (enableSound) {
        ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_ALARM, 100);
        tg.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, duration);
    }
}