sound module: Append functions with BKE (makes it easier to make them

out from local functions)
This commit is contained in:
2015-03-26 11:35:41 +01:00
parent d97b97460c
commit 828c85a1bf
30 changed files with 181 additions and 181 deletions

View File

@@ -222,7 +222,7 @@ static PyMethodDef meth_getcdevice[] = {
}; };
extern "C" { extern "C" {
extern void *sound_get_factory(void *sound); extern void *BKE_sound_get_factory(void *sound);
} }
static PyObject *AUD_getSoundFromPointer(PyObject *self, PyObject *args) static PyObject *AUD_getSoundFromPointer(PyObject *self, PyObject *args)
@@ -231,7 +231,7 @@ static PyObject *AUD_getSoundFromPointer(PyObject *self, PyObject *args)
if (PyArg_Parse(args, "l:_sound_from_pointer", &lptr)) { if (PyArg_Parse(args, "l:_sound_from_pointer", &lptr)) {
if (lptr) { if (lptr) {
boost::shared_ptr<AUD_IFactory>* factory = (boost::shared_ptr<AUD_IFactory>*) sound_get_factory((void *) lptr); boost::shared_ptr<AUD_IFactory>* factory = (boost::shared_ptr<AUD_IFactory>*) BKE_sound_get_factory((void *) lptr);
if (factory) { if (factory) {
Factory *obj = (Factory *)Factory_empty(); Factory *obj = (Factory *)Factory_empty();

View File

@@ -46,19 +46,19 @@ typedef struct SoundWaveform {
float *data; float *data;
} SoundWaveform; } SoundWaveform;
void sound_init_once(void); void BKE_sound_init_once(void);
void sound_exit_once(void); void BKE_sound_exit_once(void);
void sound_init(struct Main *main); void BKE_sound_init(struct Main *main);
void sound_init_main(struct Main *bmain); void BKE_sound_init_main(struct Main *bmain);
void sound_exit(void); void BKE_sound_exit(void);
void sound_force_device(int device); void BKE_sound_force_device(int device);
int sound_define_from_str(const char *str); int BKE_sound_define_from_str(const char *str);
struct bSound *sound_new_file(struct Main *main, const char *filename); struct bSound *BKE_sound_new_file(struct Main *main, const char *filename);
// XXX unused currently // XXX unused currently
#if 0 #if 0
@@ -67,13 +67,13 @@ struct bSound *sound_new_buffer(struct Main *bmain, struct bSound *source);
struct bSound *sound_new_limiter(struct Main *bmain, struct bSound *source, float start, float end); struct bSound *sound_new_limiter(struct Main *bmain, struct bSound *source, float start, float end);
#endif #endif
void sound_delete(struct Main *bmain, struct bSound *sound); void BKE_sound_delete(struct Main *bmain, struct bSound *sound);
void sound_cache(struct bSound *sound); void BKE_sound_cache(struct bSound *sound);
void sound_delete_cache(struct bSound *sound); void BKE_sound_delete_cache(struct bSound *sound);
void sound_load(struct Main *main, struct bSound *sound); void BKE_sound_load(struct Main *main, struct bSound *sound);
void BKE_sound_free(struct bSound *sound); void BKE_sound_free(struct bSound *sound);
@@ -81,63 +81,63 @@ void BKE_sound_free(struct bSound *sound);
AUD_Device *sound_mixdown(struct Scene *scene, AUD_DeviceSpecs specs, int start, float volume); AUD_Device *sound_mixdown(struct Scene *scene, AUD_DeviceSpecs specs, int start, float volume);
#endif #endif
void sound_create_scene(struct Scene *scene); void BKE_sound_create_scene(struct Scene *scene);
void sound_destroy_scene(struct Scene *scene); void BKE_sound_destroy_scene(struct Scene *scene);
void sound_mute_scene(struct Scene *scene, int muted); void BKE_sound_mute_scene(struct Scene *scene, int muted);
void sound_update_fps(struct Scene *scene); void BKE_sound_update_fps(struct Scene *scene);
void sound_update_scene_listener(struct Scene *scene); void BKE_sound_update_scene_listener(struct Scene *scene);
void *sound_scene_add_scene_sound(struct Scene *scene, struct Sequence *sequence, int startframe, int endframe, int frameskip); void *BKE_sound_scene_add_scene_sound(struct Scene *scene, struct Sequence *sequence, int startframe, int endframe, int frameskip);
void *sound_scene_add_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence); void *BKE_sound_scene_add_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence);
void *sound_add_scene_sound(struct Scene *scene, struct Sequence *sequence, int startframe, int endframe, int frameskip); void *BKE_sound_add_scene_sound(struct Scene *scene, struct Sequence *sequence, int startframe, int endframe, int frameskip);
void *sound_add_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence); void *BKE_sound_add_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence);
void sound_remove_scene_sound(struct Scene *scene, void *handle); void BKE_sound_remove_scene_sound(struct Scene *scene, void *handle);
void sound_mute_scene_sound(void *handle, char mute); void BKE_sound_mute_scene_sound(void *handle, char mute);
void sound_move_scene_sound(struct Scene *scene, void *handle, int startframe, int endframe, int frameskip); void BKE_sound_move_scene_sound(struct Scene *scene, void *handle, int startframe, int endframe, int frameskip);
void sound_move_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence); void BKE_sound_move_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence);
void sound_update_scene_sound(void *handle, struct bSound *sound); void BKE_sound_update_scene_sound(void *handle, struct bSound *sound);
void sound_set_cfra(int cfra); void BKE_sound_set_cfra(int cfra);
void sound_set_scene_volume(struct Scene *scene, float volume); void BKE_sound_set_scene_volume(struct Scene *scene, float volume);
void sound_set_scene_sound_volume(void *handle, float volume, char animated); void BKE_sound_set_scene_sound_volume(void *handle, float volume, char animated);
void sound_set_scene_sound_pitch(void *handle, float pitch, char animated); void BKE_sound_set_scene_sound_pitch(void *handle, float pitch, char animated);
void sound_set_scene_sound_pan(void *handle, float pan, char animated); void BKE_sound_set_scene_sound_pan(void *handle, float pan, char animated);
void sound_update_sequencer(struct Main *main, struct bSound *sound); void BKE_sound_update_sequencer(struct Main *main, struct bSound *sound);
void sound_play_scene(struct Scene *scene); void BKE_sound_play_scene(struct Scene *scene);
void sound_stop_scene(struct Scene *scene); void BKE_sound_stop_scene(struct Scene *scene);
void sound_seek_scene(struct Main *bmain, struct Scene *scene); void BKE_sound_seek_scene(struct Main *bmain, struct Scene *scene);
float sound_sync_scene(struct Scene *scene); float BKE_sound_sync_scene(struct Scene *scene);
int sound_scene_playing(struct Scene *scene); int BKE_sound_scene_playing(struct Scene *scene);
void sound_free_waveform(struct bSound *sound); void BKE_sound_free_waveform(struct bSound *sound);
void sound_read_waveform(struct bSound *sound, short *stop); void BKE_sound_read_waveform(struct bSound *sound, short *stop);
void sound_update_scene(struct Main *bmain, struct Scene *scene); void BKE_sound_update_scene(struct Main *bmain, struct Scene *scene);
void *sound_get_factory(void *sound); void *BKE_sound_get_factory(void *sound);
float sound_get_length(struct bSound *sound); float BKE_sound_get_length(struct bSound *sound);
bool sound_is_jack_supported(void); bool BKE_sound_is_jack_supported(void);
#endif /* __BKE_SOUND_H__ */ #endif /* __BKE_SOUND_H__ */

View File

@@ -305,7 +305,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
CTX_data_main_set(C, G.main); CTX_data_main_set(C, G.main);
sound_init_main(G.main); BKE_sound_init_main(G.main);
if (bfd->user) { if (bfd->user) {

View File

@@ -553,7 +553,7 @@ int unpackSound(Main *bmain, ReportList *reports, bSound *sound, int how)
freePackedFile(sound->packedfile); freePackedFile(sound->packedfile);
sound->packedfile = NULL; sound->packedfile = NULL;
sound_load(bmain, sound); BKE_sound_load(bmain, sound);
ret_value = RET_OK; ret_value = RET_OK;
} }

