Modules/ndp/ndp player/Usage

From MSX Game Library

< Modules‎ | ndp/ndp player

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
   /* ... */
}