Audaspace: external audaspace library update.
authorJörg Müller <nexyon@gmail.com>
Wed, 12 Nov 2014 11:33:28 +0000 (00:33 +1300)
committerJörg Müller <nexyon@gmail.com>
Tue, 28 Jul 2015 12:01:52 +0000 (14:01 +0200)
intern/audaspace/intern/AUD_PyInit.cpp
source/blender/blenkernel/BKE_sound.h
source/blender/blenkernel/intern/sound.c
source/blender/blenkernel/intern/writeffmpeg.c
source/blender/makesrna/intern/CMakeLists.txt
source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
source/gameengine/Converter/KX_ConvertActuators.cpp
source/gameengine/Ketsji/KX_SoundActuator.cpp

index 8802f39929c6142d18538d41766f7bfce982f6ab..2575ec7daa102068d63e242963f4f8227cfda3ec 100644 (file)
@@ -47,7 +47,7 @@ static PyObject *AUD_getSoundFromPointer(PyObject *self, PyObject *args)
                        if (sound) {
                                Sound *obj = (Sound *)Sound_empty();
                                if (obj) {
-                                       obj->sound = AUD_copy(sound);
+                                       obj->sound = AUD_Sound_copy(sound);
                                        return (PyObject *) obj;
                                }
                        }
index 7d2d23e1d3945affc83fe21fcb40c2907549487e..cb71b939dc5a12cb5c3a380a89f4fd5ae9f1f366 100644 (file)
@@ -53,6 +53,8 @@ typedef struct SoundWaveform {
 void BKE_sound_init_once(void);
 void BKE_sound_exit_once(void);
 
+void* BKE_sound_get_device(void);
+
 void BKE_sound_init(struct Main *main);
 
 void BKE_sound_init_main(struct Main *bmain);
index 0eaae45c0087bdc05c62c71f83b4a4ca44981342..a7346c8af67020994df325cbc6c96fc9d9a0a212 100644 (file)
@@ -109,13 +109,13 @@ void BKE_sound_free(bSound *sound)
 
 #ifdef WITH_AUDASPACE
        if (sound->handle) {
-               AUD_unload(sound->handle);
+               AUD_Sound_free(sound->handle);
                sound->handle = NULL;
                sound->playback_handle = NULL;
        }
 
        if (sound->cache) {
-               AUD_unload(sound->cache);
+               AUD_Sound_free(sound->cache);
                sound->cache = NULL;
        }
 
@@ -148,7 +148,7 @@ static void sound_sync_callback(void *data, int mode, float time)
                        else
                                BKE_sound_stop_scene(scene);
                        if (scene->playback_handle)
-                               AUD_seek(scene->playback_handle, time);
+                               AUD_Handle_setPosition(scene->playback_handle, time);
                }
                scene = scene->id.next;
        }
@@ -180,6 +180,13 @@ void BKE_sound_init_once(void)
        atexit(BKE_sound_exit_once);
 }
 
+static AUD_Device* sound_device;
+
+void* sound_get_device(void)
+{
+       return sound_device;
+}
+
 void BKE_sound_init(struct Main *bmain)
 {
        AUD_DeviceSpecs specs;
@@ -223,8 +230,8 @@ void BKE_sound_init(struct Main *bmain)
        if (specs.channels <= AUD_CHANNELS_INVALID)
                specs.channels = AUD_CHANNELS_STEREO;
 
-       if (!AUD_init(device_name, "Blender", specs, buffersize))
-               AUD_init("Null", "Blender", specs, buffersize);
+       if (!(sound_device = AUD_init(device_name, specs, buffersize, "Blender")))
+               sound_device = AUD_init("Null", specs, buffersize, "Blender");
 
        BKE_sound_init_main(bmain);
 }
@@ -240,12 +247,14 @@ void BKE_sound_init_main(struct Main *bmain)
 
 void BKE_sound_exit(void)
 {
-       AUD_exit();
+       AUD_exit(sound_device);
+       sound_device = NULL;
 }
 
 void BKE_sound_exit_once(void)
 {
-       AUD_exit();
+       AUD_exit(sound_device);
+       sound_device = NULL;
        AUD_exitOnce();
 }
 