View File

@@ -293,7 +293,7 @@ Scene *BKE_scene_copy(Scene *sce, int type)
} }
/* before scene copy */ /* before scene copy */
sound_create_scene(scen); BKE_sound_create_scene(scen);
/* world */ /* world */
if (type == SCE_COPY_FULL) { if (type == SCE_COPY_FULL) {
@@ -426,7 +426,7 @@ void BKE_scene_free(Scene *sce)
if (sce->fps_info) if (sce->fps_info)
MEM_freeN(sce->fps_info); MEM_freeN(sce->fps_info);
sound_destroy_scene(sce); BKE_sound_destroy_scene(sce);
BKE_color_managed_view_settings_free(&sce->view_settings); BKE_color_managed_view_settings_free(&sce->view_settings);
} }
@@ -682,7 +682,7 @@ Scene *BKE_scene_add(Main *bmain, const char *name)
sce->gm.exitkey = 218; // Blender key code for ESC sce->gm.exitkey = 218; // Blender key code for ESC
sound_create_scene(sce); BKE_sound_create_scene(sce);
/* color management */ /* color management */
colorspace_name = IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_DEFAULT_SEQUENCER); colorspace_name = IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_DEFAULT_SEQUENCER);
@@ -1690,7 +1690,7 @@ void BKE_scene_update_tagged(EvaluationContext *eval_ctx, Main *bmain, Scene *sc
* only objects and scenes. - brecht */ * only objects and scenes. - brecht */
scene_update_tagged_recursive(eval_ctx, bmain, scene, scene); scene_update_tagged_recursive(eval_ctx, bmain, scene, scene);
/* update sound system animation (TODO, move to depsgraph) */ /* update sound system animation (TODO, move to depsgraph) */
sound_update_scene(bmain, scene); BKE_sound_update_scene(bmain, scene);
/* extra call here to recalc scene animation (for sequencer) */ /* extra call here to recalc scene animation (for sequencer) */
{ {
@@ -1769,7 +1769,7 @@ void BKE_scene_update_for_newframe_ex(EvaluationContext *eval_ctx, Main *bmain,
*/ */
scene_rebuild_rbw_recursive(sce, ctime); scene_rebuild_rbw_recursive(sce, ctime);
sound_set_cfra(sce->r.cfra); BKE_sound_set_cfra(sce->r.cfra);
/* clear animation overrides */ /* clear animation overrides */
/* XXX TODO... */ /* XXX TODO... */
@@ -1814,7 +1814,7 @@ void BKE_scene_update_for_newframe_ex(EvaluationContext *eval_ctx, Main *bmain,
/* BKE_object_handle_update() on all objects, groups and sets */ /* BKE_object_handle_update() on all objects, groups and sets */
scene_update_tagged_recursive(eval_ctx, bmain, sce, sce); scene_update_tagged_recursive(eval_ctx, bmain, sce, sce);
/* update sound system animation (TODO, move to depsgraph) */ /* update sound system animation (TODO, move to depsgraph) */
sound_update_scene(bmain, sce); BKE_sound_update_scene(bmain, sce);
scene_depsgraph_hack(eval_ctx, sce, sce); scene_depsgraph_hack(eval_ctx, sce, sce);

View File

@@ -205,7 +205,7 @@ static void BKE_sequence_free_ex(Scene *scene, Sequence *seq, const bool do_cach
ed->act_seq = NULL; ed->act_seq = NULL;
if (seq->scene_sound && ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SCENE)) if (seq->scene_sound && ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SCENE))
sound_remove_scene_sound(scene, seq->scene_sound); BKE_sound_remove_scene_sound(scene, seq->scene_sound);
seq_free_animdata(scene, seq); seq_free_animdata(scene, seq);
} }
@@ -316,7 +316,7 @@ static void seqclipboard_ptr_restore(Main *bmain, ID **id_pt)
{ {
id_restore = BLI_findstring(lb, ((bSound *)ID_PT)->name, offsetof(bSound, name)); id_restore = BLI_findstring(lb, ((bSound *)ID_PT)->name, offsetof(bSound, name));
if (id_restore == NULL) { if (id_restore == NULL) {
id_restore = sound_new_file(bmain, ((bSound *)ID_PT)->name); id_restore = BKE_sound_new_file(bmain, ((bSound *)ID_PT)->name);
(ID_PT)->newid = id_restore; /* reuse next time */ (ID_PT)->newid = id_restore; /* reuse next time */
} }
break; break;
@@ -652,7 +652,7 @@ static void seq_update_sound_bounds_recursive_rec(Scene *scene, Sequence *metase
if (seq->start + seq->len - seq->endofs > end) if (seq->start + seq->len - seq->endofs > end)
endofs = seq->start + seq->len - end; endofs = seq->start + seq->len - end;
sound_move_scene_sound(scene, seq->scene_sound, seq->start + startofs, BKE_sound_move_scene_sound(scene, seq->scene_sound, seq->start + startofs,
seq->start + seq->len - endofs, startofs + seq->anim_startofs); seq->start + seq->len - endofs, startofs + seq->anim_startofs);
} }
} }
@@ -3747,10 +3747,10 @@ void BKE_sequence_sound_init(Scene *scene, Sequence *seq)
} }
else { else {
if (seq->sound) { if (seq->sound) {
seq->scene_sound = sound_add_scene_sound_defaults(scene, seq); seq->scene_sound = BKE_sound_add_scene_sound_defaults(scene, seq);
} }
if (seq->scene) { if (seq->scene) {
seq->scene_sound = sound_scene_add_scene_sound_defaults(scene, seq); seq->scene_sound = BKE_sound_scene_add_scene_sound_defaults(scene, seq);
} }
} }
} }
@@ -3962,11 +3962,11 @@ void BKE_sequencer_update_sound_bounds(Scene *scene, Sequence *seq)
/* We have to take into account start frame of the sequence's scene! */ /* We have to take into account start frame of the sequence's scene! */
int startofs = seq->startofs + seq->anim_startofs + seq->scene->r.sfra; int startofs = seq->startofs + seq->anim_startofs + seq->scene->r.sfra;
sound_move_scene_sound(scene, seq->scene_sound, seq->startdisp, seq->enddisp, startofs); BKE_sound_move_scene_sound(scene, seq->scene_sound, seq->startdisp, seq->enddisp, startofs);
} }
} }
else { else {
sound_move_scene_sound_defaults(scene, seq); BKE_sound_move_scene_sound_defaults(scene, seq);
} }
/* mute is set in seq_update_muting_recursive */ /* mute is set in seq_update_muting_recursive */
} }
@@ -3991,7 +3991,7 @@ static void seq_update_muting_recursive(ListBase *seqbasep, Sequence *metaseq, i
} }
else if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SCENE)) { else if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SCENE)) {
if (seq->scene_sound) { if (seq->scene_sound) {
sound_mute_scene_sound(seq->scene_sound, seqmute); BKE_sound_mute_scene_sound(seq->scene_sound, seqmute);
} }
} }
} }
@@ -4020,7 +4020,7 @@ static void seq_update_sound_recursive(Scene *scene, ListBase *seqbasep, bSound
} }
else if (seq->type == SEQ_TYPE_SOUND_RAM) { else if (seq->type == SEQ_TYPE_SOUND_RAM) {
if (seq->scene_sound && sound == seq->sound) { if (seq->scene_sound && sound == seq->sound) {
sound_update_scene_sound(seq->scene_sound, sound); BKE_sound_update_scene_sound(seq->scene_sound, sound);
} }
} }
} }
@@ -4353,7 +4353,7 @@ static void seq_load_apply(Scene *scene, Sequence *seq, SeqLoadInfo *seq_load)
if (seq_load->flag & SEQ_LOAD_SOUND_CACHE) { if (seq_load->flag & SEQ_LOAD_SOUND_CACHE) {
if (seq->sound) if (seq->sound)
sound_cache(seq->sound); BKE_sound_cache(seq->sound);
} }
seq_load->tot_success++; seq_load->tot_success++;
@@ -4459,7 +4459,7 @@ Sequence *BKE_sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoad
AUD_SoundInfo info; AUD_SoundInfo info;
sound = sound_new_file(bmain, seq_load->path); /* handles relative paths */ sound = BKE_sound_new_file(bmain, seq_load->path); /* handles relative paths */
if (sound == NULL || sound->playback_handle == NULL) { if (sound == NULL || sound->playback_handle == NULL) {
#if 0 #if 0
@@ -4473,7 +4473,7 @@ Sequence *BKE_sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoad
info = AUD_getInfo(sound->playback_handle); info = AUD_getInfo(sound->playback_handle);
if (info.specs.channels == AUD_CHANNELS_INVALID) { if (info.specs.channels == AUD_CHANNELS_INVALID) {
sound_delete(bmain, sound); BKE_sound_delete(bmain, sound);
#if 0 #if 0
if (op) if (op)
BKE_report(op->reports, RPT_ERROR, "Unsupported audio format"); BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
@@ -4498,7 +4498,7 @@ Sequence *BKE_sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoad
BLI_split_dirfile(seq_load->path, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name)); BLI_split_dirfile(seq_load->path, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name));
seq->scene_sound = sound_add_scene_sound(scene, seq, seq_load->start_frame, seq_load->start_frame + seq->len, 0); seq->scene_sound = BKE_sound_add_scene_sound(scene, seq, seq_load->start_frame, seq_load->start_frame + seq->len, 0);
BKE_sequence_calc_disp(scene, seq); BKE_sequence_calc_disp(scene, seq);
@@ -4620,7 +4620,7 @@ static Sequence *seq_dupli(Scene *scene, Scene *scene_to, Sequence *seq, int dup
else if (seq->type == SEQ_TYPE_SCENE) { else if (seq->type == SEQ_TYPE_SCENE) {
seqn->strip->stripdata = NULL; seqn->strip->stripdata = NULL;
if (seq->scene_sound) if (seq->scene_sound)
seqn->scene_sound = sound_scene_add_scene_sound_defaults(sce_audio, seqn); seqn->scene_sound = BKE_sound_scene_add_scene_sound_defaults(sce_audio, seqn);
} }
else if (seq->type == SEQ_TYPE_MOVIECLIP) { else if (seq->type == SEQ_TYPE_MOVIECLIP) {
/* avoid assert */ /* avoid assert */
@@ -4637,7 +4637,7 @@ static Sequence *seq_dupli(Scene *scene, Scene *scene_to, Sequence *seq, int dup
seqn->strip->stripdata = seqn->strip->stripdata =
MEM_dupallocN(seq->strip->stripdata); MEM_dupallocN(seq->strip->stripdata);
if (seq->scene_sound) if (seq->scene_sound)
seqn->scene_sound = sound_add_scene_sound_defaults(sce_audio, seqn); seqn->scene_sound = BKE_sound_add_scene_sound_defaults(sce_audio, seqn);
id_us_plus((ID *)seqn->sound); id_us_plus((ID *)seqn->sound);
} }

View File

@@ -64,7 +64,7 @@
static int sound_cfra; static int sound_cfra;
#endif #endif
bSound *sound_new_file(struct Main *bmain, const char *filename) bSound *BKE_sound_new_file(struct Main *bmain, const char *filename)
{ {
bSound *sound = NULL; bSound *sound = NULL;
@@ -87,7 +87,7 @@ bSound *sound_new_file(struct Main *bmain, const char *filename)
BLI_strncpy(sound->name, filename, FILE_MAX); BLI_strncpy(sound->name, filename, FILE_MAX);
/* sound->type = SOUND_TYPE_FILE; */ /* XXX unused currently */ /* sound->type = SOUND_TYPE_FILE; */ /* XXX unused currently */
sound_load(bmain, sound); BKE_sound_load(bmain, sound);
if (!sound->playback_handle) { if (!sound->playback_handle) {
BKE_libblock_free(bmain, sound); BKE_libblock_free(bmain, sound);
@@ -116,7 +116,7 @@ void BKE_sound_free(bSound *sound)
sound->cache = NULL; sound->cache = NULL;
} }
sound_free_waveform(sound); BKE_sound_free_waveform(sound);
if (sound->spinlock) { if (sound->spinlock) {
BLI_spin_end(sound->spinlock); BLI_spin_end(sound->spinlock);
@@ -152,7 +152,7 @@ static void sound_sync_callback(void *data, int mode, float time)
} }
#endif #endif
int sound_define_from_str(const char *str) int BKE_sound_define_from_str(const char *str)
{ {
if (BLI_strcaseeq(str, "NULL")) if (BLI_strcaseeq(str, "NULL"))
return AUD_NULL_DEVICE; return AUD_NULL_DEVICE;
@@ -166,18 +166,18 @@ int sound_define_from_str(const char *str)
return -1; return -1;
} }
void sound_force_device(int device) void BKE_sound_force_device(int device)
{ {
force_device = device; force_device = device;
} }
void sound_init_once(void) void BKE_sound_init_once(void)
{ {
AUD_initOnce(); AUD_initOnce();
atexit(sound_exit_once); atexit(BKE_sound_exit_once);
} }
void sound_init(struct Main *bmain) void BKE_sound_init(struct Main *bmain)
{ {
AUD_DeviceSpecs specs; AUD_DeviceSpecs specs;
int device, buffersize; int device, buffersize;
@@ -206,10 +206,10 @@ void sound_init(struct Main *bmain)
if (!AUD_init(device, specs, buffersize)) if (!AUD_init(device, specs, buffersize))
AUD_init(AUD_NULL_DEVICE, specs, buffersize); AUD_init(AUD_NULL_DEVICE, specs, buffersize);
sound_init_main(bmain); BKE_sound_init_main(bmain);
} }
void sound_init_main(struct Main *bmain) void BKE_sound_init_main(struct Main *bmain)
{ {
#ifdef WITH_JACK #ifdef WITH_JACK
AUD_setSyncCallback(sound_sync_callback, bmain); AUD_setSyncCallback(sound_sync_callback, bmain);
@@ -218,12 +218,12 @@ void sound_init_main(struct Main *bmain)
#endif #endif
} }
void sound_exit(void) void BKE_sound_exit(void)
{ {
AUD_exit(); AUD_exit();
} }
void sound_exit_once(void) void BKE_sound_exit_once(void)
{ {
AUD_exit(); AUD_exit();
AUD_exitOnce(); AUD_exitOnce();
@@ -282,7 +282,7 @@ bSound *sound_new_limiter(struct Main *bmain, bSound *source, float start, float
} }
#endif #endif
void sound_delete(struct Main *bmain, bSound *sound) void BKE_sound_delete(struct Main *bmain, bSound *sound)
{ {
if (sound) { if (sound) {
BKE_sound_free(sound); BKE_sound_free(sound);
@@ -291,7 +291,7 @@ void sound_delete(struct Main *bmain, bSound *sound)
} }
} }
void sound_cache(bSound *sound) void BKE_sound_cache(bSound *sound)
{ {
sound->flags |= SOUND_FLAGS_CACHING; sound->flags |= SOUND_FLAGS_CACHING;
if (sound->cache) if (sound->cache)
@@ -304,7 +304,7 @@ void sound_cache(bSound *sound)
sound->playback_handle = sound->handle; sound->playback_handle = sound->handle;
} }
void sound_delete_cache(bSound *sound) void BKE_sound_delete_cache(bSound *sound)
{ {
sound->flags &= ~SOUND_FLAGS_CACHING; sound->flags &= ~SOUND_FLAGS_CACHING;
if (sound->cache) { if (sound->cache) {
@@ -314,7 +314,7 @@ void sound_delete_cache(bSound *sound)
} }
} }
void sound_load(struct Main *bmain, bSound *sound) void BKE_sound_load(struct Main *bmain, bSound *sound)
{ {
if (sound) { if (sound) {
if (sound->cache) { if (sound->cache) {
@@ -328,7 +328,7 @@ void sound_load(struct Main *bmain, bSound *sound)
sound->playback_handle = NULL; sound->playback_handle = NULL;
} }
sound_free_waveform(sound); BKE_sound_free_waveform(sound);
/* XXX unused currently */ /* XXX unused currently */
#if 0 #if 0
@@ -382,7 +382,7 @@ void sound_load(struct Main *bmain, bSound *sound)
else else
sound->playback_handle = sound->handle; sound->playback_handle = sound->handle;
sound_update_sequencer(bmain, sound); BKE_sound_update_sequencer(bmain, sound);
} }
} }
@@ -391,7 +391,7 @@ AUD_Device *sound_mixdown(struct Scene *scene, AUD_DeviceSpecs specs, int start,
return AUD_openMixdownDevice(specs, scene->sound_scene, volume, start / FPS); return AUD_openMixdownDevice(specs, scene->sound_scene, volume, start / FPS);
} }
void sound_create_scene(struct Scene *scene) void BKE_sound_create_scene(struct Scene *scene)
{ {
/* should be done in version patch, but this gets called before */ /* should be done in version patch, but this gets called before */
if (scene->r.frs_sec_base == 0) if (scene->r.frs_sec_base == 0)
@@ -405,7 +405,7 @@ void sound_create_scene(struct Scene *scene)
scene->speaker_handles = NULL; scene->speaker_handles = NULL;
} }
void sound_destroy_scene(struct Scene *scene) void BKE_sound_destroy_scene(struct Scene *scene)
{ {
if (scene->sound_scene_handle) if (scene->sound_scene_handle)
AUD_stop(scene->sound_scene_handle); AUD_stop(scene->sound_scene_handle);
@@ -417,13 +417,13 @@ void sound_destroy_scene(struct Scene *scene)
AUD_destroySet(scene->speaker_handles); AUD_destroySet(scene->speaker_handles);
} }
void sound_mute_scene(struct Scene *scene, int muted) void BKE_sound_mute_scene(struct Scene *scene, int muted)
{ {
if (scene->sound_scene) if (scene->sound_scene)
AUD_setSequencerMuted(scene->sound_scene, muted); AUD_setSequencerMuted(scene->sound_scene, muted);
} }
void sound_update_fps(struct Scene *scene) void BKE_sound_update_fps(struct Scene *scene)
{ {
if (scene->sound_scene) if (scene->sound_scene)
AUD_setSequencerFPS(scene->sound_scene, FPS); AUD_setSequencerFPS(scene->sound_scene, FPS);
@@ -431,13 +431,13 @@ void sound_update_fps(struct Scene *scene)
BKE_sequencer_refresh_sound_length(scene); BKE_sequencer_refresh_sound_length(scene);
} }
void sound_update_scene_listener(struct Scene *scene) void BKE_sound_update_scene_listener(struct Scene *scene)
{ {
AUD_updateSequencerData(scene->sound_scene, scene->audio.speed_of_sound, AUD_updateSequencerData(scene->sound_scene, scene->audio.speed_of_sound,
scene->audio.doppler_factor, scene->audio.distance_model); scene->audio.doppler_factor, scene->audio.distance_model);
} }
void *sound_scene_add_scene_sound(struct Scene *scene, struct Sequence *sequence, void *BKE_sound_scene_add_scene_sound(struct Scene *scene, struct Sequence *sequence,
int startframe, int endframe, int frameskip) int startframe, int endframe, int frameskip)
{ {
if (scene != sequence->scene) { if (scene != sequence->scene) {
@@ -448,14 +448,14 @@ void *sound_scene_add_scene_sound(struct Scene *scene, struct Sequence *sequence
return NULL; return NULL;
} }
void *sound_scene_add_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence) void *BKE_sound_scene_add_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence)
{ {
return sound_scene_add_scene_sound(scene, sequence, return BKE_sound_scene_add_scene_sound(scene, sequence,
sequence->startdisp, sequence->enddisp, sequence->startdisp, sequence->enddisp,
sequence->startofs + sequence->anim_startofs); sequence->startofs + sequence->anim_startofs);
} }
void *sound_add_scene_sound(struct Scene *scene, struct Sequence *sequence, int startframe, int endframe, int frameskip) void *BKE_sound_add_scene_sound(struct Scene *scene, struct Sequence *sequence, int startframe, int endframe, int frameskip)
{ {
const double fps = FPS; const double fps = FPS;
void *handle = AUD_addSequence(scene->sound_scene, sequence->sound->playback_handle, void *handle = AUD_addSequence(scene->sound_scene, sequence->sound->playback_handle,
@@ -467,70 +467,70 @@ void *sound_add_scene_sound(struct Scene *scene, struct Sequence *sequence, int
return handle; return handle;
} }
void *sound_add_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence) void *BKE_sound_add_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence)
{ {
return sound_add_scene_sound(scene, sequence, return BKE_sound_add_scene_sound(scene, sequence,
sequence->startdisp, sequence->enddisp, sequence->startdisp, sequence->enddisp,
sequence->startofs + sequence->anim_startofs); sequence->startofs + sequence->anim_startofs);
} }
void sound_remove_scene_sound(struct Scene *scene, void *handle) void BKE_sound_remove_scene_sound(struct Scene *scene, void *handle)
{ {
AUD_removeSequence(scene->sound_scene, handle); AUD_removeSequence(scene->sound_scene, handle);
} }
void sound_mute_scene_sound(void *handle, char mute) void BKE_sound_mute_scene_sound(void *handle, char mute)
{ {
AUD_muteSequence(handle, mute); AUD_muteSequence(handle, mute);
} }
void sound_move_scene_sound(struct Scene *scene, void *handle, int startframe, int endframe, int frameskip) void BKE_sound_move_scene_sound(struct Scene *scene, void *handle, int startframe, int endframe, int frameskip)
{ {
const double fps = FPS; const double fps = FPS;
AUD_moveSequence(handle, startframe / fps, endframe / fps, frameskip / fps); AUD_moveSequence(handle, startframe / fps, endframe / fps, frameskip / fps);
} }
void sound_move_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence) void BKE_sound_move_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence)
{ {
if (sequence->scene_sound) { if (sequence->scene_sound) {
sound_move_scene_sound(scene, sequence->scene_sound, BKE_sound_move_scene_sound(scene, sequence->scene_sound,
sequence->startdisp, sequence->enddisp, sequence->startdisp, sequence->enddisp,
sequence->startofs + sequence->anim_startofs); sequence->startofs + sequence->anim_startofs);
} }
} }
void sound_update_scene_sound(void *handle, bSound *sound) void BKE_sound_update_scene_sound(void *handle, bSound *sound)
{ {
AUD_updateSequenceSound(handle, sound->playback_handle); AUD_updateSequenceSound(handle, sound->playback_handle);
} }
void sound_set_cfra(int cfra) void BKE_sound_set_cfra(int cfra)
{ {
sound_cfra = cfra; sound_cfra = cfra;
} }
void sound_set_scene_volume(struct Scene *scene, float volume) void BKE_sound_set_scene_volume(struct Scene *scene, float volume)
{ {
AUD_setSequencerAnimData(scene->sound_scene, AUD_AP_VOLUME, CFRA, &volume, AUD_setSequencerAnimData(scene->sound_scene, AUD_AP_VOLUME, CFRA, &volume,
(scene->audio.flag & AUDIO_VOLUME_ANIMATED) != 0); (scene->audio.flag & AUDIO_VOLUME_ANIMATED) != 0);
} }
void sound_set_scene_sound_volume(void *handle, float volume, char animated) void BKE_sound_set_scene_sound_volume(void *handle, float volume, char animated)
{ {
AUD_setSequenceAnimData(handle, AUD_AP_VOLUME, sound_cfra, &volume, animated); AUD_setSequenceAnimData(handle, AUD_AP_VOLUME, sound_cfra, &volume, animated);
} }
void sound_set_scene_sound_pitch(void *handle, float pitch, char 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_setSequenceAnimData(handle, AUD_AP_PITCH, sound_cfra, &pitch, animated);
} }
void sound_set_scene_sound_pan(void *handle, float pan, char 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_setSequenceAnimData(handle, AUD_AP_PANNING, sound_cfra, &pan, animated);
} }
void sound_update_sequencer(struct Main *main, bSound *sound) void BKE_sound_update_sequencer(struct Main *main, bSound *sound)
{ {
struct Scene *scene; struct Scene *scene;
@@ -550,7 +550,7 @@ static void sound_start_play_scene(struct Scene *scene)
AUD_setLoop(scene->sound_scene_handle, -1); AUD_setLoop(scene->sound_scene_handle, -1);
} }
void sound_play_scene(struct Scene *scene) void BKE_sound_play_scene(struct Scene *scene)
{ {
AUD_Status status; AUD_Status status;
const float cur_time = (float)((double)CFRA / FPS); const float cur_time = (float)((double)CFRA / FPS);
@@ -579,7 +579,7 @@ void sound_play_scene(struct Scene *scene)
AUD_unlock(); AUD_unlock();
} }
void sound_stop_scene(struct Scene *scene) void BKE_sound_stop_scene(struct Scene *scene)
{ {
if (scene->sound_scene_handle) { if (scene->sound_scene_handle) {
AUD_pause(scene->sound_scene_handle); AUD_pause(scene->sound_scene_handle);
@@ -589,7 +589,7 @@ void sound_stop_scene(struct Scene *scene)
} }
} }
void sound_seek_scene(struct Main *bmain, struct Scene *scene) void BKE_sound_seek_scene(struct Main *bmain, struct Scene *scene)
{ {
AUD_Status status; AUD_Status status;
bScreen *screen; bScreen *screen;
@@ -654,7 +654,7 @@ void sound_seek_scene(struct Main *bmain, struct Scene *scene)
AUD_unlock(); AUD_unlock();
} }
float sound_sync_scene(struct Scene *scene) float BKE_sound_sync_scene(struct Scene *scene)
{ {
if (scene->sound_scene_handle) { if (scene->sound_scene_handle) {
if (scene->audio.flag & AUDIO_SYNC) if (scene->audio.flag & AUDIO_SYNC)
@@ -665,7 +665,7 @@ float sound_sync_scene(struct Scene *scene)
return NAN_FLT; return NAN_FLT;
} }
int sound_scene_playing(struct Scene *scene) int BKE_sound_scene_playing(struct Scene *scene)
{ {
if (scene->audio.flag & AUDIO_SYNC) if (scene->audio.flag & AUDIO_SYNC)
return AUD_doesPlayback(); return AUD_doesPlayback();
@@ -673,7 +673,7 @@ int sound_scene_playing(struct Scene *scene)
return -1; return -1;
} }
void sound_free_waveform(bSound *sound) void BKE_sound_free_waveform(bSound *sound)
{ {
SoundWaveform *waveform = sound->waveform; SoundWaveform *waveform = sound->waveform;
if (waveform) { if (waveform) {
@@ -686,7 +686,7 @@ void sound_free_waveform(bSound *sound)
sound->waveform = NULL; sound->waveform = NULL;
} }
void sound_read_waveform(bSound *sound, short *stop) void BKE_sound_read_waveform(bSound *sound, short *stop)
{ {
AUD_SoundInfo info = AUD_getInfo(sound->playback_handle); AUD_SoundInfo info = AUD_getInfo(sound->playback_handle);
SoundWaveform *waveform = MEM_mallocN(sizeof(SoundWaveform), "SoundWaveform"); SoundWaveform *waveform = MEM_mallocN(sizeof(SoundWaveform), "SoundWaveform");
@@ -717,7 +717,7 @@ void sound_read_waveform(bSound *sound, short *stop)
return; return;
} }
sound_free_waveform(sound); BKE_sound_free_waveform(sound);
BLI_spin_lock(sound->spinlock); BLI_spin_lock(sound->spinlock);
sound->waveform = waveform; sound->waveform = waveform;
@@ -725,7 +725,7 @@ void sound_read_waveform(bSound *sound, short *stop)
BLI_spin_unlock(sound->spinlock); BLI_spin_unlock(sound->spinlock);
} }
void sound_update_scene(Main *bmain, struct Scene *scene) void BKE_sound_update_scene(Main *bmain, struct Scene *scene)
{ {
Object *ob; Object *ob;
Base *base; Base *base;
@@ -806,20 +806,20 @@ void sound_update_scene(Main *bmain, struct Scene *scene)
scene->speaker_handles = new_set; scene->speaker_handles = new_set;
} }
void *sound_get_factory(void *sound) void *BKE_sound_get_factory(void *sound)
{ {
return ((bSound *)sound)->playback_handle; return ((bSound *)sound)->playback_handle;
} }
/* stupid wrapper because AUD_C-API.h includes Python.h which makesrna doesn't like */ /* stupid wrapper because AUD_C-API.h includes Python.h which makesrna doesn't like */
float sound_get_length(bSound *sound) float BKE_sound_get_length(bSound *sound)
{ {
AUD_SoundInfo info = AUD_getInfo(sound->playback_handle); AUD_SoundInfo info = AUD_getInfo(sound->playback_handle);
return info.length; return info.length;
} }
bool sound_is_jack_supported(void) bool BKE_sound_is_jack_supported(void)
{ {
return (bool)AUD_isJackSupported(); return (bool)AUD_isJackSupported();
} }

View File

@@ -5333,7 +5333,7 @@ static void lib_link_scene(FileData *fd, Main *main)
if (seq->scene) { if (seq->scene) {
seq->scene = newlibadr(fd, sce->id.lib, seq->scene); seq->scene = newlibadr(fd, sce->id.lib, seq->scene);
if (seq->scene) { if (seq->scene) {
seq->scene_sound = sound_scene_add_scene_sound_defaults(sce, seq); seq->scene_sound = BKE_sound_scene_add_scene_sound_defaults(sce, seq);
} }
} }
if (seq->clip) { if (seq->clip) {
@@ -5361,7 +5361,7 @@ static void lib_link_scene(FileData *fd, Main *main)
} }
if (seq->sound) { if (seq->sound) {
seq->sound->id.us++; seq->sound->id.us++;
seq->scene_sound = sound_add_scene_sound_defaults(sce, seq); seq->scene_sound = BKE_sound_add_scene_sound_defaults(sce, seq);
} }
} }
seq->anim = NULL; seq->anim = NULL;
@@ -5536,7 +5536,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
sce->customdata_mask_modal = 0; sce->customdata_mask_modal = 0;
sce->lay_updated = 0; sce->lay_updated = 0;
sound_create_scene(sce); BKE_sound_create_scene(sce);
/* set users to one by default, not in lib-link, this will increase it for compo nodes */ /* set users to one by default, not in lib-link, this will increase it for compo nodes */
sce->id.us = 1; sce->id.us = 1;
@@ -6963,7 +6963,7 @@ static void lib_link_sound(FileData *fd, Main *main)
sound->id.flag -= LIB_NEED_LINK; sound->id.flag -= LIB_NEED_LINK;
sound->ipo = newlibadr_us(fd, sound->id.lib, sound->ipo); // XXX deprecated - old animation system sound->ipo = newlibadr_us(fd, sound->id.lib, sound->ipo); // XXX deprecated - old animation system
sound_load(main, sound); BKE_sound_load(main, sound);
} }
} }
} }

