Please login or register.

Login with username, password and session length
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: Playing sound at an advanced level.  (Read 4242 times)

IoIxD

  • 4 MB
  • **
  • Posts: 5
  • New Member
Playing sound at an advanced level.
« 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. 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?
Logged

IoIxD

  • 4 MB
  • **
  • Posts: 5
  • New Member
Re: Playing sound at an advanced level.
« Reply #1 on: August 08, 2024, 02:47:42 PM »

I meant this for the programming forum. Oops.
Logged

joevt

  • 64 MB
  • ****
  • Posts: 108
  • New Member
Re: Playing sound at an advanced level.
« Reply #2 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.
Logged

Mat

  • 512 MB
  • *****
  • Posts: 701
Re: Playing sound at an advanced level.
« Reply #3 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?
Logged

Naiw

  • 64 MB
  • ****
  • Posts: 127
  • new to the forums
Re: Playing sound at an advanced level.
« Reply #4 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.
Logged

IIO

  • Staff Member
  • 4096 MB
  • *******
  • Posts: 4702
  • just a number
Re: Playing sound at an advanced level.
« Reply #5 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.
Logged
insert arbitrary signature here

laulandn

  • 16 MB
  • ***
  • Posts: 18
  • Mew Nember
Re: Playing sound at an advanced level.
« Reply #6 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?
« Last Edit: January 19, 2025, 10:48:39 AM by laulandn »
Logged

Jubadub

  • 256 MB
  • *****
  • Posts: 488
  • There is no Mac in OS X
Re: Playing sound at an advanced level.
« Reply #7 on: January 31, 2025, 06:09:59 AM »

For anyone who might wonder, @laulandn's SDL_mixer is currently download #2 in this page. 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. 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!
Logged

Knezzen

  • Staff Member
  • 1024 MB
  • ******
  • Posts: 1289
  • Pro Tools Addict!
    • Macintosh Garden
Re: Playing sound at an advanced level.
« Reply #8 on: February 01, 2025, 06:47:47 AM »

Great job, guys! :D
Logged
Pro Tools addict and staff member at Mac OS 9 Lives!, System 7 Today and Macintosh Garden.
Pages: [1]   Go Up

Recent Topics