SGDK
A free and open development kit for the Sega Mega Drive
Loading...
Searching...
No Matches
xgm2.h
Go to the documentation of this file.
1
13
14#ifndef _XGM2_H_
15#define _XGM2_H_
16
17
22void XGM2_loadDriver(bool waitReady);
23
28bool XGM2_isPlaying(void);
29
41void XGM2_load(const u8 *song);
55void XGM2_load_FAR(const u8 *song, const u32 len);
67void XGM2_playTrack(const u16 track);
79void XGM2_play(const u8* song);
93void XGM2_play_FAR(const u8* song, const u32 len);
94
104void XGM2_stop(void);
114void XGM2_pause(void);
124void XGM2_resume(void);
125
147u8 XGM2_isPlayingPCM(const u16 channel_mask);
171bool XGM2_playPCM(const u8 *sample, const u32 len, const SoundPCMChannel channel);
203bool XGM2_playPCMEx(const u8 *sample, const u32 len, const SoundPCMChannel channel, const u8 priority, const bool halfRate, const bool loop);
218void XGM2_stopPCM(const SoundPCMChannel channel);
219
224bool XGM2_isProcessingFade(void);
233void XGM2_fadeIn(const u16 numFrame);
242void XGM2_fadeOut(const u16 numFrame);
251void XGM2_fadeOutAndStop(const u16 numFrame);
260void XGM2_fadeOutAndPause(const u16 numFrame);
273void XGM2_fadeTo(const u16 fmVolume, const u16 psgVolume, const u16 numFrame);
274
281void XGM2_setLoopNumber(const s8 value);
282
292u32 XGM2_getElapsed(void);
293
317void XGM2_setMusicTempo(const u16 value);
318
328void XGM2_setFMVolume(const u16 value);
338void XGM2_setPSGVolume(const u16 value);
339
344bool XGM2_isPAL(const u8 *xgm2);
345
353u16 XGM2_getCPULoad(const bool mean);
361u16 XGM2_getDMAWaitTime(const bool mean);
362
387
388
389#endif // _XGM2_H_
SoundPCMChannel
Sound PCM channel enum.
Definition sound.h:18
unsigned long u32
Definition types.h:105
char s8
Definition types.h:79
unsigned short u16
Definition types.h:100
unsigned char u8
Definition types.h:95
void XGM2_setPSGVolume(const u16 value)
Set the volume level for the PSG music part.
Definition xgm2.c:836
void XGM2_pause(void)
Pause playing music, music can be resumed by calling XGM2_resume(). Note that due to the nature of t...
Definition xgm2.c:453
bool XGM2_isProcessingFade(void)
Definition xgm2.c:678
void XGM2_loadDriver(bool waitReady)
Load the XGM2 sound driver.
Definition xgm2.c:212
bool XGM2_isPlaying(void)
Returns play music state.
Definition xgm2.c:256
u8 XGM2_getDebugProcessDuration(const u16 ind)
Returns the ending process time in number of sample for the specified v-int process (v-int process nu...
Definition xgm2.c:974
void XGM2_stopPCM(const SoundPCMChannel channel)
Stop play PCM on specified channel (XGM2 music player driver). No effect if no sample was currently ...
Definition xgm2.c:643
u16 XGM2_getDebugPCMRate(void)
Returns the real PCM playback rate (XGM2 driver). Debug function to verify the driver is working opt...
Definition xgm2.c:938
void XGM2_load(const u8 *song)
Load the specified XGM2 music blob (prepare for play, useful for multi tracks XGM2 music)
Definition xgm2.c:276
void XGM2_fadeTo(const u16 fmVolume, const u16 psgVolume, const u16 numFrame)
Process a specific music volume "fade" effect. Gradually change FM and PSG volume starting from curr...
Definition xgm2.c:703
void XGM2_fadeOutAndPause(const u16 numFrame)
Process music volume "fade-out" effect and pause. Gradually decrease FM and PSG volume starting from...
Definition xgm2.c:698
void XGM2_fadeOut(const u16 numFrame)
Process music volume "fade-out" effect. Gradually decrease FM and PSG volume starting from current l...
Definition xgm2.c:688
void XGM2_resume(void)
Resume playing music after pausing with XGM2_stop(). Note that due to the nature of the music chip (...
Definition xgm2.c:475
bool XGM2_playPCMEx(const u8 *sample, const u32 len, const SoundPCMChannel channel, const u8 priority, const bool halfRate, const bool loop)
Play a PCM sample on specified channel (XGM2 music player driver). If a sample was currently playing...
Definition xgm2.c:572
u16 XGM2_getCPULoad(const bool mean)
Returns an estimation of the Z80 CPU load (XGM2 driver).
Definition xgm2.c:853
u32 XGM2_getElapsed(void)
Return the elapsed play time since the last XGM2_play(..) call. The returned value is in music frame...
Definition xgm2.c:761
void XGM2_play(const u8 *song)
Start playing the specified XGM2 music blob (fast play for single track XGM2 music)
Definition xgm2.c:416
void XGM2_play_FAR(const u8 *song, const u32 len)
Same as XGM2_play(..) except it supports music accessible through bank switch.
Definition xgm2.c:422
u16 XGM2_getMusicTempo(void)
Get the current music tempo (in tick per second). Default value is 60 or 50 depending the system is ...
Definition xgm2.c:730
bool XGM2_playPCM(const u8 *sample, const u32 len, const SoundPCMChannel channel)
Play a PCM sample on specified channel (XGM2 music player driver). The method use a default priority...
Definition xgm2.c:638
void XGM2_setLoopNumber(const s8 value)
Set the loop number for music with loop command. Default value is -1 for pseudo unfinite (255) loops...
Definition xgm2.c:723
u8 XGM2_getDebugMissedFrames(void)
Returns the number of missed frames since last startPlay command. Debug function to verify the drive...
Definition xgm2.c:956
void XGM2_fadeOutAndStop(const u16 numFrame)
Process music volume "fade-out" effect and stop. Gradually decrease FM and PSG volume starting from ...
Definition xgm2.c:693
u16 XGM2_getDebugFrameCounter(void)
Returns the internal frame counter (v-int process number). Debug function to verify the driver is wo...
Definition xgm2.c:922
void XGM2_playTrack(const u16 track)
Start playing the specified track (need to call XGM2_load(..) first)
Definition xgm2.c:340
u8 XGM2_isPlayingPCM(const u16 channel_mask)
Return play status of specified PCM channel.
Definition xgm2.c:513
void XGM2_fadeIn(const u16 numFrame)
Process music volume "fade-in" effect, must be called right after a "start play" or "resume" command....
Definition xgm2.c:683
void XGM2_setMusicTempo(const u16 value)
Set the music tempo (in tick per second). Default value is 60 or 50 depending the system is NTSC or ...
Definition xgm2.c:754
void XGM2_load_FAR(const u8 *song, const u32 len)
Same as XGM2_load(..) except it supports access through bank switch.
Definition xgm2.c:335
void XGM2_stop(void)
Stop playing music (cannot be resumed).
Definition xgm2.c:428
void XGM2_setFMVolume(const u16 value)
Set the volume level for the FM music part.
Definition xgm2.c:826
u16 XGM2_getDMAWaitTime(const bool mean)
Returns an estimation of the Z80 CPU time spent in waiting for DMA completion (see Z80_setBusProtecti...
Definition xgm2.c:887
bool XGM2_isPAL(const u8 *xgm2)
Returns TRUE if specified xgm2 use PAL timing.
Definition xgm2.c:847