/* * audio_MacOSX.cpp - Based on audio_dummy.cpp * * $Id$ * * Basilisk II (C) 1997-2002 Christian Bauer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "sysdeps.h" #include "prefs.h" #include "audio.h" #include "audio_defs.h" #define DEBUG 1 #include "debug.h" #include "main_macosx.h" #import #import AudioDeviceID device = kAudioDeviceUnknown; /* * Initialization */ void AudioInit(void) { int count; // Init audio status and feature flags AudioStatus.sample_rate = 44100 << 16; AudioStatus.sample_size = 16; AudioStatus.channels = 2; AudioStatus.mixer = 0; AudioStatus.num_sources = 0; audio_component_flags = cmpWantsRegisterMessage | kStereoOut | k16BitOut; // Only one sample format is supported audio_sample_rates.push_back(44100 << 16); audio_sample_sizes.push_back(16); audio_channel_counts.push_back(2); // Sound disabled in prefs? Then do nothing if (PrefsFindBool("nosound")) return; // Get default audio device count = sizeof(device); err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &count, (void *) &device); if ( err != noErr || device == kAudioDeviceUnknown ) { NSLog(@"Failed to get default audio output device"); audio_open = false; return; } // Audio not available audio_open = false; } /* * Deinitialization */ void AudioExit(void) { } /* * First source added, start audio stream */ void audio_enter_stream() { } /* * Last source removed, stop audio stream */ void audio_exit_stream() { } /* * MacOS audio interrupt, read next data block */ void AudioInterrupt(void) { D(bug("AudioInterrupt\n")); } /* * Set sampling parameters * "index" is an index into the audio_sample_rates[] etc. vectors * It is guaranteed that AudioStatus.num_sources == 0 */ bool audio_set_sample_rate(int index) { } bool audio_set_sample_size(int index) { } bool audio_set_channels(int index) { } /* * Get/set volume controls (volume values received/returned have the left channel * volume in the upper 16 bits and the right channel volume in the lower 16 bits; * both volumes are 8.8 fixed point values with 0x0100 meaning "maximum volume")) */ bool audio_get_main_mute(void) { return false; } uint32 audio_get_main_volume(void) { return 0x01000100; } bool audio_get_speaker_mute(void) { return false; } uint32 audio_get_speaker_volume(void) { return 0x01000100; } void audio_set_main_mute(bool mute) { } void audio_set_main_volume(uint32 vol) { } void audio_set_speaker_mute(bool mute) { } void audio_set_speaker_volume(uint32 vol) { }