Angband
Data Structures | Enumerations | Functions | Variables
snd-sdl.c File Reference

SDL sound support. More...

#include "angband.h"
#include "init.h"
#include "sound.h"
#include <SDL/SDL.h>
#include <SDL/SDL_mixer.h>

Data Structures

struct  sdl_sample
 Struct representing all data about an event sample. More...
 

Enumerations

enum  { SDL_NULL = 0, SDL_CHUNK, SDL_MUSIC }
 

Functions

static bool open_audio_sdl (void)
 Initialise SDL and open the mixer. More...
 
static bool load_sample_sdl (const char *filename, int file_type, sdl_sample *sample)
 Load a sound from file. More...
 
static bool load_sound_sdl (const char *filename, int file_type, struct sound_data *data)
 Load a sound and return a pointer to the associated SDL Sound data structure back to the core sound module. More...
 
static bool play_sound_sdl (struct sound_data *data)
 Play the sound stored in the provided SDL Sound data structure. More...
 
static bool unload_sound_sdl (struct sound_data *data)
 Free resources referenced in the provided SDL Sound data structure. More...
 
static bool close_audio_sdl (void)
 Shut down the SDL sound module and free resources. More...
 
const struct sound_file_typesupported_files_sdl (void)
 
errr init_sound_sdl (struct sound_hooks *hooks, int argc, char **argv)
 Init the SDL sound module. More...
 

Variables

static const struct sound_file_type supported_sound_files []
 

Detailed Description

SDL sound support.

Copyright (c) 2004 Brendon Oliver brend.nosp@m.on.o.nosp@m.liver.nosp@m.@gma.nosp@m.il.co.nosp@m.m Copyright (c) 2007 Andi Sidwell andi@.nosp@m.takk.nosp@m.aria..nosp@m.org Copyright (c) 2016 Graeme Russ graem.nosp@m.e.ru.nosp@m.ss@gm.nosp@m.ail..nosp@m.com A large chunk of this file was taken and modified from main-ros.

This work is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation, version 2, or

b) the "Angband licence": This software may be copied and distributed for educational, research, and not for profit purposes provided that this copyright and statement are included in all such copies. Other copyrights may also apply.

Enumeration Type Documentation

anonymous enum
Enumerator
SDL_NULL 
SDL_CHUNK 
SDL_MUSIC 

Function Documentation

static bool close_audio_sdl ( void  )
static

Shut down the SDL sound module and free resources.

Referenced by init_sound_sdl().

errr init_sound_sdl ( struct sound_hooks hooks,
int  argc,
char **  argv 
)
static bool load_sample_sdl ( const char *  filename,
int  file_type,
sdl_sample sample 
)
static

Load a sound from file.

References sdl_sample::chunk, sdl_sample::music, plog(), sdl_sample::sample_data, SDL_CHUNK, and SDL_MUSIC.

Referenced by load_sound_sdl().

static bool load_sound_sdl ( const char *  filename,
int  file_type,
struct sound_data data 
)
static

Load a sound and return a pointer to the associated SDL Sound data structure back to the core sound module.

References load_sample_sdl(), sound_data::loaded, mem_free(), mem_zalloc(), NULL, sound_data::plat_data, and sdl_sample::sample_type.

Referenced by init_sound_sdl().

static bool open_audio_sdl ( void  )
static

Initialise SDL and open the mixer.

References plog_fmt().

Referenced by init_sound_sdl().

static bool play_sound_sdl ( struct sound_data data)
static

Play the sound stored in the provided SDL Sound data structure.

References sdl_sample::chunk, sdl_sample::music, sound_data::plat_data, sdl_sample::sample_data, sdl_sample::sample_type, SDL_CHUNK, and SDL_MUSIC.

Referenced by init_sound_sdl().

const struct sound_file_type* supported_files_sdl ( void  )

References supported_sound_files.

Referenced by init_sound_sdl().

static bool unload_sound_sdl ( struct sound_data data)
static

Free resources referenced in the provided SDL Sound data structure.

References sdl_sample::chunk, sound_data::loaded, mem_free(), sdl_sample::music, NULL, sound_data::plat_data, sdl_sample::sample_data, sdl_sample::sample_type, SDL_CHUNK, and SDL_MUSIC.

Referenced by init_sound_sdl().

Variable Documentation

const struct sound_file_type supported_sound_files[]
static
Initial value:
= { {".mp3", SDL_MUSIC},
{".ogg", SDL_CHUNK},
{"", SDL_NULL} }
Definition: snd-sdl.c:44
Definition: snd-sdl.c:43
Definition: snd-sdl.c:45

Referenced by load_sound(), and supported_files_sdl().