当前位置: 首页>>代码示例>>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;未经允许,请勿转载。