Example #1
0
void MusicManager::loadCustomSounds(std::string episodePath, std::string levelCustomPath)
{
    initArrays();
    loadSounds(defaultSndINI, PGE_SDL_Manager::appPath);
    loadSounds(episodePath+"\\sounds.ini", episodePath);
    if(!levelCustomPath.empty())
        loadSounds(levelCustomPath+"\\sounds.ini", levelCustomPath);
    loadMusics(defaultMusINI, PGE_SDL_Manager::appPath);
    loadMusics(episodePath+"\\music.ini", episodePath);
    if(!levelCustomPath.empty())
        loadMusics(levelCustomPath+"\\music.ini", levelCustomPath);
    rebuildSoundCache();
}
Example #2
0
void Item::load(const Aurora::GFF3Struct &instance, const Aurora::GFF3Struct *blueprint) {
	// UTI def has a baseitem (index into baseitem.2da, determines equippable slots, model type)
	// armour is 16, modeltype 3
	// can look up armorpart_bodypart id
	// them use that to construct model names

	// General properties

	if (blueprint)
		loadProperties(*blueprint); // Blueprint
	loadProperties(instance);    // Instance


	// Specialized object properties

	// if (blueprint)
	// 	loadObject(*blueprint); // Blueprint
	// loadObject(instance);    // Instance

	// TODO:
	//  baseitem -- needed for inventory UI interactions
	//  stacksize -- used by inventory UI

	// Appearance

	// if (_appearanceID == Aurora::kFieldIDInvalid)
		// throw Common::Exception("Item object without an appearance");

	// loadAppearance();
	loadSounds();
}
Example #3
0
/**
 * Initialise audio.
 */
void openAudio () {

	SDL_AudioSpec asDesired;

#ifdef USE_MODPLUG
	musicFile = NULL;
#endif


	// Set up SDL audio

	asDesired.freq = SOUND_FREQ;
	asDesired.format = AUDIO_S16;
	asDesired.channels = 2;
#if defined(GP2X)
	asDesired.samples = 512;
#else
	asDesired.samples = 2048;
#endif
	asDesired.callback = audioCallback;
	asDesired.userdata = NULL;

	if (SDL_OpenAudio(&asDesired, &audioSpec) < 0)
		logError("Unable to open audio", SDL_GetError());


	// Load sounds

	if (loadSounds(F_SOUNDS) != E_NONE) sounds = NULL;

	// Start audio for sfx to work
	SDL_PauseAudio(0);
	return;

}
Example #4
0
void MusicManager::resetSoundsToDefault()
{
    initArrays();
    loadSounds(defaultSndINI, PGE_SDL_Manager::appPath);
    loadMusics(defaultMusINI, PGE_SDL_Manager::appPath);
    rebuildSoundCache();
}
Example #5
0
/***** init a new flap *****/
void initFlap(Main *main, Wind *wind, Extf *extf, int *flap, int *max)
{
    *max += 1;
    *flap = *max - 1;
    extf->newFlap = 0;
    
    loadBackground(&main[*max - 1], &*wind, &*flap);
    
    initVariables(&main[*max - 1]);
    
    loadTimeText(&main[*max - 1], &*wind);
    
    loadSounds(&main[*max - 1], &*flap);
    
    initTextString(&main[*max - 1]);

    initBoxes(&main[*max - 1]);

    initMiniTimer(&main[*max - 1], &*wind, &*flap);

    loadShade(&main[*max - 1], &*wind, &*flap);

    loadChooseSound(&main[*max - 1], &*wind, &*flap);

    loadBoxPics(&main[*max - 1], &*wind, &*flap);

    loadShadePics(&main[*max - 1], &*wind, &*flap);

    initMiniTimerS(&main[*max - 1], &*wind, &*flap);
}
Example #6
0
void SoundManager::Init()
{

	m_playing.playing = false;


	s_playing.playing = false;


	this->soundpath = new char*[MAX_SOUNDS];

	this->musicpath = new char*[MAX_MUSIC];


	this->m_sounds = new std::vector<Sound*>;


	this->m_music = new std::vector<Music*> ;



	loadSounds(this->soundpath);


	loadMusic(this->musicpath);

}
Example #7
0
void initSound() {
  int audio_rate;
  Uint16 audio_format;
  int audio_channels;
  int audio_buffers;

  if ( SDL_InitSubSystem(SDL_INIT_AUDIO) < 0 ) {
    fprintf(stderr, "Unable to initialize SDL_AUDIO: %s\n", SDL_GetError());
    return;
  }

  audio_rate = 44100;
  audio_format = AUDIO_S16;
  audio_channels = 1;
  audio_buffers = 4096;
  
  if (Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) < 0) {
    fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
    return;
  } else {
    Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels);
  }

  useAudio = 1;
  loadSounds();
}
Example #8
0
/**
 * Powers can cause new enemies to spawn
 * Check PowerManager for any new queued enemies
 */
