Skip to content

Commit 897b211

Browse files
committed
feat: Implement FFmpeg codecs, MIDI, Metadata, and Synthesis engine (#97)
This major update introduces pluggable codecs, full MIDI support, a synthesis engine, and robust metadata handling. Codecs: - Create `SoundFlow.Codecs.FFMpeg` wrapping native FFmpeg libraries. - Implement `ICodecFactory` architecture in `AudioEngine` to support dynamic codec registration. - Add support for decoding/encoding MP3, AAC, OGG, FLAC, and ALAC, as well as codecs like AC3, Opus, and PCM, and more using FFmpeg. MIDI & Synthesis: - Create `SoundFlow.Midi.PortMidi` for cross-platform MIDI I/O. - Implement `MidiManager`, `MidiTrack`, `MidiSegment`, and a routing graph for MIDI signals. - Add `Synthesizer` component with polyphonic `Voice` architecture. - Implement SoundFont 2 (.sf2) parsing and playback via `SoundFontBank`. - Add MPE (MIDI Polyphonic Expression) support. - Add `ArpeggiatorModifier`, `Sequencer`, and `MidiRecorder`. Metadata: - Implement `SoundMetadataReader` and `SoundMetadataWriter`. - Add support for reading/writing ID3v2, Vorbis Comments, RIFF chunks, and MP4/M4A atoms. - Refactor `AssetDataProvider` and `StreamDataProvider` to auto-detect formats via metadata headers. Core & Utils: - Add `ChannelMixer` with SIMD (AVX/SSE) acceleration. - Add centralized `Log` utility. - Add `[ControllableParameter]` attribute for real-time MIDI mapping system (`MidiMappingManager`). - Update `CompositionProjectManager` to persist MIDI tracks, mappings, and tempo maps. - Add error handling to miniaudio audio-thread callbacks and logging, to prevent crashes. Native: - Restructure `Native` directory into isolated backend projects. - Add CMake build scripts for `ffmpeg-codec` and `portmidi`. - Add .targets files for correct native binary distribution in NuGet.
1 parent f6fff53 commit 897b211

File tree

290 files changed

+24190
-2217
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

290 files changed

+24190
-2217
lines changed

.github/FUNDING.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# These are supported funding model platforms
22

33
github: LSXPrime
4-
custom: ["https://airtm.me/lsxprime", "https://app.binance.com/qr/dplk0837ff4256a64749a2b10dfe3ea5a0b9"]
4+
ko_fi: lsxprime
5+
custom: ["https://airtm.me/lsxprime"]

.github/workflows/build-extensions-apm.yml

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
name: Build WebRTC Audio Processing
22

33
on:
4-
push:
5-
paths:
6-
- 'Extensions/SoundFlow.Extensions.WebRtc.Apm/Native/**'
4+
workflow_dispatch:
75

86
jobs:
97
build:
@@ -141,7 +139,6 @@ jobs:
141139
elif [ "${{ matrix.rid }}" == "linux-arm64" ]; then
142140
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu
143141
fi
144-
145142
# Android setup
146143
- name: Set up Android NDK
147144
if: matrix.platform == 'Android'
@@ -157,7 +154,6 @@ jobs:
157154
run: |
158155
echo "NDK_ROOT=${{ steps.setup-ndk.outputs.ndk-path }}" >> $GITHUB_ENV
159156
echo "TOOLCHAIN_ROOT=${NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64" >> $GITHUB_ENV
160-
161157
# Print the NDK Root
162158
- name: Print NDK Root
163159
if: matrix.platform == 'Android'
@@ -168,14 +164,11 @@ jobs:
168164
# List contents of the build directory before copying
169165
echo "Listing contents of Toolchain: $TOOLCHAIN_ROOT"
170166
ls -l "/opt/hostedtoolcache/ndk/r26d/x64/toolchains/llvm/prebuilt/linux-x86_64/bin/"
171-
172-
173167
- name: Install Xcode Command Line Tools (iOS)
174168
if: matrix.platform == 'iOS'
175169
run: |
176170
xcode-select --install || true
177171
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
178-
179172
# Install Homebrew LLVM for iOS builds
180173
- name: Install Homebrew LLVM (IOS)
181174
if: matrix.platform == 'iOS'
@@ -185,12 +178,11 @@ jobs:
185178
echo "/opt/homebrew/opt/llvm/bin" >> $GITHUB_PATH
186179
echo "/opt/homebrew/opt/llvm/lib" >> $GITHUB_PATH
187180
echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> /Users/runner/.bash_profile
188-
189181
# Configure Meson
190182
- name: Configure Meson
191183
shell: bash
192184
run: |
193-
cd Extensions/SoundFlow.Extensions.WebRtc.Apm/Native/
185+
cd Native/webrtc-audio-processing/
194186
BUILD_DIR="build_${{ matrix.rid }}"
195187
EXTRA_ARGS="--buildtype=release"
196188

@@ -199,19 +191,17 @@ jobs:
199191
else
200192
meson setup $BUILD_DIR $EXTRA_ARGS
201193
fi
202-
203194
- name: Build with Ninja
204195
shell: bash
205196
run: |
206-
cd Extensions/SoundFlow.Extensions.WebRtc.Apm/Native/
197+
cd Native/webrtc-audio-processing/
207198
BUILD_DIR="build_${{ matrix.rid }}"
208199
ninja -C $BUILD_DIR
209-
210200
# Package the artifacts
211201
- name: Copy and rename artifacts
212202
shell: bash
213203
run: |
214-
cd Extensions/SoundFlow.Extensions.WebRtc.Apm/Native/
204+
cd Native/webrtc-audio-processing/
215205
BUILD_DIR="build_${{ matrix.rid }}/webrtc/modules/audio_processing"
216206
OUTPUT_DIR="runtimes/${{ matrix.rid }}/native"
217207

@@ -230,84 +220,75 @@ jobs:
230220

231221
echo "Copied artifact to:"
232222
ls -l "$OUTPUT_DIR"
233-
234223
# Dependency analysis
235224
- name: Analyze Dependencies (Windows)
236225
if: matrix.platform == 'Windows'
237226
shell: bash
238227
run: |
239-
cd Extensions/SoundFlow.Extensions.WebRtc.Apm/Native/
228+
cd Native/webrtc-audio-processing/
240229
echo "Dependencies for Windows (MinGW):"
241230
objdump -p "runtimes/${{ matrix.rid }}/native/webrtc-apm.dll" | grep "DLL Name:"
242231
echo "Imported symbols:"
243232
nm -g "runtimes/${{ matrix.rid }}/native/webrtc-apm.dll" | grep " T "
244-
245233
- name: Analyze Dependencies (Linux)
246234
if: matrix.os == 'ubuntu-latest' && matrix.platform == 'Linux'
247235
shell: bash
248236
run: |
249-
cd Extensions/SoundFlow.Extensions.WebRtc.Apm/Native/
237+
cd Native/webrtc-audio-processing/
250238
LIB_PATH="runtimes/${{ matrix.rid }}/native/libwebrtc-apm.so"
251239
echo "=== Library Information ==="
252240
file "$LIB_PATH"
253-
254241
echo -e "\n=== Dependencies ==="
255242
if [[ "${{ matrix.arch }}" == "x86_64" ]]; then
256243
ldd "$LIB_PATH" || true
257244
else
258245
# For ARM architectures, use readelf instead of ldd
259246
readelf -d "$LIB_PATH" | grep "NEEDED" || true
260247
fi
261-
262248
echo -e "\n=== Symbols ==="
263249
if [[ "${{ matrix.arch }}" == "x86_64" || "${{ matrix.arch }}" == "aarch64" ]]; then
264250
nm -g "$LIB_PATH" | grep " T " || true
265251
else
266252
# For armv7l, use the correct cross-arch nm
267253
arm-linux-gnueabihf-nm -g "$LIB_PATH" | grep " T " || true
268254
fi
269-
270255
echo -e "\n=== SONAME ==="
271256
readelf -d "$LIB_PATH" | grep "SONAME" || true
272-
273257
- name: Analyze Dependencies (Android)
274258
if: matrix.platform == 'Android'
275259
shell: bash
276260
run: |
277-
cd Extensions/SoundFlow.Extensions.WebRtc.Apm/Native/
261+
cd Native/webrtc-audio-processing/
278262
LIB_PATH="runtimes/${{ matrix.rid }}/native/libwebrtc-apm.so"
279263
echo "Dependencies for Android:"
280264
readelf -d "$LIB_PATH"
281265
echo "Symbols:"
282266
nm -g "$LIB_PATH" | grep " T "
283-
284267
- name: Analyze Dependencies (macOS)
285268
if: matrix.os == 'macos-latest' && matrix.platform == 'macOS'
286269
shell: bash
287270
run: |
288-
cd Extensions/SoundFlow.Extensions.WebRtc.Apm/Native/
271+
cd Native/webrtc-audio-processing/
289272
LIB_PATH="runtimes/${{ matrix.rid }}/native/libwebrtc-apm.dylib"
290273
echo "Dependencies for macOS:"
291274
otool -L "$LIB_PATH"
292275
echo "Symbols:"
293276
nm -g "$LIB_PATH" | grep " T "
294-
295277
- name: Analyze Dependencies (iOS)
296278
if: matrix.platform == 'iOS'
297279
shell: bash
298280
run: |
299-
cd Extensions/SoundFlow.Extensions.WebRtc.Apm/Native/
281+
cd Native/webrtc-audio-processing/
300282
LIB_PATH="runtimes/${{ matrix.rid }}/native/libwebrtc-apm.dylib"
301283
echo "Dependencies for iOS:"
302284
otool -L "$LIB_PATH"
303285
echo "Symbols:"
304286
nm -g "$LIB_PATH" | grep " T "
305-
306287
- name: Upload Artifact
307288
uses: actions/upload-artifact@v4
308289
with:
309290
name: ${{ matrix.rid }}
310-
path: Extensions/SoundFlow.Extensions.WebRtc.Apm/Native/runtimes/${{ matrix.rid }}
291+
path: Native/webrtc-audio-processing/runtimes/${{ matrix.rid }}
311292

312293
package:
313294
needs: build
@@ -323,7 +304,6 @@ jobs:
323304
mkdir -p runtimes
324305
cp -r artifacts/* runtimes/
325306
zip -r webrtc-audio-processing.zip runtimes
326-
327307
- name: Upload final package
328308
uses: actions/upload-artifact@v4
329309
with:

0 commit comments

Comments
 (0)