< prev index next >
src/java.desktop/share/classes/com/sun/media/sound/Toolkit.java
Print this page
*** 50,60 ****
for (int i = off; i < (off+len); i++) {
b[i] += 128;
}
}
-
/**
* Swaps bytes.
* @throws ArrayOutOfBoundsException if len is not a multiple of 2.
*/
static void getByteSwapped(byte[] b, int off, int len) {
--- 50,59 ----
*** 66,86 ****
b[i] = b[i+1];
b[i+1] = tempByte;
}
}
-
/**
* Linear to DB scale conversion.
*/
static float linearToDB(float linear) {
float dB = (float) (Math.log(((linear==0.0)?0.0001:linear))/Math.log(10.0) * 20.0);
return dB;
}
-
/**
* DB to linear scale conversion.
*/
static float dBToLinear(float dB) {
--- 65,83 ----
*** 106,116 ****
return bytes;
}
return bytes - (bytes % blockSize);
}
-
/*
* gets the number of bytes needed to play the specified number of milliseconds
*/
static long millis2bytes(AudioFormat format, long millis) {
long result = (long) (millis * format.getFrameRate() / 1000.0f * format.getFrameSize());
--- 103,112 ----
*** 186,196 ****
+((format.getChannels()==-1)?
"NOT_SPECIFIED":String.valueOf(format.getChannels())));
}
}
-
static boolean isFullySpecifiedPCMFormat(AudioFormat format) {
if (!format.getEncoding().equals(AudioFormat.Encoding.PCM_SIGNED)
&& !format.getEncoding().equals(AudioFormat.Encoding.PCM_UNSIGNED)) {
return false;
}
--- 182,191 ----
*** 202,212 ****
return false;
}
return true;
}
-
public static AudioInputStream getPCMConvertedAudioInputStream(AudioInputStream ais) {
// we can't open the device for non-PCM playback, so we have
// convert any other encodings to PCM here (at least we try!)
AudioFormat af = ais.getFormat();
--- 197,206 ----
*** 229,235 ****
}
}
return ais;
}
-
}
--- 223,228 ----
< prev index next >