Author Topic: Taking another shot at onboard audio on a Mac Mini G4?  (Read 5126 times)

Offline biggieshellz

  • Valued Member
  • **
  • Posts: 12
  • New Member
Re: Taking another shot at onboard audio on a Mac Mini G4?
« Reply #20 on: April 07, 2023, 06:49:34 PM »
That was a super useful breadcrumb to follow.  I didn't know about the SDKs.  On Macintosh Garden, I found the Apple Developer Connection 1996, and the December issue (reference library) contains article #20 which contains an article on how to write a sound output component, along with some sample code.

Note that I had to open this on an old Intel MacBook Pro running Mojave; my usual M1 MacBook Pro on Ventura won't mount HFS.  Anybody know a way around this, for CD images and DMGs?

Online RossDarker

  • Gold Member
  • *****
  • Posts: 281
Re: Taking another shot at onboard audio on a Mac Mini G4?
« Reply #21 on: April 08, 2023, 02:06:52 AM »
There are various tools that can dump the contents of an HFS image such as machfs and hfsutils, however using them is a little different to mounting the image.

There is hfsexplorer to mount images in its own Java interface. Haven’t actually used this one before, but it looks good - I’ll probably visit it some time.

I have a slightly different approach though.
I attach the image as a CD/Drive to Mac OS 9 in Qemu/UTM, then work with it from there.
Either all the files can be viewed in the Mac OS 9 environment, or if some files need to be transferred to the host, another image can be used - a raw image that will show as a hard disk in the emulator, but can be mounted fully natively in macOS too.

This might seem like a long approach, but after setting everything up for the first time, the emulators start up pretty quickly these days. It does also feel like the most native way to me.


It’s really great to see the audio issue being tackled. Hope it all works out well, and many thanks for your work.

Offline biggieshellz

  • Valued Member
  • **
  • Posts: 12
  • New Member
Re: Taking another shot at onboard audio on a Mac Mini G4?
« Reply #22 on: April 10, 2023, 12:40:32 PM »
A few more updates here.  So looking at the Open Firmware screenshots I posted earlier, the only thing in the .properties for the sound device was "name pseudo-sound".  That doesn't match what the Linux driver expects.  So I reset Open Firmware (reset-nvram, set-defaults, and then reset-all) and found that the full device showed up, as AOAKeylargo and with the expected layout-id.  So something is happening where the OS 9 audio driver removes the sound device from the device tree.

As a test, I removed the Apple Audio Extension, and while the onboard output doesn't show up in the Sound preference panel any longer, sound output still works, and the Open Firmware sound device still ends up renamed after a reset.  So perhaps the sound driver built into the System file is doing this?

Also, any ideas on where to set a breakpoint so I'll drop into MacsBug when an application plays a sound?  I tried "tvb SndPlay" and it sets the breakpoint, but I never see it hit.

Offline Daniel

  • Gold Member
  • *****
  • Posts: 300
  • Programmer, Hacker, Thinker
Re: Taking another shot at onboard audio on a Mac Mini G4?
« Reply #23 on: April 10, 2023, 05:01:11 PM »
I looked through the Component Manager documentation, and it seems that it really doesn't want to expose where to find the component. Thankfully, we have the source. Hopefully it isn't too outdated. If these struct definitions are still accurate, you can peek into the RegisteredComponentInstancePtr returned by OpenComponent and then grab its rtiEntry. From there, rtRoutine and/or rtRoutineHandle are probably where you want to look to get the entry point. You probably need to lock the handle in memory somehow so that it doesn't get moved around (Unless that gets done for you somehow?).
https://github.com/elliotnunn/supermario/blob/master/base/SuperMarioProj.1994-02-09/Toolbox/ComponentMgr/PrivateThingManager.h#L79-L112

Offline biggieshellz

  • Valued Member
  • **
  • Posts: 12
  • New Member
Re: Taking another shot at onboard audio on a Mac Mini G4?
« Reply #24 on: April 15, 2023, 08:18:08 PM »
After reading https://vintageapple.org/inside_r/pdf/Sound_1994.pdf some more, I found that I can hit TVect breakpoints at SndDoCommand and SndDoImmediate when I run an application that plays sound (Spin Doctor, for instance).  However, I can't single-step through what happens to try to figure out which sound output component is being used.  See the attached MacsBug screenshot -- I end up stuck with a bus error.  If I trace over some of the calls, I can go farther, but I still end up stuck eventually before I make it into a sound output component.

Any ideas what to do here?  Is this as a result of debugging in ROM, and if so, how do I skip over that?

Offline dtekle

  • Newcomer
  • Posts: 4
  • New Member
Re: Taking another shot at onboard audio on a Mac Mini G4?
« Reply #25 on: October 01, 2023, 07:06:08 AM »
Hello guys, was there any progress on this issue since April 2023?
If no, what is the roadblock and can other people help on this?

Offline joevt

  • Enthusiast Member
  • ***
  • Posts: 65
  • New Member
