當前位置: 首頁>>代碼示例>>Java>>正文


Java ToneGenerator.startTone方法代碼示例

本文整理匯總了Java中android.media.ToneGenerator.startTone方法的典型用法代碼示例。如果您正苦於以下問題:Java ToneGenerator.startTone方法的具體用法?Java ToneGenerator.startTone怎麽用?Java ToneGenerator.startTone使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.media.ToneGenerator的用法示例。


在下文中一共展示了ToneGenerator.startTone方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onHandleIntent

import android.media.ToneGenerator; //導入方法依賴的package包/類
@Override
protected void onHandleIntent(@Nullable Intent intent) {
    isRunning = true;
    showForegroundNotification();
    name = intent.getStringExtra(EXTRA_ACTIVITY_TYPE);
    storage = new StorageUtil(name);
    startAccelerometer();
    try {
        Thread.sleep(Config.LENGTH_RECORDING_IN_MINUTES * 60 * 1000);
    } catch (InterruptedException e) {
    }
    stopAccelerometer();
    storage.close();
    RecorderFinishedEvent event = new RecorderFinishedEvent();
    event.activityType = name;
    EventBus.getDefault().post(event);
    isRunning = false;
    hideForegroundNotification();
    ToneGenerator beep = new ToneGenerator(AudioManager.STREAM_MUSIC, 500);
    beep.startTone(ToneGenerator.TONE_CDMA_HIGH_L, 1000);
}
 
開發者ID:apuder,項目名稱:ActivityMonitor,代碼行數:22,代碼來源:RecorderService.java

示例2: onPostExecute

import android.media.ToneGenerator; //導入方法依賴的package包/類
@Override
protected void onPostExecute(Void result) {
    super.onPostExecute(result);

    try {
        final ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100);
        tg.startTone(ToneGenerator.TONE_DTMF_0, 300);
        Thread.sleep(300);
        tg.startTone(ToneGenerator.TONE_PROP_BEEP2);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

    AAboutMe.instance.setData();

    task_save = null;

    AMain.instance.check_personal_id_status();

    AAboutMeEdit.this.finish();
}
 
開發者ID:UncleAndy,項目名稱:trust_net,代碼行數:22,代碼來源:AAboutMeEdit.java

示例3: onPostExecute

import android.media.ToneGenerator; //導入方法依賴的package包/類
@Override
protected void onPostExecute(String result) {
    super.onPostExecute(result);

    Log.d("CheckPersonalId", "Pid = "+result);

    try {
        final ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100);
        tg.startTone(ToneGenerator.TONE_DTMF_0, 300);
        Thread.sleep(300);
        tg.startTone(ToneGenerator.TONE_PROP_BEEP2);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

    show_confirm_info(result);

    task = null;
}
 
開發者ID:UncleAndy,項目名稱:trust_net,代碼行數:20,代碼來源:AConfirmOther.java

示例4: playTone

import android.media.ToneGenerator; //導入方法依賴的package包/類
public void playTone(int side, float intense) throws InterruptedException {
    int streamType = AudioManager.STREAM_MUSIC;
    ToneGenerator toneGenerator = new ToneGenerator(streamType, (int) ((1-intense)*ToneGenerator.MAX_VOLUME));
    int durationMs = 50;
    int waitTime = 50;
    int toneType;
    // left

    if (side == 0)
        toneType = ToneGenerator.TONE_DTMF_1;
    // middle
    else if (side == 1 || side == 2)
        toneType = ToneGenerator.TONE_DTMF_6;
    // right
    else
        toneType = ToneGenerator.TONE_DTMF_D;
    toneGenerator.startTone(toneType, durationMs);
    //toneGenerator.wait(durationMs + waitTime);
}
 
開發者ID:kupoko,項目名稱:Tiresias,代碼行數:20,代碼來源:PointCloudActivity.java

示例5: run

