libdragon
Data Structures | Functions
ym64.c File Reference

Player for the .YM64 module format (Arkos Tracker 2) More...

Data Structures

struct  ym5header
 Header of a YM5 file. More...
 

Functions

void ym64player_open (ym64player_t *player, const char *fn, ym64player_songinfo_t *info)
 Open a YM64 file for playback. More...
 
int ym64player_num_channels (ym64player_t *player)
 Return the number of channels used in the mixer for playback. More...
 
void ym64player_play (ym64player_t *player, int first_ch)
 Start playback of a YM file. More...
 
void ym64player_stop (ym64player_t *player)
 Stop YM playback. More...
 
void ym64player_duration (ym64player_t *player, int *len, float *secs)
 Read the total duration the YM module. More...
 
void ym64player_tell (ym64player_t *player, int *pos, float *secs)
 Read the current position of the YM module. More...
 
bool ym64player_seek (ym64player_t *player, int pos)
 Seek to a specific position in the YM module. More...
 
void ym64player_close (ym64player_t *player)
 Close and deallocate the YM64 player.
 

Detailed Description

Player for the .YM64 module format (Arkos Tracker 2)


Data Structure Documentation

◆ ym5header

struct ym5header

Header of a YM5 file.

Data Fields
uint32_t nframes Number of audioframes.
uint32_t attrs Attributes (bit 0: interleaved format)
uint16_t ndigidrums Number of digital samples.
uint32_t chipfreq Frequency of the emulated chip.
uint16_t playfreq Playback frequency in audioframes per seconds (eg: 50)
uint32_t loop Audioframe where the loop starts.
uint16_t sizeext Extension (always 0)

Function Documentation

◆ ym64player_open()

void ym64player_open ( ym64player_t player,
const char *  fn,
ym64player_songinfo_t info 
)

Open a YM64 file for playback.

Parameters
[in]playerYM64 player to initialize
[in]fnFilename of the XM64 (with filesystem prefix, e.g. rom://).
[out]infoOptional structure to fill with information on the song (pass NULL if not needed)

◆ ym64player_num_channels()

int ym64player_num_channels ( ym64player_t player)

Return the number of channels used in the mixer for playback.

Depending on the AY emulator compile-time settings, this could be either 1 or 2 (mono or stereo). Notice that the YM64 currently mixes itself the 3 internal channels of the AY8910 chip, so only a final output stream is passed to the mixer.

Parameters
[in]playerYM64 player
Returns
Number of mixer channels.

◆ ym64player_play()

void ym64player_play ( ym64player_t player,
int  first_ch 
)

Start playback of a YM file.

Parameters
[in]playerYM64 player
[in]first_chFirst mixer channel to use for playback

◆ ym64player_stop()

void ym64player_stop ( ym64player_t player)

Stop YM playback.

The YM module will keep the current position. Use ym64player_play to continue playback.

◆ ym64player_duration()

void ym64player_duration ( ym64player_t player,
int *  len,
float *  secs 
)

Read the total duration the YM module.

The function returns the total duration of the YM module, in ticks (internal YM position) or seconds. You can pass NULL to information that you are not interested in receiving.

Parameters
[in]playerYM64 player
[out]lenTotal duration in ticks
[out]secsTotal duration in seconds

◆ ym64player_tell()

void ym64player_tell ( ym64player_t player,
int *  pos,
float *  secs 
)

Read the current position of the YM module.

The function returns the current position expressed in ticks (internal YM position), and also expressed as number of seconds. You can pass NULL to information that you are not interested in receiving.

Parameters
[in]playerYM64 player
[out]posCurrent position in ticks
[out]secsCurrent position in seconds

◆ ym64player_seek()

bool ym64player_seek ( ym64player_t player,
int  pos 
)

Seek to a specific position in the YM module.

The function seeks to a new absolute position expressed in ticks (internal YM position). Notice that it's not possible to seek in a YM64 file that has been compressed. audioconv64 compresses YM files by default.

Parameters
[in]playerYM64 player
[out]posAbsolute position in ticks
Returns
True if it was possible to seek, false if the file is compressed.