Re: Taking another shot at onboard audio on a Mac Mini G4?
« Reply #26 on: October 02, 2023, 03:10:14 PM »
I looked through the Component Manager documentation, and it seems that it really doesn't want to expose where to find the component. Thankfully, we have the source. Hopefully it isn't too outdated. If these struct definitions are still accurate, you can peek into the RegisteredComponentInstancePtr returned by OpenComponent and then grab its rtiEntry. From there, rtRoutine and/or rtRoutineHandle are probably where you want to look to get the entry point. You probably need to lock the handle in memory somehow so that it doesn't get moved around (Unless that gets done for you somehow?).
https://github.com/elliotnunn/supermario/blob/master/base/SuperMarioProj.1994-02-09/Toolbox/ComponentMgr/PrivateThingManager.h#L79-L112
Some Component Manger related apps:
- "Things!" by Gary Woodcock/QuickTime™ Development Team
- "Fiendishthngs" (has source code) from Apple
- "Reinstaller3" Apple Computer QuickTime 4.0 SDK
- "Thing Detective" from Unthinkable Research
- "Thing Reporter" from Unthinkable Research (free)

I think I was using these when I was reverse engineering the planb (video input of Power Mac 8500, 8600, etc.) video digitizer QuickTime component from Mac OS 9 68K to port to PowerPC and Mac OS X.

Offline ssp3

  • Platinum Member
  • *****
  • Posts: 710
Re: Taking another shot at onboard audio on a Mac Mini G4?
« Reply #27 on: October 02, 2023, 03:21:57 PM »
Hi joevt!  :)
It would be extremely cool if you, with your knowledge, could look into this Mac Mini audio thing. If you have time, of course.
If you're not part of the solution, you're part of the problem.

Offline dtekle

  • Newcomer
  • Posts: 4
  • New Member
Re: Taking another shot at onboard audio on a Mac Mini G4?
« Reply #28 on: October 03, 2023, 09:54:21 AM »
I found a page for the Linux sound drivers for PowerMac which mentioned similar issues with the sound volume with the Toonie chip (Mac mini G4) which may be solved with a new driver "snd-aoa":  https://wiki.debian.org/PowerPC/SoundCards.

In another thread, someone pointed to the fact that the patched ROM makes Mac OS 9 treating the Mac Mini G4 as a Cube which had no built-in amplifier for the sound volume because it was meant to run with special speakers (Apple Pro USB Speakers) which had itself the amplifier for sound: http://macos9lives.com/smforum/index.php/topic,2408.msg52465.html#msg52465.

Offline zefrenchtoon

  • Veteran Member
  • ****
  • Posts: 119
Re: Taking another shot at onboard audio on a Mac Mini G4?
« Reply #29 on: October 03, 2023, 12:22:44 PM »
Thanks to answer to my post @dtekle  :)


I've found the post talking about the "choice" of the Cube identifier in the modified ROM and it seems to confirm my worries as with another machine id, the sound was described as "coming out through speakers is either really loud or distorted".

http://macos9lives.com/smforum/index.php/topic,2408.msg30135.html#msg30135


Offline zefrenchtoon

  • Veteran Member
  • ****
  • Posts: 119
Re: Taking another shot at onboard audio on a Mac Mini G4?
« Reply #30 on: October 03, 2023, 12:46:47 PM »
I would be curious to test a ROM using the eMac machine code …  ;D

As we can see here, it seems to be close to the mini:

http://apple-history.com/compare/g4cube/mac_mini/emac_usb2/emac

Offline dtekle

  • Newcomer
  • Posts: 4
  • New Member
Re: Taking another shot at onboard audio on a Mac Mini G4?
« Reply #31 on: October 05, 2023, 06:22:55 AM »
As far I can see the specs (http://apple-history.com/compare/g4cube/mac_mini/emac_usb2/emac) there could be some benefits but also some disadvantages by using the Gestalt of eMac vs G4 Cube:

eMac/2004:
+ almost identical specs to the Mac mini (same G4 processor PowerPC 7447, same GFX Radeon 9200, same ATA-100 interface, same WiFi)
+ no USB-amplified sound outputs
- original machine not able to boot Mac OS 9 natively
- slightly different audio output format (16bit vs. 24bit)
- eMac has audio input (is it a problem anyway?)
- different sound chipset ("Snapper" vs Mini's "Toonie")

The older eMac is maybe usable as base for ROM modding (instead using the Mac G4 cube), but there may be issues with the graphic card (can these be fixed with drivers?)

eMac/2002:
+ natively bootable with Mac OS 9
- hardware is one generation older (G4 7450, only ATA-66, older WiFI) (G4 cube's hardware is even older!)
- uses Nvidia GeForce2 as GFX instead of ATI Radeon

Can someone of the original ROM modder team have a look into creating a custon ROM from the eMac/2002 ROM? As far I know there exist already a ROM mod for the eMac/2004 in this forum.

Offline zefrenchtoon

  • Veteran Member
  • ****
  • Posts: 119
Re: Taking another shot at onboard audio on a Mac Mini G4?
« Reply #32 on: February 05, 2024, 07:55:40 AM »
Hi!

Sorry to unearth this topic but I had a strange behaviour with my Mini this morning.

I needed sound output for a quick test so I (re)tried to use a cheap USB audio adapter.
Once I connected the adapter, I got System sounds (mainly the ones from the OS theme) but no "standard" sound (from Quicktime Player or by playing an Audio CD in iTunes).
So I tried to reboot but with the adapter already connected.
Now, I got sound from my adapter.

OK but what's new ?

The first time, when I connected the adapter, it appeared in the Sound control panel.
When I restarted the mini, no adapter visible in the Sound control panel.

Does anyone have an explanation ??

Also ...  the control panel kept the "Main volume" to 0 even if I had sound in my speakers.  O_o