#include <nds.h>
#include <stdio.h>
#include <stdlib.h>
#include "bgm_raw.h"
int main(void) {
	int i=0;
	soundEnable();
	consoleDemoInit();
	iprintf("\n    BGM : EXceed The Limit!\n\n  Special thanks composer GCHM\n");
	iprintf("     http://gchm-music.com/\n\n");
	// 様々なパターンで鳴らす
	iprintf(" A .. Play 24KHz/16bit/mono\n X .. Play 12KHz/16bit/mono\n");
	iprintf(" Y .. Play 48KHz/16bit/mono\n B .. soundKill() ALL channel\n");
	iprintf(" L .. soundEnable()\n R .. soundDisable()\n");
	// ループ
	while(1){
		scanKeys();
		switch(keysDown()){
			default:break;
			case KEY_A:
				soundPlaySample(bgm_raw,SoundFormat_16Bit,bgm_raw_size,24000,127,64,false,0); break;
			case KEY_X:
				soundPlaySample(bgm_raw,SoundFormat_16Bit,bgm_raw_size,12000,127,64,false,0); break;
			case KEY_Y:
				soundPlaySample(bgm_raw,SoundFormat_16Bit,bgm_raw_size,48000,127,64,false,0); break;
			case KEY_B: for(i=0;i<=15;i++) soundKill(i); break;
			case KEY_L: soundEnable();break;
			case KEY_R: soundDisable();break;
		}
		swiWaitForVBlank();
	}
	return 0;
}