Esempio n. 1
0
void
MainMenu::quitButtonClicked(Button* )
{
    getSound()->playSound( "Click" );
    quitState = QUIT;
    running = false;
}
Esempio n. 2
0
void SoundInterface::commandDeleteSound(void) {
	int32_t id = cb->popValue().getInt();
	CBSound* sound = getSound(id);
	if (sound == 0) return;
	delete sound;
	sounds.erase(id);
}
Esempio n. 3
0
// Load game
void SaveLoad::loadGame(GameId id) {
	// Rewind current savegame
	_savegame->seek(0);

	// Validate main header
	SavegameMainHeader header;
	if (!loadMainHeader(_savegame, &header)) {
		debugC(2, kLastExpressDebugSavegame, "SaveLoad::saveGame - Cannot load main header: %s", getFilename(getMenu()->getGameId()).c_str());
		return;
	}

	// Load the last entry
	_savegame->seek(header.offsetEntry);

	SavegameType type = kSavegameTypeIndex;
	EntityIndex entity = kEntityPlayer;
	uint32 val = 0;
	readEntry(&type, &entity, &val, header.keepIndex == 1);

	// Setup last loading time
	_gameTicksLastSavegame = getState()->timeTicks;

	if (header.keepIndex) {
		getSound()->clearQueue();

		readEntry(&type, &entity, &val, false);
	}

	getEntities()->reset();
	getEntities()->setup(false, entity);
}
Esempio n. 4
0
void
MainMenu::optionsButtonClicked(Button* )
{
    getSound()->playSound( "Click" );
    loadOptionsMenu();
    switchMenu(optionsMenu.get());
}
Esempio n. 5
0
void
MainMenu::loadGameButtonClicked(Button* )
{
    getSound()->playSound( "Click" );
    loadLoadGameMenu();
    switchMenu(loadGameMenu.get());
}
Esempio n. 6
0
void PickupItem_Health::executeEffect(OBJECT_ID id)
{
	playSound(getSound());
	relayMessage(id, MessageCharacterReceivesHealing(healing));

	// TODO: Special FX
}
Esempio n. 7
0
void
MainMenu::creditsButtonClicked(Button* )
{
    getSound()->playSound( "Click" );
    loadCreditsMenu();
    switchMenu(creditsMenu.get());
}
Esempio n. 8
0
void ALAudio::BGS_Play(std::string const& file, int volume, int pitch) {
	SET_CONTEXT(ctx_);

	alSourcef(bgs_src_->get(), AL_PITCH, pitch * 0.01f);
	alSourcei(bgs_src_->get(), AL_LOOPING, AL_TRUE);
	bgm_src_->set_volume(volume * 0.01f);
	bgm_src_->play_buffer(getSound(file));
}
Esempio n. 9
0
void Buzzer::doInterrupt()
{
    uint16_t v2 = getSound(Timer::getInterrupts() - begin_time_);
    if(v2 != last_value_) {
        last_value_ = v2;
        hardware::setBuzzer(last_value_);
    }
}
Esempio n. 10
0
void Buzzer::doIdle()
{
    uint8_t v2 = getSound(Time::diffU16(begin_time_U16_, Time::getInterruptsU16()));
    if(v2 != last_value_) {
        last_value_ = v2;
        hardware::setBuzzer(last_value_);
    }
}
Esempio n. 11
0
void ALAudio::BGS_Play(std::string const &file, int volume, int pitch, int fadein) {
	SET_CONTEXT(ctx_);

	BGM_Pitch(pitch);
	BGM_Volume(volume);
	bgm_src_->set_buffer_loader(getSound(*bgm_src_, file));
	bgm_src_->fade_in(fadein);
}
Esempio n. 12
0
void SaveLoad::readEntry(SavegameType *type, EntityIndex *entity, uint32 *val, bool keepIndex) {
#define LOAD_ENTRY(name, func, val) { \
	uint32 _prevPosition = (uint32)_savegame->pos(); \
	func; \
	uint32 _count = (uint32)_savegame->pos() - _prevPosition; \
	debugC(kLastExpressDebugSavegame, "Savegame: Reading " #name ": %d bytes", _count); \
	if (_count != val) \
		error("SaveLoad::readEntry: Number of bytes read (%d) differ from expected count (%d)", _count, val); \
}

#define LOAD_ENTRY_ONLY(name, func) { \
	uint32 _prevPosition = (uint32)_savegame->pos(); \
	func; \
	uint32 _count = (uint32)_savegame->pos() - _prevPosition; \
	debugC(kLastExpressDebugSavegame, "Savegame: Reading " #name ": %d bytes", _count); \
}

	if (!type || !entity || !val)
		error("SaveLoad::readEntry: Invalid parameters passed!");

	// Load entry header
	SavegameEntryHeader entry;
	Common::Serializer ser(_savegame, NULL);
	entry.saveLoadWithSerializer(ser);

	if (!entry.isValid())
		error("SaveLoad::readEntry: entry header is invalid!");

	// Init type, entity & value
	*type = entry.type;
	*val = entry.value;

	// Save position
	uint32 originalPosition = (uint32)_savegame->pos();

	// Load game data
	LOAD_ENTRY("entity index", ser.syncAsUint32LE(*entity), 4);
	LOAD_ENTRY("state", getState()->saveLoadWithSerializer(ser), 4 + 4 + 4 + 4 + 1 + 4 + 4);
	LOAD_ENTRY("selected item", getInventory()->saveSelectedItem(ser), 4);
	LOAD_ENTRY("positions", getEntities()->savePositions(ser), 4 * 1000);
	LOAD_ENTRY("compartments", getEntities()->saveCompartments(ser), 4 * 16 * 2);
	LOAD_ENTRY("progress", getProgress().saveLoadWithSerializer(ser), 4 * 128);
	LOAD_ENTRY("events", getState()->syncEvents(ser), 512);
	LOAD_ENTRY("inventory", getInventory()->saveLoadWithSerializer(ser), 7 * 32);
	LOAD_ENTRY("objects", getObjects()->saveLoadWithSerializer(ser), 5 * 128);
	LOAD_ENTRY("entities", getEntities()->saveLoadWithSerializer(ser), 1262 * 40);
	LOAD_ENTRY_ONLY("sound", getSound()->saveLoadWithSerializer(ser));
	LOAD_ENTRY_ONLY("savepoints", getSavePoints()->saveLoadWithSerializer(ser));

	// Update chapter
	getProgress().chapter = entry.chapter;

	// Skip padding
	uint32 offset = _savegame->pos() - originalPosition;
	if (offset & 0xF) {
		_savegame->seek((~offset & 0xF) + 1, SEEK_SET);
	}
}
Esempio n. 13
0
void AudioPluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages)
{
    synth.clearSounds();
    synth.addSound(getSound());
    
    const int numSamples = buffer.getNumSamples();
    int channel, dp = 0;
    
    // Go through the incoming data, and apply our gain to it...
    for (channel = 0; channel < getNumInputChannels(); ++channel)
        buffer.applyGain (channel, 0, buffer.getNumSamples(), gain);
    
    // Now pass any incoming midi messages to our keyboard state object, and let it
    // add messages to the buffer if the user is clicking on the on-screen keys
    keyboardState.processNextMidiBuffer (midiMessages, 0, numSamples, true);
    
    // and now get the synth to process these midi events and generate its output.
    synth.renderNextBlock (buffer, midiMessages, 0, numSamples);
    
    // Apply our delay effect to the new output..
    for (channel = 0; channel < getNumInputChannels(); ++channel)
    {
        float* channelData = buffer.getSampleData (channel);
        float* delayData = delayBuffer.getSampleData (jmin (channel, delayBuffer.getNumChannels() - 1));
        dp = delayPosition;
        
        for (int i = 0; i < numSamples; ++i)
        {
            const float in = channelData[i];
            channelData[i] += delayData[dp];
            delayData[dp] = (delayData[dp] + in) * delay;
            if (++dp >= delayBuffer.getNumSamples())
                dp = 0;
        }
    }
    
    delayPosition = dp;
    
    // In case we have more outputs than inputs, we'll clear any output
    // channels that didn't contain input data, (because these aren't
    // guaranteed to be empty - they may contain garbage).
    for (int i = getNumInputChannels(); i < getNumOutputChannels(); ++i)
        buffer.clear (i, 0, buffer.getNumSamples());
    
    // ask the host for the current time so we can display it...
    AudioPlayHead::CurrentPositionInfo newTime;
    
    if (getPlayHead() != nullptr && getPlayHead()->getCurrentPosition (newTime))
    {
        // Successfully got the current time from the host..
        lastPosInfo = newTime;
    }
    else
    {
        // If the host fails to fill-in the current time, we'll just clear it to a default..
        lastPosInfo.resetToDefault();
    }
}
Esempio n. 14
0
void
MainMenu::loadGameLoadButtonClicked(Button *)
{
    getSound()->playSound( "Click" );
    if( loadCityNG( mFilename ) ){
        quitState = INGAME;
        running = false;
    }
}
Esempio n. 15
0
String JuceBoxAudioProcessor::infoString()
{
	SamplerSound* sound = getSound();
	if (sound == NULL)
		return "";
	return
		" proc: " +
		String(blocksStarted) + "/" + String(blocksFinished);
}
Esempio n. 16
0
void SoundEffect::inheritedBegin()
{
    SoundUnrecPtr sound = getSound();
    if(sound != NULL)
    {
        sound->addSoundListener(&theInternalSoundListener);
        sound->play();
    }
}
Esempio n. 17
0
	void PCMAudioManager::unloadSound(S32 soundId) {
		if (soundId != -1) {
			PCMSound *sound = getSound(soundId);
			if (sound) {
				pcmSounds->remove(sound);
				delete sound;
			}
		}
	}
