Skip to content

Commit

Permalink
Merge pull request #11 from umjammer/1.0.15
Browse files Browse the repository at this point in the history
1.0.15
  • Loading branch information
umjammer authored Dec 13, 2022
2 parents 89aa671 + 36bffd8 commit 4f57eb0
Show file tree
Hide file tree
Showing 210 changed files with 946 additions and 817 deletions.
25 changes: 16 additions & 9 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,19 @@ jobs:
runs-on: macos-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 1.8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Checkout repository
uses: actions/checkout@v3

- name: Check w/o SNAPSHOT when "bump version"
if: ${{ contains(github.event.head_commit.message, 'bump version') }}
run: grep "<version>" pom.xml | head -1 | grep -v SNAPSHOT

- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
cache: maven

- name: Build with Maven
run: mvn -B package --file pom.xml
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<groupId>vavi</groupId>
<artifactId>vavi-sound</artifactId>
<version>1.0.14</version>
<version>1.0.15</version>

<name>Vavi Sound API</name>
<url>https://github.com/umjammer/vavi-sound</url>
Expand Down Expand Up @@ -119,7 +119,7 @@ TODO
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.9.0</version>
<version>5.9.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -130,7 +130,7 @@ TODO
<dependency>
<groupId>com.github.umjammer</groupId>
<artifactId>vavi-commons</artifactId>
<version>1.1.7</version>
<version>1.1.8</version>
</dependency>
<dependency>
<groupId>com.github.umjammer</groupId>
Expand All @@ -157,7 +157,7 @@ TODO
<dependency>
<groupId>vavi</groupId>
<artifactId>vavi-sound-nda</artifactId>
<version>1.0.12</version>
<version>1.0.13</version>
<exclusions>
<exclusion>
<groupId>com.github.umjammer</groupId>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/vavi/sound/adpcm/AdpcmInputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public int read() throws IOException {
}

