Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

About BasiliskII, a 68k Mac emulator for Windows, MacOSX, and Linux that can run System 7.x through MacOS 8.1.

Moderators: Cat_7, Ronald P. Regensburg

RichCini
Inquisitive Elf
Posts: 34
Joined: Fri Feb 28, 2020 3:10 am

Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by RichCini »

Hi all --

I've been a long-time Basilisk user on the OSX platform and upgraded to Catalina a few months ago. I just got around to upgrading my Basilisk install with the SDL2 implementation. The emulation runs really fast -- such great work, so a quick thank you for putting out a great program (I've developed emulators before, but on the PC, so I know how hard it is).

Anyway, the only issues that I'm experiencing is with the sound. I'm using the BasiliskIIGUI beta 0.14f for the front end, and I'm using /dev/dsp as the output device and /dev/mixer as the mixer device. I get no startup chimes, no audio in games, but oddly, if I go into the Sound control panel in OS 7.5.3 and play around with the volume or the sounds, I get sound, but it's the same sound -- the error beep.

Has anyone else noticed this? Do I have the sound devices right for Catalina? I know that Catalina changed certain things in the name of security, so I don't know if this is a symptom of that or not.

Again, thanks for such a great program.

UPDATE: As I test various games, the sound works on some, but not others. So, I guess the devices above are working. Not sure why 7.5.3 itself has sound problems. Need to dig a bit more into that.

Rich
User avatar
Ronald P. Regensburg
Expert User
Posts: 6726
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by Ronald P. Regensburg »

Did sound work work for all your games with the older BasiliskII build? Did you keep your existing HD image when upgrading to the SDL2 build?
RichCini wrote:I'm using the BasiliskIIGUI beta 0.14f for the front end, and I'm using /dev/dsp as the output device and /dev/mixer as the mixer device.
These settings are (and always were) non-functional in OSX/macOS. You can leave the boxes blank.
I get no startup chimes,
There are no startup chimes in BasiliskII.
if I go into the Sound control panel in OS 7.5.3 and play around with the volume or the sounds, I get sound, but it's the same sound -- the error beep.
Always the same beep, regardless which one you choose in Sound control panel?
RichCini
Inquisitive Elf
Posts: 34
Joined: Fri Feb 28, 2020 3:10 am

Re: Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by RichCini »

Ronald P. Regensburg wrote:Did sound work work for all your games with the older BasiliskII build? Did you keep your existing HD image when upgrading to the SDL2 build?
RichCini wrote:I'm using the BasiliskIIGUI beta 0.14f for the front end, and I'm using /dev/dsp as the output device and /dev/mixer as the mixer device.
These settings are (and always were) non-functional in OSX/macOS. You can leave the boxes blank.
I get no startup chimes,
There are no startup chimes in BasiliskII.
if I go into the Sound control panel in OS 7.5.3 and play around with the volume or the sounds, I get sound, but it's the same sound -- the error beep.
Always the same beep, regardless which one you choose in Sound control panel?
I did keep my original HD image, although I just copied it to a 3GB image because I'm out of space. I didn't track the sound too closely previously, so I don't know. I've been testing them out and it seems that the newer games (Dark Castle 2) work fine, but older ones (Like Airborne!) don't.

I didn't realize the settings didn't matter, but good to know, as with the chimes.

On the control panel, yes, it's always the same beep regardless of which sound I pick. Pretty odd. Are there sound files I need somewhere? While the HD image is old, the install on my iMac is new. Maybe I destroyed a folder somewhere?
User avatar
Ronald P. Regensburg
Expert User
Posts: 6726
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by Ronald P. Regensburg »

May be a corrupted preferences file.

Trash and delete the file Sound Preferences in System Folder > Preferences. A new file will be created when you use the Sound control panel.
RichCini
Inquisitive Elf
Posts: 34
Joined: Fri Feb 28, 2020 3:10 am

Re: Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by RichCini »

Ronald P. Regensburg wrote:May be a corrupted preferences file.

Trash and delete the file Sound Preferences in System Folder > Preferences. A new file will be created when you use the Sound control panel.
Just gave that a try -- no dice. If you select "Add" or "Remove", OS 7 fails with an "Unimplemented Trap" trap in "Finder". If you double-click the preferences file, it says that it can't find the program "Sound Manager" to open the document. So, I downloaded a copy of Sound Manager 3.1 and installed the extension and control panel item. Still no joy. Kind of odd.

