From 00aabbe81284480107a4319fd0b8934f6309c874 Mon Sep 17 00:00:00 2001 From: cebix <> Date: Wed, 20 Oct 1999 15:14:00 +0000 Subject: [PATCH] - renamed main_volume to speaker_volume and dac_volume to main_volume (same for mute) - added defines for headphone volume/mute --- BasiliskII/src/AmigaOS/audio_amiga.cpp | 8 ++-- BasiliskII/src/BeOS/audio_beos.cpp | 8 ++-- BasiliskII/src/Unix/Linux/audio_linux.cpp | 16 +++---- BasiliskII/src/Unix/Solaris/audio_solaris.cpp | 8 ++-- BasiliskII/src/audio.cpp | 42 +++++++++++++------ BasiliskII/src/dummy/audio_dummy.cpp | 8 ++-- BasiliskII/src/extfs.cpp | 31 ++++++++------ BasiliskII/src/include/audio.h | 8 ++-- BasiliskII/src/include/audio_defs.h | 13 +++--- 9 files changed, 84 insertions(+), 58 deletions(-) diff --git a/BasiliskII/src/AmigaOS/audio_amiga.cpp b/BasiliskII/src/AmigaOS/audio_amiga.cpp index 412168ce..7ef1b332 100644 --- a/BasiliskII/src/AmigaOS/audio_amiga.cpp +++ b/BasiliskII/src/AmigaOS/audio_amiga.cpp @@ -279,12 +279,12 @@ uint32 audio_get_main_volume(void) return 0x01000100; } -bool audio_get_dac_mute(void) +bool audio_get_speaker_mute(void) { return false; } -uint32 audio_get_dac_volume(void) +uint32 audio_get_speaker_volume(void) { return 0x01000100; } @@ -297,10 +297,10 @@ void audio_set_main_volume(uint32 vol) { } -void audio_set_dac_mute(bool mute) +void audio_set_speaker_mute(bool mute) { } -void audio_set_dac_volume(uint32 vol) +void audio_set_speaker_volume(uint32 vol) { } diff --git a/BasiliskII/src/BeOS/audio_beos.cpp b/BasiliskII/src/BeOS/audio_beos.cpp index 20c1991a..9ef8cb26 100644 --- a/BasiliskII/src/BeOS/audio_beos.cpp +++ b/BasiliskII/src/BeOS/audio_beos.cpp @@ -306,12 +306,12 @@ uint32 audio_get_main_volume(void) return 0x01000100; } -bool audio_get_dac_mute(void) +bool audio_get_speaker_mute(void) { return false; } -uint32 audio_get_dac_volume(void) +uint32 audio_get_speaker_volume(void) { return 0x01000100; } @@ -329,10 +329,10 @@ void audio_set_main_volume(uint32 vol) } } -void audio_set_dac_mute(bool mute) +void audio_set_speaker_mute(bool mute) { } -void audio_set_dac_volume(uint32 vol) +void audio_set_speaker_volume(uint32 vol) { } diff --git a/BasiliskII/src/Unix/Linux/audio_linux.cpp b/BasiliskII/src/Unix/Linux/audio_linux.cpp index e3cb4a3b..bcca6eb4 100644 --- a/BasiliskII/src/Unix/Linux/audio_linux.cpp +++ b/BasiliskII/src/Unix/Linux/audio_linux.cpp @@ -315,7 +315,7 @@ uint32 audio_get_main_volume(void) { if (mixer_fd >= 0) { int vol; - if (ioctl(mixer_fd, SOUND_MIXER_READ_VOLUME, &vol) == 0) { + if (ioctl(mixer_fd, SOUND_MIXER_READ_PCM, &vol) == 0) { int left = vol >> 8; int right = vol & 0xff; return ((left * 256 / 100) << 16) | (right * 256 / 100); @@ -324,16 +324,16 @@ uint32 audio_get_main_volume(void) return 0x01000100; } -bool audio_get_dac_mute(void) +bool audio_get_speaker_mute(void) { return false; } -uint32 audio_get_dac_volume(void) +uint32 audio_get_speaker_volume(void) { if (mixer_fd >= 0) { int vol; - if (ioctl(mixer_fd, SOUND_MIXER_READ_PCM, &vol) == 0) { + if (ioctl(mixer_fd, SOUND_MIXER_READ_SPEAKER, &vol) == 0) { int left = vol >> 8; int right = vol & 0xff; return ((left * 256 / 100) << 16) | (right * 256 / 100); @@ -352,20 +352,20 @@ void audio_set_main_volume(uint32 vol) int left = vol >> 16; int right = vol & 0xffff; int p = ((left * 100 / 256) << 8) | (right * 100 / 256); - ioctl(mixer_fd, SOUND_MIXER_WRITE_VOLUME, &p); + ioctl(mixer_fd, SOUND_MIXER_WRITE_PCM, &p); } } -void audio_set_dac_mute(bool mute) +void audio_set_speaker_mute(bool mute) { } -void audio_set_dac_volume(uint32 vol) +void audio_set_speaker_volume(uint32 vol) { if (mixer_fd >= 0) { int left = vol >> 16; int right = vol & 0xffff; int p = ((left * 100 / 256) << 8) | (right * 100 / 256); - ioctl(mixer_fd, SOUND_MIXER_WRITE_PCM, &p); + ioctl(mixer_fd, SOUND_MIXER_WRITE_SPEAKER, &p); } } diff --git a/BasiliskII/src/Unix/Solaris/audio_solaris.cpp b/BasiliskII/src/Unix/Solaris/audio_solaris.cpp index fa27e1fc..4163f6de 100644 --- a/BasiliskII/src/Unix/Solaris/audio_solaris.cpp +++ b/BasiliskII/src/Unix/Solaris/audio_solaris.cpp @@ -296,12 +296,12 @@ uint32 audio_get_main_volume(void) return 0x01000100; } -bool audio_get_dac_mute(void) +bool audio_get_speaker_mute(void) { return false; } -uint32 audio_get_dac_volume(void) +uint32 audio_get_speaker_volume(void) { return 0x01000100; } @@ -314,10 +314,10 @@ void audio_set_main_volume(uint32 vol) { } -void audio_set_dac_mute(bool mute) +void audio_set_speaker_mute(bool mute) { } -void audio_set_dac_volume(uint32 vol) +void audio_set_speaker_volume(uint32 vol) { } diff --git a/BasiliskII/src/audio.cpp b/BasiliskII/src/audio.cpp index 3cc2407a..ffdb5c8d 100644 --- a/BasiliskII/src/audio.cpp +++ b/BasiliskII/src/audio.cpp @@ -113,29 +113,41 @@ static int32 AudioGetInfo(uint32 infoPtr, uint32 selector, uint32 sourceID) } case siSpeakerMute: - WriteMacInt16(infoPtr, audio_get_main_mute()); + WriteMacInt16(infoPtr, audio_get_speaker_mute()); break; case siSpeakerVolume: - WriteMacInt32(infoPtr, audio_get_main_volume()); + WriteMacInt32(infoPtr, audio_get_speaker_volume()); + break; + + case siHeadphoneMute: + WriteMacInt16(infoPtr, 0); + break; + + case siHeadphoneVolume: + WriteMacInt32(infoPtr, 0x01000100); + break; + + case siHeadphoneVolumeSteps: + WriteMacInt16(infoPtr, 13); break; case siHardwareMute: - WriteMacInt16(infoPtr, audio_get_dac_mute()); + WriteMacInt16(infoPtr, audio_get_main_mute()); break; case siHardwareVolume: - WriteMacInt32(infoPtr, audio_get_dac_volume()); + WriteMacInt32(infoPtr, audio_get_main_volume()); + break; + + case siHardwareVolumeSteps: + WriteMacInt16(infoPtr, 13); break; case siHardwareBusy: WriteMacInt16(infoPtr, AudioStatus.num_sources != 0); break; - case siHardwareVolumeSteps: - WriteMacInt16(infoPtr, 64); - break; - default: // Delegate to Apple Mixer if (AudioStatus.mixer == 0) return badComponentSelector; @@ -197,21 +209,25 @@ static int32 AudioSetInfo(uint32 infoPtr, uint32 selector, uint32 sourceID) return badChannel; case siSpeakerMute: - audio_set_main_mute((uint16)infoPtr); + audio_set_speaker_mute((uint16)infoPtr); break; case siSpeakerVolume: D(bug(" set speaker volume %08lx\n", infoPtr)); - audio_set_main_volume(infoPtr); + audio_set_speaker_volume(infoPtr); + break; + + case siHeadphoneMute: + case siHeadphoneVolume: break; case siHardwareMute: - audio_set_dac_mute((uint16)infoPtr); + audio_set_main_mute((uint16)infoPtr); break; case siHardwareVolume: D(bug(" set hardware volume %08lx\n", infoPtr)); - audio_set_dac_volume(infoPtr); + audio_set_main_volume(infoPtr); break; default: // Delegate to Apple Mixer @@ -351,7 +367,7 @@ adat_error: printf("FATAL: audio component data block initialization error\n"); return noErr; case kComponentVersionSelect: - return 0x00010002; + return 0x00010003; case kComponentCloseSelect: open_count--; diff --git a/BasiliskII/src/dummy/audio_dummy.cpp b/BasiliskII/src/dummy/audio_dummy.cpp index 8dfbe19a..efcc3528 100644 --- a/BasiliskII/src/dummy/audio_dummy.cpp +++ b/BasiliskII/src/dummy/audio_dummy.cpp @@ -131,12 +131,12 @@ uint32 audio_get_main_volume(void) return 0x01000100; } -bool audio_get_dac_mute(void) +bool audio_get_speaker_mute(void) { return false; } -uint32 audio_get_dac_volume(void) +uint32 audio_get_speaker_volume(void) { return 0x01000100; } @@ -149,10 +149,10 @@ void audio_set_main_volume(uint32 vol) { } -void audio_set_dac_mute(bool mute) +void audio_set_speaker_mute(bool mute) { } -void audio_set_dac_volume(uint32 vol) +void audio_set_speaker_volume(uint32 vol) { } diff --git a/BasiliskII/src/extfs.cpp b/BasiliskII/src/extfs.cpp index 94e3f2d0..e0d43e0c 100644 --- a/BasiliskII/src/extfs.cpp +++ b/BasiliskII/src/extfs.cpp @@ -19,16 +19,19 @@ */ /* -TODO: -LockRng -UnlockRng -(CatSearch) -(MakeFSSpec) -(GetVolMountInfoSize) -(GetVolMountInfo) -(GetForeignPrivs) -(SetForeignPrivs) -*/ + * SEE ALSO + * Guide to the File System Manager (from FSM 1.2 SDK) + * + * TODO + * LockRng + * UnlockRng + * (CatSearch) + * (MakeFSSpec) + * (GetVolMountInfoSize) + * (GetVolMountInfo) + * (GetForeignPrivs) + * (SetForeignPrivs) + */ #include "sysdeps.h" @@ -379,15 +382,19 @@ void InstallExtFS(void) r.d[0] = gestaltFSAttr; Execute68kTrap(0xa1ad, &r); // Gestalt() D(bug("FSAttr %ld, %08lx\n", r.d[0], r.a[0])); - if ((r.d[0] & 0xffff) || !(r.a[0] & (1 << gestaltHasFileSystemManager))) + if ((r.d[0] & 0xffff) || !(r.a[0] & (1 << gestaltHasFileSystemManager))) { + printf("WARNING: No FSM present, disabling ExtFS\n"); return; + } // Yes, version >=1.2? r.d[0] = gestaltFSMVersion; Execute68kTrap(0xa1ad, &r); // Gestalt() D(bug("FSMVersion %ld, %08lx\n", r.d[0], r.a[0])); - if ((r.d[0] & 0xffff) || (r.a[0] < 0x0120)) + if ((r.d[0] & 0xffff) || (r.a[0] < 0x0120)) { + printf("WARNING: FSM <1.2 found, disabling ExtFS\n"); return; + } D(bug("FSM present\n")); diff --git a/BasiliskII/src/include/audio.h b/BasiliskII/src/include/audio.h index 87d862b3..76657eae 100644 --- a/BasiliskII/src/include/audio.h +++ b/BasiliskII/src/include/audio.h @@ -40,12 +40,12 @@ extern void audio_set_channels(int index); extern bool audio_get_main_mute(void); extern uint32 audio_get_main_volume(void); -extern bool audio_get_dac_mute(void); -extern uint32 audio_get_dac_volume(void); +extern bool audio_get_speaker_mute(void); +extern uint32 audio_get_speaker_volume(void); extern void audio_set_main_mute(bool mute); extern void audio_set_main_volume(uint32 vol); -extern void audio_set_dac_mute(bool mute); -extern void audio_set_dac_volume(uint32 vol); +extern void audio_set_speaker_mute(bool mute); +extern void audio_set_speaker_volume(uint32 vol); // Current audio status struct audio_status { diff --git a/BasiliskII/src/include/audio_defs.h b/BasiliskII/src/include/audio_defs.h index e8a30939..fa0c8bdd 100644 --- a/BasiliskII/src/include/audio_defs.h +++ b/BasiliskII/src/include/audio_defs.h @@ -60,18 +60,21 @@ enum { // Sound information selectors enum { + siNumberChannels = 'chan', // current number of channels + siChannelAvailable = 'chav', // number of channels available siSampleRate = 'srat', // current sample rate siSampleRateAvailable = 'srav', // sample rates available siSampleSize = 'ssiz', // current sample size siSampleSizeAvailable = 'ssav', // sample sizes available - siNumberChannels = 'chan', // current number of channels - siChannelAvailable = 'chav', // number of channels available - siSpeakerMute = 'smut', // mute state of all built-in speaker - siSpeakerVolume = 'svol', // volume level of built-in speaker siHardwareMute = 'hmut', // mute state of all hardware siHardwareVolume = 'hvol', // volume level of all hardware siHardwareVolumeSteps = 'hstp', // number of volume steps for hardware - siHardwareBusy = 'hwbs' // sound hardware is in use + siHardwareBusy = 'hwbs', // sound hardware is in use + siHeadphoneMute = 'pmut', // mute state of headphone + siHeadphoneVolume = 'pvol', // volume level of headphone + siHeadphoneVolumeSteps = 'hdst', // number of volume steps for headphone + siSpeakerMute = 'smut', // mute state of all built-in speakers + siSpeakerVolume = 'svol' // volume level of built-in speaker }; enum { // ComponentResource struct