Freeciv21
Develop your civilization from humble roots to a global empire
audio_sdl.cpp File Reference
#include <fc_config.h>
#include <cstring>
#include "log.h"
#include "support.h"
#include "audio.h"
#include "audio_sdl.h"
#include <array>
+ Include dependency graph for audio_sdl.cpp:

Go to the source code of this file.

Classes

struct  sample
 

Functions

static void sdl_audio_set_volume (double volume)
 Set the volume. More...
 
static double sdl_audio_get_volume ()
 Get the volume. More...
 
static bool sdl_audio_play (const QString &tag, const QString &fullpath, bool repeat, audio_finished_callback cb)
 Play sound. More...
 
static void sdl_audio_stop ()
 Stop music. More...
 
static void sdl_audio_wait ()
 Wait for audio to die on all channels. More...
 
static void quit_sdl_audio ()
 Quit SDL. More...
 
static int init_sdl_audio ()
 Init SDL. More...
 
static void sdl_audio_shutdown ()
 Clean up. More...
 
static bool sdl_audio_init ()
 Initialize. More...
 
void audio_sdl_init ()
 Initialize. More...
 

Variables

const size_t buf_size = 1024
 
static Mix_Music * mus = nullptr
 
static std::array< sample, MIX_CHANNELS > samples
 
static double sdl_audio_volume
 

Function Documentation

◆ audio_sdl_init()

void audio_sdl_init ( )

Initialize.

Note that this function is called very early at the client startup. So for example logging isn't available.

Definition at line 253 of file audio_sdl.cpp.

Referenced by audio_init().

◆ init_sdl_audio()

static int init_sdl_audio ( )
static

Init SDL.

If the video is already in use (by gui-sdl), just init the subsystem.

This will need to be changed if SDL is used elsewhere.

Definition at line 183 of file audio_sdl.cpp.

Referenced by sdl_audio_init().

◆ quit_sdl_audio()

static void quit_sdl_audio ( )
static

Quit SDL.

If the video is still in use (by gui-sdl), just quit the subsystem.

This will need to be changed if SDL is used elsewhere.

Definition at line 168 of file audio_sdl.cpp.

Referenced by sdl_audio_init(), and sdl_audio_shutdown().

◆ sdl_audio_get_volume()

static double sdl_audio_get_volume ( )
static

Get the volume.

Definition at line 64 of file audio_sdl.cpp.

Referenced by audio_sdl_init().

◆ sdl_audio_init()

static bool sdl_audio_init ( )
static

Initialize.

Definition at line 220 of file audio_sdl.cpp.

Referenced by audio_sdl_init().

◆ sdl_audio_play()

static bool sdl_audio_play ( const QString &  tag,
const QString &  fullpath,
bool  repeat,
audio_finished_callback  cb 
)
static

Play sound.

Definition at line 69 of file audio_sdl.cpp.

Referenced by audio_sdl_init().

◆ sdl_audio_set_volume()

static void sdl_audio_set_volume ( double  volume)
static

Set the volume.

Definition at line 54 of file audio_sdl.cpp.

Referenced by audio_sdl_init(), and sdl_audio_init().

◆ sdl_audio_shutdown()

static void sdl_audio_shutdown ( )
static

Clean up.

Definition at line 195 of file audio_sdl.cpp.

Referenced by audio_sdl_init().

◆ sdl_audio_stop()

static void sdl_audio_stop ( )
static

Stop music.

Definition at line 144 of file audio_sdl.cpp.

Referenced by audio_sdl_init(), and sdl_audio_shutdown().

◆ sdl_audio_wait()

static void sdl_audio_wait ( )
static

Wait for audio to die on all channels.

WARNING: If a channel is looping, it will NEVER exit! Always call music_stop() first!

Definition at line 155 of file audio_sdl.cpp.

Referenced by audio_sdl_init(), and sdl_audio_shutdown().

Variable Documentation

◆ buf_size

const size_t buf_size = 1024

Definition at line 44 of file audio_sdl.cpp.

Referenced by sdl_audio_init().

◆ mus

Mix_Music* mus = nullptr
static

Definition at line 47 of file audio_sdl.cpp.

Referenced by sdl_audio_play(), and sdl_audio_shutdown().

◆ samples

std::array<sample, MIX_CHANNELS> samples
static

Definition at line 48 of file audio_sdl.cpp.

Referenced by sdl_audio_init(), sdl_audio_play(), and sdl_audio_shutdown().

◆ sdl_audio_volume

double sdl_audio_volume
static