68kMLA Classic Interface

This is a version of the 68kMLA forums for viewing on your favorite old mac. Visitors on modern platforms may prefer the main site.

Click here to select a new forum.
Adjusting sound volume with keyboard shortcuts on 68k Macs
Posted by: CC_333 on 2023-02-19 22:43:39
@Crutch , @cheesestraws Proper error handling, even if the end user never sees it, is important for maintainability, as I'm sure you know.

*so says a programming neophyte....*

c
Posted by: Crutch on 2023-02-21 06:45:47
For the price of round-trip shipping from Japan you could probably buy your own… But in another thread cheesestraws alerted me to the existence of the ADB Parser tool. Using that I found:
  • The media keys use command $7c (instead of the $2c command used for normal keyboard input)
  • The key codes are:
    • $00: microphone
    • $01: mute
    • $02: volume down
    • $03: volume up
Thanks for this. I think this means the keyboard is using ADB address 0x07 for the audio buttons (0x0C is just the ADB “talk” command byte). Which is interesting, ADB thanks the audio buttons are a totally separate device.

I wonder if it’s always true that audio buttons come in as ADB address 0x07? Or if that’s at least the “original ADB address” one can query using the ADB manager in case the device gets reassigned? More likely I need to check the device handler ID for these keyboards … will try that once the one I got on eBay for $49 shipped arrives sometime soon …
Posted by: cheesestraws on 2023-02-21 06:56:04
Thanks for this. I think this means the keyboard is using ADB address 0x07 for the audio buttons (0x0C is just the ADB “talk” command byte). Which is interesting, ADB thanks the audio buttons are a totally separate device.

@tashtari is probably the person to ask here: I believe they have working media key emulation in one of their PIC projects.
Posted by: Tashtari on 2023-02-21 08:41:55
The AAK appears to the ADB as two devices, a standard keyboard at address 0x2 (handler ID 0x10) and a special "media keys" device at address 0x7 (handler ID 0x02). The media keys device behaves similarly to a keyboard in its own right except it only has the four keys that @sfiera identified. My writeup on the AAK's media keys is below, let me know if there's any more info I can add to help.

Posted by: Crutch on 2023-02-21 18:59:21
Thanks @tashtari that’s extremely helpful. Being new to working with these devices … is the right protocol to check the original device address, or the device handler ID, or both? I assume just checking the ADB address == 0x07 is not sufficient, since if someone had multiple ADB devices connected they could in theory get something else assigned to address 0x07 (though I assume the AAK’s original ADB address could still be verified as 0x07, also why do I keep writing ‘0x07’ instead of just ‘7’?)
Posted by: Tashtari on 2023-02-21 20:16:15
An ADB device is identified by a combination of its original address (the one it powers up with before any reassignment has taken place) and its original handler ID - the handler ID is only 8 bits, so combining it with the original address multiplies that address space.
Posted by: rjkucia on 2023-02-25 07:49:44
OK sorry about that, this is the right file and should work at any bit depth.
Tested this and can verify it works on my SE/30!

Might not be a bad idea to make a page on the Garden or somewhere like it so it's more discoverable.
Posted by: Crutch on 2023-02-25 08:48:07
Excellent thanks! Garden upload coming once I get to 1.0 …. Next version will be a little faster due to saving the ‘speaker’ bitmap in a resource (currently drawn on the fly).
Posted by: Iesca on 2023-03-14 06:51:03
A little late to the party, but this is another FKey for adjusting volume: https://macintoshgarden.org/apps/the-volume-manager
Posted by: Iesca on 2023-03-14 06:53:20
And another: https://macintoshgarden.org/apps/volume-menu
Posted by: Crutch on 2023-03-14 07:07:14
Cool! Will check those out. Noting the first one is from 1990, it is likely that it doesn’t work with modern systems or audio devices, since it probably uses the old SetSoundVolume routine which really just controls the level of the system beep.
< 3