Skip to content

Commit 04b66f3

Browse files
authored
Merge pull request #11 from Moros1138/develop
v1.7
2 parents b52b726 + 381d6af commit 04b66f3

8 files changed

+1412
-11
lines changed
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Emscripten Build
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
pull_request:
8+
branches:
9+
- develop
10+
- main
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout source code
18+
uses: actions/checkout@v3
19+
with:
20+
submodules: 'recursive'
21+
22+
- name: Set up Python (required for Emscripten)
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: '3.x'
26+
27+
- name: Install Emscripten SDK
28+
run: |
29+
git clone https://github.com/emscripten-core/emsdk.git
30+
cd emsdk
31+
./emsdk install latest
32+
./emsdk activate latest
33+
source ./emsdk_env.sh
34+
shell: bash
35+
36+
- name: Build with Emscripten
37+
run: |
38+
source emsdk/emsdk_env.sh
39+
cd demo
40+
make emscripten
41+
shell: bash
42+
43+
+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Emscripten Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout source code
14+
uses: actions/checkout@v3
15+
with:
16+
submodules: 'recursive'
17+
18+
- name: Set up Python (required for Emscripten)
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: '3.x'
22+
23+
- name: Install Emscripten SDK
24+
run: |
25+
git clone https://github.com/emscripten-core/emsdk.git
26+
cd emsdk
27+
./emsdk install latest
28+
./emsdk activate latest
29+
source ./emsdk_env.sh
30+
shell: bash
31+
32+
- name: Build with Emscripten
33+
run: |
34+
source emsdk/emsdk_env.sh
35+
cd demo
36+
make emscripten
37+
shell: bash
38+
39+
- name: Deploy Main Demo
40+
uses: appleboy/[email protected]
41+
with:
42+
host: ${{ secrets.REMOTE_SERVER_ADDR }}
43+
username: ${{ secrets.REMOTE_SERVER_USER }}
44+
key: ${{ secrets.REMOTE_SERVER_SSH_KEY }}
45+
port: ${{ secrets.REMOTE_SERVER_PORT }}
46+
source: "demo/demo.html,demo/demo.js,demo/demo.wasm,demo/demo.data"
47+
target: ${{ secrets.REMOTE_SERVER_DIRECTORY }}
48+
strip_components: 1
49+
50+
- name: Deploy Waveform Demo
51+
uses: appleboy/[email protected]
52+
with:
53+
host: ${{ secrets.REMOTE_SERVER_ADDR }}
54+
username: ${{ secrets.REMOTE_SERVER_USER }}
55+
key: ${{ secrets.REMOTE_SERVER_SSH_KEY }}
56+
port: ${{ secrets.REMOTE_SERVER_PORT }}
57+
source: "demo/demo_waveform.html,demo/demo_waveform.js,demo/demo_waveform.wasm,demo/demo_waveform.data"
58+
target: ${{ secrets.REMOTE_SERVER_DIRECTORY }}
59+
strip_components: 1
60+
61+
- name: Deploy Synthesis Demo
62+
uses: appleboy/[email protected]
63+
with:
64+
host: ${{ secrets.REMOTE_SERVER_ADDR }}
65+
username: ${{ secrets.REMOTE_SERVER_USER }}
66+
key: ${{ secrets.REMOTE_SERVER_SSH_KEY }}
67+
port: ${{ secrets.REMOTE_SERVER_PORT }}
68+
source: "demo/demo_synthesis.html,demo/demo_synthesis.js,demo/demo_synthesis.wasm,demo/demo_synthesis.data"
69+
target: ${{ secrets.REMOTE_SERVER_DIRECTORY }}
70+
strip_components: 1

README.md

+18-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ files. Because it's built on top of [miniaudio](https://miniaud.io), it requires
66
to no additional build configurations in order to be built
77
for cross-platform.
88

