[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash/backend sound_handler_sdl.cpp
From: |
Vitaly Alexeev |
Subject: |
[Gnash-commit] gnash/backend sound_handler_sdl.cpp |
Date: |
Sat, 27 May 2006 18:30:39 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Branch:
Changes by: Vitaly Alexeev <address@hidden> 06/05/27 18:30:39
Modified files:
backend : sound_handler_sdl.cpp
Log message:
added some sound methods
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/backend/sound_handler_sdl.cpp.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
Patches:
Index: gnash/backend/sound_handler_sdl.cpp
diff -u gnash/backend/sound_handler_sdl.cpp:1.9
gnash/backend/sound_handler_sdl.cpp:1.10
--- gnash/backend/sound_handler_sdl.cpp:1.9 Mon May 8 21:12:24 2006
+++ gnash/backend/sound_handler_sdl.cpp Sat May 27 18:30:39 2006
@@ -166,11 +166,10 @@
return m_samples.size() - 1;
}
-
- virtual void play_sound(int sound_handle, int loop_count /* other
params */)
+ virtual void play_sound(int sound_handle, int loop_count, int
secondOffset)
// Play the index'd sample.
{
- if (sound_handle >= 0 && sound_handle < (int) m_samples.size())
+ if (m_opened && sound_handle >= 0 && sound_handle < (int)
m_samples.size())
{
if (m_samples[sound_handle])
{
@@ -180,23 +179,53 @@
}
}
-
- virtual void stop_sound(int sound_handle)
+ virtual void stop_all_sounds()
{
- if (sound_handle < 0 || sound_handle >= (int) m_samples.size())
+ if (m_opened)
{
- // Invalid handle.
- return;
+ for (int i = 0; i < MIX_CHANNELS; i++)
+ {
+ if (Mix_Playing(i))
+ {
+ Mix_HaltChannel(i);
+ }
+ }
}
+ }
- for (int i = 0; i < MIX_CHANNELS; i++)
+ virtual int get_volume(int sound_handle)
+ {
+ int previous_volume = 100;
+ if (m_opened && sound_handle >= 0 && sound_handle <
m_samples.size())
{
- Mix_Chunk* playing_chunk = Mix_GetChunk(i);
- if (Mix_Playing(i)
- && playing_chunk == m_samples[sound_handle])
+ // if you passed a negative value for volume then
+ // this volume is still the current volume for the
chunk
+ previous_volume =
Mix_VolumeChunk(m_samples[sound_handle], -1);
+ }
+ return previous_volume;
+ }
+
+ virtual void set_volume(int sound_handle, int volume)
+ {
+ if (m_opened && sound_handle >= 0 && sound_handle <
m_samples.size())
+ {
+ int vol = (MIX_MAX_VOLUME / 100) * volume;
+ Mix_VolumeChunk(m_samples[sound_handle], vol);
+ }
+ }
+
+ virtual void stop_sound(int sound_handle)
+ {
+ if (m_opened && sound_handle >= 0 && sound_handle <
m_samples.size())
+ {
+ for (int i = 0; i < MIX_CHANNELS; i++)
{
- // Stop this channel.
- Mix_HaltChannel(i);
+ Mix_Chunk* playing_chunk = Mix_GetChunk(i);
+ if (playing_chunk == m_samples[sound_handle])
+ {
+ // Stop this channel.
+ Mix_HaltChannel(i);
+ }
}
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash/backend sound_handler_sdl.cpp,
Vitaly Alexeev <=