Mac OS 9 Lives
Mac OS 9 Discussion => Development & Programming => Topic started by: IoIxD on August 08, 2024, 02:47:01 PM
-
(Note: this was meant for the programming forum, I accidentally put it in the Software forum by accident)
So I recently managed to compile the FFmpeg libraries for Mac OS 9 and get a video player set up (https://github.com/IoIxD/ppcplayer). It doesn't do audio though, and it's like this after I spent literal days losing sleep trying to get the decoded sound from ffmpeg playing. I've tried, in this order:
- Researching how to do it with Mac-specific functions (I can't find anything other then information on loading in supported sound files from resource files and etc. which isn't an option. I need a library that can play decoded sound from ffmpeg)
- SDL1.2 (completely broken on Mac OS 9)
- OpenAL (needlessly complex and confusing when all I need is something that takes a callback function and plays decoded waveforms)
- PortAudio (has a known issue(?) where the docs say you cannot do any malloc/complex memory stuff in the callback function, which is exactly what ffmpeg does when decoding audio. This sounds like a strange problem, but I have confirmed that, yes, my program does become unstable when I try to do it, and on Mac OS 9 it outright hangs the system).
Basically, anything I've found is either too new, too complex, or too poorly documented.
So I either need to find out how to directly play waveforms to Classic Mac OS, or I need to find a sound
library circa 2000 that supports Classic Mac OS.
Is there anybody who can help me here?
-
I meant this for the programming forum. Oops.
-
Did you read the sound and audio related stuff at https://developer.apple.com/library/archive/navigation/#section=Platforms&topic=macOS
Search for sound
Search for audio
Sort by date to make sure you're looking at Mac OS 9 related stuff instead of Mac OS X.
-
Not exactly what you asked for, but John Dalgliesh solved the h.263 decoding using ffmpeg as a QickTime component. You can see his sources : https://defyne.org/i263/
Perhaps this helps with your project?
Also you may have a look into the old Audacity sources how they handled the sound?
-
You will likely not find any library that does what you want.
You have two options, one is to use quicktime and write a component as already been said, the other is to use the Sound Manager (SndPlayDoubleBuffer)... the latter requires you to be extremely careful about what you do as the callback runs at interrupt time which makes it unsafe for most toolbox APIs, the latter is what most audio players used (there are a few exceptions that used quicktime under the hood) but there is a big downside to quicktime- which may not be an issue for your particiular application but it is for say a mp3 player or such... the downside is that quicktime runs during regular "cooperative multitasking", thus if you hold down a menu playback will stop.
-
what about using ASIO Soundmanager?
has multiple advantages for the end user, too.
not sure you can still license ASIO 2.x for mac though.
ASIO SDK is in the hotline.
-
Just a note, over at system7today we've been actively working on revitalizing SDL for MacOS 9 (and actually 7/8, and even, harder to believe, m68k), results here:
https://macintoshgarden.org/apps/sdl-1213-simple-directmedia-layer
We've been neglecting sound a bit, but am working on SDL_mixer this weekend. It builds, but support for some file formats is giving trouble, just due to code rot and using CodeWarrior.
Also wondering, if you made any progress, what did you end up using?
-
For anyone who might wonder, @laulandn's SDL_mixer is currently download #2 in this page (http://macintoshgarden.org/apps/sdl-12-add-libraries). It is based on the latest version of SDL_mixer that works with SDL 1.2 in general. Epic stuff!
SDL 1.2 also works excellent on Mac OS 9 in general, and you can either get the officially-released version 1.2.13, or the latest 1.2.15, or the "true latest", still-being-updated version 1.2.16. Or better yet, @laulandn's version of 1.2.16 which contains upgrades. All of these are easy to find and get in the Garden SDL 1.2 page (http://macintoshgarden.org/apps/sdl-1213-simple-directmedia-layer). For using it in your own software, get the Development Libraries of any of those versions or, better yet, used @laulandn's upgraded sources, which will contain everything you will need, and in fact IIRC is actually required if you use his (awesome) port of SDL_mixer!
-
Great job, guys! :D