import android.media.ToneGenerator; //導入方法依賴的package包/類
public void run() {
    long timeStart = Calendar.getInstance().getTimeInMillis();
    Log.d(LOG_TAG, "FindSound Start: "+timeStart);
    ToneGenerator toneG = new ToneGenerator(AudioManager.STREAM_ALARM, ToneGenerator.MAX_VOLUME);

    while(isFinding) {
        try {
            long timeDiff =  Calendar.getInstance().getTimeInMillis() - timeStart;
            Log.d(LOG_TAG, "Sound time: " + timeDiff/1000);

            toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200); // 200 ms tone
            Thread.sleep(600L);
        }
        catch(InterruptedException ie) {
            Thread.currentThread().interrupt();
            return;
        }
    }
}
 
開發者ID:jareddlc,項目名稱:OpenFit,代碼行數:20,代碼來源:OpenFitService.java

示例6: calculateStatus

import android.media.ToneGenerator; //導入方法依賴的package包/類
private void calculateStatus(){
    currentStatus = (int)(((batteryVoltage - minVoltage) / (maxVoltage - minVoltage))*100);

    if (currentStatus!=batteryStatus){
        batteryStatus = currentStatus;

        if (System.currentTimeMillis() - timer > CHECKING_TIME){
            sendData(batteryStatus); // Send to message queue
            timer = System.currentTimeMillis();

            if(batteryStatus<1){
                // Battery protection. When battery gets dangerously low. Stop the copter.
                MainController.getInstance().emergencyStop("Drained Battery");
                ToneGenerator toneG = new ToneGenerator(AudioManager.STREAM_ALARM, 100);
                toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200);
            }
        }

    }
}
 
開發者ID:flyver,項目名稱:Flyver-Apps,代碼行數:21,代碼來源:BatteryStatus.java

示例7: onKeyDown

import android.media.ToneGenerator; //導入方法依賴的package包/類
@Override
public boolean onKeyDown(int keyCode,KeyEvent event){
	super.onKeyDown(keyCode, event);
	if(keyCode== KeyEvent.KEYCODE_DPAD_CENTER){
		final ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100);
	    tg.startTone(ToneGenerator.TONE_PROP_BEEP);
	    
	    mIsFinderActive= !mIsFinderActive;
	    
	    if(mIsFinderActive){
			mTextView.setText("Scanning...");
			mCloudRecognition.startFinding();
	    }else{
			mTextView.setText("Tap to scan");
			mCloudRecognition.stopFinding();
	    }
		return true;
	}
	return false;
}
 
開發者ID:Catchoom,項目名稱:craftar-example-glass,代碼行數:21,代碼來源:FinderActivity.java

示例8: run

