Mac OS 9 Lives

Mac OS 9 Discussion => Development & Programming => Topic started by: IoIxD on August 08, 2024, 02:47:01 PM

Title: Playing sound at an advanced level.
Post 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:


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?
Title: Re: Playing sound at an advanced level.
Post by: IoIxD on August 08, 2024, 02:47:42 PM
I meant this for the programming forum. Oops.
Title: Re: Playing sound at an advanced level.
Post by: joevt on August 08, 2024, 04:24:39 PM
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.
Title: Re: Playing sound at an advanced level.
Post by: Mat on August 09, 2024, 12:39:58 AM
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?
Title: Re: Playing sound at an advanced level.
Post by: Naiw on August 25, 2024, 05:01:26 PM
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.
Title: Re: Playing sound at an advanced level.
Post by: IIO on August 26, 2024, 06:41:11 AM
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.
Title: Re: Playing sound at an advanced level.
Post by: laulandn on January 19, 2025, 09:05:02 AM
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?
Title: Re: Playing sound at an advanced level.
Post by: Jubadub on January 31, 2025, 06:09:59 AM
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!
Title: Re: Playing sound at an advanced level.
Post by: Knezzen on February 01, 2025, 06:47:47 AM
Great job, guys! :D