-
March 8th, 2017, 02:01 AM
#1
Audio (API)
Hello, I am new to the forums, and joined because I wanted a forum to ask some professionals if there is a better method for using audio files. But, in my thought I realized I probably have all the customization I need with the Clip interface.
But, my question is how is one using Clip (an interface), as if it were a class? Where are these methods instantiated? What class that implements Clip is being passed at AudioSystem.getClip()?
Code:
private void playSound(File f){
if(f!=null){
try {
AudioInputStream ais = AudioSystem.getAudioInputStream(f);
Clip clip = AudioSystem.getClip();
clip.open(ais);
FloatControl gainControl = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
gainControl.setValue(-30.0f);
clip.start();
}
catch(UnsupportedAudioFileException ioe) {ExceptionHandling.add(ioe);}
catch(LineUnavailableException ioe) { ExceptionHandling.add(ioe);}
catch(IOException ioe) { ExceptionHandling.add(ioe); }
}
}
-
March 8th, 2017, 07:10 AM
#2
Re: Audio (API)
What class that implements Clip is being passed at AudioSystem.getClip()?
Call the getClass() method for that object and print it to see what class it is.
Norm
-
March 10th, 2017, 02:29 AM
#3
Re: Audio (API)
I get class com.sun.media.sound.DirectAudioDevice$DirectClip, however, I cannot find that in java docs at all.
-
March 10th, 2017, 07:11 AM
#4
Re: Audio (API)
That looks like an internal class that is not supposed to be accessible except as an interface. The interface is documented.
Norm
-
March 10th, 2017, 08:28 PM
#5
Re: Audio (API)
That is a thing? Why would they hide classes from us?
-
March 10th, 2017, 09:00 PM
#6
Re: Audio (API)
So it can be changed (improved) without any changes to the existing docs
Norm
-
March 10th, 2017, 09:01 PM
#7
Re: Audio (API)
Okay so is there anywhere I can find the content of such a class?
-
March 10th, 2017, 09:02 PM
#8
Re: Audio (API)
No, It's not supposed to be public.
Norm
-
March 10th, 2017, 10:00 PM
#9
Re: Audio (API)
So, there is a matter of property? I was always under the impression all of java API's, Bytecode, JVM, and such were all free to evaluate. This assumption is inaccurate? Does Oracle have some restrictions on what we are allowed to view for reasons of copyright?
-
March 11th, 2017, 06:26 AM
#10
Re: Audio (API)
Sorry, I don't know anything about that.
Norm
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|