Exemplo n.º 1
0
void soundtest()
{


			tte_write("#{es}");

		tte_write("#{P:0,0}GBA Sound Test\n");
		tte_write("A song should now be playing.\n");
		tte_write("Pressing B will exit.\n");

		vid_vsync();
		key_poll();

		mmStart( MOD_SMACHOOSEAPLAYER, MM_PLAY_LOOP );

		while(key_is_up(KEY_B)){

			vid_vsync();

			mmFrame();

			key_poll();

		}

		mmStop();

}
Exemplo n.º 2
0
void DSGM_ResetSound(void) {
	mmStop();
	mmEffectCancelAll();
	
	if(DSGM_soundStreamInstance.sound) {
		mmUnload(DSGM_soundStreamInstance.sound->ID);
		DSGM_soundStreamInstance.sound->loaded = false;
	}
	
	int i;
	for(i = 0; i < DSGM_soundEffectInstanceCount; i++) {
		mmUnloadEffect(DSGM_soundEffectInstances[i].sound->ID - DSGM_soundStreamCount);
		DSGM_soundEffectInstances[i].sound->loaded = false;
	}
	
	DSGM_soundEffectInstanceCount = 0;
}
Exemplo n.º 3
0
// note: int execv(const char *path, char *const argv[]);
//       - where the array of strings is terminated with a null string
//       - i.e. this is a bit different for now
int execz(const char* filename, int argc, const char** argv) 
{
  struct stat st;
  char filePath[MAXPATHLEN * 2];
  int pathLen;
  const char* args[1];
  int i;

  if (stat (filename, &st) < 0) {
    return 1;
  }

  if (argc <= 0 || !argv) {
    // Construct a command line if we weren't supplied with one
    if (!getcwd (filePath, MAXPATHLEN)) {
      return 2;
    }
    pathLen = strlen (filePath);
    strcpy (filePath + pathLen, filename);
    args[0] = filePath;
    argv = args;
  }

  // shutdown sound subsystem
  // note: EffectCancelAll seems to fail to stop
  //       the current sample
  mmEffectCancelAll();
  mmStop();
  while (mmActive()) {
    swiWaitForVBlank();
  }

  // shutdown network subsystem
  Wifi_DisconnectAP();
  Wifi_DisableWifi();

  // wait a bit: race condition??
  for (i = 0 ; i < 42 ; i++) {
      swiWaitForVBlank();
  }
	
  return runNds (load_bin, load_bin_size, st.st_ino, false, true, argc, argv);
}
Exemplo n.º 4
0
// Program entrypoint
int main()
{	
	if (!mmIsARM7Loaded())
	{
		printf("Couldn't load Maxmod!\n");
		return 1;
	}

	// Init Maxmod with default settings (loading from FAR)
	mmInitDefaultFAR(hFar, "/soundbank.bin");
	
	FeOS_DirectMode();

	videoSetMode(MODE_0_2D);
	videoSetModeSub(0);
	vramSetBankA(VRAM_A_MAIN_SPRITE);

	// Initialize the sprite engine with 1D mapping 128 byte boundary
	// aand no external palette support
	oamInit(&oamMain, SpriteMapping_1D_32, false);

	int i;
	for (i = 0; i < 5; i ++)
	{
		// Allocate some space for the sprite graphics
		sprites[i].gfx = oamAllocateGfx(&oamMain, sprites[i].size, sprites[i].format);

		// Fill each sprite with a different index (2 pixels at a time)
		dmaFillHalfWords(((i+1) << 8) | (i+1), sprites[i].gfx, 32*32);
	}

	// Set indexes to different colours
	SPRITE_PALETTE[1] = RGB15(31,0,0);
	SPRITE_PALETTE[2] = RGB15(0,31,0);
	SPRITE_PALETTE[3] = RGB15(0,0,31);
	SPRITE_PALETTE[4] = RGB15(31,0,31);
	SPRITE_PALETTE[5] = RGB15(0,31,31);

	mmSetEventHandler(myEventHandler);
	mmLoad(MOD_EXAMPLE2);
	mmStart(MOD_EXAMPLE2, MM_PLAY_LOOP);

	for(;;)
	{
		swiWaitForVBlank();
		if (keysDown() & KEY_START)
			break;

		for (i = 0; i < 5; i ++)
		{
			// Constantly increase the sprite's y velocity
			sprites[i].dy += 1;
		
			// Update the sprite's y position with its y velocity
			sprites[i].y += sprites[i].dy;
		
			// Clamp the sprite's y position
			if (sprites[i].y<72) sprites[i].y = 72;
			if (sprites[i].y>96) sprites[i].y = 96;
		
			oamSet(&oamMain,                 // Main graphics engine context
			       i,                        // OAM index (0 to 127)  
			       sprites[i].x,             // X and Y pixel location of the sprite
			       sprites[i].y, 			
			       0,                        // Priority, lower renders last (on top)
			       sprites[i].paletteAlpha,  // Palette index 
			       sprites[i].size,
			       sprites[i].format,
			       sprites[i].gfx,           // Pointer to the loaded graphics
			       sprites[i].rotationIndex, // Sprite rotation data  
			       false,                    // Double the size when rotating?
			       false,                    // Hide the sprite?
			       false, false,             // VFlip, HFlip
			       false);                   // Apply mosaic
		}
	}

	mmStop();
	mmUnload(MOD_EXAMPLE2);
	mmUnloadSoundbank();

	FeOS_ConsoleMode();

	return 0;
}
Exemplo n.º 5
0
void Music::stop()
{
    mmStop();
}