Esempio n. 18
0
void
check_bulldoze_area (int x, int y)
{
    //no need to bulldoze desert
    if( MP_GROUP( x, y ) == GROUP_DESERT ) 
        return;
    
  int xx, yy, g;
  if (MP_TYPE(x,y) == CST_USED)
    {
      xx = MP_INFO(x,y).int_1;
      yy = MP_INFO(x,y).int_2;
    }
  else
    {
      xx = x;
      yy = y;
    }
  g = MP_GROUP(xx,yy);

  if (g == GROUP_MONUMENT && monument_bul_flag == 0)
    {
        if( last_message_group != GROUP_MONUMENT ){
            new Dialog( BULLDOZE_MONUMENT, xx, yy ); // deletes itself
            last_message_group = GROUP_MONUMENT;
        }
        return;
    }
  else if (g == GROUP_RIVER && river_bul_flag == 0)
    {
        if( last_message_group != GROUP_RIVER ){
            new Dialog( BULLDOZE_RIVER, xx, yy ); // deletes itself
            last_message_group = GROUP_RIVER;
        }
        return;
    }
  else if (g == GROUP_SHANTY && shanty_bul_flag == 0)
    {
        if( last_message_group != GROUP_SHANTY ){
            new Dialog( BULLDOZE_SHANTY, xx, yy ); // deletes itself
            last_message_group = GROUP_SHANTY;
        }
        return;
    }
  else if (g == GROUP_TIP)
    {
      if( last_message_group != GROUP_TIP ){
        ok_dial_box ("nobull-tip.mes", BAD, 0L);
        last_message_group = GROUP_TIP;
      }
      return;
    }
  last_message_group = 0;
  getSound()->playSound( "Raze" );
  bulldoze_item (xx,yy);
}
Esempio n. 19
0
void dialogCheckHardware::programInit()
{
  connect(pushClose, SIGNAL(clicked()), this, SLOT(slotClose()));

  // Get the various hardware details
  getVideo();
  getNetwork();
  getSound();

}
Esempio n. 20
0
void Audio::BGS_Play(std::string const& file, int volume, int pitch)
{
	BGS_Stop();

	alSourceRewind(*bgsSource_);
	alSourcei(*bgsSource_, AL_BUFFER, getSound(file));
	alSourcef(*bgsSource_, AL_GAIN, volume * 0.01f);
	alSourcei(*bgsSource_, AL_PITCH, pitch * 0.01f);
	alSourcei(*bgsSource_, AL_LOOPING, AL_TRUE);
	alSourcePlay(*bgsSource_);
}
/***********************************************************
synopsis: displays the graphical representation of time

inputs: screen - the SDL_Surface to display the image

outputs: n/a
***********************************************************/
static void
updateTime(SDL_Surface* screen)
{
    /* the time is x seconds  minus the number of seconds of game time */
    int thisTime;
    int seconds;
    int minutes;
    int minute_units;
    int minute_tens;
    int second_units;
    int second_tens;
    
    SDL_Rect fromrect, torect, blankRect;

	blankRect.x = CLOCK_WIDTH * 11;
	blankRect.y = 0;
	blankRect.w = CLOCK_WIDTH;
	blankRect.h = CLOCK_HEIGHT;

	fromrect.x = 0;
	fromrect.y = 0;
	fromrect.w = CLOCK_WIDTH;
	fromrect.h = CLOCK_HEIGHT;

	torect.y = 0;
	torect.w = CLOCK_WIDTH;
	torect.h = CLOCK_HEIGHT;

	thisTime = (int)((time_t)AVAILABLE_TIME - gameTime);
	minutes = thisTime/60;
	seconds = thisTime-(minutes*60);
	minute_tens = minutes/10;
	minute_units = minutes-(minute_tens*10);
	second_tens = seconds/10;
	second_units = seconds-(second_tens*10);

	fromrect.x = CLOCK_WIDTH * minute_tens;
	torect.x = CLOCK_WIDTH * 0;
	SDL_BlitSurface(numberBank, &fromrect, clockSprite->sprite, &torect);
	fromrect.x = CLOCK_WIDTH * minute_units;
	torect.x = CLOCK_WIDTH * 1;
	SDL_BlitSurface(numberBank, &fromrect, clockSprite->sprite, &torect);
	fromrect.x = CLOCK_WIDTH * second_tens;
	torect.x = CLOCK_WIDTH * 3;
	SDL_BlitSurface(numberBank, &fromrect, clockSprite->sprite, &torect);
	fromrect.x = CLOCK_WIDTH * second_units;
	torect.x = CLOCK_WIDTH * 4;
	SDL_BlitSurface(numberBank, &fromrect, clockSprite->sprite, &torect);

	/* tick out the last 10 seconds */
	if (thisTime<=10 && thisTime>0) {
		Mix_PlayChannel(-1, getSound("clock-tick"), 0);
	}
}
Esempio n. 22
0
void ALAudio::SE_Play(std::string const &file, int volume, int pitch) {
	SET_CONTEXT(ctx_);

	EASYRPG_SHARED_PTR<source> src = create_source(false);

	alSourcef(src->get(), AL_PITCH, pitch * 0.01f);
	src->set_volume(volume * 0.01f);
	src->set_buffer_loader(getSound(*src, file));

	se_src_.push_back(src);
}
Esempio n. 23
0
void Buzzer::doInterrupt()
{

    uint32_t v = getSound(timer.getInterrupts() - begin_time_);
    v *= volume_;
    v /= 100;
    uint16_t v2 = v;
    if(v2 != last_value_) {
        last_value_ = v2;
        hardware::setBuzzer(last_value_);
    }
}
FMCSoundStyleB::FMCSoundStyleB(Config* main_config, FMCControl* fmc_control) :
    FMCSounds(main_config, CFG_SOUNDS_STYLE_B_FILENAME, fmc_control)
{
    setupDefaultConfig();
    m_sounds_cfg->saveToFile();

    // load sounds

    loadBaseSounds();
    loadSound(CFG_SOUNDS_TOO_LOW_GEAR, m_sounds_cfg->getValue(CFG_SOUNDS_TOO_LOW_GEAR), FMCSoundBase::SOUND_SOURCE_COMPUTER);
    loadSound(CFG_SOUNDS_TOO_LOW_FLAPS, m_sounds_cfg->getValue(CFG_SOUNDS_TOO_LOW_FLAPS), FMCSoundBase::SOUND_SOURCE_COMPUTER);
    loadSound(CFG_SOUNDS_APP_MINIMUMS, m_sounds_cfg->getValue(CFG_SOUNDS_APP_MINIMUMS), FMCSoundBase::SOUND_SOURCE_COMPUTER);
    loadSound(CFG_SOUNDS_MINIMUMS, m_sounds_cfg->getValue(CFG_SOUNDS_MINIMUMS), FMCSoundBase::SOUND_SOURCE_COMPUTER);
    loadSound(CFG_SOUNDS_ALT_ALERT, m_sounds_cfg->getValue(CFG_SOUNDS_ALT_ALERT), FMCSoundBase::SOUND_SOURCE_COMPUTER);
    loadSound(CFG_SOUNDS_ALT_ALERT_CONT, m_sounds_cfg->getValue(CFG_SOUNDS_ALT_ALERT_CONT), FMCSoundBase::SOUND_SOURCE_COMPUTER);
    loadSound(CFG_SOUNDS_AP_DISCO, m_sounds_cfg->getValue(CFG_SOUNDS_AP_DISCO), FMCSoundBase::SOUND_SOURCE_COMPUTER);
    loadSound(CFG_SOUNDS_AT_DISCO, m_sounds_cfg->getValue(CFG_SOUNDS_AT_DISCO), FMCSoundBase::SOUND_SOURCE_COMPUTER);
    loadSound(CFG_SOUNDS_STALL, m_sounds_cfg->getValue(CFG_SOUNDS_STALL), FMCSoundBase::SOUND_SOURCE_COMPUTER);
    loadSound(CFG_SOUNDS_CHIME, m_sounds_cfg->getValue(CFG_SOUNDS_CHIME), FMCSoundBase::SOUND_SOURCE_COMPUTER);
    loadSound(CFG_SOUNDS_OVERSPEED, m_sounds_cfg->getValue(CFG_SOUNDS_OVERSPEED), FMCSoundBase::SOUND_SOURCE_COMPUTER);
    loadSound(CFG_SOUNDS_ALT_ALERT_CONT, m_sounds_cfg->getValue(CFG_SOUNDS_ALT_ALERT_CONT), FMCSoundBase::SOUND_SOURCE_COMPUTER);

    if (getSound(CFG_SOUNDS_STALL)) getSound(CFG_SOUNDS_STALL)->setPlayLooped(true);
    if (getSound(CFG_SOUNDS_OVERSPEED)) getSound(CFG_SOUNDS_OVERSPEED)->setPlayLooped(true);
    if (getSound(CFG_SOUNDS_ALT_ALERT_CONT)) getSound(CFG_SOUNDS_ALT_ALERT_CONT)->setPlayLooped(true);
}
Esempio n. 25
0
//////////////////////////////////////////////////////////////////////////
// Opponent
//////////////////////////////////////////////////////////////////////////
FighterOpponentMilos::FighterOpponentMilos(LastExpressEngine *engine) : Opponent(engine) {
	_sequences.push_back(loadSequence("2001or.seq"));
	_sequences.push_back(loadSequence("2001oal.seq"));
	_sequences.push_back(loadSequence("2001oam.seq"));
	_sequences.push_back(loadSequence("2001okl.seq"));
	_sequences.push_back(loadSequence("2001okm.seq"));
	_sequences.push_back(loadSequence("2001dbk.seq"));
	_sequences.push_back(loadSequence("2001wbk.seq"));

	getSound()->playSound(kEntityTables0, "MUS027", kFlagDefault);

	_field_38 = 35;
}
Esempio n. 26
0
void
BabelClient::sendSound(unsigned int thread_id, ISocket *client)
{
    while (client->getStatus() != ISocket::Canceled)
	{
		#ifdef _WIN_32
			Sleep(100);
		#else
			usleep(100);
		#endif
        client->writePacket(Packet::pack<SoundPacket>(*(getSound()->getStruct())));
    }
}
Esempio n. 27
0
void Audio::SE_Play(std::string const& file, int volume, int pitch)
{
	eraseStopped(seSource_);

	boost::shared_ptr<ALuint> src = create_source();

	alSourcei(*src, AL_BUFFER, getSound(file));
	alSourcef(*src, AL_GAIN, volume * 0.01f);
	alSourcei(*src, AL_PITCH, pitch * 0.01f);
	alSourcei(*src, AL_LOOPING, AL_FALSE);
	alSourcePlay(*src);

	seSource_.push_back(src);
}
Esempio n. 28
0
void sfzero::SFZeroAudioProcessor::getStateInformation(MemoryBlock &destData)
{
  auto obj = new DynamicObject();
  obj->setProperty("sfzFilePath", sfzFile.getFullPathName());
  auto sound = getSound();
  if (sound)
  {
    int subsound = sound->selectedSubsound();
    if (subsound != 0)
      obj->setProperty("subsound", subsound);
  }

  MemoryOutputStream out(destData, false);
  JSON::writeToStream(out, var(obj));
}
Esempio n. 29
0
//////////////////////////////////////////////////////////////////////////
// Opponent
//////////////////////////////////////////////////////////////////////////
FighterOpponentVesna::FighterOpponentVesna(LastExpressEngine *engine) : Opponent(engine) {
	_sequences.push_back(loadSequence("2005or.seq"));
	_sequences.push_back(loadSequence("2005oam.seq"));
	_sequences.push_back(loadSequence("2005oar.seq"));
	_sequences.push_back(loadSequence("2005okml.seq"));
	_sequences.push_back(loadSequence("2005okr.seq"));
	_sequences.push_back(loadSequence("2005odm1.seq"));
	_sequences.push_back(loadSequence("2005csbm.seq"));
	_sequences.push_back(loadSequence("2005oam4.seq"));

	getSound()->playSound(kEntityTables0, "MUS038", kVolumeFull);

	_countdown = 4;
	_field_38 = 30;
}
Esempio n. 30
0
void updateMenu(Inputs *input, Map **map) {
	if (input->up && getInfoGame()->choiceMenu != MIN_CHOICE_MENU)	{
		--getInfoGame()->choiceMenu;
		playSound(getSound().menuMove);
	}
	else if (input->down && getInfoGame()->choiceMenu != MAX_CHOICE_MENU) {
		++getInfoGame()->choiceMenu;
		playSound(getSound().menuMove);
	}
	else if (input->enter) {
		if (getInfoGame()->choiceMenu == 0) {
			getInfoGame()->isOnMenu = IS_IN_CHOOSEMAP_MENU;
			getInfoGame()->choicePause = 0;
		}
		else if (getInfoGame()->choiceMenu == 1)
			getInfoGame()->isOnMenu = IS_IN_EDITOR;
		else if (getInfoGame()->choiceMenu == 2) {
			getInfoGame()->isOnMenu = IS_IN_OPTION_MENU;
		}
		else if (getInfoGame()->choiceMenu == 3)
			exit(0);
		playSound(getSound().menuChoose);
	}
}