I should add that in the System briefcase in the System Folder, the sound files are there, and if you double click them, they play properly.

Rich
User avatar
Ronald P. Regensburg
Expert User
Posts: 6726
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by Ronald P. Regensburg »

RichCini wrote:Just gave that a try -- no dice. If you select "Add" or "Remove", OS 7 fails with an "Unimplemented Trap" trap in "Finder".
Selecting "Add" or "Remove"? Why? The sounds available in the System file should be visible in a list in the Sound control panel. If they are not, most probably the Sound Preferences file is corrupted.

Why did you replace the Sound Manager extension and Sound control panel? I hope the versions you installed are compatible.

You cannot open a prefs file like that. Even if you could, you would not be able to do anything useful with it.

Did you trash the Sound Preferences as I suggested?

- Close the Sound control panel
- Trash the Sound Preferences file (drag it to the Trash)
- Stop BasiliskII and start it again
- Then open the Sound control panel
RichCini
Inquisitive Elf
Posts: 34
Joined: Fri Feb 28, 2020 3:10 am

Re: Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by RichCini »

Yes I trashed the preferences file as you specified and rebooted, and yes the file versions of SoundManager were compatible (and it wasn't in the Extensions folder, and nor is it in the folder on a clean install...see below).

Regarding the add/remove buttons, they're enabled in the dialog box so why not test to see what the effect is on the emulation? Sometimes it reveals something unintended (I am also an emulation author, the Altair32 MITS Altair emulation).

As a test, I just did a clean install of 7.5.3 from CD on a blank hard drive image and I get the same outcome as above, including the trap on clicking Add. So, that eliminates problems with my original installation. I also removed the device path from the configuration screen since you said previously that it didn't matter (which it didn't).


Thanks again.
Rich
User avatar
Ronald P. Regensburg
Expert User
Posts: 6726
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by Ronald P. Regensburg »

My virgin 7.5.3 does indeed not have the Sound Manager installed either. In my other 7.5.3/7.5.5 systems it was probably installed with QuickTime 2.5.

The issue you describe is strange, and very strange that it exists in a clean installation.

I myself have no sound issues with BasiliskII, 12 January 2020 build, with System 7.5.3/7.5.5 on macOS 10.15.3 Catalina. I am not much of a gamer, but Ambrosia's "Swoop" runs fine with sound. Also, all the installed alert sounds appear in the Sound control panel and can be selected.

In all the (12+) years I used BasiliskII, I never tried clicking the Add or Remove button in the Sound control panel, but clicking the Add button results in the same System error as you describe. It may need functions that are not available in the emulator.
RichCini
Inquisitive Elf
Posts: 34
Joined: Fri Feb 28, 2020 3:10 am

Re: Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by RichCini »

Yes it is strange. I also can't get networking working either, and I had it working before Catalina (I have downloaded and installed tuntap). I've followed the on-line instructions, so who knows. Maybe I'll re-download the build and start over.

Thanks.
Rich
User avatar
Ronald P. Regensburg
Expert User
Posts: 6726
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by Ronald P. Regensburg »

I am not sure networking with tuntap will work in Catalina. Does anyone know?
User avatar
adespoton
Forum All-Star
Posts: 3350
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by adespoton »

As outlined in one of the other threads, the Tun/Tap kernel extension isn't currently functioning in Catalina. Everything from the System side up to creating the bridge and adding the hardware to it works, as does starting BII/SheepShaver and presenting the Tap interface request -- the problem is that the interface never gets bound to a port because the extension never gets loaded.

There do appear to be fixes:

NEW macOS REQUIREMENT: Restarting the computer is required by macOS Catalina before connecting some configurations for the first time.

From https://tunnelblick.net/cCatalina.html :
If a configuration requires a "tun" or "tap" system extension, the first time Tunnelblick asks macOS to load the appropriate system extension, macOS will tell the user that they must give permission to load system extensions signed by "Jonathan Bullard" in System Preferences : Security & Privacy : General. If the user give such permission by clicking "Allow", macOS must restart the computer before the permission will be honored. After the permission has been given and the computer has been restarted, you may then connect all VPN configurations normally.

