Modules/ndp/ndp player
From MSX Game Library
< Modules
The ndp/ndp_player module lets you play music in NDP format (PSG only).
The NDP format is a music format that allows users to create very high-quality music on the MSX. It was created by Naturo2413, who also provided an MML compiler for creating music in the NDP format, as well as an assembly-language player for playing it back on a real MSX.
MSXgl includes version 1.07 of the replayer, adapted for a C program under SDCC.
Original assembly source and documentation of the NPD replayer can be found on the site https://ndp.squares.net/web.
Usage
To use this module, include "ndp/ndp_player.h" in your source code, and add "ndp/ndp_player" to the modules list (LibModules) in your project's configuration file (project_config.js).
Before using any functions of this module, you must call NDP_Initialize() first.
Music
You can play back music generated with the NDP editor (the music is created using the MML language). The editor is currently only available in Japanese.
MSXgl use .NDP binary file data. It can be generated from the editor pressing ALT+F (ファイル) then ALT+B (名前を付けて曲データをBSAVE形式で保存).
This binary file include a 7 bytes header used by BASIC's BSAVE/BLOAD instructions. You have to either cut this header or just pass the starting address of binary data offset by 7 bytes.
Example:#include "mymusic.h" // NDP file converted to .H file using MSXbin
void main()
{
/* ... */
NDP_SetMusicData(g_MusicData); // or g_MusicData+7 if data include header
NDP_Play();
/* ... */
}
SFX
For sound effects, you have to export .NDS file from the NDP editor. It can be generated from the editor pressing ALT+F (ファイル) then ALT+S. Like .NDP files, .NDS files contain the 7-byte header that must be removed or skipped.
Frist, you must call the NDP_SetSFXData() with the address of the NDS sound bank. They you can play an sound using its index into the bank (from 0 to NDP_GetSFXNumber()-1).
Example:#include "mysoundbank.h" // NDS file converted to .H file using MSXbin
void main()
{
/* ... */
NDP_SetSFXData(g_SFXData); // or g_SFXData+7 if data include header
NDP_PlaySFX(0); // play first sound
/* ... */
}
Samples
See module use cases in the sample programs:
Settings
Dependencies
Dependency on other modules: None
Documentation