diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 77231df..fe3ed99 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -44,8 +44,14 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + server-id: github # Value of the distributionManagement/repository/id field of the pom.xml + settings-path: ${{ github.workspace }} # location for the settings.xml file # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -53,6 +59,10 @@ jobs: # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines # and modify them (or add more) to build your code if your project # uses a compiled language + - name: Build with Maven + run: mvn -B package --file pom.xml -s $GITHUB_WORKSPACE/settings.xml -Dmaven.test.skip=true + env: + GITHUB_TOKEN: ${{ github.token }} #- run: | # make bootstrap diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index eb50c00..7ce4bf5 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -1,7 +1,7 @@ # This workflow will build a Java project with Maven # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven -name: Java CI with Maven +name: Java CI on: push: @@ -22,10 +22,10 @@ jobs: if: ${{ contains(github.event.head_commit.message, 'bump version') }} run: grep "" pom.xml | head -1 | grep -v SNAPSHOT - - name: Set up JDK 8 + - name: Set up JDK 17 uses: actions/setup-java@v3 with: - java-version: '8' + java-version: '17' distribution: 'temurin' cache: maven diff --git a/.gitignore b/.gitignore index 3fec32c..a9bc98b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ tmp/ +local.properties diff --git a/README.md b/README.md index 1fcf400..c0b51dd 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,32 @@ [![Release](https://jitpack.io/v/umjammer/vavi-sound.svg)](https://jitpack.io/#umjammer/vavi-sound) -[![Java CI with Maven](https://github.com/umjammer/vavi-sound/workflows/Java%20CI%20with%20Maven/badge.svg)](https://github.com/umjammer/vavi-sound/actions) +[![Java CI](https://github.com/umjammer/vavi-sound/actions/workflows/maven.yml/badge.svg)](https://github.com/umjammer/vavi-sound/actionsworkflows/maven.yml) [![CodeQL](https://github.com/umjammer/vavi-sound/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/umjammer/vavi-sound/actions/workflows/codeql-analysis.yml) -![Java](https://img.shields.io/badge/Java-8-b07219) +![Java](https://img.shields.io/badge/Java-17-b07219) # vavi-sound Provides old school Japanese cell phone sounds library as `javax.sound` SPI. -Includes many ADPCM codecs and the SSRC sampling rate converter. +Includes many ADPCM codecs and the [SSRC](https://github.com/shibatch/SSRC) sampling rate converter. ## Status -| **SPI** | **Codec** | **Description** | **IN Status** | **OUT Status** | **SPI Status** | **Comment** | -|:--------|:-------------|:---------------------------|:--------------|:---------------|:---------------|:----------------------------| -| midi | MFi | Japanese cell phone format | 🚧 | ✅ | ✅ | | -| midi | SMAF | YAMAHA cell phone format | 🚧 | ✅ | ✅ | | -| sampled | MFi | Japanese cell phone format | ✅ | ✅ | ✅ | | -| sampled | SMAF | YAMAHA cell phone format | ✅ | ✅ | ✅ | | -| sampled | CCITT ADPCM | G711, G721, G723 | ✅ | ✅ | ✅ | | -| sampled | DVI ADPCM | DVI ADPCM | ✅ | ✅ | ✅ | | -| sampled | IMA ADPCM | IMA ADPCM | ✅ | ✅ | ✅ | | -| sampled | MA ADPCM | YAMAHA ADPCM | ✅ | ✅ | ✅ | | -| sampled | MS ADPCM | Microsoft ADPCM | ✅ | ✅ | ✅ | | -| sampled | OKI ADPCM | OKI ADPCM | ✅ | ✅ | ✅ | | -| sampled | ROHM ADPCM | ROHM ADPCM | ✅ | ✅ | ✅ | | -| sampled | VOX ADPCM | VOX ADPCM | ✅ | ✅ | ✅ | | -| sampled | YAMAHA ADPCM | YAMAHA ADPCM | ✅ | ✅ | - | same as ym2068 | -| sampled | YM2068 ADPCM | YAMAHA ADPCM | ✅ | ✅ | ✅ | | -| sampled | ssrc | resampling | ✅ | - | ✅ | need to wait for phase 1 | +| **SPI** | **Codec** | **Description** | **IN Status** | **OUT Status** | **SPI Status** | **Comment** | +|:--------|:---------------------------------------------------------|:---------------------------|:--------------|:---------------|:---------------|:----------------------------| +| midi | [MFi](src/main/java/vavi/sound/midi/mfi) | Japanese cell phone format | 🚧 | ✅ | ✅ | | +| midi | [SMAF](src/main/java/vavi/sound/midi/smaf) | YAMAHA cell phone format | 🚧 | ✅ | ✅ | | +| sampled | [MFi](src/main/java/vavi/sound/sampled/mfi) | Japanese cell phone format | ✅ | ✅ | ✅ | | +| sampled | [SMAF](src/main/java/vavi/sound/sampled/smaf) | YAMAHA cell phone format | ✅ | ✅ | ✅ | | +| sampled | [CCITT ADPCM](src/main/java/vavi/sound/adpcm/ccitt) | G711, G721, G723 | ✅ | ✅ | ✅ | | +| sampled | [DVI ADPCM](src/main/java/vavi/sound/adpcm/dvi) | DVI ADPCM | ✅ | ✅ | ✅ | | +| sampled | [IMA ADPCM](src/main/java/vavi/sound/adpcm/ima) | IMA ADPCM | ✅ | ✅ | ✅ | | +| sampled | [MA ADPCM](https://gitlab.com/umjammer/vavi-sound-nda) | YAMAHA ADPCM | ✅ | ✅ | ✅ | | +| sampled | [MS ADPCM](src/main/java/vavi/sound/adpcm/ms) | Microsoft ADPCM | ✅ | ✅ | ✅ | | +| sampled | [OKI ADPCM](src/main/java/vavi/sound/adpcm/oki) | OKI ADPCM | ✅ | ✅ | ✅ | | +| sampled | [ROHM ADPCM](https://gitlab.com/umjammer/vavi-sound-nda) | ROHM ADPCM | ✅ | ✅ | ✅ | | +| sampled | [VOX ADPCM](src/main/java/vavi/sound/adpcm/vox) | VOX ADPCM | ✅ | ✅ | ✅ | | +| sampled | [YAMAHA ADPCM](src/main/java/vavi/sound/adpcm/yamaha) | YAMAHA ADPCM | ✅ | ✅ | - | same as ym2068 | +| sampled | [YM2068 ADPCM](src/main/java/vavi/sound/adpcm/ym2608) | YAMAHA ADPCM | ✅ | ✅ | ✅ | | +| sampled | [ssrc](src/main/java/vavi/sound/pcm/resampling/ssrc) | resampling | ✅ | - | ✅ | need to wait for phase 1 | ## Install @@ -42,7 +42,7 @@ A. yes you can, follow those steps * `vavi/sound/pcm/resampling/ssrc/SSRC.class` * `vavi/util/SplitRadixFft.class` * `vavi/util/I0Bessel.class` - * caution: + * ⚠ **caution**: * your application complies with the LGPL. customers **have a right to reverse engineering your application**. * if you include ssrc.jar with a distribution, you **must offer a way to get ssrc source code**. * see also @@ -57,6 +57,7 @@ A. yes you can, follow those steps * use `Receiver` instead of `MetaEventListener` * ssrc: use nio pipe for 1st pass + * on macos m2 ultra 1st pass is in a blink of an eye * ~~`ima`, `ms` adpcm: wav reader~~ * ~~`tritonus:tritonus-remaining:org.tritonus.sampled.file.WaveAudioFileReader`~~ - * wip at `vavi-sound-sandbox` + * ~~wip at [vavi-sound-sandbox](https://github.com/umjammer/vavi-sound-sandbox)~~ done in this project diff --git a/local.properties.sample b/local.properties.sample new file mode 100644 index 0000000..7a65b1f --- /dev/null +++ b/local.properties.sample @@ -0,0 +1,3 @@ +#ssrc=/foo/bar.wav + +#sf2=/Users/nsano/Library/Audio/Sounds/Banks/Orchestra/baz.sf2 diff --git a/pom.xml b/pom.xml index d7c443b..5ee06ec 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ vavi vavi-sound - 1.0.15 + 1.0.16 Vavi Sound API https://github.com/umjammer/vavi-sound @@ -57,6 +57,40 @@ TODO NUL + + + assembly-with-test + + + + org.apache.maven.plugins + maven-assembly-plugin + 3.6.0 + + + src/main/assembly/assembly.xml + + + + + assembly-with-test + package + + single + + + + + PlayMFi + + + + + + + + + @@ -64,17 +98,15 @@ TODO org.apache.maven.plugins maven-compiler-plugin - 3.10.1 + 3.11.0 - 8 - 8 - UTF-8 + 17 org.codehaus.mojo native2ascii-maven-plugin - 2.0.1 + 2.1.0 @@ -91,11 +123,12 @@ TODO org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M7 + 3.1.2 -Djava.util.logging.config.file=${project.build.testOutputDirectory}/logging.properties -Dvavi.test.dev.null=${dev.null} + -Dvavi.test.volume=0.02 false @@ -119,7 +152,7 @@ TODO org.junit junit-bom - 5.9.1 + 5.10.0 pom import @@ -130,7 +163,7 @@ TODO com.github.umjammer vavi-commons - 1.1.8 + 1.1.9 com.github.umjammer @@ -144,15 +177,9 @@ TODO - com.github.umjammer + com.github.umjammer vavi-util-codec-sandbox - 1.0.1 - - - com.github.umjammer - vavi-commons - - + 1.0.2 vavi diff --git a/src/main/assembly/assembly.xml b/src/main/assembly/assembly.xml new file mode 100644 index 0000000..36389c7 --- /dev/null +++ b/src/main/assembly/assembly.xml @@ -0,0 +1,29 @@ + + + jar-with-dependencies-and-tests + + jar + + false + + + / + true + true + test + + + + + ${project.build.directory}/test-classes + / + + **/*.class + + true + + + \ No newline at end of file diff --git a/src/main/java/readme.md b/src/main/java/readme.md index 1d7cc25..db34d74 100644 --- a/src/main/java/readme.md +++ b/src/main/java/readme.md @@ -1,29 +1,29 @@ -# `vavi.sound` +# vavi.sound -このドキュメントは着メロライブラリの API 仕様です。 +those are sound API specs for the japanese old school cellphone ringtones. ## Feature - * {@link javax.sound.midi.spi} として実装されているため特にプログラムで意識することなく MFi ファイルを midi ファイルとして取り扱い可能です。 - * MFi バージョン 3.1 までの形式をサポートしています。 - * MFi ←→ SMF の相互変換が可能です。 - * 機種依存データのハンドラを追加する事で各機種に対応した着声が作成可能です。 + * we can play MFi/SMAF as a midi file because it's implemented as `javax.sound.midi.spi` + * supports until MFi version 3.1 + * mutual conversion between MFi ←→ SMF is possible + * by adding a handler for model-dependent data, you can create voice calls that are compatible with each model. ## Abstract -三つの大きなパートから構成されます。 +`vavi.sound` consists of three parts. 1. ADPCM codecs 2. MFi library - 3. {@link javax.sound.midi.spi} implementation + 3. `javax.sound.midi.spi` implementation ### 1. ADPCM codecs -パッケージ +packages - * {@link vavi.sound.adpcm.ccitt} - * {@link vavi.sound.adpcm.ma} - * {@link vavi.sound.adpcm.vox} + * `vavi.sound.adpcm.ccitt` + * `vavi.sound.adpcm.ma` + * `vavi.sound.adpcm.vox` 着声に使用される ADPCM コーデックを取り扱うパッケージ群です。 Java の標準 IO ({@link java.io.InputStream}/{@link java.io.OutputStream}) として実装されているため @@ -33,8 +33,8 @@ Java の標準 IO ({@link java.io.InputStream}/{@link java.io.OutputStream}) と packages - * {@link vavi.sound.mfi} - * {@link vavi.sound.mfi.vavi} + * `vavi.sound.mfi` + * `vavi.sound.mfi.vavi` * : 着メロライブラリの核となる部分です。MFi のファイル構造を取り扱い、MIDI 構造に変換する事が出来ます。 @@ -42,14 +42,14 @@ packages 機種依存データを扱うパッケージとして {@link vavi.sound.mfi.vavi.mitsubishi D社} と {@link vavi.sound.mfi.vavi.nec N社} がサンプル実装されています。 -### 3. {@link javax.sound.midi.spi} implementation +### 3. `javax.sound.midi.spi` implementation packages - * {@link vavi.sound.midi} - * {@link vavi.sound.midi.mfi} + * `vavi.sound.midi` + * `vavi.sound.midi.mfi` -{@link javax.sound.midi.spi} の一実装として機能させるためのパッケージです。 +`javax.sound.midi.spi` の一実装として機能させるためのパッケージです。 [SPI](http://java.sun.com/j2se/1.5.0/ja/docs/ja/guide/sound/programmer_guide/chapter1.html#111901) 仕様に従い登録すれば midi の一ファイル形式として MFi ファイルを 再生する事が可能になります。 diff --git a/src/main/java/vavi/sound/adpcm/AdpcmInputStream.java b/src/main/java/vavi/sound/adpcm/AdpcmInputStream.java index da0c36f..6cb731a 100644 --- a/src/main/java/vavi/sound/adpcm/AdpcmInputStream.java +++ b/src/main/java/vavi/sound/adpcm/AdpcmInputStream.java @@ -55,6 +55,7 @@ public AdpcmInputStream(InputStream in, ByteOrder byteOrder, int bits, ByteOrder } /** ADPCM (4bit) 換算時の長さ */ + @Override public int available() throws IOException { //Debug.println("0: " + in.available() + ", " + ((in.available() * 2) + (rest ? 1 : 0))); // TODO * 2 とか bits で計算すべき? @@ -69,6 +70,7 @@ public int available() throws IOException { /** * @return PCM H or L (8bit LSB 有効) */ + @Override public int read() throws IOException { //Debug.println(in); if (!rest) { @@ -98,7 +100,7 @@ public int read() throws IOException { } } - /* */ + @Override public int read(byte[] b, int off, int len) throws IOException { if (b == null) { throw new NullPointerException(); diff --git a/src/main/java/vavi/sound/adpcm/AdpcmOutputStream.java b/src/main/java/vavi/sound/adpcm/AdpcmOutputStream.java index ca4e3c6..7de9e13 100644 --- a/src/main/java/vavi/sound/adpcm/AdpcmOutputStream.java +++ b/src/main/java/vavi/sound/adpcm/AdpcmOutputStream.java @@ -59,6 +59,7 @@ public AdpcmOutputStream(OutputStream out, ByteOrder byteOrder, int bits, ByteOr /** * @param b PCM H or L byte を {@link #byteOrder} 順に指定 (LSB 8bit 有効) */ + @Override public void write(int b) throws IOException { if (!flushed) { diff --git a/src/main/java/vavi/sound/adpcm/ccitt/G711.java b/src/main/java/vavi/sound/adpcm/ccitt/G711.java index 01ccaf3..dec1060 100644 --- a/src/main/java/vavi/sound/adpcm/ccitt/G711.java +++ b/src/main/java/vavi/sound/adpcm/ccitt/G711.java @@ -56,8 +56,8 @@ abstract class G711 implements Codec { private static final int SIGN_BIT = 0x80; /** Quantization field mask. */ private static final int QUANT_MASK = 0xf; - /** Number of A-law segments. */ -// private static final int NSEGS = 8; +// /** Number of A-law segments. */ +// private static final int NSEGS = 8; /** Left shift for segment number. */ private static final int SEG_SHIFT = 4; /** Segment field mask. */ diff --git a/src/main/java/vavi/sound/adpcm/ccitt/G721.java b/src/main/java/vavi/sound/adpcm/ccitt/G721.java index 56779cc..8343eae 100644 --- a/src/main/java/vavi/sound/adpcm/ccitt/G721.java +++ b/src/main/java/vavi/sound/adpcm/ccitt/G721.java @@ -87,6 +87,7 @@ class G721 extends G711 { * Encodes the input vale of linear PCM, A-law or u-law data sl and returns * the resulting code. -1 is returned for unknown input coding value. */ + @Override public int encode(int sl) { // linearize input sample to 14-bit PCM @@ -133,7 +134,7 @@ public int encode(int sl) { return i; } -/** debug */ +///** debug */ //private int ccc = 0; /** @@ -142,6 +143,7 @@ public int encode(int sl) { * * @return -1 for unknown out_coding value. */ + @Override public int decode(int i) { i &= 0x0f; // mask to get proper bits @@ -184,7 +186,7 @@ public int decode(int i) { } } - /** */ + @Override public int getEncodingBits() { return 4; } diff --git a/src/main/java/vavi/sound/adpcm/ccitt/G721InputStream.java b/src/main/java/vavi/sound/adpcm/ccitt/G721InputStream.java index efaa64d..900d0a7 100644 --- a/src/main/java/vavi/sound/adpcm/ccitt/G721InputStream.java +++ b/src/main/java/vavi/sound/adpcm/ccitt/G721InputStream.java @@ -26,6 +26,7 @@ public class G721InputStream extends AdpcmInputStream { /** デコーダ */ + @Override protected Codec getCodec() { return new G721(); } diff --git a/src/main/java/vavi/sound/adpcm/ccitt/G721OutputStream.java b/src/main/java/vavi/sound/adpcm/ccitt/G721OutputStream.java index 0fffac9..693e326 100644 --- a/src/main/java/vavi/sound/adpcm/ccitt/G721OutputStream.java +++ b/src/main/java/vavi/sound/adpcm/ccitt/G721OutputStream.java @@ -23,6 +23,7 @@ public class G721OutputStream extends AdpcmOutputStream { /** エンコーダ */ + @Override protected Codec getCodec() { return new G721(); } diff --git a/src/main/java/vavi/sound/adpcm/ccitt/G723_16.java b/src/main/java/vavi/sound/adpcm/ccitt/G723_16.java index 2f631c2..32c7226 100644 --- a/src/main/java/vavi/sound/adpcm/ccitt/G723_16.java +++ b/src/main/java/vavi/sound/adpcm/ccitt/G723_16.java @@ -79,6 +79,7 @@ class G723_16 extends G711 { * code. * @return -1 if invalid input coding value. */ + @Override public int encode(int sl) { // linearize input sample to 14-bit PCM @@ -133,6 +134,7 @@ public int encode(int sl) { * the resulting 16-bit linear PCM, A-law or u-law sample value. * -1 is returned if the output coding is unknown. */ + @Override public int decode(int i) { i &= 0x03; // mask to get proper bits @@ -166,7 +168,7 @@ public int decode(int i) { } } - /** */ + @Override public int getEncodingBits() { return 2; } diff --git a/src/main/java/vavi/sound/adpcm/ccitt/G723_16InputStream.java b/src/main/java/vavi/sound/adpcm/ccitt/G723_16InputStream.java index 5f2117e..4fb401b 100644 --- a/src/main/java/vavi/sound/adpcm/ccitt/G723_16InputStream.java +++ b/src/main/java/vavi/sound/adpcm/ccitt/G723_16InputStream.java @@ -22,7 +22,7 @@ */ public class G723_16InputStream extends AdpcmInputStream { - /** */ + @Override protected Codec getCodec() { return new G723_16(); } @@ -39,6 +39,7 @@ public G723_16InputStream(InputStream in, ByteOrder byteOrder) { } /** ADPCM (4bit) 換算時の長さ */ + @Override public int available() throws IOException { //Debug.println("0: " + in.available() + ", " + ((in.available() * 2) + (rest ? 1 : 0))); return (in.available() * 4) + (rest ? 1 : 0); // TODO check * 4 ??? diff --git a/src/main/java/vavi/sound/adpcm/ccitt/G723_24.java b/src/main/java/vavi/sound/adpcm/ccitt/G723_24.java index c95faac..63c83aa 100644 --- a/src/main/java/vavi/sound/adpcm/ccitt/G723_24.java +++ b/src/main/java/vavi/sound/adpcm/ccitt/G723_24.java @@ -71,6 +71,7 @@ class G723_24 extends G711 { * code. * @return -1 if invalid input coding value. */ + @Override public int encode(int sl) { // linearize input sample to 14-bit PCM @@ -115,6 +116,7 @@ public int encode(int sl) { * the resulting 16-bit linear PCM, A-law or u-law sample value. * -1 is returned if the output coding is unknown. */ + @Override public int decode(int i) { i &= 0x07; // mask to get proper bits @@ -146,7 +148,7 @@ public int decode(int i) { } } - /** */ + @Override public int getEncodingBits() { return 3; } diff --git a/src/main/java/vavi/sound/adpcm/ccitt/G723_40.java b/src/main/java/vavi/sound/adpcm/ccitt/G723_40.java index f534a8a..6fb5a44 100644 --- a/src/main/java/vavi/sound/adpcm/ccitt/G723_40.java +++ b/src/main/java/vavi/sound/adpcm/ccitt/G723_40.java @@ -91,6 +91,7 @@ class G723_40 extends G711 { * the resulting 5-bit CCITT G.723 40Kbps code. * @return -1 if the input coding value is invalid. */ + @Override public int encode(int sl) { // linearize input sample to 14-bit PCM @@ -137,6 +138,7 @@ public int encode(int sl) { * the resulting 16-bit linear PCM, A-law or u-law sample value. * -1 is returned if the output coding is unknown. */ + @Override public int decode(int i) { i &= 0x1f; // mask to get proper bits @@ -170,7 +172,7 @@ public int decode(int i) { } } - /** */ + @Override public int getEncodingBits() { return 5; } diff --git a/src/main/java/vavi/sound/adpcm/ccitt/readme.md b/src/main/java/vavi/sound/adpcm/ccitt/readme.md index 1c8fa54..9a02864 100644 --- a/src/main/java/vavi/sound/adpcm/ccitt/readme.md +++ b/src/main/java/vavi/sound/adpcm/ccitt/readme.md @@ -1,11 +1,11 @@ # vavi.sound.adpcm.ccitt -CCITT 勧告の音声圧縮フォーマット関連のクラスを提供します。 +Provides CCITT recommendation audio compression related classes. ## Tech-know - * encoder.exe は little endian - * PCM_SIGNED の場合はちゃんと 16Bit Signed な数値を渡してやる + * encoder.exe is little endian + * it's necessary to provide '16Bit Signed' value when `PCM_SIGNED` ## TODO diff --git a/src/main/java/vavi/sound/adpcm/dvi/Dvi.java b/src/main/java/vavi/sound/adpcm/dvi/Dvi.java index c5ef325..0bb813b 100644 --- a/src/main/java/vavi/sound/adpcm/dvi/Dvi.java +++ b/src/main/java/vavi/sound/adpcm/dvi/Dvi.java @@ -92,6 +92,7 @@ public State getState() { * @param input pcm * @return adpcm */ + @Override public int encode(int input) { // @@ -174,6 +175,7 @@ public int encode(int input) { /** * @param input adpcm */ + @Override public int decode(int input) { // diff --git a/src/main/java/vavi/sound/adpcm/dvi/DviInputStream.java b/src/main/java/vavi/sound/adpcm/dvi/DviInputStream.java index ef29f8d..c4c179d 100644 --- a/src/main/java/vavi/sound/adpcm/dvi/DviInputStream.java +++ b/src/main/java/vavi/sound/adpcm/dvi/DviInputStream.java @@ -21,7 +21,7 @@ */ public class DviInputStream extends AdpcmInputStream { - /** */ + @Override protected Codec getCodec() { return new Dvi(); } diff --git a/src/main/java/vavi/sound/adpcm/dvi/DviOutputStream.java b/src/main/java/vavi/sound/adpcm/dvi/DviOutputStream.java index bb246ac..cec0532 100644 --- a/src/main/java/vavi/sound/adpcm/dvi/DviOutputStream.java +++ b/src/main/java/vavi/sound/adpcm/dvi/DviOutputStream.java @@ -21,7 +21,7 @@ */ public class DviOutputStream extends AdpcmOutputStream { - /** */ + @Override protected Codec getCodec() { return new Dvi(); } diff --git a/src/main/java/vavi/sound/adpcm/dvi/readme.md b/src/main/java/vavi/sound/adpcm/dvi/readme.md index 0900896..0ec3a87 100644 --- a/src/main/java/vavi/sound/adpcm/dvi/readme.md +++ b/src/main/java/vavi/sound/adpcm/dvi/readme.md @@ -1,18 +1,18 @@ # vavi.sound.adpcm.dvi -Intel/DVI ADPCM フォーマット関連のクラスを提供します. +Provices Intel/DVI ADPCM codec related classes. ## Status -完成 +completed ## Tech-know - * audiocafe の Java 移植はバグってる? + * the porting to java by audiocafe has bugs? ## TODO - * ~~datetime="060124 一括読み込みを止める~~ + * ~~060124 stop reading at once~~ * ~~encode~~ ## License diff --git a/src/main/java/vavi/sound/adpcm/ima/ImaInputEngine.java b/src/main/java/vavi/sound/adpcm/ima/ImaInputEngine.java index 3d67527..1b9ac80 100644 --- a/src/main/java/vavi/sound/adpcm/ima/ImaInputEngine.java +++ b/src/main/java/vavi/sound/adpcm/ima/ImaInputEngine.java @@ -50,7 +50,7 @@ public ImaInputEngine(OutputStream out, Debug.println(Level.FINE, "byteOrder: " + this.byteOrder); } - /* */ + @Override public void initialize(InputStream in) throws IOException { if (this.in != null) { throw new IOException("Already initialized"); @@ -67,6 +67,7 @@ public void initialize(InputStream in) throws IOException { * {@link IOStreamInputEngine#IOStreamInputEngine(OutputStream, vavix.io.IOStreamInputEngine.InputStreamFactory, int)} * の bufferSize を {@link #samplesPerBlock} * 2 にすること。 */ + @Override public void execute() throws IOException { if (in == null) { throw new IOException("Not yet initialized"); @@ -99,7 +100,7 @@ public void execute() throws IOException { } } - /* */ + @Override public void finish() throws IOException { out.flush(); out.close(); diff --git a/src/main/java/vavi/sound/adpcm/ima/ImaInputStream.java b/src/main/java/vavi/sound/adpcm/ima/ImaInputStream.java index 07e3bde..6b1b6e2 100644 --- a/src/main/java/vavi/sound/adpcm/ima/ImaInputStream.java +++ b/src/main/java/vavi/sound/adpcm/ima/ImaInputStream.java @@ -66,19 +66,18 @@ public ImaInputStream(InputStream in, /** */ private int available; - /** */ + @Override public int available() throws IOException { return available; } - /** - */ + @Override public int read() throws IOException { available--; return in.read(); } - /** */ + @Override public int read(byte[] b, int off, int len) throws IOException { if (b == null) { throw new NullPointerException("b"); diff --git a/src/main/java/vavi/sound/adpcm/ima/ImaOutputEngine.java b/src/main/java/vavi/sound/adpcm/ima/ImaOutputEngine.java index 4989155..8250cfd 100644 --- a/src/main/java/vavi/sound/adpcm/ima/ImaOutputEngine.java +++ b/src/main/java/vavi/sound/adpcm/ima/ImaOutputEngine.java @@ -53,7 +53,7 @@ public ImaOutputEngine(InputStream in, this.byteOrder = byteOrder; } - /** */ + @Override public void initialize(OutputStream out) throws IOException { if (this.out != null) { throw new IOException("Already initialized"); @@ -65,7 +65,7 @@ public void initialize(OutputStream out) throws IOException { } } - /** */ + @Override public void execute() throws IOException { if (out == null) { throw new IOException("Not yet initialized"); @@ -96,7 +96,7 @@ public void execute() throws IOException { } } - /** */ + @Override public void finish() throws IOException { in.close(); } diff --git a/src/main/java/vavi/sound/adpcm/ima/readme.md b/src/main/java/vavi/sound/adpcm/ima/readme.md index e3ae1c6..d884c61 100644 --- a/src/main/java/vavi/sound/adpcm/ima/readme.md +++ b/src/main/java/vavi/sound/adpcm/ima/readme.md @@ -1,19 +1,19 @@ -IMA ADPCM フォーマット関連のクラスを提供します. +# vavi.sound.adpcm.ima + +Provides IMA ADPCM codec related classes. ## TODO - * ~~111016 一括読み込みを止める~~ - * ~~111016 ↑もしくは EngineeringIO を使う~~ - * ~~060121 ちょっと違うところがある bdiff linear_8k_16_mono.pcm, out.vavi.pcm~~ - * ~~030831 全部再生されない?~~ → SourceDataLine#drain() - * ~~111101 encode 111031 あとちょっと、初期値とか?~~ + * ~~111016 stop reading at one~~ + * ~~111016 ↑or use EngineeringIO~~ + * ~~060121 `bdiff linear_8k_16_mono.pcm, out.vavi.pcm` are a bit different~~ + * ~~030831 not play all?~~ → SourceDataLine#drain() + * ~~111101 encode 111031 a little more, initial value?~~ * tritonus WaveAudioFileReader has ima adpcm detection * tritonus has ima adpcm coverter (ImaAdpcmFormatConversionProvider) ## License -WARNING THIS PROGRAM LICENCE IS LGPL - ``` /* ima_rw.c -- codex utilities for WAV_FORMAT_IMA_ADPCM diff --git a/src/main/java/vavi/sound/adpcm/ms/MsInputEngine.java b/src/main/java/vavi/sound/adpcm/ms/MsInputEngine.java index 9cc2b26..bdfc9b4 100644 --- a/src/main/java/vavi/sound/adpcm/ms/MsInputEngine.java +++ b/src/main/java/vavi/sound/adpcm/ms/MsInputEngine.java @@ -51,6 +51,7 @@ public MsInputEngine(OutputStream out, } /* */ + @Override public void initialize(InputStream in) throws IOException { if (this.in != null) { throw new IOException("Already initialized"); @@ -67,6 +68,7 @@ public void initialize(InputStream in) throws IOException { * {@link IOStreamInputEngine#IOStreamInputEngine(OutputStream, vavix.io.IOStreamInputEngine.InputStreamFactory, int)} * の bufferSize を {@link #samplesPerBlock} * 2 にすること。 */ + @Override public void execute() throws IOException { if (in == null) { throw new IOException("Not yet initialized"); @@ -100,7 +102,7 @@ public void execute() throws IOException { } } - /* */ + @Override public void finish() throws IOException { out.flush(); out.close(); diff --git a/src/main/java/vavi/sound/adpcm/ms/MsInputStream.java b/src/main/java/vavi/sound/adpcm/ms/MsInputStream.java index f8ed36b..574012f 100644 --- a/src/main/java/vavi/sound/adpcm/ms/MsInputStream.java +++ b/src/main/java/vavi/sound/adpcm/ms/MsInputStream.java @@ -69,19 +69,18 @@ public MsInputStream(InputStream in, /** */ private int available; - /** */ + @Override public int available() throws IOException { return available; } - /** - */ + @Override public int read() throws IOException { available--; return in.read(); } - /** */ + @Override public int read(byte[] b, int off, int len) throws IOException { if (b == null) { throw new NullPointerException("b"); diff --git a/src/main/java/vavi/sound/adpcm/ms/MsOutputEngine.java b/src/main/java/vavi/sound/adpcm/ms/MsOutputEngine.java index c91cd00..63fbf0f 100644 --- a/src/main/java/vavi/sound/adpcm/ms/MsOutputEngine.java +++ b/src/main/java/vavi/sound/adpcm/ms/MsOutputEngine.java @@ -62,7 +62,7 @@ public MsOutputEngine(InputStream in, this.byteOrder = byteOrder; } - /* */ + @Override public void initialize(OutputStream out) throws IOException { if (this.out != null) { throw new IOException("Already initialized"); @@ -74,7 +74,7 @@ public void initialize(OutputStream out) throws IOException { } } - /* */ + @Override public void execute() throws IOException { if (out == null) { throw new IOException("Not yet initialized"); @@ -107,7 +107,7 @@ public void execute() throws IOException { } } - /* */ + @Override public void finish() throws IOException { in.close(); } diff --git a/src/main/java/vavi/sound/adpcm/ms/readme.md b/src/main/java/vavi/sound/adpcm/ms/readme.md index ddfef1b..7db0884 100644 --- a/src/main/java/vavi/sound/adpcm/ms/readme.md +++ b/src/main/java/vavi/sound/adpcm/ms/readme.md @@ -1,23 +1,24 @@ -vavi.sound.adpcm.ms +# vavi.sound.adpcm.ms -MS ADPCM フォーマット関連のクラスを提供します. +Provices MS ADPCM codec related classes. ## Status -sox と同じ結果になったので完成とみなす。 +we assume completed because result is the same as sox. ## Tech-know - * ACM の M$ ADPCM とは結果が違う + * result is different from ACM M$ ADPCM ## TODO - * ~~datetime="111016">一括読み込みを止める~~ - * ~~datetime="111016">↑もしくは EngineeringIO を使う~~ - * ~~datetime="060124">音が汚い~~ - * ~~最後のフラグメントが切れている~~ → #drain() + * ~~111016 stop reading at once~~ + * ~~111016 ↑ or use EngineeringIO~~ + * ~~060124 sound is dirty~~ + * ~~end of the sound is cut~~ → #drain() + +## License -## TODO ``` /* * adpcm.c codex functions for MS_ADPCM data diff --git a/src/main/java/vavi/sound/adpcm/oki/Oki.java b/src/main/java/vavi/sound/adpcm/oki/Oki.java index 174fbaa..54f2cac 100644 --- a/src/main/java/vavi/sound/adpcm/oki/Oki.java +++ b/src/main/java/vavi/sound/adpcm/oki/Oki.java @@ -81,6 +81,7 @@ class Oki implements Codec { * @param a 16bit signed linear pcm * @return 4bit oki adpcm */ + @Override public int encode(int a) { // mc->mc_estim には、前回の差分比予測値インデックスが入っている @@ -170,6 +171,7 @@ public int encode(int a) { * @param b 4bit adpcm * @return 16bit linear pcm */ + @Override public int decode(int b) { // mc->mc_estim には、前回の差分比予測値インデックスが入っている int estim = this.mc_estim; diff --git a/src/main/java/vavi/sound/adpcm/oki/OkiInputStream.java b/src/main/java/vavi/sound/adpcm/oki/OkiInputStream.java index c9bdf0f..08de790 100644 --- a/src/main/java/vavi/sound/adpcm/oki/OkiInputStream.java +++ b/src/main/java/vavi/sound/adpcm/oki/OkiInputStream.java @@ -23,7 +23,7 @@ */ public class OkiInputStream extends AdpcmInputStream { - /** */ + @Override protected Codec getCodec() { return new Oki(); } diff --git a/src/main/java/vavi/sound/adpcm/oki/OkiOutputStream.java b/src/main/java/vavi/sound/adpcm/oki/OkiOutputStream.java index 0a6f600..2a4746d 100644 --- a/src/main/java/vavi/sound/adpcm/oki/OkiOutputStream.java +++ b/src/main/java/vavi/sound/adpcm/oki/OkiOutputStream.java @@ -22,6 +22,7 @@ public class OkiOutputStream extends AdpcmOutputStream { /** エンコーダ */ + @Override protected Codec getCodec() { return new Oki(); } diff --git a/src/main/java/vavi/sound/adpcm/oki/readme.md b/src/main/java/vavi/sound/adpcm/oki/readme.md index f1a5e6a..3450475 100644 --- a/src/main/java/vavi/sound/adpcm/oki/readme.md +++ b/src/main/java/vavi/sound/adpcm/oki/readme.md @@ -1,8 +1,10 @@ -OKI ADPCM codec +# vavi.sound.adpcm.oki + +Provices OKI ADPCM codec related classes. ## Status -finished +completed ## TODO diff --git a/src/main/java/vavi/sound/adpcm/readme.md b/src/main/java/vavi/sound/adpcm/readme.md index 4000cc1..3cd6115 100644 --- a/src/main/java/vavi/sound/adpcm/readme.md +++ b/src/main/java/vavi/sound/adpcm/readme.md @@ -1,10 +1,10 @@ # vavi.sound.adpcm -ADPCM サウンド CODEC 関連のクラスを提供します. +Provides ADPCM CODEC related packages. ## TODO - * javax.sound.sampled.spi に組み込み - * サンプリングレートの変換 - * ~~"060427 Codec インターフェースの抜き出し~~ - * ~~"060427 AdpcmInputStream/AdpcmOutputStream インターフェースの抜き出し~~ + * ~~make those as javax.sound.sampled.spi~~ + * sampling rate conversion + * ~~060427 extract Codec interface~~ + * ~~060427 extract AdpcmInputStream/AdpcmOutputStream interface~~ diff --git a/src/main/java/vavi/sound/adpcm/vox/Vox.java b/src/main/java/vavi/sound/adpcm/vox/Vox.java index 7b7c046..283374f 100644 --- a/src/main/java/vavi/sound/adpcm/vox/Vox.java +++ b/src/main/java/vavi/sound/adpcm/vox/Vox.java @@ -35,7 +35,7 @@ private static class State { /** */ private State state = new State(); - /** */ + @Override public int encode(int samp) { int code = 0; int ss = table[state.index]; @@ -62,7 +62,7 @@ public int encode(int samp) { return code; } - /** */ + @Override public int decode(int code) { int diff; int ss = table[state.index]; diff --git a/src/main/java/vavi/sound/adpcm/vox/VoxInputStream.java b/src/main/java/vavi/sound/adpcm/vox/VoxInputStream.java index 25416c1..56525b7 100644 --- a/src/main/java/vavi/sound/adpcm/vox/VoxInputStream.java +++ b/src/main/java/vavi/sound/adpcm/vox/VoxInputStream.java @@ -22,7 +22,7 @@ */ public class VoxInputStream extends AdpcmInputStream { - /** */ + @Override protected Codec getCodec() { return new Vox(); } @@ -35,7 +35,7 @@ public VoxInputStream(InputStream in, ByteOrder byteOrder) { super(in, byteOrder, 4, ByteOrder.BIG_ENDIAN); } - /** */ + @Override public int available() throws IOException { //Debug.println("0: " + in.available() + ", " + ((in.available() * 2) + (rest ? 1 : 0))); return (in.available() * 2) + (rest ? 1 : 0); @@ -44,6 +44,7 @@ public int available() throws IOException { /** * TODO endian */ + @Override public int read() throws IOException { //Debug.println(in); if (!rest) { diff --git a/src/main/java/vavi/sound/adpcm/vox/VoxOutputStream.java b/src/main/java/vavi/sound/adpcm/vox/VoxOutputStream.java index 81d1e8b..91fe8b0 100644 --- a/src/main/java/vavi/sound/adpcm/vox/VoxOutputStream.java +++ b/src/main/java/vavi/sound/adpcm/vox/VoxOutputStream.java @@ -25,6 +25,7 @@ public class VoxOutputStream extends AdpcmOutputStream { /** エンコーダ */ + @Override protected Codec getCodec() { return new Vox(); } @@ -42,6 +43,7 @@ public VoxOutputStream(OutputStream out, ByteOrder byteOrder) { /** * @param b */ + @Override public void write(int b) throws IOException { if (!flushed) { diff --git a/src/main/java/vavi/sound/adpcm/vox/readme.md b/src/main/java/vavi/sound/adpcm/vox/readme.md index 5869bee..f15ad6b 100644 --- a/src/main/java/vavi/sound/adpcm/vox/readme.md +++ b/src/main/java/vavi/sound/adpcm/vox/readme.md @@ -1,10 +1,10 @@ # vavi.sound.adpcm.vox -VOX ADPCM フォーマット関連のクラスを提供します. +Provides VOX ADPCM codec related classes. # Status -完成 +completed ## TODO diff --git a/src/main/java/vavi/sound/adpcm/yamaha/Yamaha.java b/src/main/java/vavi/sound/adpcm/yamaha/Yamaha.java index fe99063..d46af3b 100644 --- a/src/main/java/vavi/sound/adpcm/yamaha/Yamaha.java +++ b/src/main/java/vavi/sound/adpcm/yamaha/Yamaha.java @@ -67,6 +67,7 @@ private int adjust(int code, int ss) { * @param code ADPCM (LSB 4bit 有効) * @return 16bit PCM signed */ + @Override public int decode(int code) { int ss = stat.index; @@ -100,6 +101,7 @@ public int decode(int code) { * @param samp 16bit PCM signed * @return ADPCM (LSB 4bit 有効) */ + @Override public int encode(int samp) { int diff; int ss = stat.index; diff --git a/src/main/java/vavi/sound/adpcm/yamaha/YamahaInputStream.java b/src/main/java/vavi/sound/adpcm/yamaha/YamahaInputStream.java index 42468e1..1128f8e 100644 --- a/src/main/java/vavi/sound/adpcm/yamaha/YamahaInputStream.java +++ b/src/main/java/vavi/sound/adpcm/yamaha/YamahaInputStream.java @@ -21,7 +21,7 @@ */ public class YamahaInputStream extends AdpcmInputStream { - /** */ + @Override protected Codec getCodec() { return new Yamaha(); } diff --git a/src/main/java/vavi/sound/adpcm/yamaha/YamahaOutputStream.java b/src/main/java/vavi/sound/adpcm/yamaha/YamahaOutputStream.java index 2af84df..51bcb0b 100644 --- a/src/main/java/vavi/sound/adpcm/yamaha/YamahaOutputStream.java +++ b/src/main/java/vavi/sound/adpcm/yamaha/YamahaOutputStream.java @@ -22,6 +22,7 @@ public class YamahaOutputStream extends AdpcmOutputStream { /** エンコーダ */ + @Override protected Codec getCodec() { return new Yamaha(); } diff --git a/src/main/java/vavi/sound/adpcm/yamaha/readme.md b/src/main/java/vavi/sound/adpcm/yamaha/readme.md index 4d7a335..95e150a 100644 --- a/src/main/java/vavi/sound/adpcm/yamaha/readme.md +++ b/src/main/java/vavi/sound/adpcm/yamaha/readme.md @@ -1,14 +1,15 @@ # vavi.sound.adpcm.yamaha -YAMAHA MA Chip ADPCM フォーマット関連のクラスを提供します. +Provides YAMAHA MA Chip ADPCM codec related classes. -# Status +## Status -完成 +completed -