void EnemyManager::handleSpawn() {
	
	EnemySpawn espawn;
	
	while (!powers->enemies.empty()) {
		espawn = powers->enemies.front();		
		powers->enemies.pop();	

		enemies[enemy_count] = new Enemy(powers, map);
		enemies[enemy_count]->stats.pos.x = espawn.pos.x;
		enemies[enemy_count]->stats.pos.y = espawn.pos.y;
		enemies[enemy_count]->stats.direction = espawn.direction;
		enemies[enemy_count]->stats.load("enemies/" + espawn.type + ".txt");
		if (enemies[enemy_count]->stats.animations != "") {
			// load the animation file if specified
			enemies[enemy_count]->loadAnimations("animations/" + enemies[enemy_count]->stats.animations + ".txt");
		}
		else {
			cout << "Warning: no animation file specified for entity: " << espawn.type << endl;
		}
		loadGraphics(enemies[enemy_count]->stats.gfx_prefix);
		loadSounds(enemies[enemy_count]->stats.sfx_prefix);
		
		// special animation state for spawning enemies
		enemies[enemy_count]->stats.cur_state = ENEMY_SPAWN;
		enemy_count++;	
	}
}
Example #9
0
bool CResources::Load ()
{
	er.report(LOG_INFO, _("%s: Loading resources ...\n"), AT);

	if (!LoadPcx())
	{
		return false;
	}

	CAliReader ali;

	if (!LoadAli(ali))
	{
		return false;
	}

	if (!LoadAni(ali))
	{
		return false;
	}

	SetupAni();

	if(!loadSounds())
	{
		return false;
	}

	// All ok
	m_loaded = true;
	return m_loaded;
}
Example #10
0
void Situated::load(const Aurora::GFF3Struct &instance, const Aurora::GFF3Struct *blueprint) {
	// General properties

	if (blueprint)
		loadProperties(*blueprint); // Blueprint
	loadProperties(instance);    // Instance


	// Specialized object properties

	if (blueprint)
		loadObject(*blueprint); // Blueprint
	loadObject(instance);    // Instance


	// Appearance

	if (_appearanceID == Aurora::kFieldIDInvalid)
		throw Common::Exception("Situated object without an appearance");

	loadAppearance();
	loadSounds();


	// Position

	float posX = instance.getDouble("X");
	float posY = instance.getDouble("Y");
	float posZ = instance.getDouble("Z");

	if (instance.hasField("Position")) {
		const Aurora::GFF3Struct &pos = instance.getStruct("Position");

		posX = pos.getDouble("x");
		posY = pos.getDouble("y");
		posZ = pos.getDouble("z");
	}

	setPosition(posX, posY, posZ);

	// Orientation

	float bearing = instance.getDouble("Bearing");

	float rotX = 0.0f;
	float rotY = 0.0f;
	float rotZ = 1.0f;
	float rotW = Common::rad2deg(bearing);

	if (instance.hasField("Orientation")) {
		const Aurora::GFF3Struct &o = instance.getStruct("Orientation");

		rotX = o.getDouble("x");
		rotY = o.getDouble("y");
		rotZ = o.getDouble("z");
		rotW = -Common::rad2deg(acos(o.getDouble("w")) * 2.0);
	}

	setOrientation(rotX, rotY, rotZ, rotW);
}
Example #11
0
//-----------------------------------------------------------------------------
// Func: void CShip::init()
// Desc: Inits all the vars for this ship
//-----------------------------------------------------------------------------
void CShip::init()
{
  if(!initialized)
  {
    // geometry
    model.setTexPointer(&texture); 

    if(!model.initialized)     model.init();
    if(!texture.initialized) texture.init();

    // game logic
    finishlineId      = -1;
    currLapNumber     = 0;
    nextGateToVisit   = 0;
    feelerRadius      = 64.0f;
    memset(oldpos, 0, sizeof(vect3));
    memset(pos,    0, sizeof(vect3));
    
    loadSounds();

    // done
    initialized = 1;
  }

  reset();
}
Example #12
0
Content::Content()
{
        loadTextures();
        loadSounds();
        loadMusic();
        loadFonts();
}
Example #13
0
void		GameEngine::loadGame()
{
  _menuTheme.stop();
  _menu.setGen(mode::gen::LOAD);
  _menu.setMode(mode::load::UNKNOWN);
  _menu.setSub(mode::load::SOLO);
  draw();

  std::ifstream file("saved/game");

  _map = new Map("saved/game", true);
  _map->loadFile(&file);
  loadObject(_map);
  _projection = glm::perspective(FOV,
  				 WIN_WIDTH / static_cast<float>(WIN_HEIGHT),
  				 MIN_RANGE,
  				 MAX_RANGE);
  _transformation = glm::lookAt(_camera, glm::vec3(_camera.x, 0, 0), glm::vec3(0, 1, 0));
  _shader.bind();
  _shader.setUniform("view", _transformation);
  _shader.setUniform("projection", _projection);

  loadObject((_player = new Marvin(_bombExplosion, _up, _bombz, _objs, _map, Marvin::PLAY1, glm::vec3(1, 0, 1))));
  // if (nbPlayer == 2)
  //   loadObject((_player2 = new Marvin(_bombExplosion, _up, _bombz, _objs, _map, Marvin::PLAY2, glm::vec3(_map->getWidth() - 2, 0, _map->getHeight() - 2))));
  for (int i = 0; i < _menu.getIA(); i++)
    loadObject(new Marvin(_bombExplosion, _up, _bombz, _objs, _map, Marvin::CPU, glm::vec3(_map->getWidth() - 2, 0, 1)));
  loadSounds();
  played = true;
  _menu.setPlay(true);
  _menu.setGen(mode::gen::UNKNOWN);
}
Example #14
0
void Resources::loadResources()
{
    loadTextures();
    loadSounds();
    loadMusic();
    loadFonts();
    loadLevelInfo();
}
Example #15
0
void initSounds(void)
{
	memset(sounds, 0, sizeof(Mix_Chunk*) * SND_MAX);

	music = NULL;

	loadSounds();
}
Example #16
0
ItemDatabase::ItemDatabase(SDL_Surface *_screen, FontEngine *_font) {
	screen = _screen;
	font = _font;
	
	vendor_ratio = 4; // this means scrap/vendor pays 1/4th price to buy items from hero
	load();
	loadSounds();
	loadIcons();
}
Example #17
0
void xmlLoader::loadNode(clamourNode &n, ofxXmlSettings &XML) {

    if(XML.tagExists("ATTACK_SECS"))n.setAttSecs(XML.getValue("ATTACK_SECS", 0.01)); // could be in a param if necessary later
    if(XML.tagExists("DECAY_SECS"))n.setDecSecs(XML.getValue("DECAY_SECS", 0.2));  //
    if(XML.tagExists("ENV_TYPE"))n.setEnvType(XML.getValue("ENV_TYPE", "AR"));

    loadEvents(n, XML);

    if(XML.tagExists("SOUND_TYPE"))n.setSoundType(XML.getValue("SOUND_TYPE","none"));
    if(XML.tagExists("DRAW_TYPE"))n.setDrawType(XML.getValue("DRAW_TYPE", "none"));
    if(XML.tagExists("CAN_SLEEP"))n.setCanSleep(XML.getValue("CAN_SLEEP", true));
    if(XML.tagExists("ROTATE")){n.setIsRotate(XML.getValue("ROTATE", true));}
    if(XML.tagExists("COLLIDES")){n.setIsCollidable(XML.getValue("COLLIDES", false));}
    if(XML.tagExists("DISTRIB")){n.setIsDistributable(XML.getValue("DISTRIB", true));}

    if(XML.tagExists("SHIFT"))n.setShiftAmount(XML.getValue("SHIFT", 0.2));

    if(XML.pushTag("DRAW_PARAMS")) {

        vector<parameter> p;
        xmlLoader::loadParams( p ,XML);
        for(int i = 0; i < p.size(); i++)n.setDrawParameter(p[i]);
        XML.popTag();
    }


    if(n.getDrawData().getName() != "none"){
        //if statement needed here too
        ofPath p;

        pathFactory::createPath(p, n.getDrawData().getShapeType(),
                                XML.getValue("X_DIM",1.0),XML.getValue("Y_DIM", 1.0),
                                n.getDrawData().getParameter("size").abs_val);

        n.setEdgeTemplate(p);
    }




    if(XML.pushTag("SOUND_PARAMS")) {

        if(XML.tagExists("FILE"))n.setSoundFile(XML.getValue("FILE", "default"));
        vector<parameter> p;
        xmlLoader::loadParams( p ,XML);
        for(int i = 0; i < p.size(); i++) {
            n.setSoundParameter(p[i]);
        }
        XML.popTag();
    }

    loadSounds(n, XML);
    loadReactions(n,XML);


}
Example #18
0
CTDataBuf *g_getSound(const char *name){
   
   loadSounds();
   
   if(strcmp(name,"welcomeSnd")==0){return &welcomeSnd;}
   if(strcmp(name,"onHoldSnd")==0){ return &onHoldSnd;}
   if(strcmp(name,"putOnHoldSnd")==0){ return &putOnHoldSnd;}
 
   return 0;
}
Example #19
0
	void loadAssets()
	{
		log("loading fonts"); 		loadFonts();
		log("loading sounds"); 		loadSounds();
		log("loading music"); 		loadMusic();
		log("loading music data"); 	loadMusicData();
		log("loading style data"); 	loadStyleData();
		log("loading level data");	loadLevelData();
		log("loading scores"); 		loadScores();
	}