9-
See the emscripten version [running on the web here](https://www.moros1138.com/demos/olcPGEX_MiniAudio/).
9+
See the emscripten versions of the demos here:
10+
* [Main Demo](https://www.moros1138.com/demos/olcPGEX_MiniAudio/).
11+
* [Waveform Demo](https://www.moros1138.com/demos/olcPGEX_MiniAudio/demo_waveform.html).
12+
* [Synthesis Demo](https://www.moros1138.com/demos/olcPGEX_MiniAudio/demo_synthesis.html).
1013

1114
# This is an olc::PixelGameEngine Extension
1215

@@ -47,9 +50,20 @@ Cross-Platform, out-of-the-box. Easily use in your Linux, Windows, MacOS, and Em
4750
* Get the current position in the sample, in milliseconds.
4851
* Get the current position in the sample, as float 0.0f is start, 1.0f is end.
4952

53+
### Waveform Features
54+
* Create sine, square, sawtooth, and triangle waves.
55+
* Load and play multiple waveform channels at the same time.
56+
* Modify waveform amplitudes, frequencies, and types in realtime.
57+
58+
### Noise Generation Features
59+
* Set a callback function to send and play raw audio data for potential sound synthesis.
60+
* Send raw data for both left and right stereo channels.
61+
* Track passage of audio frame time for oscillators / time-sensitive applications.
62+
5063
*** Advanced Features, for those who want to use more of miniaudio
5164
* Get a pointer to the ma_device
52-
* Get a poitner to the ma_engine
65+
* Get a pointer to the ma_engine
66+
* Get pointers to waveforms and sounds
5367

5468
# Usage
5569

@@ -109,3 +123,5 @@ That's it!
109123
# Acknowledgements
110124

111125
I'd like to give a special thanks for JavidX9 (aka OneLoneCoder), AniCator, JustinRichardsMusic, and everybody else who was a part of that audiophile conversation when I asked for help! Your patience and feedback made this project possible. Thank you!
126+
127+
I'd also like to single out sigonasr2 (Dense Dance 2π) for the waveform functionality and for crafting the demos for them!

demo/Makefile

+33-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
INCLUDE := -I../ -I../third_party/miniaudio -I../third_party/olcPixelGameEngine
2-
GCC_FLAGS := -std=c++17 -O2 -lX11 -lGL -lpthread -lpng -lstdc++fs -std=c++17 -ldl -lm
3-
EM_FLAGS := -std=c++17 -O2 -s ALLOW_MEMORY_GROWTH=1 -s MAX_WEBGL_VERSION=2 -s MIN_WEBGL_VERSION=2 -s USE_LIBPNG=1
2+
GCC_FLAGS := -std=c++20 -O2 -lX11 -lGL -lpthread -lpng -lstdc++fs -ldl -lm
3+
EM_FLAGS := -std=c++20 -O2 -s ALLOW_MEMORY_GROWTH=1 -s MAX_WEBGL_VERSION=2 -s MIN_WEBGL_VERSION=2 -s USE_LIBPNG=1 --shell-file shell.html --preload-file=./assets@assets
44

55
.PHONY: all linux emscripten clean
66

@@ -9,12 +9,39 @@ all: linux emscripten
99
demo: demo.cpp
1010
g++ demo.cpp -o demo ${INCLUDE} ${GCC_FLAGS}
1111

12+
demo_synthesis: demo_synthesis.cpp
13+
g++ demo_synthesis.cpp -o demo_synthesis ${INCLUDE} ${GCC_FLAGS}
14+
15+
demo_waveform: demo_waveform.cpp
16+
g++ demo_waveform.cpp -o demo_waveform ${INCLUDE} ${GCC_FLAGS}
17+
1218
demo.html: demo.cpp
13-
em++ demo.cpp -o demo.html ${INCLUDE} ${EM_FLAGS} --preload-file=./assets@assets
19+
em++ demo.cpp -o demo.html ${INCLUDE} ${EM_FLAGS}
20+
21+
demo_synthesis.html: demo_synthesis.cpp
22+
em++ demo_synthesis.cpp -o demo_synthesis.html ${INCLUDE} ${EM_FLAGS}
23+
24+
demo_waveform.html: demo.cpp
25+
em++ demo_waveform.cpp -o demo_waveform.html ${INCLUDE} ${EM_FLAGS}
1426

15-
linux: demo
27+
linux: demo demo_synthesis demo_waveform
1628

17-
emscripten: demo.html
29+
emscripten: demo.html demo_synthesis.html demo_waveform.html
1830

1931
clean:
20-
@rm -f demo demo.html demo.js demo.wasm demo.data
32+
@rm -f \
33+
demo \
34+
demo.html \
35+
demo.js \
36+
demo.wasm \
37+
demo.data \
38+
demo_synthesis \
39+
demo_synthesis.html \
40+
demo_synthesis.js \
41+
demo_synthesis.wasm \
42+
demo_synthesis.data \
43+
demo_waveform \
44+
demo_waveform.html \
45+
demo_waveform.js \
46+
demo_waveform.wasm \
47+
demo_waveform.data

0 commit comments

Comments
 (0)