View File

@@ -795,7 +795,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
char str[FILE_MAX]; char str[FILE_MAX];
BLI_join_dirfile(str, sizeof(str), seq->strip->dir, seq->strip->stripdata->name); BLI_join_dirfile(str, sizeof(str), seq->strip->dir, seq->strip->stripdata->name);
BLI_path_abs(str, main->name); BLI_path_abs(str, main->name);
seq->sound = sound_new_file(main, str); seq->sound = BKE_sound_new_file(main, str);
} }
#define SEQ_USE_PROXY_CUSTOM_DIR (1 << 19) #define SEQ_USE_PROXY_CUSTOM_DIR (1 << 19)
#define SEQ_USE_PROXY_CUSTOM_FILE (1 << 21) #define SEQ_USE_PROXY_CUSTOM_FILE (1 << 21)

View File

@@ -107,7 +107,7 @@ static void change_frame_apply(bContext *C, wmOperator *op)
SUBFRA = 0.0f; SUBFRA = 0.0f;
/* do updates */ /* do updates */
sound_seek_scene(bmain, scene); BKE_sound_seek_scene(bmain, scene);
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
} }

View File

@@ -2099,7 +2099,7 @@ static int frame_offset_exec(bContext *C, wmOperator *op)
areas_do_frame_follow(C, false); areas_do_frame_follow(C, false);
sound_seek_scene(bmain, scene); BKE_sound_seek_scene(bmain, scene);
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
@@ -2151,7 +2151,7 @@ static int frame_jump_exec(bContext *C, wmOperator *op)
areas_do_frame_follow(C, true); areas_do_frame_follow(C, true);
sound_seek_scene(bmain, scene); BKE_sound_seek_scene(bmain, scene);
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
} }
@@ -2257,7 +2257,7 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op)
else { else {
areas_do_frame_follow(C, true); areas_do_frame_follow(C, true);
sound_seek_scene(bmain, scene); BKE_sound_seek_scene(bmain, scene);
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
@@ -2319,7 +2319,7 @@ static int marker_jump_exec(bContext *C, wmOperator *op)
areas_do_frame_follow(C, true); areas_do_frame_follow(C, true);
sound_seek_scene(bmain, scene); BKE_sound_seek_scene(bmain, scene);
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
@@ -3435,7 +3435,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv
if ((scene->audio.flag & AUDIO_SYNC) && if ((scene->audio.flag & AUDIO_SYNC) &&
(sad->flag & ANIMPLAY_FLAG_REVERSE) == false && (sad->flag & ANIMPLAY_FLAG_REVERSE) == false &&
finite(time = sound_sync_scene(scene))) finite(time = BKE_sound_sync_scene(scene)))
{ {
double newfra = (double)time * FPS; double newfra = (double)time * FPS;
/* give some space here to avoid jumps */ /* give some space here to avoid jumps */
@@ -3510,7 +3510,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv
} }
if (sad->flag & ANIMPLAY_FLAG_JUMPED) if (sad->flag & ANIMPLAY_FLAG_JUMPED)
sound_seek_scene(bmain, scene); BKE_sound_seek_scene(bmain, scene);
/* since we follow drawflags, we can't send notifier but tag regions ourselves */ /* since we follow drawflags, we can't send notifier but tag regions ourselves */
ED_update_for_newframe(bmain, scene, 1); ED_update_for_newframe(bmain, scene, 1);
@@ -3610,7 +3610,7 @@ int ED_screen_animation_play(bContext *C, int sync, int mode)
if (ED_screen_animation_playing(CTX_wm_manager(C))) { if (ED_screen_animation_playing(CTX_wm_manager(C))) {
/* stop playback now */ /* stop playback now */
ED_screen_animation_timer(C, 0, 0, 0, 0); ED_screen_animation_timer(C, 0, 0, 0, 0);
sound_stop_scene(scene); BKE_sound_stop_scene(scene);
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
} }
@@ -3618,7 +3618,7 @@ int ED_screen_animation_play(bContext *C, int sync, int mode)
int refresh = SPACE_TIME; /* these settings are currently only available from a menu in the TimeLine */ int refresh = SPACE_TIME; /* these settings are currently only available from a menu in the TimeLine */
if (mode == 1) /* XXX only play audio forwards!? */ if (mode == 1) /* XXX only play audio forwards!? */
sound_play_scene(scene); BKE_sound_play_scene(scene);
ED_screen_animation_timer(C, screen->redraws_flag, refresh, sync, mode); ED_screen_animation_timer(C, screen->redraws_flag, refresh, sync, mode);

View File

@@ -100,7 +100,7 @@ static int sound_open_exec(bContext *C, wmOperator *op)
Main *bmain = CTX_data_main(C); Main *bmain = CTX_data_main(C);
RNA_string_get(op->ptr, "filepath", path); RNA_string_get(op->ptr, "filepath", path);
sound = sound_new_file(bmain, path); sound = BKE_sound_new_file(bmain, path);
if (!op->customdata) if (!op->customdata)
sound_open_init(C, op); sound_open_init(C, op);
@@ -114,7 +114,7 @@ static int sound_open_exec(bContext *C, wmOperator *op)
info = AUD_getInfo(sound->playback_handle); info = AUD_getInfo(sound->playback_handle);
if (info.specs.channels == AUD_CHANNELS_INVALID) { if (info.specs.channels == AUD_CHANNELS_INVALID) {
sound_delete(bmain, sound); BKE_sound_delete(bmain, sound);
if (op->customdata) MEM_freeN(op->customdata); if (op->customdata) MEM_freeN(op->customdata);
BKE_report(op->reports, RPT_ERROR, "Unsupported audio format"); BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
@@ -122,11 +122,11 @@ static int sound_open_exec(bContext *C, wmOperator *op)
if (RNA_boolean_get(op->ptr, "mono")) { if (RNA_boolean_get(op->ptr, "mono")) {
sound->flags |= SOUND_FLAGS_MONO; sound->flags |= SOUND_FLAGS_MONO;
sound_load(bmain, sound); BKE_sound_load(bmain, sound);
} }
if (RNA_boolean_get(op->ptr, "cache")) { if (RNA_boolean_get(op->ptr, "cache")) {
sound_cache(sound); BKE_sound_cache(sound);
} }
/* hook into UI */ /* hook into UI */
@@ -690,7 +690,7 @@ static int sound_pack_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
sound->packedfile = newPackedFile(op->reports, sound->name, ID_BLEND_PATH(bmain, &sound->id)); sound->packedfile = newPackedFile(op->reports, sound->name, ID_BLEND_PATH(bmain, &sound->id));
sound_load(bmain, sound); BKE_sound_load(bmain, sound);
return OPERATOR_FINISHED; return OPERATOR_FINISHED;
} }

View File

@@ -912,7 +912,7 @@ static void change_frame_apply(bContext *C, wmOperator *op)
SUBFRA = 0.0f; SUBFRA = 0.0f;
/* do updates */ /* do updates */
sound_seek_scene(CTX_data_main(C), scene); BKE_sound_seek_scene(CTX_data_main(C), scene);
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
} }

