sound & ds hardware
DESCRIPTION
Sound & DS Hardware. 학과 : 컴퓨터학과 학번 : 200897107 이름 : 이은정. Sound 포맷 형식. Raw 특수 효과 ( 레이저 소리 등 ) 에 좋다 . 하지만 음악을 위해서는 너무 많은 공간이 필요함 . Mod 음악을 재생하는데 효과적 . 왜냐하면 각각의 음악이 롬에서 매우 적은 공간을 차지하기 때문 . Raw 파일 생성. http://www.nch.com.au/switch/. Raw 함수설명. #include “ raw_file_name.h “ - PowerPoint PPT PresentationTRANSCRIPT
Sound & DS Hardware
학과 : 컴퓨터학과학번 : 200897107이름 : 이은정
Sound 포맷 형식 Raw 특수 효과 ( 레이저 소리 등 ) 에 좋다 . 하지만 음악을 위해서는 너무 많은 공간이 필요함 . Mod 음악을 재생하는데 효과적 . 왜냐하면 각각의 음악이 롬에서 매우 적은 공간을 차지하기 때문 .
Raw 파일 생성http://www.nch.com.au/switch/
Raw 함수설명 #include “raw_file_name.h“ PA_InitSound(); PA_PlaySimpleSound(channel, soundfile);
Raw 실행 코드 raw 파일이 생성되었으면 프로젝트의 data 디렉토리에 놓는다.
#include <PA9.h> // Include for PA_Lib#include "beethoven.h" // Include the sound (found in the data folder in .raw format - for saberoff.raw use saberoff.h) // Function: main()int main(int argc, char ** argv){
PA_Init(); // Initializes PA_LibPA_InitVBL(); // Initializes a standard VBLPA_InitText(0, 0);
PA_InitSound(); // Init the sound system
PA_OutputSimpleText(0, 6, 10, "Press A to play the sound");
// Infinite loop to keep the program runningwhile (1){ // Play the sound if A is pressed...if (Pad.Newpress.A) PA_PlaySimpleSound(0,beethoven);//here, too. Only saberoff
PA_WaitForVBL();}
return 1;
}
Mod 파일 생성 Mod 파일은 사용하기 좋다 . 쉽고 매우 작은 공간을 롬에서 차지한다 . 소리도 꽤 좋은 편이다 . 하지만 생성하기가 그리 쉽지는 않다 . 1) The Mod Archive2) Exotica 3) ModLand
Mod 함수 설명 #include "modfile_name.h" PA_InitSound(); PA_PlayMod(modfile_name);
Mod 실행 코드// Includes#include <PA9.h> // Include for PA_Lib#include "wood.h" // Include the mod file (the .mod file is in the data directory) // Function: main()int main(int argc, char ** argv){ PA_Init(); // PA Init...PA_InitVBL(); // VBL Init...
PA_InitSound(); // Sound Init, for the mod player...
PA_PlayMod(wood); // Play a given mod
while(1){ // Infinite loopPA_WaitForVBL();}
return 0;} // End of main()
Microphone 함수 설명 u8 MicData[100000]; PA_MicStartRecording(MicData, 100000); PA_MicReplay(0, MicData, 100000);
Microphone 실행 코드// Microphone example !
// Includes#include <PA9.h> // Include for PA_Lib
u8 MicData[100000]; // Array we will use to save the microphone...
// Function: main()int main(int argc, char ** argv){
PA_Init(); // Initializes PA_LibPA_InitVBL(); // Initializes a standard VBLPA_InitText(0, 0);
PA_InitSound(); // Init the sound system
PA_OutputSimpleText(0, 4, 9, "Press A to start recording");PA_OutputSimpleText(0, 4, 10, "Press B to play sound");
// Infinite loop to keep the program runningwhile (1){ // Record if A pressed... if (Pad.Newpress.A) PA_MicStartRecording(MicData, 100000); // Buffer, buffer length
// If B, replay recorded soundif(Pad.Newpress.B) PA_MicReplay(0, MicData, 100000); // Channel, buffer used, buffer length
PA_OutputText(0, 2, 12, "Mic Volume : %d ", PA_MicGetVol()); // Get mic volume, even if not recording
PA_WaitForVBL();}return 0;
} // End of main()
ModPlayer 함수 설명 PA_SoundChannelIsBusy(i);
ModPlayer 실행 코드// Play a simple mod !
// Includes#include <PA9.h> // Include for PA_Lib#include "modfile.h" // Include the mod file (the .mod file is in the data directory)
// Function: main()int main(int argc, char ** argv){
PA_Init(); // PA Init...PA_InitVBL(); // VBL Init...
PA_InitSound(); // Sound Init, for the mod player...PA_InitText(0, 0); PA_InitText(1, 0);
PA_PlayMod(modfile); // Play a given mod
PA_OutputText(0, 8, 10, "Playing Mod...");u8 i;
while(1){ // Infinite loop// See which channels are busyfor (i = 0; i < 16; i++) PA_OutputText(1, 0, i, "Channel %02d busy : %d ", i, PA_SoundChannelIsBusy(i)); // 0 for free, 1 for busy
PA_WaitForVBL();}
return 0;} // End of main()
ModVolume 함수 설명 PA_GetModVolume() PA_SetModVolume()
ModVolume 실행 코드// Play a simple mod !// Includes#include <PA9.h> // Include for PA_Lib#include "modfile.h" // Include the mod file (the .mod file is in the data directory)// Function: main()int main(int argc, char ** argv){
PA_Init(); // PA Init...PA_InitVBL(); // VBL Init...
PA_InitSound(); // Sound Init, for the mod player...PA_InitText(0, 0); PA_InitText(1, 0);
PA_PlayMod(modfile); // Play a given mod
PA_OutputText(0, 8, 10, "Playing Mod...");
while(1){ // Infinite loop
PA_OutputText(1, 6, 6, "Mod Volume : %d ", PA_GetModVolume()); PA_OutputText(1, 2, 7, "Move Stylus to change volume");
if(Stylus.Held) { PA_SetModVolume(Stylus.X >> 1);}
PA_WaitForVBL();}return 0;
} // End of main()
DS Hardware 기능 Date and Time User Info Pause on Lid Close Screen Lights Names and Subnames Change the Game Icon
Date_Time 함수 설명 PA_RTC.Day, PA_RTC.Month, PA_RTC.Year PA_RTC.Hour, PA_RTC.Minutes,
PA_RTC.Seconds
Date_Time 실행 코드/* Check out the date and the time*/
#include <PA9.h>// Main functionint main(void){// PAlib initPA_Init();PA_InitVBL();
// Initialise the background text functionPA_InitText(1, 0);// Main loopwhile(1){
// Day, Month, and YearPA_OutputText(1, 2, 10, "%02d/%02d/%02d", PA_RTC.Day, PA_RTC.Month, PA_RTC.Year);// And the time...PA_OutputText(1, 2, 12, "%02d:%02d %02d seconds", PA_RTC.Hour, PA_RTC.Minutes, PA_RTC.Seconds);PA_WaitForVBL();
}return 0;}
Userinfo 함수 설명 PA_UserInfo.Name, PA_UserInfo.BdayDay,
PA_UserInfo.BdayMonth PA_UserInfo.AlarmHour,
PA_UserInfo.AlarmMinute PA_UserInfo.Language PA_UserInfo.Message
Userinfo 실행 코드/* Check out the user infos...*/#include <PA9.h>// Main functionint main(void){// PAlib initPA_Init();PA_InitVBL();// Initialise the background text functionPA_InitText(1, 0);// Main loopwhile(1){
// User name, and birthday (Day/Month)PA_OutputText(1, 2, 10, "User name : %s, %02d/%02d", PA_UserInfo.Name, PA_UserInfo.BdayDay, PA_UserInfo.BdayMonth);// Alarm TimePA_OutputText(1, 2, 12, "Alarm : %02d:%02d", PA_UserInfo.AlarmHour, PA_UserInfo.AlarmMinute);// DS Language... 0 si japonese, 1 is english, 2 is french...PA_OutputText(1, 2, 14, "Language : %d", PA_UserInfo.Language);// Special messagePA_OutputText(1, 2, 16, "Message : %s", PA_UserInfo.Message);
// In Pa_OutputText, %s is for strings, %d for numbers, and %02d means 'write the number, and if has less than// 2 digits, complete with zeros... Example : 5 -> 05
PA_WaitForVBL();}return 0;}
Screenlight 함수 설명 (Pad.Newpress.A) PA_SetScreenLight(0, //
screen 1); // Turn on bottom light (Pad.Newpress.B) PA_SetScreenLight(0, 0); (Pad.Newpress.X) PA_SetScreenLight(1,
1);// Turn on top light (Pad.Newpress.Y) PA_SetScreenLight(1, 0);
Screenlight 실행 코드 // Includes #include <PA9.h> // Include for PA_Lib
// Function: main() int main(int argc, char ** argv) { PA_Init(); // Initializes PA_Lib PA_InitVBL(); // Initializes a standard VBL
// Infinite loop to keep the program running while (1) { if (Pad.Newpress.A) PA_SetScreenLight(0, // screen 1); // Turn on bottom light if (Pad.Newpress.B) PA_SetScreenLight(0, 0); if (Pad.Newpress.X) PA_SetScreenLight(1, 1);// Turn on top light if (Pad.Newpress.Y) PA_SetScreenLight(1, 0);
PA_WaitForVBL(); }
return 0; } // End of main()
Checklid 함수 설명 PA_CheckLid();
Checklid 실행 코드 /* This will be the shortest example ever ! It just turns of the scren when the lid is closed... Therefore, usable only on DS, duh... */
// Includes #include <PA9.h> // Include for PA_Lib
// Function: main() int main(int argc, char ** argv) { PA_Init(); // Initializes PA_Lib PA_InitVBL(); // Initializes a standard VBL
PA_SetBgPalCol(0, 0, PA_RGB(31, 0, 0)); // Set the background color to red, to check if on...
// Infinite loop to keep the program running while (1) { PA_CheckLid(); // Checks the lid, and pauses if closed... Returns 1 when it unpauses PA_WaitForVBL(); }
return 0; } // End of main()
Names and Subnames 함수 설명 TEXT1 := PAlib Project TEXT2 := using PAlib TEXT3 := www.palib.info
Change the Game Icon
The End