libdragon
xm64.h
Go to the documentation of this file.
1
36#ifndef __LIBDRAGON_AUDIO_XM64_H
37#define __LIBDRAGON_AUDIO_XM64_H
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
44typedef struct xm_context_s xm_context_t;
45typedef struct waveform_s waveform_t;
47
56typedef struct xm64player_s {
57 xm_context_t *ctx;
59 int nwaves;
60 FILE *fh;
62 bool playing;
63 bool looping;
64 struct {
65 int patidx, row, tick;
66 } seek;
68
79void xm64player_open(xm64player_t *player, const char *fn);
80
87
99void xm64player_set_loop(xm64player_t *player, bool loop);
100
109void xm64player_play(xm64player_t *player, int first_ch);
110
117void xm64player_stop(xm64player_t *player);
118
132void xm64player_tell(xm64player_t *player, int *patidx, int *row, float *secs);
133
147void xm64player_seek(xm64player_t *player, int patidx, int row, int tick);
148
155void xm64player_set_vol(xm64player_t *player, float volume);
156
175void xm64player_set_effect_callback(xm64player_t *player, void (*cb)(void*, uint8_t, uint8_t, uint8_t), void *ctx);
176
180void xm64player_close(xm64player_t *player);
181
182#ifdef __cplusplus
183}
184#endif
185
186#endif
A waveform that can be played back through the mixer.
Definition: mixer.h:439
FILE * fh
open handle of XM64 file
Definition: xm64.h:60
xm_context_t * ctx
libxm context
Definition: xm64.h:57
int first_ch
first channel used in the mixer
Definition: xm64.h:61
void xm64player_open(xm64player_t *player, const char *fn)
Open a XM64 module file and prepare for playback.
Definition: xm64.c:93
int xm64player_num_channels(xm64player_t *player)
Get the number of channels in the XM64 file.
Definition: xm64.c:167
void xm64player_set_loop(xm64player_t *player, bool loop)
Configure a XM64 file for looping.
Definition: xm64.c:171
void xm64player_play(xm64player_t *player, int first_ch)
Start playing the XM64 module.
Definition: xm64.c:175
void xm64player_set_effect_callback(xm64player_t *player, void(*cb)(void *, uint8_t, uint8_t, uint8_t), void *ctx)
Set a custom effect callback to allow music synchronization.
Definition: xm64.c:234
void xm64player_set_vol(xm64player_t *player, float volume)
Change the volume of the player.
Definition: xm64.c:228
void xm64player_seek(xm64player_t *player, int patidx, int row, int tick)
Seek to a specific position of the XM module.
Definition: xm64.c:218
bool looping
true if the XM is configured to loop
Definition: xm64.h:63
void xm64player_close(xm64player_t *player)
Close and deallocate the XM64 player.
Definition: xm64.c:238
bool playing
playing flag
Definition: xm64.h:62
int nwaves
number of wavers (XM "samples")
Definition: xm64.h:59
void xm64player_tell(xm64player_t *player, int *patidx, int *row, float *secs)
Read the current position of the XM module.
Definition: xm64.c:203
waveform_t * waves
array of all waveforms (one per XM "sample")
Definition: xm64.h:58
void xm64player_stop(xm64player_t *player)
Stop XM playback.
Definition: xm64.c:198
Player of a .XM64 file.
Definition: xm64.h:56