townengine/include/twn_audio.h

39 lines
1.1 KiB
C

#ifndef TWN_AUDIO_H
#define TWN_AUDIO_H
#include "twn_engine_api.h"
#include <stdbool.h>
typedef struct PlayAudioArgs {
/* default: false */
bool repeat;
/* crossfade between already playing audio on a given channel, if any */
/* default: false */
bool crossfade;
/* range: 0.0f to 1.0f */
/* default: 1.0f */
float volume;
/* range: -1.0 to 1.0f */
/* default: 0.0f */
float panning;
} PlayAudioArgs;
/* plays audio file at specified channel or anywhere if NULL is passed */
/* path must contain valid file extension to infer which file format it is */
/* supported formats: .ogg, .xm */
/* preserves args that are already specified on the channel */
TWN_API void audio_play(const char *path, const char *channel);
TWN_API void audio_play_ex(const char *path, const char *channel, PlayAudioArgs args);
/* could be used for modifying args */
/* warn: is only valid if no other calls to audio are made */
TWN_API PlayAudioArgs *audio_get_args(const char *channel);
TWN_API PlayAudioArgs audio_get_default_args(void);
#endif