本文整理匯總了Java中android.media.ToneGenerator.MAX_VOLUME屬性的典型用法代碼示例。如果您正苦於以下問題:Java ToneGenerator.MAX_VOLUME屬性的具體用法?Java ToneGenerator.MAX_VOLUME怎麽用?Java ToneGenerator.MAX_VOLUME使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.media.ToneGenerator
的用法示例。
在下文中一共展示了ToneGenerator.MAX_VOLUME屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: playTone
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);
}
示例2: run
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;
}
}
}
示例3: testTone
public void testTone() throws Exception {
Log.d(TAG, "Creating tone generator ADT 10");
ToneGenerator toneGen = new ToneGenerator(AudioManager.STREAM_RING,
ToneGenerator.MAX_VOLUME);
toneGen.startTone(ToneGenerator.TONE_PROP_BEEP2);
final long DELAYED = 1000;
Thread.sleep(DELAYED);
toneGen.stopTone();
toneGen.release();
Log.d(TAG, "Released tone generator");
}
示例4: beep
@Override
public void beep() {
ToneGenerator toneGenerator = new ToneGenerator(
AudioManager.STREAM_SYSTEM, ToneGenerator.MAX_VOLUME);
toneGenerator.startTone(ToneGenerator.TONE_PROP_BEEP);
}