Conversation
|
Thank you so much for your contributions. I hope my existing code isn't too messy or causing many problems! If we could get cross platform audio output working without any of the windows-dependent NAudio libraries that would be a huge step forward. I think I might even separate out the logic that gathers and processes signals from all the channels in the AudioProvider.Read() loop into a function that just processes one sample's worth of audio and returns the resulting left and right values. Then that could just be linked into whatever code is feeding samples into the platform's audio buffer. I think that would be cleaner to separate the WaveTracker specific logic from the platform's audio API. Right now I'm looking into modifying the custom input fields to accept text input, highlighting, arrow key cursor navigation, all the things you'd expect an input field to have; which, granted, is quite a lot. I think this will be the biggest roadblock towards getting the app to be cross platform, so I'd like to start chipping away at it now. Of course there are cross platform alternatives to winforms that could replace the pop-up dialog in an emergency, but I'd really really really like to have seamless field editing without opening up an ugly pop up. (It would also allow for searching in the sample browser!) |
So far I honestly expected all of this to be much harder than it actually was. To the contrary I find your code pretty readable and well-organized xd |
|
👀 |
|
You could also just filter out actual duplicates (check if the name is the same as existing device on the list, if so skip adding it to the list). I think LMMS (open source FL Studio clone) does it that way. |
|
I'm just not exactly sure how to know it's a duplicate, because both the full description and name are always different from each other. The output-only stuff is just a pattern I noticed... Full print of my PCM devicesHere's a print of my PCM devices, in the following format: The description can span several lines, and Edit: now that I look at it again, the remaining duplicates (if I ignore the |
|
So... I realized that NAudio.Core actually contains the DirectSound output implementation that links to Windows libs. In the future I might contribute to NAudio to at least make sure the Windows-specific classes get a Edit: I had another realization, |
|
The sample browser is now functional again but I really don't like the code I've written for that to happen... I'll see if it's still bearable when I add MP3 and FLAC parsing somehow, but even then I'd love feedback and ideas on that when I'm done. |
As it stands, depending on NAudio is not favorable because it has a strong dependency on Windows. Since adding cross-platform support to NAudio will likely take much more time than implementing what's necessary for WaveTracker, vendoring NAudio.Midi is favorable as long as NAudio remains Windows-specific.
|
Nevermind, clipping still appears after running the app for about 1 minute... Not sure what to do about it. |
|
Finally getting a chance to take a look now. Everything seems to be working okay on windows except for a crash I sometimes get when previewing samples in the sample browser. Not sure exactly what's causing it but I'm going to try to see if I can find out. |
|
Thank you! I've noticed it as well. There's probably some low-level thing I've written in there that isn't quite sound/safe, although I didn't manage to find the problem. I'd say the best places to look are the audio engine implementations. |
|
Ok, it seems I haven't been careful enough with my audio engine. It's writing in the audio thread but changing the sample rate on the main thread. I'll try to think of the best way to have everything related to managing the audio output on a single thread. |
|
I still have to test on Windows but I at least fixed the crash on Linux |
|
I fixed it yesterday on Windows, I think it should be good now |
|
Great news! Hopefully I'll get a chance to take a look this weekend |
|
Hi, what things still need to happen for this to be merged? |
|
I don't think anything needs to be done right now. Just it needs to be looked over. |
|
Linux user here. NativeFileDialogs doesn't work. |
|
|
|
Hey, I maintain NativeFileDialogs.NET, so if there's a problem I can try fixing it xd |
|
Ah, yeah, would be nice. Also nevermind about using GtkSharp, NFD is much more lightweight and does not depend on GTK so that's better. |
|
Anyway, this PR is great work, really like it |
|
Very late update on this bug: I just can't reproduce it. If it manages to come up again in the future I'll make a future PR I guess |
|
My apologies for being sooo behind on this, life has been very busy the past few months. Finally taking a look now, all seems to be good. Going to merge this to be bundled in with some other changes/bug fixes I'd like to include in the next release. Huge thank you to Speykious and everyone here who contributed |
|
Thank you so much!! Do mention me on issues if any problem with the audio engine or something along those lines resurface. |
|
@Speykious You actually rock so much. |

PR status
Some bugs have been pointed out, and they have been fixed. The PR is complete once again!
implement slightly more advanced text input(has been implemented already!)StereoBiQuadFiltermake input fields actual input fields instead of spawning a dialogue?(has been implemented already!)Bugs to fix:
Considerations
In #6 (comment), @tgpholly said that it would be more worthwhile contributing upstream to get better Linux support into NAudio. But I feel like instead it would be harder and take a longer time to implement, given how simple the audio interface can be for WaveTracker as far as I understand.
Explanations
For the implementation of the ALSA audio context, I'd like to mention this handy article on Minimal cross-platform graphics. I'd probably refer to it again for the Windows backend reimplementation, and it'll serve the same purpose eventually for MacOS.
The audio thread is incredibly simple, it just reads from the audio provider and writes to ALSA in a loop. Though I had to tweak the latency and sample buffer size to get results that sounded ok on my machine and didn't underrun too much, so I'm not sure about that. I think that'll probably become a setting.
As a full disclosure, I maintain NativeFileDialogs.NET and it binds to a C library (which isn't mine).
Edit: since then, the decision to use FFmpeg for audio file reading has been accepted. I decided to use FFmpeg 4.4. It's quite old, but the main benefit is that there is already an existing Nuget package - FFmpeg.Native - which automatically imports the libraries needed with the correct version. That way it's guaranteed that WaveTracker won't have any issue with loading them.
Here's a demo of sound, dialogs and WAV export working :D
wavetracker-linux-update.mp4