Skip to content

Commit bf79329

Browse files
committed
refactor: Rework core playback, backend, and add APM extension
Implement fractional sample rate playback, improve device handling, add the WebRTC Audio Processing Module (APM) as an extension. This commit introduces significant changes across multiple areas: - Core Engine Playback (`SoundPlayerBase`): - Reworked audio generation logic to use fractional sample position. - Implemented robust linear interpolation for flexible playback speed. - Improved buffering and seek handling for better audio continuity, accuracy and fix distortions. - Made `CreateEncoder` and `CreateDecoder` public on `AudioEngine`. - MiniAudio Backend (`MiniAudioEngine`, `Native`): - Refactored device initialization and switching to handle both playback and capture devices simultaneously. - Added `SwitchDevices` method for changing both devices at once. - Configured miniaudio device init for low latency and disabled WASAPI SRC auto-conversion. - Fixed issues in device enumeration info handling. - WebRTC APM Extension (`SoundFlow.Extensions.WebRtc.Apm`): - Added a new extension package integrating the WebRTC Audio Processing Module. - Provides `WebRtcApmModifier` for real-time processing (AEC, NS, AGC, HPF, Pre-Amp). - Includes `NoiseSuppressor` component for offline/batch noise suppression. - Added necessary native libraries for cross-platform support via runtimes. - Build System and CI (`.github/workflows`, `Native/CMakeLists.txt`, `Src/SoundFlow.targets`): - Overhauled GitHub Actions workflow for native library builds, simplifying Windows setup and standardizing artifact handling. - Added `.targets` files for improved NuGet package native library distribution. - Updated native CMake build files for better platform targeting and project structure. - Other Improvements: - Refactored Algorithmic Reverb modifier for improved robustness and clarity. - Added `IDisposable` interface to `ISoundDataProvider` and implemented it across built-in providers. - Added `Volume` property to `ISoundPlayer`. - Added new utility math functions (`Mod`, `PrincipalAngle`). - Added a new sample project (`SoundFlow.Samples.NoiseSuppression`) and updated existing samples. - Added GitHub issue templates for structured bug reports, feature requests, etc.
1 parent ab5dfd1 commit bf79329

File tree

744 files changed

+114210
-540
lines changed

Some content is hidden

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

744 files changed

