diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-08-17 00:37:22 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-08-17 00:37:22 +0400 |
commit | 55edb016b198dbfbd94612348a70ea9bb26ef558 (patch) | |
tree | 01ec633273d5c92d42fcf1ba00e7546cba7d68fe /source/blender/blenkernel/intern/sound.c | |
parent | 19babf988d2e9e8cb9537161d5e331f35a05c2b5 (diff) |
2.5: Sound
* Move sound_init to make sure it gets called everytime user
preferences is reloaded.
* Merged sound_reinit and sound_init. One used user preferences
while the other did not, don't see the point of this, so just
made it always use user preferences now.
* Timeline header audio sync option now controls scene flag
rather than timeline flag. Since it uses the same playback
operator now, there is no distinction anymore.
* Added boolean property sync to animation play operator, to sync
with audio or not. Uses scene setting if property is not set.
* Playback stop button in info header now calls operator, so sounds
stop playing too.
Diffstat (limited to 'source/blender/blenkernel/intern/sound.c')
-rw-r--r-- | source/blender/blenkernel/intern/sound.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 347837d1dd0..03123a4e577 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -34,19 +34,7 @@ void sound_init() { AUD_Specs specs; - specs.channels = AUD_CHANNELS_STEREO; - specs.format = AUD_FORMAT_S16; - specs.rate = AUD_RATE_44100; - - if(!AUD_init(AUD_SDL_DEVICE, specs, AUD_DEFAULT_BUFFER_SIZE)) - if(!AUD_init(AUD_OPENAL_DEVICE, specs, AUD_DEFAULT_BUFFER_SIZE*4)) - AUD_init(AUD_NULL_DEVICE, specs, AUD_DEFAULT_BUFFER_SIZE); -} - -void sound_reinit(struct bContext *C) -{ - AUD_Specs specs; - int device, buffersize; + int device, buffersize, success; device = U.audiodevice; buffersize = U.mixbufsize; @@ -66,8 +54,15 @@ void sound_reinit(struct bContext *C) if(specs.channels <= AUD_CHANNELS_INVALID) specs.channels = AUD_CHANNELS_STEREO; - if(!AUD_init(device, specs, buffersize)) - AUD_init(AUD_NULL_DEVICE, specs, buffersize); + if(!AUD_init(device, specs, buffersize)) { + if(device == AUD_SDL_DEVICE) + success= AUD_init(AUD_OPENAL_DEVICE, specs, AUD_DEFAULT_BUFFER_SIZE*4); + else + success= AUD_init(AUD_SDL_DEVICE, specs, AUD_DEFAULT_BUFFER_SIZE*4); + + if(!success) + AUD_init(AUD_NULL_DEVICE, specs, buffersize); + } } void sound_exit() |