/* */
public int read(byte b[], int off, int len) throws IOException {
public int read(byte[] b, int off, int len) throws IOException {
if (b == null) {
throw new NullPointerException();
} else if ((off < 0) || (off > b.length) || (len < 0) ||
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/vavi/sound/adpcm/dvi/Dvi.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class Dvi implements Codec {
};

/** */
private class State {
private static class State {
/** */
int valPrev;
/** */
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/vavi/sound/adpcm/ima/Ima.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

package vavi.sound.adpcm.ima;

import java.util.logging.Level;

import vavi.util.Debug;


Expand Down Expand Up @@ -60,7 +62,7 @@ private static int adjustState(int c) {
/** */
private static int[][] stateAdjustTable = new int[ISSTMAX + 1][8];

/** */
/* */
static {
for (int i = 0; i <= ISSTMAX; i++) {
for (int j = 0; j < 8; j++) {
Expand Down Expand Up @@ -104,7 +106,7 @@ private void decode(int channel,
}
int state = inBuffer[ip + 2] & 0xff;
if (state > ISSTMAX) {
Debug.println("IMA_ADPCM block ch" + channel + " initial-state (" + state + ") out of range");
Debug.println(Level.FINE, "IMA_ADPCM block ch" + channel + " initial-state (" + state + ") out of range");
state = 0;
}
// specs say to ignore ip[3] , but write it as 0
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/vavi/sound/adpcm/ima/ImaInputEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteOrder;
import java.util.logging.Level;

import vavi.io.InputEngine;
import vavi.io.LittleEndianDataInputStream;
Expand Down Expand Up @@ -41,12 +42,12 @@ class ImaInputEngine implements InputEngine {
public ImaInputEngine(OutputStream out,
int samplesPerBlock,
int channels,
final ByteOrder byteOrder) {
ByteOrder byteOrder) {
this.out = out;
this.samplesPerBlock = samplesPerBlock;
this.channels = channels;
this.byteOrder = byteOrder;
Debug.println("byteOrder: " + this.byteOrder);
Debug.println(Level.FINE, "byteOrder: " + this.byteOrder);
}

/* */
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/vavi/sound/adpcm/ms/Ms.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

package vavi.sound.adpcm.ms;

import java.util.logging.Level;

import vavi.util.Debug;


Expand All @@ -44,7 +46,7 @@
class Ms {

/** */
private class State {
private static class State {
/** step size */
int step;
int[] iCoef = new int[2];
Expand Down Expand Up @@ -133,7 +135,7 @@ public void decodeBlock(int channels,
for (int channel = 0; channel < channels; channel++) {
int bpred = inBuffer[ip++] & 0xff;
if (bpred >= nCoef) {
Debug.println("MSADPCM bpred >= nCoef, arbitrarily using 0");
Debug.println(Level.FINE, "MSADPCM bpred >= nCoef, arbitrarily using 0");
bpred = 0;
}
state[channel] = new State();
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/vavi/sound/adpcm/ms/MsInputEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteOrder;
import java.util.logging.Level;

import vavi.io.InputEngine;
import vavi.io.LittleEndianDataInputStream;
Expand Down Expand Up @@ -41,12 +42,12 @@ class MsInputEngine implements InputEngine {
public MsInputEngine(OutputStream out,
int samplesPerBlock,
int channels,
final ByteOrder byteOrder) {
ByteOrder byteOrder) {
this.out = out;
this.samplesPerBlock = samplesPerBlock;
this.channels = channels;
this.byteOrder = byteOrder;
Debug.println("byteOrder: " + this.byteOrder);
Debug.println(Level.FINE, "byteOrder: " + this.byteOrder);
}

/* */
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/vavi/sound/adpcm/ms/MsInputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteOrder;
import java.util.logging.Level;

import vavi.io.OutputEngineInputStream;
import vavi.util.Debug;
Expand Down Expand Up @@ -60,9 +61,9 @@ public MsInputStream(InputStream in,
channels,
blockSize,
samplesPerBlock);
Debug.println("numSamples: " + numSamples);
Debug.println(Level.FINE, "numSamples: " + numSamples);
this.available = numSamples * channels * bytesPerSample;
Debug.println("available: " + available);
Debug.println(Level.FINE, "available: " + available);
}

/** */
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/vavi/sound/adpcm/ms/MsOutputEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ class MsOutputEngine implements OutputEngine {

/** */
public MsOutputEngine(InputStream in,
final int samplesPerBlock,
final int nCoefs,
final int[][] iCoefs,
final int channels,
int samplesPerBlock,
int nCoefs,
int[][] iCoefs,
int channels,
int blockSize,
final ByteOrder byteOrder) {
ByteOrder byteOrder) {
this.in = in;
this.samplesPerBlock = samplesPerBlock;
if (nCoefs < 7 || nCoefs > 0x100) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/vavi/sound/adpcm/oki/OkiInputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import java.io.InputStream;
import java.nio.ByteOrder;
import java.util.logging.Level;

import vavi.sound.adpcm.AdpcmInputStream;
import vavi.sound.adpcm.Codec;
Expand All @@ -33,7 +34,7 @@ protected Codec getCodec() {
*/
public OkiInputStream(InputStream in, ByteOrder byteOrder) {
super(in, byteOrder, 4, ByteOrder.LITTLE_ENDIAN); // oki adpcm は little endian 固定
Debug.println(this.in);
Debug.println(Level.FINE, this.in);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/vavi/sound/adpcm/vox/Vox.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class Vox implements Codec {

/** */
private class State {
private static class State {
int index;
int last;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/vavi/sound/adpcm/yamaha/Yamaha.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class Yamaha implements Codec {

/** */
private class Status {
private static class Status {
int index = 127;
int last = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/vavi/sound/mfi/MfiDevice.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
public interface MfiDevice {

/** */
static class Info {
class Info {

/** */
String name;
Expand Down
35 changes: 17 additions & 18 deletions src/main/java/vavi/sound/mfi/MfiSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
Expand Down Expand Up @@ -72,8 +71,8 @@ public static Sequencer getSequencer()
throws MfiUnavailableException {

MfiDevice.Info[] infos = provider.getDeviceInfo();
for (int i = 0; i < infos.length; i++) {
MfiDevice device = provider.getDevice(infos[i]);
for (MfiDevice.Info info : infos) {
MfiDevice device = provider.getDevice(info);
if (device instanceof Sequencer) {
return (Sequencer) device;
}
Expand All @@ -87,8 +86,8 @@ public static javax.sound.midi.MetaEventListener getMetaEventListener()
throws MfiUnavailableException {

MfiDevice.Info[] infos = provider.getDeviceInfo();
for (int i = 0; i < infos.length; i++) {
MfiDevice device = provider.getDevice(infos[i]);
for (MfiDevice.Info info : infos) {
MfiDevice device = provider.getDevice(info);
if (device instanceof javax.sound.midi.MetaEventListener) {
return (javax.sound.midi.MetaEventListener) device;
}
Expand All @@ -103,8 +102,8 @@ public static MidiConverter getMidiConverter()
throws MfiUnavailableException {

MfiDevice.Info[] infos = provider.getDeviceInfo();
for (int i = 0; i < infos.length; i++) {
MfiDevice device = provider.getDevice(infos[i]);
for (MfiDevice.Info info : infos) {
MfiDevice device = provider.getDevice(info);
if (device instanceof MidiConverter) {
return (MidiConverter) device;
}
Expand Down Expand Up @@ -156,7 +155,7 @@ public static MfiFileFormat getMfiFileFormat(InputStream stream)
//Debug.println(StringUtil.paramString(mff));
return mff;
} catch (Exception e) {
Debug.println(e);
Debug.println(Level.WARNING, e);
}
}

Expand All @@ -168,7 +167,7 @@ public static MfiFileFormat getMfiFileFormat(File file)
throws InvalidMfiDataException,
IOException {

return getMfiFileFormat(new BufferedInputStream(new FileInputStream(file)));
return getMfiFileFormat(new BufferedInputStream(Files.newInputStream(file.toPath())));
}

/** MFi ファイルフォーマットを取得します。 */
Expand Down Expand Up @@ -204,7 +203,7 @@ public static Sequence getSequence(File file)
throws InvalidMfiDataException,
IOException {

return getSequence(new BufferedInputStream(new FileInputStream(file)));
return getSequence(new BufferedInputStream(Files.newInputStream(file.toPath())));
}

/** MFi シーケンスを取得します。 */
Expand All @@ -220,8 +219,8 @@ public static int[] getMfiFileTypes() {
List<Integer> types = new ArrayList<>();
for (MfiFileWriter writer : writers) {
int[] ts = writer.getMfiFileTypes();
for (int j = 0; j < ts.length; j++) {
types.add(ts[j]);
for (int t : ts) {
types.add(t);
}
}

Expand All @@ -238,8 +237,8 @@ public static int[] getMfiFileTypes(Sequence sequence) {
List<Integer> types = new ArrayList<>();
for (MfiFileWriter writer : writers) {
int[] ts = writer.getMfiFileTypes(sequence);
for (int j = 0; j < ts.length; j++) {
types.add(ts[j]);
for (int t : ts) {
types.add(t);
}
}

Expand Down Expand Up @@ -278,7 +277,7 @@ public static int write(Sequence in, int fileType, OutputStream out)
public static int write(Sequence in, int fileType, File out)
throws IOException {

return write(in, fileType, new BufferedOutputStream(new FileOutputStream(out)));
return write(in, fileType, new BufferedOutputStream(Files.newOutputStream(out.toPath())));
}

//-------------------------------------------------------------------------
Expand All @@ -293,7 +292,7 @@ public static int write(Sequence in, int fileType, File out)
/** default プロバイダ */
private static MfiDeviceProvider provider;

/**
/*
* default は MfiSystem.properties で指定します。
* <li>vavi.sound.mfi.spi.MfiDeviceProvider
*/
Expand All @@ -309,7 +308,7 @@ public static int write(Sequence in, int fileType, File out)
providers = ServiceLoader.load(vavi.sound.mfi.spi.MfiDeviceProvider.class);
providers.forEach(System.err::println);
provider = StreamSupport.stream(providers.spliterator(), false).filter(p -> p.getClass().getName().equals(defaultProvider)).findFirst().get();
Debug.println("default provider: " + provider.getClass().getName());
Debug.println(Level.FINE, "default provider: " + provider.getClass().getName());

readers = ServiceLoader.load(vavi.sound.mfi.spi.MfiFileReader.class);
providers.forEach(System.err::println);
Expand Down
Loading

0 comments on commit 4f57eb0

Please sign in to comment.