Example #20
0
void Situated::load(const Aurora::GFF3Struct &instance, const Aurora::GFF3Struct *blueprint) {
	// General properties

	if (blueprint)
		loadProperties(*blueprint); // Blueprint
	loadProperties(instance);    // Instance


	// Specialized object properties

	if (blueprint)
		loadObject(*blueprint); // Blueprint
	loadObject(instance);    // Instance


	// Appearance

	if (_appearanceID == Aurora::kFieldIDInvalid)
		warning("Situated object \"%s\" without an appearance", _tag.c_str());

	loadAppearance();
	loadSounds();

	// Model

	if (!_modelName.empty()) {
		_model.reset(loadModelObject(_modelName));

		if (!_model)
			throw Common::Exception("Failed to load situated object model \"%s\"",
			                        _modelName.c_str());
	} else
		warning("Situated object \"%s\" (\"%s\") has no model", _name.c_str(), _tag.c_str());

	if (_model) {
		// Clickable
		_model->setTag(_tag);
		_model->setClickable(isClickable());

		// ID
		_ids.push_back(_model->getID());
	}

	// Position

	setPosition(instance.getDouble("X"),
	            instance.getDouble("Y"),
	            instance.getDouble("Z"));

	// Orientation

	float bearing = instance.getDouble("Bearing");

	setOrientation(0.0f, 0.0f, 1.0f, Common::rad2deg(bearing));
}
Example #21
0
void SoundManager::init(void){

	int errorCode = Mix_OpenAudio(22050, AUDIO_S16SYS, 2, 4096);
	if(errorCode != 0){
		std::cout<<"Error: Could not open SDL Mixer.\n"<<Mix_GetError()<<std::endl;
	}
	resetIDs();
	backgroundMusic=NULL;
	loadSounds();
	
}
Example #22
0
Audio::Audio() : musiqueId(0), specialId(0) {
    SOUND = true;
    music = NULL;
    
    if(SDL_InitSubSystem(SDL_INIT_AUDIO) == -1) SOUND = false;
    
    if (SOUND) {
        Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 2048);
        previous_volume = Mix_VolumeMusic(32);
        loadSounds();
        setVolson(32);
    }
}
Example #23
0
void MusicManager::initAudioEngine()
{
    bool firstRun = !PGE_SDL_Manager::isInit;
    PGE_SDL_Manager::initSDL();
    if(firstRun)
    {
        initArrays();
        defaultSndINI=PGE_SDL_Manager::appPath+"sounds.ini";
        defaultMusINI=PGE_SDL_Manager::appPath+"music.ini";
        loadSounds(defaultSndINI, PGE_SDL_Manager::appPath);
        loadMusics(defaultMusINI, PGE_SDL_Manager::appPath);
        rebuildSoundCache();
    }
}
Example #24
0
void GameApp::loadData()
{
	// Load textures.
	textures.resize(iNumOfTextures);
	textures[0] = loadTexture("../data/textures/button.png");
	textures[START_SCREEN] = loadTexture("../data/textures/start.png");
	textures[OPTIONS_SCREEN] = loadTexture("../data/textures/options.png");
	textures[HOWTO_SCREEN] = loadTexture("../data/textures/howto.png");
	textures[PLAY_SCREEN] = loadTexture("../data/textures/round1.png");
	textures[PLAY_SCREEN+1] = loadTexture("../data/textures/round2.png");
	textures[PLAY_SCREEN+2] = loadTexture("../data/textures/round3.png");

	// Load sounds and fonts.
	loadSounds();
	loadFonts();
}
Example #25
0
bool MinigameBbAnt::run(bool fromMainGame) {

	memset(_objects, 0, sizeof(_objects));
	
	_numbersAnim = getAnimation(167);
	
	_backgroundSpriteIndex = 303;
	_titleScreenSpriteIndex = 304;

	_fromMainGame = fromMainGame;

	_hiScore = 0;
	if (!_fromMainGame)
		_hiScore = loadHiscore(kMinigameBbAnt);

	_gameState = 0;
	_gameResult = false;
	_gameDone = false;
	initObjects();
	initVars();
	
	_spriteModule = new SpriteModule();
	_spriteModule->load("bbant/bbant.000");

	Palette palette = _spriteModule->getPalette();
	_vm->_screen->setPalette(palette);
	
	loadSounds();

	_gameTicks = 0;
	playSound(12, true);
	
	while (!_vm->shouldQuit() &&!_gameDone) {
		_vm->updateEvents();
		update();
	}
	
	_vm->_sound->unloadSounds();

	if (!_fromMainGame)
		saveHiscore(kMinigameBbAnt, _hiScore);

	delete _spriteModule;

	return _gameResult;
}
Example #26
0
/**
 * When loading a new map, we eliminate existing enemies and load the new ones.
 * The map will have loaded Entity blocks into an array; retrieve the Enemies and init them
 */
