1/**********************************************************************************************************************************
2*
3*   OpenAL cross platform audio library
4*   Copyright (c) 2004, Apple Computer, Inc. All rights reserved.
5*
6*   Redistribution and use in source and binary forms, with or without modification, are permitted provided
7*   that the following conditions are met:
8*
9*   1.  Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10*   2.  Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
11*       disclaimer in the documentation and/or other materials provided with the distribution.
12*   3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of its contributors may be used to endorse or promote
13*       products derived from this software without specific prior written permission.
14*
15*   THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16*   THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS
17*   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
18*   TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
19*   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
20*   USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21*
22**********************************************************************************************************************************/
23
24#ifndef __OAL_IMP__
25#define __OAL_IMP__
26
27#include "al.h"
28#include "alc.h"
29#include "oalOSX.h"
30#include <Carbon/Carbon.h>
31#include <map>
32
33typedef ALvoid			(*alSourceNotificationProc) (ALuint sid, ALuint	notificationID, ALvoid*	userData);
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39// added for OSX Extension
40ALC_API ALvoid alcMacOSXRenderingQuality (ALint value);
41ALC_API ALvoid alMacOSXRenderChannelCount (ALint value);
42ALC_API ALvoid alcMacOSXMixerMaxiumumBusses (ALint value);
43ALC_API ALvoid alcMacOSXMixerOutputRate(ALdouble value);
44
45ALC_API ALint alcMacOSXGetRenderingQuality ();
46ALC_API ALint alMacOSXGetRenderChannelCount ();
47ALC_API ALint alcMacOSXGetMixerMaxiumumBusses ();
48ALC_API ALdouble alcMacOSXGetMixerOutputRate();
49
50AL_API ALvoid AL_APIENTRY alSetInteger (ALenum pname, ALint value);
51AL_API ALvoid AL_APIENTRY alSetDouble (ALenum pname, ALdouble value);
52
53AL_API ALvoid	AL_APIENTRY	alBufferDataStatic (ALint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq);
54
55AL_API ALenum alSourceAddNotification (ALuint sid, ALuint notificationID, alSourceNotificationProc notifyProc, ALvoid* userData);
56AL_API ALvoid alSourceRemoveNotification (ALuint	sid, ALuint notificationID, alSourceNotificationProc notifyProc, ALvoid* userData);
57
58// added for ASA (Apple Environmental Audio)
59
60ALC_API ALenum  alcASAGetSource(ALuint property, ALuint source, ALvoid *data, ALuint* dataSize);
61ALC_API ALenum  alcASASetSource(ALuint property, ALuint source, ALvoid *data, ALuint dataSize);
62ALC_API ALenum  alcASAGetListener(ALuint property, ALvoid *data, ALuint* dataSize);
63ALC_API ALenum  alcASASetListener(ALuint property, ALvoid *data, ALuint dataSize);
64
65// Used internally but no longer available via a header file. Some OpenAL applications may have been built with a header
66// that defined these constants so keep defining them.
67
68#define ALC_SPATIAL_RENDERING_QUALITY        0xF002
69#define ALC_MIXER_OUTPUT_RATE		         0xF003
70#define ALC_MIXER_MAXIMUM_BUSSES             0xF004
71#define ALC_RENDER_CHANNEL_COUNT             0xF005
72
73// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
74
75#define AL_FORMAT_MONO_FLOAT32               0x10010
76#define AL_FORMAT_STEREO_FLOAT32             0x10011
77
78// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
79// Continue exporting these deprectaed APIs to prevent runtime link errors
80
81#ifdef TARGET_OS_MAC
82   #if TARGET_OS_MAC
83       #pragma export on
84   #endif
85#endif
86
87
88AL_API ALvoid	AL_APIENTRY alHint( ALenum target, ALenum mode );
89
90#ifdef TARGET_OS_MAC
91   #if TARGET_OS_MAC
92      #pragma export off
93   #endif
94#endif
95
96#ifdef __cplusplus
97}
98#endif
99
100// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
101// development build flags
102#define	USE_AU_TRACER 					0
103#define LOG_GRAPH_AND_MIXER_CHANGES		0
104#define GET_OVERLOAD_NOTIFICATIONS 		0
105#define	LOG_IO 							0
106
107#if LOG_IO
108	#include  "AudioLogger.h"
109#endif
110
111// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
112
113#define AL_MAXBUFFERS 1024
114#define AL_MAXSOURCES 256
115
116#define kDefaultMaximumMixerBusCount    64
117#define kDopplerDefault                 0
118
119enum {
120		kRogerBeepType	= 'rogr',
121		kDistortionType	= 'dist'
122};
123
124#define	THROW_RESULT		if(result != noErr) throw static_cast<OSStatus>(result);
125
126enum {
127		kUnknown3DMixerVersion	= 0,
128		kUnsupported3DMixer		= 1,
129		k3DMixerVersion_1_3		= 13,
130		k3DMixerVersion_2_0,
131		k3DMixerVersion_2_1,
132		k3DMixerVersion_2_2,
133		k3DMixerVersion_2_3
134};
135
136enum {
137		kUnknownAUState	= -1,
138		kAUIsNotPresent	= 0,
139		kAUIsPresent	= 1
140};
141// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
142
143void	alSetError (ALenum errorCode);
144UInt32	Get3DMixerVersion ();
145ALCint  IsDistortionPresent();
146ALCint  IsRogerBeepPresent();
147
148#endif
149
150