mirror of
https://github.com/processing/processing4.git
synced 2026-02-11 09:39:19 +01:00
working on java 1.1 audio
This commit is contained in:
@@ -33,7 +33,7 @@ import javax.sound.sampled.*;
|
||||
// for this class: http://javaalmanac.com/egs/javax.sound.sampled/pkg.html
|
||||
|
||||
public class PSound2 extends PSound {
|
||||
PApplet parent;
|
||||
//PApplet parent;
|
||||
Method soundEventMethod;
|
||||
|
||||
Clip clip;
|
||||
@@ -47,12 +47,11 @@ public class PSound2 extends PSound {
|
||||
AudioInputStream stream =
|
||||
AudioSystem.getAudioInputStream(input);
|
||||
|
||||
// *** this code appears as though it may just be faulty ***
|
||||
|
||||
// At present, ALAW and ULAW encodings must be converted
|
||||
// to PCM_SIGNED before it can be played
|
||||
AudioFormat format = stream.getFormat();
|
||||
if (format.getEncoding() != AudioFormat.Encoding.PCM_SIGNED) {
|
||||
// *** this code appears as though it may just be faulty ***
|
||||
format = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED,
|
||||
format.getSampleRate(),
|
||||
format.getSampleSizeInBits()*2,
|
||||
@@ -61,7 +60,7 @@ public class PSound2 extends PSound {
|
||||
format.getFrameRate(),
|
||||
true); // big endian
|
||||
stream = AudioSystem.getAudioInputStream(format, stream);
|
||||
//} else {
|
||||
//} else {
|
||||
//System.out.println("no conversion necessary");
|
||||
}
|
||||
|
||||
@@ -202,6 +201,7 @@ public class PSound2 extends PSound {
|
||||
gainControl.setValue(dB);
|
||||
}
|
||||
|
||||
|
||||
/** mute */
|
||||
/*
|
||||
public void noVolume() {
|
||||
|
||||
Reference in New Issue
Block a user