View File

@@ -3054,7 +3054,7 @@ static int frame_jump_exec(bContext *C, wmOperator *op)
if (CFRA != sc->user.framenr) { if (CFRA != sc->user.framenr) {
CFRA = sc->user.framenr; CFRA = sc->user.framenr;
sound_seek_scene(CTX_data_main(C), scene); BKE_sound_seek_scene(CTX_data_main(C), scene);
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
} }

View File

@@ -88,7 +88,7 @@ static void graphview_cursor_apply(bContext *C, wmOperator *op)
*/ */
CFRA = RNA_int_get(op->ptr, "frame"); CFRA = RNA_int_get(op->ptr, "frame");
SUBFRA = 0.f; SUBFRA = 0.f;
sound_seek_scene(bmain, scene); BKE_sound_seek_scene(bmain, scene);
/* set the cursor value */ /* set the cursor value */
sipo->cursorVal = RNA_float_get(op->ptr, "value"); sipo->cursorVal = RNA_float_get(op->ptr, "value");

View File

@@ -2982,7 +2982,7 @@ static void change_frame_apply(bContext *C, wmOperator *op)
SUBFRA = 0.0f; SUBFRA = 0.0f;
/* do updates */ /* do updates */
sound_seek_scene(CTX_data_main(C), scene); BKE_sound_seek_scene(CTX_data_main(C), scene);
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
} }

