[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [10937] branches/soc-2007-hcube/intern/ tinySND: Added enable/disable audio device feature
Csaba Hruska
csaba.hruska at gmail.com
Fri Jun 15 16:36:39 CEST 2007
Revision: 10937
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=10937
Author: hcube
Date: 2007-06-15 16:36:39 +0200 (Fri, 15 Jun 2007)
Log Message:
-----------
Added enable/disable audio device feature
Modified Paths:
--------------
branches/soc-2007-hcube/intern/tinySND/SND_Device.h
branches/soc-2007-hcube/intern/tinySND/blender/SND_C-api.cpp
branches/soc-2007-hcube/intern/tinySND/portaudio/portaudioDevice.cpp
branches/soc-2007-hcube/intern/tinySND/portaudio/portaudioDevice.h
branches/soc-2007-hcube/intern/tinySND/sdl/SDLDevice.cpp
branches/soc-2007-hcube/intern/tinySND/sdl/SDLDevice.h
Modified: branches/soc-2007-hcube/intern/tinySND/SND_Device.h
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/SND_Device.h 2007-06-15 12:08:29 UTC (rev 10936)
+++ branches/soc-2007-hcube/intern/tinySND/SND_Device.h 2007-06-15 14:36:39 UTC (rev 10937)
@@ -13,6 +13,10 @@
// close sound device
virtual bool finalize() = 0;
+ // enables/disables audio device temporarly
+ virtual void enable() = 0;
+ virtual void disable() = 0;
+
virtual int getNumChannels() = 0;
virtual char* getChannelName( int hwChannelIdx ) = 0;
// only same sample rate is acceptable that device has
Modified: branches/soc-2007-hcube/intern/tinySND/blender/SND_C-api.cpp
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/blender/SND_C-api.cpp 2007-06-15 12:08:29 UTC (rev 10936)
+++ branches/soc-2007-hcube/intern/tinySND/blender/SND_C-api.cpp 2007-06-15 14:36:39 UTC (rev 10937)
@@ -80,5 +80,8 @@
void SND_StopAllSounds(void)
{
+ assert( gDevice != 0 );
+
+ gDevice->disable();
}
Modified: branches/soc-2007-hcube/intern/tinySND/portaudio/portaudioDevice.cpp
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/portaudio/portaudioDevice.cpp 2007-06-15 12:08:29 UTC (rev 10936)
+++ branches/soc-2007-hcube/intern/tinySND/portaudio/portaudioDevice.cpp 2007-06-15 14:36:39 UTC (rev 10937)
@@ -169,3 +169,11 @@
mSounds[ hwChannelIdx ] = sound;
}
+void portaudioDevice::enable(void)
+{
+}
+
+void portaudioDevice::disable(void)
+{
+}
+
Modified: branches/soc-2007-hcube/intern/tinySND/portaudio/portaudioDevice.h
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/portaudio/portaudioDevice.h 2007-06-15 12:08:29 UTC (rev 10936)
+++ branches/soc-2007-hcube/intern/tinySND/portaudio/portaudioDevice.h 2007-06-15 14:36:39 UTC (rev 10937)
@@ -11,6 +11,9 @@
bool initialize();
bool finalize();
+ void enable();
+ void disable();
+
int getNumChannels();
char* getChannelName( int hwChannelIdx );
void assignSoundToChannel( int hwChannelIdx, SND_SoundInterface *sound );
Modified: branches/soc-2007-hcube/intern/tinySND/sdl/SDLDevice.cpp
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/sdl/SDLDevice.cpp 2007-06-15 12:08:29 UTC (rev 10936)
+++ branches/soc-2007-hcube/intern/tinySND/sdl/SDLDevice.cpp 2007-06-15 14:36:39 UTC (rev 10937)
@@ -47,7 +47,6 @@
fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
return false;
}
- SDL_PauseAudio(0);
return true;
}
@@ -66,6 +65,16 @@
return true;
}
+void SDLDevice::enable(void)
+{
+ SDL_PauseAudio(0);
+}
+
+void SDLDevice::disable(void)
+{
+ SDL_PauseAudio(1);
+}
+
void SDLDevice::fill_audio(void *udata, Uint8 *stream, int len)
{
((SDLDevice*)udata)->fill_audio_do((Sint16*)stream, len);
Modified: branches/soc-2007-hcube/intern/tinySND/sdl/SDLDevice.h
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/sdl/SDLDevice.h 2007-06-15 12:08:29 UTC (rev 10936)
+++ branches/soc-2007-hcube/intern/tinySND/sdl/SDLDevice.h 2007-06-15 14:36:39 UTC (rev 10937)
@@ -11,6 +11,9 @@
bool initialize();
bool finalize();
+ void enable();
+ void disable();
+
int getNumChannels();
char* getChannelName( int hwChannelIdx );
void assignSoundToChannel( int hwChannelIdx, SND_SoundInterface *sound );
More information about the Bf-blender-cvs
mailing list