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
24void XGM2_loadDriver(bool waitReady);
31void XGM2_unloadDriver(void);
32
37bool XGM2_isPlaying(void);
38
50void XGM2_load(const u8 *song);
64void XGM2_load_FAR(const u8 *song, const u32 len);
76void XGM2_playTrack(const u16 track);
88void XGM2_play(const u8* song);
102void XGM2_play_FAR(const u8* song, const u32 len);
103
113void XGM2_stop(void);
123void XGM2_pause(void);
133void XGM2_resume(void);
134
156u8 XGM2_isPlayingPCM(const u16 channel_mask);
180bool XGM2_playPCM(const u8 *sample, const u32 len, const SoundPCMChannel channel);
212bool XGM2_playPCMEx(const u8 *sample, const u32 len, const SoundPCMChannel channel, const u8 priority, const bool halfRate, const bool loop);
227void XGM2_stopPCM(const SoundPCMChannel channel);
228
233bool XGM2_isProcessingFade(void);
242void XGM2_fadeIn(const u16 numFrame);
251void XGM2_fadeOut(const u16 numFrame);
260void XGM2_fadeOutAndStop(const u16 numFrame);
269void XGM2_fadeOutAndPause(const u16 numFrame);
282void XGM2_fadeTo(const u16 fmVolume, const u16 psgVolume, const u16 numFrame);
283
290void XGM2_setLoopNumber(const s8 value);
291
301u32 XGM2_getElapsed(void);
302
326void XGM2_setMusicTempo(const u16 value);
327
337void XGM2_setFMVolume(const u16 value);
347void XGM2_setPSGVolume(const u16 value);
348
353bool XGM2_isPAL(const u8 *xgm2);
354
362u16 XGM2_getCPULoad(const bool mean);
370u16 XGM2_getDMAWaitTime(const bool mean);
371
396
397
398#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:874
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:446
bool XGM2_isProcessingFade(void)
Definition xgm2.c:671
void XGM2_loadDriver(bool waitReady)
Load the XGM2 sound driver.
Definition xgm2.c:211
bool XGM2_isPlaying(void)
Returns play music state.
Definition xgm2.c:249
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:1012
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:636
u16 XGM2_getDebugPCMRate(void)
Returns the real PCM playback rate (XGM2 driver). Debug function to verify the driver is working opt...
Definition xgm2.c:976
void XGM2_load(const u8 *song)
Load the specified XGM2 music blob (prepare for play, useful for multi tracks XGM2 music)
Definition xgm2.c:269
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:696
void XGM2_unloadDriver(void)
Unload the XGM2 sound driver.
Definition xgm2.c:242
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:691
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:681
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:468
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:565
u16 XGM2_getCPULoad(const bool mean)
Returns an estimation of the Z80 CPU load (XGM2 driver).
Definition xgm2.c:891
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:799
void XGM2_play(const u8 *song)
Start playing the specified XGM2 music blob (fast play for single track XGM2 music)
Definition xgm2.c:409
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:415
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:768
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:631
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:761
u8 XGM2_getDebugMissedFrames(void)
Returns the number of missed frames since last startPlay command. Debug function to verify the drive...
Definition xgm2.c:994
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:686
u16 XGM2_getDebugFrameCounter(void)
Returns the internal frame counter (v-int process number). Debug function to verify the driver is wo...
Definition xgm2.c:960
void XGM2_playTrack(const u16 track)
Start playing the specified track (need to call XGM2_load(..) first)
Definition xgm2.c:333
u8 XGM2_isPlayingPCM(const u16 channel_mask)
Return play status of specified PCM channel.
Definition xgm2.c:506
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:676
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:792
void XGM2_load_FAR(const u8 *song, const u32 len)
Same as XGM2_load(..) except it supports access through bank switch.
Definition xgm2.c:328
void XGM2_stop(void)
Stop playing music (cannot be resumed).
Definition xgm2.c:421
void XGM2_setFMVolume(const u16 value)
Set the volume level for the FM music part.
Definition xgm2.c:864
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:925
bool XGM2_isPAL(const u8 *xgm2)
Returns TRUE if specified xgm2 use PAL timing.
Definition xgm2.c:885