Ghostのブログっ

ブログの説明→特になし

Makefileを色々いじってみたら

やった!!buildできた!!

f:id:iwannabethetabasuko:20150401203115j:plain

 

 

あのさぁ…

できてねぇじゃねぇか!(憤怒)

なにが悪いのかなぁ

 

 

おま毛

 

f:id:iwannabethetabasuko:20150401203226j:plain

あひぁでggったら一番上にきたよ

エロサイトに勝った!!

やったねあひぁさん!!

PAlibのサウンド関係

BGMつけようと思ったら容量が大きすぎてできないだぁ!?

ふざけるな!!(声だけ迫真)

 

で調べてみたらAS_libというものがありまして

これをつかればmp3再生もできるようで

main.cのコード

/*

Advanced Sound Library (ASlib)
------------------------------

file : main.c
author : Lasorsa Yohan (Noda)
description : ARM9 example program

history :

28/11/2007 - v1.0
= Original release

*/

// use libfat with a "test.mp3" file at the root, else load default mp3 from ram
//#define USE_FAT_TEST

#include <nds.h>
#include <stdio.h>
#include <fat.h>

#include "as_lib9.h"

// the sounds
#include "test.h"
#include "sfxa.h"
#include "sfxb.h"


int main(void) {

touchPosition touchXY;
int i, rate = 0, newrate = 0;
bool mp3_mode = true, autopan = false;
u8 lastsfx = 0, usage = 0, pan = 0, fx_mode = AS_SURROUND;

// set up the display
powerON(POWER_ALL_2D);

videoSetMode(0); // not using the main screen
videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); // sub bg 0 will be used to print text
vramSetBankC(VRAM_C_SUB_BG);

SUB_BG0_CR = BG_MAP_BASE(31);
BG_PALETTE_SUB[255] = RGB15(31,31,31); // font will be rendered with color 255

consoleInitDefault*1 {
iprintf("Fat init error !!!\n");
return 1;
}
#endif

// init the ASlib
AS_Init(AS_MODE_MP3 | AS_MODE_SURROUND | AS_MODE_16CH);

// set default sound settings
AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND);

