Go to the documentation of this file.
21 #ifndef SOUND_HANDLER_SDL_H
22 #define SOUND_HANDLER_SDL_H
27 #include <SDL_audio.h>
48 SDL_AudioSpec audioSpec;
60 mutable std::mutex _mutex;
63 void mix(std::int16_t* outSamples, std::int16_t* inSamples,
64 unsigned int nSamples,
float volume);
83 static void sdl_audio_callback (
void *udata, Uint8 *stream,
int buffer_length_in);
100 size_t sample_count,
int seekSamples,
int streamId);
114 virtual void reset();
120 virtual int get_volume(
int sound_handle)
const;
130 virtual void pause();
137 virtual unsigned int get_duration(
int sound_handle)
const;
140 virtual unsigned int tell(
int sound_handle)
const;
150 void fetchSamples(std::int16_t* to,
unsigned int nSamples);
156 #endif // SOUND_HANDLER_SDL_H
virtual unsigned int get_duration(int sound_handle) const
Gets the duration in milliseconds of an event sound.
Definition: sound_handler.cpp:421
virtual void stopStreamingSound(int handle)
Remove scheduled requests to play the specified sound buffer slot.
Definition: sound_handler.cpp:268
virtual void unpause()
gnash calls this to unpause audio
Definition: sound_handler_sdl.cpp:322
virtual void stopStreamingSound(int sound_handle)
Remove scheduled requests to play the specified sound buffer slot.
Definition: sound_handler_sdl.cpp:175
virtual void unplugInputStream(InputStream *id)
Unplug an external InputStream from the mixer.
Definition: sound_handler.cpp:373
virtual void stopEventSound(int sound_handle)
Remove scheduled requests to play the specified sound buffer slot.
Definition: sound_handler.cpp:283
virtual void fetchSamples(std::int16_t *to, unsigned int nSamples)
Fetch mixed samples.
Definition: sound_handler.cpp:646
void log_debug(StringType msg, Args... args)
Definition: log.h:301
virtual void delete_sound(int sound_handle)
Discard the sound data for an embedded event sound.
Definition: sound_handler.cpp:198
virtual void stopAllEventSounds()
Stop all instances of all playing event sounds.
Definition: sound_handler_sdl.cpp:168
#define _(String)
Definition: log.h:44
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
virtual int get_volume(int sound_handle) const
Gets the volume for a given sound buffer slot.
Definition: sound_handler.cpp:241
@ m
Definition: GnashKey.h:159
virtual int createStreamingSound(const media::SoundInfo &sinfo)
Streaming sound functions:
Definition: sound_handler.cpp:442
virtual void pause()
gnash calls this to pause audio
Definition: sound_handler_sdl.cpp:315
void log_error(StringType msg, Args... args)
Definition: log.h:283
@ volume
Definition: klash_part.cpp:331
virtual void stopAllEventSounds()
Stop all instances of all playing event sounds.
Definition: sound_handler.cpp:306
virtual StreamBlockId addSoundBlock(SimpleBuffer buf, size_t sample_count, int seekSamples, int streamId)
Definition: sound_handler_sdl.cpp:151
void fetchSamples(std::int16_t *to, unsigned int nSamples)
Fetch mixed samples.
Definition: sound_handler_sdl.cpp:240
virtual void plugInputStream(std::unique_ptr< InputStream > in)
Plug an InputStream to the mixer.
Definition: sound_handler.cpp:613
SDL-based sound_handler.
Definition: sound_handler_sdl.h:44
virtual void stop_all_sounds()
Mixed functions:
Definition: sound_handler_sdl.cpp:190
virtual void delete_sound(int sound_handle)
Discard the sound data for an embedded event sound.
Definition: sound_handler_sdl.cpp:183
bool hasInputStreams() const
Does the mixer have input streams ?
Definition: sound_handler.cpp:785
virtual void stopEventSound(int sound_handle)
Remove scheduled requests to play the specified sound buffer slot.
Definition: sound_handler_sdl.cpp:161
virtual int create_sound(std::unique_ptr< SimpleBuffer > data, const media::SoundInfo &sinfo)
Event sound functions:
Definition: sound_handler.cpp:455
virtual void unpause()
gnash calls this to unpause audio
Definition: sound_handler.h:330
virtual unsigned int tell(int sound_handle) const
Gets the playhead position in milliseconds of an event sound.
Definition: sound_handler_sdl.cpp:227
virtual void pause()
gnash calls this to pause audio
Definition: sound_handler.h:327
void plugInputStream(std::unique_ptr< InputStream > in)
Plug an InputStream to the mixer.
Definition: sound_handler_sdl.cpp:297
void gnashSleep(time_t useconds)
Sleep compatibly for the specified number of microseconds.
Definition: GnashSleep.h:35
virtual void reset()
Discard all sound inputs (slots and aux streamers) and clear scheduling.
Definition: sound_handler_sdl.cpp:115
virtual unsigned int tell(int sound_handle) const
Gets the playhead position in milliseconds of an event sound.
Definition: sound_handler.cpp:398
Sound mixer.
Definition: sound_handler.h:88
unsigned long StreamBlockId
Identifier of a streaming sound block.
Definition: sound_handler.h:97
SDL_sound_handler(media::MediaHandler *m)
Definition: sound_handler_sdl.cpp:106
virtual StreamBlockId addSoundBlock(SimpleBuffer data, size_t sampleCount, int seekSamples, int streamId)
Definition: sound_handler.cpp:147
virtual unsigned int get_duration(int sound_handle) const
Gets the duration in milliseconds of an event sound.
Definition: sound_handler_sdl.cpp:220
sound_handler * create_sound_handler_sdl(media::MediaHandler *m)
Definition: sound_handler_sdl.cpp:234
virtual media::SoundInfo * get_sound_info(int handle) const
Returns a SoundInfo object for the sound with the given id.
Definition: sound_handler.cpp:258
virtual int create_sound(std::unique_ptr< SimpleBuffer > data, const media::SoundInfo &sinfo)
Event sound functions:
Definition: sound_handler_sdl.cpp:143
virtual int createStreamingSound(const media::SoundInfo &sinfo)
Streaming sound functions:
Definition: sound_handler_sdl.cpp:136
virtual media::SoundInfo * get_sound_info(int soundHandle) const
Returns a SoundInfo object for the sound with the given id.
Definition: sound_handler_sdl.cpp:213
virtual void stop_all_sounds()
Mixed functions:
Definition: sound_handler.cpp:225
virtual void set_volume(int sound_handle, int volume)
Sets the volume for a given event sound.
Definition: sound_handler.cpp:250
SimpleBuffer data
Definition: LocalConnection_as.cpp:151
~SDL_sound_handler()
Definition: sound_handler_sdl.cpp:121
A simple buffer of bytes.
Definition: SimpleBuffer.h:38
virtual void set_volume(int sound_handle, int volume)
Sets the volume for a given event sound.
Definition: sound_handler_sdl.cpp:206
void unplugInputStream(InputStream *id)
Unplug an external InputStream from the mixer.
Definition: sound_handler_sdl.cpp:333
virtual int get_volume(int sound_handle) const
Gets the volume for a given sound buffer slot.
Definition: sound_handler_sdl.cpp:198