@@ -303,9 +312,9 @@ void BKE_sound_cache(bSound *sound)
 {
        sound->flags |= SOUND_FLAGS_CACHING;
        if (sound->cache)
-               AUD_unload(sound->cache);
+               AUD_Sound_free(sound->cache);
 
-       sound->cache = AUD_bufferSound(sound->handle);
+       sound->cache = AUD_Sound_cache(sound->handle);
        if (sound->cache)
                sound->playback_handle = sound->cache;
        else
@@ -316,7 +325,7 @@ void BKE_sound_delete_cache(bSound *sound)
 {
        sound->flags &= ~SOUND_FLAGS_CACHING;
        if (sound->cache) {
-               AUD_unload(sound->cache);
+               AUD_Sound_free(sound->cache);
                sound->cache = NULL;
                sound->playback_handle = sound->handle;
        }
@@ -326,12 +335,12 @@ void BKE_sound_load(struct Main *bmain, bSound *sound)
 {
        if (sound) {
                if (sound->cache) {
-                       AUD_unload(sound->cache);
+                       AUD_Sound_free(sound->cache);
                        sound->cache = NULL;
                }
 
                if (sound->handle) {
-                       AUD_unload(sound->handle);
+                       AUD_Sound_free(sound->handle);
                        sound->handle = NULL;
                        sound->playback_handle = NULL;
                }
@@ -356,10 +365,10 @@ void BKE_sound_load(struct Main *bmain, bSound *sound)
 
                        /* but we need a packed file then */
                        if (pf)
-                               sound->handle = AUD_loadBuffer((unsigned char *) pf->data, pf->size);
+                               sound->handle = AUD_Sound_bufferFile((unsigned char *) pf->data, pf->size);
                        /* or else load it from disk */
                        else
-                               sound->handle = AUD_load(fullpath);
+                               sound->handle = AUD_Sound_file(fullpath);
                }
 /* XXX unused currently */
 #if 0
@@ -376,13 +385,13 @@ void BKE_sound_load(struct Main *bmain, bSound *sound)
        }
 #endif
                if (sound->flags & SOUND_FLAGS_MONO) {
-                       void *handle = AUD_monoSound(sound->handle);
-                       AUD_unload(sound->handle);
+                       void *handle = AUD_Sound_rechannel(sound->handle, AUD_CHANNELS_MONO);
+                       AUD_Sound_free(sound->handle);
                        sound->handle = handle;
                }
 
                if (sound->flags & SOUND_FLAGS_CACHING) {
-                       sound->cache = AUD_bufferSound(sound->handle);
+                       sound->cache = AUD_Sound_cache(sound->handle);
                }
 
                if (sound->cache)
@@ -405,9 +414,10 @@ void BKE_sound_create_scene(struct Scene *scene)
        if (scene->r.frs_sec_base == 0)
                scene->r.frs_sec_base = 1;
 
-       scene->sound_scene = AUD_createSequencer(FPS, scene->audio.flag & AUDIO_MUTE);
-       AUD_updateSequencerData(scene->sound_scene, scene->audio.speed_of_sound,
-                               scene->audio.doppler_factor, scene->audio.distance_model);
+       scene->sound_scene = AUD_Sequence_create(FPS, scene->audio.flag & AUDIO_MUTE);
+       AUD_Sequence_setSpeedOfSound(scene->sound_scene, scene->audio.speed_of_sound);
+       AUD_Sequence_setDopplerFactor(scene->sound_scene, scene->audio.doppler_factor);
+       AUD_Sequence_setDistanceModel(scene->sound_scene, scene->audio.distance_model);
        scene->playback_handle = NULL;
        scene->sound_scrub_handle = NULL;
        scene->speaker_handles = NULL;
@@ -416,11 +426,11 @@ void BKE_sound_create_scene(struct Scene *scene)
 void BKE_sound_destroy_scene(struct Scene *scene)
 {
        if (scene->playback_handle)
-               AUD_stop(scene->playback_handle);
+               AUD_Handle_stop(scene->playback_handle);
        if (scene->sound_scrub_handle)
-               AUD_stop(scene->sound_scrub_handle);
+               AUD_Handle_stop(scene->sound_scrub_handle);
        if (scene->sound_scene)
-               AUD_destroySequencer(scene->sound_scene);
+               AUD_Sequence_free(scene->sound_scene);
        if (scene->speaker_handles)
                AUD_destroySet(scene->speaker_handles);
 }
@@ -428,21 +438,22 @@ void BKE_sound_destroy_scene(struct Scene *scene)
 void BKE_sound_mute_scene(struct Scene *scene, int muted)
 {
        if (scene->sound_scene)
-               AUD_setSequencerMuted(scene->sound_scene, muted);
+               AUD_Sequence_setMuted(scene->sound_scene, muted);
 }
 
 void BKE_sound_update_fps(struct Scene *scene)
 {
        if (scene->sound_scene)
-               AUD_setSequencerFPS(scene->sound_scene, FPS);
+               AUD_Sequence_setFPS(scene->sound_scene, FPS);
 
        BKE_sequencer_refresh_sound_length(scene);
 }
 
 void BKE_sound_update_scene_listener(struct Scene *scene)
 {
-       AUD_updateSequencerData(scene->sound_scene, scene->audio.speed_of_sound,
-                               scene->audio.doppler_factor, scene->audio.distance_model);
+       AUD_Sequence_setSpeedOfSound(scene->sound_scene, scene->audio.speed_of_sound);
+       AUD_Sequence_setDopplerFactor(scene->sound_scene, scene->audio.doppler_factor);
+       AUD_Sequence_setDistanceModel(scene->sound_scene, scene->audio.distance_model);
 }
 
 void *BKE_sound_scene_add_scene_sound(struct Scene *scene, struct Sequence *sequence,
@@ -450,7 +461,7 @@ void *BKE_sound_scene_add_scene_sound(struct Scene *scene, struct Sequence *sequ
 {
        if (scene != sequence->scene) {
                const double fps = FPS;
-               return AUD_addSequence(scene->sound_scene, sequence->scene->sound_scene,
+               return AUD_Sequence_add(scene->sound_scene, sequence->scene->sound_scene,
                                       startframe / fps, endframe / fps, frameskip / fps);
        }
        return NULL;
@@ -466,12 +477,12 @@ void *BKE_sound_scene_add_scene_sound_defaults(struct Scene *scene, struct Seque
 void *BKE_sound_add_scene_sound(struct Scene *scene, struct Sequence *sequence, int startframe, int endframe, int frameskip)
 {
        const double fps = FPS;
-       void *handle = AUD_addSequence(scene->sound_scene, sequence->sound->playback_handle,
+       void *handle = AUD_Sequence_add(scene->sound_scene, sequence->sound->playback_handle,
                                       startframe / fps, endframe / fps, frameskip / fps);
-       AUD_muteSequence(handle, (sequence->flag & SEQ_MUTE) != 0);
-       AUD_setSequenceAnimData(handle, AUD_AP_VOLUME, CFRA, &sequence->volume, 0);
-       AUD_setSequenceAnimData(handle, AUD_AP_PITCH, CFRA, &sequence->pitch, 0);
-       AUD_setSequenceAnimData(handle, AUD_AP_PANNING, CFRA, &sequence->pan, 0);
+       AUD_SequenceEntry_setMuted(handle, (sequence->flag & SEQ_MUTE) != 0);
+       AUD_SequenceEntry_setAnimationData(handle, AUD_AP_VOLUME, CFRA, &sequence->volume, 0);
+       AUD_SequenceEntry_setAnimationData(handle, AUD_AP_PITCH, CFRA, &sequence->pitch, 0);
+       AUD_SequenceEntry_setAnimationData(handle, AUD_AP_PANNING, CFRA, &sequence->pan, 0);
        return handle;
 }
 
@@ -484,18 +495,18 @@ void *BKE_sound_add_scene_sound_defaults(struct Scene *scene, struct Sequence *s
 
 void BKE_sound_remove_scene_sound(struct Scene *scene, void *handle)
 {
-       AUD_removeSequence(scene->sound_scene, handle);
+       AUD_Sequence_remove(scene->sound_scene, handle);
 }
 
 void BKE_sound_mute_scene_sound(void *handle, char mute)
 {
-       AUD_muteSequence(handle, mute);
+       AUD_SequenceEntry_setMuted(handle, mute);
 }
 
 void BKE_sound_move_scene_sound(struct Scene *scene, void *handle, int startframe, int endframe, int frameskip)
 {
        const double fps = FPS;
-       AUD_moveSequence(handle, startframe / fps, endframe / fps, frameskip / fps);
+       AUD_SequenceEntry_move(handle, startframe / fps, endframe / fps, frameskip / fps);
 }
 
 void BKE_sound_move_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence)
@@ -509,7 +520,7 @@ void BKE_sound_move_scene_sound_defaults(struct Scene *scene, struct Sequence *s
 
 void BKE_sound_update_scene_sound(void *handle, bSound *sound)
 {
-       AUD_updateSequenceSound(handle, sound->playback_handle);
+       AUD_SequenceEntry_setSound(handle, sound->playback_handle);
 }
 
 void BKE_sound_set_cfra(int cfra)
@@ -519,23 +530,23 @@ void BKE_sound_set_cfra(int cfra)
 
 void BKE_sound_set_scene_volume(struct Scene *scene, float volume)
 {
-       AUD_setSequencerAnimData(scene->sound_scene, AUD_AP_VOLUME, CFRA, &volume,
+       AUD_Sequence_setAnimationData(scene->sound_scene, AUD_AP_VOLUME, CFRA, &volume,
                                 (scene->audio.flag & AUDIO_VOLUME_ANIMATED) != 0);
 }
 
 void BKE_sound_set_scene_sound_volume(void *handle, float volume, char animated)
 {
-       AUD_setSequenceAnimData(handle, AUD_AP_VOLUME, sound_cfra, &volume, animated);
+       AUD_SequenceEntry_setAnimationData(handle, AUD_AP_VOLUME, sound_cfra, &volume, animated);
 }
 
 void BKE_sound_set_scene_sound_pitch(void *handle, float pitch, char animated)
 {
-       AUD_setSequenceAnimData(handle, AUD_AP_PITCH, sound_cfra, &pitch, animated);
+       AUD_SequenceEntry_setAnimationData(handle, AUD_AP_PITCH, sound_cfra, &pitch, animated);
 }
 
 void BKE_sound_set_scene_sound_pan(void *handle, float pan, char animated)
 {
-       AUD_setSequenceAnimData(handle, AUD_AP_PANNING, sound_cfra, &pan, animated);
+       AUD_SequenceEntry_setAnimationData(handle, AUD_AP_PANNING, sound_cfra, &pan, animated);
 }
 
 void BKE_sound_update_sequencer(struct Main *main, bSound *sound)
@@ -549,13 +560,18 @@ void BKE_sound_update_sequencer(struct Main *main, bSound *sound)
 
 static void sound_start_play_scene(struct Scene *scene)
 {
+       AUD_Specs specs;
+
        if (scene->playback_handle)
-               AUD_stop(scene->playback_handle);
+               AUD_Handle_stop(scene->playback_handle);
+
+       specs.channels = AUD_Device_getChannels(sound_device);
+       specs.rate = AUD_Device_getRate(sound_device);
 
-       AUD_setSequencerDeviceSpecs(scene->sound_scene);
+       AUD_Sequence_setSpecs(scene->sound_scene, specs);
 
-       if ((scene->playback_handle = AUD_play(scene->sound_scene, 1)))
-               AUD_setLoop(scene->playback_handle, -1);
+       if ((scene->playback_handle = AUD_Device_play(sound_device, scene->sound_scene, 1)))
+               AUD_Handle_setLoopCount(scene->playback_handle, -1);
 }
 
 void BKE_sound_play_scene(struct Scene *scene)
@@ -563,34 +579,34 @@ void BKE_sound_play_scene(struct Scene *scene)
        AUD_Status status;
        const float cur_time = (float)((double)CFRA / FPS);
 
-       AUD_lock();
+       AUD_Device_lock(sound_device);
 
-       status = scene->playback_handle ? AUD_getStatus(scene->playback_handle) : AUD_STATUS_INVALID;
+       status = scene->playback_handle ? AUD_Handle_getStatus(scene->playback_handle) : AUD_STATUS_INVALID;
 
        if (status == AUD_STATUS_INVALID) {
                sound_start_play_scene(scene);
 
                if (!scene->playback_handle) {
-                       AUD_unlock();
+                       AUD_Device_unlock(sound_device);
                        return;
                }
        }
 
        if (status != AUD_STATUS_PLAYING) {
-               AUD_seek(scene->playback_handle, cur_time);
-               AUD_resume(scene->playback_handle);
+               AUD_Handle_setPosition(scene->playback_handle, cur_time);
+               AUD_Handle_resume(scene->playback_handle);
        }
 
        if (scene->audio.flag & AUDIO_SYNC)
                AUD_playSynchronizer();
 
-       AUD_unlock();
+       AUD_Device_unlock(sound_device);
 }
 
 void BKE_sound_stop_scene(struct Scene *scene)
 {
        if (scene->playback_handle) {
-               AUD_pause(scene->playback_handle);
+               AUD_Handle_pause(scene->playback_handle);
 
                if (scene->audio.flag & AUDIO_SYNC)
                        AUD_stopSynchronizer();
@@ -606,19 +622,19 @@ void BKE_sound_seek_scene(struct Main *bmain, struct Scene *scene)
        const float one_frame = (float)(1.0 / FPS);
        const float cur_time = (float)((double)CFRA / FPS);
 
-       AUD_lock();
+       AUD_Device_lock(sound_device);
 
-       status = scene->playback_handle ? AUD_getStatus(scene->playback_handle) : AUD_STATUS_INVALID;
+       status = scene->playback_handle ? AUD_Handle_getStatus(scene->playback_handle) : AUD_STATUS_INVALID;
 
        if (status == AUD_STATUS_INVALID) {
                sound_start_play_scene(scene);
 
                if (!scene->playback_handle) {
-                       AUD_unlock();
+                       AUD_Device_unlock(sound_device);
                        return;
                }
 
-               AUD_pause(scene->playback_handle);
+               AUD_Handle_pause(scene->playback_handle);
        }
 
        animation_playing = 0;
@@ -630,20 +646,17 @@ void BKE_sound_seek_scene(struct Main *bmain, struct Scene *scene)
        }
 
        if (scene->audio.flag & AUDIO_SCRUB && !animation_playing) {
+               AUD_Handle_setPosition(scene->playback_handle, cur_time);
                if (scene->audio.flag & AUDIO_SYNC) {
-                       AUD_seek(scene->playback_handle, cur_time);
                        AUD_seekSynchronizer(scene->playback_handle, cur_time);
                }
-               else {
-                       AUD_seek(scene->playback_handle, cur_time);
-               }
-               AUD_resume(scene->playback_handle);
-               if (scene->sound_scrub_handle && AUD_getStatus(scene->sound_scrub_handle) != AUD_STATUS_INVALID) {
-                       AUD_seek(scene->sound_scrub_handle, 0);
+               AUD_Handle_resume(scene->playback_handle);
+               if (scene->sound_scrub_handle && AUD_Handle_getStatus(scene->sound_scrub_handle) != AUD_STATUS_INVALID) {
+                       AUD_Handle_setPosition(scene->sound_scrub_handle, 0);
                }
                else {
                        if (scene->sound_scrub_handle) {
-                               AUD_stop(scene->sound_scrub_handle);
+                               AUD_Handle_stop(scene->sound_scrub_handle);
                        }
                        scene->sound_scrub_handle = AUD_pauseAfter(scene->playback_handle, one_frame);
                }
@@ -654,12 +667,12 @@ void BKE_sound_seek_scene(struct Main *bmain, struct Scene *scene)
                }
                else {
                        if (status == AUD_STATUS_PLAYING) {
-                               AUD_seek(scene->playback_handle, cur_time);
+                               AUD_Handle_setPosition(scene->playback_handle, cur_time);
                        }
                }
        }
 
-       AUD_unlock();
+       AUD_Device_unlock(sound_device);
 }
 
 float BKE_sound_sync_scene(struct Scene *scene)
@@ -668,7 +681,7 @@ float BKE_sound_sync_scene(struct Scene *scene)
                if (scene->audio.flag & AUDIO_SYNC)
                        return AUD_getSynchronizerPosition(scene->playback_handle);
                else
-                       return AUD_getPosition(scene->playback_handle);
+                       return AUD_Handle_getPosition(scene->playback_handle);
        }
        return NAN_FLT;
 }
@@ -762,38 +775,41 @@ void BKE_sound_update_scene(Main *bmain, struct Scene *scene)
 
                                        if (AUD_removeSet(scene->speaker_handles, strip->speaker_handle)) {
                                                if (speaker->sound) {
-                                                       AUD_moveSequence(strip->speaker_handle, (double)strip->start / FPS, FLT_MAX, 0);
+                                                       AUD_SequenceEntry_move(strip->speaker_handle, (double)strip->start / FPS, FLT_MAX, 0);
                                                }
                                                else {
-                                                       AUD_removeSequence(scene->sound_scene, strip->speaker_handle);
+                                                       AUD_Sequence_remove(scene->sound_scene, strip->speaker_handle);
                                                        strip->speaker_handle = NULL;
                                                }
                                        }
                                        else {
                                                if (speaker->sound) {
-                                                       strip->speaker_handle = AUD_addSequence(scene->sound_scene,
+                                                       strip->speaker_handle = AUD_Sequence_add(scene->sound_scene,
                                                                                                speaker->sound->playback_handle,
                                                                                                (double)strip->start / FPS, FLT_MAX, 0);
-                                                       AUD_setRelativeSequence(strip->speaker_handle, 0);
+                                                       AUD_SequenceEntry_setRelative(strip->speaker_handle, 0);
                                                }
                                        }
 
                                        if (strip->speaker_handle) {
                                                const bool mute = ((strip->flag & NLASTRIP_FLAG_MUTED) || (speaker->flag & SPK_MUTED));
                                                AUD_addSet(new_set, strip->speaker_handle);
-                                               AUD_updateSequenceData(strip->speaker_handle, speaker->volume_max,
-                                                                      speaker->volume_min, speaker->distance_max,
-                                                                      speaker->distance_reference, speaker->attenuation,
-                                                                      speaker->cone_angle_outer, speaker->cone_angle_inner,
-                                                                      speaker->cone_volume_outer);
+                                               AUD_SequenceEntry_setVolumeMaximum(strip->speaker_handle, speaker->volume_max);
+                                               AUD_SequenceEntry_setVolumeMinimum(strip->speaker_handle, speaker->volume_min);
+                                               AUD_SequenceEntry_setDistanceMaximum(strip->speaker_handle, speaker->distance_max);
+                                               AUD_SequenceEntry_setDistanceReference(strip->speaker_handle, speaker->distance_reference);
+                                               AUD_SequenceEntry_setAttenuation(strip->speaker_handle, speaker->attenuation);
+                                               AUD_SequenceEntry_setConeAngleOuter(strip->speaker_handle, speaker->cone_angle_outer);
+                                               AUD_SequenceEntry_setConeAngleInner(strip->speaker_handle, speaker->cone_angle_inner);
+                                               AUD_SequenceEntry_setConeVolumeOuter(strip->speaker_handle, speaker->cone_volume_outer);
 
                                                mat4_to_quat(quat, ob->obmat);
-                                               AUD_setSequenceAnimData(strip->speaker_handle, AUD_AP_LOCATION, CFRA, ob->obmat[3], 1);
-                                               AUD_setSequenceAnimData(strip->speaker_handle, AUD_AP_ORIENTATION, CFRA, quat, 1);
-                                               AUD_setSequenceAnimData(strip->speaker_handle, AUD_AP_VOLUME, CFRA, &speaker->volume, 1);
-                                               AUD_setSequenceAnimData(strip->speaker_handle, AUD_AP_PITCH, CFRA, &speaker->pitch, 1);
-                                               AUD_updateSequenceSound(strip->speaker_handle, speaker->sound->playback_handle);
-                                               AUD_muteSequence(strip->speaker_handle, mute);
+                                               AUD_SequenceEntry_setAnimationData(strip->speaker_handle, AUD_AP_LOCATION, CFRA, ob->obmat[3], 1);
+                                               AUD_SequenceEntry_setAnimationData(strip->speaker_handle, AUD_AP_ORIENTATION, CFRA, quat, 1);
+                                               AUD_SequenceEntry_setAnimationData(strip->speaker_handle, AUD_AP_VOLUME, CFRA, &speaker->volume, 1);
+                                               AUD_SequenceEntry_setAnimationData(strip->speaker_handle, AUD_AP_PITCH, CFRA, &speaker->pitch, 1);
+                                               AUD_SequenceEntry_setSound(strip->speaker_handle, speaker->sound->playback_handle);
+                                               AUD_SequenceEntry_setMuted(strip->speaker_handle, mute);
                                        }
                                }
                        }
@@ -801,13 +817,13 @@ void BKE_sound_update_scene(Main *bmain, struct Scene *scene)
        }
 
        while ((handle = AUD_getSet(scene->speaker_handles))) {
-               AUD_removeSequence(scene->sound_scene, handle);
+               AUD_Sequence_remove(scene->sound_scene, handle);
        }
 
        if (scene->camera) {
                mat4_to_quat(quat, scene->camera->obmat);
-               AUD_setSequencerAnimData(scene->sound_scene, AUD_AP_LOCATION, CFRA, scene->camera->obmat[3], 1);
-               AUD_setSequencerAnimData(scene->sound_scene, AUD_AP_ORIENTATION, CFRA, quat, 1);
+               AUD_Sequence_setAnimationData(scene->sound_scene, AUD_AP_LOCATION, CFRA, scene->camera->obmat[3], 1);
+               AUD_Sequence_setAnimationData(scene->sound_scene, AUD_AP_ORIENTATION, CFRA, quat, 1);
        }
 
        AUD_destroySet(scene->speaker_handles);
index af33e688dc42d7e0c98db2ab9a99f2daf8316dc7..eb07a2d370b4c784989248623e06f30872c716db 100644 (file)
@@ -138,7 +138,7 @@ static int write_audio_frame(FFMpegContext *context)
        pkt.size = 0;
        pkt.data = NULL;
 
-       AUD_readDevice(context->audio_mixdown_device, context->audio_input_buffer, context->audio_input_samples);
+       AUD_Device_read(context->audio_mixdown_device, context->audio_input_buffer, context->audio_input_samples);
        context->audio_time += (double) context->audio_input_samples / (double) c->sample_rate;
 
 #ifdef FFMPEG_HAVE_ENCODE_AUDIO2
@@ -1215,7 +1215,7 @@ static void end_ffmpeg_impl(FFMpegContext *context, int is_autosplit)
 #ifdef WITH_AUDASPACE
        if (is_autosplit == false) {
                if (context->audio_mixdown_device) {
-                       AUD_closeReadDevice(context->audio_mixdown_device);
+                       AUD_Device_free(context->audio_mixdown_device);
                        context->audio_mixdown_device = 0;
                }
        }
index 967ec3aeaf84947a6a51a46b7038e6ccc2c35247..36e0a49c01d5086f0e731b38316c0fe229f0654c 100644 (file)
@@ -230,7 +230,7 @@ if(WITH_AUDASPACE)
                add_definitions(-DWITH_EXTERNAL_AUDASPACE)
                list(APPEND INC_SYS ${CAUDASPACE_INCLUDE_DIRS})
        else()
-               list(APPEND INC ../../../intern/audaspace/intern)
+               list(APPEND INC ../../../../intern/audaspace/intern)
        endif()
 endif()
 
index 4d30bc51280544838b0488532fbdc94796532145..93ef1fa8c46cce9222cc42e73e65e17737700155 100644 (file)
@@ -79,6 +79,7 @@ extern "C" {
        #include "BKE_ipo.h"
        #include "BKE_main.h"
        #include "BKE_context.h"
+       #include "BKE_sound.h"
 
        /* avoid c++ conflict with 'new' */
        #define new _new
@@ -504,9 +505,10 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
                                ketsjiengine->InitDome(scene->gm.dome.res, scene->gm.dome.mode, scene->gm.dome.angle, scene->gm.dome.resbuf, scene->gm.dome.tilt, scene->gm.dome.warptext);
 
                        // initialize 3D Audio Settings
-                       AUD_setSpeedOfSound(scene->audio.speed_of_sound);
-                       AUD_setDopplerFactor(scene->audio.doppler_factor);
-                       AUD_setDistanceModel(AUD_DistanceModel(scene->audio.distance_model));
+                       AUD_Device* device = sound_get_device();
+                       AUD_Device_setSpeedOfSound(device, scene->audio.speed_of_sound);
+                       AUD_Device_setDopplerFactor(device, scene->audio.doppler_factor);
+                       AUD_Device_setDistanceModel(device, AUD_DistanceModel(scene->audio.distance_model));
 
                        // from see blender.c:
                        // FIXME: this version patching should really be part of the file-reading code,
@@ -673,7 +675,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
                }
 
                // stop all remaining playing sounds
-               AUD_stopAll();
+               AUD_Device_stopAll(sound_get_device());
        
        } while (exitrequested == KX_EXIT_REQUEST_RESTART_GAME || exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME);
        
index e5e86cd4ee6bc3bf5c3e56491ea7f21e7c4277bf..65290ae4f2c70621d8f6d0e0c112fcff8d5c1d13 100644 (file)
@@ -412,7 +412,7 @@ void BL_ConvertActuators(const char* maggiename,
                                                // if sound shall be 3D but isn't mono, we have to make it mono!
                                                if (is3d)
                                                {
-                                                       snd_sound = AUD_monoSound(snd_sound);
+                                                       snd_sound = AUD_Sound_rechannel(snd_sound, AUD_CHANNELS_MONO);
                                                }
                                        }
                                        KX_SoundActuator* tmpsoundact =
@@ -426,7 +426,7 @@ void BL_ConvertActuators(const char* maggiename,
 
                                        // if we made it mono, we have to free it
                                        if(snd_sound != sound->playback_handle && snd_sound != NULL)
-                                               AUD_unload(snd_sound);
+                                               AUD_Sound_free(snd_sound);
 
                                        tmpsoundact->SetName(bact->name);
                                        baseact = tmpsoundact;
index a14cb9a289703f211b3b4f0a2ac44b7ba2c41d6c..69821fc3fad19a93e3151bb31f4200639acdcdb0 100644 (file)
@@ -65,7 +65,7 @@ KX_SoundActuator::KX_SoundActuator(SCA_IObject* gameobj,
                                                                   KX_SOUNDACT_TYPE type)//,
                                                                   : SCA_IActuator(gameobj, KX_ACT_SOUND)
 {
-       m_sound = AUD_copy(sound);
+       m_sound = AUD_Sound_copy(sound);
        m_handle = NULL;
        m_volume = volume;
        m_pitch = pitch;
@@ -81,12 +81,12 @@ KX_SoundActuator::~KX_SoundActuator()
 {
        if(m_handle)
        {
-               AUD_stop(m_handle);
+               AUD_Handle_stop(m_handle);
        }
 
        if(m_sound)
        {
-               AUD_unload(m_sound);
+               AUD_Sound_free(m_sound);
        }
 }
 
@@ -94,7 +94,7 @@ void KX_SoundActuator::play()
 {
        if(m_handle)
        {
-               AUD_stop(m_handle);
+               AUD_Handle_stop(m_handle);
                m_handle = NULL;
        }
 
@@ -110,7 +110,7 @@ void KX_SoundActuator::play()
        {
        case KX_SOUNDACT_LOOPBIDIRECTIONAL:
        case KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP:
-               sound = AUD_pingpongSound(sound);
+               sound = AUD_Sound_pingpong(sound);
                // fall through
        case KX_SOUNDACT_LOOPEND:
        case KX_SOUNDACT_LOOPSTOP:
@@ -122,31 +122,31 @@ void KX_SoundActuator::play()
                break;
        }
 
-       m_handle = AUD_play(sound, false);
+       //m_handle = AUD_Device_play(sound_get_device(), sound, false);
 
        // in case of pingpong, we have to free the sound
        if(sound != m_sound)
-               AUD_unload(sound);
+               AUD_Sound_free(sound);
 
        if (m_handle != NULL)
        {
                if (m_is3d)
                {
-                       AUD_setRelative(m_handle, true);
-                       AUD_setVolumeMaximum(m_handle, m_3d.max_gain);
-                       AUD_setVolumeMinimum(m_handle, m_3d.min_gain);
-                       AUD_setDistanceReference(m_handle, m_3d.reference_distance);
-                       AUD_setDistanceMaximum(m_handle, m_3d.max_distance);
-                       AUD_setAttenuation(m_handle, m_3d.rolloff_factor);
-                       AUD_setConeAngleInner(m_handle, m_3d.cone_inner_angle);
-                       AUD_setConeAngleOuter(m_handle, m_3d.cone_outer_angle);
-                       AUD_setConeVolumeOuter(m_handle, m_3d.cone_outer_gain);
+                       AUD_Handle_setRelative(m_handle, true);
+                       AUD_Handle_setVolumeMaximum(m_handle, m_3d.max_gain);
+                       AUD_Handle_setVolumeMinimum(m_handle, m_3d.min_gain);
+                       AUD_Handle_setDistanceReference(m_handle, m_3d.reference_distance);
+                       AUD_Handle_setDistanceMaximum(m_handle, m_3d.max_distance);
+                       AUD_Handle_setAttenuation(m_handle, m_3d.rolloff_factor);
+                       AUD_Handle_setConeAngleInner(m_handle, m_3d.cone_inner_angle);
+                       AUD_Handle_setConeAngleOuter(m_handle, m_3d.cone_outer_angle);
+                       AUD_Handle_setConeVolumeOuter(m_handle, m_3d.cone_outer_gain);
                }
 
                if (loop)
-                       AUD_setLoop(m_handle, -1);
-               AUD_setSoundPitch(m_handle, m_pitch);
-               AUD_setSoundVolume(m_handle, m_volume);
+                       AUD_Handle_setLoopCount(m_handle, -1);
+               AUD_Handle_setPitch(m_handle, m_pitch);
+               AUD_Handle_setVolume(m_handle, m_volume);
        }
 
        m_isplaying = true;
@@ -163,7 +163,7 @@ void KX_SoundActuator::ProcessReplica()
 {
        SCA_IActuator::ProcessReplica();
        m_handle = NULL;
-       m_sound = AUD_copy(m_sound);
+       m_sound = AUD_Sound_copy(m_sound);
 }
 
 bool KX_SoundActuator::Update(double curtime, bool frame)
@@ -182,7 +182,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame)
                return false;
 
        // actual audio device playing state
-       bool isplaying = m_handle ? (AUD_getStatus(m_handle) == AUD_STATUS_PLAYING) : false;
+       bool isplaying = m_handle ? (AUD_Handle_getStatus(m_handle) == AUD_STATUS_PLAYING) : false;
 
        if (bNegativeEvent)
        {
@@ -198,7 +198,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame)
                                        // stop immediately
                                        if (m_handle)
                                        {
-                                               AUD_stop(m_handle);
+                                               AUD_Handle_stop(m_handle);
                                                m_handle = NULL;
                                        }
                                        break;
@@ -213,7 +213,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame)
                                {
                                        // stop the looping so that the sound stops when it finished
                                        if (m_handle)
-                                               AUD_setLoop(m_handle, 0);
+                                               AUD_Handle_setLoopCount(m_handle, 0);
                                        break;
                                }
                        default:
@@ -240,7 +240,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame)
                        play();
        }
        // verify that the sound is still playing
-       isplaying = m_handle ? (AUD_getStatus(m_handle) == AUD_STATUS_PLAYING) : false;
+       isplaying = m_handle ? (AUD_Handle_getStatus(m_handle) == AUD_STATUS_PLAYING) : false;
 
        if (isplaying)
        {
@@ -258,13 +258,13 @@ bool KX_SoundActuator::Update(double curtime, bool frame)
                                p = (obj->NodeGetWorldPosition() - cam->NodeGetWorldPosition());
                                p = Mo * p;
                                p.getValue(data);
-                               AUD_setSourceLocation(m_handle, data);
+                               AUD_Handle_setLocation(m_handle, data);
                                p = (obj->GetLinearVelocity() - cam->GetLinearVelocity());
                                p = Mo * p;
                                p.getValue(data);
-                               AUD_setSourceVelocity(m_handle, data);
+                               AUD_Handle_setVelocity(m_handle, data);
                                (Mo * obj->NodeGetWorldOrientation()).getRotation().getValue(data);
-                               AUD_setSourceOrientation(m_handle, data);
+                               AUD_Handle_setOrientation(m_handle, data);
                        }
                }
                result = true;
@@ -339,11 +339,11 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_SoundActuator, startSound,
 "startSound()\n"
 "\tStarts the sound.\n")
 {
-       switch (m_handle ? AUD_getStatus(m_handle) : AUD_STATUS_INVALID) {
+       switch (m_handle ? AUD_Handle_getStatus(m_handle) : AUD_STATUS_INVALID) {
                case AUD_STATUS_PLAYING:
                        break;
                case AUD_STATUS_PAUSED:
-                       AUD_resume(m_handle);
+                       AUD_Handle_resume(m_handle);
                        break;
                default:
                        play();
@@ -356,7 +356,7 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_SoundActuator, pauseSound,
 "\tPauses the sound.\n")
 {
        if (m_handle)
-               AUD_pause(m_handle);
+               AUD_Handle_pause(m_handle);
        Py_RETURN_NONE;
 }
 
@@ -366,7 +366,7 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_SoundActuator, stopSound,
 {
        if (m_handle)
        {
-               AUD_stop(m_handle);
+               AUD_Handle_stop(m_handle);
                m_handle = NULL;
        }
        Py_RETURN_NONE;
@@ -417,7 +417,7 @@ PyObject *KX_SoundActuator::pyattr_get_audposition(void *self, const struct KX_P
        float position = 0.0;
 
        if (actuator->m_handle)
-               position = AUD_getPosition(actuator->m_handle);
+               position = AUD_Handle_getPosition(actuator->m_handle);
 
        PyObject *result = PyFloat_FromDouble(position);
 
@@ -469,42 +469,42 @@ int KX_SoundActuator::pyattr_set_3d_property(void *self, const struct KX_PYATTRI
        if (!strcmp(prop, "volume_maximum")) {
                actuator->m_3d.max_gain = prop_value;
                if (actuator->m_handle)
-                       AUD_setVolumeMaximum(actuator->m_handle, prop_value);
+                       AUD_Handle_setVolumeMaximum(actuator->m_handle, prop_value);
 
        } else if (!strcmp(prop, "volume_minimum")) {
                actuator->m_3d.min_gain = prop_value;
                if (actuator->m_handle)
-                       AUD_setVolumeMinimum(actuator->m_handle, prop_value);
+                       AUD_Handle_setVolumeMinimum(actuator->m_handle, prop_value);
 
        } else if (!strcmp(prop, "distance_reference")) {
                actuator->m_3d.reference_distance = prop_value;
                if (actuator->m_handle)
-                       AUD_setDistanceReference(actuator->m_handle, prop_value);
+                       AUD_Handle_setDistanceReference(actuator->m_handle, prop_value);
 
        } else if (!strcmp(prop, "distance_maximum")) {
                actuator->m_3d.max_distance = prop_value;
                if (actuator->m_handle)
-                       AUD_setDistanceMaximum(actuator->m_handle, prop_value);
+                       AUD_Handle_setDistanceMaximum(actuator->m_handle, prop_value);
 
        } else if (!strcmp(prop, "attenuation")) {
                actuator->m_3d.rolloff_factor = prop_value;
                if (actuator->m_handle)
-                       AUD_setAttenuation(actuator->m_handle, prop_value);
+                       AUD_Handle_setAttenuation(actuator->m_handle, prop_value);
 
        } else if (!!strcmp(prop, "cone_angle_inner")) {
                actuator->m_3d.cone_inner_angle = prop_value;
                if (actuator->m_handle)
-                       AUD_setConeAngleInner(actuator->m_handle, prop_value);
+                       AUD_Handle_setConeAngleInner(actuator->m_handle, prop_value);
 
        } else if (!strcmp(prop, "cone_angle_outer")) {
                actuator->m_3d.cone_outer_angle = prop_value;
                if (actuator->m_handle)
-                       AUD_setConeAngleOuter(actuator->m_handle, prop_value);
+                       AUD_Handle_setConeAngleOuter(actuator->m_handle, prop_value);
 
        } else if (!strcmp(prop, "cone_volume_outer")) {
                actuator->m_3d.cone_outer_gain = prop_value;
                if (actuator->m_handle)
-                       AUD_setConeVolumeOuter(actuator->m_handle, prop_value);
+                       AUD_Handle_setConeVolumeOuter(actuator->m_handle, prop_value);
 
        } else {
                return PY_SET_ATTR_FAIL;
@@ -522,7 +522,7 @@ int KX_SoundActuator::pyattr_set_audposition(void *self, const struct KX_PYATTRI
                return PY_SET_ATTR_FAIL;
 
        if (actuator->m_handle)
-               AUD_seek(actuator->m_handle, position);
+               AUD_Handle_setPosition(actuator->m_handle, position);
        return PY_SET_ATTR_SUCCESS;
 }
 
@@ -535,7 +535,7 @@ int KX_SoundActuator::pyattr_set_gain(void *self, const struct KX_PYATTRIBUTE_DE
 
        actuator->m_volume = gain;
        if (actuator->m_handle)
-               AUD_setSoundVolume(actuator->m_handle, gain);
+               AUD_Handle_setVolume(actuator->m_handle, gain);
 
        return PY_SET_ATTR_SUCCESS;
 }
@@ -549,7 +549,7 @@ int KX_SoundActuator::pyattr_set_pitch(void *self, const struct KX_PYATTRIBUTE_D
 
        actuator->m_pitch = pitch;
        if (actuator->m_handle)
-               AUD_setSoundPitch(actuator->m_handle, pitch);
+               AUD_Handle_setPitch(actuator->m_handle, pitch);
 
        return PY_SET_ATTR_SUCCESS;
 }
@@ -565,7 +565,7 @@ int KX_SoundActuator::pyattr_set_sound(void *self, const struct KX_PYATTRIBUTE_D
 
        if (snd)
        {
-               AUD_unload(actuator->m_sound);
+               AUD_Sound_free(actuator->m_sound);
                actuator->m_sound = snd;
                return PY_SET_ATTR_SUCCESS;
        }