Skip to content

Commit 4a39a34

Browse files
authored
Merge pull request #1 from jameshball/initial-version
Add fundamental files from osci-render
2 parents ccbf5d3 + 7cf6c3c commit 4a39a34

27 files changed

+2050
-19
lines changed

.github/FUNDING.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: jameshball
2+
custom: paypal.me/jameshball

.github/workflows/RELEASE.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
See the [changelog](https://github.com/jameshball/patchable/blob/master/src/main/resources/CHANGELOG.md) for changes to this version.
2+
3+
Please report any bugs or issues on GitHub or by emailing me at [[email protected]](mailto:[email protected]).
4+
5+
I'm always open to feedback and feature requests, so please reach out!

.github/workflows/release.yml

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Maven Package and Release patchable
2+
3+
on:
4+
push:
5+
branches: [ release ]
6+
7+
jobs:
8+
build-windows:
9+
10+
runs-on: windows-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Set up JDK 19
15+
uses: actions/setup-java@v2
16+
with:
17+
java-version: '19'
18+
distribution: 'adopt'
19+
- name: Build with Maven
20+
run: |
21+
mvn -B package
22+
mvn -B jpackage:jpackage@win
23+
$version= mvn help:evaluate -Dexpression="project.version" -q -DforceStdout
24+
echo "VERSION=$version" >> $env:GITHUB_ENV
25+
mv "target/lib/patchable-$version.jar" "target/lib/patchable-win-$version.jar"
26+
ls target/lib/
27+
- name: Release
28+
uses: softprops/action-gh-release@v1
29+
with:
30+
body_path: .github/workflows/RELEASE.md
31+
tag_name: v${{ env.VERSION }}
32+
files: |
33+
target/lib/patchable-${{ env.VERSION }}.exe
34+
target/lib/patchable-win-${{ env.VERSION }}.jar
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
GITHUB_REPOSITORY: jameshball/patchable
38+
39+
build-debian:
40+
41+
runs-on: ubuntu-latest
42+
43+
steps:
44+
- uses: actions/checkout@v2
45+
- name: Set up JDK 19
46+
uses: actions/setup-java@v2
47+
with:
48+
java-version: '19'
49+
distribution: 'adopt'
50+
- name: Build with Maven
51+
run: |
52+
mvn -B package
53+
mvn -B jpackage:jpackage@debian
54+
version=$(mvn help:evaluate -Dexpression="project.version" -q -DforceStdout)
55+
echo "VERSION=$version" >> $GITHUB_ENV
56+
mv target/lib/patchable-$version.jar target/lib/patchable-unix-$version.jar
57+
ls target/lib/
58+
- name: Release
59+
uses: softprops/action-gh-release@v1
60+
with:
61+
tag_name: v${{ env.VERSION }}
62+
files: |
63+
target/lib/patchable_${{ env.VERSION }}-1_amd64.deb
64+
target/lib/patchable-unix-${{ env.VERSION }}.jar
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
GITHUB_REPOSITORY: jameshball/patchable
68+
69+
build-mac:
70+
71+
runs-on: macos-latest
72+
73+
steps:
74+
- uses: actions/checkout@v2
75+
- name: Set up JDK 19
76+
uses: actions/setup-java@v2
77+
with:
78+
java-version: '19'
79+
distribution: 'adopt'
80+
- name: Build with Maven
81+
run: |
82+
mvn -B package
83+
mvn -B jpackage:jpackage@mac
84+
version=$(mvn help:evaluate -Dexpression="project.version" -q -DforceStdout)
85+
echo "VERSION=$version" >> $GITHUB_ENV
86+
mv target/lib/patchable-$version.jar target/lib/patchable-mac-$version.jar
87+
ls target/lib/
88+
- name: Release
89+
uses: softprops/action-gh-release@v1
90+
with:
91+
tag_name: v${{ env.VERSION }}
92+
files: |
93+
target/lib/patchable-${{ env.VERSION }}.pkg
94+
target/lib/patchable-mac-${{ env.VERSION }}.jar
95+
env:
96+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97+
GITHUB_REPOSITORY: jameshball/patchable

.gitignore

+13-19
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
1-
# Compiled class file
2-
*.class
3-
4-
# Log file
1+
/target
2+
/.idea
3+
/logs
4+
osci-render.iml
5+
*.osci
56
*.log
7+
.DS_Store
68

7-
# BlueJ files
8-
*.ctxt
9-
10-
# Mobile Tools for Java (J2ME)
11-
.mtj.tmp/
9+
# ignore temporary files
10+
*~
1211

13-
# Package Files #
14-
*.jar
15-
*.war
16-
*.nar
17-
*.ear
18-
*.zip
19-
*.tar.gz
20-
*.rar
12+
# Ignore local binaries for xt-audio
13+
/win32-x64
2114

22-
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23-
hs_err_pid*
15+
# Ignore any .wav file output
16+
*.wav
17+
/out/

pom.xml

+214
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>sh.ball</groupId>
8+
<artifactId>patchable</artifactId>
9+
<version>0.0.0</version>
10+
11+
<name>patchable</name>
12+
13+
<properties>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
<maven.compiler.release>19</maven.compiler.release>
16+
<javafx.version>19</javafx.version>
17+
<appMainClass>sh.ball.gui.Launcher</appMainClass>
18+
</properties>
19+
20+
<build>
21+
<plugins>
22+
<plugin>
23+
<artifactId>maven-clean-plugin</artifactId>
24+
<version>2.4.1</version>
25+
<executions>
26+
<execution>
27+
<id>auto-clean</id>
28+
<phase>initialize</phase>
29+
<goals>
30+
<goal>clean</goal>
31+
</goals>
32+
</execution>
33+
</executions>
34+
</plugin>
35+
<plugin>
36+
<artifactId>maven-jar-plugin</artifactId>
37+
<version>3.2.0</version>
38+
<executions>
39+
<execution>
40+
<id>default-jar</id>
41+
<phase>none</phase>
42+
<configuration>
43+
<finalName>unwanted</finalName>
44+
<classifier>unwanted</classifier>
45+
</configuration>
46+
</execution>
47+
</executions>
48+
</plugin>
49+
<plugin>
50+
<artifactId>maven-assembly-plugin</artifactId>
51+
<configuration>
52+
<archive>
53+
<manifest>
54+
<mainClass>${appMainClass}</mainClass>
55+
</manifest>
56+
</archive>
57+
<descriptorRefs>
58+
<descriptorRef>jar-with-dependencies</descriptorRef>
59+
</descriptorRefs>
60+
<appendAssemblyId>false</appendAssemblyId>
61+
<outputDirectory>${project.build.directory}/lib</outputDirectory>
62+
</configuration>
63+
<executions>
64+
<execution>
65+
<id>make-assembly</id>
66+
<phase>package</phase>
67+
<goals>
68+
<goal>single</goal>
69+
</goals>
70+
</execution>
71+
</executions>
72+
</plugin>
73+
<plugin>
74+
<groupId>org.apache.maven.plugins</groupId>
75+
<artifactId>maven-compiler-plugin</artifactId>
76+
<version>3.8.1</version>
77+
<configuration>
78+
<source>${maven.compiler.release}</source>
79+
<target>${maven.compiler.release}</target>
80+
</configuration>
81+
</plugin>
82+
<plugin>
83+
<groupId>org.panteleyev</groupId>
84+
<artifactId>jpackage-maven-plugin</artifactId>
85+
<version>1.4.0</version>
86+
87+
<configuration>
88+
<name>patchable</name>
89+
<description>patchable</description>
90+
<appVersion>${project.version}</appVersion>
91+
<vendor>james.ball.sh</vendor>
92+
<input>${project.build.directory}/lib</input>
93+
<mainJar>patchable-${project.version}.jar</mainJar>
94+
<mainClass>${appMainClass}</mainClass>
95+
<destination>${project.build.directory}/lib</destination>
96+
<javaOptions>
97+
<option>-Dfile.encoding=UTF-8</option>
98+
</javaOptions>
99+
</configuration>
100+
101+
<executions>
102+
<execution>
103+
<id>win</id>
104+
<configuration>
105+
<winMenu>true</winMenu>
106+
<winMenuGroup>patchable</winMenuGroup>
107+
</configuration>
108+
</execution>
109+
<execution>
110+
<id>debian</id>
111+
</execution>
112+
<execution>
113+
<id>mac</id>
114+
<configuration>
115+
<type>PKG</type>
116+
<macPackageName>patchable</macPackageName>
117+
<macBundleIdentifier>Patchable-${project.version}</macBundleIdentifier>
118+
<macBundleName>patchable</macBundleName>
119+
</configuration>
120+
</execution>
121+
</executions>
122+
</plugin>
123+
</plugins>
124+
</build>
125+
<repositories>
126+
<repository>
127+
<id>jitpack.io</id>
128+
<name>jitpack</name>
129+
<url>https://jitpack.io</url>
130+
</repository>
131+
</repositories>
132+
<dependencies>
133+
<!-- https://sjoerdvankreel.github.io/xt-audio/ -->
134+
<dependency>
135+
<groupId>com.github.sjoerdvankreel</groupId>
136+
<artifactId>xt.audio</artifactId>
137+
<version>2.0</version>
138+
</dependency>
139+
<dependency>
140+
<groupId>org.openjfx</groupId>
141+
<artifactId>javafx-fxml</artifactId>
142+
<version>${javafx.version}</version>
143+
</dependency>
144+
<dependency>
145+
<groupId>org.openjfx</groupId>
146+
<artifactId>javafx-controls</artifactId>
147+
<version>${javafx.version}</version>
148+
</dependency>
149+
<dependency>
150+
<groupId>org.openjfx</groupId>
151+
<artifactId>javafx-web</artifactId>
152+
<version>${javafx.version}</version>
153+
</dependency>
154+
<!-- https://mvnrepository.com/artifact/com.github.axet/TarsosDSP -->
155+
<dependency>
156+
<groupId>com.github.axet</groupId>
157+
<artifactId>TarsosDSP</artifactId>
158+
<version>2.4-1</version>
159+
</dependency>
160+
</dependencies>
161+
<profiles>
162+
<profile>
163+
<id>win</id>
164+
165+
<activation>
166+
<os><family>windows</family></os>
167+
</activation>
168+
169+
<dependencies>
170+
<dependency>
171+
<groupId>org.openjfx</groupId>
172+
<artifactId>javafx-graphics </artifactId>
173+
<version>${javafx.version}</version>
174+
<classifier>win</classifier>
175+
</dependency>
176+
</dependencies>
177+
</profile>
178+
179+
<profile>
180+
<id>mac</id>
181+
182+
<activation>
183+
<os><family>mac</family></os>
184+
</activation>
185+
186+
<dependencies>
187+
<dependency>
188+
<groupId>org.openjfx</groupId>
189+
<artifactId>javafx-graphics </artifactId>
190+
<version>${javafx.version}</version>
191+
<classifier>mac</classifier>
192+
</dependency>
193+
</dependencies>
194+
</profile>
195+
196+
<profile>
197+
<id>linux</id>
198+
199+
<activation>
200+
<os><family>unix</family></os>
201+
</activation>
202+
203+
<dependencies>
204+
<dependency>
205+
<groupId>org.openjfx</groupId>
206+
<artifactId>javafx-graphics </artifactId>
207+
<version>${javafx.version}</version>
208+
<classifier>linux</classifier>
209+
</dependency>
210+
</dependencies>
211+
</profile>
212+
213+
</profiles>
214+
</project>
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package sh.ball.audio;
2+
3+
import sh.ball.audio.engine.AudioDevice;
4+
5+
public class AudioUtil {
6+
private static final int MIN_FRAME_LATENCY = 512;
7+
8+
public static int calculateBufferSize(int sampleRate, int frameSize, int latencyMs) {
9+
return Math.max((int) (sampleRate * latencyMs * 0.0005), MIN_FRAME_LATENCY) * frameSize;
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package sh.ball.audio.engine;
2+
3+
import javax.sound.sampled.Mixer;
4+
5+
public interface AudioDevice {
6+
String id();
7+
8+
String name();
9+
10+
int sampleRate();
11+
12+
AudioSample sample();
13+
14+
int channels();
15+
16+
Mixer.Info mixerInfo();
17+
18+
boolean output();
19+
}

0 commit comments

Comments
 (0)