1 |
/* |
2 |
* audio.h - Audio support |
3 |
* |
4 |
* Basilisk II (C) 1997-2001 Christian Bauer |
5 |
* |
6 |
* This program is free software; you can redistribute it and/or modify |
7 |
* it under the terms of the GNU General Public License as published by |
8 |
* the Free Software Foundation; either version 2 of the License, or |
9 |
* (at your option) any later version. |
10 |
* |
11 |
* This program is distributed in the hope that it will be useful, |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
* GNU General Public License for more details. |
15 |
* |
16 |
* You should have received a copy of the GNU General Public License |
17 |
* along with this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 |
*/ |
20 |
|
21 |
#ifndef AUDIO_H |
22 |
#define AUDIO_H |
23 |
|
24 |
#include <vector> |
25 |
|
26 |
#ifndef NO_STD_NAMESPACE |
27 |
using std::vector; |
28 |
#endif |
29 |
|
30 |
extern int32 AudioDispatch(uint32 params, uint32 ti); |
31 |
|
32 |
extern bool AudioAvailable; // Flag: audio output available (from the software point of view) |
33 |
|
34 |
extern int16 SoundInOpen(uint32 pb, uint32 dce); |
35 |
extern int16 SoundInPrime(uint32 pb, uint32 dce); |
36 |
extern int16 SoundInControl(uint32 pb, uint32 dce); |
37 |
extern int16 SoundInStatus(uint32 pb, uint32 dce); |
38 |
extern int16 SoundInClose(uint32 pb, uint32 dce); |
39 |
|
40 |
// System specific and internal functions/data |
41 |
extern void AudioInit(void); |
42 |
extern void AudioExit(void); |
43 |
extern void AudioReset(void); |
44 |
|
45 |
extern void AudioInterrupt(void); |
46 |
|
47 |
extern void audio_enter_stream(void); |
48 |
extern void audio_exit_stream(void); |
49 |
|
50 |
extern bool audio_set_sample_rate(int index); |
51 |
extern bool audio_set_sample_size(int index); |
52 |
extern bool audio_set_channels(int index); |
53 |
|
54 |
extern bool audio_get_main_mute(void); |
55 |
extern uint32 audio_get_main_volume(void); |
56 |
extern bool audio_get_speaker_mute(void); |
57 |
extern uint32 audio_get_speaker_volume(void); |
58 |
extern void audio_set_main_mute(bool mute); |
59 |
extern void audio_set_main_volume(uint32 vol); |
60 |
extern void audio_set_speaker_mute(bool mute); |
61 |
extern void audio_set_speaker_volume(uint32 vol); |
62 |
|
63 |
// Current audio status |
64 |
struct audio_status { |
65 |
uint32 sample_rate; // 16.16 fixed point |
66 |
uint32 sample_size; // 8 or 16 |
67 |
uint32 channels; // 1 (mono) or 2 (stereo) |
68 |
uint32 mixer; // Mac address of Apple Mixer |
69 |
int num_sources; // Number of active sources |
70 |
}; |
71 |
extern struct audio_status AudioStatus; |
72 |
|
73 |
extern bool audio_open; // Flag: audio is open and ready |
74 |
extern int audio_frames_per_block; // Number of audio frames per block |
75 |
extern uint32 audio_component_flags; // Component feature flags |
76 |
|
77 |
extern vector<uint32> audio_sample_rates; // Vector of supported sample rates (16.16 fixed point) |
78 |
extern vector<uint16> audio_sample_sizes; // Vector of supported sample sizes |
79 |
extern vector<uint16> audio_channel_counts; // Array of supported channels counts |
80 |
|
81 |
// Audio component global data and 68k routines |
82 |
enum { |
83 |
adatDelegateCall = 0, // 68k code to call DelegateCall() |
84 |
adatOpenMixer = 14, // 68k code to call OpenMixerSoundComponent() |
85 |
adatCloseMixer = 36, // 68k code to call CloseMixerSoundComponent() |
86 |
adatGetInfo = 54, // 68k code to call GetInfo() |
87 |
adatSetInfo = 78, // 68k code to call SetInfo() |
88 |
adatPlaySourceBuffer = 102, // 68k code to call PlaySourceBuffer() |
89 |
adatGetSourceData = 126, // 68k code to call GetSourceData() |
90 |
adatData = 146, // SoundComponentData struct |
91 |
adatMixer = 174, // Mac address of mixer, returned by adatOpenMixer |
92 |
adatStreamInfo = 178, // Mac address of stream info, returned by adatGetSourceData |
93 |
SIZEOF_adat = 182 |
94 |
}; |
95 |
|
96 |
extern uint32 audio_data; // Mac address of global data area |
97 |
|
98 |
#endif |