Blender V2.61 - r43446
|
00001 /* 00002 * ***** BEGIN GPL LICENSE BLOCK ***** 00003 * 00004 * Copyright 2009-2011 Jörg Hermann Müller 00005 * 00006 * This file is part of AudaSpace. 00007 * 00008 * Audaspace is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * AudaSpace is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with Audaspace; if not, write to the Free Software Foundation, 00020 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00021 * 00022 * ***** END GPL LICENSE BLOCK ***** 00023 */ 00024 00030 #ifndef AUD_SPACE 00031 #define AUD_SPACE 00032 00034 #define AUD_FORMAT_SIZE(format) (format & 0x0F) 00035 00036 #define AUD_DEVICE_SAMPLE_SIZE(specs) (specs.channels * (specs.format & 0x0F)) 00037 00038 #define AUD_SAMPLE_SIZE(specs) (specs.channels * sizeof(sample_t)) 00039 00040 #define AUD_THROW(exception, errorstr) { AUD_Exception e; e.error = exception; e.str = errorstr; throw e; } 00041 00043 #define AUD_COMPARE_SPECS(s1, s2) ((s1.rate == s2.rate) && (s1.channels == s2.channels)) 00044 00046 #define AUD_CHANNEL_BIT(channel) (0x01 << channel) 00047 00049 #define AUD_MIN(a, b) (((a) < (b)) ? (a) : (b)) 00050 00051 #define AUD_MAX(a, b) (((a) > (b)) ? (a) : (b)) 00052 00053 // 5 sec * 44100 samples/sec * 4 bytes/sample * 6 channels 00055 #define AUD_BUFFER_RESIZE_BYTES 5292000 00056 00058 #define AUD_DEFAULT_BUFFER_SIZE 1024 00059 00064 typedef enum 00065 { 00066 AUD_FORMAT_INVALID = 0x00, 00067 AUD_FORMAT_U8 = 0x01, 00068 AUD_FORMAT_S16 = 0x12, 00069 AUD_FORMAT_S24 = 0x13, 00070 AUD_FORMAT_S32 = 0x14, 00071 AUD_FORMAT_FLOAT32 = 0x24, 00072 AUD_FORMAT_FLOAT64 = 0x28 00073 } AUD_SampleFormat; 00074 00076 typedef enum 00077 { 00078 AUD_CHANNELS_INVALID = 0, 00079 AUD_CHANNELS_MONO = 1, 00080 AUD_CHANNELS_STEREO = 2, 00081 AUD_CHANNELS_STEREO_LFE = 3, 00082 AUD_CHANNELS_SURROUND4 = 4, 00083 AUD_CHANNELS_SURROUND5 = 5, 00084 AUD_CHANNELS_SURROUND51 = 6, 00085 AUD_CHANNELS_SURROUND61 = 7, 00086 AUD_CHANNELS_SURROUND71 = 8 00087 } AUD_Channels; 00088 00090 typedef enum 00091 { 00092 AUD_CHANNEL_FRONT_LEFT = 0, 00093 AUD_CHANNEL_FRONT_RIGHT, 00094 AUD_CHANNEL_FRONT_CENTER, 00095 AUD_CHANNEL_LFE, 00096 AUD_CHANNEL_REAR_LEFT, 00097 AUD_CHANNEL_REAR_RIGHT, 00098 AUD_CHANNEL_REAR_CENTER, 00099 AUD_CHANNEL_SIDE_LEFT, 00100 AUD_CHANNEL_SIDE_RIGHT, 00101 AUD_CHANNEL_MAX 00102 } AUD_Channel; 00103 00108 typedef enum 00109 { 00110 AUD_RATE_INVALID = 0, 00111 AUD_RATE_8000 = 8000, 00112 AUD_RATE_16000 = 16000, 00113 AUD_RATE_11025 = 11025, 00114 AUD_RATE_22050 = 22050, 00115 AUD_RATE_32000 = 32000, 00116 AUD_RATE_44100 = 44100, 00117 AUD_RATE_48000 = 48000, 00118 AUD_RATE_88200 = 88200, 00119 AUD_RATE_96000 = 96000, 00120 AUD_RATE_192000 = 192000 00121 } AUD_DefaultSampleRate; 00122 00124 typedef enum 00125 { 00126 AUD_STATUS_INVALID = 0, 00127 AUD_STATUS_PLAYING, 00128 AUD_STATUS_PAUSED 00129 } AUD_Status; 00130 00132 typedef enum 00133 { 00134 AUD_NO_ERROR = 0, 00135 AUD_ERROR_SPECS, 00136 AUD_ERROR_PROPS, 00137 AUD_ERROR_FILE, 00138 AUD_ERROR_SRC, 00139 AUD_ERROR_FFMPEG, 00140 AUD_ERROR_OPENAL, 00141 AUD_ERROR_SDL, 00142 AUD_ERROR_JACK 00143 } AUD_Error; 00144 00146 typedef enum 00147 { 00148 AUD_FADE_IN, 00149 AUD_FADE_OUT 00150 } AUD_FadeType; 00151 00153 typedef enum 00154 { 00155 AUD_DISTANCE_MODEL_INVALID = 0, 00156 AUD_DISTANCE_MODEL_INVERSE, 00157 AUD_DISTANCE_MODEL_INVERSE_CLAMPED, 00158 AUD_DISTANCE_MODEL_LINEAR, 00159 AUD_DISTANCE_MODEL_LINEAR_CLAMPED, 00160 AUD_DISTANCE_MODEL_EXPONENT, 00161 AUD_DISTANCE_MODEL_EXPONENT_CLAMPED 00162 } AUD_DistanceModel; 00163 00165 typedef enum 00166 { 00167 AUD_AP_VOLUME, 00168 AUD_AP_PANNING, 00169 AUD_AP_PITCH, 00170 AUD_AP_LOCATION, 00171 AUD_AP_ORIENTATION 00172 } AUD_AnimateablePropertyType; 00173 00175 typedef enum 00176 { 00177 AUD_CONTAINER_INVALID = 0, 00178 AUD_CONTAINER_AC3, 00179 AUD_CONTAINER_FLAC, 00180 AUD_CONTAINER_MATROSKA, 00181 AUD_CONTAINER_MP2, 00182 AUD_CONTAINER_MP3, 00183 AUD_CONTAINER_OGG, 00184 AUD_CONTAINER_WAV 00185 } AUD_Container; 00186 00188 typedef enum 00189 { 00190 AUD_CODEC_INVALID = 0, 00191 AUD_CODEC_AAC, 00192 AUD_CODEC_AC3, 00193 AUD_CODEC_FLAC, 00194 AUD_CODEC_MP2, 00195 AUD_CODEC_MP3, 00196 AUD_CODEC_PCM, 00197 AUD_CODEC_VORBIS 00198 } AUD_Codec; 00199 00201 typedef float sample_t; 00202 00204 typedef unsigned char data_t; 00205 00207 typedef double AUD_SampleRate; 00208 00210 typedef struct 00211 { 00213 AUD_SampleRate rate; 00214 00216 AUD_Channels channels; 00217 } AUD_Specs; 00218 00220 typedef struct 00221 { 00223 AUD_SampleFormat format; 00224 00225 union 00226 { 00227 struct 00228 { 00230 AUD_SampleRate rate; 00231 00233 AUD_Channels channels; 00234 }; 00235 AUD_Specs specs; 00236 }; 00237 } AUD_DeviceSpecs; 00238 00240 typedef struct 00241 { 00246 AUD_Error error; 00247 00251 const char* str; 00252 00253 // void* userData; - for the case it is needed someday 00254 } AUD_Exception; 00255 00256 #endif //AUD_SPACE