View File

@@ -287,7 +287,7 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
BLI_strncpy(seq->name + 2, sce_seq->id.name + 2, sizeof(seq->name) - 2); BLI_strncpy(seq->name + 2, sce_seq->id.name + 2, sizeof(seq->name) - 2);
BKE_sequence_base_unique_name_recursive(&ed->seqbase, seq); BKE_sequence_base_unique_name_recursive(&ed->seqbase, seq);
seq->scene_sound = sound_scene_add_scene_sound(scene, seq, start_frame, start_frame + seq->len, 0); seq->scene_sound = BKE_sound_scene_add_scene_sound(scene, seq, start_frame, start_frame + seq->len, 0);
BKE_sequence_calc_disp(scene, seq); BKE_sequence_calc_disp(scene, seq);
BKE_sequencer_sort(scene); BKE_sequencer_sort(scene);

View File

@@ -3165,7 +3165,7 @@ static void seq_copy_del_sound(Scene *scene, Sequence *seq)
} }
} }
else if (seq->scene_sound) { else if (seq->scene_sound) {
sound_remove_scene_sound(scene, seq->scene_sound); BKE_sound_remove_scene_sound(scene, seq->scene_sound);
seq->scene_sound = NULL; seq->scene_sound = NULL;
} }
} }
@@ -3322,10 +3322,10 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op)
} }
if (seq_act->scene_sound) if (seq_act->scene_sound)
sound_remove_scene_sound(scene, seq_act->scene_sound); BKE_sound_remove_scene_sound(scene, seq_act->scene_sound);
if (seq_other->scene_sound) if (seq_other->scene_sound)
sound_remove_scene_sound(scene, seq_other->scene_sound); BKE_sound_remove_scene_sound(scene, seq_other->scene_sound);
seq_act->scene_sound = NULL; seq_act->scene_sound = NULL;
seq_other->scene_sound = NULL; seq_other->scene_sound = NULL;
@@ -3333,8 +3333,8 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op)
BKE_sequence_calc(scene, seq_act); BKE_sequence_calc(scene, seq_act);
BKE_sequence_calc(scene, seq_other); BKE_sequence_calc(scene, seq_other);
if (seq_act->sound) sound_add_scene_sound_defaults(scene, seq_act); if (seq_act->sound) BKE_sound_add_scene_sound_defaults(scene, seq_act);
if (seq_other->sound) sound_add_scene_sound_defaults(scene, seq_other); if (seq_other->sound) BKE_sound_add_scene_sound_defaults(scene, seq_other);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);