-よう見たら YM2608 のコードと一緒やん、何が2年の研究やねん +## Tech-Know + +If you look at it, it's the same code as YM2608, wtf two years of research? ## License -記載なし +none diff --git a/src/main/java/vavi/sound/adpcm/ym2608/Ym2608.java b/src/main/java/vavi/sound/adpcm/ym2608/Ym2608.java index 1dcc4ef..be46d49 100644 --- a/src/main/java/vavi/sound/adpcm/ym2608/Ym2608.java +++ b/src/main/java/vavi/sound/adpcm/ym2608/Ym2608.java @@ -43,6 +43,7 @@ void next() { * @param pcm PCM 16bit * @return ADPCM 4bit */ + @Override public int encode(int pcm) { // エンコード処理 2 @@ -96,6 +97,7 @@ public int encode(int pcm) { * @param adpcm ADPCM (LSB 4 bit 有効) * @return PCM */ + @Override public int decode(int adpcm) { // デコード処理 2, 3 diff --git a/src/main/java/vavi/sound/adpcm/ym2608/Ym2608InputStream.java b/src/main/java/vavi/sound/adpcm/ym2608/Ym2608InputStream.java index 7810471..eda01b3 100644 --- a/src/main/java/vavi/sound/adpcm/ym2608/Ym2608InputStream.java +++ b/src/main/java/vavi/sound/adpcm/ym2608/Ym2608InputStream.java @@ -21,7 +21,7 @@ */ public class Ym2608InputStream extends AdpcmInputStream { - /** */ + @Override protected Codec getCodec() { return new Ym2608(); } diff --git a/src/main/java/vavi/sound/adpcm/ym2608/Ym2608OutputStream.java b/src/main/java/vavi/sound/adpcm/ym2608/Ym2608OutputStream.java index 2d94e84..38aaf3a 100644 --- a/src/main/java/vavi/sound/adpcm/ym2608/Ym2608OutputStream.java +++ b/src/main/java/vavi/sound/adpcm/ym2608/Ym2608OutputStream.java @@ -22,6 +22,7 @@ public class Ym2608OutputStream extends AdpcmOutputStream { /** エンコーダ */ + @Override protected Codec getCodec() { return new Ym2608(); } diff --git a/src/main/java/vavi/sound/adpcm/ym2608/readme.md b/src/main/java/vavi/sound/adpcm/ym2608/readme.md index e776d86..e9dc735 100644 --- a/src/main/java/vavi/sound/adpcm/ym2608/readme.md +++ b/src/main/java/vavi/sound/adpcm/ym2608/readme.md @@ -1,26 +1,26 @@ # vavi.sound.adpcm.ym2608 -YAMAHA (YM2608) ADPCM フォーマット関連のクラスを提供します. +Provides YAMAHA (YM2608) ADPCM codec related classes. ## Status -完成(たぶん) +completed (maybe) ## TODO - * ~~なんか音がちっちゃーい~~ + * ~~somehow the sound is small~~ * ~~OutputStream~~ - * C のリファレンスのほうがおかしい encode の i = のあたりが > 0 になることがある + * the C reference is strange. around `i =` at `encode` may be < 0. ## License -記載なし +none ## ADPCMの基礎知識、およびYM2608のADPCM仕様 [source](http://hackipedia.org/Platform/Sega/Genesis/hardware,%20FM%20synthesis,%20YM2608/html/adpcm.html) -### ◆ ADPCM +### ADPCM ADPCMはMPEGと違い、リニアPCMデータに対して1サンプルの振幅情報を圧縮する方式である。 ADPCMはサンプル間の差分を用いてデータ圧縮を行うという基本は変わらないが、コーデックの種類は多数存在し、YM2608のADPCM仕様もそのコーデックの1つである。 @@ -54,7 +54,7 @@ ADPCMはMPEGと違いリアルタイムエンコード時のレイテンシー MPEG形式の周波数帯域圧縮はある一定時間(512サンプル)のサンプリングデータに対して圧縮しなければならない。 これに対してADPCMは、1~3サンプル程度のデータから圧縮が可能であり、音声通信によるレイテンシを大きく下げる事が可能である。 -### ◆ エンコード +### Encoding YM2608のADPCMアルゴリズムは比較的単純である。 YM2608のADPCMは16ビットのPCMを4ビットのADPCMデータに変換する。 @@ -79,19 +79,19 @@ YM2608のADPCMは16ビットのPCMを4ビットのADPCMデータに変換する ⊿n と Sn の分割値 I が1/4以上かつ2/4未満であれば An は1というように求める。 つまり実際の差分が予測ステップサイズを超える精度になった場合(1/4未満や7/4以上)、予測値を大きく外れている可能性があり、これはデータ再現性に影響が出始める事を表す。 - * ⊿n が正の場合は An の最上位ビット(ビット4)を0、負の場合は1にする。 + * `⊿n` が正の場合は An の最上位ビット(ビット4)を0、負の場合は1にする。 * 予測値 x(n+1) を求める。予測値の更新には An の各ビット値と以下の式を用いて求める。
```x x(n+1) = ( 1-2xL4 ) x ( L3 + L2/2 + L1/4 + 1/8 ) x ⊿n + xn ``` - * ステップサイズ S(n+1) を求める。ステップサイズの更新には、An の下位3ビットと上記表の f との関係を用いて求める。
+ * ステップサイズ `S(n+1)` を求める。ステップサイズの更新には、An の下位3ビットと上記表の f との関係を用いて求める。
``` S(n+1) = f( An ) x Sn ``` * ステップサイズ Sn を飽和する。YM2608のADPCMステップサイズは最小127、最大24576と決められている。 * データの終端まで2~7を繰り返す。 -## ◆ デコード +### Decoding エンコードの5と6が予測値とステップサイズを求める式となり、予測値 xn が復元値 Xn になる。 diff --git a/src/main/java/vavi/sound/mfi/NoteMessage.java b/src/main/java/vavi/sound/mfi/NoteMessage.java index 53d24fd..f28283b 100644 --- a/src/main/java/vavi/sound/mfi/NoteMessage.java +++ b/src/main/java/vavi/sound/mfi/NoteMessage.java @@ -149,6 +149,7 @@ public void setNote(int note) { * ボイスナンバを取得します. * @return ボイスナンバ */ + @Override public int getVoice() { return voice; } @@ -157,6 +158,7 @@ public int getVoice() { * ボイスナンバを設定します. * @param voice ボイスナンバ */ + @Override public void setVoice(int voice) { this.voice = voice & 0x03; this.data[1] = (byte) ((this.data[1] & 0x3f) | (this.voice << 6)); diff --git a/src/main/java/vavi/sound/mfi/Synthesizer.java b/src/main/java/vavi/sound/mfi/Synthesizer.java index 7e494b5..a6824fb 100644 --- a/src/main/java/vavi/sound/mfi/Synthesizer.java +++ b/src/main/java/vavi/sound/mfi/Synthesizer.java @@ -8,6 +8,8 @@ import javax.sound.midi.Instrument; import javax.sound.midi.MidiChannel; +import javax.sound.midi.MidiUnavailableException; +import javax.sound.midi.Receiver; import javax.sound.midi.Soundbank; @@ -22,20 +24,23 @@ */ public interface Synthesizer extends MfiDevice { - /** for volume controle */ - MidiChannel[] getChannels() throws MfiUnavailableException; + /** @see javax.sound.midi.Synthesizer#getChannels() */ + MidiChannel[] getChannels(); - /** */ + /** @see javax.sound.midi.Synthesizer#getDefaultSoundbank() */ Soundbank getDefaultSoundbank(); - /** */ + /** @see javax.sound.midi.Synthesizer#getAvailableInstruments() */ Instrument[] getAvailableInstruments(); - /** */ + /** @see javax.sound.midi.Synthesizer#getChannels() */ boolean loadAllInstruments(Soundbank soundbank); - /** */ + /** @see javax.sound.midi.Synthesizer#unloadAllInstruments(Soundbank) */ void unloadAllInstruments(Soundbank soundbank); + + /** @see javax.sound.midi.Synthesizer#getReceiver() */ + Receiver getReceiver() throws MidiUnavailableException; } /* */ diff --git a/src/main/java/vavi/sound/mfi/spi/readme.md b/src/main/java/vavi/sound/mfi/spi/readme.md index cdd0348..e8f0e1b 100644 --- a/src/main/java/vavi/sound/mfi/spi/readme.md +++ b/src/main/java/vavi/sound/mfi/spi/readme.md @@ -1,5 +1,5 @@ # vavi.sound.mfi.spi -MFi のサービスプロバイダのクラスを提供します. +Provides MFi service provider related classes. ## TODO diff --git a/src/main/java/vavi/sound/mfi/vavi/AudioDataMessage.java b/src/main/java/vavi/sound/mfi/vavi/AudioDataMessage.java index 7bbb620..3905565 100644 --- a/src/main/java/vavi/sound/mfi/vavi/AudioDataMessage.java +++ b/src/main/java/vavi/sound/mfi/vavi/AudioDataMessage.java @@ -236,14 +236,15 @@ public byte[] getData() { return data; } - /** @throws UnsupportedOperationException */ + /** @throws UnsupportedOperationException no mean for this class. */ + @Override public byte[] getMessage() { throw new UnsupportedOperationException("no mean"); } //---- - /** */ + @Override public MidiEvent[] getMidiEvents(MidiContext context) throws InvalidMidiDataException { MetaMessage metaMessage = new MetaMessage(); @@ -263,7 +264,7 @@ public MidiEvent[] getMidiEvents(MidiContext context) throws InvalidMidiDataExce }; } - /** */ + @Override public void sequence() throws InvalidMfiDataException { int id = getAudioDataNumber(); int format = getFormat(); diff --git a/src/main/java/vavi/sound/mfi/vavi/MetaEventAdapter.java b/src/main/java/vavi/sound/mfi/vavi/MetaEventAdapter.java index c402729..4335221 100644 --- a/src/main/java/vavi/sound/mfi/vavi/MetaEventAdapter.java +++ b/src/main/java/vavi/sound/mfi/vavi/MetaEventAdapter.java @@ -38,21 +38,21 @@ class MetaEventAdapter implements MetaEventListener, MfiDevice { "Software sequencer using adpcm", "Version " + VaviMfiDeviceProvider.version) {}; - /* */ + @Override public MfiDevice.Info getDeviceInfo() { return info; } - /* */ + @Override public void close() { } - /* */ + @Override public boolean isOpen() { return true; } - /* */ + @Override public void open() { } @@ -64,6 +64,7 @@ public void open() { * @see vavi.sound.mfi.vavi.header.TitlMessage#getMidiEvents(MidiContext) * @see vavi.sound.mfi.vavi.track.TempoMessage#getMidiEvents(MidiContext) */ + @Override public void meta(javax.sound.midi.MetaMessage message) { //Debug.println("type: " + message.getType()); switch (MetaEvent.valueOf(message.getType())) { diff --git a/src/main/java/vavi/sound/mfi/vavi/MfiContext.java b/src/main/java/vavi/sound/mfi/vavi/MfiContext.java index 303e9f2..4e60fdc 100644 --- a/src/main/java/vavi/sound/mfi/vavi/MfiContext.java +++ b/src/main/java/vavi/sound/mfi/vavi/MfiContext.java @@ -329,10 +329,9 @@ public void setMidiSequence(Sequence midiSequence) { for (Track track : midiTracks) { for (int i = 0; i < track.size(); i++) { MidiMessage midiMessage = track.get(i).getMessage(); - if (midiMessage instanceof MetaMessage && + if (midiMessage instanceof MetaMessage metaMessage && ((MetaMessage) midiMessage).getType() == MetaEvent.META_TEMPO.number()) { - MetaMessage metaMessage = (MetaMessage) midiMessage; byte[] data = metaMessage.getData(); int timeBase = TempoMessage.getNearestTimeBase(this.timeBase); @@ -360,7 +359,7 @@ public void setMidiSequence(Sequence midiSequence) { } } midiEvents.sort(new Comparator() { - /** */ + @Override public int compare(MidiEvent e1, MidiEvent e2) { long t1 = e1.getTick(); long t2 = e2.getTick(); diff --git a/src/main/java/vavi/sound/mfi/vavi/MidiContext.java b/src/main/java/vavi/sound/mfi/vavi/MidiContext.java index 37ef2c4..5ec75d0 100644 --- a/src/main/java/vavi/sound/mfi/vavi/MidiContext.java +++ b/src/main/java/vavi/sound/mfi/vavi/MidiContext.java @@ -30,17 +30,17 @@ public class MidiContext { /** */ public static final int MAX_MIDI_CHANNELS = 16; - /** チャンネルコンフィギュレーション */ + /** channel configuration */ public enum ChannelConfiguration { - /** リズム */ + /** rhythm */ PERCUSSION, - /** その他 */ + /** others */ SOUND_SET, - /** 未使用 */ + /** unused */ UNUSED } - /** channel 9 はデフォルトでリズム */ + /** channel 9 defaults to rhythm */ public static final int CHANNEL_DRUM = 9; /** */ @@ -48,10 +48,10 @@ public MidiContext() { drums[CHANNEL_DRUM] = ChannelConfiguration.PERCUSSION; } - /** リズムチャンネルが複数の場合の保存用 TODO */ +// /** TODO for saving when there are multiple rhythm channels */ // drumProgram = 0; - /** 現在のトラック No. */ + /** current track number */ private int mfiTrackNumber; /** */ @@ -64,7 +64,7 @@ public void setMfiTrackNumber(int trackNumber) { this.mfiTrackNumber = trackNumber; } - /** 現在のΔタイム */ + /** current Δ time */ private long[] currents = new long[4]; /** mfiTrackNumber must be set */ @@ -82,7 +82,7 @@ public void addCurrent(long value) { this.currents[mfiTrackNumber] += value; } - /** channel がリズムかどうか, index is pseudo MIDI channel */ + /** whether channel is a rhythm, index is pseudo MIDI channel */ private ChannelConfiguration[] drums = new ChannelConfiguration[MAX_MIDI_CHANNELS]; /* initializing */ { @@ -94,7 +94,7 @@ public void addCurrent(long value) { /** */ private static final int CHANNEL_UNUSED = -1; - /** DRUM_CHANNEL がリズムでない場合の交換先チャンネル */ + /** destination channel if DRUM_CHANNEL is not rhythm */ private int drumSwapChannel = CHANNEL_UNUSED; /** @@ -107,11 +107,11 @@ public void setDrum(int channel, ChannelConfiguration value) { drums[channel] = value; } - // DRUM_CHANNEL がリズムでなければ空いてる channel と交換 + // ff DRUM_CHANNEL is not a rhythm, replace it with an empty channel if (channel == CHANNEL_DRUM && drums[CHANNEL_DRUM] == ChannelConfiguration.SOUND_SET && drumSwapChannel == CHANNEL_UNUSED) { for (int k = MAX_MIDI_CHANNELS - 1; k >= 0; k--) { if (k != CHANNEL_DRUM && drums[k] == ChannelConfiguration.UNUSED) { - drumSwapChannel = k; // TODO 複数対応? + drumSwapChannel = k; // TODO support multiple? Debug.println(Level.FINE, "channel 9 -> " + k); break; } @@ -122,7 +122,7 @@ public void setDrum(int channel, ChannelConfiguration value) { } } - /** channel に割り当てられた volume, index is pseudo MIDI channel */ + /** volumes assigned to channel, index is pseudo MIDI channel */ private int[] volumes = new int[MAX_MIDI_CHANNELS]; /** @@ -146,12 +146,12 @@ public int getVolume(int channel) { return volumes[channel]; } - /** channel に割り当てられた program no, index is real MIDI channel */ + /** program numbers assigned to channel, index is real MIDI channel */ private int[] programs = new int[MAX_MIDI_CHANNELS]; /** * @param channel pseudo MIDI channel (mfiTrackNumber * 4 + voice) - * @return ドラム置き換え後のチャンネル (real MIDI channel) + * @return channel after drum replacement (real MIDI channel) */ public int setProgram(int channel, int program) { if (channel != drumSwapChannel && drums[channel] == ChannelConfiguration.PERCUSSION) { @@ -168,7 +168,7 @@ public int setProgram(int channel, int program) { /** * @param channel pseudo MIDI channel (mfiTrackNumber * 4 + voice) - * @return ドラム置き換え後のチャンネル (real MIDI channel) + * @return channel after drum replacement (real MIDI channel) */ public int setBank(int channel, int bank) { if (channel != drumSwapChannel && drums[channel] == ChannelConfiguration.PERCUSSION) { @@ -197,7 +197,7 @@ public int getProgram(int channel) { /** * @param channel pseudo MIDI channel (mfiTrackNumber * 4 + voice) - * @return ドラム置き換え後のチャンネル (real MIDI channel) + * @return channel after drum replacement (real MIDI channel) */ public int retrieveChannel(int channel) { @@ -220,7 +220,7 @@ public int retrieveChannel(int channel) { */ public int retrievePitch(int channel, int pitch) { if (drums[channel] == ChannelConfiguration.PERCUSSION) { - pitch -= 10; // TODO 仕様 + pitch -= 10; // TODO spec } return pitch + 45; diff --git a/src/main/java/vavi/sound/mfi/vavi/SubMessage.java b/src/main/java/vavi/sound/mfi/vavi/SubMessage.java index bcec9a2..3881f6d 100644 --- a/src/main/java/vavi/sound/mfi/vavi/SubMessage.java +++ b/src/main/java/vavi/sound/mfi/vavi/SubMessage.java @@ -14,7 +14,6 @@ import java.io.UnsupportedEncodingException; import java.lang.reflect.Constructor; import java.util.HashMap; -import java.util.Iterator; import java.util.Map; import java.util.Properties; import java.util.logging.Level; @@ -135,6 +134,7 @@ public int getDataLength() { * データ部分のみ。{@link #getSubType() subType} 文字列も含みません。 * @return コピー */ + @Override public byte[] getData() { byte[] tmp = new byte[getDataLength()]; System.arraycopy(this.data, HEADER_LENGTH + SUB_TYPE_LENGTH, diff --git a/src/main/java/vavi/sound/mfi/vavi/TrackMessage.java b/src/main/java/vavi/sound/mfi/vavi/TrackMessage.java index c267c55..044c2be 100644 --- a/src/main/java/vavi/sound/mfi/vavi/TrackMessage.java +++ b/src/main/java/vavi/sound/mfi/vavi/TrackMessage.java @@ -14,7 +14,6 @@ import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.util.HashMap; -import java.util.Iterator; import java.util.Map; import java.util.Properties; import java.util.logging.Level; @@ -219,6 +218,7 @@ private MfiMessage getClassOrNormalMessage(int delta, } /** @throws UnsupportedOperationException */ + @Override public byte[] getMessage() { throw new UnsupportedOperationException("no mean"); } diff --git a/src/main/java/vavi/sound/mfi/vavi/VaviMfiDeviceProvider.java b/src/main/java/vavi/sound/mfi/vavi/VaviMfiDeviceProvider.java index 13408fa..596dea3 100644 --- a/src/main/java/vavi/sound/mfi/vavi/VaviMfiDeviceProvider.java +++ b/src/main/java/vavi/sound/mfi/vavi/VaviMfiDeviceProvider.java @@ -8,7 +8,6 @@ import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Properties; @@ -39,7 +38,7 @@ public VaviMfiDeviceProvider() { this.mfiDeviceInfos = Factory.getMfiDeviceInfos(); } - /** */ + @Override public boolean isDeviceSupported(MfiDevice.Info info) { for (MfiDevice.Info mfiDeviceInfo : mfiDeviceInfos) { if (mfiDeviceInfo.equals(info)) { @@ -49,12 +48,12 @@ public boolean isDeviceSupported(MfiDevice.Info info) { return false; } - /** */ + @Override public MfiDevice.Info[] getDeviceInfo() { return mfiDeviceInfos; } - /** */ + @Override public MfiDevice getDevice(MfiDevice.Info info) throws IllegalArgumentException { @@ -66,9 +65,8 @@ private static class Factory { /** */ public static MfiDevice.Info[] getMfiDeviceInfos() { - List tmp = new ArrayList<>(); - tmp.addAll(deviceMap.keySet()); + List tmp = new ArrayList<>(deviceMap.keySet()); return tmp.toArray(new MfiDevice.Info[0]); } @@ -77,7 +75,7 @@ public static MfiDevice.Info[] getMfiDeviceInfos() { public static MfiDevice getMfiDevice(MfiDevice.Info mfiDeviceInfo) { if (deviceMap.containsKey(mfiDeviceInfo)) { try { - return deviceMap.get(mfiDeviceInfo).newInstance(); + return deviceMap.get(mfiDeviceInfo).getDeclaredConstructor().newInstance(); } catch (Exception e) { Debug.printStackTrace(e); } @@ -104,7 +102,7 @@ public static MfiDevice getMfiDevice(MfiDevice.Info mfiDeviceInfo) { @SuppressWarnings("unchecked") Class deviceClass = (Class) Class.forName(props.getProperty(key)); //Debug.println("mfi device class: " + StringUtil.getClassName(deviceClass)); - MfiDevice.Info mfiDeviceInfo = deviceClass.newInstance().getDeviceInfo(); + MfiDevice.Info mfiDeviceInfo = deviceClass.getDeclaredConstructor().newInstance().getDeviceInfo(); deviceMap.put(mfiDeviceInfo, deviceClass); } diff --git a/src/main/java/vavi/sound/mfi/vavi/VaviMfiFileFormat.java b/src/main/java/vavi/sound/mfi/vavi/VaviMfiFileFormat.java index 59b7981..111c597 100644 --- a/src/main/java/vavi/sound/mfi/vavi/VaviMfiFileFormat.java +++ b/src/main/java/vavi/sound/mfi/vavi/VaviMfiFileFormat.java @@ -118,9 +118,8 @@ public void init(Map subChunks) { for (int j = 0; j < track.size(); j++) { MfiEvent event = track.get(j); MfiMessage message = event.getMessage(); - if (message instanceof SubMessage) { - SubMessage subChunk = (SubMessage) message; -//Debug.println(infoMessage); + if (message instanceof SubMessage subChunk) { + //Debug.println(infoMessage); subChunks.put(subChunk.getSubType(), subChunk); } } diff --git a/src/main/java/vavi/sound/mfi/vavi/VaviMfiFileReader.java b/src/main/java/vavi/sound/mfi/vavi/VaviMfiFileReader.java index 23aff3a..8068302 100644 --- a/src/main/java/vavi/sound/mfi/vavi/VaviMfiFileReader.java +++ b/src/main/java/vavi/sound/mfi/vavi/VaviMfiFileReader.java @@ -32,7 +32,7 @@ */ public class VaviMfiFileReader extends MfiFileReader { - /** */ + @Override public MfiFileFormat getMfiFileFormat(InputStream stream) throws InvalidMfiDataException, IOException { @@ -40,7 +40,7 @@ public MfiFileFormat getMfiFileFormat(InputStream stream) return VaviMfiFileFormat.readFrom(stream); } - /** */ + @Override public MfiFileFormat getMfiFileFormat(File file) throws InvalidMfiDataException, IOException { @@ -49,7 +49,7 @@ public MfiFileFormat getMfiFileFormat(File file) return VaviMfiFileFormat.readFrom(is); } - /** */ + @Override public MfiFileFormat getMfiFileFormat(URL url) throws InvalidMfiDataException, IOException { @@ -58,7 +58,7 @@ public MfiFileFormat getMfiFileFormat(URL url) return VaviMfiFileFormat.readFrom(is); } - /** */ + @Override public Sequence getSequence(InputStream is) throws InvalidMfiDataException, IOException { @@ -68,7 +68,7 @@ public Sequence getSequence(InputStream is) return mff.getSequence(); } - /** */ + @Override public Sequence getSequence(File file) throws InvalidMfiDataException, IOException { @@ -77,7 +77,7 @@ public Sequence getSequence(File file) return getSequence(is); } - /** */ + @Override public Sequence getSequence(URL url) throws InvalidMfiDataException, IOException { diff --git a/src/main/java/vavi/sound/mfi/vavi/VaviMfiFileWriter.java b/src/main/java/vavi/sound/mfi/vavi/VaviMfiFileWriter.java index 4cbff22..11543eb 100644 --- a/src/main/java/vavi/sound/mfi/vavi/VaviMfiFileWriter.java +++ b/src/main/java/vavi/sound/mfi/vavi/VaviMfiFileWriter.java @@ -49,18 +49,18 @@ public class VaviMfiFileWriter extends MfiFileWriter { /** @see vavi.sound.mfi.vavi.header.ProtMessage */ private static String defaultCreator = "vavi"; - /** */ + @Override public int[] getMfiFileTypes() { return types; } - /** */ + @Override public int[] getMfiFileTypes(Sequence sequence) { // sequence を無視しているけど MFi Sequence 一つしか型ないからいい return types; } - /** */ + @Override public boolean isFileTypeSupported(int fileType) { for (int type : types) { if (type == fileType) { @@ -70,7 +70,7 @@ public boolean isFileTypeSupported(int fileType) { return false; } - /** */ + @Override public boolean isFileTypeSupported(int fileType, Sequence sequence) { // sequence を無視しているけど MFi Sequence 一つしか型ないからいい return isFileTypeSupported(fileType); @@ -83,6 +83,7 @@ public boolean isFileTypeSupported(int fileType, Sequence sequence) { * @return 0: fileType がサポートされていない場合、書き込みデータにエラーがある場合 * else: 書き込んだバイト数 */ + @Override public int write(Sequence in, int fileType, OutputStream out) throws IOException { @@ -111,7 +112,7 @@ public int write(Sequence in, int fileType, OutputStream out) ff.setNoteLength(1); } catch (InvalidMfiDataException e) { // TODO IOException でいいのか? - throw (IOException) new IOException().initCause(e); + throw (IOException) new IOException(e); } int type = ff.getMajorType(); @@ -135,6 +136,7 @@ public int write(Sequence in, int fileType, OutputStream out) } /** delegate to {@link #write(Sequence, int, OutputStream)} */ + @Override public int write(Sequence in, int fileType, File out) throws IOException { diff --git a/src/main/java/vavi/sound/mfi/vavi/VaviMidiConverter.java b/src/main/java/vavi/sound/mfi/vavi/VaviMidiConverter.java index 63c81ae..ea927a6 100644 --- a/src/main/java/vavi/sound/mfi/vavi/VaviMidiConverter.java +++ b/src/main/java/vavi/sound/mfi/vavi/VaviMidiConverter.java @@ -52,20 +52,24 @@ class VaviMidiConverter implements MidiConverter { "Version " + VaviMfiDeviceProvider.version) {}; /* */ + @Override public MfiDevice.Info getDeviceInfo() { return info; } /* */ + @Override public void close() { } /* */ + @Override public boolean isOpen() { return true; } /* */ + @Override public void open() { } @@ -74,6 +78,7 @@ public void open() { /** * Converts midi sequence to mfi sequence. */ + @Override @Deprecated public vavi.sound.mfi.Sequence toMfiSequence(Sequence midiSequence) throws InvalidMidiDataException { @@ -82,6 +87,7 @@ public vavi.sound.mfi.Sequence toMfiSequence(Sequence midiSequence) } /** Converts midi sequence to mfi sequence. */ + @Override public vavi.sound.mfi.Sequence toMfiSequence(Sequence midiSequence, int fileType) throws InvalidMidiDataException { @@ -124,9 +130,8 @@ protected vavi.sound.mfi.Sequence convert(Sequence midiSequence, int fileType) int mfiTrackNumber = 0; // - if (midiMessage instanceof ShortMessage) { + if (midiMessage instanceof ShortMessage shortMessage) { - ShortMessage shortMessage = (ShortMessage) midiMessage; int channel = shortMessage.getChannel(); int command = shortMessage.getCommand(); int data1 = shortMessage.getData1(); @@ -157,9 +162,8 @@ protected vavi.sound.mfi.Sequence convert(Sequence midiSequence, int fileType) } else { key = "short." + (command & 0xf0); } - } else if (midiMessage instanceof SysexMessage) { + } else if (midiMessage instanceof SysexMessage sysexMessage) { - SysexMessage sysexMessage = (SysexMessage) midiMessage; byte[] data = sysexMessage.getData(); // GM system on @@ -174,13 +178,12 @@ protected vavi.sound.mfi.Sequence convert(Sequence midiSequence, int fileType) mfiTrackNumber = 0; key = "sysex." + data[0]; - } else if (midiMessage instanceof MetaMessage) { + } else if (midiMessage instanceof MetaMessage metaMessage) { // 1 -> ProtInfo // 2 -> CopyInfo // 3 -> TitlInfo // 0x51 tempo - MetaMessage metaMessage = (MetaMessage) midiMessage; int meta = metaMessage.getType(); // byte[] data = metaMessage.getData(); @@ -278,6 +281,7 @@ private void addEventToTrack(MfiContext mfiContext, long tick, Track mfiTrack, i //---- /** Converts mfi sequence to midi sequence */ + @Override public Sequence toMidiSequence(vavi.sound.mfi.Sequence mfiSequence) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/VaviNoteMessage.java b/src/main/java/vavi/sound/mfi/vavi/VaviNoteMessage.java index 3bb6303..060ceab 100644 --- a/src/main/java/vavi/sound/mfi/vavi/VaviNoteMessage.java +++ b/src/main/java/vavi/sound/mfi/vavi/VaviNoteMessage.java @@ -46,6 +46,7 @@ public VaviNoteMessage() { // TODO public ぐぬぬ... } /* */ + @Override public MidiEvent[] getMidiEvents(MidiContext context) throws InvalidMidiDataException { @@ -82,6 +83,7 @@ public MidiEvent[] getMidiEvents(MidiContext context) * ゲートタイムより小さい場合は直前の NoteMessage からの継続音とする * TODO 次の音まで余裕があったら伸ばして、無かったら切る?(未実装) */ + @Override public MfiEvent[] getMfiEvents(MidiEvent midiEvent, MfiContext context) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/VaviSequencer.java b/src/main/java/vavi/sound/mfi/vavi/VaviSequencer.java index 2206a14..da41d2c 100644 --- a/src/main/java/vavi/sound/mfi/vavi/VaviSequencer.java +++ b/src/main/java/vavi/sound/mfi/vavi/VaviSequencer.java @@ -15,6 +15,7 @@ import javax.sound.midi.MidiChannel; import javax.sound.midi.MidiSystem; import javax.sound.midi.MidiUnavailableException; +import javax.sound.midi.Receiver; import javax.sound.midi.Soundbank; import vavi.sound.mfi.InvalidMfiDataException; @@ -62,22 +63,23 @@ class VaviSequencer implements Sequencer, Synthesizer { /** the sequence of MFi */ private Sequence sequence; - /* */ + @Override public MfiDevice.Info getDeviceInfo() { return info; } - /* */ + @Override public void close() { if (midiSequencer == null) { throw new IllegalStateException("not opend"); } midiSequencer.close(); midiSynthesizer.close(); + off(); Debug.println("★0 close: " + midiSequencer.hashCode()); } - /* */ + @Override public boolean isOpen() { if (midiSequencer == null) { return false; @@ -88,25 +90,28 @@ public boolean isOpen() { /** ADPCM sequencer, TODO should be {@link javax.sound.midi.Transmitter} */ private javax.sound.midi.MetaEventListener mea = new MetaEventAdapter(); - /* */ + @Override public void open() throws MfiUnavailableException { try { if (this.midiSequencer == null) { this.midiSequencer = MidiUtil.getDefaultSequencer(vavi.sound.midi.VaviMidiDeviceProvider.class); this.midiSynthesizer = MidiSystem.getSynthesizer(); +Debug.println(Level.FINE, "midiSequencer: " + midiSequencer.getClass().getName()); +Debug.println(Level.FINE, "midiSynthesizer: " + midiSynthesizer.getClass().getName()); Debug.println("★0 init: " + midiSequencer.hashCode()); } Debug.println("★0 open: " + midiSequencer.hashCode()); midiSequencer.open(); midiSynthesizer.open(); + midiSequencer.getTransmitter().setReceiver(midiSynthesizer.getReceiver()); } catch (MidiUnavailableException e) { Debug.printStackTrace(e); throw new MfiUnavailableException(e); } } - /* */ + @Override public void setSequence(Sequence sequence) throws InvalidMfiDataException { @@ -123,7 +128,7 @@ public void setSequence(Sequence sequence) } } - /* */ + @Override public void setSequence(InputStream stream) throws IOException, InvalidMfiDataException { @@ -131,12 +136,12 @@ public void setSequence(InputStream stream) this.setSequence(MfiSystem.getSequence(stream)); } - /* */ + @Override public Sequence getSequence() { return sequence; } - /* */ + @Override public void start() { if (midiSequencer == null) { throw new IllegalStateException("not opend"); @@ -145,7 +150,7 @@ public void start() { midiSequencer.start(); } - /* */ + @Override public void stop() { if (midiSequencer == null) { throw new IllegalStateException("not opend"); @@ -154,7 +159,7 @@ public void stop() { off(); } - /* */ + @Override public boolean isRunning() { if (midiSequencer == null) { throw new IllegalStateException("not opend"); @@ -198,7 +203,7 @@ protected void fireMeta(MetaMessage meta) { /** meta 0x2f listener */ private javax.sound.midi.MetaEventListener mel = new javax.sound.midi.MetaEventListener() { - /** */ + @Override public void meta(javax.sound.midi.MetaMessage message) { Debug.println("★0 meta: type: " + message.getType()); switch (message.getType()) { @@ -221,7 +226,7 @@ public void meta(javax.sound.midi.MetaMessage message) { }; @Override - public MidiChannel[] getChannels() throws MfiUnavailableException { + public MidiChannel[] getChannels() { return midiSynthesizer.getChannels(); // TODO MFiChannel? } @@ -246,8 +251,8 @@ public void unloadAllInstruments(Soundbank soundbank) { } @Override - protected void finalize() { - off(); + public Receiver getReceiver() throws MidiUnavailableException { + return midiSynthesizer.getReceiver(); } } diff --git a/src/main/java/vavi/sound/mfi/vavi/audio/CommonAudioMessage.java b/src/main/java/vavi/sound/mfi/vavi/audio/CommonAudioMessage.java index b97227e..901d701 100644 --- a/src/main/java/vavi/sound/mfi/vavi/audio/CommonAudioMessage.java +++ b/src/main/java/vavi/sound/mfi/vavi/audio/CommonAudioMessage.java @@ -28,7 +28,7 @@ /** - * CommonMessage. + * CommonAudioMessage. * * @author Naohide Sano (nsano) * @version 0.00 071010 nsano initial version
diff --git a/src/main/java/vavi/sound/mfi/vavi/header/CopyMessage.java b/src/main/java/vavi/sound/mfi/vavi/header/CopyMessage.java index 5512256..aa79e44 100644 --- a/src/main/java/vavi/sound/mfi/vavi/header/CopyMessage.java +++ b/src/main/java/vavi/sound/mfi/vavi/header/CopyMessage.java @@ -72,6 +72,7 @@ public String toString() { // ---- /** Meta 0x02 */ + @Override public MidiEvent[] getMidiEvents(MidiContext context) throws InvalidMidiDataException { MetaMessage metaMessage = new MetaMessage(); @@ -84,7 +85,7 @@ public MidiEvent[] getMidiEvents(MidiContext context) throws InvalidMidiDataExce }; } - /** */ + @Override public MfiEvent[] getMfiEvents(MidiEvent midiEvent, MfiContext context) throws InvalidMfiDataException { MetaMessage metaMessage = (MetaMessage) midiEvent.getMessage(); diff --git a/src/main/java/vavi/sound/mfi/vavi/header/ProtMessage.java b/src/main/java/vavi/sound/mfi/vavi/header/ProtMessage.java index fd47c58..8de3fee 100644 --- a/src/main/java/vavi/sound/mfi/vavi/header/ProtMessage.java +++ b/src/main/java/vavi/sound/mfi/vavi/header/ProtMessage.java @@ -76,6 +76,7 @@ public String toString() { // ---- /** Meta 0x01 */ + @Override public MidiEvent[] getMidiEvents(MidiContext context) throws InvalidMidiDataException { @@ -90,7 +91,7 @@ public MidiEvent[] getMidiEvents(MidiContext context) }; } - /** */ + @Override public MfiEvent[] getMfiEvents(MidiEvent midiEvent, MfiContext context) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/header/TitlMessage.java b/src/main/java/vavi/sound/mfi/vavi/header/TitlMessage.java index 9edd532..489011c 100644 --- a/src/main/java/vavi/sound/mfi/vavi/header/TitlMessage.java +++ b/src/main/java/vavi/sound/mfi/vavi/header/TitlMessage.java @@ -87,6 +87,7 @@ public String toString() { //---- /** Meta 0x03 */ + @Override public MidiEvent[] getMidiEvents(MidiContext context) throws InvalidMidiDataException { @@ -101,7 +102,7 @@ public MidiEvent[] getMidiEvents(MidiContext context) }; } - /** */ + @Override public MfiEvent[] getMfiEvents(MidiEvent midiEvent, MfiContext context) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/header/readme.md b/src/main/java/vavi/sound/mfi/vavi/header/readme.md index 0c0c5e7..7d932e9 100644 --- a/src/main/java/vavi/sound/mfi/vavi/header/readme.md +++ b/src/main/java/vavi/sound/mfi/vavi/header/readme.md @@ -1,7 +1,7 @@ # vavi.sound.mfi.vavi.header -MFi Header の Sub Chunk (SubMessage の派生クラス)を提供します. +Provides MFi Header Sub Chunks (sub classes of `SubMessage`).. ## TODO - * thrd 3D定位機能利用情報 + * `thrd` 3D orientation function usage info diff --git a/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function1.java b/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function1.java index e5732f4..adef361 100644 --- a/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function1.java +++ b/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function1.java @@ -35,6 +35,7 @@ public class Function1 implements MachineDependentFunction { * 6 01 * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function129.java b/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function129.java index d5ce1ce..ddda567 100644 --- a/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function129.java +++ b/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function129.java @@ -35,6 +35,7 @@ public class Function129 implements MachineDependentFunction { * 6 81 * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function130.java b/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function130.java index 0d1f2bb..10b0e1f 100644 --- a/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function130.java +++ b/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function130.java @@ -35,6 +35,7 @@ public class Function130 implements MachineDependentFunction { * 6 82 * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function131.java b/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function131.java index a911826..f87c305 100644 --- a/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function131.java +++ b/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function131.java @@ -63,6 +63,7 @@ public class Function131 implements MachineDependentFunction { * +------- continue flag * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function132.java b/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function132.java index 32d0d22..ea60188 100644 --- a/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function132.java +++ b/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function132.java @@ -45,6 +45,7 @@ public class Function132 extends Function131 { * 10-13 size (big endian) * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { @@ -89,6 +90,7 @@ public void setLength(int length) { * 事前に {@link #setAdpcm(byte[])}, {@link #setSamplingRate(int)}, * {@link #setSamplingBits(int)} を用いてフィールドを設定しておいて下さい。 */ + @Override public byte[] getMessage() throws InvalidMfiDataException { // [14~] diff --git a/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function143.java b/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function143.java index cb6758c..bba4735 100644 --- a/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function143.java +++ b/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function143.java @@ -41,6 +41,7 @@ public class Function143 implements MachineDependentFunction { * 6 8f * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function16.java b/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function16.java index 798d837..ea98b8e 100644 --- a/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function16.java +++ b/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function16.java @@ -35,6 +35,7 @@ public class Function16 implements MachineDependentFunction { * 6 10 * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function17.java b/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function17.java index 7dc30b4..c96c070 100644 --- a/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function17.java +++ b/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function17.java @@ -35,6 +35,7 @@ public class Function17 implements MachineDependentFunction { * 6 f1 * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function2.java b/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function2.java index 9c87cd4..860b748 100644 --- a/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function2.java +++ b/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function2.java @@ -35,6 +35,7 @@ public class Function2 implements MachineDependentFunction { * 6 02 * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function3.java b/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function3.java index 8997114..36d8ad3 100755 --- a/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function3.java +++ b/src/main/java/vavi/sound/mfi/vavi/mitsubishi/Function3.java @@ -35,6 +35,7 @@ public class Function3 implements MachineDependentFunction { * 6 03 * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/mitsubishi/MitsubishiSequencer.java b/src/main/java/vavi/sound/mfi/vavi/mitsubishi/MitsubishiSequencer.java index 7f432b1..1088b15 100644 --- a/src/main/java/vavi/sound/mfi/vavi/mitsubishi/MitsubishiSequencer.java +++ b/src/main/java/vavi/sound/mfi/vavi/mitsubishi/MitsubishiSequencer.java @@ -35,6 +35,7 @@ public class MitsubishiSequencer implements MachineDependentSequencer { * * @param message see below */ + @Override public void sequence(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/nec/Function1_240_7.java b/src/main/java/vavi/sound/mfi/vavi/nec/Function1_240_7.java index 2d66d4a..d13775f 100755 --- a/src/main/java/vavi/sound/mfi/vavi/nec/Function1_240_7.java +++ b/src/main/java/vavi/sound/mfi/vavi/nec/Function1_240_7.java @@ -53,6 +53,7 @@ public class Function1_240_7 implements MachineDependentFunction { * * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/nec/Function1_241_3.java b/src/main/java/vavi/sound/mfi/vavi/nec/Function1_241_3.java index 50bda54..38af87e 100755 --- a/src/main/java/vavi/sound/mfi/vavi/nec/Function1_241_3.java +++ b/src/main/java/vavi/sound/mfi/vavi/nec/Function1_241_3.java @@ -45,6 +45,7 @@ public class Function1_241_3 implements MachineDependentFunction { * 10 .6543210 velocity * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/nec/Function1_241_4.java b/src/main/java/vavi/sound/mfi/vavi/nec/Function1_241_4.java index 8f2aeea..b1e9df9 100644 --- a/src/main/java/vavi/sound/mfi/vavi/nec/Function1_241_4.java +++ b/src/main/java/vavi/sound/mfi/vavi/nec/Function1_241_4.java @@ -45,6 +45,7 @@ public class Function1_241_4 implements MachineDependentFunction { * 10 .6543210 velocity * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/nec/Function1_241_5.java b/src/main/java/vavi/sound/mfi/vavi/nec/Function1_241_5.java index fe933ec..772c07d 100644 --- a/src/main/java/vavi/sound/mfi/vavi/nec/Function1_241_5.java +++ b/src/main/java/vavi/sound/mfi/vavi/nec/Function1_241_5.java @@ -42,6 +42,7 @@ public class Function1_241_5 implements MachineDependentFunction { * 9 ...43210 stream wave number * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/nec/Function1_241_6.java b/src/main/java/vavi/sound/mfi/vavi/nec/Function1_241_6.java index cb4d50d..f55766d 100644 --- a/src/main/java/vavi/sound/mfi/vavi/nec/Function1_241_6.java +++ b/src/main/java/vavi/sound/mfi/vavi/nec/Function1_241_6.java @@ -43,6 +43,7 @@ public class Function1_241_6 implements MachineDependentFunction { * 10 0 ~ 63, 128 mono, 255 no pan * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/nec/Function1_243_3.java b/src/main/java/vavi/sound/mfi/vavi/nec/Function1_243_3.java index 7636b60..128aac2 100644 --- a/src/main/java/vavi/sound/mfi/vavi/nec/Function1_243_3.java +++ b/src/main/java/vavi/sound/mfi/vavi/nec/Function1_243_3.java @@ -43,6 +43,7 @@ public class Function1_243_3 implements MachineDependentFunction { * 9 maxGain 0x00 ~ 0x60 (-48db), default 0x18 (-12db) * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/nec/Function1_243_4.java b/src/main/java/vavi/sound/mfi/vavi/nec/Function1_243_4.java index 58e0ef9..0bc6e74 100644 --- a/src/main/java/vavi/sound/mfi/vavi/nec/Function1_243_4.java +++ b/src/main/java/vavi/sound/mfi/vavi/nec/Function1_243_4.java @@ -44,6 +44,7 @@ public class Function1_243_4 implements MachineDependentFunction { * +---- max stream number, 0 ~ 2, default 0 * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/nec/Function240_1.java b/src/main/java/vavi/sound/mfi/vavi/nec/Function240_1.java index fc3662b..c3e9f76 100755 --- a/src/main/java/vavi/sound/mfi/vavi/nec/Function240_1.java +++ b/src/main/java/vavi/sound/mfi/vavi/nec/Function240_1.java @@ -38,6 +38,7 @@ public class Function240_1 implements MachineDependentFunction { * 6 f1 * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/nec/Function240_2.java b/src/main/java/vavi/sound/mfi/vavi/nec/Function240_2.java index f3ce2ee..8304517 100644 --- a/src/main/java/vavi/sound/mfi/vavi/nec/Function240_2.java +++ b/src/main/java/vavi/sound/mfi/vavi/nec/Function240_2.java @@ -45,6 +45,7 @@ public class Function240_2 implements MachineDependentFunction { * 9 sample rate 0:4kHz, 1:8kHz * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/nec/Function241_0.java b/src/main/java/vavi/sound/mfi/vavi/nec/Function241_0.java index 095607f..79b03fa 100644 --- a/src/main/java/vavi/sound/mfi/vavi/nec/Function241_0.java +++ b/src/main/java/vavi/sound/mfi/vavi/nec/Function241_0.java @@ -39,6 +39,7 @@ public class Function241_0 implements MachineDependentFunction { * 8 streamNumber * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/nec/Function241_1.java b/src/main/java/vavi/sound/mfi/vavi/nec/Function241_1.java index 6d688e3..38a93d1 100644 --- a/src/main/java/vavi/sound/mfi/vavi/nec/Function241_1.java +++ b/src/main/java/vavi/sound/mfi/vavi/nec/Function241_1.java @@ -37,6 +37,7 @@ public class Function241_1 implements MachineDependentFunction { * 6 f1 * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/nec/Function241_2.java b/src/main/java/vavi/sound/mfi/vavi/nec/Function241_2.java index 7421818..4bbdbd7 100644 --- a/src/main/java/vavi/sound/mfi/vavi/nec/Function241_2.java +++ b/src/main/java/vavi/sound/mfi/vavi/nec/Function241_2.java @@ -37,6 +37,7 @@ public class Function241_2 implements MachineDependentFunction { * 6 f1 * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/nec/Function242_1.java b/src/main/java/vavi/sound/mfi/vavi/nec/Function242_1.java index ee18342..36e0611 100644 --- a/src/main/java/vavi/sound/mfi/vavi/nec/Function242_1.java +++ b/src/main/java/vavi/sound/mfi/vavi/nec/Function242_1.java @@ -39,6 +39,7 @@ public class Function242_1 implements MachineDependentFunction { * 8 volume * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/nec/Function242_4.java b/src/main/java/vavi/sound/mfi/vavi/nec/Function242_4.java index 0e62962..93261e2 100644 --- a/src/main/java/vavi/sound/mfi/vavi/nec/Function242_4.java +++ b/src/main/java/vavi/sound/mfi/vavi/nec/Function242_4.java @@ -37,6 +37,7 @@ public class Function242_4 implements MachineDependentFunction { * 6 f1 * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/nec/Function242_5.java b/src/main/java/vavi/sound/mfi/vavi/nec/Function242_5.java index f93eab8..43b2658 100755 --- a/src/main/java/vavi/sound/mfi/vavi/nec/Function242_5.java +++ b/src/main/java/vavi/sound/mfi/vavi/nec/Function242_5.java @@ -37,6 +37,7 @@ public class Function242_5 implements MachineDependentFunction { * 6 f1 * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/nec/NecSequencer.java b/src/main/java/vavi/sound/mfi/vavi/nec/NecSequencer.java index 501a8c3..ffd6079 100644 --- a/src/main/java/vavi/sound/mfi/vavi/nec/NecSequencer.java +++ b/src/main/java/vavi/sound/mfi/vavi/nec/NecSequencer.java @@ -46,6 +46,7 @@ public class NecSequencer implements MachineDependentSequencer { * 7 f2, channel * */ + @Override public void sequence(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/sequencer/UndefinedFunction.java b/src/main/java/vavi/sound/mfi/vavi/sequencer/UndefinedFunction.java index 1fccd18..360905a 100644 --- a/src/main/java/vavi/sound/mfi/vavi/sequencer/UndefinedFunction.java +++ b/src/main/java/vavi/sound/mfi/vavi/sequencer/UndefinedFunction.java @@ -34,6 +34,7 @@ public class UndefinedFunction implements MachineDependentFunction { * 6 f1 * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/sequencer/UnknownVenderSequencer.java b/src/main/java/vavi/sound/mfi/vavi/sequencer/UnknownVenderSequencer.java index 2e65d4a..d498890 100644 --- a/src/main/java/vavi/sound/mfi/vavi/sequencer/UnknownVenderSequencer.java +++ b/src/main/java/vavi/sound/mfi/vavi/sequencer/UnknownVenderSequencer.java @@ -18,7 +18,7 @@ */ public class UnknownVenderSequencer implements MachineDependentSequencer { - /** */ + @Override public void sequence(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/sequencer/readme.md b/src/main/java/vavi/sound/mfi/vavi/sequencer/readme.md index 0cd9b60..da478b3 100644 --- a/src/main/java/vavi/sound/mfi/vavi/sequencer/readme.md +++ b/src/main/java/vavi/sound/mfi/vavi/sequencer/readme.md @@ -1,7 +1,7 @@ # vavi.sound.mfi.vavi.sysex -SysexMessage の派生クラスを提供します. +Provides sub classes of SysexMessage. ## TODO - * まだまだ改良の余地あり + * there is still room for improvement diff --git a/src/main/java/vavi/sound/mfi/vavi/sharp/Function129.java b/src/main/java/vavi/sound/mfi/vavi/sharp/Function129.java index 0c7c348..6be4b7e 100644 --- a/src/main/java/vavi/sound/mfi/vavi/sharp/Function129.java +++ b/src/main/java/vavi/sound/mfi/vavi/sharp/Function129.java @@ -40,6 +40,7 @@ public class Function129 implements MachineDependentFunction { * +- channel * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/sharp/Function130.java b/src/main/java/vavi/sound/mfi/vavi/sharp/Function130.java index efd5143..e50af8b 100644 --- a/src/main/java/vavi/sound/mfi/vavi/sharp/Function130.java +++ b/src/main/java/vavi/sound/mfi/vavi/sharp/Function130.java @@ -40,6 +40,7 @@ public class Function130 implements MachineDependentFunction { * +- channel * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/sharp/Function131.java b/src/main/java/vavi/sound/mfi/vavi/sharp/Function131.java index 0595c0e..e0ada53 100644 --- a/src/main/java/vavi/sound/mfi/vavi/sharp/Function131.java +++ b/src/main/java/vavi/sound/mfi/vavi/sharp/Function131.java @@ -63,6 +63,7 @@ public class Function131 implements MachineDependentFunction { * +------- continue flag * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/sharp/Function132.java b/src/main/java/vavi/sound/mfi/vavi/sharp/Function132.java index e4499f2..1f48c84 100644 --- a/src/main/java/vavi/sound/mfi/vavi/sharp/Function132.java +++ b/src/main/java/vavi/sound/mfi/vavi/sharp/Function132.java @@ -54,6 +54,7 @@ public class Function132 extends Function131 { * 10-13 size (big endian) * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { @@ -98,6 +99,7 @@ public void setLength(int length) { * 事前に {@link #setAdpcm(byte[])}, {@link #setSamplingRate(int)}, * {@link #setSamplingBits(int)} を用いてフィールドを設定しておいて下さい。 */ + @Override public byte[] getMessage() throws InvalidMfiDataException { // [10~] diff --git a/src/main/java/vavi/sound/mfi/vavi/sharp/Function143.java b/src/main/java/vavi/sound/mfi/vavi/sharp/Function143.java index 519ad7a..8602f28 100644 --- a/src/main/java/vavi/sound/mfi/vavi/sharp/Function143.java +++ b/src/main/java/vavi/sound/mfi/vavi/sharp/Function143.java @@ -42,6 +42,7 @@ public class Function143 implements MachineDependentFunction { * 6 0x8f * */ + @Override public void process(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/sharp/SharpSequencer.java b/src/main/java/vavi/sound/mfi/vavi/sharp/SharpSequencer.java index d904ee8..c5346be 100644 --- a/src/main/java/vavi/sound/mfi/vavi/sharp/SharpSequencer.java +++ b/src/main/java/vavi/sound/mfi/vavi/sharp/SharpSequencer.java @@ -33,6 +33,7 @@ public class SharpSequencer implements MachineDependentSequencer { * * @param message see below */ + @Override public void sequence(MachineDependentMessage message) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/track/AudioChannelPanpotMessage.java b/src/main/java/vavi/sound/mfi/vavi/track/AudioChannelPanpotMessage.java index f00e986..98eb23b 100644 --- a/src/main/java/vavi/sound/mfi/vavi/track/AudioChannelPanpotMessage.java +++ b/src/main/java/vavi/sound/mfi/vavi/track/AudioChannelPanpotMessage.java @@ -69,12 +69,12 @@ public void setPanpot(int panpot) { this.data[3] = (byte) ((this.data[3] & 0xc0) | this.panpot); } - /** */ + @Override public int getVoice() { return voice; } - /** */ + @Override public void setVoice(int voice) { this.voice = voice & 0x03; this.data[3] = (byte) ((this.data[3] & 0x3f) | (this.voice << 6)); @@ -89,7 +89,7 @@ public String toString() { //---- - /** */ + @Override public MidiEvent[] getMidiEvents(MidiContext context) throws InvalidMidiDataException { @@ -111,7 +111,7 @@ public MidiEvent[] getMidiEvents(MidiContext context) }; } - /** */ + @Override public void sequence() throws InvalidMfiDataException { // TODO Auto-generated method stub } diff --git a/src/main/java/vavi/sound/mfi/vavi/track/AudioChannelVolumeMessage.java b/src/main/java/vavi/sound/mfi/vavi/track/AudioChannelVolumeMessage.java index 6b14e25..b387d58 100644 --- a/src/main/java/vavi/sound/mfi/vavi/track/AudioChannelVolumeMessage.java +++ b/src/main/java/vavi/sound/mfi/vavi/track/AudioChannelVolumeMessage.java @@ -68,12 +68,12 @@ public void setVolume(int volume) { this.data[3] = (byte) ((this.data[3] & 0xc0) | this.volume); } - /** */ + @Override public int getVoice() { return voice; } - /** */ + @Override public void setVoice(int voice) { this.voice = voice & 0x03; this.data[3] = (byte) ((this.data[3] & 0x3f) | (this.voice << 6)); @@ -87,7 +87,7 @@ public String toString() { //---- - /** */ + @Override public MidiEvent[] getMidiEvents(MidiContext context) throws InvalidMidiDataException { @@ -109,7 +109,7 @@ public MidiEvent[] getMidiEvents(MidiContext context) }; } - /** */ + @Override public void sequence() throws InvalidMfiDataException { // TODO Auto-generated method stub } diff --git a/src/main/java/vavi/sound/mfi/vavi/track/AudioPlayMessage.java b/src/main/java/vavi/sound/mfi/vavi/track/AudioPlayMessage.java index c30fc0d..c522406 100644 --- a/src/main/java/vavi/sound/mfi/vavi/track/AudioPlayMessage.java +++ b/src/main/java/vavi/sound/mfi/vavi/track/AudioPlayMessage.java @@ -57,6 +57,7 @@ public AudioPlayMessage(int delta, int status, int data1, byte[] data2) { } /* */ + @Override public int getVoice() { return voice; } @@ -72,6 +73,7 @@ public int getVelocity() { } /* */ + @Override public void setVoice(int voice) { this.voice = voice & 0x03; this.data[3] = (byte) ((this.data[3] & 0x3f) | (this.voice << 6)); @@ -90,6 +92,7 @@ public String toString() { /** * @throws InvalidMidiDataException */ + @Override public MidiEvent[] getMidiEvents(MidiContext context) throws InvalidMidiDataException { MetaMessage metaMessage = new MetaMessage(); @@ -111,6 +114,7 @@ public MidiEvent[] getMidiEvents(MidiContext context) throws InvalidMidiDataExce } /** @throws IllegalArgumentException when audio engine does not found */ + @Override public void sequence() throws InvalidMfiDataException { int id = getIndex(); diff --git a/src/main/java/vavi/sound/mfi/vavi/track/AudioStopMessage.java b/src/main/java/vavi/sound/mfi/vavi/track/AudioStopMessage.java index 880bec6..8cd9ecf 100644 --- a/src/main/java/vavi/sound/mfi/vavi/track/AudioStopMessage.java +++ b/src/main/java/vavi/sound/mfi/vavi/track/AudioStopMessage.java @@ -54,6 +54,7 @@ public AudioStopMessage(int delta, int status, int data1, byte[] data2) { } /* */ + @Override public int getVoice() { return voice; } @@ -64,6 +65,7 @@ public int getIndex() { } /* */ + @Override public void setVoice(int voice) { this.voice = voice & 0x03; this.data[3] = (byte) ((this.data[3] & 0x3f) | (this.voice << 6)); @@ -81,6 +83,7 @@ public String toString() { /** * @throws InvalidMidiDataException */ + @Override public MidiEvent[] getMidiEvents(MidiContext context) throws InvalidMidiDataException { MetaMessage metaMessage = new MetaMessage(); @@ -102,6 +105,7 @@ public MidiEvent[] getMidiEvents(MidiContext context) throws InvalidMidiDataExce } /** @throws IllegalArgumentException when audio engine does not found */ + @Override public void sequence() throws InvalidMfiDataException { int id = getIndex(); diff --git a/src/main/java/vavi/sound/mfi/vavi/track/ChangeBankMessage.java b/src/main/java/vavi/sound/mfi/vavi/track/ChangeBankMessage.java index 2398e69..079cace 100644 --- a/src/main/java/vavi/sound/mfi/vavi/track/ChangeBankMessage.java +++ b/src/main/java/vavi/sound/mfi/vavi/track/ChangeBankMessage.java @@ -72,12 +72,12 @@ public void setBank(int bank) { this.data[3] = (byte) ((this.data[3] & 0xc0) | this.bank); } - /** */ + @Override public int getVoice() { return voice; } - /** */ + @Override public void setVoice(int voice) { this.voice = voice & 0x03; this.data[3] = (byte) ((this.data[3] & 0x3f) | (this.voice << 6)); @@ -92,7 +92,7 @@ public String toString() { //---- - /** */ + @Override public MidiEvent[] getMidiEvents(MidiContext context) throws InvalidMidiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/track/ChangeVoiceMessage.java b/src/main/java/vavi/sound/mfi/vavi/track/ChangeVoiceMessage.java index 652a29a..2b524cd 100644 --- a/src/main/java/vavi/sound/mfi/vavi/track/ChangeVoiceMessage.java +++ b/src/main/java/vavi/sound/mfi/vavi/track/ChangeVoiceMessage.java @@ -77,12 +77,12 @@ public void setProgram(int program) { this.data[3] = (byte) ((this.data[3] & 0xc0) | this.program); } - /** */ + @Override public int getVoice() { return voice; } - /** */ + @Override public void setVoice(int voice) { this.voice = voice & 0x03; this.data[3] = (byte) ((this.data[3] & 0x3f) | (this.voice << 6)); @@ -97,7 +97,7 @@ public String toString() { //---- - /** */ + @Override public MidiEvent[] getMidiEvents(MidiContext context) throws InvalidMidiDataException { @@ -116,7 +116,7 @@ public MidiEvent[] getMidiEvents(MidiContext context) }; } - /** */ + @Override public MfiEvent[] getMfiEvents(MidiEvent midiEvent, MfiContext context) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/track/ChannelChangeMessage.java b/src/main/java/vavi/sound/mfi/vavi/track/ChannelChangeMessage.java index 93a9c98..c70663d 100644 --- a/src/main/java/vavi/sound/mfi/vavi/track/ChannelChangeMessage.java +++ b/src/main/java/vavi/sound/mfi/vavi/track/ChannelChangeMessage.java @@ -62,12 +62,12 @@ public int getChannel() { return channel; } - /** */ + @Override public int getVoice() { return voice; } - /** */ + @Override public void setVoice(int voice) { this.voice = voice & 0x03; this.data[3] = (byte) ((this.data[3] & 0x3f) | (this.voice << 6)); @@ -82,7 +82,7 @@ public String toString() { //---- - /** */ + @Override public MidiEvent[] getMidiEvents(MidiContext context) { Debug.println(Level.INFO, "ignore: " + this); return null; diff --git a/src/main/java/vavi/sound/mfi/vavi/track/ChannelConfigurationMessage.java b/src/main/java/vavi/sound/mfi/vavi/track/ChannelConfigurationMessage.java index 085423f..d2bbc15 100644 --- a/src/main/java/vavi/sound/mfi/vavi/track/ChannelConfigurationMessage.java +++ b/src/main/java/vavi/sound/mfi/vavi/track/ChannelConfigurationMessage.java @@ -74,6 +74,7 @@ public String toString() { * コンテキストのチャンネルコンフィグレーションを設定します。 * @return 何も返しません */ + @Override public MidiEvent[] getMidiEvents(MidiContext context) { Debug.println(Level.FINE, this); context.setDrum(getChannel(), isDrum() ? MidiContext.ChannelConfiguration.PERCUSSION : diff --git a/src/main/java/vavi/sound/mfi/vavi/track/CuePointMessage.java b/src/main/java/vavi/sound/mfi/vavi/track/CuePointMessage.java index 69c8f47..6a05c05 100644 --- a/src/main/java/vavi/sound/mfi/vavi/track/CuePointMessage.java +++ b/src/main/java/vavi/sound/mfi/vavi/track/CuePointMessage.java @@ -73,6 +73,7 @@ public String toString() { * TODO {@link javax.sound.midi.MetaMessage} に 0x07 キューポイントってあるよ * @return 何も返しません */ + @Override public MidiEvent[] getMidiEvents(MidiContext context) throws InvalidMidiDataException { // if (start) { diff --git a/src/main/java/vavi/sound/mfi/vavi/track/EndOfTrackMessage.java b/src/main/java/vavi/sound/mfi/vavi/track/EndOfTrackMessage.java index 24aa88f..96bb283 100644 --- a/src/main/java/vavi/sound/mfi/vavi/track/EndOfTrackMessage.java +++ b/src/main/java/vavi/sound/mfi/vavi/track/EndOfTrackMessage.java @@ -64,7 +64,7 @@ public String toString() { //---- - /** */ + @Override public MidiEvent[] getMidiEvents(MidiContext context) { // MetaMessage metaMessage = new MetaMessage(); // metaMessage.setMessage( @@ -83,6 +83,7 @@ public MidiEvent[] getMidiEvents(MidiContext context) { * @return このメソッドの戻り値のみ MFi トラック 0 ~ 3 の EndOfTrackMessage の * MfiEvent になる。トラックがない場合は null が入っている */ + @Override public MfiEvent[] getMfiEvents(MidiEvent midiEvent, MfiContext context) { MfiEvent[] mfiEvents = new MfiEvent[MfiContext.MAX_MFI_TRACKS]; diff --git a/src/main/java/vavi/sound/mfi/vavi/track/ExpressionMessage.java b/src/main/java/vavi/sound/mfi/vavi/track/ExpressionMessage.java index 32512f7..0d73193 100644 --- a/src/main/java/vavi/sound/mfi/vavi/track/ExpressionMessage.java +++ b/src/main/java/vavi/sound/mfi/vavi/track/ExpressionMessage.java @@ -82,12 +82,12 @@ public void setVolume(int volume) { this.data[3] = (byte) ((this.data[3] & 0xc0) | this.volume); } - /** */ + @Override public int getVoice() { return voice; } - /** */ + @Override public void setVoice(int voice) { this.voice = voice & 0x03; this.data[3] = (byte) ((this.data[3] & 0x3f) | (this.voice << 6)); @@ -103,6 +103,7 @@ public String toString() { //---- /** TODO エクスプレッションとみなしたけどいいの? */ + @Override public MidiEvent[] getMidiEvents(MidiContext context) throws InvalidMidiDataException { @@ -135,7 +136,7 @@ public MidiEvent[] getMidiEvents(MidiContext context) return events; } - /** */ + @Override public MfiEvent[] getMfiEvents(MidiEvent midiEvent, MfiContext context) throws InvalidMfiDataException { diff --git a/src/main/java/vavi/sound/mfi/vavi/track/LoopPointMessage.java b/src/main/java/vavi/sound/mfi/vavi/track/LoopPointMessage.java index 73c99f5..00ccef3 100644 --- a/src/main/java/vavi/sound/mfi/vavi/track/LoopPointMessage.java +++ b/src/main/java/vavi/sound/mfi/vavi/track/LoopPointMessage.java @@ -86,7 +86,7 @@ public String toString() { //---- - /** */ + @Override public MidiEvent[] getMidiEvents(MidiContext context) { Debug.println(Level.INFO, "ignore: " + this); return null; diff --git a/src/main/java/vavi/sound/mfi/vavi/track/MachineDependentMessage.java b/src/main/java/vavi/sound/mfi/vavi/track/MachineDependentMessage.java index 90340cb..a38183e 100644 --- a/src/main/java/vavi/sound/mfi/vavi/track/MachineDependentMessage.java +++ b/src/main/java/vavi/sound/mfi/vavi/track/MachineDependentMessage.java @@ -140,7 +140,7 @@ public String toString() { * 行う。 *

*

- * 再生機構は {@link vavi.sound.mfi.vavi.MetaEventAdapter} を参照。 + * see also {@code vavi.sound.mfi.vavi.MetaEventAdapter} for playing functionality. *

*
      * MIDI Meta
@@ -167,6 +167,7 @@ public String toString() {
      * @see vavi.sound.midi.VaviMidiDeviceProvider#MANUFACTURER_ID
      * @see MachineDependentSequencer#META_FUNCTION_ID_MACHINE_DEPEND
      */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context)
         throws InvalidMidiDataException {
 
diff --git a/src/main/java/vavi/sound/mfi/vavi/track/MasterVolumeMessage.java b/src/main/java/vavi/sound/mfi/vavi/track/MasterVolumeMessage.java
index ab6b389..c239afb 100644
--- a/src/main/java/vavi/sound/mfi/vavi/track/MasterVolumeMessage.java
+++ b/src/main/java/vavi/sound/mfi/vavi/track/MasterVolumeMessage.java
@@ -58,7 +58,7 @@ public String toString() {
 
     //----
 
-    /** */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context)
         throws InvalidMidiDataException {
 
diff --git a/src/main/java/vavi/sound/mfi/vavi/track/MfiConvertibleMessage.java b/src/main/java/vavi/sound/mfi/vavi/track/MfiConvertibleMessage.java
index 172b891..f700f09 100644
--- a/src/main/java/vavi/sound/mfi/vavi/track/MfiConvertibleMessage.java
+++ b/src/main/java/vavi/sound/mfi/vavi/track/MfiConvertibleMessage.java
@@ -53,6 +53,7 @@ public class MfiConvertibleMessage implements MfiConvertible {
     private int[] nrpnMSB = new int[MidiContext.MAX_MIDI_CHANNELS];
 
     /** bank, rpn, nrpn */
+    @Override
     public MfiEvent[] getMfiEvents(MidiEvent midiEvent, MfiContext context)
         throws InvalidMfiDataException {
 
diff --git a/src/main/java/vavi/sound/mfi/vavi/track/ModulationDepthMessage.java b/src/main/java/vavi/sound/mfi/vavi/track/ModulationDepthMessage.java
index 8bff2cc..77c16ea 100644
--- a/src/main/java/vavi/sound/mfi/vavi/track/ModulationDepthMessage.java
+++ b/src/main/java/vavi/sound/mfi/vavi/track/ModulationDepthMessage.java
@@ -78,12 +78,12 @@ public void setModulationDepth(int modulationDepth) {
         this.data[3] = (byte) ((this.data[3] & 0xc0) | this.modulationDepth);
     }
 
-    /** */
+    @Override
     public int getVoice() {
         return voice;
     }
 
-    /** */
+    @Override
     public void setVoice(int voice) {
         this.voice = voice & 0x03;
         this.data[3] = (byte) ((this.data[3] & 0x3f) | (this.voice << 6));
@@ -98,7 +98,7 @@ public String toString() {
 
     //----
 
-    /** */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context)
         throws InvalidMidiDataException {
 
@@ -120,7 +120,7 @@ public MidiEvent[] getMidiEvents(MidiContext context)
         return events;
     }
 
-    /** */
+    @Override
     public MfiEvent[] getMfiEvents(MidiEvent midiEvent, MfiContext context)
         throws InvalidMfiDataException {
 
diff --git a/src/main/java/vavi/sound/mfi/vavi/track/Nop2Message.java b/src/main/java/vavi/sound/mfi/vavi/track/Nop2Message.java
index 24ae2a1..86d5e16 100644
--- a/src/main/java/vavi/sound/mfi/vavi/track/Nop2Message.java
+++ b/src/main/java/vavi/sound/mfi/vavi/track/Nop2Message.java
@@ -65,7 +65,7 @@ public String toString() {
 
     //----
 
-    /** */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context) {
 //Debug.println("ignore: " + this);
         return null;
diff --git a/src/main/java/vavi/sound/mfi/vavi/track/NopMessage.java b/src/main/java/vavi/sound/mfi/vavi/track/NopMessage.java
index 390bd12..86d8413 100644
--- a/src/main/java/vavi/sound/mfi/vavi/track/NopMessage.java
+++ b/src/main/java/vavi/sound/mfi/vavi/track/NopMessage.java
@@ -58,7 +58,7 @@ public String toString() {
 
     //----
 
-    /** */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context) {
 //Debug.println("ignore: " + this);
         return null;
diff --git a/src/main/java/vavi/sound/mfi/vavi/track/PanpotMessage.java b/src/main/java/vavi/sound/mfi/vavi/track/PanpotMessage.java
index ba31fcd..de77ce3 100644
--- a/src/main/java/vavi/sound/mfi/vavi/track/PanpotMessage.java
+++ b/src/main/java/vavi/sound/mfi/vavi/track/PanpotMessage.java
@@ -79,12 +79,12 @@ public void setPanpot(int panpot) {
         this.data[3] = (byte) ((this.data[3] & 0xc0) | this.panpot);
     }
 
-    /** */
+    @Override
     public int getVoice() {
         return voice;
     }
 
-    /** */
+    @Override
     public void setVoice(int voice) {
         this.voice = voice & 0x03;
         this.data[3] = (byte) ((this.data[3] & 0x3f) | (this.voice << 6));
@@ -99,7 +99,7 @@ public String toString() {
 
     //----
 
-    /** */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context)
         throws InvalidMidiDataException {
 
@@ -121,7 +121,7 @@ public MidiEvent[] getMidiEvents(MidiContext context)
         return events;
     }
 
-    /** */
+    @Override
     public MfiEvent[] getMfiEvents(MidiEvent midiEvent, MfiContext context)
         throws InvalidMfiDataException {
 
diff --git a/src/main/java/vavi/sound/mfi/vavi/track/PitchBendMessage.java b/src/main/java/vavi/sound/mfi/vavi/track/PitchBendMessage.java
index b2e0952..afeadf7 100644
--- a/src/main/java/vavi/sound/mfi/vavi/track/PitchBendMessage.java
+++ b/src/main/java/vavi/sound/mfi/vavi/track/PitchBendMessage.java
@@ -77,12 +77,12 @@ public void setPitchBend(int pitchBend) {
         this.data[3] = (byte) ((this.data[3] & 0xc0) | this.pitchBend);
     }
 
-    /** */
+    @Override
     public int getVoice() {
         return voice;
     }
 
-    /** */
+    @Override
     public void setVoice(int voice) {
         this.voice = voice & 0x03;
         this.data[3] = (byte) ((this.data[3] & 0x3f) | (this.voice << 6));
@@ -97,6 +97,7 @@ public String toString() {
     /**
      * PsmPlayer がこう変換していたからしょうがない。
      */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context)
         throws InvalidMidiDataException {
 
@@ -116,7 +117,7 @@ public MidiEvent[] getMidiEvents(MidiContext context)
         };
     }
 
-    /** */
+    @Override
     public MfiEvent[] getMfiEvents(MidiEvent midiEvent, MfiContext context)
         throws InvalidMfiDataException {
 
diff --git a/src/main/java/vavi/sound/mfi/vavi/track/PitchBendRangeMessage.java b/src/main/java/vavi/sound/mfi/vavi/track/PitchBendRangeMessage.java
index 7cf0c77..c731195 100644
--- a/src/main/java/vavi/sound/mfi/vavi/track/PitchBendRangeMessage.java
+++ b/src/main/java/vavi/sound/mfi/vavi/track/PitchBendRangeMessage.java
@@ -79,12 +79,12 @@ public void setPitchBendRange(int pitchBendRange) {
         this.data[3] = (byte) ((this.data[3] & 0xc0) | this.pitchBendRange);
     }
 
-    /** */
+    @Override
     public int getVoice() {
         return voice;
     }
 
-    /** */
+    @Override
     public void setVoice(int voice) {
         this.voice = voice & 0x03;
         this.data[3] = (byte) ((this.data[3] & 0x3f) | (this.voice << 6));
@@ -98,7 +98,7 @@ public String toString() {
 
     //----
 
-    /** */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context)
         throws InvalidMidiDataException {
 
@@ -128,7 +128,7 @@ public MidiEvent[] getMidiEvents(MidiContext context)
         return events;
     }
 
-    /** */
+    @Override
     public MfiEvent[] getMfiEvents(MidiEvent midiEvent, MfiContext context)
         throws InvalidMfiDataException {
 
diff --git a/src/main/java/vavi/sound/mfi/vavi/track/TempoMessage.java b/src/main/java/vavi/sound/mfi/vavi/track/TempoMessage.java
index be9b313..d17cf07 100644
--- a/src/main/java/vavi/sound/mfi/vavi/track/TempoMessage.java
+++ b/src/main/java/vavi/sound/mfi/vavi/track/TempoMessage.java
@@ -7,8 +7,6 @@
 package vavi.sound.mfi.vavi.track;
 
 import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
 import java.util.List;
 import java.util.logging.Level;
 
@@ -115,7 +113,7 @@ public String toString() {
 
     //----
 
-    /** */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context)
         throws InvalidMidiDataException {
 
@@ -140,7 +138,7 @@ public MidiEvent[] getMidiEvents(MidiContext context)
         };
     }
 
-    /** */
+    @Override
     public MfiEvent[] getMfiEvents(MidiEvent midiEvent, MfiContext context)
         throws InvalidMfiDataException {
 
diff --git a/src/main/java/vavi/sound/mfi/vavi/track/UndefinedMessage.java b/src/main/java/vavi/sound/mfi/vavi/track/UndefinedMessage.java
index 6271559..212a334 100644
--- a/src/main/java/vavi/sound/mfi/vavi/track/UndefinedMessage.java
+++ b/src/main/java/vavi/sound/mfi/vavi/track/UndefinedMessage.java
@@ -59,7 +59,7 @@ public String toString() {
 
     //----
 
-    /** */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context) {
 Debug.println(this);
         return null;
diff --git a/src/main/java/vavi/sound/mfi/vavi/track/VolumeMessage.java b/src/main/java/vavi/sound/mfi/vavi/track/VolumeMessage.java
index 90e409e..ba39dd5 100644
--- a/src/main/java/vavi/sound/mfi/vavi/track/VolumeMessage.java
+++ b/src/main/java/vavi/sound/mfi/vavi/track/VolumeMessage.java
@@ -77,12 +77,12 @@ public void setVolume(int volume) {
         this.data[3] = (byte) ((this.data[3] & 0xc0) | this.volume);
     }
 
-    /** */
+    @Override
     public int getVoice() {
         return voice;
     }
 
-    /** */
+    @Override
     public void setVoice(int voice) {
         this.voice = voice & 0x03;
         this.data[3] = (byte) ((this.data[3] & 0x3f) | (this.voice << 6));
@@ -96,7 +96,7 @@ public String toString() {
 
     //----
 
-    /** */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context)
         throws InvalidMidiDataException {
 
@@ -121,7 +121,7 @@ public MidiEvent[] getMidiEvents(MidiContext context)
         return events;
     }
 
-    /** */
+    @Override
     public MfiEvent[] getMfiEvents(MidiEvent midiEvent, MfiContext context)
         throws InvalidMfiDataException {
 
diff --git a/src/main/java/vavi/sound/midi/BasicMidiFileReader.java b/src/main/java/vavi/sound/midi/BasicMidiFileReader.java
index 7238db6..426cbc3 100644
--- a/src/main/java/vavi/sound/midi/BasicMidiFileReader.java
+++ b/src/main/java/vavi/sound/midi/BasicMidiFileReader.java
@@ -39,6 +39,7 @@ public abstract class BasicMidiFileReader extends MidiFileReader {
      * @param stream a midi stream
      * @throws IOException when the I/O does not support marking.
      */
+    @Override
     public MidiFileFormat getMidiFileFormat(InputStream stream)
         throws InvalidMidiDataException,
                IOException {
diff --git a/src/main/java/vavi/sound/midi/VaviMidiDeviceProvider.java b/src/main/java/vavi/sound/midi/VaviMidiDeviceProvider.java
index 4afec40..983b1ad 100644
--- a/src/main/java/vavi/sound/midi/VaviMidiDeviceProvider.java
+++ b/src/main/java/vavi/sound/midi/VaviMidiDeviceProvider.java
@@ -32,6 +32,7 @@ public class VaviMidiDeviceProvider extends MidiDeviceProvider {
     private static final MidiDevice.Info[] infos = new MidiDevice.Info[] { VaviSequencer.info };
 
     /* */
+    @Override
     public MidiDevice.Info[] getDeviceInfo() {
         return infos;
     }
@@ -40,6 +41,7 @@ public MidiDevice.Info[] getDeviceInfo() {
      * ADPCM 再生機構を付加した MIDI シーケンサを返します。
      * @throws IllegalArgumentException info is not suitable for this provider
      */
+    @Override
     public MidiDevice getDevice(MidiDevice.Info info) {
 
         if (info == VaviSequencer.info) {
diff --git a/src/main/java/vavi/sound/midi/mfi/MfiMidiFileReader.java b/src/main/java/vavi/sound/midi/mfi/MfiMidiFileReader.java
index 54bcf50..6d3fdcb 100644
--- a/src/main/java/vavi/sound/midi/mfi/MfiMidiFileReader.java
+++ b/src/main/java/vavi/sound/midi/mfi/MfiMidiFileReader.java
@@ -31,6 +31,7 @@
 public class MfiMidiFileReader extends BasicMidiFileReader {
 
     /** Gets a MIDI Sequence converted from MFi */
+    @Override
     public Sequence getSequence(InputStream is)
         throws InvalidMidiDataException,
                IOException {
diff --git a/src/main/java/vavi/sound/midi/mfi/MfiMidiFileWriter.java b/src/main/java/vavi/sound/midi/mfi/MfiMidiFileWriter.java
index 0e19fa8..b925f64 100644
--- a/src/main/java/vavi/sound/midi/mfi/MfiMidiFileWriter.java
+++ b/src/main/java/vavi/sound/midi/mfi/MfiMidiFileWriter.java
@@ -18,7 +18,6 @@
 import vavi.sound.mfi.MfiUnavailableException;
 import vavi.sound.midi.BasicMidiFileWriter;
 import vavi.util.Debug;
-import vavi.util.StringUtil;
 
 
 /**
diff --git a/src/main/java/vavi/sound/midi/readme.md b/src/main/java/vavi/sound/midi/readme.md
index acf7ea7..5ed9ae3 100644
--- a/src/main/java/vavi/sound/midi/readme.md
+++ b/src/main/java/vavi/sound/midi/readme.md
@@ -1,10 +1,12 @@
-MIDI のサービスプロバイダとしての実装をするための基本クラスを提供します。
+# vavi.sound.midi
+
+Provides base classes for the MIDI service provider.
 
 ## 注意
 MFi, SMAF をこのパッケージで再生する場合、システムプロパティ `javax.sound.midi.Sequencer` に
 `"#Java MIDI(MFi/SMAF) ADPCM Sequencer"` と設定してください。ADPCM のハンドリングができなくなります。
 
-## MIDI ファイルタイプの勝手な仕様
+## MIDI file type for MFi/SMAF (⚠ this is not MIDI specs, proprietary)
 
 ```
  8765 4321 LSB
@@ -18,20 +20,19 @@ MFi, SMAF をこのパッケージで再生する場合、システムプロパ
 
 ## TODO
 
- * SMAF Handyphone/Mobile の切り分け
- * ↓は OK で
-```java
+ * implement SMAF Handyphone/Mobile
+ * ↓ is OK
+   ```java
         InputStream is = new BufferedInputStream(new FileInputStream(file));
         Sequence sequence = MidiSystem.getSequence(is);
         sequencer.setSequence(sequence);
-```
-↓ は NG、Smaf, `MfiFileReader` (プロバイダ2つ目以降?)に
- 0 バイトの `ByteArrayInputStream` の MIDI ストリームが渡ってくる
-```java
+   ```
+   ↓ is NG, Smaf, `MfiFileReader` returns (after second providers?) 0 byte `ByteArrayInputStream` MIDI stream
+   ```java
         InputStream is = new BufferedInputStream(new FileInputStream(file));
         sequencer.setSequence(is);
-```
- * ~~`DeveiceInfo` 周りをちゃんとする (`MidiSystem#getSequencer()` で `SmafMidiSequencer`(一番目) が返る)~~ → 仕様
+   ```
+ * ~~implement `DeveiceInfo` properly (`MidiSystem#getSequencer()` returns `SmafMidiSequencer`(first))~~ → specs
 
 ## Deprecated
 
diff --git a/src/main/java/vavi/sound/mobile/AudioEngine.java b/src/main/java/vavi/sound/mobile/AudioEngine.java
index d8ec01f..0d6296e 100644
--- a/src/main/java/vavi/sound/mobile/AudioEngine.java
+++ b/src/main/java/vavi/sound/mobile/AudioEngine.java
@@ -24,6 +24,8 @@
  */
 public interface AudioEngine {
 
+    double volume = Double.parseDouble(System.getProperty("vavi.sound.mobile.AudioEngine.volume",  "0.2"));
+
     /**
      * Sets adpcm data.
      * @param streamNumber packet id
diff --git a/src/main/java/vavi/sound/mobile/BasicAudioEngine.java b/src/main/java/vavi/sound/mobile/BasicAudioEngine.java
index b95b5bd..0e0fc2a 100644
--- a/src/main/java/vavi/sound/mobile/BasicAudioEngine.java
+++ b/src/main/java/vavi/sound/mobile/BasicAudioEngine.java
@@ -108,7 +108,7 @@ public void start(int streamNumber) {
             SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info);
             line.open(audioFormat);
             line.start();
-            volume(line, .2d);
+            volume(line, volume);
             byte[] buf = new byte[1024];
             while (iss[0].available() > 0) {
                 if (channels == 1) {
diff --git a/src/main/java/vavi/sound/mobile/PcmAudioEngine.java b/src/main/java/vavi/sound/mobile/PcmAudioEngine.java
index 73592f2..4eb6584 100644
--- a/src/main/java/vavi/sound/mobile/PcmAudioEngine.java
+++ b/src/main/java/vavi/sound/mobile/PcmAudioEngine.java
@@ -143,7 +143,7 @@ public void start(int streamNumber) {
             SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info);
             line.open(audioFormat);
             line.start();
-            volume(line, .2d);
+            volume(line, volume);
             byte[] buf = new byte[1024];
             while (iss[0].available() > 0) {
                 if (channels == 1) {
diff --git a/src/main/java/vavi/sound/pcm/resampling/ssrc/SSRC.java b/src/main/java/vavi/sound/pcm/resampling/ssrc/SSRC.java
index 9881fab..2732c2c 100644
--- a/src/main/java/vavi/sound/pcm/resampling/ssrc/SSRC.java
+++ b/src/main/java/vavi/sound/pcm/resampling/ssrc/SSRC.java
@@ -29,7 +29,7 @@
 /**
  * Shibatch Sampling Rate Converter.
  *
- * TODO 2pass 1st phase use pipe
+ * TODO 2pass 1st phase use pipe (but on m2 ultra, it's in a blink of an eye)
  *
  * @author Naoki Shibata
  * @author Naohide Sano (nsano)
@@ -46,6 +46,9 @@ public class SSRC {
     /** */
     private static final String VERSION = "1.30";
 
+    /** for producing same result use fixed seed */
+    private static final long SEED = 314159265358979L;
+
     /** */
     private double AA = 170;
 
@@ -55,21 +58,21 @@ public class SSRC {
     /** */
     private int FFTFIRLEN = 65536;
 
-    /** */
-//  private static final int M = 15;
+//    /** */
+//    private static final int M = 15;
 
     /** */
     private static int round(double x) {
         return x >= 0 ? (int) (x + 0.5) : (int) (x - 0.5);
     }
 
-    /** */
+    /** @view */
     private boolean quiet = false;
 
-    /** */
+    /** @view */
     private int lastShowed2;
 
-    /** */
+    /** @view */
     private long startTime, lastShowed;
 
     /** */
@@ -153,10 +156,10 @@ private static class Shaper {
         /** */
         private int randPtr;
 
-        /**  */
+        /** */
         private static final int POOLSIZE = 97;
 
-        /**  */
+        /** */
         private int initShaper(int freq, int nch, int min, int max, int dType, int pdf, double noiseAmp) {
             int i;
             int[] pool = new int[POOLSIZE];
@@ -190,7 +193,7 @@ private int initShaper(int freq, int nch, int min, int max, int dType, int pdf,
 
             randBuf = new double[RANDBUFLEN];
 
-            Random random = new Random(System.currentTimeMillis()); // TODO seed should be controlled for test
+            Random random = new Random(SEED);
             for (i = 0; i < POOLSIZE; i++) {
                 pool[i] = random.nextInt();
             }
@@ -267,7 +270,7 @@ private int initShaper(int freq, int nch, int min, int max, int dType, int pdf,
             return samp[shaperType];
         }
 
-        /**  */
+        /** */
         private int doShaping(double s, double[] peak, int dtype, int ch) {
             double u, h;
             int i;
@@ -327,7 +330,7 @@ private int doShaping(double s, double[] peak, int dtype, int ch) {
             return (int) s;
         }
 
-        /**  */
+        /** */
         private void quitShaper(int nch) {
         }
     }
@@ -363,7 +366,7 @@ private static double hn_lpf(int n, double lpf, double fs) {
         return 2 * lpf * t * sinc(n * omega * t);
     }
 
-    /** */
+    /** @view */
     private static void usage() {
         System.err.print("http://shibatch.sourceforge.net/\n\n");
         System.err.print("usage: ssrc []  \n");
@@ -389,20 +392,20 @@ private static void usage() {
         System.err.print("                                       fast     : fast, not so bad quality\n");
     }
 
-    /** */
+    /** @view */
     private static void error(int x) {
         System.err.printf("unknown error %d\n", x);
         System.exit(-1);
     }
 
-    /** */
+    /** @view */
     private void setStartTime() {
         startTime = System.currentTimeMillis();
         lastShowed = 0;
         lastShowed2 = -1;
     }
 
-    /** */
+    /** @view */
     private void showProgress(double p) {
         int eta, pc;
         long t;
@@ -433,10 +436,8 @@ private void showProgress(double p) {
 
     /** */
     private static int gcd(int x, int y) {
-        int t;
-
         while (y != 0) {
-            t = x % y;
+            int t = x % y;
             x = y;
             y = t;
         }
@@ -444,7 +445,7 @@ private static int gcd(int x, int y) {
     }
 
     /** */
-    abstract static class Resampler {
+    private abstract static class Resampler {
         int nch;
         int bps;
         int dbps;
@@ -477,10 +478,11 @@ void init(int nch, int bps, int dbps, int sfrq, int dfrq, double gain, int chank
         double peak;
     }
 
-    /** */
-    class Upsampler extends Resampler {
+    /** up */
+    private class Upsampler extends Resampler {
 
         /* */
+        @Override
         int resample(ReadableByteChannel fpi, WritableByteChannel fpo) throws IOException {
             int frqgcd, osf, fs1, fs2;
             double[][] stage1;
@@ -522,8 +524,10 @@ int resample(ReadableByteChannel fpi, WritableByteChannel fpo) throws IOExceptio
                     osf = 3;
                 } else {
                     throw new IllegalArgumentException(
-                        String.format("Resampling from %dHz to %dHz is not supported.\n" +
-                                      "%d/gcd(%d,%d)=%d must be divided by 2 or 3.\n",
+                        String.format("""
+                                        Resampling from %dHz to %dHz is not supported.
+                                        %d/gcd(%d,%d)=%d must be divided by 2 or 3.
+                                        """,
                                       sfrq, dfrq, sfrq, sfrq, dfrq, fs1 / dfrq));
                 }
 
@@ -630,15 +634,15 @@ int resample(ReadableByteChannel fpi, WritableByteChannel fpo) throws IOExceptio
 
             {
                 int n2b2 = n2b / 2;
-                // inbufのfs1での次に読むサンプルの場所を保持
+                // keeps the location of the next sample to read in fs1 of inbuf
                 int rp;
-                // 次にdisposeするsfrqでのサンプル数
+                // number of samples in sfrq to dispose next
                 int ds;
-                // 実際にファイルからinbufに読み込まれた値から計算した stage2 filterに渡されるサンプル数
+                // number of samples passed to stage2 filter calculated from the value actually read into inbuf from the file
                 int nsmplwrt1;
-                // 実際にファイルからinbufに読み込まれた値から計算した stage2 filterに渡されるサンプル数
+                // number of samples passed to stage2 filter calculated from the value actually read into inbuf from the file
                 int nsmplwrt2 = 0;
-                // stage1 filterから出力されたサンプルの数をn1y*osfで割った余り
+                // remainder of number of samples output from stage1 filter divided by n1y*osf
                 int s1p;
                 boolean init;
                 boolean ending;
@@ -1049,10 +1053,11 @@ int resample(ReadableByteChannel fpi, WritableByteChannel fpo) throws IOExceptio
         }
     }
 
-    /** */
-    class Downsampler extends Resampler {
+    /** down */
+    private class Downsampler extends Resampler {
 
         /* */
+        @Override
         int resample(ReadableByteChannel fpi, WritableByteChannel fpo) throws IOException {
             int frqgcd, osf, fs1, fs2;
             double[] stage1;
@@ -1226,18 +1231,18 @@ int resample(ReadableByteChannel fpi, WritableByteChannel fpo) throws IOExceptio
 
             {
                 int n1b2 = n1b / 2;
-//                int rp; // inbufのfs1での次に読むサンプルの場所を保持
-                int rps; // rpを(fs1/sfrq=osf)で割った余り
-                int rp2; // buf2のfs2での次に読むサンプルの場所を保持
-                int ds; // 次にdisposeするsfrqでのサンプル数
-                // 実際にファイルからinbufに読み込まれた値から計算した stage2 filterに渡されるサンプル数
+//                int rp; // keeps the location of the next sample to read in fs1 of inbuf
+                int rps; // remainder when dividing rp by (fs1/sfrq=osf)
+                int rp2; // keeps the location of the next sample to read in fs2 of buf2
+                int ds; // number of samples in sfrq to dispose next
+                // number of samples passed to stage2 filter calculated from the value actually read into inbuf from the file
 //                int nsmplwrt1;
-                // 実際にファイルからinbufに読み込まれた値から計算した stage2 filterに渡されるサンプル数
+                // number of samples passed to stage2 filter calculated from the value actually read into inbuf from the file
                 int nsmplwrt2 = 0;
-                int s2p; // stage1 filterから出力されたサンプルの数をn1y*osfで割った余り
+                int s2p; // remainder of number of samples output from stage1 filter divided by n1y*osf
                 boolean init, ending;
 //                int osc;
-                int bp; // rp2から計算される.buf2の次に読むサンプルの位置
+                int bp; // calculated from rp2. Position of sample to read next after buf2
                 int rps_backup, s2p_backup;
                 int k, ch, p;
                 int inbuflen = 0;
@@ -1248,13 +1253,13 @@ int resample(ReadableByteChannel fpi, WritableByteChannel fpo) throws IOExceptio
                 // |....B....|....C....| buf1 n1b2+n1b2
                 // |.A.|....D....| buf2 n2x+n1b2
                 //
-                // まずinbufからBにosf倍サンプリングしながらコピー
-                // Cはクリア
-                // BCにstage 1 filterをかける
-                // DにBを足す
-                // ADにstage 2 filterをかける
-                // Dの後ろをAに移動
-                // CをDにコピー
+                // first, copy from inbuf to B while sampling osf times
+                // clear C
+                // multiply stage 1 filter to BC
+                // add B to D
+                // multiply stage 2 filter to AD
+                // move last D to A
+                // copy C to D
 
                 buf1 = new double[nch][n1b];
 
@@ -1307,7 +1312,7 @@ int resample(ReadableByteChannel fpi, WritableByteChannel fpo) throws IOExceptio
                         for (i = 0; i < nsmplread * nch; i++) {
                             int v = rawinbuf.order(byteOrder).asShortBuffer().get(i);
                             inbuf[nch * inbuflen + i] = (1 / (double) 0x7fff) * v;
-    //System.err.printf("I: %f\n", inbuf[nch * inbuflen + i]);
+//System.err.printf("I: %f\n", inbuf[nch * inbuflen + i]);
                         }
                         break;
 
@@ -1630,10 +1635,11 @@ int resample(ReadableByteChannel fpi, WritableByteChannel fpo) throws IOExceptio
         }
     }
 
-    /** */
-    class NoSrc extends Resampler {
+    /** no src */
+    private class NoSrc extends Resampler {
 
         /* */
+        @Override
         int resample(ReadableByteChannel fpi, WritableByteChannel fpo) throws IOException {
             double[] peak = new double[] {
                 0
@@ -1757,12 +1763,13 @@ int resample(ReadableByteChannel fpi, WritableByteChannel fpo) throws IOExceptio
         }
     }
 
+    /** */
     public static void main(String[] args) throws Exception {
         SSRC app = new SSRC();
         app.exec(args);
     }
 
-    /** */
+    /** exec#noiseamp */
     private static final double[] presets = {
         0.7, 0.9, 0.18
     };
diff --git a/src/main/java/vavi/sound/pcm/resampling/ssrc/readme.md b/src/main/java/vavi/sound/pcm/resampling/ssrc/readme.md
index 417cceb..061ab5e 100644
--- a/src/main/java/vavi/sound/pcm/resampling/ssrc/readme.md
+++ b/src/main/java/vavi/sound/pcm/resampling/ssrc/readme.md
@@ -4,7 +4,7 @@ Shibatch Sampling Rate Converter
 
 ## Reference
 
- * [Original](http://shibatch.sourceforge.net)
+ * [Original](https://github.com/shibatch/SSRC)
 
 ## TODO
 
diff --git a/src/main/java/vavi/sound/readme.md b/src/main/java/vavi/sound/readme.md
index f362eac..e483acf 100644
--- a/src/main/java/vavi/sound/readme.md
+++ b/src/main/java/vavi/sound/readme.md
@@ -1,11 +1,11 @@
 # vavi.sound
 
-サウンド関連のクラスを提供します.
+provides about sound.
 
- * vavi.sound.adpcm.* ... adpcm
- * vavi.sound.mfi.* ... i-melody
- * vavi.sound.smaf.* ... smaf
- * vavi.sound.midi.* ... i-melody and smaf adpcm
- * vavi.sound.mobile.* ... mobile adpcm
- * vavi.sound.sampled.ssrc.* ... sampling rate converter
- * vavi.sound.sampled.adpcm.* ... adpcm as spi
+ * vavi.sound.adpcm ... adpcm
+ * vavi.sound.mfi ... i-melody
+ * vavi.sound.smaf ... smaf
+ * vavi.sound.midi ... i-melody and smaf adpcm
+ * vavi.sound.mobile ... mobile adpcm
+ * vavi.sound.sampled.ssrc ... sampling rate converter
+ * vavi.sound.sampled.adpcm ... adpcm as spi
diff --git a/src/main/java/vavi/sound/sampled/MonauralInputFilter.java b/src/main/java/vavi/sound/sampled/MonauralInputFilter.java
index 5d35a98..48359fc 100644
--- a/src/main/java/vavi/sound/sampled/MonauralInputFilter.java
+++ b/src/main/java/vavi/sound/sampled/MonauralInputFilter.java
@@ -27,7 +27,7 @@
  */
 public class MonauralInputFilter implements InputFilter {
 
-    /** */
+    @Override
     public AudioInputStream doFilter(AudioInputStream sourceAis) throws IOException, UnsupportedAudioFileException {
         AudioFormat inAudioFormat = sourceAis.getFormat();
         if (inAudioFormat.getChannels() != 2) {
diff --git a/src/main/java/vavi/sound/sampled/Pcm16BitMonauralWaveDivider.java b/src/main/java/vavi/sound/sampled/Pcm16BitMonauralWaveDivider.java
index f827c90..fa76dae 100644
--- a/src/main/java/vavi/sound/sampled/Pcm16BitMonauralWaveDivider.java
+++ b/src/main/java/vavi/sound/sampled/Pcm16BitMonauralWaveDivider.java
@@ -44,6 +44,7 @@ class Pcm16BitMonauralWaveDivider implements WaveDivider {
      * @param seconds time for divide
      * @param event event for each chunks
      */
+    @Override
     public void divide(float seconds, Event event) throws IOException {
 
         int numberChannels = targetAis.getFormat().getChannels();
diff --git a/src/main/java/vavi/sound/sampled/SimpleResamplingInputFilter.java b/src/main/java/vavi/sound/sampled/SimpleResamplingInputFilter.java
index 1913af9..a332148 100644
--- a/src/main/java/vavi/sound/sampled/SimpleResamplingInputFilter.java
+++ b/src/main/java/vavi/sound/sampled/SimpleResamplingInputFilter.java
@@ -34,7 +34,7 @@ public SimpleResamplingInputFilter(int outSamplingRate) {
         this.outSamplingRate = outSamplingRate;
     }
 
-    /** */
+    @Override
     public AudioInputStream doFilter(AudioInputStream sourceAis) throws IOException, UnsupportedAudioFileException {
         AudioFormat inAudioFormat = sourceAis.getFormat();
 Debug.println(Level.FINE, "IN: " + inAudioFormat);
diff --git a/src/main/java/vavi/sound/sampled/TemporaryFiledInputFilter.java b/src/main/java/vavi/sound/sampled/TemporaryFiledInputFilter.java
index 35a0395..2027e32 100644
--- a/src/main/java/vavi/sound/sampled/TemporaryFiledInputFilter.java
+++ b/src/main/java/vavi/sound/sampled/TemporaryFiledInputFilter.java
@@ -26,7 +26,7 @@
  */
 public class TemporaryFiledInputFilter implements InputFilter {
 
-    /** */
+    @Override
     public AudioInputStream doFilter(AudioInputStream sourceAis) throws IOException, UnsupportedAudioFileException {
         // 一回 temp ファイルに落とす
         File tmpFile = File.createTempFile("temp", ".wav");
diff --git a/src/main/java/vavi/sound/sampled/mfi/DividedMfiWithVoiceMaker.java b/src/main/java/vavi/sound/sampled/mfi/DividedMfiWithVoiceMaker.java
index de2e813..a5a4020 100644
--- a/src/main/java/vavi/sound/sampled/mfi/DividedMfiWithVoiceMaker.java
+++ b/src/main/java/vavi/sound/sampled/mfi/DividedMfiWithVoiceMaker.java
@@ -72,12 +72,13 @@ public DividedMfiWithVoiceMaker(AudioInputStream sourceAis, String directory, St
     private class Event implements WaveDivider.Event {
         /** total size written */
         int r = 0;
+        @Override
         public void exec(WaveDivider.Chunk chunk) throws IOException {
             try {
                 File file = new File(directory, String.format(base, chunk.sequence + 1));
                 r += createMFi(chunk.buffer, file);
             } catch (InvalidMfiDataException e) {
-                throw (IOException) new IOException().initCause(e);
+                throw (IOException) new IOException(e);
             }
         }
     }
@@ -89,6 +90,7 @@ public void exec(WaveDivider.Chunk chunk) throws IOException {
      * @throws InvalidMfiDataException
      * @return total size written
      */
+    @Override
     public int create() throws IOException, UnsupportedAudioFileException, InvalidMfiDataException {
 long t = System.currentTimeMillis();
         // divide
diff --git a/src/main/java/vavi/sound/sampled/mfi/MachineDependentMfiWithVoiceMaker.java b/src/main/java/vavi/sound/sampled/mfi/MachineDependentMfiWithVoiceMaker.java
index b67ae08..3827fce 100644
--- a/src/main/java/vavi/sound/sampled/mfi/MachineDependentMfiWithVoiceMaker.java
+++ b/src/main/java/vavi/sound/sampled/mfi/MachineDependentMfiWithVoiceMaker.java
@@ -39,18 +39,18 @@ List getEvents(byte[] data, float time, int sampleRate, int bits, int
 
     /** factory */
     PrefixedPropertiesFactory factory =
-        new PrefixedClassPropertiesFactory("/vavi/sound/sampled/mfi/MfiWithVoiceMaker.properties", "class.") {
-
-        @Override
-        protected String getRestoreKey(String key) {
-            return key;
-        }
-
-        @Override
-        protected String getStoreKey(String key) {
-            return key.substring(key.indexOf('.') + 1);
-        }
-    };
+            new PrefixedClassPropertiesFactory<>("/vavi/sound/sampled/mfi/MfiWithVoiceMaker.properties", "class.") {
+
+                @Override
+                protected String getRestoreKey(String key) {
+                    return key;
+                }
+
+                @Override
+                protected String getStoreKey(String key) {
+                    return key.substring(key.indexOf('.') + 1);
+                }
+            };
 }
 
 /* */
diff --git a/src/main/java/vavi/sound/sampled/mfi/MfiAudioFileWriter.java b/src/main/java/vavi/sound/sampled/mfi/MfiAudioFileWriter.java
index 3c00bfe..3128acb 100644
--- a/src/main/java/vavi/sound/sampled/mfi/MfiAudioFileWriter.java
+++ b/src/main/java/vavi/sound/sampled/mfi/MfiAudioFileWriter.java
@@ -34,11 +34,13 @@ public class MfiAudioFileWriter extends AudioFileWriter {
     };
 
     /** このオーディオファイルライタがファイル書き込みサポートを提供するファイル型を取得します。 */
+    @Override
     public Type[] getAudioFileTypes() {
         return outputTypes;
     }
 
     /** 指定されたオーディオ入力ストリームからこのオーディオファイルライタが書き込みできるファイル型を取得します。 */
+    @Override
     public Type[] getAudioFileTypes(AudioInputStream stream) {
         return getAudioFileTypes(); // TODO check stream
     }
@@ -50,6 +52,7 @@ public Type[] getAudioFileTypes(AudioInputStream stream) {
      * @throws IllegalArgumentException fileType が MFi でない場合スローされます。
      * @throws NullPointerException fileType に properties が設定されていない場合スローされます。
      */
+    @Override
     public int write(AudioInputStream stream, Type fileType, OutputStream out) throws IOException {
         if (!isFileTypeSupported(fileType, stream)) {
             throw new IllegalArgumentException("unsupported fileType: " + fileType.getClass().getName());
@@ -88,7 +91,7 @@ public int write(AudioInputStream stream, Type fileType, OutputStream out) throw
                 return r;
             }
         } catch (UnsupportedAudioFileException | InvalidMfiDataException e) {
-            throw (IOException) new IOException().initCause(e);
+            throw (IOException) new IOException(e);
         } catch (IllegalArgumentException e) {
 Debug.printStackTrace(e);
             throw e;
@@ -100,6 +103,7 @@ public int write(AudioInputStream stream, Type fileType, OutputStream out) throw
      * @param fileType must be instance of {@link MFi}
      * @param out null 出力を指定してください。 win32: "nul", *nix: "/dev/null"
      */
+    @Override
     public int write(AudioInputStream stream, Type fileType, File out) throws IOException {
         return write(stream, fileType, Files.newOutputStream(out.toPath()));
     }
diff --git a/src/main/java/vavi/sound/sampled/mfi/type/sh252.java b/src/main/java/vavi/sound/sampled/mfi/type/sh252.java
index 0f3b408..6810f94 100644
--- a/src/main/java/vavi/sound/sampled/mfi/type/sh252.java
+++ b/src/main/java/vavi/sound/sampled/mfi/type/sh252.java
@@ -30,6 +30,7 @@ public class sh252 implements MachineDependentMfiWithVoiceMaker {
      * @param masterVolume 100% currently recommended
      * @param adpcmVolume 100% currently recommended
      */
+    @Override
     public List getEvents(byte[] data, float time, int sampleRate, int bits, int channels, int masterVolume, int adpcmVolume)
         throws InvalidMfiDataException, IOException {
 
diff --git a/src/main/java/vavi/sound/sampled/mfi/type/sh900.java b/src/main/java/vavi/sound/sampled/mfi/type/sh900.java
index 31fec3d..3c39848 100644
--- a/src/main/java/vavi/sound/sampled/mfi/type/sh900.java
+++ b/src/main/java/vavi/sound/sampled/mfi/type/sh900.java
@@ -30,6 +30,7 @@ public class sh900 implements MachineDependentMfiWithVoiceMaker {
      * @param masterVolume 100% currently recommended
      * @param adpcmVolume 100% currently recommended
      */
+    @Override
     public List getEvents(byte[] data, float time, int sampleRate, int bits, int channels, int masterVolume, int adpcmVolume)
         throws InvalidMfiDataException, IOException {
 
diff --git a/src/main/java/vavi/sound/sampled/smaf/DividedSmafWithVoiceMaker.java b/src/main/java/vavi/sound/sampled/smaf/DividedSmafWithVoiceMaker.java
index 31d485c..0718a16 100644
--- a/src/main/java/vavi/sound/sampled/smaf/DividedSmafWithVoiceMaker.java
+++ b/src/main/java/vavi/sound/sampled/smaf/DividedSmafWithVoiceMaker.java
@@ -66,13 +66,14 @@ public DividedSmafWithVoiceMaker(AudioInputStream sourceAis, String directory, S
     private class Event implements WaveDivider.Event {
         /** total size written */
         int r = 0;
+        @Override
         public void exec(WaveDivider.Chunk chunk) throws IOException {
             try {
                 File file = new File(directory, String.format(base, chunk.sequence + 1));
 Debug.println(Level.FINE, "file: " + file + ", " + directory + ", " + base + ", " + (chunk.sequence + 1));
                 r += createSMAF(chunk.buffer, file);
             } catch (InvalidSmafDataException e) {
-                throw (IOException) new IOException().initCause(e);
+                throw (IOException) new IOException(e);
             }
         }
     }
@@ -84,6 +85,7 @@ public void exec(WaveDivider.Chunk chunk) throws IOException {
      * @throws InvalidSmafDataException
      * @return total size written
      */
+    @Override
     public int create() throws IOException, UnsupportedAudioFileException, InvalidSmafDataException {
 long t = System.currentTimeMillis();
         // divide
diff --git a/src/main/java/vavi/sound/sampled/smaf/SmafAudioFileWriter.java b/src/main/java/vavi/sound/sampled/smaf/SmafAudioFileWriter.java
index a0a013d..cf751ac 100644
--- a/src/main/java/vavi/sound/sampled/smaf/SmafAudioFileWriter.java
+++ b/src/main/java/vavi/sound/sampled/smaf/SmafAudioFileWriter.java
@@ -33,11 +33,13 @@ public class SmafAudioFileWriter extends AudioFileWriter {
     };
 
     /** このオーディオファイルライタがファイル書き込みサポートを提供するファイル型を取得します。 */
+    @Override
     public Type[] getAudioFileTypes() {
         return outputTypes;
     }
 
     /** 指定されたオーディオ入力ストリームからこのオーディオファイルライタが書き込みできるファイル型を取得します。 */
+    @Override
     public Type[] getAudioFileTypes(AudioInputStream stream) {
         return getAudioFileTypes(); // TODO check stream
     }
@@ -49,6 +51,7 @@ public Type[] getAudioFileTypes(AudioInputStream stream) {
      * @throws IllegalArgumentException fileType が SMAF でない場合スローされます。
      * @throws NullPointerException fileType に properties が設定されていない場合スローされます。
      */
+    @Override
     public int write(AudioInputStream stream, Type fileType, OutputStream out) throws IOException {
         if (!isFileTypeSupported(fileType, stream)) {
             throw new IllegalArgumentException("unsupported fileType: " + fileType.getClass().getName());
@@ -94,6 +97,7 @@ public int write(AudioInputStream stream, Type fileType, OutputStream out) throw
      * @param fileType must be instance of {@link SMAF}
      * @param out null 出力を指定してください。 win32: "nul", *nix: "/dev/null"
      */
+    @Override
     public int write(AudioInputStream stream, Type fileType, File out) throws IOException {
         return write(stream, fileType, Files.newOutputStream(out.toPath()));
     }
diff --git a/src/main/java/vavi/sound/smaf/MetaEventAdapter.java b/src/main/java/vavi/sound/smaf/MetaEventAdapter.java
index 3b0e27d..bdd6e1f 100644
--- a/src/main/java/vavi/sound/smaf/MetaEventAdapter.java
+++ b/src/main/java/vavi/sound/smaf/MetaEventAdapter.java
@@ -37,20 +37,24 @@ class MetaEventAdapter implements MetaEventListener, SmafDevice {
                            "Version " + SmafDeviceProvider.version) {};
 
     /* */
+    @Override
     public SmafDevice.Info getDeviceInfo() {
         return info;
     }
 
     /* */
+    @Override
     public void close() {
     }
 
     /* */
+    @Override
     public boolean isOpen() {
         return true;
     }
 
     /* */
+    @Override
     public void open() {
     }
 
@@ -58,6 +62,7 @@ public void open() {
      * {@link SmafMessageStore} を使用した再生機構を実装しています。
      * @see WaveMessage#getMidiEvents(MidiContext)
      */
+    @Override
     public void meta(javax.sound.midi.MetaMessage message) {
 //Debug.println("type: " + message.getType());
         switch (MetaEvent.valueOf(message.getType())) {
diff --git a/src/main/java/vavi/sound/smaf/SmafDeviceProvider.java b/src/main/java/vavi/sound/smaf/SmafDeviceProvider.java
index 85090e3..7a4de50 100644
--- a/src/main/java/vavi/sound/smaf/SmafDeviceProvider.java
+++ b/src/main/java/vavi/sound/smaf/SmafDeviceProvider.java
@@ -8,7 +8,6 @@
 
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -62,9 +61,8 @@ private static class Factory {
 
         /** */
         public static SmafDevice.Info[] getSmafDeviceInfos() {
-            List tmp = new ArrayList<>();
 
-            tmp.addAll(deviceMap.keySet());
+            List tmp = new ArrayList<>(deviceMap.keySet());
 
             return tmp.toArray(new SmafDevice.Info[0]);
         }
@@ -73,7 +71,7 @@ public static SmafDevice.Info[] getSmafDeviceInfos() {
         public static SmafDevice getSmafDevice(SmafDevice.Info smafDeviceInfo) {
             if (deviceMap.containsKey(smafDeviceInfo)) {
                 try {
-                    return deviceMap.get(smafDeviceInfo).newInstance();
+                    return deviceMap.get(smafDeviceInfo).getDeclaredConstructor().newInstance();
                 } catch (Exception e) {
 Debug.printStackTrace(e);
                 }
@@ -100,7 +98,7 @@ public static SmafDevice getSmafDevice(SmafDevice.Info smafDeviceInfo) {
                         @SuppressWarnings("unchecked")
                         Class deviceClass = (Class) Class.forName(props.getProperty(key));
 //Debug.println("smaf device class: " + StringUtil.getClassName(clazz));
-                        SmafDevice.Info smafDeviceInfo = deviceClass.newInstance().getDeviceInfo();
+                        SmafDevice.Info smafDeviceInfo = deviceClass.getDeclaredConstructor().newInstance().getDeviceInfo();
 
                         deviceMap.put(smafDeviceInfo, deviceClass);
                     }
diff --git a/src/main/java/vavi/sound/smaf/SmafFileFormat.java b/src/main/java/vavi/sound/smaf/SmafFileFormat.java
index 1eefbc6..5f46dd3 100644
--- a/src/main/java/vavi/sound/smaf/SmafFileFormat.java
+++ b/src/main/java/vavi/sound/smaf/SmafFileFormat.java
@@ -72,8 +72,7 @@ Sequence getSequence() {
     static SmafFileFormat readFrom(InputStream is) throws InvalidSmafDataException, IOException {
         try {
             Chunk chunk = Chunk.readFrom(is, null);
-            if (chunk instanceof FileChunk) {
-                FileChunk fileChunk = (FileChunk) chunk;
+            if (chunk instanceof FileChunk fileChunk) {
                 SmafFileFormat sff = new SmafFileFormat(fileChunk.getSize());
                 sff.sequence = new SmafSequence(fileChunk);
                 return sff;
diff --git a/src/main/java/vavi/sound/smaf/SmafMidiConverter.java b/src/main/java/vavi/sound/smaf/SmafMidiConverter.java
index 8b4ebb1..c1b1883 100644
--- a/src/main/java/vavi/sound/smaf/SmafMidiConverter.java
+++ b/src/main/java/vavi/sound/smaf/SmafMidiConverter.java
@@ -40,20 +40,24 @@ class SmafMidiConverter implements SmafDevice {
                             "Version " + SmafDeviceProvider.version) {};
 
     /* */
+    @Override
     public Info getDeviceInfo() {
         return info;
     }
 
     /* */
+    @Override
     public void close() {
     }
 
     /* */
+    @Override
     public boolean isOpen() {
         return true;
     }
 
     /* */
+    @Override
     public void open() {
     }
 
diff --git a/src/main/java/vavi/sound/smaf/SmafSequencer.java b/src/main/java/vavi/sound/smaf/SmafSequencer.java
index b4ac153..1e1ac12 100644
--- a/src/main/java/vavi/sound/smaf/SmafSequencer.java
+++ b/src/main/java/vavi/sound/smaf/SmafSequencer.java
@@ -14,6 +14,7 @@
 import javax.sound.midi.MidiChannel;
 import javax.sound.midi.MidiSystem;
 import javax.sound.midi.MidiUnavailableException;
+import javax.sound.midi.Receiver;
 import javax.sound.midi.Soundbank;
 
 import vavi.sound.midi.MidiUtil;
@@ -60,6 +61,7 @@ public void close() {
         }
         midiSequencer.close();
         midiSynthesizer.close();
+        off();
     }
 
     @Override
@@ -161,11 +163,13 @@ private void off() {
     private MetaSupport metaSupport = new MetaSupport();
 
     /* {@link MetaEventListener} を登録します。 */
+    @Override
     public void addMetaEventListener(MetaEventListener l) {
         metaSupport.addMetaEventListener(l);
     }
 
     /* {@link MetaEventListener} を削除します。 */
+    @Override
     public void removeMetaEventListener(MetaEventListener l) {
         metaSupport.removeMetaEventListener(l);
     }
@@ -177,7 +181,7 @@ protected void fireMeta(MetaMessage meta) {
 
     /** meta 0x2f listener */
     private javax.sound.midi.MetaEventListener mel = new javax.sound.midi.MetaEventListener() {
-        /** */
+        @Override
         public void meta(javax.sound.midi.MetaMessage message) {
 //Debug.println("type: " + message.getType());
             switch (message.getType()) {
@@ -201,39 +205,34 @@ public void meta(javax.sound.midi.MetaMessage message) {
 
     // synthesizer
 
-    /* @see vavi.sound.smaf.Synthesizer#getChannels() */
     @Override
-    public MidiChannel[] getChannels() throws SmafUnavailableException {
-        return midiSynthesizer.getChannels(); // TODO MFiChannel?
+    public MidiChannel[] getChannels() {
+        return midiSynthesizer.getChannels(); // TODO SmafChannel?
     }
 
-    /* @see vavi.sound.smaf.Synthesizer#loadAllInstruments(javax.sound.midi.Soundbank) */
     @Override
     public boolean loadAllInstruments(Soundbank soundbank) {
         return midiSynthesizer.loadAllInstruments(soundbank);
     }
 
-    /* @see vavi.sound.smaf.Synthesizer#getAvailableInstruments() */
     @Override
     public Instrument[] getAvailableInstruments() {
         return midiSynthesizer.getAvailableInstruments();
     }
 
-    /* @see vavi.sound.smaf.Synthesizer#getDefaultSoundbank() */
     @Override
     public Soundbank getDefaultSoundbank() {
         return midiSynthesizer.getDefaultSoundbank();
     }
 
-    /* @see vavi.sound.smaf.Synthesizer#unloadAllInstruments(javax.sound.midi.Soundbank) */
     @Override
     public void unloadAllInstruments(Soundbank soundbank) {
         midiSynthesizer.unloadAllInstruments(soundbank);
     }
 
-    /* */
-    protected void finalize() {
-        off();
+    @Override
+    public Receiver getReceiver() throws MidiUnavailableException {
+        return midiSynthesizer.getReceiver();
     }
 }
 
diff --git a/src/main/java/vavi/sound/smaf/Synthesizer.java b/src/main/java/vavi/sound/smaf/Synthesizer.java
index 7aa3b27..ee985b9 100644
--- a/src/main/java/vavi/sound/smaf/Synthesizer.java
+++ b/src/main/java/vavi/sound/smaf/Synthesizer.java
@@ -8,6 +8,8 @@
 
 import javax.sound.midi.Instrument;
 import javax.sound.midi.MidiChannel;
+import javax.sound.midi.MidiUnavailableException;
+import javax.sound.midi.Receiver;
 import javax.sound.midi.Soundbank;
 
 
@@ -22,20 +24,23 @@
  */
 public interface Synthesizer extends SmafDevice {
 
-    /** for volume controle */
-    MidiChannel[] getChannels() throws SmafUnavailableException;
+    /** @see javax.sound.midi.Synthesizer#getChannels() */
+    MidiChannel[] getChannels();
 
-    /** */
+    /** @see javax.sound.midi.Synthesizer#getDefaultSoundbank() */
     Soundbank getDefaultSoundbank();
 
-    /** */
+    /** @see javax.sound.midi.Synthesizer#getAvailableInstruments() */
     Instrument[] getAvailableInstruments();
 
-    /** */
+    /** @see javax.sound.midi.Synthesizer#getChannels() */
     boolean loadAllInstruments(Soundbank soundbank);
 
-    /** */
+    /** @see javax.sound.midi.Synthesizer#unloadAllInstruments(Soundbank) */
     void unloadAllInstruments(Soundbank soundbank);
+
+    /** @see javax.sound.midi.Synthesizer#getReceiver() */
+    Receiver getReceiver() throws MidiUnavailableException;
 }
 
 /* */
diff --git a/src/main/java/vavi/sound/smaf/chunk/AudioSequenceDataChunk.java b/src/main/java/vavi/sound/smaf/chunk/AudioSequenceDataChunk.java
index c26b522..939896b 100644
--- a/src/main/java/vavi/sound/smaf/chunk/AudioSequenceDataChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/AudioSequenceDataChunk.java
@@ -39,6 +39,7 @@ public AudioSequenceDataChunk() {
     }
 
     /** TODO how to get formatType from parent chunk ??? */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent)
         throws InvalidSmafDataException, IOException {
 //Debug.println("available: " + is.available() + ", " + available());
@@ -58,6 +59,7 @@ protected void init(MyDataInputStream dis, Chunk parent)
      * internal use
      * Atsq の場合
      */
+    @Override
     protected SmafMessage getHandyPhoneStandardMessage(int duration, int data, int gateTime) {
         return new WaveMessage(duration, data, gateTime);
     }
diff --git a/src/main/java/vavi/sound/smaf/chunk/BitmapChunk.java b/src/main/java/vavi/sound/smaf/chunk/BitmapChunk.java
index 9cf078a..8ab117d 100644
--- a/src/main/java/vavi/sound/smaf/chunk/BitmapChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/BitmapChunk.java
@@ -37,12 +37,14 @@ public BitmapChunk() {
     }
 
     /**  */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent)
         throws InvalidSmafDataException, IOException {
 dis.skipBytes((int) (long) size); // TODO
     }
 
     /** TODO */
+    @Override
     public void writeTo(OutputStream os) throws IOException {
     }
 }
diff --git a/src/main/java/vavi/sound/smaf/chunk/Chunk.java b/src/main/java/vavi/sound/smaf/chunk/Chunk.java
index 7170370..dfe5a02 100644
--- a/src/main/java/vavi/sound/smaf/chunk/Chunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/Chunk.java
@@ -117,8 +117,7 @@ public static Chunk readFrom(InputStream is, Chunk parent)
             }
         } else {
 //Debug.printf(Level.FINE, "crc (calc): %04x, avail: %d, %s, %s", mdis.crc(), mdis.available(), mdis, chunk.getClass().getName());
-            if (chunk instanceof FileChunk) {
-                FileChunk fc = (FileChunk) chunk;
+            if (chunk instanceof FileChunk fc) {
                 if (fc.getCrc() != mdis.crc()) {
 Debug.printf(Level.WARNING, "crc not match expected: %04x, actural: %04x", fc.getCrc(), mdis.crc());
                 }
@@ -141,8 +140,7 @@ protected static class MyDataInputStream extends InputStream implements DataInpu
         static ThreadLocal crc = new ThreadLocal<>();
 
         protected MyDataInputStream(InputStream is, byte[] id, int size) {
-            if (is instanceof MyDataInputStream) {
-                MyDataInputStream mdis = (MyDataInputStream) is;
+            if (is instanceof MyDataInputStream mdis) {
                 this.is = mdis.is;
             } else {
                 this.is = is;
@@ -341,42 +339,42 @@ private static Chunk newInstance(byte[] id, int size)
 
     /** constructors for factory */
     private static final PrefixedPropertiesFactory> chunkFactory =
-        new PrefixedPropertiesFactory>("/vavi/sound/smaf/smaf.properties", keyBase) {
+            new PrefixedPropertiesFactory<>("/vavi/sound/smaf/smaf.properties", keyBase) {
+
+                @Override
+                public Constructor get(byte[] id) {
+                    String type = new String(id);
+                    Debug.printf(Level.FINE, "Chunk ID(read): %s+0x%02x", (Character.isLetterOrDigit(type.charAt(3)) ? type : new String(id, 0, 3)), (int) type.charAt(3));
+
+                    for (String key : instances.keySet()) {
+                        if (key.charAt(3) == '*' && key.substring(0, 3).equals(type.substring(0, 3))) {
+                            return instances.get(key);
+                        } else if (key.equals(type)) {
+                            return instances.get(key);
+                        }
+                    }
 
-        @Override
-        public Constructor get(byte[] id) {
-            String type = new String(id);
-Debug.printf(Level.FINE, "Chunk ID(read): %s+0x%02x", (Character.isLetterOrDigit(type.charAt(3)) ? type : new String(id, 0, 3)), (int) type.charAt(3));
-
-            for (String key : instances.keySet()) {
-                if (key.charAt(3) == '*' && key.substring(0, 3).equals(type.substring(0, 3))) {
-                    return instances.get(key);
-                } else if (key.equals(type)) {
-                    return instances.get(key);
+                    throw new IllegalArgumentException(type);
                 }
-            }
 
-            throw new IllegalArgumentException(type);
-        }
-
-        @Override
-        protected Constructor getStoreValue(String value) {
-            try {
-                @SuppressWarnings("unchecked")
-                Class clazz = (Class) Class.forName(value);
+                @Override
+                protected Constructor getStoreValue(String value) {
+                    try {
+                        @SuppressWarnings("unchecked")
+                        Class clazz = (Class) Class.forName(value);
 //Debug.println("chunk class: " + StringUtil.getClassName(clazz));
-                return clazz.getConstructor(byte[].class, Integer.TYPE);
-            } catch (Exception e) {
-Debug.printStackTrace(e);
-                throw new IllegalStateException(e);
-            }
-        }
+                        return clazz.getConstructor(byte[].class, Integer.TYPE);
+                    } catch (Exception e) {
+                        Debug.printStackTrace(e);
+                        throw new IllegalStateException(e);
+                    }
+                }
 
-        @Override
-        protected String getStoreKey(String key) {
-            return key.substring(keyBase.length());
-        }
-    };
+                @Override
+                protected String getStoreKey(String key) {
+                    return key.substring(keyBase.length());
+                }
+            };
 }
 
 /* */
diff --git a/src/main/java/vavi/sound/smaf/chunk/ColorPaletteDefinitionChunk.java b/src/main/java/vavi/sound/smaf/chunk/ColorPaletteDefinitionChunk.java
index e4a1c1f..834ce6e 100644
--- a/src/main/java/vavi/sound/smaf/chunk/ColorPaletteDefinitionChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/ColorPaletteDefinitionChunk.java
@@ -35,13 +35,13 @@ public ColorPaletteDefinitionChunk() {
         this.size = 0;
     }
 
-    /** */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent)
         throws InvalidSmafDataException, IOException {
 dis.skipBytes((int) (long) size);
     }
 
-    /** */
+    @Override
     public void writeTo(OutputStream os) throws IOException {
         DataOutputStream dos = new DataOutputStream(os);
 
diff --git a/src/main/java/vavi/sound/smaf/chunk/ContentsInfoChunk.java b/src/main/java/vavi/sound/smaf/chunk/ContentsInfoChunk.java
index 4cd978a..e60c78e 100644
--- a/src/main/java/vavi/sound/smaf/chunk/ContentsInfoChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/ContentsInfoChunk.java
@@ -48,7 +48,7 @@ public ContentsInfoChunk() {
         this.size = 5;
     }
 
-    /** */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent)
         throws InvalidSmafDataException, IOException {
 
@@ -76,7 +76,7 @@ protected void init(MyDataInputStream dis, Chunk parent)
         }
     }
 
-    /** */
+    @Override
     public void writeTo(OutputStream os) throws IOException {
         DataOutputStream dos = new DataOutputStream(os);
 
diff --git a/src/main/java/vavi/sound/smaf/chunk/DataChunk.java b/src/main/java/vavi/sound/smaf/chunk/DataChunk.java
index 6382eb2..40e5c60 100644
--- a/src/main/java/vavi/sound/smaf/chunk/DataChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/DataChunk.java
@@ -44,7 +44,7 @@ public DataChunk() {
         this.size = 0;
     }
 
-    /** */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent)
         throws InvalidSmafDataException, IOException {
 
@@ -58,7 +58,7 @@ protected void init(MyDataInputStream dis, Chunk parent)
         dis.skipBytes(dis.available()); // TODO 正常ファイルなら必要なし
     }
 
-    /** */
+    @Override
     public void writeTo(OutputStream os) throws IOException {
         DataOutputStream dos = new DataOutputStream(os);
 
diff --git a/src/main/java/vavi/sound/smaf/chunk/DisplayParameterDefinitionChunk.java b/src/main/java/vavi/sound/smaf/chunk/DisplayParameterDefinitionChunk.java
index fc61ea9..75f95ed 100644
--- a/src/main/java/vavi/sound/smaf/chunk/DisplayParameterDefinitionChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/DisplayParameterDefinitionChunk.java
@@ -40,7 +40,7 @@ public DisplayParameterDefinitionChunk() {
         this.size = 0;
     }
 
-    /** */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent)
         throws InvalidSmafDataException, IOException {
 
@@ -64,7 +64,7 @@ protected void init(MyDataInputStream dis, Chunk parent)
         }
     }
 
-    /** */
+    @Override
     public void writeTo(OutputStream os) throws IOException {
         DataOutputStream dos = new DataOutputStream(os);
 
diff --git a/src/main/java/vavi/sound/smaf/chunk/FileChunk.java b/src/main/java/vavi/sound/smaf/chunk/FileChunk.java
index 5cced57..71ca320 100644
--- a/src/main/java/vavi/sound/smaf/chunk/FileChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/FileChunk.java
@@ -39,7 +39,7 @@ public FileChunk() {
         this.size = 2; // crc
     }
 
-    /** */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent)
         throws InvalidSmafDataException, IOException {
 
@@ -72,7 +72,7 @@ protected void init(MyDataInputStream dis, Chunk parent)
         }
     }
 
-    /** */
+    @Override
     public void writeTo(OutputStream os) throws IOException {
         Crc16OutputStream cos = new Crc16OutputStream(os);
 
@@ -109,7 +109,7 @@ private static class Crc16OutputStream extends FilterOutputStream {
         public Crc16OutputStream(OutputStream out) {
             super(out);
         }
-        /** */
+        @Override
         public void write(int b) throws IOException {
             out.write(b);
             crc16.update((byte) b);
diff --git a/src/main/java/vavi/sound/smaf/chunk/GraphicsSetupDataChunk.java b/src/main/java/vavi/sound/smaf/chunk/GraphicsSetupDataChunk.java
index f7b8a46..2acadd4 100644
--- a/src/main/java/vavi/sound/smaf/chunk/GraphicsSetupDataChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/GraphicsSetupDataChunk.java
@@ -37,7 +37,7 @@ public GraphicsSetupDataChunk() {
         this.size = 0;
     }
 
-    /** */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent) throws InvalidSmafDataException, IOException {
         while (dis.available() > 0) {
             Chunk chunk = readFrom(dis);
@@ -58,7 +58,7 @@ protected void init(MyDataInputStream dis, Chunk parent) throws InvalidSmafDataE
     /** option */
     private Chunk colorPaletteDefinitionChunk;
 
-    /** */
+    @Override
     public void writeTo(OutputStream os) throws IOException {
         DataOutputStream dos = new DataOutputStream(os);
 
diff --git a/src/main/java/vavi/sound/smaf/chunk/GraphicsTrackChunk.java b/src/main/java/vavi/sound/smaf/chunk/GraphicsTrackChunk.java
index d8c141f..ae3b7e3 100644
--- a/src/main/java/vavi/sound/smaf/chunk/GraphicsTrackChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/GraphicsTrackChunk.java
@@ -53,7 +53,7 @@ public GraphicsTrackChunk() {
         this.size = 5;
     }
 
-    /** */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent)
         throws InvalidSmafDataException, IOException {
 //skip(is, size);
@@ -85,7 +85,7 @@ protected void init(MyDataInputStream dis, Chunk parent)
         }
     }
 
-    /** */
+    @Override
     public void writeTo(OutputStream os) throws IOException {
         DataOutputStream dos = new DataOutputStream(os);
 
@@ -170,13 +170,14 @@ public List getSmafEvents() throws InvalidSmafDataException {
     public static class FontDataChunk extends Chunk {
         // "Ge**” :Font Chunk
         // "Gu**” :Unicode Font Chunk
-        /** */
+        @Override
         protected void init(MyDataInputStream dis, Chunk parent)
             throws InvalidSmafDataException, IOException {
 dis.skipBytes((int) (long) size); // TODO
         }
 
         /** TODO */
+        @Override
         public void writeTo(OutputStream os) throws IOException {
         }
     }
diff --git a/src/main/java/vavi/sound/smaf/chunk/GraphicsTrackSequenceDataChunk.java b/src/main/java/vavi/sound/smaf/chunk/GraphicsTrackSequenceDataChunk.java
index a2f912d..78a69ee 100644
--- a/src/main/java/vavi/sound/smaf/chunk/GraphicsTrackSequenceDataChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/GraphicsTrackSequenceDataChunk.java
@@ -51,7 +51,7 @@ public GraphicsTrackSequenceDataChunk() {
         this.size = 0;
     }
 
-    /** */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent)
         throws InvalidSmafDataException, IOException {
 
diff --git a/src/main/java/vavi/sound/smaf/chunk/HuffmanDecodingInputStream.java b/src/main/java/vavi/sound/smaf/chunk/HuffmanDecodingInputStream.java
index b7a30fb..645c1a4 100644
--- a/src/main/java/vavi/sound/smaf/chunk/HuffmanDecodingInputStream.java
+++ b/src/main/java/vavi/sound/smaf/chunk/HuffmanDecodingInputStream.java
@@ -128,7 +128,7 @@ private int readTree(boolean init) throws IOException {
         }
     }
 
-    /** */
+    @Override
     public int read() throws IOException {
         byte[] buf = new byte[1];
         int r = read(buf, 0, 1);
@@ -139,7 +139,7 @@ public int read() throws IOException {
         }
     }
 
-    /** */
+    @Override
     public int read(byte[] b, int offset, int length) throws IOException {
         int position = 0;
         while (position < length) {
diff --git a/src/main/java/vavi/sound/smaf/chunk/ImageChunk.java b/src/main/java/vavi/sound/smaf/chunk/ImageChunk.java
index e3f383f..ea3d499 100644
--- a/src/main/java/vavi/sound/smaf/chunk/ImageChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/ImageChunk.java
@@ -45,7 +45,7 @@ public ImageChunk() {
         this.size = 0;
     }
 
-    /** */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent)
         throws InvalidSmafDataException, IOException {
 
@@ -69,6 +69,7 @@ public BufferedImage getImage() {
     }
 
     /** TODO */
+    @Override
     public void writeTo(OutputStream os) throws IOException {
     }
 }
diff --git a/src/main/java/vavi/sound/smaf/chunk/ImageDataChunk.java b/src/main/java/vavi/sound/smaf/chunk/ImageDataChunk.java
index 0d9f1a0..5b5b516 100644
--- a/src/main/java/vavi/sound/smaf/chunk/ImageDataChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/ImageDataChunk.java
@@ -39,6 +39,7 @@ public ImageDataChunk() {
     }
 
     /**  */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent)
         throws InvalidSmafDataException, IOException {
 
@@ -61,6 +62,7 @@ protected void init(MyDataInputStream dis, Chunk parent)
     private List imageDataChunks = new ArrayList<>();
 
     /** TODO */
+    @Override
     public void writeTo(OutputStream os) throws IOException {
     }
 }
diff --git a/src/main/java/vavi/sound/smaf/chunk/LinkChunk.java b/src/main/java/vavi/sound/smaf/chunk/LinkChunk.java
index ee9ab08..9f18fe6 100644
--- a/src/main/java/vavi/sound/smaf/chunk/LinkChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/LinkChunk.java
@@ -37,12 +37,14 @@ public LinkChunk() {
     }
 
     /**  */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent)
         throws InvalidSmafDataException, IOException {
 dis.skipBytes((int) (long) size); // TODO
     }
 
     /** TODO */
+    @Override
     public void writeTo(OutputStream os) throws IOException {
     }
 }
diff --git a/src/main/java/vavi/sound/smaf/chunk/MasterTrackChunk.java b/src/main/java/vavi/sound/smaf/chunk/MasterTrackChunk.java
index a1142da..096c511 100644
--- a/src/main/java/vavi/sound/smaf/chunk/MasterTrackChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/MasterTrackChunk.java
@@ -32,7 +32,7 @@ public MasterTrackChunk(byte[] id, int size) {
 Debug.println(Level.FINE, "MasterTrack: " + size);
     }
 
-    /** */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent)
         throws InvalidSmafDataException, IOException {
 
@@ -56,7 +56,7 @@ protected void init(MyDataInputStream dis, Chunk parent)
         }
     }
 
-    /** */
+    @Override
     public void writeTo(OutputStream os) throws IOException {
         // TODO
     }
diff --git a/src/main/java/vavi/sound/smaf/chunk/MasterTrackSequenceDataChunk.java b/src/main/java/vavi/sound/smaf/chunk/MasterTrackSequenceDataChunk.java
index 4937cdf..fd12151 100644
--- a/src/main/java/vavi/sound/smaf/chunk/MasterTrackSequenceDataChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/MasterTrackSequenceDataChunk.java
@@ -30,6 +30,7 @@ public MasterTrackSequenceDataChunk(byte[] id, int size) {
     }
 
     /** TODO how to get formatType from parent chunk ??? */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent)
         throws InvalidSmafDataException, IOException {
 dis.skipBytes((int) (long) size); // TODO
diff --git a/src/main/java/vavi/sound/smaf/chunk/OptionalDataChunk.java b/src/main/java/vavi/sound/smaf/chunk/OptionalDataChunk.java
index f780c7a..7b4af89 100644
--- a/src/main/java/vavi/sound/smaf/chunk/OptionalDataChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/OptionalDataChunk.java
@@ -39,7 +39,7 @@ public OptionalDataChunk() {
         this.size = 0;
     }
 
-    /** */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent)
         throws InvalidSmafDataException, IOException {
 
@@ -50,7 +50,7 @@ protected void init(MyDataInputStream dis, Chunk parent)
         }
     }
 
-    /** */
+    @Override
     public void writeTo(OutputStream os) throws IOException {
         DataOutputStream dos = new DataOutputStream(os);
 
diff --git a/src/main/java/vavi/sound/smaf/chunk/PcmAudioTrackChunk.java b/src/main/java/vavi/sound/smaf/chunk/PcmAudioTrackChunk.java
index d39b5d4..aefc33c 100644
--- a/src/main/java/vavi/sound/smaf/chunk/PcmAudioTrackChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/PcmAudioTrackChunk.java
@@ -47,7 +47,7 @@ public PcmAudioTrackChunk() {
         this.size = 6;
     }
 
-    /** */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent)
         throws InvalidSmafDataException, IOException {
 //skip(is, size);
@@ -81,7 +81,7 @@ protected void init(MyDataInputStream dis, Chunk parent)
         }
     }
 
-    /** */
+    @Override
     public void writeTo(OutputStream os) throws IOException {
         DataOutputStream dos = new DataOutputStream(os);
 
diff --git a/src/main/java/vavi/sound/smaf/chunk/ScoreTrackChunk.java b/src/main/java/vavi/sound/smaf/chunk/ScoreTrackChunk.java
index 159ccb4..72f2f14 100644
--- a/src/main/java/vavi/sound/smaf/chunk/ScoreTrackChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/ScoreTrackChunk.java
@@ -55,7 +55,7 @@ public ScoreTrackChunk() {
         this.size = 4;
     }
 
-    /** */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent)
         throws InvalidSmafDataException, IOException {
 
@@ -113,7 +113,7 @@ protected void init(MyDataInputStream dis, Chunk parent)
         }
     }
 
-    /** */
+    @Override
     public void writeTo(OutputStream os) throws IOException {
         DataOutputStream dos = new DataOutputStream(os);
 
diff --git a/src/main/java/vavi/sound/smaf/chunk/SeekAndPhraseInfoChunk.java b/src/main/java/vavi/sound/smaf/chunk/SeekAndPhraseInfoChunk.java
index 9e6de26..b4820f5 100644
--- a/src/main/java/vavi/sound/smaf/chunk/SeekAndPhraseInfoChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/SeekAndPhraseInfoChunk.java
@@ -41,7 +41,7 @@ public SeekAndPhraseInfoChunk() {
         this.size = 0;
     }
 
-    /** */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent)
         throws InvalidSmafDataException, IOException {
 
@@ -60,7 +60,7 @@ protected void init(MyDataInputStream dis, Chunk parent)
         }
     }
 
-    /** */
+    @Override
     public void writeTo(OutputStream os) throws IOException {
         DataOutputStream dos = new DataOutputStream(os);
 
@@ -107,7 +107,7 @@ private void addSubData(String tag, SubData subDatum) {
         size += subDatum.getSize();
     }
 
-    /** */
+//    /** */
 //    private static final String[] TAG_Phrase = {
 //        "Pa", "Pb", "Pc", "Pd", "Pe", "Pf", "Pg",
 //        "Ph", "Pi", "Pj", "Pk", "Pl", "Pm", "Pn",
@@ -121,7 +121,7 @@ public List getPhraseList() {
         return null;
     }
 
-    /** [a-zABEIKSR]+ */
+//    /** [a-zABEIKSR]+ */
 //    private static final String TAG_SubSequence = "SL";
 
     /** TODO List */
diff --git a/src/main/java/vavi/sound/smaf/chunk/SequenceDataChunk.java b/src/main/java/vavi/sound/smaf/chunk/SequenceDataChunk.java
index 07b1fe6..0c52861 100644
--- a/src/main/java/vavi/sound/smaf/chunk/SequenceDataChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/SequenceDataChunk.java
@@ -62,6 +62,7 @@ public SequenceDataChunk() {
     }
 
     /** TODO how to get formatType from parent chunk ??? */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent)
         throws InvalidSmafDataException, IOException {
 //Debug.println("available: " + is.available() + ", " + available());
@@ -355,7 +356,7 @@ private void readMobileStandard(MyDataInputStream dis)
         }
     }
 
-    /** */
+    @Override
     public void writeTo(OutputStream os) throws IOException {
         DataOutputStream dos = new DataOutputStream(os);
 
diff --git a/src/main/java/vavi/sound/smaf/chunk/SetupDataChunk.java b/src/main/java/vavi/sound/smaf/chunk/SetupDataChunk.java
index 0e8d1c7..0c9f072 100644
--- a/src/main/java/vavi/sound/smaf/chunk/SetupDataChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/SetupDataChunk.java
@@ -43,7 +43,7 @@ public SetupDataChunk() {
         this.size = 0;
     }
 
-    /** */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent) throws InvalidSmafDataException, IOException {
 
         ScoreTrackChunk.FormatType formatType = ((ScoreTrackChunk) parent).getFormatType();
@@ -136,6 +136,7 @@ private void readMobileStandard(MyDataInputStream dis) throws InvalidSmafDataExc
     }
 
     /** TODO formatType */
+    @Override
     public void writeTo(OutputStream os) throws IOException {
         DataOutputStream dos = new DataOutputStream(os);
 
diff --git a/src/main/java/vavi/sound/smaf/chunk/StreamPcmDataChunk.java b/src/main/java/vavi/sound/smaf/chunk/StreamPcmDataChunk.java
index 43c10bf..931f562 100644
--- a/src/main/java/vavi/sound/smaf/chunk/StreamPcmDataChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/StreamPcmDataChunk.java
@@ -41,7 +41,7 @@ public StreamPcmDataChunk() {
         this.size = 0;
     }
 
-    /** */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent) throws InvalidSmafDataException, IOException {
         while (dis.available() > 0) {
             Chunk chunk = readFrom(dis);
@@ -53,7 +53,7 @@ protected void init(MyDataInputStream dis, Chunk parent) throws InvalidSmafDataE
         }
     }
 
-    /** */
+    @Override
     public void writeTo(OutputStream os) throws IOException {
         DataOutputStream dos = new DataOutputStream(os);
 
diff --git a/src/main/java/vavi/sound/smaf/chunk/StreamWaveDataChunk.java b/src/main/java/vavi/sound/smaf/chunk/StreamWaveDataChunk.java
index 1abcdff..8b693bf 100644
--- a/src/main/java/vavi/sound/smaf/chunk/StreamWaveDataChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/StreamWaveDataChunk.java
@@ -37,7 +37,7 @@ public StreamWaveDataChunk() {
         size = 0;
     }
 
-    /** */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent) throws InvalidSmafDataException, IOException {
         byte[] weveTypeBytes = new byte[3];
         dis.readFully(weveTypeBytes);
diff --git a/src/main/java/vavi/sound/smaf/chunk/UndefinedChunk.java b/src/main/java/vavi/sound/smaf/chunk/UndefinedChunk.java
index 22c275e..30ed1d2 100644
--- a/src/main/java/vavi/sound/smaf/chunk/UndefinedChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/UndefinedChunk.java
@@ -29,7 +29,7 @@ public UndefinedChunk(byte[] id, int size) {
 //new Exception("*** DUMMY ***").printStackTrace(System.err);
     }
 
-    /** */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent)
         throws InvalidSmafDataException, IOException {
 
@@ -43,7 +43,7 @@ protected void init(MyDataInputStream dis, Chunk parent)
 Debug.println(Level.WARNING, "Undefined: size: " + size + "\n" + StringUtil.getDump(data, 64));
     }
 
-    /** */
+    @Override
     public void writeTo(OutputStream os) throws IOException {
         // TODO
 Debug.println(Level.WARNING, "not implemented skip");
diff --git a/src/main/java/vavi/sound/smaf/chunk/WaveDataChunk.java b/src/main/java/vavi/sound/smaf/chunk/WaveDataChunk.java
index 36673f7..6232b24 100644
--- a/src/main/java/vavi/sound/smaf/chunk/WaveDataChunk.java
+++ b/src/main/java/vavi/sound/smaf/chunk/WaveDataChunk.java
@@ -41,13 +41,13 @@ public WaveDataChunk() {
         size = 0;
     }
 
-    /** */
+    @Override
     protected void init(MyDataInputStream dis, Chunk parent) throws InvalidSmafDataException, IOException {
         data = new byte[size];
         dis.readFully(data);
     }
 
-    /** */
+    @Override
     public void writeTo(OutputStream os) throws IOException {
         DataOutputStream dos = new DataOutputStream(os);
 
diff --git a/src/main/java/vavi/sound/smaf/message/BankSelectMessage.java b/src/main/java/vavi/sound/smaf/message/BankSelectMessage.java
index 0bedc4b..9976237 100644
--- a/src/main/java/vavi/sound/smaf/message/BankSelectMessage.java
+++ b/src/main/java/vavi/sound/smaf/message/BankSelectMessage.java
@@ -109,16 +109,18 @@ public String toString() {
     //----
 
     /* */
+    @Override
     public byte[] getMessage() {
         return null; // TODO
     }
 
     /* */
+    @Override
     public int getLength() {
         return 0;   // TODO
     }
 
-    /** */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context)
         throws InvalidMidiDataException {
 
@@ -172,6 +174,7 @@ public MidiEvent[] getMidiEvents(MidiContext context)
     }
 
     /** TODO */
+    @Override
     public SmafEvent[] getSmafEvents(MidiEvent midiEvent, SmafContext context)
         throws InvalidSmafDataException {
 
diff --git a/src/main/java/vavi/sound/smaf/message/EndOfSequenceMessage.java b/src/main/java/vavi/sound/smaf/message/EndOfSequenceMessage.java
index 3c34fe4..c352bfe 100644
--- a/src/main/java/vavi/sound/smaf/message/EndOfSequenceMessage.java
+++ b/src/main/java/vavi/sound/smaf/message/EndOfSequenceMessage.java
@@ -51,6 +51,7 @@ public String toString() {
     //----
 
     /* */
+    @Override
     public byte[] getMessage() {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         FormatType formatType = FormatType.HandyPhoneStandard; // TODO
@@ -75,11 +76,13 @@ public byte[] getMessage() {
     }
 
     /* */
+    @Override
     public int getLength() {
         return getMessage().length;
     }
 
     /** NOP 等の対策で EOT の tick をカウントしたものに設定する。 */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context) {
         javax.sound.midi.Track midiTrack = context.getMidiTrack();
         MidiEvent midiEvent = midiTrack.get(midiTrack.size() - 1); // should be EoT
@@ -93,6 +96,7 @@ public MidiEvent[] getMidiEvents(MidiContext context) {
      * @return このメソッドの戻り値のみ SMAF トラック 0 ~ 3 の EndOfSequenceMessage の
      * SmafEvent になる。トラックがない場合は null が入っている
      */
+    @Override
     public SmafEvent[] getSmafEvents(MidiEvent midiEvent, SmafContext context) {
 
         SmafEvent[] smafEvents = new SmafEvent[SmafContext.MAX_SMAF_TRACKS];
diff --git a/src/main/java/vavi/sound/smaf/message/ExpressionMessage.java b/src/main/java/vavi/sound/smaf/message/ExpressionMessage.java
index ff2d900..459a10a 100644
--- a/src/main/java/vavi/sound/smaf/message/ExpressionMessage.java
+++ b/src/main/java/vavi/sound/smaf/message/ExpressionMessage.java
@@ -76,16 +76,18 @@ public String toString() {
     //----
 
     /* */
+    @Override
     public byte[] getMessage() {
         return null; // TODO
     }
 
     /* */
+    @Override
     public int getLength() {
         return 0;   // TODO
     }
 
-    /** */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context)
         throws InvalidMidiDataException {
 
@@ -102,7 +104,7 @@ public MidiEvent[] getMidiEvents(MidiContext context)
         return events;
     }
 
-    /** */
+    @Override
     public SmafEvent[] getSmafEvents(MidiEvent midiEvent, SmafContext context)
         throws InvalidSmafDataException {
 
diff --git a/src/main/java/vavi/sound/smaf/message/MidiContext.java b/src/main/java/vavi/sound/smaf/message/MidiContext.java
index 7b381b2..47b45cc 100644
--- a/src/main/java/vavi/sound/smaf/message/MidiContext.java
+++ b/src/main/java/vavi/sound/smaf/message/MidiContext.java
@@ -68,8 +68,7 @@ public void setTrack(Track smafTrack) {
         for (int j = 0; j < smafTrack.size(); j++) {
             SmafEvent event = smafTrack.get(j);
             SmafMessage message = event.getMessage();
-            if (message instanceof vavi.sound.smaf.MetaMessage) {
-                vavi.sound.smaf.MetaMessage metaMessage = (vavi.sound.smaf.MetaMessage) message;
+            if (message instanceof vavi.sound.smaf.MetaMessage metaMessage) {
                 if (metaMessage.getType() == MetaEvent.META_MACHINE_DEPEND.number()) {
                     //
                     this.formatType = (FormatType) metaMessage.getData().get("formatType"); // [ms]
@@ -536,8 +535,7 @@ public int getResolution(Track[] smafTracks)
             for (int i = 0; i < track.size(); i++) {
                 SmafEvent event = track.get(i);
                 SmafMessage message = event.getMessage();
-                if (message instanceof vavi.sound.smaf.MetaMessage) {
-                    vavi.sound.smaf.MetaMessage metaMessage = (vavi.sound.smaf.MetaMessage) message;
+                if (message instanceof vavi.sound.smaf.MetaMessage metaMessage) {
                     if (metaMessage.getType() == MetaEvent.META_MACHINE_DEPEND.number()) {
                         this.timeBase = (Integer) metaMessage.getData().get("durationTimeBase"); // [ms]
 Debug.println(Level.FINE, "timebase: " + timeBase + ", (" + t + ":" + i + ")");
diff --git a/src/main/java/vavi/sound/smaf/message/MidiConvertibleMessage.java b/src/main/java/vavi/sound/smaf/message/MidiConvertibleMessage.java
index e2c8853..80c95c8 100644
--- a/src/main/java/vavi/sound/smaf/message/MidiConvertibleMessage.java
+++ b/src/main/java/vavi/sound/smaf/message/MidiConvertibleMessage.java
@@ -78,16 +78,18 @@ public String toString() {
     //----
 
     /* */
+    @Override
     public byte[] getMessage() {
         return null; // TODO
     }
 
     /* */
+    @Override
     public int getLength() {
         return 0;   // TODO
     }
 
-    /** */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context) throws InvalidMidiDataException {
         int midiChannel = context.retrieveChannel(this.channel);
 
diff --git a/src/main/java/vavi/sound/smaf/message/ModulationMessage.java b/src/main/java/vavi/sound/smaf/message/ModulationMessage.java
index be6408e..f3a085c 100644
--- a/src/main/java/vavi/sound/smaf/message/ModulationMessage.java
+++ b/src/main/java/vavi/sound/smaf/message/ModulationMessage.java
@@ -76,16 +76,18 @@ public String toString() {
     //----
 
     /* */
+    @Override
     public byte[] getMessage() {
         return null; // TODO
     }
 
     /* */
+    @Override
     public int getLength() {
         return 0;   // TODO
     }
 
-    /** */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context)
         throws InvalidMidiDataException {
 
@@ -101,7 +103,7 @@ public MidiEvent[] getMidiEvents(MidiContext context)
         return events;
     }
 
-    /** */
+    @Override
     public SmafEvent[] getSmafEvents(MidiEvent midiEvent, SmafContext context)
         throws InvalidSmafDataException {
 
diff --git a/src/main/java/vavi/sound/smaf/message/NopMessage.java b/src/main/java/vavi/sound/smaf/message/NopMessage.java
index 06aa7af..4a4035a 100644
--- a/src/main/java/vavi/sound/smaf/message/NopMessage.java
+++ b/src/main/java/vavi/sound/smaf/message/NopMessage.java
@@ -51,6 +51,7 @@ public String toString() {
     //----
 
     /* */
+    @Override
     public byte[] getMessage() {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         FormatType formatType = FormatType.HandyPhoneStandard; // TODO
@@ -74,11 +75,12 @@ public byte[] getMessage() {
     }
 
     /* */
+    @Override
     public int getLength() {
         return getMessage().length;
     }
 
-    /** */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context) {
         return null;
     }
diff --git a/src/main/java/vavi/sound/smaf/message/NoteMessage.java b/src/main/java/vavi/sound/smaf/message/NoteMessage.java
index eeeaf01..b2168e6 100644
--- a/src/main/java/vavi/sound/smaf/message/NoteMessage.java
+++ b/src/main/java/vavi/sound/smaf/message/NoteMessage.java
@@ -212,7 +212,7 @@ public int getLength() {
 
 private static int uc = 0;
 
-    /** */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context)
         throws InvalidMidiDataException {
 
diff --git a/src/main/java/vavi/sound/smaf/message/OctaveShiftMessage.java b/src/main/java/vavi/sound/smaf/message/OctaveShiftMessage.java
index 9642d79..4302c06 100644
--- a/src/main/java/vavi/sound/smaf/message/OctaveShiftMessage.java
+++ b/src/main/java/vavi/sound/smaf/message/OctaveShiftMessage.java
@@ -74,16 +74,19 @@ public String toString() {
     //----
 
     /* */
+    @Override
     public byte[] getMessage() {
         return null; // TODO
     }
 
     /* */
+    @Override
     public int getLength() {
         return 0;   // TODO
     }
 
     /** Modify context. */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context) {
         context.setOctaveShift(channel, octaveShift);
 
diff --git a/src/main/java/vavi/sound/smaf/message/PanMessage.java b/src/main/java/vavi/sound/smaf/message/PanMessage.java
index d611d89..31dc0e8 100644
--- a/src/main/java/vavi/sound/smaf/message/PanMessage.java
+++ b/src/main/java/vavi/sound/smaf/message/PanMessage.java
@@ -76,16 +76,18 @@ public String toString() {
     //----
 
     /* */
+    @Override
     public byte[] getMessage() {
         return null; // TODO
     }
 
     /* */
+    @Override
     public int getLength() {
         return 0;   // TODO
     }
 
-    /** */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context)
         throws InvalidMidiDataException {
 
@@ -101,7 +103,7 @@ public MidiEvent[] getMidiEvents(MidiContext context)
         return events;
     }
 
-    /** */
+    @Override
     public SmafEvent[] getSmafEvents(MidiEvent midiEvent, SmafContext context)
         throws InvalidSmafDataException {
 
diff --git a/src/main/java/vavi/sound/smaf/message/PitchBendMessage.java b/src/main/java/vavi/sound/smaf/message/PitchBendMessage.java
index a232776..6b3cf01 100644
--- a/src/main/java/vavi/sound/smaf/message/PitchBendMessage.java
+++ b/src/main/java/vavi/sound/smaf/message/PitchBendMessage.java
@@ -77,11 +77,13 @@ public String toString() {
     //----
 
     /* */
+    @Override
     public byte[] getMessage() {
         return null; // TODO
     }
 
     /* */
+    @Override
     public int getLength() {
         return 0;   // TODO
     }
@@ -89,6 +91,7 @@ public int getLength() {
     /**
      * PsmPlayer がこう変換していたからしょうがない。
      */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context)
         throws InvalidMidiDataException {
 
@@ -104,7 +107,7 @@ public MidiEvent[] getMidiEvents(MidiContext context)
         };
     }
 
-    /** */
+    @Override
     public SmafEvent[] getSmafEvents(MidiEvent midiEvent, SmafContext context)
         throws InvalidSmafDataException {
 
diff --git a/src/main/java/vavi/sound/smaf/message/ProgramChangeMessage.java b/src/main/java/vavi/sound/smaf/message/ProgramChangeMessage.java
index a966b10..57d7b94 100644
--- a/src/main/java/vavi/sound/smaf/message/ProgramChangeMessage.java
+++ b/src/main/java/vavi/sound/smaf/message/ProgramChangeMessage.java
@@ -78,16 +78,18 @@ public String toString() {
     //----
 
     /* */
+    @Override
     public byte[] getMessage() {
         return null; // TODO
     }
 
     /* */
+    @Override
     public int getLength() {
         return 0;   // TODO
     }
 
-    /** */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context)
         throws InvalidMidiDataException {
 
@@ -112,6 +114,7 @@ public MidiEvent[] getMidiEvents(MidiContext context)
     }
 
     /** TODO */
+    @Override
     public SmafEvent[] getSmafEvents(MidiEvent midiEvent, SmafContext context)
         throws InvalidSmafDataException {
 
diff --git a/src/main/java/vavi/sound/smaf/message/RealtimeUniversalSysexMessage.java b/src/main/java/vavi/sound/smaf/message/RealtimeUniversalSysexMessage.java
index 24da956..911b0a8 100644
--- a/src/main/java/vavi/sound/smaf/message/RealtimeUniversalSysexMessage.java
+++ b/src/main/java/vavi/sound/smaf/message/RealtimeUniversalSysexMessage.java
@@ -64,7 +64,7 @@
  */
 public class RealtimeUniversalSysexMessage extends SysexMessage {
 
-    /**
+    /*
 
 [マスターボリューム]
       F0 7F 7F 04 01 ll mm F7
diff --git a/src/main/java/vavi/sound/smaf/message/STMessage.java b/src/main/java/vavi/sound/smaf/message/STMessage.java
index 38abd57..e1b080c 100644
--- a/src/main/java/vavi/sound/smaf/message/STMessage.java
+++ b/src/main/java/vavi/sound/smaf/message/STMessage.java
@@ -71,6 +71,7 @@ public int getLength() {
     /**
      * @throws InvalidMidiDataException
      */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context) throws InvalidMidiDataException {
         byte[] data;
         try {
diff --git a/src/main/java/vavi/sound/smaf/message/SmafContext.java b/src/main/java/vavi/sound/smaf/message/SmafContext.java
index 24214e5..80f54de 100644
--- a/src/main/java/vavi/sound/smaf/message/SmafContext.java
+++ b/src/main/java/vavi/sound/smaf/message/SmafContext.java
@@ -196,9 +196,8 @@ public SmafEvent[] getIntervalSmafEvents() {
         MidiEvent midiEvent = midiTrack.get(midiEventIndex);
 
         MidiMessage midiMessage = midiEvent.getMessage();
-        if (midiMessage instanceof ShortMessage) {
+        if (midiMessage instanceof ShortMessage shortMessage) {
             // note
-            ShortMessage shortMessage = (ShortMessage) midiMessage;
             int channel = shortMessage.getChannel();
 
             track = retrieveSmafTrack(channel);
@@ -254,9 +253,8 @@ public int getDuration() {
         MidiEvent midiEvent = midiTrack.get(midiEventIndex);
 
         MidiMessage midiMessage = midiEvent.getMessage();
-        if (midiMessage instanceof ShortMessage) {
+        if (midiMessage instanceof ShortMessage shortMessage) {
             // note
-            ShortMessage shortMessage = (ShortMessage) midiMessage;
             int channel = shortMessage.getChannel();
 
             delta = retrieveAdjustedDelta(retrieveSmafTrack(channel), midiEvent.getTick());
@@ -460,6 +458,7 @@ public boolean isNoteOffEventUsed() {
     private int[] nrpnMSB = new int[MidiContext.MAX_MIDI_CHANNELS];
 
     /** bank, rpn, nrpn */
+    @Override
     public SmafEvent[] getSmafEvents(MidiEvent midiEvent, SmafContext context)
         throws InvalidSmafDataException {
 
diff --git a/src/main/java/vavi/sound/smaf/message/VNMessage.java b/src/main/java/vavi/sound/smaf/message/VNMessage.java
index fd6a4bd..9ece407 100644
--- a/src/main/java/vavi/sound/smaf/message/VNMessage.java
+++ b/src/main/java/vavi/sound/smaf/message/VNMessage.java
@@ -71,6 +71,7 @@ public int getLength() {
     /**
      * @throws InvalidMidiDataException
      */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context) throws InvalidMidiDataException {
         byte[] data;
         try {
diff --git a/src/main/java/vavi/sound/smaf/message/VolumeMessage.java b/src/main/java/vavi/sound/smaf/message/VolumeMessage.java
index e9d83b5..c9bfa32 100644
--- a/src/main/java/vavi/sound/smaf/message/VolumeMessage.java
+++ b/src/main/java/vavi/sound/smaf/message/VolumeMessage.java
@@ -90,6 +90,7 @@ public String toString() {
     //----
 
     /* */
+    @Override
     public byte[] getMessage() {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         FormatType formatType = FormatType.HandyPhoneStandard; // TODO
@@ -114,11 +115,12 @@ public byte[] getMessage() {
     }
 
     /* */
+    @Override
     public int getLength() {
         return getMessage().length;
     }
 
-    /** */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context)
         throws InvalidMidiDataException {
 
@@ -145,7 +147,7 @@ public MidiEvent[] getMidiEvents(MidiContext context)
         }
     }
 
-    /** */
+    @Override
     public SmafEvent[] getSmafEvents(MidiEvent midiEvent, SmafContext context)
         throws InvalidSmafDataException {
 
diff --git a/src/main/java/vavi/sound/smaf/message/WaveDataMessage.java b/src/main/java/vavi/sound/smaf/message/WaveDataMessage.java
index 957dc86..6500782 100644
--- a/src/main/java/vavi/sound/smaf/message/WaveDataMessage.java
+++ b/src/main/java/vavi/sound/smaf/message/WaveDataMessage.java
@@ -90,7 +90,7 @@ public int getLength() {
         return data.length;
     }
 
-    /** */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context)
         throws InvalidMidiDataException {
 
@@ -113,6 +113,7 @@ public MidiEvent[] getMidiEvents(MidiContext context)
     }
 
     /* */
+    @Override
     public void sequence() throws InvalidSmafDataException {
 Debug.println(Level.FINE, "WAVE DATA[" + number + "]: " + this);
 //try {
diff --git a/src/main/java/vavi/sound/smaf/message/WaveMessage.java b/src/main/java/vavi/sound/smaf/message/WaveMessage.java
index fecccab..94ef99b 100644
--- a/src/main/java/vavi/sound/smaf/message/WaveMessage.java
+++ b/src/main/java/vavi/sound/smaf/message/WaveMessage.java
@@ -186,6 +186,7 @@ public int getLength() {
      * @see vavi.sound.midi.VaviMidiDeviceProvider#MANUFACTURER_ID
      * @see vavi.sound.smaf.sequencer.WaveSequencer#META_FUNCTION_ID_SMAF
      */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context)
         throws InvalidMidiDataException {
 
@@ -208,6 +209,7 @@ public MidiEvent[] getMidiEvents(MidiContext context)
     }
 
     /* */
+    @Override
     public void sequence() throws InvalidSmafDataException {
 Debug.println(Level.FINE, "WAVE PLAY: " + number);
         AudioEngine engine = Factory.getAudioEngine();
diff --git a/src/main/java/vavi/sound/smaf/message/graphics/BackDropColorDefinitionMessage.java b/src/main/java/vavi/sound/smaf/message/graphics/BackDropColorDefinitionMessage.java
index b86070f..199e9f2 100644
--- a/src/main/java/vavi/sound/smaf/message/graphics/BackDropColorDefinitionMessage.java
+++ b/src/main/java/vavi/sound/smaf/message/graphics/BackDropColorDefinitionMessage.java
@@ -51,6 +51,7 @@ public String toString() {
     //----
 
     /* */
+    @Override
     public byte[] getMessage() {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         FormatType formatType = FormatType.HandyPhoneStandard; // TODO
@@ -74,6 +75,7 @@ public byte[] getMessage() {
     }
 
     /* */
+    @Override
     public int getLength() {
         return getMessage().length;
     }
diff --git a/src/main/java/vavi/sound/smaf/message/graphics/GeneralPurposeDisplayMessage.java b/src/main/java/vavi/sound/smaf/message/graphics/GeneralPurposeDisplayMessage.java
index bd29b33..137f1aa 100644
--- a/src/main/java/vavi/sound/smaf/message/graphics/GeneralPurposeDisplayMessage.java
+++ b/src/main/java/vavi/sound/smaf/message/graphics/GeneralPurposeDisplayMessage.java
@@ -67,6 +67,7 @@ enum SubBlockType {
     //----
 
     /* */
+    @Override
     public byte[] getMessage() {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         FormatType formatType = FormatType.HandyPhoneStandard; // TODO
@@ -93,6 +94,7 @@ public byte[] getMessage() {
     }
 
     /* */
+    @Override
     public int getLength() {
         return getMessage().length;
     }
diff --git a/src/main/java/vavi/sound/smaf/message/graphics/NopMessage.java b/src/main/java/vavi/sound/smaf/message/graphics/NopMessage.java
index 8163a14..abc3bd2 100644
--- a/src/main/java/vavi/sound/smaf/message/graphics/NopMessage.java
+++ b/src/main/java/vavi/sound/smaf/message/graphics/NopMessage.java
@@ -45,6 +45,7 @@ public String toString() {
     //----
 
     /* */
+    @Override
     public byte[] getMessage() {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         FormatType formatType = FormatType.HandyPhoneStandard; // TODO
@@ -66,6 +67,7 @@ public byte[] getMessage() {
     }
 
     /* */
+    @Override
     public int getLength() {
         return getMessage().length;
     }
diff --git a/src/main/java/vavi/sound/smaf/message/graphics/OffsetOriginMessage.java b/src/main/java/vavi/sound/smaf/message/graphics/OffsetOriginMessage.java
index ccda283..fd16b91 100644
--- a/src/main/java/vavi/sound/smaf/message/graphics/OffsetOriginMessage.java
+++ b/src/main/java/vavi/sound/smaf/message/graphics/OffsetOriginMessage.java
@@ -47,6 +47,7 @@ public String toString() {
     //----
 
     /* */
+    @Override
     public byte[] getMessage() {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         FormatType formatType = FormatType.HandyPhoneStandard; // TODO
@@ -69,6 +70,7 @@ public byte[] getMessage() {
     }
 
     /* */
+    @Override
     public int getLength() {
         return getMessage().length;
     }
diff --git a/src/main/java/vavi/sound/smaf/message/graphics/ResetOrigneMessage.java b/src/main/java/vavi/sound/smaf/message/graphics/ResetOrigneMessage.java
index 81ef9b9..9ad7a95 100644
--- a/src/main/java/vavi/sound/smaf/message/graphics/ResetOrigneMessage.java
+++ b/src/main/java/vavi/sound/smaf/message/graphics/ResetOrigneMessage.java
@@ -44,6 +44,7 @@ public String toString() {
     //----
 
     /* */
+    @Override
     public byte[] getMessage() {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         FormatType formatType = FormatType.HandyPhoneStandard; // TODO
@@ -65,6 +66,7 @@ public byte[] getMessage() {
     }
 
     /* */
+    @Override
     public int getLength() {
         return getMessage().length;
     }
diff --git a/src/main/java/vavi/sound/smaf/message/graphics/UserMessage.java b/src/main/java/vavi/sound/smaf/message/graphics/UserMessage.java
index f8c7b64..f97a454 100644
--- a/src/main/java/vavi/sound/smaf/message/graphics/UserMessage.java
+++ b/src/main/java/vavi/sound/smaf/message/graphics/UserMessage.java
@@ -52,6 +52,7 @@ public String toString() {
     //----
 
     /* */
+    @Override
     public byte[] getMessage() {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         FormatType formatType = FormatType.HandyPhoneStandard; // TODO
@@ -75,6 +76,7 @@ public byte[] getMessage() {
     }
 
     /* */
+    @Override
     public int getLength() {
         return getMessage().length;
     }
diff --git a/src/main/java/vavi/sound/smaf/message/yamaha/YamahaMessage.java b/src/main/java/vavi/sound/smaf/message/yamaha/YamahaMessage.java
index 5ac9fec..c561db3 100644
--- a/src/main/java/vavi/sound/smaf/message/yamaha/YamahaMessage.java
+++ b/src/main/java/vavi/sound/smaf/message/yamaha/YamahaMessage.java
@@ -128,6 +128,7 @@ public class YamahaMessage extends MachineDependentMessage
      * @see "ATS-MA5-SMAF_GL_133_HV.pdf"
      * @see "http://murachue.ddo.jp/web/softlist.cgi?mode=desc&title=mmftool"
      */
+    @Override
     public MidiEvent[] getMidiEvents(MidiContext context) throws InvalidMidiDataException {
 
 //        MidiEvent[] events = new MidiEvent[1];
@@ -159,6 +160,7 @@ public MidiEvent[] getMidiEvents(MidiContext context) throws InvalidMidiDataExce
     }
 
     /* TODO 今、超適当 */
+    @Override
     public void sequence() throws InvalidSmafDataException {
 Debug.println(Level.INFO, "yamaha: " + data.length + "\n" + StringUtil.getDump(data, 64));
         switch (data[1]) {
diff --git a/src/test/java/PlayLine.java b/src/test/java/PlayLine.java
index af83d93..b99b670 100644
--- a/src/test/java/PlayLine.java
+++ b/src/test/java/PlayLine.java
@@ -25,6 +25,8 @@
  */
 public class PlayLine {
 
+    static final double volume = Double.parseDouble(System.getProperty("vavi.test.volume",  "0.2"));
+
     /**
      * usage: java PlayLine file ...
      */
@@ -54,7 +56,7 @@ void play(String filename) throws Exception {
                 System.exit(0);
             }
         });
-        volume(line, .2d);
+        volume(line, volume);
         line.start();
         byte[] buf = new byte[line.getBufferSize()];
         int l;
diff --git a/src/test/java/PlayMFi.java b/src/test/java/PlayMFi.java
index 4a2618e..897384a 100644
--- a/src/test/java/PlayMFi.java
+++ b/src/test/java/PlayMFi.java
@@ -5,16 +5,22 @@
  */
 
 import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Paths;
 import java.util.concurrent.CountDownLatch;
-import javax.sound.midi.MidiChannel;
+
 import javax.sound.midi.MidiSystem;
 import javax.sound.midi.Soundbank;
 
+import org.junit.jupiter.api.BeforeEach;
 import vavi.sound.mfi.MetaEventListener;
 import vavi.sound.mfi.MfiSystem;
 import vavi.sound.mfi.Sequence;
 import vavi.sound.mfi.Sequencer;
 import vavi.sound.mfi.Synthesizer;
+import vavi.sound.midi.MidiUtil;
+import vavi.util.properties.annotation.Property;
+import vavi.util.properties.annotation.PropsEntity;
 
 
 /**
@@ -23,6 +29,7 @@
  * @author Naohide Sano (nsano)
  * @version 0.00 090913 nsano initial version 
*/ +@PropsEntity(url = "file:local.properties") public class PlayMFi { /** @@ -30,28 +37,35 @@ public class PlayMFi { * @param args mfi files ... */ public static void main(String[] args) throws Exception { + PlayMFi app = new PlayMFi(); + PropsEntity.Util.bind(app); + app.exec(args); + } + + static final float volume = Float.parseFloat(System.getProperty("vavi.test.volume", "0.2")); + + @Property(name = "sf2") + String sf2 = System.getProperty("user.home") + "/Library/Audio/Sounds/Banks/Orchestra/default.sf2"; + + /** */ + void exec(String[] args) throws Exception { Sequencer sequencer = MfiSystem.getSequencer(); sequencer.open(); Synthesizer synthesizer = (Synthesizer) sequencer; // sf -Soundbank soundbank = synthesizer.getDefaultSoundbank(); +File file = new File(sf2); + if (file.exists()) { + Soundbank soundbank = synthesizer.getDefaultSoundbank(); //Instrument[] instruments = synthesizer.getAvailableInstruments(); -System.err.println("---- " + soundbank.getDescription() + " ----"); + System.err.println("---- " + soundbank.getDescription() + " ----"); //Arrays.asList(instruments).forEach(System.err::println); -synthesizer.unloadAllInstruments(soundbank); -File file = new File("/Users/nsano/lib/audio/sf2/SGM-V2.01.sf2"); -soundbank = MidiSystem.getSoundbank(file); -synthesizer.loadAllInstruments(soundbank); + synthesizer.unloadAllInstruments(soundbank); + soundbank = MidiSystem.getSoundbank(file); + synthesizer.loadAllInstruments(soundbank); //instruments = synthesizer.getAvailableInstruments(); -System.err.println("---- " + soundbank.getDescription() + " ----"); + System.err.println("---- " + soundbank.getDescription() + " ----"); //Arrays.asList(instruments).forEach(System.err::println); -// volume (not work ???) -MidiChannel[] channels = synthesizer.getChannels(); -double gain = 0.02d; -for (MidiChannel channel : channels) { - channel.controlChange(7, (int) (gain * 127.0)); } - for (String arg : args) { System.err.println("START: " + arg); CountDownLatch countDownLatch = new CountDownLatch(1); @@ -65,6 +79,7 @@ public static void main(String[] args) throws Exception { sequencer.setSequence(sequence); sequencer.addMetaEventListener(mel); sequencer.start(); +MidiUtil.volume(synthesizer.getReceiver(), volume); countDownLatch.await(); System.err.println("END: " + arg); sequencer.removeMetaEventListener(mel); diff --git a/src/test/java/PlayPCM.java b/src/test/java/PlayPCM.java index 29a3ea1..1ebfa92 100644 --- a/src/test/java/PlayPCM.java +++ b/src/test/java/PlayPCM.java @@ -26,6 +26,8 @@ */ public class PlayPCM { + static final double volume = Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + /** * usage: java PlayPCM pcm_file [sampleRate] [byteOrder(le,be)] */ @@ -76,7 +78,7 @@ void play(File file, int sampleRate, ByteOrder byteOrder) throws Exception { System.exit(0); } }); - volume(line, .2d); + volume(line, volume); line.start(); byte[] buf = new byte[line.getBufferSize()]; int l; diff --git a/src/test/java/PlayPCM2.java b/src/test/java/PlayPCM2.java index 434e6f8..777ff62 100644 --- a/src/test/java/PlayPCM2.java +++ b/src/test/java/PlayPCM2.java @@ -30,6 +30,8 @@ */ public class PlayPCM2 { + static final double volume = Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + /** * usage: java PlayPCM2 pcm_file */ @@ -72,7 +74,7 @@ void play(File file, int sampleRate, ByteOrder byteOrder) throws Exception { System.exit(0); } }); - volume(line, .2d); + volume(line, volume); line.start(); byte[] buf = new byte[line.getBufferSize()]; int l; diff --git a/src/test/java/SoundFontTest.java b/src/test/java/SoundFontTest.java index 0e9f8c9..97676e5 100644 --- a/src/test/java/SoundFontTest.java +++ b/src/test/java/SoundFontTest.java @@ -15,7 +15,11 @@ import javax.sound.midi.Soundbank; import javax.sound.midi.Synthesizer; +import vavi.sound.SoundUtil; +import vavi.sound.midi.MidiUtil; import vavi.util.Debug; +import vavi.util.properties.annotation.Property; +import vavi.util.properties.annotation.PropsEntity; /** @@ -25,6 +29,7 @@ * @version 0.00 080701 nsano initial version
* @see "https://stackoverflow.com/a/45119638/6102938" */ +@PropsEntity(url = "file:local.properties") public class SoundFontTest { /** @@ -33,6 +38,18 @@ public class SoundFontTest { public static void main(String[] args) throws Exception { File file = new File(args[0]); + SoundFontTest app = new SoundFontTest(); + PropsEntity.Util.bind(app); + app.exec(file); + } + + static final float volume = Float.parseFloat(System.getProperty("vavi.test.volume", "0.2")); + + @Property(name = "sf2") + String sf2name = System.getProperty("user.home") + "/Library/Audio/Sounds/Banks/Orchestra/default.sf2"; + + /** */ + void exec(File file) throws Exception { Sequence sequence = MidiSystem.getSequence(file); Debug.println(Level.FINE, "sequence: " + sequence); @@ -46,22 +63,13 @@ public static void main(String[] args) throws Exception { //System.err.println("---- " + soundbank.getDescription() + " ----"); //Arrays.asList(instruments).forEach(System.err::println); synthesizer.unloadAllInstruments(soundbank); -// String sf2name = "SGM-V2.01.sf2"; - String sf2name = "Aspirin-Stereo.sf2"; - File sf2 = new File("/Users/nsano/lib/audio/sf2", sf2name); + File sf2 = new File(sf2name); soundbank = MidiSystem.getSoundbank(sf2); synthesizer.loadAllInstruments(soundbank); // instruments = synthesizer.getAvailableInstruments(); System.err.println("---- " + soundbank.getDescription() + " ----"); //Arrays.asList(instruments).forEach(System.err::println); - // volume (not work ???) -// MidiChannel[] channels = synthesizer.getChannels(); -// double gain = 0.02d; -// for (int i = 0; i < channels.length; i++) { -// channels[i].controlChange(7, (int) (gain * 127.0)); -// } - CountDownLatch countDownLatch = new CountDownLatch(1); MetaEventListener mel = meta -> { System.err.println("META: " + meta.getType()); @@ -77,6 +85,7 @@ public static void main(String[] args) throws Exception { sequencer.setSequence(sequence); sequencer.addMetaEventListener(mel); sequencer.start(); +MidiUtil.volume(synthesizer.getReceiver(), volume); countDownLatch.await(); sequencer.stop(); sequencer.removeMetaEventListener(mel); diff --git a/src/test/java/vavi/io/InputEngineOutputStreamTest.java b/src/test/java/vavi/io/InputEngineOutputStreamTest.java index 617fb91..acabe7b 100644 --- a/src/test/java/vavi/io/InputEngineOutputStreamTest.java +++ b/src/test/java/vavi/io/InputEngineOutputStreamTest.java @@ -44,7 +44,7 @@ static void setup() throws IOException { @Test public void test1() throws Exception { // - InputStream is = new OutputEngineInputStream(new IOStreamOutputEngine(getClass().getResourceAsStream(inFile), out -> new Rot13.OutputStream(out))); + InputStream is = new OutputEngineInputStream(new IOStreamOutputEngine(getClass().getResourceAsStream(inFile), Rot13.OutputStream::new)); OutputStream os = Files.newOutputStream(Paths.get(out1File)); byte[] buffer = new byte[8192]; while (true) { @@ -60,7 +60,7 @@ public void test1() throws Exception { // is = Files.newInputStream(Paths.get(out1File)); - os = new InputEngineOutputStream(new IOStreamInputEngine(Files.newOutputStream(Paths.get(out2File)), in -> new Rot13.InputStream(in))); + os = new InputEngineOutputStream(new IOStreamInputEngine(Files.newOutputStream(Paths.get(out2File)), Rot13.InputStream::new)); buffer = new byte[8192]; while (true) { int amount = is.read(buffer); diff --git a/src/test/java/vavi/sound/adpcm/AdpcmOutputStreamTest.java b/src/test/java/vavi/sound/adpcm/AdpcmOutputStreamTest.java index 25e7c23..31722e5 100644 --- a/src/test/java/vavi/sound/adpcm/AdpcmOutputStreamTest.java +++ b/src/test/java/vavi/sound/adpcm/AdpcmOutputStreamTest.java @@ -28,11 +28,14 @@ void test() throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); AdpcmOutputStream os = new AdpcmOutputStream(baos, ByteOrder.BIG_ENDIAN, 4, ByteOrder.BIG_ENDIAN) { + @Override protected Codec getCodec() { return new Codec() { + @Override public int encode(int pcm) { return pcm & 0xf; } + @Override public int decode(int adpcm) { return adpcm | adpcm << 4 | adpcm << 8 | adpcm << 16; } diff --git a/src/test/java/vavi/sound/adpcm/ccitt/Decoder.java b/src/test/java/vavi/sound/adpcm/ccitt/Decoder.java index a3a7a56..fc28b03 100644 --- a/src/test/java/vavi/sound/adpcm/ccitt/Decoder.java +++ b/src/test/java/vavi/sound/adpcm/ccitt/Decoder.java @@ -95,7 +95,7 @@ public static void main(String[] args) throws Exception { } } while (++argc < args.length); - G711 decoder = (G711) Class.forName(decoderName).newInstance(); + G711 decoder = (G711) Class.forName(decoderName).getDeclaredConstructor().newInstance(); decoder.setEncoding(encoding); InputStream is = new BitInputStream( diff --git a/src/test/java/vavi/sound/adpcm/ccitt/Encoder.java b/src/test/java/vavi/sound/adpcm/ccitt/Encoder.java index a193360..32d2da0 100644 --- a/src/test/java/vavi/sound/adpcm/ccitt/Encoder.java +++ b/src/test/java/vavi/sound/adpcm/ccitt/Encoder.java @@ -97,7 +97,7 @@ public static void main(String[] args) throws Exception { } } while (++argc < args.length); - G711 encoder = (G711) Class.forName(encoderName).newInstance(); + G711 encoder = (G711) Class.forName(encoderName).getDeclaredConstructor().newInstance(); encoder.setEncoding(encoding); InputStream is = new BufferedInputStream(in); diff --git a/src/test/java/vavi/sound/adpcm/ccitt/G721InputStreamTest.java b/src/test/java/vavi/sound/adpcm/ccitt/G721InputStreamTest.java index f62da59..9e32ba6 100644 --- a/src/test/java/vavi/sound/adpcm/ccitt/G721InputStreamTest.java +++ b/src/test/java/vavi/sound/adpcm/ccitt/G721InputStreamTest.java @@ -36,6 +36,8 @@ */ public class G721InputStreamTest { + static final double volume = Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + String inFile = "out.4.adpcm"; String correctFile = "out.4.pcm"; File outFile; @@ -74,7 +76,7 @@ public void test1() throws Exception { line.open(format); line.start(); -volume(line, .2d); +volume(line, volume); byte[] buf = new byte[1024]; while (is.available() > 0) { diff --git a/src/test/java/vavi/sound/adpcm/dvi/DviInputStreamTest.java b/src/test/java/vavi/sound/adpcm/dvi/DviInputStreamTest.java index e80a617..2ae4a3e 100644 --- a/src/test/java/vavi/sound/adpcm/dvi/DviInputStreamTest.java +++ b/src/test/java/vavi/sound/adpcm/dvi/DviInputStreamTest.java @@ -36,6 +36,8 @@ */ public class DviInputStreamTest { + static final double volume = Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + String inFile = "out.adpcm"; String correctFile = "out.pcm"; File outFile; @@ -72,7 +74,7 @@ public void test1() throws Exception { SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info); line.open(format); line.start(); - volume(line, .2d); + volume(line, volume); byte[] buf = new byte[1024]; while (true) { diff --git a/src/test/java/vavi/sound/adpcm/ima/ImaInputStreamTest.java b/src/test/java/vavi/sound/adpcm/ima/ImaInputStreamTest.java index cdafcbc..c565b36 100644 --- a/src/test/java/vavi/sound/adpcm/ima/ImaInputStreamTest.java +++ b/src/test/java/vavi/sound/adpcm/ima/ImaInputStreamTest.java @@ -41,6 +41,8 @@ */ public class ImaInputStreamTest { + static final double volume = Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + String inFile = "ima_8k_4_mono.wav"; String correctFile = "linear_8k_16_mono.pcm"; File outFile; @@ -112,7 +114,7 @@ public void test1() throws Exception { } }); line.start(); -volume(line, .2d); +volume(line, volume); byte[] buf = new byte[bufferSize]; while (true) { diff --git a/src/test/java/vavi/sound/adpcm/ima/ImaOutputStreamTest.java b/src/test/java/vavi/sound/adpcm/ima/ImaOutputStreamTest.java index 682ccd3..234de03 100644 --- a/src/test/java/vavi/sound/adpcm/ima/ImaOutputStreamTest.java +++ b/src/test/java/vavi/sound/adpcm/ima/ImaOutputStreamTest.java @@ -44,6 +44,8 @@ */ public class ImaOutputStreamTest { + static final double volume = Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + String inFile = "out.pcm"; String correctFile = "out_sox.adpcm"; File outFile; @@ -94,7 +96,7 @@ public void test1() throws Exception { line.open(audioFormat); line.start(); - volume(line, .2d); + volume(line, volume); byte[] buf = new byte[8192]; while (true) { @@ -159,7 +161,7 @@ public void test2() throws Exception { line.open(audioFormat); line.start(); - volume(line, .2d); + volume(line, volume); byte[] buf = new byte[8192]; while (true) { @@ -243,7 +245,7 @@ public void test3() throws Exception { line.open(audioFormat); line.start(); - volume(line, .2d); + volume(line, volume); byte[] buf = new byte[8192]; while (true) { diff --git a/src/test/java/vavi/sound/adpcm/ma/MaInputStreamTest.java b/src/test/java/vavi/sound/adpcm/ma/MaInputStreamTest.java index f05a895..51c498a 100644 --- a/src/test/java/vavi/sound/adpcm/ma/MaInputStreamTest.java +++ b/src/test/java/vavi/sound/adpcm/ma/MaInputStreamTest.java @@ -38,6 +38,8 @@ */ public class MaInputStreamTest { + static final double volume = Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + String inFile = "out.adpcm"; String correctFile = "out.pcm"; File outFile; @@ -82,7 +84,7 @@ public void test1() throws Exception { } }); line.start(); - volume(line, .2d); + volume(line, volume); byte[] buf = new byte[1024]; while (is.available() > 0) { diff --git a/src/test/java/vavi/sound/adpcm/ms/MsInputStreamTest.java b/src/test/java/vavi/sound/adpcm/ms/MsInputStreamTest.java index 2a2de05..8790912 100644 --- a/src/test/java/vavi/sound/adpcm/ms/MsInputStreamTest.java +++ b/src/test/java/vavi/sound/adpcm/ms/MsInputStreamTest.java @@ -44,6 +44,8 @@ */ public class MsInputStreamTest { + static final double volume = Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + String inFile = "ms_8k_4_mono.wav"; String correctFile = "out_sox.pcm"; File outFile; @@ -123,7 +125,7 @@ public void test1() throws Exception { } }); line.start(); -volume(line, .2d); +volume(line, volume); byte[] buf = new byte[1024]; while (true) { diff --git a/src/test/java/vavi/sound/adpcm/ms/MsOutputStreamTest.java b/src/test/java/vavi/sound/adpcm/ms/MsOutputStreamTest.java index c4ccbf2..e5d3535 100644 --- a/src/test/java/vavi/sound/adpcm/ms/MsOutputStreamTest.java +++ b/src/test/java/vavi/sound/adpcm/ms/MsOutputStreamTest.java @@ -40,6 +40,8 @@ */ public class MsOutputStreamTest { + static final double volume = Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + String inFile = "out.pcm"; String correctFile = "out_sox.adpcm"; File outFile; @@ -164,7 +166,7 @@ public void test3() throws Exception { line.addLineListener(ev -> Debug.println(ev.getType())); line.start(); - volume(line, .2d); + volume(line, volume); byte[] buf = new byte[1024]; while (true) { diff --git a/src/test/java/vavi/sound/adpcm/oki/OkiInputStreamTest.java b/src/test/java/vavi/sound/adpcm/oki/OkiInputStreamTest.java index 976d863..b2f5bc2 100644 --- a/src/test/java/vavi/sound/adpcm/oki/OkiInputStreamTest.java +++ b/src/test/java/vavi/sound/adpcm/oki/OkiInputStreamTest.java @@ -36,6 +36,8 @@ */ public class OkiInputStreamTest { + static final double volume = Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + String inFile = "out.adpcm"; String correctFile = "out.pcm"; File outFile; @@ -72,7 +74,7 @@ public void test1() throws Exception { SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info); line.open(format); line.start(); - volume(line, .2d); + volume(line, volume); byte[] buf = new byte[1024]; while (true) { diff --git a/src/test/java/vavi/sound/adpcm/oki/Xlaw.java b/src/test/java/vavi/sound/adpcm/oki/Xlaw.java index 5880477..cda4daa 100644 --- a/src/test/java/vavi/sound/adpcm/oki/Xlaw.java +++ b/src/test/java/vavi/sound/adpcm/oki/Xlaw.java @@ -44,7 +44,7 @@ public void setBit(int bit) { /** */ protected int[] encodeTable; - /** */ + @Override public int decode(int xlaw) { if (AudioFormat.Encoding.PCM_SIGNED.equals(encoding)) { if (bit == 8) { @@ -69,7 +69,7 @@ public int decode(int xlaw) { } } - /** */ + @Override public int encode(int linear) { if (AudioFormat.Encoding.PCM_SIGNED.equals(encoding)) { if (bit == 8) { diff --git a/src/test/java/vavi/sound/adpcm/rohm/RohmInputStreamTest.java b/src/test/java/vavi/sound/adpcm/rohm/RohmInputStreamTest.java index cb6aa32..470b4ce 100644 --- a/src/test/java/vavi/sound/adpcm/rohm/RohmInputStreamTest.java +++ b/src/test/java/vavi/sound/adpcm/rohm/RohmInputStreamTest.java @@ -38,6 +38,8 @@ */ public class RohmInputStreamTest { + static final double volume = Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + String inFile = "out.adpcm"; String correctFile = "out.pcm"; File outFile; @@ -82,7 +84,7 @@ public void test1() throws Exception { } }); line.start(); - volume(line, .2d); + volume(line, volume); byte[] buf = new byte[1024]; while (is.available() > 0) { diff --git a/src/test/java/vavi/sound/adpcm/vox/VoxInputStreamTest.java b/src/test/java/vavi/sound/adpcm/vox/VoxInputStreamTest.java index 2cd6e9c..7bcb531 100644 --- a/src/test/java/vavi/sound/adpcm/vox/VoxInputStreamTest.java +++ b/src/test/java/vavi/sound/adpcm/vox/VoxInputStreamTest.java @@ -38,6 +38,8 @@ */ public class VoxInputStreamTest { + static final double volume = Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + String inFile = "out.adpcm"; String correctFile = "out.pcm"; File outFile; @@ -74,7 +76,7 @@ public void test1() throws Exception { SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info); line.open(format); line.start(); - volume(line, .2d); + volume(line, volume); byte[] buf = new byte[1024]; while (true) { diff --git a/src/test/java/vavi/sound/adpcm/yamaha/YamahaInputStreamTest.java b/src/test/java/vavi/sound/adpcm/yamaha/YamahaInputStreamTest.java index a216bd0..13475cb 100644 --- a/src/test/java/vavi/sound/adpcm/yamaha/YamahaInputStreamTest.java +++ b/src/test/java/vavi/sound/adpcm/yamaha/YamahaInputStreamTest.java @@ -41,6 +41,8 @@ */ public class YamahaInputStreamTest { + static final double volume = Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + String inFile = "out.adpcm"; String correctFile = "out.pcm"; File outFile; @@ -77,7 +79,7 @@ public void test1() throws Exception { SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info); line.open(format); line.start(); - volume(line, .2d); + volume(line, volume); byte[] buf = new byte[1024]; while (true) { diff --git a/src/test/java/vavi/sound/adpcm/ym2608/Ym2608InputStreamTest.java b/src/test/java/vavi/sound/adpcm/ym2608/Ym2608InputStreamTest.java index 65f6b2a..c2180f3 100644 --- a/src/test/java/vavi/sound/adpcm/ym2608/Ym2608InputStreamTest.java +++ b/src/test/java/vavi/sound/adpcm/ym2608/Ym2608InputStreamTest.java @@ -36,6 +36,8 @@ */ public class Ym2608InputStreamTest { + static final double volume = Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + String inFile = "out.adpcm"; String correctFile = "out.pcm"; File outFile; @@ -74,7 +76,7 @@ public void test1() throws Exception { line.start(); byte[] buf = new byte[1024]; int l; - volume(line, .2d); + volume(line, volume); while (is.available() > 0) { l = is.read(buf, 0, 1024); diff --git a/src/test/java/vavi/sound/mfi/vavi/VaviMfiFileWriterTest.java b/src/test/java/vavi/sound/mfi/vavi/VaviMfiFileWriterTest.java index 29bcf5a..dc10fe1 100644 --- a/src/test/java/vavi/sound/mfi/vavi/VaviMfiFileWriterTest.java +++ b/src/test/java/vavi/sound/mfi/vavi/VaviMfiFileWriterTest.java @@ -125,13 +125,13 @@ private void d505i(Track track, byte[] pcm, int sampleRate, int delta) } } - /** - * 同じ channel で次の {@link ShortMessage#NOTE_OFF}, {@link ShortMessage#CONTROL_CHANGE} - * である MIDI イベントを取得します。 - * - * @throws NoSuchElementException 次のイベントがない - * @throws IllegalStateException 現在のイベントは {@link ShortMessage} ではない - */ +// /** +// * 同じ channel で次の {@link ShortMessage#NOTE_OFF}, {@link ShortMessage#CONTROL_CHANGE} +// * である MIDI イベントを取得します。 +// * +// * @throws NoSuchElementException 次のイベントがない +// * @throws IllegalStateException 現在のイベントは {@link ShortMessage} ではない +// */ /* public MidiEvent getNoteOffOrControllChangeMidiEvent() throws NoSuchElementException { @@ -193,12 +193,12 @@ public MidiEvent getNoteOffOrControllChangeMidiEvent() throws NoSuchElementExcep } */ - /** - * 同じ channel で次の {@link ShortMessage} である MIDI イベントを取得します。 - * (not used) - * @throws NoSuchElementException 次の MIDI イベントがない - * @throws IllegalStateException 現在のイベントは {@link ShortMessage} ではない - */ +// /** +// * 同じ channel で次の {@link ShortMessage} である MIDI イベントを取得します。 +// * (not used) +// * @throws NoSuchElementException 次の MIDI イベントがない +// * @throws IllegalStateException 現在のイベントは {@link ShortMessage} ではない +// */ /* public MidiEvent getNextMidiEvent() throws NoSuchElementException { @@ -232,10 +232,10 @@ public MidiEvent getNextMidiEvent() throws NoSuchElementException { throw new NoSuchElementException("no next event of channel: " + channel); } */ - /** - * @return 補正なし Δタイム - * TODO 何でこれでうまくいくの? - */ +// /** +// * @return 補正なし Δタイム +// * TODO 何でこれでうまくいくの? +// */ /* private int retrieveDelta(int mfiTrackNumber, long currentTick) { return (int) Math.round((currentTick - previousTicks[mfiTrackNumber]) / scale); diff --git a/src/test/java/vavi/sound/mfi/vavi/VaviMidiConverterTest.java b/src/test/java/vavi/sound/mfi/vavi/VaviMidiConverterTest.java index c9751f2..c0ece0b 100644 --- a/src/test/java/vavi/sound/mfi/vavi/VaviMidiConverterTest.java +++ b/src/test/java/vavi/sound/mfi/vavi/VaviMidiConverterTest.java @@ -12,16 +12,15 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.concurrent.CountDownLatch; -import java.util.logging.Level; - import javax.sound.midi.MidiSystem; import javax.sound.midi.Sequence; import javax.sound.midi.Sequencer; +import javax.sound.midi.Synthesizer; import org.junit.jupiter.api.Test; - import vavi.sound.mfi.MfiSystem; import vavi.sound.mfi.MfiSystemTest; +import vavi.sound.midi.MidiUtil; import vavi.util.Debug; @@ -41,9 +40,9 @@ public void test() throws Exception { Sequence midiSequence = MfiSystem.toMidiSequence(mfiSequence); Sequencer midiSequencer = MidiSystem.getSequencer(); -Debug.println(Level.FINE, "midiSequencer: " + midiSequencer); -Debug.println(Level.FINE, "midiSequencer:T: " + midiSequencer.getTransmitter()); -Debug.println(Level.FINE, "midiSequencer:R: " + midiSequencer.getReceiver()); +Debug.println("midiSequencer: " + midiSequencer); +Debug.println("midiSequencer:T: " + midiSequencer.getTransmitter()); +Debug.println("midiSequencer:R: " + midiSequencer.getReceiver()); midiSequencer.open(); midiSequencer.setSequence(midiSequence); midiSequencer.addMetaEventListener(meta -> { @@ -66,6 +65,7 @@ public void test() throws Exception { * % java VaviMidiConverter -p in_mld_file * % java VaviMidiConverter -c in_mld_file out_mid_file *
+ * @param args 0: -p|-c, 1: in_mld, 2: [out_mid] */ public static void main(String[] args) throws Exception { @@ -84,39 +84,48 @@ public static void main(String[] args) throws Exception { vavi.sound.mfi.Sequence mfiSequence = MfiSystem.getSequence(file); Sequence midiSequence = MfiSystem.toMidiSequence(mfiSequence); + Synthesizer synthesizer = MidiSystem.getSynthesizer(); + synthesizer.open(); + Sequencer midiSequencer = MidiSystem.getSequencer(); -Debug.println(Level.FINE, "midiSequencer: " + midiSequencer); -Debug.println(Level.FINE, "midiSequencer:T: " + midiSequencer.getTransmitter()); -Debug.println(Level.FINE, "midiSequencer:R: " + midiSequencer.getReceiver()); +Debug.println("midiSequencer: " + midiSequencer); +Debug.println("midiSequencer:T: " + midiSequencer.getTransmitter()); +Debug.println("midiSequencer:R: " + midiSequencer.getReceiver()); + midiSequencer.getTransmitter().setReceiver(synthesizer.getReceiver()); midiSequencer.open(); midiSequencer.setSequence(midiSequence); if (play) { + CountDownLatch cdl = new CountDownLatch(1); + midiSequencer.addMetaEventListener(meta -> { +Debug.println(meta.getType()); + if (meta.getType() == 47) { + cdl.countDown(); + } + }); midiSequencer.start(); - while (midiSequencer.isRunning()) { - try { Thread.sleep(100); } catch (Exception ignored) {} - } + MidiUtil.volume(synthesizer.getReceiver(), 0.2f); // TODO volume + cdl.await(); midiSequencer.stop(); } midiSequencer.close(); + synthesizer.close(); if (convert) { int[] ts = MidiSystem.getMidiFileTypes(midiSequence); -Debug.println(Level.FINE, "types: " + ts.length); +Debug.println("types: " + ts.length); if (ts.length == 0) { throw new IllegalArgumentException("no support type"); } for (int t : ts) { - Debug.printf(Level.FINE, "type: 0x%02x\n", t); +Debug.printf("type: 0x%02x\n", t); } file = new File(args[2]); int r = MidiSystem.write(midiSequence, 0, file); -Debug.println(Level.FINE, "write: " + r); +Debug.println("write: " + r); } - - System.exit(0); } } diff --git a/src/test/java/vavi/sound/midi/mfi/MfiMidiFileReaderTest.java b/src/test/java/vavi/sound/midi/mfi/MfiMidiFileReaderTest.java index 830008f..83c4349 100644 --- a/src/test/java/vavi/sound/midi/mfi/MfiMidiFileReaderTest.java +++ b/src/test/java/vavi/sound/midi/mfi/MfiMidiFileReaderTest.java @@ -9,8 +9,6 @@ import java.io.File; import java.io.InputStream; import java.util.concurrent.CountDownLatch; -import javax.sound.midi.MetaEventListener; -import javax.sound.midi.MetaMessage; import javax.sound.midi.MidiSystem; import javax.sound.midi.Sequence; import javax.sound.midi.Sequencer; diff --git a/src/test/java/vavi/sound/midi/mfi/MfiVaviSequenceTest.java b/src/test/java/vavi/sound/midi/mfi/MfiVaviSequenceTest.java index 1899876..7fba054 100644 --- a/src/test/java/vavi/sound/midi/mfi/MfiVaviSequenceTest.java +++ b/src/test/java/vavi/sound/midi/mfi/MfiVaviSequenceTest.java @@ -45,14 +45,14 @@ public void test2() throws Exception { @Test public void test3() throws Exception { InputStream is = MfiVaviSequenceTest.class.getResourceAsStream("/test.mld"); - MidiFileFormat format= new MfiMidiFileReader().getMidiFileFormat(is); + MidiFileFormat format = new MfiMidiFileReader().getMidiFileFormat(is); assertNotNull(format); } @Test public void test4() throws Exception { InputStream is = MfiVaviSequenceTest.class.getResourceAsStream("/test.mld"); - MidiFileFormat format= MidiSystem.getMidiFileFormat(is); + MidiFileFormat format = MidiSystem.getMidiFileFormat(is); assertNotNull(format); } diff --git a/src/test/java/vavi/sound/mobile/BasicAudioEngineTest.java b/src/test/java/vavi/sound/mobile/BasicAudioEngineTest.java index c41e5ab..ad29695 100644 --- a/src/test/java/vavi/sound/mobile/BasicAudioEngineTest.java +++ b/src/test/java/vavi/sound/mobile/BasicAudioEngineTest.java @@ -33,6 +33,8 @@ */ public class BasicAudioEngineTest { + static final float volume = (float) Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + @Test public void test() throws Exception { CountDownLatch cdl = new CountDownLatch(1); @@ -94,6 +96,7 @@ public void close() throws IOException { } } } + /** */ void debug1(byte[] adpcm) { try { diff --git a/src/test/java/vavi/sound/pcm/resampling/ssrc/SSRCTest.java b/src/test/java/vavi/sound/pcm/resampling/ssrc/SSRCTest.java index 811637d..bc92faa 100644 --- a/src/test/java/vavi/sound/pcm/resampling/ssrc/SSRCTest.java +++ b/src/test/java/vavi/sound/pcm/resampling/ssrc/SSRCTest.java @@ -8,9 +8,10 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.File; import java.io.InputStream; - +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; @@ -18,15 +19,16 @@ import javax.sound.sampled.SourceDataLine; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; - import vavi.io.LittleEndianDataInputStream; import vavi.io.LittleEndianDataOutputStream; import vavi.util.Debug; import vavi.util.StringUtil; - +import vavi.util.properties.annotation.Property; +import vavi.util.properties.annotation.PropsEntity; import vavix.util.Checksum; import static org.junit.jupiter.api.Assertions.assertArrayEquals; @@ -40,80 +42,97 @@ * @author Naohide Sano (nsano) * @version 0.00 060127 nsano initial version
*/ +@PropsEntity(url = "file:local.properties") public class SSRCTest { -// static String inFile = "/Users/nsano/Music/0/kirameki01.wav"; // TODO error in down sampling - static String inFile = "src/test/resources/vavi/sound/pcm/resampling/ssrc/44100.wav"; -// static String inFile = "/Users/nsano/Music/0/rc.wav"; + static boolean localPropertiesExists() { + return Files.exists(Paths.get("local.properties")); + } - static String outFile = "tmp/out.vavi.wav"; - static String correctFile = "src/test/resources/vavi/sound/pcm/resampling/ssrc/out.wav"; + @Property + String ssrc = "src/test/resources/vavi/sound/pcm/resampling/ssrc/44100.wav"; - static boolean onIde; + static final Path outPath = Paths.get("tmp/out.vavi.wav"); + static final String inFile = "src/test/resources/vavi/sound/pcm/resampling/ssrc/44100.wav"; + static final String correctDownFile = "src/test/resources/vavi/sound/pcm/resampling/ssrc/down.wav"; + static final String correctUpFile = "src/test/resources/vavi/sound/pcm/resampling/ssrc/up.wav"; + + static double volume = Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + static boolean onIde = System.getProperty("vavi.test", "").equals("ide"); @BeforeAll - public static void setUp() throws Exception { - onIde = System.getProperty("vavi.test", "").equals("ide"); -Debug.println("onIde: " + onIde + ", " + System.getProperty("vavi.test") + ", file: " + inFile); + static void setUp() throws Exception { + Path tmp = outPath.getParent(); + if (!Files.exists(tmp)) { + Files.createDirectory(tmp); + } + } + + @BeforeEach + void setup() throws Exception { + if (localPropertiesExists()) { + PropsEntity.Util.bind(this); + } } @Test - @Disabled("ssrc uses random, so check sum never be equal") @DisplayName("down sample, call by main") public void test1() throws Exception { - SSRC.main(new String[] { "--rate", "8000", "--twopass", "--normalize", inFile, outFile }); + SSRC.main(new String[] {"--rate", "8000", "--twopass", "--normalize", inFile, outPath.toString()}); - AudioInputStream ais = AudioSystem.getAudioInputStream(new File(outFile)); - AudioFormat format = ais.getFormat(); + if (onIde) { + AudioInputStream ais = AudioSystem.getAudioInputStream(outPath.toFile()); + AudioFormat format = ais.getFormat(); Debug.println(format); - DataLine.Info info = new DataLine.Info(SourceDataLine.class, format); - SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info); - line.open(format); - volume(line, .2d); - line.start(); - byte[] buf = new byte[1024]; - int l; - while (ais.available() > 0) { - l = ais.read(buf, 0, buf.length); - if (onIde) + DataLine.Info info = new DataLine.Info(SourceDataLine.class, format); + SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info); + line.open(format); + volume(line, volume); + line.start(); + byte[] buf = new byte[1024]; + int l; + while (true) { + l = ais.read(buf, 0, buf.length); + if (l < 0) + break; line.write(buf, 0, l); + } + line.drain(); + line.stop(); + line.close(); } - line.drain(); - line.stop(); - line.close(); - assertEquals(Checksum.getChecksum(new File(correctFile)), Checksum.getChecksum(new File(outFile))); + assertEquals(Checksum.getChecksum(Paths.get(correctDownFile)), Checksum.getChecksum(outPath)); } - static String outFile3 = "tmp/out3.vavi.wav"; - static String correctFile3 = "src/test/resources/vavi/sound/pcm/resampling/ssrc/out.wav"; - @Test - @Disabled("ssrc uses random, so check sum never be equal") @DisplayName("up sample, call by main") public void test3() throws Exception { - SSRC.main(new String[] { "--rate", "48000", "--twopass", "--normalize", inFile, outFile }); + SSRC.main(new String[] { "--rate", "48000", "--twopass", "--normalize", ssrc, outPath.toString() }); - AudioInputStream ais = AudioSystem.getAudioInputStream(new File(outFile)); - AudioFormat format = ais.getFormat(); + if (onIde) { + AudioInputStream ais = AudioSystem.getAudioInputStream(outPath.toFile()); + AudioFormat format = ais.getFormat(); Debug.println(format); - DataLine.Info info = new DataLine.Info(SourceDataLine.class, format); - SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info); - line.open(format); - volume(line, .2d); - line.start(); - byte[] buf = new byte[1024]; - int l; - while (ais.available() > 0) { - l = ais.read(buf, 0, buf.length); - if (onIde) + DataLine.Info info = new DataLine.Info(SourceDataLine.class, format); + SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info); + line.open(format); + volume(line, volume); + line.start(); + byte[] buf = new byte[1024]; + int l; + while (true) { + l = ais.read(buf, 0, buf.length); + if (l < 0) + break; line.write(buf, 0, l); + } + line.drain(); + line.stop(); + line.close(); } - line.drain(); - line.stop(); - line.close(); - assertEquals(Checksum.getChecksum(new File(correctFile3)), Checksum.getChecksum(new File(outFile))); + assertEquals(Checksum.getChecksum(Paths.get(correctUpFile)), Checksum.getChecksum(outPath)); } @Test @@ -152,12 +171,12 @@ private void writeDouble(byte[] buffer, int offset, double value) { @Test @DisplayName("call by stream") public void test4() throws Exception { - AudioInputStream ais = AudioSystem.getAudioInputStream(new File(inFile)); + AudioInputStream ais = AudioSystem.getAudioInputStream(Paths.get(ssrc).toFile()); AudioFormat format = ais.getFormat(); AudioFormat outFormat = new AudioFormat( - format.getEncoding(), + AudioFormat.Encoding.PCM_SIGNED, 8000, - format.getSampleSizeInBits(), + 16, format.getChannels(), format.getFrameSize(), format.getFrameRate(), @@ -171,7 +190,7 @@ public void test4() throws Exception { SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info); line.open(outFormat); // volume - volume(line, .2d); + volume(line, volume); line.start(); byte[] buf = new byte[0x10000]; int f = format.getFrameSize() * format.getChannels(); diff --git a/src/test/java/vavi/sound/sampled/adpcm/ccitt/G721AudioFileReaderTest.java b/src/test/java/vavi/sound/sampled/adpcm/ccitt/G721AudioFileReaderTest.java index 41f89c8..a350d74 100644 --- a/src/test/java/vavi/sound/sampled/adpcm/ccitt/G721AudioFileReaderTest.java +++ b/src/test/java/vavi/sound/sampled/adpcm/ccitt/G721AudioFileReaderTest.java @@ -36,6 +36,8 @@ */ public class G721AudioFileReaderTest { + static final double volume = Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + String inFile = "/vavi/sound/adpcm/ccitt/out.4.adpcm"; String correctFile = "/vavi/sound/adpcm/ccitt/out.4.pcm"; File outFile; @@ -86,7 +88,7 @@ public void test1() throws Exception { line.start(); byte[] buf = new byte[1024]; int l; - volume(line, .2d); + volume(line, volume); while (oais.available() > 0) { l = oais.read(buf, 0, 1024); diff --git a/src/test/java/vavi/sound/sampled/adpcm/dvi/DviAudioFileReaderTest.java b/src/test/java/vavi/sound/sampled/adpcm/dvi/DviAudioFileReaderTest.java index 7dfed68..ca42ad5 100644 --- a/src/test/java/vavi/sound/sampled/adpcm/dvi/DviAudioFileReaderTest.java +++ b/src/test/java/vavi/sound/sampled/adpcm/dvi/DviAudioFileReaderTest.java @@ -35,6 +35,8 @@ */ public class DviAudioFileReaderTest { + static final double volume = Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + String inFile = "/vavi/sound/adpcm/dvi/out.adpcm"; String correctFile = "/vavi/sound/adpcm/dvi/out.pcm"; File outFile; @@ -85,7 +87,7 @@ public void test1() throws Exception { line.start(); byte[] buf = new byte[1024]; int l; - volume(line, .2d); + volume(line, volume); while (oais.available() > 0) { l = oais.read(buf, 0, 1024); diff --git a/src/test/java/vavi/sound/sampled/adpcm/ima/ImaAudioFileReaderTest.java b/src/test/java/vavi/sound/sampled/adpcm/ima/ImaAudioFileReaderTest.java index 3c03f3a..2f157ee 100644 --- a/src/test/java/vavi/sound/sampled/adpcm/ima/ImaAudioFileReaderTest.java +++ b/src/test/java/vavi/sound/sampled/adpcm/ima/ImaAudioFileReaderTest.java @@ -37,6 +37,8 @@ @Disabled public class ImaAudioFileReaderTest { + static final double volume = Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + String inFile = "/vavi/sound/adpcm/ima/ima_8k_4_mono.wav"; String correctFile = "/vavi/sound/adpcm/ima/linear_8k_16_mono.pcm"; File outFile; @@ -87,7 +89,7 @@ public void test1() throws Exception { line.start(); byte[] buf = new byte[1024]; int l; - volume(line, .2d); + volume(line, volume); while (oais.available() > 0) { l = oais.read(buf, 0, 1024); diff --git a/src/test/java/vavi/sound/sampled/adpcm/ma/MaAudioFileReaderTest.java b/src/test/java/vavi/sound/sampled/adpcm/ma/MaAudioFileReaderTest.java index 1681e46..f0f062d 100644 --- a/src/test/java/vavi/sound/sampled/adpcm/ma/MaAudioFileReaderTest.java +++ b/src/test/java/vavi/sound/sampled/adpcm/ma/MaAudioFileReaderTest.java @@ -35,6 +35,8 @@ */ public class MaAudioFileReaderTest { + static final double volume = Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + String inFile = "/vavi/sound/adpcm/ma/out.adpcm"; String correctFile = "/vavi/sound/adpcm/ma/out.pcm"; File outFile; @@ -85,7 +87,7 @@ public void test1() throws Exception { line.start(); byte[] buf = new byte[1024]; int l; - volume(line, .2d); + volume(line, volume); while (oais.available() > 0) { l = oais.read(buf, 0, 1024); diff --git a/src/test/java/vavi/sound/sampled/adpcm/ms/MsAudioFileReaderTest.java b/src/test/java/vavi/sound/sampled/adpcm/ms/MsAudioFileReaderTest.java index e8eaf15..f7d47f2 100644 --- a/src/test/java/vavi/sound/sampled/adpcm/ms/MsAudioFileReaderTest.java +++ b/src/test/java/vavi/sound/sampled/adpcm/ms/MsAudioFileReaderTest.java @@ -37,6 +37,8 @@ @Disabled public class MsAudioFileReaderTest { + static final double volume = Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + String inFile = "/vavi/sound/adpcm/ms/ms_8k_4_mono.wav"; String correctFile = "/vavi/sound/adpcm/ms/out_sox.pcm"; File outFile; @@ -87,7 +89,7 @@ public void test1() throws Exception { line.start(); byte[] buf = new byte[1024]; int l; - volume(line, .2d); + volume(line, volume); while (oais.available() > 0) { l = oais.read(buf, 0, 1024); diff --git a/src/test/java/vavi/sound/sampled/adpcm/oki/OkiAudioFileReaderTest.java b/src/test/java/vavi/sound/sampled/adpcm/oki/OkiAudioFileReaderTest.java index 9cf896a..c095da0 100644 --- a/src/test/java/vavi/sound/sampled/adpcm/oki/OkiAudioFileReaderTest.java +++ b/src/test/java/vavi/sound/sampled/adpcm/oki/OkiAudioFileReaderTest.java @@ -36,6 +36,8 @@ */ public class OkiAudioFileReaderTest { + static final double volume = Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + String inFile = "/vavi/sound/adpcm/oki/out.adpcm"; String correctFile = "/vavi/sound/adpcm/oki/out.pcm"; File outFile; @@ -86,7 +88,7 @@ public void test1() throws Exception { line.start(); byte[] buf = new byte[1024]; int l; - volume(line, .2d); + volume(line, volume); while (oais.available() > 0) { l = oais.read(buf, 0, 1024); diff --git a/src/test/java/vavi/sound/sampled/adpcm/rhom/RohmAudioFileReaderTest.java b/src/test/java/vavi/sound/sampled/adpcm/rhom/RohmAudioFileReaderTest.java index 45713ce..8e39e9e 100644 --- a/src/test/java/vavi/sound/sampled/adpcm/rhom/RohmAudioFileReaderTest.java +++ b/src/test/java/vavi/sound/sampled/adpcm/rhom/RohmAudioFileReaderTest.java @@ -37,6 +37,8 @@ */ public class RohmAudioFileReaderTest { + static final double volume = Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + String inFile = "/vavi/sound/adpcm/rohm/out.adpcm"; String correctFile = "/vavi/sound/adpcm/rohm/out.pcm"; File outFile; @@ -87,7 +89,7 @@ public void test1() throws Exception { line.start(); byte[] buf = new byte[1024]; int l; - volume(line, .2d); + volume(line, volume); while (oais.available() > 0) { l = oais.read(buf, 0, 1024); diff --git a/src/test/java/vavi/sound/sampled/adpcm/vox/VoxAudioFileReaderTest.java b/src/test/java/vavi/sound/sampled/adpcm/vox/VoxAudioFileReaderTest.java index 1a01c83..f0c516d 100644 --- a/src/test/java/vavi/sound/sampled/adpcm/vox/VoxAudioFileReaderTest.java +++ b/src/test/java/vavi/sound/sampled/adpcm/vox/VoxAudioFileReaderTest.java @@ -36,6 +36,8 @@ */ public class VoxAudioFileReaderTest { + static final double volume = Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + String inFile = "/vavi/sound/adpcm/vox/out.adpcm"; String correctFile = "/vavi/sound/adpcm/vox/out.pcm"; File outFile; @@ -86,7 +88,7 @@ public void test1() throws Exception { line.start(); byte[] buf = new byte[1024]; int l; - volume(line, .2d); + volume(line, volume); while (oais.available() > 0) { l = oais.read(buf, 0, 1024); diff --git a/src/test/java/vavi/sound/sampled/adpcm/yamaha/YamahaAudioFileReaderTest.java b/src/test/java/vavi/sound/sampled/adpcm/yamaha/YamahaAudioFileReaderTest.java index 1c5c5e0..aca0540 100644 --- a/src/test/java/vavi/sound/sampled/adpcm/yamaha/YamahaAudioFileReaderTest.java +++ b/src/test/java/vavi/sound/sampled/adpcm/yamaha/YamahaAudioFileReaderTest.java @@ -35,6 +35,8 @@ */ public class YamahaAudioFileReaderTest { + static final double volume = Double.parseDouble(System.getProperty("vavi.test.volume", "0.2")); + String inFile = "/vavi/sound/adpcm/ym2608/out.adpcm"; String correctFile = "/vavi/sound/adpcm/ym2608/out.pcm"; File outFile; @@ -85,7 +87,7 @@ public void test1() throws Exception { line.start(); byte[] buf = new byte[1024]; int l; - volume(line, .2d); + volume(line, volume); while (oais.available() > 0) { l = oais.read(buf, 0, 1024); diff --git a/src/test/resources/vavi/sound/pcm/resampling/ssrc/down.wav b/src/test/resources/vavi/sound/pcm/resampling/ssrc/down.wav new file mode 100644 index 0000000..ada7fa3 Binary files /dev/null and b/src/test/resources/vavi/sound/pcm/resampling/ssrc/down.wav differ diff --git a/src/test/resources/vavi/sound/pcm/resampling/ssrc/up.wav b/src/test/resources/vavi/sound/pcm/resampling/ssrc/up.wav new file mode 100644 index 0000000..1f5d23d Binary files /dev/null and b/src/test/resources/vavi/sound/pcm/resampling/ssrc/up.wav differ