本文整理匯總了Java中javax.sound.sampled.AudioSystem.getTargetEncodings方法的典型用法代碼示例。如果您正苦於以下問題:Java AudioSystem.getTargetEncodings方法的具體用法?Java AudioSystem.getTargetEncodings怎麽用?Java AudioSystem.getTargetEncodings使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.sound.sampled.AudioSystem
的用法示例。
在下文中一共展示了AudioSystem.getTargetEncodings方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: main
import javax.sound.sampled.AudioSystem; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
// 1st checks Encoding.PCM_FLOAT is available
pcmFloatEnc = Encoding.PCM_FLOAT;
Encoding[] encodings = AudioSystem.getTargetEncodings(pcmFloatEnc);
out("conversion from PCM_FLOAT to " + encodings.length + " encodings:");
for (Encoding e: encodings) {
out(" - " + e);
}
if (encodings.length == 0) {
testFailed = true;
}
test(Encoding.PCM_SIGNED);
test(Encoding.PCM_UNSIGNED);
if (testFailed) {
throw new Exception("test failed");
}
out("test passed.");
}
示例2: test
import javax.sound.sampled.AudioSystem; //導入方法依賴的package包/類
static boolean test(Encoding enc) {
out("conversion " + enc + " -> PCM_FLOAT:");
Encoding[] encodings = AudioSystem.getTargetEncodings(enc);
for (Encoding e: encodings) {
if (e.equals(pcmFloatEnc)) {
out(" - OK");
return true;
}
}
out(" - FAILED (not supported)");
testFailed = true;
return false;
}