Skip to content

Commit

Permalink
Merge pull request #2 from umjammer/0.0.2
Browse files Browse the repository at this point in the history
0.0.2
  • Loading branch information
umjammer authored Nov 21, 2024
2 parents be1e05a + 4b4b31c commit b6afa3b
Show file tree
Hide file tree
Showing 43 changed files with 632 additions and 645 deletions.
21 changes: 16 additions & 5 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ on:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
runs-on: macos-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
Expand All @@ -30,11 +34,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -44,8 +48,15 @@ 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: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven

- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -59,4 +70,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v3
27 changes: 18 additions & 9 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -12,13 +12,22 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: macos-13

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Checkout repository
uses: actions/checkout@v4

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

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

- name: Build with Maven
run: mvn -B package --file pom.xml
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/tmp/
/local.properties
2 changes: 2 additions & 0 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jdk:
- openjdk17
1 change: 1 addition & 0 deletions local.properties.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vavi.test.volume=0.02
78 changes: 68 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,82 @@

<groupId>vavi</groupId>
<artifactId>vavi-sound-nsf</artifactId>
<version>0.0.1</version>
<version>0.0.2</version>

<name>festalon4j</name>
<name>vavi-sound-nsf</name>
<organization>
<name></name>
<name>vavi</name>
</organization>
<url>https://github.com/umjammer/vavi-sound-nsf</url>
<description></description>
<description>nes sound file player spi</description>
<scm>
<url>https://github.com/umjammer/vavi-sound-nsf</url>
</scm>
<issueManagement>
<url>https://github.com/umjammer/vavi-sound-nsf/issues</url>
</issueManagement>

<properties>
<vavi.test.volume>0.02</vavi.test.volume>
</properties>

<profiles>
<profile>
<id>local</id>
<activation>
<file>
<exists>${basedir}/local.properties</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>read-properties</id>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${basedir}/local.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<release>17</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<configuration>
<argLine>
-Djava.util.logging.config.file=${project.build.testOutputDirectory}/logging.properties
<!--
-agentpath:/Applications/VisualVM.app/Contents/Resources/visualvm/visualvm/lib/deployed/jdk16/mac/libprofilerinterface.jnilib=/Applications/VisualVM.app/Contents/Resources/visualvm/visualvm/lib,5140
-->
-Dvavi.test.volume=@{vavi.test.volume}
</argLine>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
</plugins>
Expand All @@ -48,7 +101,7 @@
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.8.1</version>
<version>5.10.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -59,13 +112,13 @@
<dependency>
<groupId>com.github.orangelando</groupId>
<artifactId>nsf</artifactId>
<version>master-SNAPSHOT</version>
<version>master-e567f7716e-1</version>
</dependency>

<dependency>
<groupId>com.github.umjammer</groupId>
<artifactId>vavi-sound</artifactId>
<version>1.0.12</version>
<version>1.0.19</version>
</dependency>

<dependency>
Expand All @@ -78,5 +131,10 @@
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-commons</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
36 changes: 29 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,38 @@
[![Release](https://jitpack.io/v/umjammer/vavi-sound-nsf.svg)](https://jitpack.io/#umjammer/vavi-sound-nsf)
[![Java CI with Maven](https://github.com/umjammer/vavi-sound-nsf/actions/workflows/maven.yml/badge.svg)](https://github.com/umjammer/vavi-sound-nsf/actions/workflows/maven.yml)
[![Java CI](https://github.com/umjammer/vavi-sound-nsf/actions/workflows/maven.yml/badge.svg)](https://github.com/umjammer/vavi-sound-nsf/actions/workflows/maven.yml)
[![CodeQL](https://github.com/umjammer/vavi-sound-nsf/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/umjammer/vavi-sound-nsf/actions/workflows/codeql-analysis.yml)
![Java](https://img.shields.io/badge/Java-17-b07219)

# vavi-sound-nsf

play nsf as `javax.sound.sampled.spi`
<img src="https://github.com/umjammer/vavi-sound-nsf/assets/493908/f9af5c46-ad4b-4e9b-801c-8ac87cf2b669" width=160 alt="nes logo"/><sub><a href="https://www.nintendo.com/">© Nintendo</a></sub>

# TODO
[NSF](https://www.nesdev.org/wiki/NSF) Java Sound SPI powered by [nsf](https://github.com/orangelando/nsf)

* improve decoding speed
## Install

## Originals
* [maven](https://jitpack.io/#umjammer/vavi-sound-nsf)

* [nsf](https://github.com/orangelando/nsf)
* [Festalon](https://github.com/ahefner/festalon)
## Usage

```java
AudioInputStream ais = AudioSystem.getAudioInputStream(Paths.get(nsf).toFile());
Clip clip = AudioSystem.getClip();
clip.open(AudioSystem.getAudioInputStream(new AudioFormat(Encoding.PCM_SIGNED, 44100, 16, 1, 2, 44100, false, props), ais));
clip.loop(Clip.LOOP_CONTINUOUSLY);
```

### properties for target `AudioFormat`

* `track` ... specify track # in the file to play
* `maxPlaySecs` ... specify max play time in \[sec]

## References

* [nsf](https://github.com/orangelando/nsf)
* [Festalon](https://github.com/ahefner/festalon)

## TODO

* ~~improve decoding speed (i7 imac)~~
* on m2 ultra mac no problem
4 changes: 1 addition & 3 deletions src/main/java/vavi/sound/fidlib/CombinedFidFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public CombinedFidFilter(List<FidFilter> filt) {
throw new IllegalArgumentException("expecting IIR+FIR in flattened filter");
}

this.n_buf = this.n_fir > this.n_iir ? this.n_fir : this.n_iir;
this.n_buf = Math.max(this.n_fir, this.n_iir);

// buffer
if (this.magic != 0x64966325) {
Expand All @@ -116,5 +116,3 @@ void fid_run_zapbuf() {
}
}
}

/* */
2 changes: 0 additions & 2 deletions src/main/java/vavi/sound/fidlib/CommandListFidFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -263,5 +263,3 @@ public double filter_step(double val) {
return 0;
}
}

/* */
Loading

0 comments on commit b6afa3b

Please sign in to comment.