while(1) {

consoleClear();
iprintf(" ASlib example - by Noda\n");
iprintf(" -----------------------\n\n");

// get controls state
scanKeys();
touchXY = touchReadXY();

if(mp3_mode) {

// show some infos
iprintf("\x1b[3;0H MP3 Testing mode\n\n\n");
iprintf("A: play MP3 B: pause MP3\n\n");
iprintf("X: stop MP3 Y: surround ON/OFF\n");
iprintf("Stylus : < > pan ^ v pitch\n\n");
iprintf("--------------------------------\n");
iprintf("\x1b[22;0H [press select for SFX mode]\n");

// show sample rate & panning
iprintf("\x1b[14;0HSample rate : %i pan : %i \n", newrate, IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.pan);

// show surround status
iprintf("\x1b[16;0HSurround : %s\n", (IPC_Sound->mp3.delay ? "on " : "off"));
iprintf("(restart play to take effect)");

// show playback status
iprintf("\x1b[19;0HMP3 Status : "); // clear status field
switch (AS_GetMP3Status()) {
case (MP3ST_STOPPED) : iprintf("stopped "); break;
case (MP3ST_PAUSED) : iprintf("paused "); break;
case (MP3ST_PLAYING) : iprintf("playing "); break;
case (MP3ST_OUT_OF_DATA) : iprintf("out of data "); break;
case (MP3ST_DECODE_ERROR) : iprintf("decoding error"); break;
}

// controls
if (keysDown() & KEY_A) {

if (AS_GetMP3Status() & MP3ST_PAUSED) {

AS_MP3Unpause();

} else {

#ifdef USE_FAT_TEST
AS_MP3StreamPlay("test.mp3");
#else
AS_MP3DirectPlay*2 {

newrate = (rate + rate/4) - (rate * touchXY.py / 96 / 4);
AS_SetMP3Rate(newrate);
AS_SetMP3Pan(touchXY.px / 2);
}
// set sample rate
if(rate == 0 && IPC_Sound->mp3.rate && (AS_GetMP3Status() & MP3ST_PLAYING)) {

rate = IPC_Sound->mp3.rate;
newrate = rate;
}

} else {

// show some infos
iprintf("\x1b[3;0H SFX Testing mode\n\n\n");
iprintf("A: play SFX_A B: play SFX_B\n\n");
iprintf("X: autopan ON/OFF Y: FX mode\n\n");
iprintf("--------------------------------\n");
iprintf("\x1b[22;0H [press select for MP3 mode]\n");

// show channels usage, autopan status & panning of last sound played
iprintf("\x1b[12;0HChan usage : %i / %i \n\n", usage, IPC_Sound->num_chan - 1);
iprintf("Autopan : %s\n\n", (autopan ? "on " : "off"));
iprintf("Last SFX pan : %i \n", IPC_Sound->chan[lastsfx].snd.pan);

// show fx mode
iprintf("\x1b[18;0HSFX effect : %s\n", (fx_mode == AS_SURROUND ? "surround" : ( fx_mode == AS_REVERB ? "reverb " : "no fx ")));
iprintf("(start new SFX to take effect)");

// controls
if (keysDown() & KEY_A) {

lastsfx = AS_SoundQuickPlay(sfxa);
}
if (keysDown() & KEY_B) {

lastsfx = AS_SoundQuickPlay(sfxb);
}
if (keysDown() & KEY_X) {
autopan = !autopan;
}
if (keysDown() & KEY_Y) {

if(fx_mode == AS_SURROUND)
fx_mode = AS_REVERB;
else if(fx_mode == AS_REVERB)
fx_mode = AS_NO_DELAY;
else
fx_mode = AS_SURROUND;

// set new default sound settings
AS_SetDefaultSettings(AS_PCM_8BIT, 11025, fx_mode);
}

// autopan
if(autopan)
AS_SetSoundPan(lastsfx, (++pan > 127 ? 255 - pan : pan));

// get the number of busy channels
usage = 0;
for(i = 1; i < IPC_Sound->num_chan; i++)
if(IPC_Sound->chan[i].busy)
usage++;

}

// switch testing mode
if *3 {

if(mp3_mode)
AS_MP3Stop();

mp3_mode = !mp3_mode;
}

swiWaitForVBlank();
}

return 0;
}

 

 

(´・_・`)

(´・_・`)(´・_・`)(´・_・`)(´・_・`)(´・_・`)(´・_・`)(´・_・`)(´・_・`)(´・_・`)(´・_・`)(´・_・`)(´・_・`)(´・_・`)(´・_・`)

 

わからん!!

次回少しずつ読み解いてみまする(´・_・`)

*1:u16*)SCREEN_BASE_BLOCK_SUB(31), (u16*)CHAR_BASE_BLOCK_SUB(0), 16);

// init the IRQ
irqInit();
irqEnable(IRQ_VBLANK);
irqSet(IRQ_VBLANK, AS_SoundVBL); // needed for mp3 streaming

#ifdef USE_FAT_TEST
// init libfat
if(!fatInitDefault(

*2:u8*)test, (u32)test_size);
#endif
AS_SetMP3Loop(true);
rate = 0;
newrate = 0;
}
}
if (keysDown() & KEY_B) {

AS_MP3Pause();
}
if (keysDown() & KEY_X) {

AS_MP3Stop();
}
if (keysDown() & KEY_Y) {

if(IPC_Sound->mp3.delay)
AS_SetMP3Delay(AS_NO_DELAY);
else
AS_SetMP3Delay(AS_SURROUND);
}

// change panning & sample rate using the stylus
if((keysHeld() & KEY_TOUCH) && rate && (AS_GetMP3Status() & MP3ST_PLAYING

*3:keysDown() & KEY_SELECT