Blender V2.61 - r43446

AUD_C-API.h

Go to the documentation of this file.
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 
00029 #ifndef AUD_CAPI
00030 #define AUD_CAPI
00031 
00032 #ifdef WITH_PYTHON
00033 #include "Python.h"
00034 #endif
00035 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 #include "AUD_Space.h"
00041 
00043 typedef enum
00044 {
00045     AUD_NULL_DEVICE = 0,
00046     AUD_SDL_DEVICE,
00047     AUD_OPENAL_DEVICE,
00048     AUD_JACK_DEVICE
00049 } AUD_DeviceType;
00050 
00052 typedef struct
00053 {
00054     AUD_Specs specs;
00055     float length;
00056 } AUD_SoundInfo;
00057 
00058 #ifndef AUD_CAPI_IMPLEMENTATION
00059     typedef void AUD_Sound;
00060     typedef void AUD_Handle;
00061     typedef void AUD_Device;
00062     typedef void AUD_SEntry;
00063     typedef float (*AUD_volumeFunction)(void*, void*, float);
00064     typedef void (*AUD_syncFunction)(void*, int, float);
00065 #endif
00066 
00070 extern void AUD_initOnce(void);
00071 
00079 extern int AUD_init(AUD_DeviceType device, AUD_DeviceSpecs specs, int buffersize);
00080 
00084 extern void AUD_exit(void);
00085 
00089 extern void AUD_lock(void);
00090 
00094 extern void AUD_unlock(void);
00095 
00101 extern AUD_SoundInfo AUD_getInfo(AUD_Sound* sound);
00102 
00108 extern AUD_Sound* AUD_load(const char* filename);
00109 
00116 extern AUD_Sound* AUD_loadBuffer(unsigned char* buffer, int size);
00117 
00123 extern AUD_Sound* AUD_bufferSound(AUD_Sound* sound);
00124 
00130 extern AUD_Sound* AUD_monoSound(AUD_Sound* sound);
00131 
00138 extern AUD_Sound* AUD_delaySound(AUD_Sound* sound, float delay);
00139 
00147 extern AUD_Sound* AUD_limitSound(AUD_Sound* sound, float start, float end);
00148 
00154 extern AUD_Sound* AUD_pingpongSound(AUD_Sound* sound);
00155 
00161 extern AUD_Sound* AUD_loopSound(AUD_Sound* sound);
00162 
00169 extern int AUD_setLoop(AUD_Handle* handle, int loops);
00170 
00176 extern AUD_Sound* AUD_rectifySound(AUD_Sound* sound);
00177 
00182 extern void AUD_unload(AUD_Sound* sound);
00183 
00191 extern AUD_Handle* AUD_play(AUD_Sound* sound, int keep);
00192 
00198 extern int AUD_pause(AUD_Handle* handle);
00199 
00205 extern int AUD_resume(AUD_Handle* handle);
00206 
00212 extern int AUD_stop(AUD_Handle* handle);
00213 
00221 extern int AUD_setKeep(AUD_Handle* handle, int keep);
00222 
00229 extern int AUD_seek(AUD_Handle* handle, float seekTo);
00230 
00237 extern float AUD_getPosition(AUD_Handle* handle);
00238 
00244 extern AUD_Status AUD_getStatus(AUD_Handle* handle);
00245 
00250 extern int AUD_setListenerLocation(const float* location);
00251 
00256 extern int AUD_setListenerVelocity(const float* velocity);
00257 
00262 extern int AUD_setListenerOrientation(const float* orientation);
00263 
00269 extern int AUD_setSpeedOfSound(float speed);
00270 
00277 extern int AUD_setDopplerFactor(float factor);
00278 
00283 extern int AUD_setDistanceModel(AUD_DistanceModel model);
00284 
00291 extern int AUD_setSourceLocation(AUD_Handle* handle, const float* location);
00292 
00299 extern int AUD_setSourceVelocity(AUD_Handle* handle, const float* velocity);
00300 
00307 extern int AUD_setSourceOrientation(AUD_Handle* handle, const float* orientation);
00308 
00316 extern int AUD_setRelative(AUD_Handle* handle, int relative);
00317 
00324 extern int AUD_setVolumeMaximum(AUD_Handle* handle, float volume);
00325 
00332 extern int AUD_setVolumeMinimum(AUD_Handle* handle, float volume);
00333 
00342 extern int AUD_setDistanceMaximum(AUD_Handle* handle, float distance);
00343 
00350 extern int AUD_setDistanceReference(AUD_Handle* handle, float distance);
00351 
00359 extern int AUD_setAttenuation(AUD_Handle* handle, float factor);
00360 
00367 extern int AUD_setConeAngleOuter(AUD_Handle* handle, float angle);
00368 
00375 extern int AUD_setConeAngleInner(AUD_Handle* handle, float angle);
00376 
00385 extern int AUD_setConeVolumeOuter(AUD_Handle* handle, float volume);
00386 
00393 extern int AUD_setSoundVolume(AUD_Handle* handle, float volume);
00394 
00401 extern int AUD_setSoundPitch(AUD_Handle* handle, float pitch);
00402 
00408 extern AUD_Device* AUD_openReadDevice(AUD_DeviceSpecs specs);
00409 
00416 extern int AUD_setDeviceVolume(AUD_Device* device, float volume);
00417 
00425 extern AUD_Handle* AUD_playDevice(AUD_Device* device, AUD_Sound* sound, float seek);
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, double samplerate,
00452                                   int* length);
00453 
00460 extern AUD_Handle* AUD_pauseAfter(AUD_Handle* handle, float seconds);
00461 
00468 extern AUD_Sound* AUD_createSequencer(float fps, int muted);
00469 
00474 extern void AUD_destroySequencer(AUD_Sound* sequencer);
00475 
00481 extern void AUD_setSequencerMuted(AUD_Sound* sequencer, int muted);
00482 
00488 extern void AUD_setSequencerFPS(AUD_Sound* sequencer, float fps);
00489 
00499 extern AUD_SEntry* AUD_addSequence(AUD_Sound* sequencer, AUD_Sound* sound,
00500                                    float begin, float end, float skip);
00501 
00507 extern void AUD_removeSequence(AUD_Sound* sequencer, AUD_SEntry* entry);
00508 
00516 extern void AUD_moveSequence(AUD_SEntry* entry, float begin, float end, float skip);
00517 
00523 extern void AUD_muteSequence(AUD_SEntry* entry, char mute);
00524 
00532 extern void AUD_setRelativeSequence(AUD_SEntry* entry, char relative);
00533 
00539 extern void AUD_updateSequenceSound(AUD_SEntry* entry, AUD_Sound* sound);
00540 
00549 extern void AUD_setSequenceAnimData(AUD_SEntry* entry, AUD_AnimateablePropertyType type, int frame, float* data, char animated);
00550 
00559 extern void AUD_setSequencerAnimData(AUD_Sound* sequencer, AUD_AnimateablePropertyType type, int frame, float* data, char animated);
00560 
00573 extern void AUD_updateSequenceData(AUD_SEntry* entry, float volume_max, float volume_min,
00574                                    float distance_max, float distance_reference, float attenuation,
00575                                    float cone_angle_outer, float cone_angle_inner, float cone_volume_outer);
00576 
00584 extern void AUD_updateSequencerData(AUD_Sound* sequencer, float speed_of_sound,
00585                                     float factor, AUD_DistanceModel model);
00586 
00592 extern void AUD_setSequencerDeviceSpecs(AUD_Sound* sequencer);
00593 
00599 extern void AUD_setSequencerSpecs(AUD_Sound* sequencer, AUD_Specs specs);
00600 
00606 extern void AUD_seekSequencer(AUD_Handle* handle, float time);
00607 
00613 extern float AUD_getSequencerPosition(AUD_Handle* handle);
00614 
00618 extern void AUD_startPlayback(void);
00619 
00623 extern void AUD_stopPlayback(void);
00624 
00625 #ifdef WITH_JACK
00626 
00631 extern void AUD_setSyncCallback(AUD_syncFunction function, void* data);
00632 #endif
00633 
00638 extern int AUD_doesPlayback(void);
00639 
00648 extern int AUD_readSound(AUD_Sound* sound, sample_t* buffer, int length, int samples_per_second);
00649 
00655 extern AUD_Sound* AUD_copy(AUD_Sound* sound);
00656 
00661 extern void AUD_freeHandle(AUD_Handle* channel);
00662 
00667 extern void* AUD_createSet(void);
00668 
00673 extern void AUD_destroySet(void* set);
00674 
00681 extern char AUD_removeSet(void* set, void* entry);
00682 
00688 extern void AUD_addSet(void* set, void* entry);
00689 
00695 extern void* AUD_getSet(void* set);
00696 
00710 extern const char* AUD_mixdown(AUD_Sound* sound, unsigned int start, unsigned int length, unsigned int buffersize, const char* filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate);
00711 
00720 extern AUD_Device* AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound* sequencer, float volume, float start);
00721 
00722 #ifdef WITH_PYTHON
00723 
00728 extern PyObject* AUD_getPythonFactory(AUD_Sound* sound);
00729 
00735 extern AUD_Sound* AUD_getPythonSound(PyObject* sound);
00736 #endif
00737 
00738 #ifdef __cplusplus
00739 }
00740 
00741 #include "AUD_Reference.h"
00742 class AUD_IDevice;
00743 class AUD_I3DDevice;
00744 
00749 AUD_Reference<AUD_IDevice> AUD_getDevice();
00750 
00755 AUD_I3DDevice* AUD_get3DDevice();
00756 #endif
00757 
00758 #endif //AUD_CAPI