News:

Simutrans Forum Archive
A complete record of the old Simutrans Forum.

MacOS changed on github

Started by Roboron, December 19, 2021, 06:47:20 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Roboron

Seems that GitHub's MacOS VM just updated, and that has ~consequences~. Standard builds are also failing. Nothing to do with the pier system.

prissi

MacOS is now MacOS 11 on github actions. Maybe one can still request the older.

TurfIt

From config.default:
#AV_FOUNDATION = 1  # Use AVFoundation instead of QTKit. If you are using macOS 10.12 or later, this must be enabled.
AV_FOUNDATION := 0


Github actions appear to be using cmake instead which is missing the proper macOS config...

Roboron

AV_FOUNDATION will make Simutrans crash, in the most common scenario, or just don't work, if you are lucky. But you are right that a check for Mac version is indeed needed to pick between QTKit or no_midi as backup music. I will try to investigate how to get the macOS version (but at first glance, it doesn't seem as easy as it should).

Anyway, someone please move these posts to another thread, we are getting out of topic.

Roboron

#4
I have a patch. Tested on 10.15 and 11 (from GitHub). Of course I can't test on versions pre-10.12, but hopefully it works.

Now, setting the version back to 10.15 is still preferred (EDIT: it also happens with 10.15), since the another cause of the build failing is that  readline can't be found (but it is installed...), and so the check for fluidsynth fails.

Warning: readline 8.1.1 is already installed and up-to-date.

-- Checking for module 'fluidsynth>=2.1.0'
--   Package 'readline', required by 'fluidsynth', not found

prissi

Thanks, I have comitted this. It is a pity that this just happened before release, as I would like to have had a MacOS with midi sound ...

Roboron

Well we just need to point pkg-config to the readline location if it is not able to find it alone. That would allow again the fluidsynth build.

And... done. An extra line in CMakeLists.txt, and everything is back to normal. Tested with a simutrans-extended fork.

=> https://github.com/Roboron3042/simutrans-extended/runs/4582215755?check_suite_focus=true

-- Checking for module 'fluidsynth>=2.1.0'
--   Found fluidsynth, version 2.2.4


Attached patch for Standard.

prissi

#7
Because the bundle does not sound contain a sound font. I fear most MacOS user will never hear any music. Therefore, I rather suggest using built in functions, even if they sound worse ...

Anyway, digging revealed that in iOS 14.4 http://codeworkshop.net/objc-diff/sdkdiffs/ios/14.5/AVFoundation.html that
Removed -[AVMIDIPlayer initWithContentsOfURL:soundBankURL:error:]

I have zero idea of ObkectiveC syntax, so I would guess somethying like this:

old: AVMIDIPlayer*  const player = [[AVMIDIPlayer alloc] initWithContentsOfURL:url soundBankURL: nil error: nil];
new?: AVMIDIPlayer*  const player = [[AVMIDIPlayer alloc] init(contentsOf: url, soundBankURL: nil];

Roboron

There doesn't seem to be anything wrong with that specific line, and the function you referenced is swift, not objective-c. See the documentation for objective-c:

=> https://developer.apple.com/documentation/avfaudio/avmidiplayer/1390856-initwithcontentsofurl?language=objc

Also note: build was not failing, so syntax is technically correct. The problem is not there.

Quote from: Roboron on February 09, 2021, 06:15:29 PMThe crash happens when AVFoundation is going to play the midi (player play - line 17).

Everything seems ok, currentposition is 0, the song to play is number 47 of 49... But it crash anyway.

A "NSException" was thrown then.

Quote from: prissi on December 21, 2021, 07:38:09 AMBecause the bundle does not sound contain a sound font.

We could include one, just like we do for Android, if only for the release package. At least that's what I'm going to do for Steam if the native backend is still broken.

prissi

If this has never worked, I wonder if the URL destroyed after exiting might be part of the problem. If so, loading the sounds beforehand would solve it, like the QT. Also AVF has no vloume control: https://forum.simutrans.com/index.php?topic=16675.0

It is a pity I do not have a Mac.

Roboron

I don't know, it's like blindly shooting for me, I'm afraid I am not of much help at this point. You may have better luck requesting help from THLeader if he still plays on Mac.