Freeciv-3.2
Loading...
Searching...
No Matches
Data Structures | Functions | Variables
audio_sdl.c File Reference
#include <string.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_mixer.h>
#include "log.h"
#include "support.h"
#include "audio.h"
#include "audio_sdl.h"

Go to the source code of this file.

Data Structures

struct  sample
 

Functions

static void sdl_audio_set_volume (double volume)
 
static double sdl_audio_get_volume (void)
 
static bool sdl_audio_play (const char *const tag, const char *const fullpath, bool repeat, audio_finished_callback cb)
 
static void sdl_audio_pause (void)
 
static void sdl_audio_resume (void)
 
static void sdl_audio_stop (void)
 
static void sdl_audio_wait (void)
 
static void quit_sdl_audio (void)
 
static bool init_sdl_audio (void)
 
static void sdl_audio_shutdown (struct audio_plugin *self)
 
static bool sdl_audio_init (struct audio_plugin *self)
 
void audio_sdl_init (void)
 

Variables

const size_t buf_size = 1024
 
static Mix_Musicmus = NULL
 
static struct sample samples [MIX_CHANNELS]
 
static double sdl_audio_volume
 

Function Documentation

◆ audio_sdl_init()

void audio_sdl_init ( void  )

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

Definition at line 295 of file audio_sdl.c.

Referenced by audio_init().

◆ init_sdl_audio()

static bool init_sdl_audio ( void  )
static

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

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

Definition at line 210 of file audio_sdl.c.

Referenced by sdl_audio_init().

◆ quit_sdl_audio()

static void quit_sdl_audio ( void  )
static

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

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

Definition at line 195 of file audio_sdl.c.

Referenced by sdl_audio_init(), and sdl_audio_shutdown().

◆ sdl_audio_get_volume()

static double sdl_audio_get_volume ( void  )
static

Get the volume.

Definition at line 73 of file audio_sdl.c.

Referenced by audio_sdl_init().

◆ sdl_audio_init()

static bool sdl_audio_init ( struct audio_plugin self)
static

Initialize.

Definition at line 253 of file audio_sdl.c.

Referenced by audio_sdl_init().

◆ sdl_audio_pause()

static void sdl_audio_pause ( void  )
static

Pause music

Definition at line 155 of file audio_sdl.c.

Referenced by audio_sdl_init().

◆ sdl_audio_play()

static bool sdl_audio_play ( const char *const  tag,
const char *const  fullpath,
bool  repeat,
audio_finished_callback  cb 
)
static

Play sound

Definition at line 81 of file audio_sdl.c.

Referenced by audio_sdl_init().

◆ sdl_audio_resume()

static void sdl_audio_resume ( void  )
static

Resume music

Definition at line 163 of file audio_sdl.c.

Referenced by audio_sdl_init().

◆ sdl_audio_set_volume()

static void sdl_audio_set_volume ( double  volume)
static

Set the volume.

Definition at line 63 of file audio_sdl.c.

Referenced by audio_sdl_init(), and sdl_audio_init().

◆ sdl_audio_shutdown()

static void sdl_audio_shutdown ( struct audio_plugin self)
static

Clean up.

Definition at line 228 of file audio_sdl.c.

Referenced by audio_sdl_init().

◆ sdl_audio_stop()

static void sdl_audio_stop ( void  )
static

Stop music

Definition at line 171 of file audio_sdl.c.

Referenced by audio_sdl_init(), and sdl_audio_shutdown().

◆ sdl_audio_wait()

static void sdl_audio_wait ( void  )
static

Wait for audio to die on all channels. WARNING: If a channel is looping, it will NEVER exit! Always call stop_style_music() first!

Definition at line 182 of file audio_sdl.c.

Referenced by audio_sdl_init(), and sdl_audio_shutdown().

Variable Documentation

◆ buf_size

const size_t buf_size = 1024

Definition at line 53 of file audio_sdl.c.

Referenced by interpret_tilde(), and sdl_audio_init().

◆ mus

Mix_Music* mus = NULL
static

Definition at line 56 of file audio_sdl.c.

Referenced by sdl_audio_play(), and sdl_audio_shutdown().

◆ samples

struct sample samples[MIX_CHANNELS]
static

Definition at line 57 of file audio_sdl.c.

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

◆ sdl_audio_volume

double sdl_audio_volume
static