Project

General

Profile

Feature #1734 ยป 0032-Audio-Let-plugin.play-to-know-if-track-is-music-or-s.patch

Marko Lindqvist, 11/12/2025 05:48 PM

View differences:

client/audio.c
static int audio_play_tag(struct section_file *sfile,
const char *tag, bool repeat,
int exclude, bool keep_old_style);
int exclude, enum keep_style keep_old_style);
static void audio_shutdown_atexit(void);
......
if (usage_enabled) {
current_track = audio_play_tag(mfcb.sfile, mfcb.tag, TRUE, current_track,
FALSE);
KS_CHANGE);
}
}
......
**************************************************************************/
static int audio_play_tag(struct section_file *sfile,
const char *tag, bool repeat, int exclude,
bool keep_old_style)
enum keep_style keep_old_style)
{
const char *soundfile;
const char *fullpath = NULL;
......
}
if (repeat) {
if (!keep_old_style) {
if (keep_old_style != KS_KEEP) {
mfcb.sfile = sfile;
mfcb.tag = tag;
}
......
}
}
if (!plugins[selected_plugin].play(tag, fullpath, repeat, cb)) {
if (!plugins[selected_plugin].play(tag, fullpath, repeat,
keep_old_style != KS_SND_EFFECT, cb)) {
return -1;
}
......
**************************************************************************/
static bool audio_play_sound_tag(const char *tag, bool repeat)
{
return (audio_play_tag(ss_tagfile, tag, repeat, -1, FALSE) >= 0);
return (audio_play_tag(ss_tagfile, tag, repeat, -1, KS_SND_EFFECT) >= 0);
}
/**********************************************************************//**
Play tag from music set
**************************************************************************/
static int audio_play_music_tag(const char *tag, bool repeat,
bool keep_old_style)
enum keep_style keep_old_style)
{
return audio_play_tag(ms_tagfile, tag, repeat, -1, keep_old_style);
}
......
music.
**************************************************************************/
static void real_audio_play_music(const char *const tag, char *const alt_tag,
bool keep_old_style)
enum keep_style keep_old_style)
{
char *pretty_alt_tag = alt_tag ? alt_tag : "(null)";
......
{
current_usage = usage;
real_audio_play_music(tag, alt_tag, FALSE);
real_audio_play_music(tag, alt_tag, KS_CHANGE);
}
/**********************************************************************//**
......
audio_stop();
}
real_audio_play_music(tag, alt_tag, TRUE);
real_audio_play_music(tag, alt_tag, KS_KEEP);
}
/**********************************************************************//**
client/audio.h
double (*get_volume) (void);
void (*set_volume) (double volume);
bool (*play) (const char *const tag, const char *const path, bool repeat,
audio_finished_callback cb);
bool music, audio_finished_callback cb);
void (*pause)(void);
void (*resume)(void);
};
enum music_usage { MU_MENU, MU_INGAME };
/* Sound effects do not have style. */
enum keep_style { KS_SND_EFFECT, KS_KEEP, KS_CHANGE };
struct strvec;
struct option;
const struct strvec *get_soundplugin_list(const struct option *poption);
client/audio_none.c
Play sound sample
**************************************************************************/
static bool none_audio_play(const char *const tag, const char *const fullpath,
bool repeat, audio_finished_callback cb)
bool repeat, bool music,
audio_finished_callback cb)
{
if (strcmp(tag, "e_turn_bell") == 0) {
sound_bell();
return TRUE;
}
return FALSE;
}
client/audio_sdl.c
Play sound
**************************************************************************/
static bool sdl_audio_play(const char *const tag, const char *const fullpath,
bool repeat, audio_finished_callback cb)
bool repeat, bool music, audio_finished_callback cb)
{
int i, j;
Mix_Chunk *wave = NULL;
    (1-1/1)