Exemplo n.º 1
0
void LoadSounds()
{
    GetSoundManager().LoadSound("glass_step.ogg");
    GetSoundManager().LoadSound("airlock.ogg");
    GetSoundManager().LoadSound("Wirecutter.ogg");
    GetSoundManager().LoadSound("Screwdriver.ogg");
}
Exemplo n.º 2
0
void aiNest::ai_update()
{
  for (uint i(0) ; i < babies_.get_size() ; ++i) {
    if (++babies_.current()->age_ > DEVELOPMENT_DURATION) {
      aiNestEntrance& ent = random_entrance() ;
      switch (babies_.current()->morphology_) {
        case HARVESTER:
          world_.add_object(*new aiHarvester(world_,ent.get_coords2d(),UINT_RAND(HARVESTER_INITIAL_HP))) ;
          break ;
        case SCOUT:
          world_.add_object(*new aiScout(world_,ent.get_coords2d(),UINT_RAND(SCOUT_INITIAL_HP))) ;
          break ;
        //case MAJOR:
        //  world_.add_object(*new aiMajor(*world_,ent.get_coords2d(),MAJOR_INITIAL_HP)) ;
        //  break ;
      }
      delete_current_baby() ;
    } else next_baby() ;
  }
  if (needs_a_scout()) {
    if (food_stock_ >= FOOD_STOCK_NEEDED_TO_GROW_A_SCOUT) {
      babies_.add(*new aiNestBaby(SCOUT)) ;
      food_stock_ -= FOOD_STOCK_NEEDED_TO_GROW_A_SCOUT ;
      GetSoundManager().PlaySound(NEWANT_SOUND_ID, false);
    }
  } else if (needs_a_harvester()) {
    if (food_stock_ >= FOOD_STOCK_NEEDED_TO_GROW_A_HARVESTER) {
      babies_.add(*new aiNestBaby(HARVESTER)) ;
      food_stock_ -= FOOD_STOCK_NEEDED_TO_GROW_A_HARVESTER ;
      GetSoundManager().PlaySound(NEWANT_SOUND_ID, false);
    }
  }
}
Exemplo n.º 3
0
void Source::Stop()
{
    // Is a buffer loaded? (using 'IsPlaying()' to test this is NOT correct in here!)
    Buffer *pBuffer = static_cast<Buffer*>(GetBuffer());
    if (pBuffer) {
        // Stop playback
        pBuffer->Stop(m_nChannel);
        m_nChannel = -1;

        // Remove source from sound manager
        static_cast<SoundManager&>(GetSoundManager()).RemoveActiveSource(*this);
    }
}
Exemplo n.º 4
0
bool Source::Play(bool bRestart)
{
    // Is a buffer loaded?
    Buffer *pBuffer = static_cast<Buffer*>(GetBuffer());
    if (!pBuffer)
        return false; // Error!

    // Paused?
    if (IsPaused() && !bRestart) {
        FSOUND_SetPaused(m_nChannel, 0);
    } else {
        // Play
        if (IsPlaying()) {
            if (!bRestart)
                return true; // Done
            Stop();
        }
        m_nChannel = pBuffer->Play();

        // Add source to sound manager
        static_cast<SoundManager&>(GetSoundManager()).AddActiveSource(*this);

        // Get frequency and setup pitch
        m_nFrequency = FSOUND_GetFrequency(m_nChannel);
        float fPitch = m_fPitch;
        m_fPitch = -1.0f;
        SetPitch(fPitch);

        // Set volume
        pBuffer->SetVolume(m_nChannel, m_fVolume);

        // [HACK] HW sound: We have to pause the playback if we want to change the looping mode...
        //	FSOUND_SetPaused(m_nChannel, 1);
        pBuffer->SetLooping(m_nChannel, m_bLooping);
        //	FSOUND_SetPaused(m_nChannel, 0);

        // Set attributes
        SetAttribute(Position, m_vAttributes[Position]);
        SetAttribute(Velocity, m_vAttributes[Velocity]);
    }

    // Done
    return true;
}
Exemplo n.º 5
0
		//! Play
		void teSound::Play()
		{
			teSoundManager::CheckResult(FMOD_System_PlaySound(GetSoundManager()->GetSystem(), FMOD_CHANNEL_REUSE, sound, stream, &channel));
			teSoundManager::CheckResult(FMOD_Channel_SetMode(channel, (loop ? FMOD_LOOP_NORMAL : FMOD_LOOP_OFF)));
			teSoundManager::CheckResult(FMOD_Channel_SetPaused(channel, false));
		}
Exemplo n.º 6
0
void Source::SetPitch(float fPitch)
{
    m_fPitch = fPitch;
    if (IsPlaying()) {
        int nFrequency = (GetFlags() & Source::NoMasterPitch) ? static_cast<int>(m_nFrequency*m_fPitch) : static_cast<int>(m_nFrequency*(m_fPitch*GetSoundManager().GetPitch()));
        if (nFrequency < 100)
            nFrequency = 100;
        if (nFrequency > 705600)
            nFrequency = 705600;
        FSOUND_SetFrequency(m_nChannel, nFrequency);
    }
}
Exemplo n.º 7
0
void InitSound(sf::Sound* sound, const std::string& name)
{
    GetSoundManager().InitSound(sound, name);
}