mirror of
https://github.com/jonthysell/MacLO.git
synced 2025-01-03 10:29:22 +00:00
Fix sounds on system 6
This commit is contained in:
parent
15378f1077
commit
efaf627495
BIN
src/MacLO.pi.bin
BIN
src/MacLO.pi.bin
Binary file not shown.
Binary file not shown.
26
src/Sounds.c
26
src/Sounds.c
@ -1,9 +1,13 @@
|
||||
// Copyright (c) Jon Thysell <http://jonthysell.com>
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include <GestaltEqu.h>
|
||||
|
||||
#include "Sounds.h"
|
||||
|
||||
#define ClickSndResID BaseResID
|
||||
#define SndBaseResId 8192
|
||||
|
||||
#define ClickSndResID SndBaseResId
|
||||
#define RetrySndResID (ClickSndResID + 1)
|
||||
#define DoneSndResID (RetrySndResID + 1)
|
||||
|
||||
@ -12,9 +16,19 @@
|
||||
|
||||
void Sounds_Init(Sounds *pSounds)
|
||||
{
|
||||
pSounds->Enabled = DefaultEnabled;
|
||||
OSErr err;
|
||||
int32_t sysVersion;
|
||||
|
||||
SndNewChannel(&(pSounds->SndChannel), 0, 0, nil);
|
||||
pSounds->Enabled = DefaultEnabled;
|
||||
pSounds->SndChannel = nil;
|
||||
|
||||
err = Gestalt(gestaltSystemVersion, &sysVersion);
|
||||
if (err == noErr && sysVersion >= 0x0700)
|
||||
{
|
||||
// Only create a shared sound channel on System 7
|
||||
// or above in order to cheaply support async sound
|
||||
SndNewChannel(&(pSounds->SndChannel), 0, 0, nil);
|
||||
}
|
||||
|
||||
pSounds->ClickSnd = GetResource('snd ', ClickSndResID);
|
||||
if (pSounds->ClickSnd == nil)
|
||||
@ -39,7 +53,9 @@ void Sounds_PlayClickSnd(const Sounds *pSounds)
|
||||
{
|
||||
if (pSounds->Enabled)
|
||||
{
|
||||
HLock(pSounds->ClickSnd);
|
||||
SndPlay(pSounds->SndChannel, pSounds->ClickSnd, PlaySoundsAsync);
|
||||
HUnlock(pSounds->ClickSnd);
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,7 +63,9 @@ void Sounds_PlayRetrySnd(const Sounds *pSounds)
|
||||
{
|
||||
if (pSounds->Enabled)
|
||||
{
|
||||
HLock(pSounds->RetrySnd);
|
||||
SndPlay(pSounds->SndChannel, pSounds->RetrySnd, PlaySoundsAsync);
|
||||
HUnlock(pSounds->RetrySnd);
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,6 +73,8 @@ void Sounds_PlayDoneSnd(const Sounds *pSounds)
|
||||
{
|
||||
if (pSounds->Enabled)
|
||||
{
|
||||
HLock(pSounds->DoneSnd);
|
||||
SndPlay(pSounds->SndChannel, pSounds->DoneSnd, PlaySoundsAsync);
|
||||
HUnlock(pSounds->DoneSnd);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user