diff options
Diffstat (limited to 'source/blender/blenkernel/intern/sound.c')
-rw-r--r-- | source/blender/blenkernel/intern/sound.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 26392132038..3dc2221e0c8 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -110,6 +110,8 @@ void sound_init(struct Main *bmain) #ifdef WITH_JACK AUD_setSyncCallback(sound_sync_callback, bmain); +#else + (void)bmain; /* unused */ #endif } @@ -118,7 +120,7 @@ void sound_exit() AUD_exit(); } -struct bSound* sound_new_file(struct Main *bmain, char* filename) +struct bSound* sound_new_file(struct Main *bmain, const char *filename) { bSound* sound = NULL; @@ -129,7 +131,7 @@ struct bSound* sound_new_file(struct Main *bmain, char* filename) strcpy(str, filename); - path = /*bmain ? bmain->name :*/ G.sce; + path = /*bmain ? bmain->name :*/ G.main->name; BLI_path_abs(str, path); @@ -264,7 +266,7 @@ void sound_load(struct Main *bmain, struct bSound* sound) if(sound->id.lib) path = sound->id.lib->filepath; else - path = /*bmain ? bmain->name :*/ G.sce; + path = bmain->name; BLI_path_abs(fullpath, path); @@ -274,7 +276,7 @@ void sound_load(struct Main *bmain, struct bSound* sound) /* or else load it from disk */ else sound->handle = AUD_load(fullpath); - } // XXX + } // XXX unused currently #if 0 break; @@ -433,9 +435,11 @@ void sound_seek_scene(struct bContext *C) if(scene->audio.flag & AUDIO_SCRUB && !CTX_wm_screen(C)->animtimer) { - // AUD_XXX TODO: fix scrubbing, it currently doesn't stop playing if(scene->audio.flag & AUDIO_SYNC) + { + AUD_seek(scene->sound_scene_handle, CFRA / FPS); AUD_seekSequencer(scene->sound_scene_handle, CFRA / FPS); + } else AUD_seek(scene->sound_scene_handle, CFRA / FPS); AUD_resume(scene->sound_scene_handle); @@ -480,3 +484,12 @@ int sound_read_sound_buffer(struct bSound* sound, float* buffer, int length, flo return AUD_readSound(limiter, buffer, length); AUD_unload(limiter); } + +int sound_get_channels(struct bSound* sound) +{ + AUD_SoundInfo info; + + info = AUD_getInfo(sound->playback_handle); + + return info.specs.channels; +} |