@@ -326,9 +326,9 @@ private void initAudioInputStream() throws StreamPlayerException {
326
326
status = Status .OPENED ;
327
327
generateEvent (Status .OPENED , getEncodedStreamPosition (), null );
328
328
329
- } catch (LineUnavailableException | UnsupportedAudioFileException | IOException ¢ ) {
330
- logger .log (Level .INFO , ¢ .getMessage (), ¢ );
331
- throw new StreamPlayerException (¢ );
329
+ } catch (LineUnavailableException | UnsupportedAudioFileException | IOException e ) {
330
+ logger .log (Level .INFO , e .getMessage (), e );
331
+ throw new StreamPlayerException (e );
332
332
}
333
333
334
334
logger .info ("Exited initAudioInputStream\n " );
@@ -349,7 +349,7 @@ private void determineProperties() {
349
349
audioProperties = new HashMap <>();
350
350
else {
351
351
// Tritonus SPI compliant audio file format.
352
- audioProperties = ((TAudioFileFormat) audioFileFormat) .properties();
352
+ audioProperties = audioFileFormat .properties ();
353
353
354
354
// Clone the Map because it is not mutable.
355
355
audioProperties = deepCopy (audioProperties );
@@ -378,7 +378,7 @@ private void determineProperties() {
378
378
audioProperties .put ("audio.channels" , audioFormat .getChannels ());
379
379
// Tritonus SPI compliant audio format.
380
380
if (audioFormat instanceof TAudioFormat )
381
- audioProperties.putAll(((TAudioFormat) audioFormat) .properties());
381
+ audioProperties .putAll (audioFormat .properties ());
382
382
383
383
// Add SourceDataLine
384
384
audioProperties .put ("basicplayer.sourcedataline" , sourceDataLine );
@@ -457,7 +457,7 @@ private void createLine() throws LineUnavailableException, StreamPlayerException
457
457
// Calculate the Sample Size in bits
458
458
int nSampleSizeInBits = sourceFormat .getSampleSizeInBits ();
459
459
if (sourceFormat .getEncoding () == AudioFormat .Encoding .ULAW || sourceFormat .getEncoding () == AudioFormat .Encoding .ALAW
460
- || nSampleSizeInBits <= 0 || nSampleSizeInBits != 8 )
460
+ || nSampleSizeInBits != 8 )
461
461
nSampleSizeInBits = 16 ;
462
462
463
463
final AudioFormat targetFormat = new AudioFormat (AudioFormat .Encoding .PCM_SIGNED ,
@@ -1068,11 +1068,11 @@ private Mixer getMixer(final String name) {
1068
1068
final Mixer .Info [] mixerInfos = AudioSystem .getMixerInfo ();
1069
1069
1070
1070
if (name != null && mixerInfos != null )
1071
- for ( int i = 0 ; i < mixerInfos . length ; i ++ )
1072
- if (mixerInfos [ i ] .getName ().equals (name )) {
1073
- mixer = AudioSystem .getMixer (mixerInfos [ i ] );
1074
- break ;
1075
- }
1071
+ for ( Mixer . Info mixerInfo : mixerInfos )
1072
+ if (mixerInfo .getName ().equals (name )) {
1073
+ mixer = AudioSystem .getMixer (mixerInfo );
1074
+ break ;
1075
+ }
1076
1076
return mixer ;
1077
1077
}
1078
1078
@@ -1183,9 +1183,9 @@ public int getPositionByte() {
1183
1183
final int positionByte = AudioSystem .NOT_SPECIFIED ;
1184
1184
if (audioProperties != null ) {
1185
1185
if (audioProperties .containsKey ("mp3.position.byte" ))
1186
- return (( Integer ) audioProperties .get ("mp3.position.byte" )). intValue ( );
1186
+ return (Integer ) audioProperties .get ("mp3.position.byte" );
1187
1187
if (audioProperties .containsKey ("ogg.position.byte" ))
1188
- return (( Integer ) audioProperties .get ("ogg.position.byte" )). intValue ( );
1188
+ return (Integer ) audioProperties .get ("ogg.position.byte" );
1189
1189
}
1190
1190
return positionByte ;
1191
1191
}
@@ -1256,7 +1256,7 @@ public void setPan(final double fPan) {
1256
1256
*/
1257
1257
public void setGain (final double fGain ) {
1258
1258
if (isPlaying () || isPaused () && hasControl (FloatControl .Type .MASTER_GAIN , gainControl ))
1259
- gainControl .setValue ((float ) (20 * Math .log10 (fGain != 0.0 ? fGain : 0.0000 )));
1259
+ gainControl .setValue ((float ) (20 * Math .log10 (fGain )));
1260
1260
}
1261
1261
1262
1262
/**
@@ -1298,8 +1298,7 @@ public void setEqualizer(final float[] array, final int stop) {
1298
1298
return ;
1299
1299
// Map<?, ?> map = ((PropertiesContainer) audioInputStream).properties()
1300
1300
final float [] equalizer = (float []) ((PropertiesContainer ) audioInputStream ).properties ().get ("mp3.equalizer" );
1301
- for (int i = 0 ; i < stop ; i ++)
1302
- equalizer [i ] = array [i ];
1301
+ if (stop >= 0 ) System .arraycopy (array , 0 , equalizer , 0 , stop );
1303
1302
1304
1303
}
1305
1304
0 commit comments