diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index e864632..4117c69 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -18,6 +18,10 @@ jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
+ permissions:
+ actions: read
+ contents: read
+ security-events: write
strategy:
fail-fast: false
diff --git a/README.md b/README.md
index fe867e8..612b203 100644
--- a/README.md
+++ b/README.md
@@ -26,6 +26,10 @@ https://jitpack.io/#umjammer/vavi-sound-alac
clip.loop(Clip.LOOP_CONTINUOUSLY);
```
+## References
+
+ * https://github.com/flacon/alacenc
+
## TODO
* play clip w/o format conversion (possible?)
diff --git a/local.properties.sample b/local.properties.sample
index cc42d55..970f556 100644
--- a/local.properties.sample
+++ b/local.properties.sample
@@ -1 +1,3 @@
-alac=/foo/bar.m4a
\ No newline at end of file
+alac=/foo/bar.m4a
+
+vavi.test.volume=0.02
diff --git a/pom.xml b/pom.xml
index d1767d1..5d46381 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,12 +8,50 @@
vavi
vavi-sound-alac
- 0.3.4
+ 0.3.5
Apple Lossless Decoder for Java
https://github.com/umjammer/vavi-sound-alac
ALAC Java sound SPI
+
+ 0.02
+
+
+
+
+ local
+
+
+ ${basedir}/local.properties
+
+
+
+
+
+ org.codehaus.mojo
+ properties-maven-plugin
+ 1.1.0
+
+
+ read-properties
+ initialize
+
+ read-project-properties
+
+
+
+ ${basedir}/local.properties
+
+
+
+
+
+
+
+
+
+
@@ -32,7 +70,7 @@
--add-opens java.base/java.io=ALL-UNNAMED
-Djava.util.logging.config.file=${project.build.testOutputDirectory}/logging.properties
- -Dvavi.test.volume=0.02
+ -Dvavi.test.volume=${vavi.test.volume}
false
false
@@ -53,7 +91,7 @@
org.junit
junit-bom
- 5.10.1
+ 5.10.2
pom
import
@@ -64,7 +102,7 @@
com.github.umjammer
vavi-sound
- 1.0.16
+ 1.0.18
diff --git a/src/main/java/com/beatofthedrum/alacdecoder/Alac.java b/src/main/java/com/beatofthedrum/alacdecoder/Alac.java
index 71451b9..af420a1 100644
--- a/src/main/java/com/beatofthedrum/alacdecoder/Alac.java
+++ b/src/main/java/com/beatofthedrum/alacdecoder/Alac.java
@@ -30,12 +30,13 @@ public class Alac implements AutoCloseable {
* @param is accepts only FileInputStream or InputStream which supports mark
* if "moov" chank in the alac mp4 container is located at back of data,
* mark might not work well.
+ * @throws IllegalArgumentException maybe {@code is} is not alac
*/
public Alac(InputStream is) throws IOException {
context = new AlacContext();
if (!(is instanceof FileInputStream) && !is.markSupported()) {
- throw new IllegalArgumentException("is must be mark supported or FileInputStream");
+ throw new IOException("is must be mark supported or FileInputStream");
}
if (is.markSupported()) {
int whole = is.available();
@@ -70,7 +71,7 @@ public Alac(InputStream is) throws IOException {
} catch (IOException e) {
logger.fine(e.getMessage());
}
- throw new IOException(errorMessage);
+ throw new IllegalArgumentException(errorMessage);
} else if (headerRead == 3) {
// This section is used when the stream system being used doesn't
// support seeking
diff --git a/src/main/java/vavi/sound/sampled/alac/AlacAudioFileReader.java b/src/main/java/vavi/sound/sampled/alac/AlacAudioFileReader.java
index 6de3f8e..7a04ccf 100644
--- a/src/main/java/vavi/sound/sampled/alac/AlacAudioFileReader.java
+++ b/src/main/java/vavi/sound/sampled/alac/AlacAudioFileReader.java
@@ -14,7 +14,6 @@
import java.net.URL;
import java.util.HashMap;
import java.util.logging.Level;
-
import javax.sound.sampled.AudioFileFormat;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
@@ -23,7 +22,6 @@
import javax.sound.sampled.spi.AudioFileReader;
import com.beatofthedrum.alacdecoder.Alac;
-
import vavi.util.Debug;
@@ -40,7 +38,7 @@ public class AlacAudioFileReader extends AudioFileReader {
@Override
public AudioFileFormat getAudioFileFormat(File file) throws UnsupportedAudioFileException, IOException {
//noinspection IOStreamConstructor
- try (InputStream inputStream = new FileInputStream(file)) { // must be FileInputStream
+ try (InputStream inputStream = new FileInputStream(file)) { // must be FileInputStream because Alac accept it to use channel in it
return getAudioFileFormat(inputStream, (int) file.length());
}
}
@@ -61,8 +59,8 @@ public AudioFileFormat getAudioFileFormat(InputStream stream) throws Unsupported
/**
* Return the AudioFileFormat from the given InputStream. Implementation.
*
- * @param bitStream
- * @param mediaLength
+ * @param bitStream input to decode
+ * @param mediaLength unused
* @return an AudioInputStream object based on the audio file data contained
* in the input stream.
* mark must be supported and mark size must be larger than the alac data size
@@ -75,9 +73,9 @@ protected AudioFileFormat getAudioFileFormat(InputStream bitStream, int mediaLen
Alac alac;
try {
alac = new Alac(bitStream);
- } catch (IOException e) {
-Debug.println(Level.FINE, "error exit available: " + bitStream.available());
-Debug.printStackTrace(Level.FINER, e);
+ } catch (Exception e) {
+Debug.println(Level.FINER, "error exit available: " + bitStream.available());
+Debug.printStackTrace(Level.FINEST, e);
throw (UnsupportedAudioFileException) new UnsupportedAudioFileException(e.getMessage()).initCause(e);
}
// TODO AudioSystem.NOT_SPECIFIED cause IllegalArgumentException at Clip#open()
@@ -90,7 +88,7 @@ protected AudioFileFormat getAudioFileFormat(InputStream bitStream, int mediaLen
@Override
public AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException, IOException {
//noinspection IOStreamConstructor
- InputStream inputStream = new FileInputStream(file); // must be FileInputStream
+ InputStream inputStream = new FileInputStream(file); // must be FileInputStream because Alac accept it to use channel in it
try {
return getAudioInputStream(inputStream, (int) file.length());
} catch (UnsupportedAudioFileException | IOException e) {
@@ -121,7 +119,7 @@ public AudioInputStream getAudioInputStream(InputStream stream) throws Unsupport
*
* @param inputStream the input stream from which the AudioInputStream
* should be constructed.
- * @param mediaLength
+ * @param mediaLength unused
* @return an AudioInputStream object based on the audio file data contained
* in the input stream.
* @exception UnsupportedAudioFileException if the File does not point to a