View File

@@ -85,7 +85,7 @@ static void preview_startjob(void *data, short *stop, short *do_update, float *p
PreviewJobAudio *preview_next; PreviewJobAudio *preview_next;
bSound *sound = previewjb->sound; bSound *sound = previewjb->sound;
sound_read_waveform(sound, stop); BKE_sound_read_waveform(sound, stop);
if (*stop || G.is_break) { if (*stop || G.is_break) {
BLI_mutex_lock(pj->mutex); BLI_mutex_lock(pj->mutex);

View File

@@ -538,13 +538,13 @@ static void rna_Scene_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
static void rna_Scene_fps_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) static void rna_Scene_fps_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{ {
sound_update_fps(scene); BKE_sound_update_fps(scene);
BKE_sequencer_update_sound_bounds_all(scene); BKE_sequencer_update_sound_bounds_all(scene);
} }
static void rna_Scene_listener_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) static void rna_Scene_listener_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{ {
sound_update_scene_listener(scene); BKE_sound_update_scene_listener(scene);
} }
static void rna_Scene_volume_set(PointerRNA *ptr, float value) static void rna_Scene_volume_set(PointerRNA *ptr, float value)
@@ -553,7 +553,7 @@ static void rna_Scene_volume_set(PointerRNA *ptr, float value)
scene->audio.volume = value; scene->audio.volume = value;
if (scene->sound_scene) if (scene->sound_scene)
sound_set_scene_volume(scene, value); BKE_sound_set_scene_volume(scene, value);
} }
static void rna_Scene_framelen_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) static void rna_Scene_framelen_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
@@ -654,7 +654,7 @@ static void rna_Scene_preview_range_end_frame_set(PointerRNA *ptr, int value)
static void rna_Scene_frame_update(Main *bmain, Scene *UNUSED(current_scene), PointerRNA *ptr) static void rna_Scene_frame_update(Main *bmain, Scene *UNUSED(current_scene), PointerRNA *ptr)
{ {
Scene *scene = (Scene *)ptr->id.data; Scene *scene = (Scene *)ptr->id.data;
sound_seek_scene(bmain, scene); BKE_sound_seek_scene(bmain, scene);
} }
static PointerRNA rna_Scene_active_keying_set_get(PointerRNA *ptr) static PointerRNA rna_Scene_active_keying_set_get(PointerRNA *ptr)
@@ -1422,7 +1422,7 @@ static void rna_Scene_use_audio_set(PointerRNA *ptr, int value)
else else
scene->audio.flag &= ~AUDIO_MUTE; scene->audio.flag &= ~AUDIO_MUTE;
sound_mute_scene(scene, value); BKE_sound_mute_scene(scene, value);
} }
static int rna_Scene_sync_mode_get(PointerRNA *ptr) static int rna_Scene_sync_mode_get(PointerRNA *ptr)

