[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11720] branches/soc-2007-hcube: bugfix: there were and unnecessary assertion, while loading blend file, due to audio callback was live all the time.
Csaba Hruska
csaba.hruska at gmail.com
Mon Aug 20 01:30:56 CEST 2007
Revision: 11720
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11720
Author: hcube
Date: 2007-08-20 01:30:56 +0200 (Mon, 20 Aug 2007)
Log Message:
-----------
bugfix: there were and unnecessary assertion, while loading blend file, due to audio callback was live all the time.
Modified Paths:
--------------
branches/soc-2007-hcube/intern/tinySND/blender/SND_C-api.cpp
branches/soc-2007-hcube/intern/tinySND/blender/SND_C-api.h
branches/soc-2007-hcube/source/blender/include/BAU_soundsystem.h
branches/soc-2007-hcube/source/blender/src/soundsystem.c
Modified: branches/soc-2007-hcube/intern/tinySND/blender/SND_C-api.cpp
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/blender/SND_C-api.cpp 2007-08-19 23:04:34 UTC (rev 11719)
+++ branches/soc-2007-hcube/intern/tinySND/blender/SND_C-api.cpp 2007-08-19 23:30:56 UTC (rev 11720)
@@ -112,6 +112,20 @@
gDevice = 0;
}
+void SND_Enable(void)
+{
+ assert( gDevice != 0 );
+
+ gDevice->enable();
+}
+
+void SND_Disable(void)
+{
+ assert( gDevice != 0 );
+
+ gDevice->disable();
+}
+
int SND_GetMixRate(void)
{
assert( gDevice != 0 );
Modified: branches/soc-2007-hcube/intern/tinySND/blender/SND_C-api.h
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/blender/SND_C-api.h 2007-08-19 23:04:34 UTC (rev 11719)
+++ branches/soc-2007-hcube/intern/tinySND/blender/SND_C-api.h 2007-08-19 23:30:56 UTC (rev 11720)
@@ -28,6 +28,8 @@
extern int SND_IsInitialized(void);
extern void SND_Initialize(void);
extern void SND_Finalize(void);
+extern void SND_Enable(void);
+extern void SND_Disable(void);
extern int SND_GetMixRate(void);
Modified: branches/soc-2007-hcube/source/blender/include/BAU_soundsystem.h
===================================================================
--- branches/soc-2007-hcube/source/blender/include/BAU_soundsystem.h 2007-08-19 23:04:34 UTC (rev 11719)
+++ branches/soc-2007-hcube/source/blender/include/BAU_soundsystem.h 2007-08-19 23:30:56 UTC (rev 11720)
@@ -25,7 +25,7 @@
void audio_sample_unload(struct bSample* sample);
// pcm data parameters: 4000KHz and 4 bit, it is just visual purpuses
-short* audio_sample_getvisualpcmdata(struct bSample *sample, int channelIdx);
+char* audio_sample_getvisualpcmdata(struct bSample *sample, int channelIdx);
// bSound functions
// hint: a bSound->sample cant be NULL, always have to be a valid pointer
Modified: branches/soc-2007-hcube/source/blender/src/soundsystem.c
===================================================================
--- branches/soc-2007-hcube/source/blender/src/soundsystem.c 2007-08-19 23:04:34 UTC (rev 11719)
+++ branches/soc-2007-hcube/source/blender/src/soundsystem.c 2007-08-19 23:30:56 UTC (rev 11720)
@@ -321,7 +321,7 @@
}
// pcm data parameters: 4000KHz and 4 bit, it is just visual purpuses
-short* audio_sample_getvisualpcmdata( struct bSample *sample, int channelIdx )
+char* audio_sample_getvisualpcmdata( struct bSample *sample, int channelIdx )
{
assert( sample != NULL );
assert( sample->snd_sample != NULL );
@@ -459,6 +459,7 @@
{
bSound *sound;
+ SND_Disable();
// initialize sample blocks
sound = G.main->sound.first;
while( sound )
@@ -471,12 +472,17 @@
audio_sample_load( sound->sample );
sound = (bSound*)sound->id.next;
}
+ SND_Enable();
}
int audio_sound_isplaying(struct bSound *sound)
{
assert( sound != NULL );
- assert( sound->sample != NULL );
+
+ if( sound->sample == NULL )
+ {
+ return FALSE;
+ }
assert( sound->sample->snd_sample != NULL );
return SND_SoundIsPlaying( (SND_SoundIHandle)sound->sample->snd_sample );
@@ -485,7 +491,11 @@
void audio_sound_play(struct bSound *sound)
{
assert( sound != NULL );
- assert( sound->sample != NULL );
+
+ if( sound->sample == NULL )
+ {
+ return;
+ }
assert( sound->sample->snd_sample != NULL );
SND_SoundPlay( (SND_SoundIHandle)sound->sample->snd_sample );
@@ -494,7 +504,10 @@
void audio_sound_stop(struct bSound *sound)
{
assert( sound != NULL );
- assert( sound->sample != NULL );
+ if( sound->sample == NULL )
+ {
+ return;
+ }
assert( sound->sample->snd_sample != NULL );
SND_SoundStop( (SND_SoundIHandle)sound->sample->snd_sample );
@@ -503,7 +516,10 @@
int audio_sound_getframeposition(struct bSound *sound)
{
assert( sound != NULL );
- assert( sound->sample != NULL );
+ if( sound->sample == NULL )
+ {
+ return 0;
+ }
assert( sound->sample->snd_sample != NULL );
return SND_SoundGetFramePos( (SND_SoundIHandle)sound->sample->snd_sample );
@@ -512,7 +528,10 @@
void audio_sound_setframeposition(struct bSound *sound, int framePos)
{
assert( sound != NULL );
- assert( sound->sample != NULL );
+ if( sound->sample == NULL )
+ {
+ return;
+ }
assert( sound->sample->snd_sample != NULL );
SND_SoundSeek( (SND_SoundIHandle)sound->sample->snd_sample, framePos );
@@ -521,7 +540,10 @@
float audio_sound_getgain(struct bSound *sound)
{
assert( sound != NULL );
- assert( sound->sample != NULL );
+ if( sound->sample == NULL )
+ {
+ return 0.0;
+ }
assert( sound->sample->snd_sample != NULL );
return SND_SoundGetGain( (SND_SoundIHandle)sound->sample->snd_sample );
@@ -530,7 +552,10 @@
void audio_sound_setgain(struct bSound *sound, float gain)
{
assert( sound != NULL );
- assert( sound->sample != NULL );
+ if( sound->sample == NULL )
+ {
+ return;
+ }
assert( sound->sample->snd_sample != NULL );
SND_SoundSetGain( (SND_SoundIHandle)sound->sample->snd_sample, gain );
@@ -539,7 +564,10 @@
float audio_sound_getpan(struct bSound *sound)
{
assert( sound != NULL );
- assert( sound->sample != NULL );
+ if( sound->sample == NULL )
+ {
+ return 0.0;
+ }
assert( sound->sample->snd_sample != NULL );
return SND_SoundGetPan( (SND_SoundIHandle)sound->sample->snd_sample );
@@ -548,7 +576,10 @@
void audio_sound_setpan(struct bSound *sound, float pan)
{
assert( sound != NULL );
- assert( sound->sample != NULL );
+ if( sound->sample == NULL )
+ {
+ return;
+ }
assert( sound->sample->snd_sample != NULL );
SND_SoundSetPan( (SND_SoundIHandle)sound->sample->snd_sample, pan );
@@ -557,7 +588,10 @@
int audio_sound_ismuted(struct bSound *sound)
{
assert( sound != NULL );
- assert( sound->sample != NULL );
+ if( sound->sample == NULL )
+ {
+ return FALSE;
+ }
assert( sound->sample->snd_sample != NULL );
return SND_SoundIsMuted( (SND_SoundIHandle)sound->sample->snd_sample );
@@ -566,7 +600,10 @@
void audio_sound_setmute(struct bSound *sound, int mute)
{
assert( sound != NULL );
- assert( sound->sample != NULL );
+ if( sound->sample == NULL )
+ {
+ return;
+ }
assert( sound->sample->snd_sample != NULL );
SND_SoundSetMute( (SND_SoundIHandle)sound->sample->snd_sample, mute );
More information about the Bf-blender-cvs
mailing list