void EnemyManager::handleNewMap () {
	
	Map_Enemy me;
	
	// delete existing enemies
	for (int i=0; i<enemy_count; i++) {
		delete(enemies[i]);
	}
	enemy_count = 0;
	
	// free shared resources
	for (int j=0; j<gfx_count; j++) {
		SDL_FreeSurface(sprites[j]);
	}
	for (int j=0; j<sfx_count; j++) {
		Mix_FreeChunk(sound_phys[j]);
		Mix_FreeChunk(sound_ment[j]);
		Mix_FreeChunk(sound_hit[j]);
		Mix_FreeChunk(sound_die[j]);
		Mix_FreeChunk(sound_critdie[j]);
	}
	gfx_count = 0;
	sfx_count = 0;
	
	// load new enemies
	while (!map->enemies.empty()) {
		me = map->enemies.front();
		map->enemies.pop();
		
		enemies[enemy_count] = new Enemy(powers, map);
		enemies[enemy_count]->stats.pos.x = me.pos.x;
		enemies[enemy_count]->stats.pos.y = me.pos.y;
		enemies[enemy_count]->stats.direction = me.direction;
		enemies[enemy_count]->stats.load("enemies/" + me.type + ".txt");
		if (enemies[enemy_count]->stats.animations != "") {
			// load the animation file if specified
			enemies[enemy_count]->loadAnimations("animations/" + enemies[enemy_count]->stats.animations + ".txt");
		}
		else {
			cout << "Warning: no animation file specified for entity: " << me.type << endl;
		}
		loadGraphics(enemies[enemy_count]->stats.gfx_prefix);
		loadSounds(enemies[enemy_count]->stats.sfx_prefix);
		enemy_count++;
	}
}
Example #27
0
int doInit(Uint32 vidFlags, int doWipe) {
	int i;

	BrInitError error;
	if(br_init(&error, "kuri2d") == 0 && error != BR_INIT_ERROR_DISABLED) {
		printf("Warning: BinReloc failed to initialize (error code %d)\n", error);
		printf("Will fallback to hardcoded default path.\n");
	}

	if(SDL_Init((Uint32)(SDL_INIT_VIDEO | SDL_INIT_AUDIO))) {
		printf("Unable to init SDL: %s\n", SDL_GetError());
		return 0;
	}
	(void)atexit(SDL_Quit);
	(void)atexit(TTF_Quit);

	/* malloc some defaults - they *should* be reloaded later */
	level = (KuriLevel *)malloc(sizeof(KuriLevel));
	startState = malloc(sizeof(State));
	state = malloc(sizeof(State));
	strcpy(state->name, "Player");
	state->level = (Uint8)0;
	state->score = (Uint8)0;
	state->lives = (Uint8)3;

	for(i=0; i<MAX_HISCORES; i++) {
		strcpy(hiscores[i].name, "nobody");
		hiscores[i].score = 0;
		hiscores[i].level = 0;
	}

	if(level && startState && state &&
		(doWipe ? 1 : loadHiScores()) &&
		loadBackgrounds() &&
		loadBlocks() &&
		loadLevels() &&
		loadSounds() &&
		loadFonts() &&
		loadTexts() &&
		openFrame(vidFlags)) {
		return 1;
	}

	return 0;
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    // Create an instance of a ScoreKeeper that will keep track of correct/incorrect answers and provide statistics on them
    score_keeper = new ScoreKeeper(this);

    // Upon retrieving the two sound file URLs, send a request to Playback to open them and assign them to the Players
    connect(this, SIGNAL(loadSoundsRequest(QUrl,QUrl)), ui->playbackWidget, SLOT(loadSounds(QUrl,QUrl)));
    // When a guess is made by the user, send whether it was correct or incorrect to ScoreKeeper
    connect(this, SIGNAL(guessMade(ScoreKeeper::Guesses)), score_keeper, SLOT(guessMade(ScoreKeeper::Guesses)));
    // When the user makes a guess, Playback starts a new trial
    connect(this, SIGNAL(startNewTrialRequest()), ui->playbackWidget, SLOT(startNewTrial()));
    // When ScoreKeeper has updated its scores, it notifies this window to update their display
    connect(score_keeper, SIGNAL(scoreUpdated(ScoreKeeper::Score,ScoreKeeper::Score)), this, SLOT(updateLabels(ScoreKeeper::Score,ScoreKeeper::Score)));
}
Example #29
0
void Situated::load(const Aurora::GFF3Struct &instance, const Aurora::GFF3Struct *blueprint) {
    // General properties

    if (blueprint)
        loadProperties(*blueprint); // Blueprint
    loadProperties(instance);    // Instance


    // Specialized object properties

    if (blueprint)
        loadObject(*blueprint); // Blueprint
    loadObject(instance);    // Instance


    // Sounds

    loadSounds();

    // Position

    setPosition(instance.getDouble("X"),
                instance.getDouble("Y"),
                instance.getDouble("Z"));

    // Orientation

    float bearing = instance.getDouble("Bearing");

    float rotX = 0.0f;
    float rotY = 0.0f;
    float rotZ = 1.0f;
    float rotW = Common::rad2deg(bearing);

    if (instance.hasField("OrientationW")) {
        rotX = instance.getDouble("OrientationX");
        rotY = instance.getDouble("OrientationY");
        rotZ = instance.getDouble("OrientationZ");
        rotW = Common::rad2deg(acos(instance.getDouble("OrientationW")) * 2.0);
    }

    setOrientation(rotX, rotY, rotZ, rotW);
}
Sounds::Sounds() {
	IGLog("Sounds init");

	soundKeyMove = NULL;
	soundOpenChest = NULL;
	soundRestartLevel = NULL;
	soundDoor = NULL;
	soundClick = NULL;
	soundMapLocked = NULL;
	soundUnlockAchievement = NULL;
	
	if(AIRPLAY_DEVICE == AIRPLAY_DEVICE_IPHONE) {
		// for iphone, if there's background music playing, keep it playing
		if(s3eIOSBackgroundMusicAvailable() == S3E_TRUE) {
			if(s3eIOSBackgroundMusicGetInt(S3E_IOSBACKGROUNDMUSIC_PLAYBACK_STATE) == S3E_IOSBACKGROUNDMUSIC_PLAYBACK_INTERRUPTED)
				s3eIOSBackgroundMusicPlay();
			if(s3eIOSBackgroundAudioIsPlaying() == S3E_TRUE)
				s3eIOSBackgroundAudioSetMix(S3E_TRUE);
		}
	}

	// set default frequency at which all channels will play at, in Hz.
	s3eSoundSetInt(S3E_SOUND_DEFAULT_FREQ, 44100);

	// turn down the volume
	s3eSoundSetInt(S3E_SOUND_VOLUME, 96);
	s3eAudioSetInt(S3E_AUDIO_VOLUME, 96);

	// if sounds are enabled, load the sounds
	if(Settings::getInstance()->soundEnabled)
		loadSounds();

	// start playing music?
	gameplayStart = 0;
	gameplayPlaying = false;
	if(Settings::getInstance()->musicEnabled) {
		if(GameData::getInstance()->isSavedGame())
			startMusicGameplay();
		else
			startMusicMenu();
	}
}