Blender  V2.59
AUD_C-API.h
Go to the documentation of this file.
00001 /*
00002  * $Id: AUD_C-API.h 36092 2011-04-10 22:40:37Z nexyon $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * Copyright 2009-2011 Jörg Hermann Müller
00007  *
00008  * This file is part of AudaSpace.
00009  *
00010  * Audaspace is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * AudaSpace is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with Audaspace; if not, write to the Free Software Foundation,
00022  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00023  *
00024  * ***** END GPL LICENSE BLOCK *****
00025  */
00026 
00031 #ifndef AUD_CAPI
00032 #define AUD_CAPI
00033 
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037 
00038 #include "AUD_Space.h"
00039 
00040 typedef enum
00041 {
00042         AUD_NULL_DEVICE = 0,
00043         AUD_SDL_DEVICE,
00044         AUD_OPENAL_DEVICE,
00045         AUD_JACK_DEVICE
00046 } AUD_DeviceType;
00047 
00048 typedef struct
00049 {
00050         AUD_Specs specs;
00051         float length;
00052 } AUD_SoundInfo;
00053 
00054 #ifndef AUD_CAPI_IMPLEMENTATION
00055         typedef void AUD_Sound;
00056         typedef void AUD_Channel;
00057         typedef void AUD_Device;
00058         typedef void AUD_SequencerEntry;
00059         typedef float (*AUD_volumeFunction)(void*, void*, float);
00060         typedef void (*AUD_syncFunction)(void*, int, float);
00061 #endif
00062 
00066 extern void AUD_initOnce(void);
00067 
00075 extern int AUD_init(AUD_DeviceType device, AUD_DeviceSpecs specs, int buffersize);
00076 
00080 extern void AUD_exit(void);
00081 
00085 extern void AUD_lock(void);
00086 
00090 extern void AUD_unlock(void);
00091 
00097 extern AUD_SoundInfo AUD_getInfo(AUD_Sound* sound);
00098 
00104 extern AUD_Sound* AUD_load(const char* filename);
00105 
00112 extern AUD_Sound* AUD_loadBuffer(unsigned char* buffer, int size);
00113 
00119 extern AUD_Sound* AUD_bufferSound(AUD_Sound* sound);
00120 
00127 extern AUD_Sound* AUD_delaySound(AUD_Sound* sound, float delay);
00128 
00136 extern AUD_Sound* AUD_limitSound(AUD_Sound* sound, float start, float end);
00137 
00143 extern AUD_Sound* AUD_pingpongSound(AUD_Sound* sound);
00144 
00150 extern AUD_Sound* AUD_loopSound(AUD_Sound* sound);
00151 
00158 extern int AUD_setLoop(AUD_Channel* handle, int loops);
00159 
00165 extern AUD_Sound* AUD_rectifySound(AUD_Sound* sound);
00166 
00171 extern void AUD_unload(AUD_Sound* sound);
00172 
00180 extern AUD_Channel* AUD_play(AUD_Sound* sound, int keep);
00181 
00187 extern int AUD_pause(AUD_Channel* handle);
00188 
00194 extern int AUD_resume(AUD_Channel* handle);
00195 
00201 extern int AUD_stop(AUD_Channel* handle);
00202 
00210 extern int AUD_setKeep(AUD_Channel* handle, int keep);
00211 
00218 extern int AUD_seek(AUD_Channel* handle, float seekTo);
00219 
00226 extern float AUD_getPosition(AUD_Channel* handle);
00227 
00233 extern AUD_Status AUD_getStatus(AUD_Channel* handle);
00234 
00239 extern int AUD_setListenerLocation(const float* location);
00240 
00245 extern int AUD_setListenerVelocity(const float* velocity);
00246 
00251 extern int AUD_setListenerOrientation(const float* orientation);
00252 
00258 extern int AUD_setSpeedOfSound(float speed);
00259 
00266 extern int AUD_setDopplerFactor(float factor);
00267 
00272 extern int AUD_setDistanceModel(AUD_DistanceModel model);
00273 
00280 extern int AUD_setSourceLocation(AUD_Channel* handle, const float* location);
00281 
00288 extern int AUD_setSourceVelocity(AUD_Channel* handle, const float* velocity);
00289 
00296 extern int AUD_setSourceOrientation(AUD_Channel* handle, const float* orientation);
00297 
00305 extern int AUD_setRelative(AUD_Channel* handle, int relative);
00306 
00313 extern int AUD_setVolumeMaximum(AUD_Channel* handle, float volume);
00314 
00321 extern int AUD_setVolumeMinimum(AUD_Channel* handle, float volume);
00322 
00331 extern int AUD_setDistanceMaximum(AUD_Channel* handle, float distance);
00332 
00339 extern int AUD_setDistanceReference(AUD_Channel* handle, float distance);
00340 
00348 extern int AUD_setAttenuation(AUD_Channel* handle, float factor);
00349 
00356 extern int AUD_setConeAngleOuter(AUD_Channel* handle, float angle);
00357 
00364 extern int AUD_setConeAngleInner(AUD_Channel* handle, float angle);
00365 
00374 extern int AUD_setConeVolumeOuter(AUD_Channel* handle, float volume);
00375 
00382 extern int AUD_setSoundVolume(AUD_Channel* handle, float volume);
00383 
00390 extern int AUD_setSoundPitch(AUD_Channel* handle, float pitch);
00391 
00397 extern AUD_Device* AUD_openReadDevice(AUD_DeviceSpecs specs);
00398 
00405 extern int AUD_setDeviceVolume(AUD_Device* device, float volume);
00406 
00414 extern AUD_Channel* AUD_playDevice(AUD_Device* device, AUD_Sound* sound, float seek);
00415 
00423 extern int AUD_setDeviceSoundVolume(AUD_Device* device,
00424                                                                         AUD_Channel* handle,
00425                                                                         float volume);
00426 
00436 extern int AUD_readDevice(AUD_Device* device, data_t* buffer, int length);
00437 
00442 extern void AUD_closeReadDevice(AUD_Device* device);
00443 
00448 extern float* AUD_readSoundBuffer(const char* filename, float low, float high,
00449                                                                   float attack, float release, float threshold,
00450                                                                   int accumulate, int additive, int square,
00451                                                                   float sthreshold, int samplerate,
00452                                                                   int* length);
00453 
00460 extern AUD_Channel* AUD_pauseAfter(AUD_Channel* handle, float seconds);
00461 
00462 extern AUD_Sound* AUD_createSequencer(int muted, void* data, AUD_volumeFunction volume);
00463 
00464 extern void AUD_destroySequencer(AUD_Sound* sequencer);
00465 
00466 extern void AUD_setSequencerMuted(AUD_Sound* sequencer, int muted);
00467 
00468 extern AUD_SequencerEntry* AUD_addSequencer(AUD_Sound** sequencer, AUD_Sound* sound,
00469                                                                                 float begin, float end, float skip, void* data);
00470 
00471 extern void AUD_removeSequencer(AUD_Sound* sequencer, AUD_SequencerEntry* entry);
00472 
00473 extern void AUD_moveSequencer(AUD_Sound* sequencer, AUD_SequencerEntry* entry,
00474                                                   float begin, float end, float skip);
00475 
00476 extern void AUD_muteSequencer(AUD_Sound* sequencer, AUD_SequencerEntry* entry,
00477                                                   char mute);
00478 
00479 extern int AUD_readSound(AUD_Sound* sound, sample_t* buffer, int length);
00480 
00481 extern void AUD_startPlayback(void);
00482 
00483 extern void AUD_stopPlayback(void);
00484 
00485 extern void AUD_seekSequencer(AUD_Channel* handle, float time);
00486 
00487 extern float AUD_getSequencerPosition(AUD_Channel* handle);
00488 
00489 #ifdef WITH_JACK
00490 extern void AUD_setSyncCallback(AUD_syncFunction function, void* data);
00491 #endif
00492 
00493 extern int AUD_doesPlayback(void);
00494 
00495 #ifdef __cplusplus
00496 }
00497 #endif
00498 
00499 #endif //AUD_CAPI