libmsx
C library for MSX
Loading...
Searching...
No Matches
NDP.h
Go to the documentation of this file.
1// -*- coding: utf-8-unix -*-
2/*
3 * Copyright (c) 2021-2025 Daishi Mori (mori0091)
4 *
5 * This software is released under the MIT License.\n
6 * See https://github.com/mori0091/libmsx/blob/main/LICENSE
7 *
8 * GitHub libmsx project\n
9 * https://github.com/mori0091/libmsx
10 */
17#ifndef NDP_H_
18#define NDP_H_
19
20#include <memfile.h>
21
53void NDP_init(void);
54
69uint16_t NDP_version(void);
70
80void NDP_play(void);
81
82#if defined(LIBMSX_MEGAROM)
83/*
84 * An alternative version of `NDP_play()` that allows direct playback of song
85 * data in MegaROM.
86 */
87void NDP_play_bmem(void);
88#define NDP_play NDP_play_bmem
89#endif
90
96void NDP_start(void);
97
98#if defined(LIBMSX_MEGAROM)
99/*
100 * An alternative version of `NDP_start()` that allows direct playback of song
101 * data in MegaROM.
102 */
103void NDP_start_bmem(void);
104#define NDP_start NDP_start_bmem
105#endif
106
110void NDP_pause(void);
116bool NDP_is_paused(void);
117
123void NDP_stop(void);
124
130void NDP_set_volume(uint8_t vol);
131
137void NDP_fadeout(uint8_t wait);
138
144void NDP_fadein(uint8_t wait);
145
151bool NDP_is_playing(void);
152
163
174
177// ----------------------------------------------------------------------
188typedef struct NDPFile {
191
200int NDP_open_mem(NDPFile * ndp, const uint8_t * loc, size_t size);
201
210int NDP_open_bmem(NDPFile * ndp, bmemptr_t loc, uint32_t size);
211
219int NDP_open_resource(NDPFile * ndp, const char * path);
220
233
247bool NDP_load_bgm(NDPFile * ndp, uint8_t * buf, size_t buf_size);
248
257
282size_t NDP_read_metadata(NDPFile * ndp, uint8_t * buf, size_t buf_size);
283
286#endif // NDP_H_
uint32_t bmemptr_t
Type of an address of banked memory.
Definition bmem.h:75
void NDP_fadein(uint8_t wait)
MSX Fade-in and start music.
void NDP_init(void)
MSX Initialize the NDP sound driver.
uint16_t NDP_version(void)
MSX Return the version code of the NDP sound driver.
void NDP_start(void)
MSX Start / Resume music.
bool NDP_is_playing(void)
MSX Return whether BGM is playing or not.
uint8_t NDP_get_loop_counter(void)
MSX Return the loop counter value.
void NDP_stop(void)
MSX Stop music.
void NDP_set_volume(uint8_t vol)
MSX Set maximum main-volume.
void NDP_fadeout(uint8_t wait)
MSX Fade-out and stop music.
bool NDP_is_paused(void)
MSX Return whether paused or not.
void NDP_play(void)
MSX Main routine of the NDP sound driver.
void NDP_pause(void)
MSX Pause music.
uint8_t NDP_get_track_status(void)
MSX Return status for each tracks.
MemFile mf
Definition NDP.h:189
bool NDP_set_bgm(NDPFile *ndp)
MSX Setup the NDP song data to NDP sound driver.
size_t NDP_read_metadata(NDPFile *ndp, uint8_t *buf, size_t buf_size)
MSX Read metadata stored in NDP song data.
bool NDP_load_bgm(NDPFile *ndp, uint8_t *buf, size_t buf_size)
MSX Load and setup the NDP song data to NDP sound driver.
struct NDPFile NDPFile
MSX Container of an opened NDP song data.
int NDP_open_mem(NDPFile *ndp, const uint8_t *loc, size_t size)
MSX Open NDP song data stored in ROM / RAM.
int NDP_open_resource(NDPFile *ndp, const char *path)
MSX Open NDP file stored as named resources in banked memory (MegaROM).
bool NDP_has_metadata(NDPFile *ndp)
MSX Returns whether or not there is metadata in the NDP song data.
int NDP_open_bmem(NDPFile *ndp, bmemptr_t loc, uint32_t size)
MSX Open NDP song data stored in banked memory (MegaROM).
MSX Container of an opened NDP song data.
Definition NDP.h:188
Stream interface for ROM / RAM / MegaROM.
Internal structure of MemFile type.