View File

@@ -577,8 +577,8 @@ static void rna_Sequence_filepath_set(PointerRNA *ptr, const char *value)
PointerRNA id_ptr; PointerRNA id_ptr;
RNA_id_pointer_create((ID *)seq->sound, &id_ptr); RNA_id_pointer_create((ID *)seq->sound, &id_ptr);
RNA_string_set(&id_ptr, "filepath", value); RNA_string_set(&id_ptr, "filepath", value);
sound_load(G.main, seq->sound); BKE_sound_load(G.main, seq->sound);
sound_update_scene_sound(seq->scene_sound, seq->sound); BKE_sound_update_scene_sound(seq->scene_sound, seq->sound);
} }
BLI_split_dirfile(value, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir), BLI_split_dirfile(value, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir),
@@ -633,7 +633,7 @@ static void rna_Sequence_volume_set(PointerRNA *ptr, float value)
seq->volume = value; seq->volume = value;
if (seq->scene_sound) if (seq->scene_sound)
sound_set_scene_sound_volume(seq->scene_sound, value, (seq->flag & SEQ_AUDIO_VOLUME_ANIMATED) != 0); BKE_sound_set_scene_sound_volume(seq->scene_sound, value, (seq->flag & SEQ_AUDIO_VOLUME_ANIMATED) != 0);
} }
static void rna_Sequence_pitch_set(PointerRNA *ptr, float value) static void rna_Sequence_pitch_set(PointerRNA *ptr, float value)
@@ -642,7 +642,7 @@ static void rna_Sequence_pitch_set(PointerRNA *ptr, float value)
seq->pitch = value; seq->pitch = value;
if (seq->scene_sound) if (seq->scene_sound)
sound_set_scene_sound_pitch(seq->scene_sound, value, (seq->flag & SEQ_AUDIO_PITCH_ANIMATED) != 0); BKE_sound_set_scene_sound_pitch(seq->scene_sound, value, (seq->flag & SEQ_AUDIO_PITCH_ANIMATED) != 0);
} }
static void rna_Sequence_pan_set(PointerRNA *ptr, float value) static void rna_Sequence_pan_set(PointerRNA *ptr, float value)
@@ -651,7 +651,7 @@ static void rna_Sequence_pan_set(PointerRNA *ptr, float value)
seq->pan = value; seq->pan = value;
if (seq->scene_sound) if (seq->scene_sound)
sound_set_scene_sound_pan(seq->scene_sound, value, (seq->flag & SEQ_AUDIO_PAN_ANIMATED) != 0); BKE_sound_set_scene_sound_pan(seq->scene_sound, value, (seq->flag & SEQ_AUDIO_PAN_ANIMATED) != 0);
} }

View File