+114210
-540
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
name: "\U0001F41B Bug Report"
3+
about: Create a report to help us improve SoundFlow
4+
title: "[BUG] Brief description of the bug"
5+
labels: bug, documentation
6+
assignees: ''
7+
8+
---
9+
10+
**Thank you for reporting a bug! To help us understand and fix the issue, please provide the following information:**
11+
12+
**Requirements:**
13+
* [ ] I have searched the existing issues to ensure this bug has not already been reported.
14+
* [ ] I have provided a clear and concise description of the bug.
15+
* [ ] I have provided detailed steps to reproduce the bug.
16+
* [ ] I have included a minimal reproducible example (MRE) if applicable.
17+
* [ ] I have provided error messages and stack traces if applicable.
18+
* [ ] I have completed the environment information.
19+
20+
**1. Describe the Bug**
21+
22+
A clear and concise description of what the bug is.
23+
24+
**2. Steps to Reproduce**
25+
26+
Please provide detailed steps to reproduce the behavior:
27+
1. Go to '...'
28+
2. Call method '....' with parameters '....'
29+
3. Configure component '....' with settings '....'
30+
4. See error / Observe unexpected behavior
31+
32+
**3. Expected Behavior**
33+
34+
A clear and concise description of what you expected to happen.
35+
36+
**4. Current Behavior**
37+
38+
A clear and concise description of what actually happens.
39+
40+
**5. Minimal Reproducible Example (MRE)**
41+
42+
Please provide a *minimal* code snippet that demonstrates the bug. This is crucial for us to quickly identify and fix the issue.
43+
If the code is too long, please link to a Gist or a small repository.
44+
45+
```csharp
46+
// Your MRE code here
47+
```
48+
49+
**6. Error Messages and Stack Trace (if applicable)**
50+
51+
If an exception is thrown, please paste the full error message and stack trace below.
52+
53+
```
54+
(Paste full error message and stack trace here)
55+
```
56+
57+
**7. Environment (please complete the following information):**
58+
* **SoundFlow Version:** [e.g., 1.0.0, or commit SHA if building from source]
59+
* **.NET Version:** [e.g., .NET 8.0, .NET 9.0]
60+
* **Operating System:** [e.g., Windows 11, macOS Sonoma 14.2, Ubuntu 22.04]
61+
* **Architecture:** [e.g., x64, ARM64]
62+
* **Audio Backend Used (if known):** [e.g., WASAPI, CoreAudio, etc.]
63+
* **Specific Audio Hardware (if relevant):** [e.g., Realtek HD Audio, Focusrite Scarlett 2i2]
64+
65+
**8. Affected Components/Modules (if known)**
66+
67+
List any specific SoundFlow components, modifiers, providers, or extensions you believe are related to this bug.
68+
* [e.g., `SoundPlayer`, `WebRtcApmModifier`, `MiniAudioDecoder`, `NetworkDataProvider`]
69+
70+
**9. Impact**
71+
72+
Describe the impact of this bug (e.g., crash, incorrect audio output, performance degradation, minor inconvenience).
73+
74+
**10. Possible Workaround (if known)**
75+
76+
If you've found a way to work around the issue, please describe it.
77+
78+
**11. Additional Context**
79+
80+
Add any other context about the problem here.
81+
* Were there any recent changes to your environment or the library version?
82+
* Is this bug consistently reproducible, or does it happen intermittently?
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
name: "\U0001F4D6 Documentation Issue"
3+
about: Report an issue or suggest an improvement for the documentation
4+
title: "[DOCS] Brief description of the documentation issue"
5+
labels: documentation
6+
assignees: ''
7+
8+
---
9+
10+
**Thank you for helping us improve the SoundFlow documentation!**
11+
12+
**Requirements:**
13+
* [ ] I have searched the existing issues to ensure this documentation issue has not already been reported.
14+
* [ ] I have clearly identified the affected documentation.
15+
* [ ] I have described the problem and proposed a clear improvement.
16+
17+
**1. Affected Page/Section**
18+
19+
Please provide the URL or a clear description of the documentation page or section that has an issue.
20+
* URL (if applicable):
21+
* Section/Topic: [e.g., "SoundPlayer Looping", "WebRtcApmModifier Configuration", "API reference for Mixer.AddComponent"]
22+
23+
**2. Describe the Issue**
24+
25+
A clear and concise description of what is wrong with the current documentation.
26+
* Is something missing?
27+
* Is something unclear or confusing?
28+
* Is something incorrect or outdated?
29+
* Are there typos or grammatical errors?
30+
31+
**3. Suggested Improvement**
32+
33+
Please describe how the documentation could be improved.
34+
* What information should be added, changed, or removed?
35+
* Provide a corrected version if possible.
36+
37+
**4. Why is this Improvement Important?**
38+
39+
Explain how this change would make the documentation better or easier to understand for users.
40+
41+
**5. Code Examples (if relevant)**
42+
43+
If the documentation issue relates to code examples, please provide the problematic example and/or a corrected/improved version.
44+
45+
**Current Example (if applicable):**
46+
```csharp
47+
// Problematic code example
48+
```
49+
50+
**Suggested Example (if applicable):**
51+
```csharp
52+
// Improved code example
53+
```
54+
55+
**6. Additional Context**
56+
57+
Add any other relevant information, screenshots, or links.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
name: "✨ Feature Request"
3+
about: Suggest an idea or enhancement for SoundFlow
4+
title: "[FEAT] Brief description of the feature"
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Thank you for suggesting a feature! We appreciate your input.**
11+
12+
**Requirements:**
13+
* [ ] I have searched the existing issues to ensure this feature has not already been requested.
14+
* [ ] I have clearly described the problem and the proposed solution.
15+
* [ ] I have considered alternative solutions.
16+
17+
**1. Is your feature request related to a problem? Please describe.**
18+
19+
A clear and concise description of what the problem is.
20+
21+
*Example: I'm always frustrated when [...] because [...] and I would like to be able to [...]*
22+
23+
**2. Describe the Solution You'd Like**
24+
25+
A clear and concise description of what you want to happen.
26+
* What is the desired behavior?
27+
* How would this feature be used? (e.g., API examples, new component, modification to existing one)
28+
29+
**3. Describe Alternatives You've Considered**
30+
31+
A clear and concise description of any alternative solutions or features you've considered.
32+
* Why were they not suitable?
33+
34+
**4. Proposed API (if applicable)**
35+
36+
If this involves new or changed API, please provide a sketch of how it might look.
37+
```csharp
38+
// public class NewComponent : SoundComponent { ... }
39+
// public void ExistingComponent.NewMethod(ParameterType param) { ... }
40+
```
41+
42+
**5. Benefits**
43+
44+
What are the benefits of implementing this feature?
45+
* Who would benefit from this?
46+
* How would it improve SoundFlow?
47+
48+
**6. Potential Drawbacks/Challenges**
49+
50+
Are there any potential downsides or implementation challenges you foresee?
51+
52+
**7. Additional Context**
53+
54+
Add any other context, examples, mockups, or links to relevant resources or similar features in other libraries.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
name: "⏱️ Performance Issue"
3+
about: Report a performance problem with SoundFlow
4+
title: "[PERF] Brief description of the performance issue"
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Thank you for reporting a performance issue! Accurate details are key to helping us optimize SoundFlow.**
11+
12+
**1. Describe the Performance Issue**
13+
14+
A clear and concise description of the performance problem.
15+
* Is it high CPU usage, high memory consumption, audio stuttering/glitches, slow initialization, etc.?
16+
17+
**2. Area of the Library Affected**
18+
19+
Which part of SoundFlow seems to be causing the performance issue?
20+
* [e.g., `SoundPlayer` with many instances, a specific `SoundModifier`, `MiniAudioEngine` processing, `NetworkDataProvider` streaming]
21+
22+
**3. Scenario Causing Slowness**
23+
24+
Describe the specific scenario or operations that trigger the performance problem.
25+
* Please provide steps if possible.
26+
27+
**4. Expected Performance**
28+
29+
What level of performance were you expecting in this scenario?
30+
* [e.g., "CPU usage below 10%", "No audible glitches", "Modifier should process X samples in Y ms"]
31+
32+
**5. Actual Performance**
33+
34+
Describe the observed performance. Provide metrics if possible:
35+
* **CPU Usage:** [e.g., "Sustained 80% on one core", "Spikes to 100%"]
36+
* **Memory Usage:** [e.g., "Increases by 100MB per minute", "Consumes 2GB RAM"]
37+
* **Latency/Glitches:** [e.g., "Audio stutters every 5 seconds", "Noticeable delay in processing"]
38+
* **Timing:** [e.g., "Method X takes 500ms to complete for a 1s buffer"]
39+
40+
**6. Minimal Reproducible Example (MRE) (Highly Recommended)**
41+
42+
Please provide a *minimal* code snippet that demonstrates the performance issue. This is extremely helpful.
43+
```csharp
44+
// Your MRE code here
45+
```
46+
47+
**7. Profiling Data (if available)**
48+
49+
If you have run a profiler (e.g., dotTrace, PerfView, Visual Studio Profiler), please share:
50+
* Screenshots of hot paths.
51+
* Exported profiling sessions (if shareable).
52+
* Key findings from the profiler.
53+
54+
**8. Environment (please complete the following information):**
55+
* **SoundFlow Version:** [e.g., 1.0.0, or commit SHA]
56+
* **.NET Version:** [e.g., .NET 8.0]
57+
* **Operating System:** [e.g., Windows 11, macOS Sonoma, Ubuntu 22.04]
58+
* **Architecture:** [e.g., x64, ARM64]
59+
* **Audio Backend Used (if known):** [e.g., MiniAudioEngine with WASAPI, CoreAudio, ALSA]
60+
* **Specific Audio Hardware (if relevant):** [e.g., CPU model, RAM amount, Audio Interface model]
61+
* **Audio Buffer Size / Sample Rate:** [e.g., 480 samples / 48000 Hz]
62+
63+
**9. Additional Context**
64+
65+
Add any other relevant information.
66+
* Does the issue scale with input size, number of components, etc.?
67+
* Have you tried different configurations or settings?
68+
69+
**Requirements:**
70+
* [ ] I have searched the existing issues to ensure this performance issue has not already been reported.
71+
* [ ] I have provided a clear description of the issue and the scenario.
72+
* [ ] I have included performance metrics if possible.
73+
* [ ] I have considered providing an MRE.
74+
* [ ] I have completed the environment information.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
name: "\U0001F4BB Platform Specific Issue"
3+
about: Report an issue that only occurs on specific platforms or environments
4+
title: "[PLAT] Brief description of the platform-specific issue"
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Thank you for reporting a platform-specific issue! This helps us ensure SoundFlow works well everywhere.**
11+
12+
**1. Affected Platform(s)**
13+
14+
Please specify the platform(s) where this issue occurs. Be as specific as possible.
15+
* **Operating System & Version:** [e.g., Windows 10 Pro 22H2, macOS Monterey 12.5, Ubuntu 20.04 LTS]
16+
* **Architecture:** [e.g., x64, ARM64, x86]
17+
* **.NET Runtime & Version:** [e.g., .NET Core 3.1, .NET 7, Mono 6.12]
18+
* **Audio Backend Used (if known):** [e.g., MiniAudioEngine with WASAPI, CoreAudio, ALSA]
19+
* **Specific Hardware (if relevant):** [e.g., M1 Mac, Raspberry Pi 4, specific sound card model]
20+
21+
**2. Description of the Issue**
22+
23+
A clear and concise description of the problem as it manifests on the affected platform(s).
24+
* How does the behavior differ from other platforms (if you've tested)?
25+
26+
**3. Does it work correctly on other platforms?**
27+
* [ ] Yes (Please specify which platforms work correctly: ____________)
28+
* [ ] No (This might be a general bug, consider the Bug Report template)
29+
* [ ] Not Tested / Don't Know
30+
31+
**4. Steps to Reproduce (on the affected platform)**
32+
33+
Please provide detailed steps to reproduce the behavior *on the affected platform(s)*.
34+
1.
35+
2.
36+
3.
37+
38+
**5. Expected Behavior (on the affected platform)**
39+
40+
What should happen on this platform?
41+
42+
**6. Current Behavior (on the affected platform)**
43+
44+
What actually happens on this platform?
45+
46+
**7. Minimal Reproducible Example (MRE)**
47+
48+
If possible, provide a *minimal* code snippet that demonstrates the issue on the affected platform.
49+
```csharp
50+
// Your MRE code here
51+
```
52+
53+
**8. Error Messages and Stack Trace (if applicable, from the affected platform)**
54+
```
55+
(Paste full error message and stack trace here)
56+
```
57+
58+
**9. SoundFlow Version:** [e.g., 1.0.0, or commit SHA]
59+
60+
**10. Additional Context**
61+
62+
Any other details that might be relevant to this platform-specific issue.
63+
* Have you tried any platform-specific configurations or workarounds?
64+
* Are there any known quirks or limitations of the OS, runtime, or hardware involved?
65+
66+
**Requirements:**
67+
* [ ] I have searched the existing issues to ensure this platform-specific issue has not already been reported.
68+
* [ ] I have clearly specified the affected platform(s) and environment details.
69+
* [ ] I have provided detailed steps to reproduce the issue on the affected platform.
70+
* [ ] I have indicated if the issue is confirmed to work correctly on other platforms.

.github/ISSUE_TEMPLATE/question.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: "\U0001F914 Question"
3+
about: Ask a question about SoundFlow
4+
title: "[QSTN] Your question in a few words"
5+
labels: question
6+
assignees: ''
7+
8+
---
9+
10+
**Before asking, please ensure your question isn't answered in the [documentation](https://lsxprime.github.io/soundflow-docs/) or existing issues.**
11+
12+
**Requirements:**
13+
* [ ] I have searched the documentation and existing issues for an answer.
14+
* [ ] My question is specific and clearly formulated.
15+
* [ ] This is not a bug report or a feature request.
16+
17+
**1. What are you trying to achieve?**
18+
19+
A clear and concise description of your goal.
20+
21+
**2. What have you tried so far?**
22+
23+
Please describe the steps you've taken, what you've looked at in the documentation, or any code you've experimented with.
24+
25+
**3. What are you unsure about / What is your specific question?**
26+
27+
Be precise.
28+
29+
**4. Relevant Code Snippet (if applicable)**
30+
31+
If your question relates to a specific piece of code, please include a minimal, runnable snippet.
32+
```csharp
33+
// Your code here
34+
```
35+
36+
**5. Environment (if relevant to your question):**
37+
* **SoundFlow Version:** [e.g., 1.0.0]
38+
* **.NET Version:** [e.g., .NET 8.0]
39+
* **Operating System:** [e.g., Windows 11]
40+
41+
**6. Additional Context**
42+
43+
Any other information that might help us understand and answer your question.
44+
45+
**Important:**
46+
* This issue tracker is primarily for bugs and feature requests. For general "how-to" questions, please use the [Discussions tab](https://github.com/LSXPrime/SoundFlow/discussions) if available. However, if your question might reveal a documentation gap or an unintuitive aspect of the library, this is the right place.
47+
* **This is NOT for reporting bugs or requesting features.** Please use the appropriate templates for those.

0 commit comments

Comments
 (0)