This only needs to be done one time. Once permission to load system extensions signed by "Jonathan Bullard" has been granted and the computer restarted, no further action is needed. Tunnelblick will be able to load "tun" and "tap" system extensions for any configuration without user interaction, and that ability will persist after computer restarts, "safe boots", and updates to Tunnelblick.

Note: If you are using a "tun" VPN, you can avoid needing to load the "tun" system extension. See the note at the start of Errors Loading Kexts (Device Drivers).
I presume since TunnelBlick uses the same mechanism as BII/SheepShaver, this information is also appropriate here; I haven't tested it yet myself as SLIRP networking is usually good enough for me.
RichCini
Inquisitive Elf
Posts: 34
Joined: Fri Feb 28, 2020 3:10 am

Re: Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by RichCini »

Going back to the sound issues, I found another thread (viewtopic.php?f=6&t=9134) which says it relates to the ROM version. Indeed, this fixed it for me, changing from the Q900 to the Q650 ROM. So, all good there.

The only thing to fix is the startup chime. I saw other very old posts indicating that the the OSX version of Basilisk didn't support a configurable startup chime. I also tried putting a WAV file in the System folder in the emulation (as was suggested) and that didn't work. Any ideas?

Thanks!
Rich
User avatar
adespoton
Forum All-Star
Posts: 3350
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by adespoton »

RichCini wrote: Wed Feb 03, 2021 10:08 pm Going back to the sound issues, I found another thread (viewtopic.php?f=6&t=9134) which says it relates to the ROM version. Indeed, this fixed it for me, changing from the Q900 to the Q650 ROM. So, all good there.

The only thing to fix is the startup chime. I saw other very old posts indicating that the the OSX version of Basilisk didn't support a configurable startup chime. I also tried putting a WAV file in the System folder in the emulation (as was suggested) and that didn't work. Any ideas?

Thanks!
Rich
Hmm... I remember fixing the startup chime issue at some point, but I think it's broken again in the configuration I'm currently using. I do have all the sound files; you could likely script things so the file plays as BII starts up; that's essentially what the Windows version does anyways.
RichCini
Inquisitive Elf
Posts: 34
Joined: Fri Feb 28, 2020 3:10 am

Re: Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by RichCini »

I took a look at the prefs file and there isn't anything in there to indicate a file to play (or not play). I might peruse the source code to see where it might be. I have a few different sound files (WAV format). At least it's not just me :-)

I did find one mention in rom_patches.c about skipping the startup chime, but it was in the code block for the Classic (patch_rom_classic).

Rich
User avatar
Ronald P. Regensburg
Expert User
Posts: 6726
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by Ronald P. Regensburg »

As far as I am aware, the startup chime was never implemented in BasiliskII for MacOSX. You can put a sound file in the Startup items folder in the System Folder, but the sound would then play later it the startup process. Of course it needs to be a file format that the installed MacOS can play, like a System 7 sound file.
RichCini
Inquisitive Elf
Posts: 34
Joined: Fri Feb 28, 2020 3:10 am

Re: Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by RichCini »

Ron -

Thanks, that’s helpful. Two questions to help narrow things down since I may try adding it. Does the sound exist on the Windows platform and is the sound data contained in the ROM and if so, what format?

Rich
User avatar
Cat_7
Expert User
Posts: 5342
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by Cat_7 »

A long time ago I created a Windows build that could play a sound when that sound was placed in the Basilisk folder.
See here: viewtopic.php?f=6&t=5282
under BasiliskII for Windows, with startup sounds. More sound are available there as well.

Best,
Cat_7
RichCini
Inquisitive Elf
Posts: 34
Joined: Fri Feb 28, 2020 3:10 am

Re: Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by RichCini »

Thanks @Cat_7 for that link, it was very helpful. I didn't see the source archive there, even for the Build 142 referenced. Is that available somewhere or really is it just the small code snippet for startupsound later in the thread? If it's that simple, then I'd guess adding a call to the sound somewhere in main.cpp before init finishes makes sense.
RichCini
Inquisitive Elf
Posts: 34
Joined: Fri Feb 28, 2020 3:10 am

Re: Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by RichCini »

Ok, I did a little work on this today and I can get a startup sound working in the OSX build. The below code can be pasted into main_unix.cpp @ line 865. It's not perfect because it occurs before the main window opens, but it's close. The "right" place for it would be just after the main window was created, but I'm having trouble finding that spot (I'm not too familiar with OSX programming; I program mostly in Windows). There may be ways to shorten/improve but it's a start. WAV file format is 44100 16-bit mono. Although the code is below, I did put it into a separate source file which can be dropped into the project and called @ main_unix.cpp:865 or wherever.