@@ -158,7 +158,7 @@ static Sequence *rna_Sequences_new_scene(ID *id, Editing *ed,
seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_SCENE, NULL); seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_SCENE, NULL);
seq->scene = sce_seq; seq->scene = sce_seq;
seq->len = sce_seq->r.efra - sce_seq->r.sfra + 1; seq->len = sce_seq->r.efra - sce_seq->r.sfra + 1;
seq->scene_sound = sound_scene_add_scene_sound(scene, seq, frame_start, frame_start + seq->len, 0); seq->scene_sound = BKE_sound_scene_add_scene_sound(scene, seq, frame_start, frame_start + seq->len, 0);
id_us_plus((ID *)sce_seq); id_us_plus((ID *)sce_seq);
BKE_sequence_calc_disp(scene, seq); BKE_sequence_calc_disp(scene, seq);
@@ -225,7 +225,7 @@ static Sequence *rna_Sequences_new_sound(ID *id, Editing *ed, Main *bmain, Repor
Scene *scene = (Scene *)id; Scene *scene = (Scene *)id;
Sequence *seq; Sequence *seq;
bSound *sound = sound_new_file(bmain, file); bSound *sound = BKE_sound_new_file(bmain, file);
if (sound == NULL || sound->playback_handle == NULL) { if (sound == NULL || sound->playback_handle == NULL) {
BKE_report(reports, RPT_ERROR, "Sequences.new_sound: unable to open sound file"); BKE_report(reports, RPT_ERROR, "Sequences.new_sound: unable to open sound file");
@@ -234,9 +234,9 @@ static Sequence *rna_Sequences_new_sound(ID *id, Editing *ed, Main *bmain, Repor
seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_SOUND_RAM, sound->name); seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_SOUND_RAM, sound->name);
seq->sound = sound; seq->sound = sound;
seq->len = ceil((double)sound_get_length(sound) * FPS); seq->len = ceil((double)BKE_sound_get_length(sound) * FPS);
seq->scene_sound = sound_add_scene_sound(scene, seq, frame_start, frame_start + seq->len, 0); seq->scene_sound = BKE_sound_add_scene_sound(scene, seq, frame_start, frame_start + seq->len, 0);
BKE_sequence_calc_disp(scene, seq); BKE_sequence_calc_disp(scene, seq);

View File

@@ -42,7 +42,7 @@
static void rna_Sound_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) static void rna_Sound_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{ {
sound_load(bmain, (bSound *)ptr->data); BKE_sound_load(bmain, (bSound *)ptr->data);
} }
static int rna_Sound_caching_get(PointerRNA *ptr) static int rna_Sound_caching_get(PointerRNA *ptr)
@@ -55,9 +55,9 @@ static void rna_Sound_caching_set(PointerRNA *ptr, const int value)
{ {
bSound *sound = (bSound *)(ptr->data); bSound *sound = (bSound *)(ptr->data);
if (value) if (value)
sound_cache(sound); BKE_sound_cache(sound);
else else
sound_delete_cache(sound); BKE_sound_delete_cache(sound);
} }
static void rna_Sound_caching_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) static void rna_Sound_caching_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)

View File

@@ -331,7 +331,7 @@ static PointerRNA rna_UserDef_system_get(PointerRNA *ptr)
static void rna_UserDef_audio_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) static void rna_UserDef_audio_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
{ {
sound_init(bmain); BKE_sound_init(bmain);
} }
static void rna_Userdef_memcache_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) static void rna_Userdef_memcache_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))

View File

@@ -2223,7 +2223,7 @@ void wm_event_do_handlers(bContext *C)
Scene *scene = win->screen->scene; Scene *scene = win->screen->scene;
if (scene) { if (scene) {
int is_playing_sound = sound_scene_playing(win->screen->scene); int is_playing_sound = BKE_sound_scene_playing(win->screen->scene);
if (is_playing_sound != -1) { if (is_playing_sound != -1) {
bool is_playing_screen; bool is_playing_screen;
@@ -2240,7 +2240,7 @@ void wm_event_do_handlers(bContext *C)
} }
if (is_playing_sound == 0) { if (is_playing_sound == 0) {
const float time = sound_sync_scene(scene); const float time = BKE_sound_sync_scene(scene);
if (finite(time)) { if (finite(time)) {
int ncfra = time * (float)FPS + 0.5f; int ncfra = time * (float)FPS + 0.5f;
if (ncfra != scene->r.cfra) { if (ncfra != scene->r.cfra) {

View File

@@ -301,7 +301,7 @@ static void wm_init_userdef(bContext *C, const bool from_memory)
UI_init_userdef(); UI_init_userdef();
MEM_CacheLimiter_set_maximum(((size_t)U.memcachelimit) * 1024 * 1024); MEM_CacheLimiter_set_maximum(((size_t)U.memcachelimit) * 1024 * 1024);
sound_init(bmain); BKE_sound_init(bmain);
/* needed so loading a file from the command line respects user-pref [#26156] */ /* needed so loading a file from the command line respects user-pref [#26156] */
BKE_BIT_TEST_SET(G.fileflags, U.flag & USER_FILENOUI, G_FILE_NO_UI); BKE_BIT_TEST_SET(G.fileflags, U.flag & USER_FILENOUI, G_FILE_NO_UI);

View File

@@ -328,7 +328,7 @@ bool WM_init_game(bContext *C)
WM_operator_name_call(C, "VIEW3D_OT_game_start", WM_OP_EXEC_DEFAULT, NULL); WM_operator_name_call(C, "VIEW3D_OT_game_start", WM_OP_EXEC_DEFAULT, NULL);
sound_exit(); BKE_sound_exit();
return true; return true;
} }
@@ -398,7 +398,7 @@ void WM_exit_ext(bContext *C, const bool do_python)
{ {
wmWindowManager *wm = C ? CTX_wm_manager(C) : NULL; wmWindowManager *wm = C ? CTX_wm_manager(C) : NULL;
sound_exit(); BKE_sound_exit();
/* first wrap up running stuff, we assume only the active WM is running */ /* first wrap up running stuff, we assume only the active WM is running */
/* modal handlers are on window level freed, others too? */ /* modal handlers are on window level freed, others too? */

View File

@@ -811,7 +811,7 @@ static int no_glsl(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(dat
static int no_audio(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data)) static int no_audio(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
{ {
sound_force_device(0); BKE_sound_force_device(0);
return 0; return 0;
} }
@@ -822,7 +822,7 @@ static int set_audio(int argc, const char **argv, void *UNUSED(data))
exit(1); exit(1);
} }
sound_force_device(sound_define_from_str(argv[1])); BKE_sound_force_device(BKE_sound_define_from_str(argv[1]));
return 1; return 1;
} }
@@ -1755,7 +1755,7 @@ int main(
/* Initialize ffmpeg if built in, also needed for bg mode if videos are /* Initialize ffmpeg if built in, also needed for bg mode if videos are
* rendered via ffmpeg */ * rendered via ffmpeg */
sound_init_once(); BKE_sound_init_once();
init_def_material(); init_def_material();

View File

@@ -636,7 +636,7 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode)
if (!m_networkdevice) if (!m_networkdevice)
goto initFailed; goto initFailed;
sound_init(m_maggie); BKE_sound_init(m_maggie);
// create a ketsjisystem (only needed for timing and stuff) // create a ketsjisystem (only needed for timing and stuff)
m_kxsystem = new GPG_System (m_system); m_kxsystem = new GPG_System (m_system);
@@ -672,7 +672,7 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode)
return m_engineInitialized; return m_engineInitialized;
initFailed: initFailed:
sound_exit(); BKE_sound_exit();
delete m_kxsystem; delete m_kxsystem;
delete m_networkdevice; delete m_networkdevice;
delete m_mouse; delete m_mouse;
@@ -847,7 +847,7 @@ void GPG_Application::exitEngine()
if (!m_engineInitialized) if (!m_engineInitialized)
return; return;
sound_exit(); BKE_sound_exit();
if (m_ketsjiengine) if (m_ketsjiengine)
{ {
stopEngine(); stopEngine();

View File

@@ -517,7 +517,7 @@ int main(int argc, char** argv)
// enable fast mipmap generation // enable fast mipmap generation
U.use_gpu_mipmap = 1; U.use_gpu_mipmap = 1;
sound_init_once(); BKE_sound_init_once();
set_free_windowmanager_cb(wm_free); set_free_windowmanager_cb(wm_free);