libmsx
C library for MSX
Loading...
Searching...
No Matches
Open NDP song data, and set it in the driver.
+ Collaboration diagram for Open NDP song data, and set it in the driver.:

Data Structures

struct  NDPFile
 MSX Container of an opened NDP song data. More...
 

Typedefs

typedef struct NDPFile NDPFile
 MSX Container of an opened NDP song data.
 

Functions

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_bmem (NDPFile *ndp, bmemptr_t loc, uint32_t size)
 MSX Open NDP song data stored in banked memory (MegaROM).
 
int NDP_open_resource (NDPFile *ndp, const char *path)
 MSX Open NDP file stored as named resources in banked memory (MegaROM).
 
bool NDP_set_bgm (NDPFile *ndp)
 MSX Setup the NDP song data to NDP sound driver.
 
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.
 
bool NDP_has_metadata (NDPFile *ndp)
 MSX Returns whether or not there is metadata in the NDP song data.
 
size_t NDP_read_metadata (NDPFile *ndp, uint8_t *buf, size_t buf_size)
 MSX Read metadata stored in NDP song data.
 

Detailed Description


Data Structure Documentation

◆ NDPFile

struct NDPFile

MSX Container of an opened NDP song data.

Definition at line 188 of file NDP.h.

+ Collaboration diagram for NDPFile:
Data Fields
MemFile mf

Typedef Documentation

◆ NDPFile

typedef struct NDPFile NDPFile

MSX Container of an opened NDP song data.

Function Documentation

◆ NDP_open_mem()

int NDP_open_mem ( NDPFile * ndp,
const uint8_t * loc,
size_t size )

MSX Open NDP song data stored in ROM / RAM.

Parameters
ndpPointer to a NDPFile to be initialized.
locLocation of the NDP song data.
sizeSize in bytes.
Returns
Number of songs contained in the NDP file.

◆ NDP_open_bmem()

int NDP_open_bmem ( NDPFile * ndp,
bmemptr_t loc,
uint32_t size )

MSX Open NDP song data stored in banked memory (MegaROM).

Parameters
ndpPointer to a NDPFile to be initialized.
locLocation of the NDP song data.
sizeSize in bytes.
Returns
Number of songs contained in the NDP file.

◆ NDP_open_resource()

int NDP_open_resource ( NDPFile * ndp,
const char * path )

MSX Open NDP file stored as named resources in banked memory (MegaROM).

Parameters
ndpPointer to a NDPFile to be initialized.
pathPath/File name (*.NDP) of the resource.
Returns
Number of songs contained in the NDP file.

◆ NDP_set_bgm()

bool NDP_set_bgm ( NDPFile * ndp)

MSX Setup the NDP song data to NDP sound driver.

If the song data body is in a contiguous area of the current CPU address space or within the 16KiB segment boundaries of MegaROM, set the NDP sound driver to play directly from that area. Otherwise, fails.

Parameters
ndpPointer to the NDPFile opened by NDP_open_*().
Returns
true on success, false otherwise.

◆ NDP_load_bgm()

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.

If the specified RAM buffer size is large enough, load the song into the buffer and set the NDP sound driver to play from the buffer. Otherwise, fails.

Parameters
ndpPointer to the NDPFile opened by NDP_open_*().
bufPointer to RAM buffer.
buf_sizeSize of the buffer.
Returns
true on success, false otherwise.

◆ NDP_has_metadata()

bool NDP_has_metadata ( NDPFile * ndp)

MSX Returns whether or not there is metadata in the NDP song data.

Parameters
ndpPointer to NDPFile opened by NDP_open_*().
Returns
true if metadata is present, false otherwise.

◆ NDP_read_metadata()

size_t NDP_read_metadata ( NDPFile * ndp,
uint8_t * buf,
size_t buf_size )

MSX Read metadata stored in NDP song data.

If there is metadata in the NDP song data, it is read and written to the specified buffer. If successful, the buffer contents will be a concatenation of five C strings (zero-terminated Shift-JIS strings).

Each of the five string values corresponds to the following information in order

  • Title of the song
  • Composer
  • Arranger
  • Programmer (NDP music data creator)
  • Memo (remarks)

If the buffer size is too short, some items in the buffer will be too short or will be invalid strings.

Parameters
ndpPointer to NDPFile opened by NDP_open_*().
bufPointer to the buffer into which the metadata will be read.
buf_sizeSize of the buffer.
Returns
Size read into the buffer.