Code: Select all

    // RAC - looks like a good place to play the startup chime
    SDL_AudioSpec wav_spec;
    Uint32 wav_length;
    Uint8 *wav_buffer;
    SDL_AudioSpec desired;
    SDL_AudioSpec obtained;

    SDL_zero(desired);
    desired.freq = 44100;
    desired.format = AUDIO_S16;
    desired.channels = 1;
    desired.samples = 4096;
    desired.callback = NULL;

    if (SDL_LoadWAV("startup.wav", &wav_spec, &wav_buffer, &wav_length)){
        SDL_AudioDeviceID deviceId = SDL_OpenAudioDevice(NULL, 0, &desired, &obtained, 0);

        if (deviceId){
            int success = SDL_QueueAudio(deviceId, wav_buffer, wav_length);

            SDL_PauseAudioDevice(deviceId, 0);
            SDL_Delay(1500);
            SDL_CloseAudioDevice(deviceId);
        }
        else
            printf("%s", "Audio driver failed to initialize");

        SDL_FreeWAV(wav_buffer);
    }
    else
        printf("%s", "WAV file failed to load");

Rich
kanjitalk755
Mac Mechanic
Posts: 193
Joined: Thu Nov 09, 2017 12:06 pm

Re: Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by kanjitalk755 »

I have incorporated your code.

https://github.com/kanjitalk755/macemu
RichCini
Inquisitive Elf
Posts: 34
Joined: Fri Feb 28, 2020 3:10 am

Re: Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by RichCini »

Thanks!

If you’d like I can PM you the same code in two source files rather than in-line or I can try to submit on GitHub. Up to you.

Also, I’d like to find a better spot for the chime to sound, like after main window creation. If you can tell me where that is, I can test it. The original spot is after all of what I think are the hardware setups but I think it’s clunky to sound before the main window is open.

Rich
User avatar
adespoton
Forum All-Star
Posts: 3350
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by adespoton »

The "right" place from a functional perspective would be right after BII patches the ROM and sets it up for loading. In the original, the chime loads after the system self-test, but IIRC, BII skips the self-test because it would fail due to the patching.

I suppose it should be possible if anyone has the inclination to re-purpose the self-test routine results for BII configuration test results, assuming a ROM is found. If that was done, we could even re-use the embedded chimes from the ROM instead of relying on externally loaded sounds.

But this is one of those "would be interesting" ideas, as I don't have the time or inclination to patch that in myself right now :)

In any case, thanks for stepping in and implementing something usable here!
RichCini
Inquisitive Elf
Posts: 34
Joined: Fri Feb 28, 2020 3:10 am

Re: Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by RichCini »

Thanks. In which chase, the "right" place for the call to PlayStartupChime() is @ main.cpp:196 (adjusted for adding "#include startupchime.hpp") after the call to PatchROM(). I made the patch into a separate source file/header.

As for playing what's in ROM, is the chime stored as a resource with a pointer? I see that rom_patches.cpp has a lot of useful ROM-related stuff that's supposed to be printed somewhere when PatchROM is called, but I'm not seeing the output.

I'm happy to try to make this work...just need a quick roadmap to the internals.

Rich
User avatar
adespoton
Forum All-Star
Posts: 3350
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by adespoton »

If I remember correctly, the chime is stored in-line as a SND resource, and is referenced via pointer. Some useful stuff to help patch the right references might be available here: https://github.com/elliotnunn/mac-rom , https://github.com/jpluimers/macrompatcher/ and http://educ.jmu.edu/~jarvislb/utils/macintosh/boot2.htm
RichCini
Inquisitive Elf
Posts: 34
Joined: Fri Feb 28, 2020 3:10 am

Re: Sound issues with BasiliskII-1.0 SDL2 and OSX Catalina

Post by RichCini »

So based on the last site, the chime sounds before the desktop appears. Right now, it sounds before the main window opens. Probably tough to find the exact right spot because of the execution speed. I've tried it in a few places and it seems to work in each place.

I also like the mac-rom site. Very interesting stuff there.

Rich
Last edited by RichCini on Sun Feb 07, 2021 2:55 am, edited 2 times in total.
Post Reply