Home▸
Forums▸
Taking another shot at onboard audio on a Mac Mini G4?▸
Taking another shot at onboard audio on a Mac Mini G4?
Thread
Taking another shot at onboard audio on a Mac Mini G4?
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?
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?
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.
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.
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?
Any ideas what to do here? Is this as a result of debugging in ROM, and if so, how do I skip over that?
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.
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.
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.
I would be curious to test a ROM using the eMac machine code … 
As we can see here, it seems to be close to the mini:
http://apple-history.com/compare/g4cube/mac_mini/emac_usb2/emac

As we can see here, it seems to be close to the mini:
http://apple-history.com/compare/g4cube/mac_mini/emac_usb2/emac
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
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
BUMP!
With all those programmers joining this place recently, it would be extremely cool if some of you could look at this issue.
It has a very high priority and, if solved, it would make many many people happy.
Thanks and keep decompiling!
P.S. Here's a bit more on this: http://macos9lives.com/smforum/index.php?topic=4325.0
With all those programmers joining this place recently, it would be extremely cool if some of you could look at this issue.
It has a very high priority and, if solved, it would make many many people happy.
Thanks and keep decompiling!

P.S. Here's a bit more on this: http://macos9lives.com/smforum/index.php?topic=4325.0
I thought about this some more. I went through the device tree and wanted to see if I could access the sound-related GPIOs directly through reads and writes to their physical addresses in Open Firmware. It looks like the answer is yes. See the attached screenshot -- this is reading the headphone detect GPIO directly, with the plug removed/inserted/removed. It looks like bit 1 represents the GPIO detected state, which correlates with the Linux aoa sound driver I linked earlier in the thread.
I'm thinking of writing my own sound component to handle the GPIOs at first, and the I2S DAC eventually.
A few questions for folks who know more about this stuff on classic Mac OS than I do:
* If I write a sound component, are all the physical addresses for the available hardware identity-mapped within the component? For instance, if I go read 0x80000067 like I did here, will it work? Or do I need to do something like ioremap() on Linux?
* How do I register an interrupt handler for the GPIO interrupt here? It's off of the mac-io (Keylargo), which is a PCI-connected device.
I'm thinking of writing my own sound component to handle the GPIOs at first, and the I2S DAC eventually.
A few questions for folks who know more about this stuff on classic Mac OS than I do:
* If I write a sound component, are all the physical addresses for the available hardware identity-mapped within the component? For instance, if I go read 0x80000067 like I did here, will it work? Or do I need to do something like ioremap() on Linux?
* How do I register an interrupt handler for the GPIO interrupt here? It's off of the mac-io (Keylargo), which is a PCI-connected device.
It would be nice to document all the efforts so far taken on the Mac Mini G4 onboard audio problem, so there is no need to redo investigations and findings, especially if the work stops and has to be restarted by another person.
I have collected some information on the problem which I would like to share with the people currently working on this to help their effort to tackle the problem.
Ressources:
I have collected some information on the problem which I would like to share with the people currently working on this to help their effort to tackle the problem.
- Problem situation:
- Mac OS 9.2.2 (v9 iso image):
- Sound Manager (v3.6.7 / QuickTime 5.0.2)
- Headphone Port:
- shows up in Sound Panel
- plays sound, but at a very low volume level
- Volume level not adjustable
- Internal Speaker:
- does not show up in Sound Panel
- no sound at all
- Mac OS 7.6.1 CHRP (v0.2 iso image): [1.1]
- Headphone Port:
- shows up in Sound Panel
- plays some sound (System Sounds are played, but no beep sounds in poping up alert windows)
- Volume level adjustable(?) in Control Strip and Sound Control Panel
- probably made work by setting a valid NVRAM by accident
- Internal Speaker:
- does not show up in Sound Panel
- no sound at all
- Hardware information (Mac Mini G4):
- Chipset: Toonie
- DAC only, no hardware functions (mixing, amplification, ...) so everything must be done in driver software [3,4,5]
- devices: Line Out (Headphone Port), Internal Speaker [2]
- Existing driver sourcecode for the Toonie chip
- Linux driver AOA (Apple Onboard Audio) [3,4]
- Darwin driver AppleOnboardAudio [5]
A Mac OS 9 driver must be created by porting the existing driver sourcecodes. The Darwin driver might be very helpful since it must handle the (Carbon) Sound Manager, too. - Developer Documentation for creating a Mac OS 9 sound driver:
- Grokipedia [6]:
Overview article over the historical developments of the Sound Manager - Inside Macintosh [8]:
- A sound driver must be written as a Sound Component for the Sound Manager.
If extra functions are needed (e.g. separate volume settings for stereo L/R-channels) a Audio Component is needed, too. - The components must be loaded by the Component Manager at OS startup.
- An example how to create a Sound Component for the Sound Manager is given in the develop article [12.2].
- The Sound Manager 3.3 (= Mac OS 9.2???) has some new functions which are not covered in Inside Macintosh. There is a ADC article [9].
- A sound driver must be written as a Sound Component for the Sound Manager.
- Open questions:
- How to enable the Internal Speaker? We can only send audio to the Headphone port so far.
- What is the device tree, interrupts and memory addresses of the audio hardware? We need a complete list before we can start creating a driver (Maybe the Darwin driver sourcecode can help here?).
- Should we build the Darwin driver from sourcecode and experiment there to figure out the answers first? (existing driver = easier to use for debugging)
Ressources:
- Forum messages
- MacOS 9 lives - System 7 natively boots on the Mac mini G4!
(https://macos9lives.com/smforum/index.php?topic=7711.msg59814#msg59814)
- MacOS 9 lives - System 7 natively boots on the Mac mini G4!
- Apple System Information - Mac Mini G4
- Mac mini (original) - Technical Specifications
(https://support.apple.com/en-us/112579#:~:text=Processor%20and%20memory,digital%20displays%20up%20to%20135MHz) - Mac Mini Service Manual (Updated December 2005)
(https://macdat.net/files/pdf/apple/servicesource/mac_mini.pdf)
- Mac mini (original) - Technical Specifications
- Debian Wiki - PowerPC Soundcards - ALSA support on PowerMac
(https://wiki.debian.org/PowerPC/SoundCards) - Sourcecodes
- Linux Sourcecode - AOA (Apple Onboard Audio)
(https://github.com/torvalds/linux/tree/master/sound/aoa/) - Apple OSS distributions - Darwin - AppleOnboardAudio
- AppleOnboardAudio 247.2.2 (Mac OS X 10.3.9)
(https://github.com/apple-oss-distributions/AppleOnboardAudio/tree/AppleOnboardAudio-247.2.2) - AppleOnboardAudio 256.2.5 (Mac OS X 10.4.11 PPC)
(https://github.com/apple-oss-distributions/AppleOnboardAudio/tree/AppleOnboardAudio-256.2.5) - AppleOnboardAudio 258.3.1 (Mac OS X 10.5.8 PPC)
(https://github.com/apple-oss-distributions/AppleOnboardAudio/tree/AppleOnboardAudio-258.3.1)
- AppleOnboardAudio 247.2.2 (Mac OS X 10.3.9)
- Basilisk II / SheepShaver
- Which is the real Basilisk II github repo?
(https://www.emaculation.com/forum/viewtopic.php?t=12515) - GitHub - Basilisk II and SheepShaver (Official Repo)
(https://github.com/cebix/macemu) - GitHub - Basilisk II and SheepShaver (Latest Forked Repo)
(https://github.com/kanjitalk755/macemu)
- Which is the real Basilisk II github repo?
- Leaked System 7.1 "SuperMario" Sourcecode
- GitHub - SuperMario
(https://github.com/elliotnunn/supermario)
- GitHub - SuperMario
- Linux Sourcecode - AOA (Apple Onboard Audio)
- Grokipedia - Sound Manager
(https://grokipedia.com/page/sound_manager) - Steve's Blog
- Steve's Blog - Apple’s Inside Macintosh 1984 to 1996
(https://www.savagetaylor.com/2024/02/18/apples-inside-macintosh-1984-to-1996) - Steve's Blog - Apple’s develop: The Apple Technical Journal 1990 to 1997
(https://www.savagetaylor.com/2024/02/09/apples-develop-the-apple-technical-journal) - Steve's Blog - Apple’s Developer CD Series 1989 to 2009
(https://www.savagetaylor.com/2024/01/31/apples-developer-cd-series/)
- Steve's Blog - Apple’s Inside Macintosh 1984 to 1996
- Inside Macintosh
- Inside Macintosh - Sound
(https://vintageapple.org/inside_r/pdf/Sound_1994.pdf)
(https://leopard-adc.pepas.com/documentation/mac/Sound/Sound-2.html)- Chapter 5 - Sound Components
(https://developer.apple.com/library/archive/documentation/mac/pdf/Sound/Sound_Components.pdf) - Chapter 6 - Audio Components
(https://developer.apple.com/library/archive/documentation/mac/pdf/Sound/Audio_Components.pdf)
- Chapter 5 - Sound Components
- Inside Macintosh - More Macintosh Toolbox
(https://developer.apple.com/library/archive/documentation/mac/pdf/MoreMacintoshToolbox.pdf)
(https://vintageapple.org/inside_r/pdf/More_Macintosh_TB_1993.pdf)- Chapter 6 - Component Manager
- Inside Macintosh - Devices
(https://vintageapple.org/inside_r/pdf/Devices_1994.pdf)- Chapter 1 - Device Manager
(https://dev.os9.ca/techpubs/mac/pdf/Devices/Device_Manager.pdf)
- Chapter 1 - Device Manager
- Inside Macintosh - Memory
(https://vintageapple.org/inside_r/pdf/Memory_1992.pdf) - Inside Macintosh - Designing PCI Cards and Drivers for Power Macintosh Computers
(https://leopard-adc.pepas.com/documentation/Hardware/DeviceManagers/pci_srvcs/pci_cards_drivers/Designing_PCI_Cards_Drivers.pdf)
- Inside Macintosh - Sound
- ADC - Reference Library - New Sound Manager Features
(https://leopard-adc.pepas.com/documentation/QuickTime/RM/LegacyAPIs/SoundManager3.3/rmSoundManager33/rmSndMgr33.html) - Technical Note QT05 - Component Manager version 3.0
(https://developer.apple.com/library/archive/technotes/qt/qt_05.html) - Macintosh Programmer's Workshop (MPW)
- ADC - MPW Reference Books
(https://web.archive.org/web/20010413124033/http://developer.apple.com/tools/mpw-tools/books.html) - Building and Managing Programs in MPW (2nd Edition)
(https://68kmla.org/bb/threads/looking-for-building-and-managing-programs-in-mpw.7974/#post-93461)
- ADC - MPW Reference Books
- develop - The Apple Technical Journal
- develop #4 (October 1990):
Writing a Device Driver in C++ (What? In C++?) (p.376)
(https://vintageapple.org/develop/pdf/develop-04_9010_October_1990.pdf)
(http://preserve.mactech.com/articles/develop/issue_04/device_driver.html) - develop #9 (Winter 1992):
Tracks: A New Tool for Debugging Drivers (p.68)
(https://vintageapple.org/develop/pdf/develop-09_9201_Winter_1992.pdf)
(htttml) - develop #16 (December 1993):
Somewhere in QuickTime: What’s New With Sound Manager 3.0 (p.34)
(https://vintageapple.org/develop/pdf/develop-16_9312_December_1993.pdf)
(http://preserve.mactech.com/articles/develop/issue_16/034-038_QuickTime_column.html) - develop #20 (December 1994):
Make Your Own Sound Components (p.50)
(https://vintageapple.org/develop/pdf/develop-20_9412_December_1994.pdf)
(http://preserve.mactech.com/articles/develop/issue_20/20olson.html) - develop #22 (June 1995):
Creating PCI Device Drivers (p.376)
(https://vintageapple.org/develop/pdf/develop-22_9506_June_1995.pdf)
(http://preserve.mactech.com/articles/develop/issue_22/042-062_Minow.html) - develop #24 (December 1995):
The New Device Drivers: Memory Matters (p.84)
(https://vintageapple.org/develop/pdf/develop-24_9512_December_1995.pdf)
(http://preserve.mactech.com/articles/develop/issue_24/minow.html)
- develop #4 (October 1990):
- Apple Developer Files
- Mirror of "ftp.apple.com/developer/index.html"
(https://www.sonixwave.com/apple/developer/index.html) - Apple SDK Files
- Sound Manager SDK
(https://www.sonixwave.com/apple/developer/Development_Kits/Sound_Manager.sit.hqx) - PCI Driver Development Kit 3.0
- This DDK (Driver Development Kit) will enable you to create both OpenFirmware (FCode) and MacOS drivers for PCI cards. Documentation, Samples, and Tools to get you started are included.
(https://www.sonixwave.com/apple/developer/Development_Kits/PCI_DDK_3.0.sit.hqx) - Power Manager Driver Development Kit 1.0f1
- The contents of this DDK will be of interest to anyone involved in developing PCI card driver software for the Macintosh. This DDK contains documentation, header files, stub libraries, and sample code which illustrate the requirements for drivers to be PCI power management compliant.
(https://www.sonixwave.com/apple/developer/Development_Kits/PowerManager_DDK_1.0f1.sit.hqx)
- Sound Manager SDK
- Apple Code Sample Files
- Mac OS X Kernel Debug Kits
(https://www.macintoshrepository.org/25003-mac-os-x-kernel-debug-kits) - Mac OS X - Driver Development
- Developer Note - Introduction to PCI
(https://leopard-adc.pepas.com/documentation/Hardware/Conceptual/HWtech_PCI/Introduction/Introduction.html) - Writing PCI Drivers
(https://leopard-adc.pepas.com/documentation/DeviceDrivers/Conceptual/WritingPCIDrivers/WritingPCIDrivers.pdf)
- Developer Note - Introduction to PCI
- Mirror of "ftp.apple.com/developer/index.html"
- Open Firmware
- ADC - Hardware Developer Documentation - Open Firmware
(https://web.archive.org/web/20010713051935/https://developer.apple.com/techpubs/hardware/reference_info/openfirmware.html) - Technical Note TN1061
Fundamentals of Open Firmware, Part I: The User Interface
(https://leopard-adc.pepas.com/technotes/tn/tn1061.html) - Technical Note TN1062
Fundamentals of Open Firmware, Part II: The Device Tree
(https://leopard-adc.pepas.com/technotes/tn/tn1062.html) - Technical Note TN1044
Fundamentals of Open Firmware, Part III: Understanding PCI Expansion ROM Choices for Mac OS
(https://leopard-adc.pepas.com/technotes/tn/tn1044.html) - Technical Note TN2004
Debugging Open Firmware Using Telnet
(https://web.archive.org/web/20010624195528/http://developer.apple.com/technotes/tn/tn2004.html)
- ADC - Hardware Developer Documentation - Open Firmware