Ejemplo n.º 1
0
void initSound()
{
	int i;
	for(i=0;i<NUMSFX;i++)
	{
		SFX[i].used=false;
	}

	soundEnable();
}
Ejemplo n.º 2
0
int main()
{
	soundEnable();
	channel = soundPlayPSG(DutyCycle_50, 10000, 127, 64);

	//calls the timerCallBack function 5 times per second.
	timerStart(0, ClockDivider_1024, TIMER_FREQ_1024(5), timerCallBack);

	waitfor(KEY_A);

	return 0;
}
Ejemplo n.º 3
0
void initSND()
{
    static double analog[] = { -1, -0.8667, -0.7334, -0.6, -0.4668, -0.3335, -0.2, -0.067, 0.0664, 0.2, 0.333, 0.4668, 0.6, 0.7334, 0.8667, 1  } ;
    int i;
    for (i=0; i<16; i++)
    {
        pcmVals[i] = analog[i]*0x70;
    }
    for (i=0; i<4; i++) {
        soundKill(sound[i]);
        chanOn = 0;
        chanVol[i] = 0;
        chanFreq[i] = 0;
        setSoundVolume(i);
    }
    srand(time(NULL));
    if (!soundDisabled)
        soundEnable();
}
Ejemplo n.º 4
0
int main(int argc, char **argv) {

	// Chargement de NitroFS / NitroFS loading
	NF_Set2D(0, 0);
	NF_Set2D(1, 0);	
	consoleDemoInit();
	iprintf("\n NitroFS init. Please wait.\n\n");
	iprintf(" Chargement de NitroFS. Veuillez patienter.\n\n");
	swiWaitForVBlank();
	iprintf("OK !\n\n");
	NF_SetRootFolder("NITROFS");	// Défini le dossier root comme celui de NitroFS

	// Moteur 2D / 2D Engine
	NF_Set2D(0, 0);	
	NF_Set2D(1, 0);

	soundEnable();
	
	// Les fonds / Backgrounds
	NF_InitTiledBgBuffers();	// buffer
	NF_InitTiledBgSys(0);		// haut / top
	NF_InitTiledBgSys(1);		// bas / bottom

	//Texte / Text
	NF_InitTextSys(0); //haut / top
	NF_InitTextSys(1); //bas / bottom

	// Buffers du son / Sound buffer
	NF_InitRawSoundBuffers();

	// Chargement de la police de caractère /  Loading font
	NF_LoadTextFont("fnt/default", "haut", 256, 256, 0);
	NF_LoadTextFont("fnt/default", "bas", 256, 256, 0);

	// Calque police et couleur/ Font layer and color
	NF_CreateTextLayer(0, 0, 0,	"haut");
	NF_CreateTextLayer(1, 0, 0,	"bas");
	NF_BgSetPalColor(0, 0, 1, 0, 31, 0);
	NF_BgSetPalColor(1, 0, 1, 0, 31, 0);
	
	//Vars
	touchPosition touch;
	u16 newpress;
	s16 x;
	s16 y;
	u8 beat = 0; //high 0 / low 1
	
	NF_ResetRawSoundBuffers();
	NF_ClearTextLayer(1, 0);
	NF_ClearTextLayer(0, 0);
	NF_WriteText(0, 0, 0, 1, "___  ____    ___  ____ ____ ___ ");
	NF_WriteText(0, 0, 0, 2, "|  \\ [__     |  \\ |__| |___  |  ");
	NF_WriteText(0, 0, 0, 3, "|__/ ___]    |__/ |  | |     |  ");
	NF_WriteText(0, 0, 25, 5, "1.0");
	NF_WriteText(0, 0, 0, 22, "Corenting (www.corenting.fr)");
	NF_UpdateTextLayers(); // Actualisation du texte
	NF_LoadTiledBg("bg/1", "1", 256, 256);	
	NF_CreateTiledBg(1, 3, "1");

	//Harder Better Faster Stronger
	while(1) {
		
		// Scan touches et tactile
		scanKeys();
		touchRead(&touch);
		newpress = keysDown();
		x = touch.px;
		y = touch.py ;
	
		if (newpress&&(x > 51)&&(y > 182)&&(x < 92)&&(y < 192)) {
			if (beat == 1) {
				beat = 0;
			}
			else {
				beat = 1;
			}
		}
		
		if(beat == 0) {
			NF_WriteText(1, 0, 7, 23, "High");
			NF_UpdateTextLayers(); // Actualisation du texte
			// Chargement des samples
			do {
			NF_ResetRawSoundBuffers();
			NF_LoadRawSound("sfx/workit1", 0, 16384, 0);
			NF_LoadRawSound("sfx/makeit1", 1, 16384, 0);
			NF_LoadRawSound("sfx/doit1", 2, 16384, 0);
			NF_LoadRawSound("sfx/makesus1", 3, 16384, 0);
			NF_LoadRawSound("sfx/harder1", 4, 16384, 0);
			NF_LoadRawSound("sfx/better1", 5, 16384, 0);
			NF_LoadRawSound("sfx/faster1", 6, 16384, 0);
			NF_LoadRawSound("sfx/stronger1", 7, 16384, 0);
			NF_LoadRawSound("sfx/morethan1", 8, 16384, 0);
			NF_LoadRawSound("sfx/hour1", 9, 16384, 0);
			NF_LoadRawSound("sfx/our1", 10, 16384, 0);
			NF_LoadRawSound("sfx/never1", 11, 16384, 0);
			NF_LoadRawSound("sfx/ever1", 12, 16384, 0);
			NF_LoadRawSound("sfx/after1", 13, 16384, 0);
			NF_LoadRawSound("sfx/workis1", 14, 16384, 0);
			NF_LoadRawSound("sfx/over1", 15, 16384, 0);
			} while (0==1);
		}
		if(beat == 1) {
			NF_WriteText(1, 0, 7, 23, "Low ");
			NF_UpdateTextLayers(); // Actualisation du texte
			do {
			NF_ResetRawSoundBuffers();
			NF_LoadRawSound("sfx/workit2", 0, 16384, 0);
			NF_LoadRawSound("sfx/makeit2", 1, 16384, 0);
			NF_LoadRawSound("sfx/doit2", 2, 16384, 0);
			NF_LoadRawSound("sfx/makesus2", 3, 16384, 0);
			NF_LoadRawSound("sfx/harder2", 4, 16384, 0);
			NF_LoadRawSound("sfx/better2", 5, 16384, 0);
			NF_LoadRawSound("sfx/faster2", 6, 16384, 0);
			NF_LoadRawSound("sfx/stronger2", 7, 16384, 0);
			NF_LoadRawSound("sfx/morethan2", 8, 16384, 0);
			NF_LoadRawSound("sfx/hour2", 9, 16384, 0);
			NF_LoadRawSound("sfx/our2", 10, 16384, 0);
			NF_LoadRawSound("sfx/never2", 11, 16384, 0);
			NF_LoadRawSound("sfx/ever2", 12, 16384, 0);
			NF_LoadRawSound("sfx/after2", 13, 16384, 0);
			NF_LoadRawSound("sfx/workis2", 14, 16384, 0);
			NF_LoadRawSound("sfx/over2", 15, 16384, 0);
			} while (0==1);
		}
		
		if (newpress&&(x > 0)&&(y > 0)&&(x < 58)&&(y < 35)) {
			NF_PlayRawSound(0, 127, 127, false, 0);
		}
		
		if (newpress&&(x >= 66)&&(y >= 0)&&(x < 123)&&(y < 35)) {
			NF_PlayRawSound(1, 127, 127, false, 0);
		}
		
		if (newpress&&(x >= 132)&&(y >= 0)&&(x < 187)&&(y < 35)) {
			NF_PlayRawSound(2, 127, 127, false, 0);
		}
		
		if (newpress&&(x >= 197)&&(y >= 0)&&(x < 255)&&(y < 35)) {
			NF_PlayRawSound(3, 127, 127, false, 0);
		}
		
		if (newpress&&(x >= 0)&&(y >= 45)&&(x < 58)&&(y < 80)) {
			NF_PlayRawSound(4, 127, 127, false, 0);
		}
		
		if (newpress&&(x >= 67)&&(y >= 45)&&(x < 122)&&(y < 80)) {
			NF_PlayRawSound(5, 127, 127, false, 0);
		}		
		
		if (newpress&&(x >= 133)&&(y >= 45)&&(x < 189)&&(y < 80)) {
			NF_PlayRawSound(6, 127, 127, false, 0);
		}
		
		if (newpress&&(x >= 197)&&(y >= 45)&&(x < 252)&&(y < 80)) {
			NF_PlayRawSound(7, 127, 127, false, 0);
		}		

		if (newpress&&(x >= 0)&&(y >= 89)&&(x < 58)&&(y < 125)) {
			NF_PlayRawSound(8, 127, 127, false, 0);
		}	

		if (newpress&&(x >= 67)&&(y >= 89)&&(x < 122)&&(y < 125)) {
			NF_PlayRawSound(9, 127, 127, false, 0);
		}

		if (newpress&&(x >= 132)&&(y >= 89)&&(x < 190)&&(y < 125)) {
			NF_PlayRawSound(10, 127, 127, false, 0);
		}	
		
		if (newpress&&(x >= 198)&&(y >= 89)&&(x < 253)&&(y < 125)) {
			NF_PlayRawSound(11, 127, 127, false, 0);
		}

		if (newpress&&(x >= 0)&&(y >= 132)&&(x < 57)&&(y < 168)) {
			NF_PlayRawSound(12, 127, 127, false, 0);
		}

		if (newpress&&(x >= 66)&&(y >= 132)&&(x < 123)&&(y < 168)) {
			NF_PlayRawSound(13, 127, 127, false, 0);
		}

		if (newpress&&(x >= 132)&&(y >= 132)&&(x < 187)&&(y < 168)) {
			NF_PlayRawSound(14, 127, 127, false, 0);
		}

		if (newpress&&(x >= 197)&&(y >= 132)&&(x < 253)&&(y < 168)) {
			NF_PlayRawSound(15, 127, 127, false, 0);
		}	
		
		
		swiWaitForVBlank();
	}
	

	return 0; 

}