-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MacOS Support #96
Comments
I got a system running macOS 10.11.3, installed Xcode 7.3.1 and Qt 5.9.7 and attempted a compilation. Surprisingly, it got pretty far but eventually did end up failing. I think something's not right with RtMidi on macOS. Maybe I'm missing something @jpcima? Take a look:
|
This is |
Manually appending
|
I think that at least 2. is an extreme example of the referenced issue, which causes alot of stuttering under Linux with >3ms. Reducing the vertical window size as low as it can go produces usable sound output, but that's obviously not a usable setup.
Hence we should maybe consider @rerrahkr's idea to make a separate buffer and somehow sync up the chip output, playback and pattern drawing.
|
The general solution for latency is that you drop buffer-based playback in favor of callback-based. (QtMultimedia, as far as I know, supports only the buffered processing model) The audio callback should handle all interaction with chips and generating; UI should communicate by use of some lock-free channel. (commonly ring-buffer used as FIFO queue) |
About CI: We can add a Travis CI builder to test if BT will build on (various versions of) macOS, We can't add an AppVeyor builder because AppVeyor doesn't offer any macOS images to build on, and cross-compiling Qt to macOS supposedly hasn't been possible for awhile now.
Edit: there are more deployment options than AWS S3 storage, but nothing that appears to be like a "drop-in and forget" replacement to AppVeyor. |
See: BambooTracker#96 (comment) RtMidi, besides CoreMIDI, also requires the CoreAudio and CoreFoundation frameworks to compile on macOS.
Since the idea of the Power Mac has been mentioned in the OP, I'll mention a problem specific to big-endian, therefore PowerPC. The file formats are handled in the assumption of a little-endian computer. |
@jpcima I don't think there's any hope of getting BambooTracker to run on a PowerMac with OS X anymore these days anyway, even the oldest supported Qt5 versions are not available for PowerPC anymore. 😜 |
Depending on how the task of PPC is important to you, there can be a compatibility if the program is made compatible at the same time with Qt4 and Qt5. |
I think PowerPC architecture support would definitely be neat to have - the more architectures the better - but I'm sure my |
I'm unsure now if this is actually the case. On my test system
This all sounds more like a rendering (or callback?) load problem to me now. 🤔 |
@OPNA2608 I don't believe at all the stuttering to be a problem specific to MacOS. For example, on another OS, when you set a relatively low buffer (eg 10ms), start a playback, and then open the configuration dialog, you will likely be able to hear the sound skipping as it opens. What this means is: the sound generation is interdependent with the event loop of the GUI. In the ideal, I think the sound producer would be engineered in such a way that it will operate by itself, in its distinct thread, never interrupted. You would need, I believe, a communication channel separate of the Qt event loop, and adapted to realtime, which is why I mentioned about the FIFO queue. (it's a kind of reengineering I made when I adapted our BankEditor program for MIDI and low-latency) |
I didn't mean to imply that it's not related to the sound generation and buffering, merely that, on macOS, this seems to affect and is affected by more/different factors than on Linux. On Linux, I need to use a buffer of ~<3ms to get a usable pattern editor rendering rate, and nothing else will impact how fast or slow the pattern editor and the oscilloscope renders, but actual playback is flawless. On macOS, every buffer size setting causes severe rendering and playback lag (you can barely call it "playback" at that point, more like a seemingly never-ending struggle 😆), but lowering the window size makes the rendering and playback butter-smooth again. I'm sure it's all symptoms emerging from the same problem, but the ways of triggering these appear to be platform-specific. |
It's as I just told, the symptom could be more or less pronounced by platform; when you'll be dependent on a black-box GUI-related code to terminate in due time, so audio can take over, there is not a timing guarantee. The absolute way that you solve the problem, is when audio processing and GUI processing are fully independent. Then the window size, or how much of a time slice it takes to draw a graphics part with CoreGraphics or whatever that is, can not have impact on the audio process. Right now, the behavior lets me observe that GUI and audio are co-dependent. |
With the release of v0.2.0 and the mention of the Travis CI tests for macOS, I was reminded that Travis CI can upload its build result to Github Releases if the commit it's building is tagged, but this needs an encrypted OAuth API key in the .travis.yml file by @rerrahkr and some extra steps after testing the compilation to properly deploy it. Untested, but I think this yaml snippet could work for setting up the uploading part, minus the token: deploy:
provider: releases
api_key: "GITHUB OAUTH TOKEN"
file: "BambooTracker.app"
skip_cleanup: true
on:
repo: rerrahkr/BambooTracker
tags: true
condition: $TRAVIS_OS_NAME = osx I'll test uploading and what to do to get a runnable application image deployed on a fork when I can access that macOS box again. |
I changed .travis.yml to deploy the zip file at Since I can run macOS 10.13.6 from time to time, I tried to build the tracker. I also confirmed the problems @OPNA2608 mentioned:
|
awesome! +1 for macOS support. long ago i remember building it and running fine in macOS but that was pre-Qt days i think. lots have change (and for the better!) but can't wait for macOS support! |
I am starting to develop my own tracker, and was discussing with the OpenMPT team about how to prevent audio stuttering. https://forum.openmpt.org/index.php?topic=6211.0 The posts by their developers may be useful here. I don't know if BambooTracker still relies on the GUI event loop to generate or playback audio (which is probably a bad idea). |
In #152, the audio task is separated from Qt main event loop by using RtAudio. Now sample generation no longer interferes with GUI drawing. And as I mentioned, there is another problem about drawing: paint event in some views (especially the pattern editor) take too cost to update its appearances. I checked costs of After studying the source of 0CC-FamiTracker, I realized that it was not necessary to draw the entire area of pattern editor each time the paint event was called. For example, the hover cursor is changed, it is possible to update its appearance to stay characters and redraw only the background of the pattern cells. Another solution is to make redrawing periodically. BambooTracker calls paint event whenever an event such as moving cursor happens, and there is a problem of a large number of calls due to playback following and cursor hovering. |
As you know, since v0.3.0, BambooTracker has supported macOS. Thanks for all help! 😄 |
I was approached by a macOS user on Discord recently about getting BambooTracker to run natively on macOS. While it supposedly does run well in Wine, afew things still cause crashes and a native .dmg image for installation is just more appealing than fiddling with Wine.
I think it therefore makes sense to invest some time into getting it running on macOS and providing a precompiled binary via CI, as manual compilation is an unreasonable expectation for alot of end-users of this platform (downloading Xcode, the massive Qt5 framework, working in the Terminal, …) and, as of right now, shouldn't even succeed.
Points of Interest / Problems:
macOS (or Xcode?) comes with the clang compiler instead of gcc, we should check if the argument and strictness differences between these two is significant enough to abort the compilation prematurely(I tried compiling BambooTracker with clang on Linux some time ago and afaik it only failed on the very last compilation step with
unknown option: -stdlib=libstdc++
, might be a system orqmake
problem though)clang appears to work just fine, it just issues afew more warnings about unused varibales
macOS does not support ALSA, instead it offers the CoreAudio framework for audio and MIDI as far as I understandthis appears to be handled in the RtMidi code, see next comment for problems
and, of course, someone'd need to get a test system to develop and test all of these changes on. all of the Apple systems i own are way too old to get a modern-enough macOS version for Qt5 running (PowerMac G5, Late 2006 XServe), but i can see if i can eventually get a spare, more modern macOS system at workI can get my hands on a macOS 10.11.3 machine at irregular intervals
The text was updated successfully, but these errors were encountered: