ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/MacOSX/audio_macosx.cpp
Revision: 1.3
Committed: 2005-01-30T21:42:13Z (19 years, 9 months ago) by gbeauche
Branch: MAIN
CVS Tags: nigel-build-17
Changes since 1.2: +2 -2 lines
Log Message:
Happy New Year!

File Contents

# User Rev Content
1 nigel 1.1 /*
2     * audio_MacOSX.cpp - Based on audio_dummy.cpp
3     *
4 gbeauche 1.3 * $Id: audio_macosx.cpp,v 1.2 2004/01/12 15:29:24 cebix Exp $
5 nigel 1.1 *
6 gbeauche 1.3 * Basilisk II (C) 1997-2005 Christian Bauer
7 nigel 1.1 *
8     * This program is free software; you can redistribute it and/or modify
9     * it under the terms of the GNU General Public License as published by
10     * the Free Software Foundation; either version 2 of the License, or
11     * (at your option) any later version.
12     *
13     * This program is distributed in the hope that it will be useful,
14     * but WITHOUT ANY WARRANTY; without even the implied warranty of
15     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16     * GNU General Public License for more details.
17     *
18     * You should have received a copy of the GNU General Public License
19     * along with this program; if not, write to the Free Software
20     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21     */
22    
23     #include "sysdeps.h"
24     #include "prefs.h"
25     #include "audio.h"
26     #include "audio_defs.h"
27    
28     #define DEBUG 1
29     #include "debug.h"
30    
31    
32     #include "main_macosx.h"
33    
34     #import <CoreFoundation/CoreFoundation.h>
35    
36     #import <CoreAudio/CoreAudio.h>
37    
38    
39    
40     AudioDeviceID device = kAudioDeviceUnknown;
41    
42     /*
43     * Initialization
44     */
45    
46     void AudioInit(void)
47     {
48     int count;
49    
50     // Init audio status and feature flags
51     AudioStatus.sample_rate = 44100 << 16;
52     AudioStatus.sample_size = 16;
53     AudioStatus.channels = 2;
54     AudioStatus.mixer = 0;
55     AudioStatus.num_sources = 0;
56     audio_component_flags = cmpWantsRegisterMessage | kStereoOut | k16BitOut;
57    
58     // Only one sample format is supported
59     audio_sample_rates.push_back(44100 << 16);
60     audio_sample_sizes.push_back(16);
61     audio_channel_counts.push_back(2);
62    
63     // Sound disabled in prefs? Then do nothing
64     if (PrefsFindBool("nosound"))
65     return;
66    
67    
68     // Get default audio device
69    
70     count = sizeof(device);
71     err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice,
72     &count, (void *) &device);
73     if ( err != noErr || device == kAudioDeviceUnknown )
74     {
75     NSLog(@"Failed to get default audio output device");
76     audio_open = false;
77     return;
78     }
79    
80    
81     // Audio not available
82     audio_open = false;
83     }
84    
85    
86     /*
87     * Deinitialization
88     */
89    
90     void AudioExit(void)
91     {
92     }
93    
94    
95     /*
96     * First source added, start audio stream
97     */
98    
99     void audio_enter_stream()
100     {
101     }
102    
103    
104     /*
105     * Last source removed, stop audio stream
106     */
107    
108     void audio_exit_stream()
109     {
110     }
111    
112    
113     /*
114     * MacOS audio interrupt, read next data block
115     */
116    
117     void AudioInterrupt(void)
118     {
119     D(bug("AudioInterrupt\n"));
120     }
121    
122    
123     /*
124     * Set sampling parameters
125     * "index" is an index into the audio_sample_rates[] etc. vectors
126     * It is guaranteed that AudioStatus.num_sources == 0
127     */
128    
129     bool audio_set_sample_rate(int index)
130     {
131     }
132    
133     bool audio_set_sample_size(int index)
134     {
135     }
136    
137     bool audio_set_channels(int index)
138     {
139     }
140    
141    
142     /*
143     * Get/set volume controls (volume values received/returned have the left channel
144     * volume in the upper 16 bits and the right channel volume in the lower 16 bits;
145     * both volumes are 8.8 fixed point values with 0x0100 meaning "maximum volume"))
146     */
147    
148     bool audio_get_main_mute(void)
149     {
150     return false;
151     }
152    
153     uint32 audio_get_main_volume(void)
154     {
155     return 0x01000100;
156     }
157    
158     bool audio_get_speaker_mute(void)
159     {
160     return false;
161     }
162    
163     uint32 audio_get_speaker_volume(void)
164     {
165     return 0x01000100;
166     }
167    
168     void audio_set_main_mute(bool mute)
169     {
170     }
171    
172     void audio_set_main_volume(uint32 vol)
173     {
174     }
175    
176     void audio_set_speaker_mute(bool mute)
177     {
178     }
179    
180     void audio_set_speaker_volume(uint32 vol)
181     {
182     }