Hi,
I've been struggling with this problem for some time and I don't
understand why this doesn't work. I'm trying to call the "open" method
of a javax.sound.sampled class but it throws the following exception:
  No matching method found: open for class
  com.sun.media.sound.DirectAudioDevice$DirectSDL.
Please give it a look and tell me what you think. The code is not
robust and might fail on your system for other reasons (probably
harware-related).
DirectSDL extends SourceDataLine. The method I'm trying to call is
documented here:
http://java.sun.com/j2se/1.4.2/docs/api/javax/sound/sampled/SourceDataLine.html#method_summary
Using the commented line, which casts everything explicitly, yields
the same result. Calling the method without parameters (Line class)
works, but that's not what I need.
Also, I know the method exists because it shows up when I extract the
object's methods:
#<Method public void com.sun.media.sound.AbstractDataLine.open
(javax.sound.sampled.AudioFormat,int) throws
javax.sound.sampled.LineUnavailableException>


Here's the code:

(import '(javax.sound.sampled AudioSystem AudioFormat DataLine DataLine
$Info
                              SourceDataLine TargetDataLine
AudioInputStream))
(def format (AudioFormat. 48000 16 2 true false))
(def sdl-info (DataLine$Info. SourceDataLine format))
(when (not (AudioSystem/isLineSupported sdl-info))
  (throw (RuntimeException. "Unsupported format.")))
(def sdl (AudioSystem/getLine sdl-info))
(.open sdl format (* 48000 2 2))
;(. (cast SourceDataLine sdl) open (cast AudioFormat format) (int (*
48000 2 2)))


Thanks for your help.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to