11package ev3dev .actuators ;
22
3+ import java .io .File ;
4+ import java .io .IOException ;
5+ import java .net .MalformedURLException ;
6+ import java .net .URL ;
7+ import java .util .Objects ;
8+
9+ import javax .sound .sampled .AudioInputStream ;
10+ import javax .sound .sampled .AudioSystem ;
11+ import javax .sound .sampled .Clip ;
12+ import javax .sound .sampled .LineUnavailableException ;
13+ import javax .sound .sampled .UnsupportedAudioFileException ;
14+
15+ import org .slf4j .Logger ;
16+ import org .slf4j .LoggerFactory ;
17+
318import ev3dev .hardware .EV3DevDevice ;
419import ev3dev .hardware .EV3DevDistro ;
520import ev3dev .hardware .EV3DevDistros ;
621import ev3dev .hardware .EV3DevPlatform ;
722import ev3dev .utils .Shell ;
823import ev3dev .utils .Sysfs ;
924import lejos .utility .Delay ;
10- import org .slf4j .Logger ;
11- import org .slf4j .LoggerFactory ;
12-
13- import javax .sound .sampled .AudioInputStream ;
14- import javax .sound .sampled .AudioSystem ;
15- import javax .sound .sampled .Clip ;
16- import javax .sound .sampled .LineUnavailableException ;
17- import javax .sound .sampled .UnsupportedAudioFileException ;
18- import java .io .File ;
19- import java .io .IOException ;
20- import java .util .Objects ;
21- import java .net .URL ;
22- import java .net .MalformedURLException ;
2325
2426
2527/**
@@ -119,7 +121,6 @@ public void twoBeeps() {
119121 * @param duration The duration of the tone, in milliseconds.
120122 * @param volume The volume of the playback
121123 *
122- * @see playTone(int, int)
123124 */
124125public void playTone (final int frequency ,final int duration ,final int volume ) {
125126if (CURRENT_PLATFORM .equals (EV3DevPlatform .EV3BRICK )) {
@@ -152,8 +153,6 @@ public void playTone(final int frequency, final int duration) {
152153 * @param url URL to the sample
153154 * @param volume the volume level
154155 *
155- * @see playSample(URL)
156- * @see setVolume(int)
157156 */
158157public void playSample (final URL url ,final int volume ) {
159158this .setVolume (volume );
@@ -166,8 +165,6 @@ public void playSample(final URL url, final int volume) {
166165 * @param file File path to the sample
167166 * @param volume the volume level
168167 *
169- * @see playSample(File)
170- * @see setVolume(int)
171168 */
172169public void playSample (final File file ,final int volume ) {
173170this .setVolume (volume );
@@ -180,8 +177,6 @@ public void playSample(final File file, final int volume) {
180177 * @param resource Resource path to the sample
181178 * @param volume the volume level
182179 *
183- * @see playSample(String)
184- * @see setVolume(int)
185180 */
186181public void playSample (final String resource ,final int volume ) {
187182this .setVolume (volume );
@@ -218,8 +213,7 @@ public void playSample(final URL url) {
218213public void playSample (final File file ) {
219214try {
220215playSample (file .toURI ().toURL ());
221- }
222- catch (MalformedURLException e ) {
216+ }catch (MalformedURLException e ) {
223217LOGGER .error (e .getLocalizedMessage (),e );
224218throw new RuntimeException (e );
225219 }
@@ -274,8 +268,7 @@ public void setVolume(final int volume) {
274268// "Beep" (tones), so set the volume for both:
275269final String []mixers = {"PCM" ,"Beep" };
276270for (String item :mixers ) {
277- Shell .execute (new String []
278- {"amixer" ,"set" ,item +",0" ,"" +volume +"%" });
271+ Shell .execute (new String [] {"amixer" ,"set" ,item +",0" ,"" +volume +"%" });
279272 }
280273 }
281274 }