Replaced G.sce by Main.name in sound.c.
authorJoerg Mueller <nexyon@gmail.com>
Tue, 25 Aug 2009 15:30:04 +0000 (15:30 +0000)
committerJoerg Mueller <nexyon@gmail.com>
Tue, 25 Aug 2009 15:30:04 +0000 (15:30 +0000)
I hoped for it to resolve the bug of loading sounds with relative paths didn't work, but Main.name isn't set before the sounds are loaded, so the bug resists!
Someone who is into file loading should please fix this!

intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
source/blender/blenkernel/BKE_sound.h
source/blender/blenkernel/intern/packedFile.c
source/blender/blenkernel/intern/sound.c
source/blender/blenloader/intern/readfile.c

index de0e47300f872747455a4fb8c1079713d48bde32..d70a9c25bcbe128d5ded05abb6ecd49b1b675b32 100644 (file)
@@ -334,7 +334,6 @@ void AUD_FFMPEGReader::read(int & length, sample_t* & buffer)
        // read packages and decode them
        AVPacket packet;
        int data_size = 0;
-       int pkgbuf_size = m_pkgbuf->getSize();
        int pkgbuf_pos;
        int left = length;
        int sample_size = AUD_SAMPLE_SIZE(m_specs);
index 1dd90b4dbda3c0f5fab79a9b47e802da83d43270..84ecd79a008f3ac4ee5765f945e023d41d1ed11e 100644 (file)
@@ -54,7 +54,7 @@ void sound_delete(struct bContext *C, struct bSound* sound);
 
 void sound_cache(struct bSound* sound, int ignore);
 
-void sound_load(struct bSound* sound);
+void sound_load(struct Main *main, struct bSound* sound);
 
 void sound_free(struct bSound* sound);
 
index 8c77ed92aa14c7b2417d8c93874a018591d1db32..3e47c1006e53c68426e276e3f1f2f20ca75b3b68 100644 (file)
@@ -473,7 +473,7 @@ int unpackSound(ReportList *reports, bSound *sound, int how)
                        freePackedFile(sound->packedfile);
                        sound->packedfile = 0;
 
-                       sound_load(sound);
+                       sound_load(NULL, sound);
 
                        ret_value = RET_OK;
                }
index 74ab41ff5775e1d8f8f42866240c7c141974569f..c6f9db6fda97bdd2d47935a13767eedfdfbd581a 100644 (file)
@@ -78,7 +78,7 @@ struct bSound* sound_new_file(struct Main *main, char* filename)
        int len;
 
        strcpy(str, filename);
-       BLI_convertstringcode(str, G.sce);
+       BLI_convertstringcode(str, main->name);
 
        len = strlen(filename);
        while(len > 0 && filename[len-1] != '/' && filename[len-1] != '\\')
@@ -88,7 +88,7 @@ struct bSound* sound_new_file(struct Main *main, char* filename)
        strcpy(sound->name, filename);
        sound->type = SOUND_TYPE_FILE;
 
-       sound_load(sound);
+       sound_load(main, sound);
 
        if(!sound->snd_sound)
        {
@@ -114,7 +114,7 @@ struct bSound* sound_new_buffer(struct bContext *C, struct bSound *source)
        sound->child_sound = source;
        sound->type = SOUND_TYPE_BUFFER;
 
-       sound_load(sound);
+       sound_load(CTX_data_main(C), sound);
 
        if(!sound->snd_sound)
        {
@@ -140,7 +140,7 @@ struct bSound* sound_new_limiter(struct bContext *C, struct bSound *source, floa
        sound->end = end;
        sound->type = SOUND_TYPE_LIMITER;
 
-       sound_load(sound);
+       sound_load(CTX_data_main(C), sound);
 
        if(!sound->snd_sound)
        {
@@ -172,7 +172,7 @@ void sound_cache(struct bSound* sound, int ignore)
        sound->cache = AUD_bufferSound(sound->snd_sound);
 }
 
-void sound_load(struct bSound* sound)
+void sound_load(struct Main *main, struct bSound* sound)
 {
        if(sound)
        {
@@ -198,7 +198,7 @@ void sound_load(struct bSound* sound)
                        if(sound->id.lib)
                                path = sound->id.lib->filename;
                        else
-                               path = G.sce;
+                               path = main ? main->name : NULL;
 
                        BLI_convertstringcode(fullpath, path);
 
index 5cc3ff7695a28d93dfadf53d821009fc59f1efc8..920e202520ed0442796a23c1cf5e4a25e56e3c51 100644 (file)
@@ -5075,7 +5075,7 @@ static void lib_link_sound(FileData *fd, Main *main)
                        sound->ipo= newlibadr_us(fd, sound->id.lib, sound->ipo); // XXX depreceated - old animation system
                        sound->stream = 0;
 
-                       sound_load(sound);
+                       sound_load(main, sound);
                }
                sound= sound->id.next;
        }