diff options
author | Joerg Mueller <nexyon@gmail.com> | 2009-08-03 00:34:12 +0400 |
---|---|---|
committer | Joerg Mueller <nexyon@gmail.com> | 2009-08-03 00:34:12 +0400 |
commit | 04d5344cae61912cb8606c5c41acab6e099fb9cb (patch) | |
tree | 4d5d55db8794573c4cca05bdb39795cf6fd995e2 | |
parent | 40c8585e84b029ee1aaad3f56f11460d739247f0 (diff) |
Loading pre 2.5 files now works flawlessly.
-rw-r--r-- | source/blender/blenkernel/BKE_sound.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sound.c | 6 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 67 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_add.c | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_sequence_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_sound_types.h | 4 |
6 files changed, 66 insertions, 18 deletions
diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index 1a1a57e80b4..974c7620deb 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -36,6 +36,7 @@ struct bSound; // AUD_XXX struct bSample; struct bContext; struct ListBase; +struct Main; /* bad bad global... */ // AUD_XXX @@ -58,7 +59,7 @@ void sound_reinit(struct bContext *C); void sound_exit(); -struct bSound* sound_new_file(struct bContext *C, char* filename); +struct bSound* sound_new_file(struct Main *main, char* filename); // AUD_XXX unused currently #if 0 diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 25429ef27d5..68edb3b3ab4 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -199,7 +199,7 @@ void sound_exit() AUD_exit(); } -struct bSound* sound_new_file(struct bContext *C, char* filename) +struct bSound* sound_new_file(struct Main *main, char* filename) { bSound* sound = NULL; @@ -213,7 +213,7 @@ struct bSound* sound_new_file(struct bContext *C, char* filename) while(len > 0 && filename[len-1] != '/' && filename[len-1] != '\\') len--; - sound = alloc_libblock(&CTX_data_main(C)->sound, ID_SO, filename+len); + sound = alloc_libblock(&main->sound, ID_SO, filename+len); strcpy(sound->name, filename); sound->type = SOUND_TYPE_FILE; @@ -221,7 +221,7 @@ struct bSound* sound_new_file(struct bContext *C, char* filename) if(!sound->snd_sound) { - free_libblock(&CTX_data_main(C)->sound, sound); + free_libblock(&main->sound, sound); sound = NULL; } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 2a9b31389b8..0fc8167f0b1 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4042,7 +4042,10 @@ static void lib_link_scene(FileData *fd, Main *main) if(seq->scene) seq->scene= newlibadr(fd, sce->id.lib, seq->scene); // AUD_XXX if(seq->sound) { - seq->sound= newlibadr(fd, sce->id.lib, seq->sound); + if(seq->type == SEQ_HD_SOUND) + seq->type = SEQ_SOUND; + else + seq->sound= newlibadr(fd, sce->id.lib, seq->sound); if (seq->sound) { seq->sound->id.us++; seq->sound_handle= sound_new_handle(sce, seq->sound, seq->startdisp, seq->enddisp, seq->startofs); @@ -5033,6 +5036,9 @@ static void lib_link_sound(FileData *fd, Main *main) sound->id.flag -= LIB_NEEDLINK; sound->ipo= newlibadr_us(fd, sound->id.lib, sound->ipo); // XXX depreceated - old animation system sound->stream = 0; + + // AUD_XXX + sound_load(sound); } sound= sound->id.next; } @@ -9173,6 +9179,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) // AUD_XXX bSound *sound; + Sequence *seq; + bActuator *act; for(sound = main->sound.first; sound; sound = sound->id.next) { @@ -9180,7 +9188,54 @@ static void do_versions(FileData *fd, Library *lib, Main *main) { sound->packedfile = sound->newpackedfile; sound->newpackedfile = NULL; - sound->type = SOUND_TYPE_FILE; + } + } + + for(ob = main->object.first; ob; ob= ob->id.next) { + for(act= ob->actuators.first; act; act= act->next) { + if (act->type == ACT_SOUND) { + bSoundActuator *sAct = (bSoundActuator*) act->data; +/* that would only work if do_versions was called after the linking + if(sAct->sound) + { + sAct->flag = sAct->sound->flags | SOUND_FLAGS_3D ? ACT_SND_3D_SOUND : 0; + sAct->pitch = sAct->sound->pitch; + sAct->volume = sAct->sound->volume; + sAct->sound3D.reference_distance = sAct->sound->distance; + sAct->sound3D.max_gain = sAct->sound->max_gain; + sAct->sound3D.min_gain = sAct->sound->min_gain; + sAct->sound3D.rolloff_factor = sAct->sound->attenuation; + } + else*/ + { + sAct->sound3D.reference_distance = 1.0f; + sAct->flag = ACT_SND_3D_SOUND; + sAct->volume = 1.0f; + sAct->sound3D.max_gain = 1.0f; + sAct->sound3D.rolloff_factor = 1.0f; + } + sAct->sound3D.cone_inner_angle = 360.0f; + sAct->sound3D.cone_outer_angle = 360.0f; + sAct->sound3D.max_distance = FLT_MAX; + } + } + } + + for(scene = main->scene.first; scene; scene = scene->id.next) + { + if(scene->ed && scene->ed->seqbasep) + { + for(seq = scene->ed->seqbasep->first; seq; seq = seq->next) + { + if(seq->type == SEQ_HD_SOUND) + { + char str[FILE_MAX]; + BLI_join_dirfile(str, seq->strip->dir, seq->strip->stripdata->name); + BLI_convertstringcode(str, G.sce); + BLI_convertstringframe(str, scene->r.cfra); + seq->sound = sound_new_file(main, str); + } + } } } @@ -9278,14 +9333,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Scene *sce; ToolSettings *ts; int i, a; -// AUD_XXX - bSound *sound; - - for(sound = main->sound.first; sound; sound = sound->id.next) - { - sound->snd_sound = NULL; - sound_load(sound); - } for(ob = main->object.first; ob; ob = ob->id.next) { diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index a7c19ff0bd2..7a50a0d019f 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -241,7 +241,7 @@ static Sequence* sequencer_add_sound_strip(bContext *C, wmOperator *op, int star AUD_SoundInfo info; - sound = sound_new_file(C, filename); + sound = sound_new_file(CTX_data_main(C), filename); if (sound==NULL || sound->snd_sound == NULL) { if(op) diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index 507b787da87..bec6effecba 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -283,7 +283,7 @@ typedef struct SpeedControlVars { #define SEQ_RAM_SOUND 4 #define SEQ_HD_SOUND 5 // AUD_XXX #define SEQ_MOVIE_AND_HD_SOUND 6 /* helper for add_sequence */ -#define SEQ_SOUND 6 +#define SEQ_SOUND 4 #define SEQ_EFFECT 8 #define SEQ_CROSS 8 diff --git a/source/blender/makesdna/DNA_sound_types.h b/source/blender/makesdna/DNA_sound_types.h index 89897d8c4a5..c0da5a8049f 100644 --- a/source/blender/makesdna/DNA_sound_types.h +++ b/source/blender/makesdna/DNA_sound_types.h @@ -141,8 +141,8 @@ typedef struct bSound { } bSound; typedef enum eSound_Type { - SOUND_TYPE_INVALID = 0, - SOUND_TYPE_FILE, + SOUND_TYPE_INVALID = -1, + SOUND_TYPE_FILE = 0, SOUND_TYPE_BUFFER, SOUND_TYPE_LIMITER } eSound_Type; |