27.04.2013 Views

330 Java Tips.pdf - FTP Server

330 Java Tips.pdf - FTP Server

330 Java Tips.pdf - FTP Server

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Sound & Multimedia<br />

Receive our newsletter with new tips! Almost 6,000 subscribers (by June 2001) can not be wrong!<br />

They read our tips every week! To subscribe to The <strong>Java</strong> FAQ Daily send empty e-mail to:<br />

javafaq-tips-subscribe@topica.com or visit at:<br />

http://www.topica.com/lists/javafaq-tips/<br />

Sound & Multimedia<br />

Do you know that Version 1.3 of the <strong>Java</strong>TM 2 Platform<br />

includes a powerful new API for capturing, processing, and<br />

playing back audio and MIDI (Musical Intstrument Digital Interface) data.<br />

You can read here more: http://java.sun.com/j2se/1.3/docs/guide/sound/index.html<br />

I'm doing a small console java app, and want to know what the function is to<br />

make the pc speaker beep....<br />

Answer: Toolkit.getDefaultToolkit().beep();<br />

Q: I would like to burn a CD from within my code, that way I won't have to waste<br />

so much time making illegal copies of music. Is there a convenient way to do this in<br />

<strong>Java</strong>?<br />

Answer: Unfortunately <strong>Java</strong> doesn't provide any API for this :-)<br />

Q: I use System.out.println("\007") to make a beep. It works fine with java.exe<br />

version 2.2.2_007, but doesn't work when I use javaw.<br />

It's said that java and javaw are exactly the same but apparently they have some<br />

differences.<br />

How I can use System.out.println("\007") to make a beep with javaw?<br />

Visit us here and you will find<br />

much more tips!<br />

Answer: System.out.println sends a character to the standard output stream, which is<br />

redirected to nowhere when you use javaw. Same would happen if you ran your<br />

application under UNIX and redirected standard out to /dev/null. I'd guess that your<br />

code wouldn't work at all on a Macintosh.<br />

To solve this problem, do what you need more directly, for example using<br />

java.awt.Toolkit.beep instead of a non-portable kludge with sending special ASCII<br />

file:///F|/350_t/350_tips/sound_multimedia.htm (1 of 2) [2002-02-27 21:19:10]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!