import android.media.ToneGenerator; //導入方法依賴的package包/類
@Override
public void run() {
        String myString = "1010101";
        final ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 5000);
        long blinkDelay = 50; //Delay in ms
        for (int i = 0; i < myString.length(); i++) {
            if (myString.charAt(i) == '0') {
                turnOnSOS();
                tg.startTone(ToneGenerator.TONE_DTMF_6, 50);
            } else {
                turnOffSOS();
            }
            try {
                Thread.sleep(blinkDelay);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    while (!stopRunning) {
        longSOS();
    }
    }
 
開發者ID:numixproject,項目名稱:org.numixproject.torch,代碼行數:23,代碼來源:MainActivity.java

示例9: longSOS

import android.media.ToneGenerator; //導入方法依賴的package包/類
public void longSOS(){
    final ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 5000);
    String myString = "010101";
    long blinkDelay = 250; //Delay in ms
    for (int i = 0; i < myString.length(); i++) {
        if (myString.charAt(i) == '0') {
            turnOnSOS();
            tg.startTone(ToneGenerator.TONE_DTMF_6, 250); //200 is duration in ms
        } else {
            turnOffSOS();
        }
        try {
            Thread.sleep(blinkDelay);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    while (!stopRunning) {
        shortSOS();
    }
}
 
開發者ID:numixproject,項目名稱:org.numixproject.torch,代碼行數:22,代碼來源:MainActivity.java

示例10: shortSOS

import android.media.ToneGenerator; //導入方法依賴的package包/類
public void shortSOS(){
    final ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 5000);
    String myString = "010101111111";
    long blinkDelay = 50; //Delay in ms
    for (int i = 0; i < myString.length(); i++) {
        if (myString.charAt(i) == '0') {
            turnOnSOS();
            tg.startTone(ToneGenerator.TONE_DTMF_6, 50); //200 is duration in ms
        } else {
            turnOffSOS();
        }
        try {
            Thread.sleep(blinkDelay);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    while (!stopRunning) {
        run();
    }
}
 
開發者ID:numixproject,項目名稱:org.numixproject.torch,代碼行數:22,代碼來源:MainActivity.java

示例11: taskFailed

import android.media.ToneGenerator; //導入方法依賴的package包/類
@Override
public void taskFailed() {
    Toast.makeText(getApplicationContext(),
            "Không gọi được",
            Toast.LENGTH_SHORT).show();

    ToneGenerator toneG = new ToneGenerator(AudioManager.STREAM_ALARM, 100);
    toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200);
}
 
開發者ID:chuyencuadev,項目名稱:alert,代碼行數:10,代碼來源:MainActivity.java

示例12: run

import android.media.ToneGenerator; //導入方法依賴的package包/類
@Override
public void run() {
    ToneGenerator toneGenerator = new ToneGenerator(AudioManager.STREAM_MUSIC, 100);
    if (toneGenerator.startTone(this.sound)) {
        try {
            Thread.sleep(250);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        toneGenerator.stopTone();
    }
    toneGenerator.release();
}
 
開發者ID:codemumbler,項目名稱:fitTimer,代碼行數:14,代碼來源:SoundMaker.java

示例13: exec

import android.media.ToneGenerator; //導入方法依賴的package包/類
@Override
public String exec(ExecutePack pack) throws Exception {
    try {
        ToneGenerator toneG = new ToneGenerator(AudioManager.STREAM_ALARM, 50);
        toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 1000);
    } catch (Exception e) {
        return e.toString();
    }

    return null;
}
 
開發者ID:Andre1299,項目名稱:TUI-ConsoleLauncher,代碼行數:12,代碼來源:beep.java

示例14: playTone

import android.media.ToneGenerator; //導入方法依賴的package包/類
private static void playTone() {
    try {
        ToneGenerator toneGen1 = new ToneGenerator(AudioManager.STREAM_ALARM, 100);
        toneGen1.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 100);
    } catch (RuntimeException ignored) {
    }
}
 
開發者ID:plusCubed,項目名稱:velociraptor,代碼行數:8,代碼來源:Utils.java

示例15: parseReceivedData

import android.media.ToneGenerator; //導入方法依賴的package包/類
private void parseReceivedData(byte[] data) {
    ut61pkt u;
    try {
        u = new ut61pkt(data);
    } catch (NumberFormatException e) {
        Log.i(TAG,"Error reading value");
        return;
    }
    Log.i(TAG, Arrays.toString(data));
    Log.i(TAG, u.toStrDebug());

    String calibStatus = "C";
    Float dvalue = Float.valueOf(u.value);
    changed.add(dvalue);
    String minmax=String.valueOf(changed.Min)+" "+String.valueOf(changed.Max);
    if (chDetect) {
        calibStatus = "A ";
        if (changed.isChange()) {
            ToneGenerator toneG = new ToneGenerator(AudioManager.STREAM_ALARM, 100);
            toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200);
        }
    }

    mTitleTextView.setText(String.valueOf(u.value) +
            " " + u.mtype + u.munit + " " +u.acdc+" "+minmax+" "+calibStatus);

    if (series1.size() > HISTORY_SIZE) {
        series1.removeFirst();
    }
    series1.addLast(null, u.value);
    plot.redraw();

    // mDumpTextView.append(u.toStr()+"\n");
    // mScrollView.smoothScrollTo(0, mDumpTextView.getBottom());

}
 
開發者ID:kost,項目名稱:DroidMeter,代碼行數:37,代碼來源:SerialConsoleActivity.java


注:本文中的android.media.ToneGenerator.startTone方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。