Skip to main content

audio - Playing sound with AudioClip in Java - JackRouter error? -


i'm relatively new java, though i'm delving little bit further in here.

i'm creating program displays button of chicken, , upon clicking button, audioclip of chicken clucking played. simple, seems, yet can't audio work @ all.

i'm using audioclip try accomplish this. book i've been using teach myself, [i]introduction java programming[/i] (eighth edition) y. daniel liang, tells me can use audioclip despite in non-applet program despite location.

i'm having trouble getting work, though, here's have far. i'll give code , give error i'm receiving.

i'm temporarily on mac, way, , haven't had chance try on windows. don't know why affect anything, there go.

//this class plays sound. main class follows. import javax.swing.japplet; import java.applet.*; import java.net.url; public class chickensound extends japplet { private audioclip chsound; //creates audioclip public chickensound() { url url = getclass().getresource("resources/chicken-sound.wav"); //creates url path of soundfile chsound = this.newaudioclip(url); //sets audioclip equal url chsound.play(); //plays audioclip } } //main class // of these imports unnecessary clean them later import java.applet.*; import java.awt.*; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.net.*; import java.net.url; import javax.swing.*; public class chickenbutton extends jframe { private imageicon chbtnicon = new imageicon("resources/chicken-side.png"); private jbutton chbtn = new jbutton(chbtnicon); private jpanel panel = new jpanel(new gridbaglayout()); public chickenbutton() //main window { gridbagconstraints c = new gridbagconstraints(); chbtn.setborder(borderfactory.createemptyborder()); chbtn.setcontentareafilled(false); font bigfont = new font("times new roman", font.bold, 25); jlabel chlbl = new jlabel("click chick'n"); chlbl.setfont(bigfont); c.gridheight = 1; c.gridx= 0; c.gridy = 0; c.weighty = 2; panel.add(chlbl,c); c.gridheight=2; c.gridx= 0; c.gridy = 1; c.weighty = 2; panel.add(chbtn, c); add(panel); chbtn.addactionlistener(new chlstnr()); //creates click listener button } public static void main(string[] args) { chickenbutton window = new chickenbutton(); window.setlocationrelativeto(null); window.settitle("chick'n button"); window.setdefaultcloseoperation(jframe.exit_on_close); window.setsize(300, 400); window.setvisible(true); //creates window } class chlstnr implements actionlistener { public void actionperformed(actionevent e) { system.out.println("cluck cluck cluck"); //for button functionality testing purposes (and works) chickensound chsnd = new chickensound(); //this supposed play sound. doesn't work. } } } 

the errors receive are...

2012-07-06 15:44:33.365 java[41264:ff03] error loading /library/audio/plug-ins/hal/jackrouter.plugin/contents/macos/jackrouter: dlopen(/library/audio/plug-ins/hal/jackrouter.plugin/contents/macos/jackrouter, 262): no suitable image found. did find:/library/audio/plug-ins/hal/jackrouter.plugin/contents/macos/jackrouter: no matching architecture in universal wrapper 2012-07-06 15:44:33.367 java[41264:ff03] cannot find function pointer new_jackrouterplugin factory 7cb18864-927d-48b5-904c-ccfbcfbc7add in cfbundle/cfplugin 0x102191490 </library/audio/plug-ins/hal/jackrouter.plugin> (bundle, not loaded) 

i have no idea means. has audio plug-in can't loaded, don't know. seems may more of error computer i'm messing java, i've found no solution far. i've tried 2 ides, eclipse , netbeans, , both produce same errors. have idea what's this?

any appreciated.

thanks.

edit: works now. somehow.

audio - playing sound audioclip in java - jackrouter error? - stack overflow

learn, share, build

each month, on 50 million developers come stack overflow learn, share knowledge, , build careers.

join world’s largest developer community.

sign up

i'm relatively new java, though i'm delving little bit further in here.

i'm creating program displays button of chicken, , upon clicking button, audioclip of chicken clucking played. simple, seems, yet can't audio work @ all.

i'm using audioclip try accomplish this. book i've been using teach myself, [i]introduction java programming[/i] (eighth edition) y. daniel liang, tells me can use audioclip despite in non-applet program despite location.

i'm having trouble getting work, though, here's have far. i'll give code , give error i'm receiving.

i'm temporarily on mac, way, , haven't had chance try on windows. don't know why affect anything, there go.

//this class plays sound. main class follows. import javax.swing.japplet; import java.applet.*; import java.net.url; public class chickensound extends japplet { private audioclip chsound; //creates audioclip public chickensound() { url url = getclass().getresource("resources/chicken-sound.wav"); //creates url path of soundfile chsound = this.newaudioclip(url); //sets audioclip equal url chsound.play(); //plays audioclip } } //main class // of these imports unnecessary clean them later import java.applet.*; import java.awt.*; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.net.*; import java.net.url; import javax.swing.*; public class chickenbutton extends jframe { private imageicon chbtnicon = new imageicon("resources/chicken-side.png"); private jbutton chbtn = new jbutton(chbtnicon); private jpanel panel = new jpanel(new gridbaglayout()); public chickenbutton() //main window { gridbagconstraints c = new gridbagconstraints(); chbtn.setborder(borderfactory.createemptyborder()); chbtn.setcontentareafilled(false); font bigfont = new font("times new roman", font.bold, 25); jlabel chlbl = new jlabel("click chick'n"); chlbl.setfont(bigfont); c.gridheight = 1; c.gridx= 0; c.gridy = 0; c.weighty = 2; panel.add(chlbl,c); c.gridheight=2; c.gridx= 0; c.gridy = 1; c.weighty = 2; panel.add(chbtn, c); add(panel); chbtn.addactionlistener(new chlstnr()); //creates click listener button } public static void main(string[] args) { chickenbutton window = new chickenbutton(); window.setlocationrelativeto(null); window.settitle("chick'n button"); window.setdefaultcloseoperation(jframe.exit_on_close); window.setsize(300, 400); window.setvisible(true); //creates window } class chlstnr implements actionlistener { public void actionperformed(actionevent e) { system.out.println("cluck cluck cluck"); //for button functionality testing purposes (and works) chickensound chsnd = new chickensound(); //this supposed play sound. doesn't work. } } } 

the errors receive are...

2012-07-06 15:44:33.365 java[41264:ff03] error loading /library/audio/plug-ins/hal/jackrouter.plugin/contents/macos/jackrouter: dlopen(/library/audio/plug-ins/hal/jackrouter.plugin/contents/macos/jackrouter, 262): no suitable image found. did find:/library/audio/plug-ins/hal/jackrouter.plugin/contents/macos/jackrouter: no matching architecture in universal wrapper 2012-07-06 15:44:33.367 java[41264:ff03] cannot find function pointer new_jackrouterplugin factory 7cb18864-927d-48b5-904c-ccfbcfbc7add in cfbundle/cfplugin 0x102191490 </library/audio/plug-ins/hal/jackrouter.plugin> (bundle, not loaded) 

i have no idea means. has audio plug-in can't loaded, don't know. seems may more of error computer i'm messing java, i've found no solution far. i've tried 2 ides, eclipse , netbeans, , both produce same errors. have idea what's this?

any appreciated.

thanks.

edit: works now. somehow.

share|improve question

closed unclear you're asking flexo aug 10 '13 @ 7:38

please clarify specific problem or add additional details highlight need. it's written, it’s hard tell you're asking. see how ask page clarifying question. if question can reworded fit rules in help center, please edit question.

    
i don't know happened. works now. somehow. – hellephant jul 7 '12 @ 7:48
1  
did ever figure out why started working? – priestvallon apr 3 '13 @ 17:07

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -