LA0 decoder is a decoder for the libmsx audio replayer.
LA0 decoder supports all functionality of the libmsx audio replayer.
#include <stdio.h>
uint8_t song_number = 255;
uint8_t number_of_songs;
uint8_t number_of_sfx;
uint8_t pressed;
uint8_t clicked;
void show_vsync_freq(void) {
}
void show_player_freq(void) {
}
void show_bgm_info(void) {
printf(" BGM:%dHz (#%d/%d) ",
(int)song_number+1,
(int)number_of_songs);
show_player_freq();
}
void increase_player_freq(void) {
if (Hz < 240) {
show_player_freq();
}
}
void decrease_player_freq(void) {
if (10 < Hz) {
show_player_freq();
}
}
void next_song(void) {
if (song_number < number_of_songs - 1) {
song_number++;
}
else {
song_number = 0;
}
show_bgm_info();
}
void prev_song(void) {
if (0 < song_number) {
song_number--;
} else {
song_number = number_of_songs - 1;
}
show_bgm_info();
}
void show_psg_register_values(void) {
for (uint8_t i = 0; i < 14; ++i) {
}
}
void show_psg_registers(void) {
for (uint8_t i = 0; i < 14; ++i) {
printf("R#%02d\n", (int)i);
}
show_psg_register_values();
}
void update_joypad_state(void) {
clicked = pressed & ~joy;
pressed = joy;
}
static void play(void) {
}
void main(void) {
print(
" LEFT/RIGHT Select BGM\n");
print(
" UP/DOWN Player Freq.\n");
print(
" SPACE Sound effects\n");
show_vsync_freq();
show_player_freq();
show_psg_registers();
for (;;) {
show_psg_register_values();
next_song();
}
}
next_song();
}
update_joypad_state();
if (number_of_sfx) {
}
}
next_song();
}
prev_song();
}
increase_player_freq();
}
decrease_player_freq();
}
}
}
The libmsx audio replayer.
Unified sound-chip buffer of the libmsx audio replayer.
uint8_t audio_buf_cache[256]
The latest value of each command.
int8_t audio_efx_amp_get_fade(void)
MSX Return the status of fade-in/out.
void audio_efx_amp_fadeout(uint8_t ticks)
MSX Decrease the main volume level by one for each specified period of time.
void audio_efx_amp_set_volume(uint8_t volume)
MSX Sets the main volume level to the AMP effector.
void audio_efx_amp(void)
MSX The AMP effector for the libmsx audio replayer.
void audio_set_repeat(bool repeat)
MSX Turn on/off the auto-repeat of the BGM.
void audio_start(void)
MSX Start / Resume music.
uint8_t audio_get_bgm_frequency(void)
MSX Return replayer frequency of the background music.
bool audio_is_playing_bgm(void)
MSX Return whether BGM is playing or not.
void audio_set_bgm_frequency(uint8_t freq)
MSX Force replayer frequency of the background music.
void audio_stop(void)
MSX Stop music.
void audio_init(void)
MSX Initialize the libmsx audio replayer.
void audio_play(void)
MSX Main routine of the libmsx audio replayer.
uint8_t msx_get_vsync_frequency(void)
MSX Returns VSYNC frequency in Hz.
#define color(fg, bg, border)
MSX Set foreground, background, and border color.
#define locate(x, y)
MSX Set cursor position.
#define cls()
MSX Clear the screen and move the cursor to the top left corner.
void print(const char *str)
MSX Print string on the screen.
void printx(uint16_t x)
MSX Print unsigned integer in hexadecimal on the screen.
void await_vsync(void)
MSX Waits for next VSYNC interrupt.
void set_vsync_handler(void(*handler)(void))
MSX Register user defined VSYNC interrupt handler.
uint16_t la0_get_bgm_total_samples(void)
MSX Return the total number of BGM samples.
uint8_t la0_get_bgm_frequency(void)
MSX Return default frequency of the current background music.
uint16_t la0_get_bgm_loop_samples(void)
MSX Return the number of samples in the loop portion of BGM.
uint8_t la0_get_bgm_loop_counter(void)
MSX Return the loop counter value.
int la0_open_resource(MemFile *mf, const char *path)
MSX Open LA0 file stored as named resources in banked memory (MegaROM).
void la0_set_sfx(uint8_t idx, MemFile *mf)
MSX Set a song in the LA0 file to the LA0 audio decoder, as sound effects (SFX).
void la0_set_bgm(uint8_t idx, MemFile *mf)
MSX Set a song in the LA0 file to the LA0 audio decoder, as background music (BGM).
void screen1(void)
MSX SCREEN 1: WIDTH 32 (GRAPHIC 1 mode).
The libmsx audio format 0 (LA0) decoder.
Internal structure of MemFile type.
Using #include <msx.h> includes almost all C header files in libmsx, for ease to use.
SCREEN mode initialization function like MSX-BASIC.
Utility functions for text ouput.
static volatile uint16_t JIFFY
MSX Free-running counter that counts up every VSYNC interrupts.