diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-06-23 13:27:56 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-06-23 13:27:56 +0400 |
commit | 2023db70a88c9c5ae7b38eccfee54b6f35780b5f (patch) | |
tree | 59f071e5f75e12f344567665ecc0370a0b091eb9 /source/blender/blenkernel/intern | |
parent | 9c2aa3d0ffb93881bf1e2763ab28893533f02bd7 (diff) |
cmake option to build without an audio library.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 19 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sound.c | 141 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/writeffmpeg.c | 4 |
3 files changed, 111 insertions, 53 deletions
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index b82ac69fc9e..265cc3eeb79 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -73,7 +73,10 @@ #include "BKE_context.h" #include "BKE_sound.h" -#include "AUD_C-API.h" + +#ifdef WITH_AUDASPACE +# include "AUD_C-API.h" +#endif #ifdef WIN32 #define snprintf _snprintf @@ -697,6 +700,7 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range) } seq->strip->len = seq->len; case SEQ_SOUND: +#ifdef WITH_AUDASPACE if(!seq->sound) return; seq->len = ceil(AUD_getInfo(seq->sound->playback_handle).length * FPS); @@ -706,6 +710,9 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range) seq->len = 0; } seq->strip->len = seq->len; +#else + return; +#endif break; case SEQ_SCENE: { @@ -3493,6 +3500,7 @@ Sequence *sequencer_add_image_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo return seq; } +#ifdef WITH_AUDASPACE Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load) { Scene *scene= CTX_data_scene(C); /* only for sound */ @@ -3550,6 +3558,15 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo return seq; } +#else // WITH_AUDASPACE +Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load) +{ + (void)C; + (void)seqbasep; + (void)seq_load; + return NULL; +} +#endif // WITH_AUDASPACE Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load) { diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index e0e456a371e..0eb2392b012 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -21,7 +21,9 @@ #include "DNA_screen_types.h" #include "DNA_sound_types.h" -#include "AUD_C-API.h" +#ifdef WITH_AUDASPACE +# include "AUD_C-API.h" +#endif #include "BKE_utildefines.h" #include "BKE_global.h" @@ -36,6 +38,62 @@ static int force_device = -1; + +struct bSound* sound_new_file(struct Main *bmain, const char *filename) +{ + bSound* sound = NULL; + + char str[FILE_MAX]; + char *path; + + int len; + + strcpy(str, filename); + + path = /*bmain ? bmain->name :*/ G.main->name; + + BLI_path_abs(str, path); + + len = strlen(filename); + while(len > 0 && filename[len-1] != '/' && filename[len-1] != '\\') + len--; + + sound = alloc_libblock(&bmain->sound, ID_SO, filename+len); + BLI_strncpy(sound->name, filename, FILE_MAX); +// XXX unused currently sound->type = SOUND_TYPE_FILE; + + sound_load(bmain, sound); + + if(!sound->playback_handle) + { + free_libblock(&bmain->sound, sound); + sound = NULL; + } + + return sound; +} + +void sound_free(struct bSound* sound) +{ + if (sound->packedfile) + { + freePackedFile(sound->packedfile); + sound->packedfile = NULL; + } + +#ifdef WITH_AUDASPACE + if(sound->handle) + { + AUD_unload(sound->handle); + sound->handle = NULL; + sound->playback_handle = NULL; + } +#endif // WITH_AUDASPACE +} + + +#ifdef WITH_AUDASPACE + #ifdef WITH_JACK static void sound_sync_callback(void* data, int mode, float time) { @@ -123,40 +181,6 @@ void sound_exit(void) AUD_exit(); } -struct bSound* sound_new_file(struct Main *bmain, const char *filename) -{ - bSound* sound = NULL; - - char str[FILE_MAX]; - char *path; - - int len; - - strcpy(str, filename); - - path = /*bmain ? bmain->name :*/ G.main->name; - - BLI_path_abs(str, path); - - len = strlen(filename); - while(len > 0 && filename[len-1] != '/' && filename[len-1] != '\\') - len--; - - sound = alloc_libblock(&bmain->sound, ID_SO, filename+len); - BLI_strncpy(sound->name, filename, FILE_MAX); -// XXX unused currently sound->type = SOUND_TYPE_FILE; - - sound_load(bmain, sound); - - if(!sound->playback_handle) - { - free_libblock(&bmain->sound, sound); - sound = NULL; - } - - return sound; -} - // XXX unused currently #if 0 struct bSound* sound_new_buffer(struct bContext *C, struct bSound *source) @@ -301,22 +325,6 @@ void sound_load(struct Main *bmain, struct bSound* sound) } } -void sound_free(struct bSound* sound) -{ - if (sound->packedfile) - { - freePackedFile(sound->packedfile); - sound->packedfile = NULL; - } - - if(sound->handle) - { - AUD_unload(sound->handle); - sound->handle = NULL; - sound->playback_handle = NULL; - } -} - static float sound_get_volume(Scene* scene, Sequence* sequence, float time) { AnimData *adt= BKE_animdata_from_id(&scene->id); @@ -502,3 +510,34 @@ int sound_get_channels(struct bSound* sound) return info.specs.channels; } + +#else // WITH_AUDASPACE + +#include "BLI_utildefines.h" + +int sound_define_from_str(const char *UNUSED(str)) { return -1;} +void sound_force_device(int UNUSED(device)) {} +void sound_init_once(void) {} +void sound_init(struct Main *UNUSED(bmain)) {} +void sound_exit(void) {} +void sound_cache(struct bSound* UNUSED(sound), int UNUSED(ignore)) { } +void sound_delete_cache(struct bSound* UNUSED(sound)) {} +void sound_load(struct Main *UNUSED(bmain), struct bSound* UNUSED(sound)) {} +void sound_create_scene(struct Scene *UNUSED(scene)) {} +void sound_destroy_scene(struct Scene *UNUSED(scene)) {} +void sound_mute_scene(struct Scene *UNUSED(scene), int UNUSED(muted)) {} +void* sound_scene_add_scene_sound(struct Scene *UNUSED(scene), struct Sequence* UNUSED(sequence), int UNUSED(startframe), int UNUSED(endframe), int UNUSED(frameskip)) { return NULL; } +void* sound_add_scene_sound(struct Scene *UNUSED(scene), struct Sequence* UNUSED(sequence), int UNUSED(startframe), int UNUSED(endframe), int UNUSED(frameskip)) { return NULL; } +void sound_remove_scene_sound(struct Scene *UNUSED(scene), void* UNUSED(handle)) {} +void sound_mute_scene_sound(struct Scene *UNUSED(scene), void* UNUSED(handle), char UNUSED(mute)) {} +void sound_move_scene_sound(struct Scene *UNUSED(scene), void* UNUSED(handle), int UNUSED(startframe), int UNUSED(endframe), int UNUSED(frameskip)) {} +static void sound_start_play_scene(struct Scene *UNUSED(scene)) {} +void sound_play_scene(struct Scene *UNUSED(scene)) {} +void sound_stop_scene(struct Scene *UNUSED(scene)) {} +void sound_seek_scene(struct bContext *UNUSED(C)) {} +float sound_sync_scene(struct Scene *UNUSED(scene)) { return 0.0f; } +int sound_scene_playing(struct Scene *UNUSED(scene)) { return 0; } +int sound_read_sound_buffer(struct bSound* UNUSED(sound), float* UNUSED(buffer), int UNUSED(length), float UNUSED(start), float UNUSED(end)) { return 0; } +int sound_get_channels(struct bSound* UNUSED(sound)) { return 1; } + +#endif // WITH_AUDASPACE diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index c729565533f..4c75201a7ad 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -49,7 +49,9 @@ #include "BLI_blenlib.h" -#include "AUD_C-API.h" /* must be before BKE_sound.h for define */ +#ifdef WITH_AUDASPACE +# include "AUD_C-API.h" +#endif #include "BKE_global.h" #include "BKE_idprop.h" |