示例#1
0
	void AudioManager::Stop()
	{
		StopAllSounds();
		DeleteAllSounds();

#ifdef DESKTOP
		Mix_CloseAudio();
		Mix_Quit();
		SDL_Quit();
#else
		if(mOutputMixObj != NULL)
		{
			(*mOutputMixObj)->Destroy(mOutputMixObj);
			mOutputMixObj = NULL;
		}
		if(mEngineObj != NULL)
		{
			(*mEngineObj)->Destroy(mEngineObj);
			mEngineObj = NULL;
			mEngine = NULL;
		}
#endif
		star::Logger::GetInstance()->Log(star::LogLevel::Info,
			_T("Audio : Stopped audio Engine"), STARENGINE_LOG_TAG);
	}
bool SoundManager::OpenSoundFile(FileSpecifier& File)
{
	StopAllSounds();
	if (!sound_file.Open(File)) return false;
	real_number_of_sound_definitions = number_of_sound_definitions = sound_file.sound_count;	

	sound_source = (parameters.flags & _16bit_sound_flag) ? _16bit_22k_source : _8bit_22k_source;
	if (sound_file.source_count == 1)
		sound_source = _8bit_22k_source;

	return true;
}
示例#3
0
void CIwGameAudio::Release()
{
	// Stop sound and music
	StopMusic();
	StopAllSounds();

	// Clean-up sound collection
	SAFE_DELETE(SoundCollection)

	// Cleanup IwSound
	IwSoundTerminate();
}
示例#4
0
void CCustomDetector::OnH_B_Independent(bool just_before_destroy) 
{
	inherited::OnH_B_Independent(just_before_destroy);
	
	m_pCurrentActor				= NULL;
	m_pCurrentInvOwner			= NULL;

	StopAllSounds				();

	m_ZoneInfoMap.clear			();
	Feel::Touch::feel_touch.clear();
}
示例#5
0
文件: Sound.cpp 项目: xzrunner/t3d
int Sound::Shutdown()
{
	// this function releases all the memory allocated and the directsound object
	// itself

	// first turn all sounds off
	StopAllSounds();

	// now release all sound buffers
	for (int index=0; index<MAX_SOUNDS; index++)
		if (sound_fx[index].dsbuffer)
			sound_fx[index].dsbuffer->Release();

	// now release the directsound interface itself
	if (lpds)
		lpds->Release();

	return(1);
}
示例#6
0
int DSShutdown(void)
{
    // first turn all sounds off
    StopAllSounds();
    
    // now release all sound buffers
    for (int index = 0; index < MAX_SOUNDS; index++)
        if (sound_fx[index].dsbuffer) {
            sound_fx[index].dsbuffer->Release();
        }
        
    // now release the directsound interface itself
    if (lpDS) {
        lpDS->Release();
        lpDS = NULL;
    }
    
    // return success
    return(1);
}
bool SoundManager::OpenSoundFile(FileSpecifier& File)
{
	StopAllSounds();
	sound_file.reset(new M2SoundFile);
	if (!sound_file->Open(File))
	{
		// try M1 sounds
		sound_file.reset(new M1SoundFile);
		if (!sound_file->Open(File))
		{
			return false;
		}
		set_sounds_images_file(File);
	}

	sound_source = (parameters.flags & _16bit_sound_flag) ? _16bit_22k_source : _8bit_22k_source;
	if (sound_file->SourceCount() == 1)
		sound_source = _8bit_22k_source;

	return true;
}
void SoundManager::CloseSoundFile()
{
	StopAllSounds();
	sound_file.Close();
}
void CFlowConvoyNode::ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
{
	switch (event)
	{
	case eFE_Update:
		{
			if (m_processNode)
				Update(pActInfo);
		}
		break;
	case eFE_Activate:
		{
			if (IsPortActive(pActInfo, IN_SPEED) || IsPortActive(pActInfo, IN_DESIREDSPEED))
			{
				float speed=0;

				speed=GetPortFloat(pActInfo, IN_DESIREDSPEED);

				if(speed<0) //do not use negative speed
					speed=0;
				if(speed>m_speed && m_speed<0.01f)
				{
					AwakeCoaches(); //if speed is too small Physics go to sleep and callback does not work...
													//have to awake if train start again. should make more elegant...(keep awake somehow)
					StartSounds();
				}

				if(speed==0.f && m_speed>0.f)
					ConvoyStopSounds();

				m_desiredSpeed = speed;
			}
			else if(IsPortActive(pActInfo, IN_SPLIT_COACH))
			{
				if(!m_splitCoachIndex)
				{
					int splitCoachIndex=GetPortInt(pActInfo, IN_SPLIT_COACH);
					if(splitCoachIndex > 0 && splitCoachIndex < (int)m_coaches.size())
					{
						m_splitCoachIndex=splitCoachIndex;
						m_splitDistanceOnPath=m_distanceOnPath;
						m_distanceOnPath=m_coaches[m_splitCoachIndex-1].m_distanceOnPath-m_coaches[m_splitCoachIndex-1].m_coachOffset;
						m_splitSpeed=m_speed;
						if(!(m_splitCoachIndex&1))
							SplitLineSound(); //have to split the lineSound (there is 1 sound for 2 coaches)
					}
				}
				else
					CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_WARNING, "SplitCoachIndex has been set! Do not set it again! FlowConvoyNode: %s", m_coaches[0].m_pEntity->GetName());
			}
			else if(IsPortActive(pActInfo, IN_HORN_SOUND))
			{
				//bool isPlaying=false;
				//if(m_hornSoundID!=INVALID_SOUNDID)
				//{
				//	ISound *i_sound=m_coaches[0].m_pEntitySoundsProxy->GetSound(m_hornSoundID);
				//	if(i_sound && i_sound->IsPlaying())
				//		isPlaying=true;
				//}
				//if(!isPlaying)
				//	m_hornSoundID=m_coaches[0].m_pEntitySoundsProxy->PlaySound("sounds/vehicles_exp1:train:horn", Vec3Constants<float>::fVec3_Zero, Vec3Constants<float>::fVec3_OneY, FLAG_SOUND_DEFAULT_3D, eSoundSemantic_Vehicle);
			}
			else if(IsPortActive(pActInfo, IN_BREAK_SOUND) && m_speed>0.f)
				m_startBreakSoundShifted=1;
			else if(IsPortActive(pActInfo, IN_START_DISTANCE))
			{
				m_distanceOnPath = GetPortFloat(pActInfo, IN_START_DISTANCE);
				InitConvoyCoaches();
			}
			
			if (IsPortActive(pActInfo, IN_SHIFT))
			{
				m_ShiftTime = m_MaxShiftTime = GetPortFloat(pActInfo, IN_SHIFTTIME);
				bool* p_x = (pActInfo->pInputPorts[IN_SHIFT].GetPtr<bool>());

				*p_x = false;
			}
		}
		
		if (IsPortActive(pActInfo, IN_START))
		{
			m_processNode = true;
		}
		else if (IsPortActive(pActInfo, IN_STOP))
		{
			m_processNode = false;
		}
		break;		
	case eFE_Initialize:
		m_distanceOnPath = GetPortFloat(pActInfo, IN_START_DISTANCE);
		m_speed					= GetPortFloat(pActInfo, IN_SPEED);
		m_desiredSpeed	= GetPortFloat(pActInfo, IN_DESIREDSPEED);


		std::vector<Vec3> temp;
		temp.resize(1000);
		uint32 count = gEnv->pAISystem->GetINavigation()->GetPath(GetPortString(pActInfo, IN_PATH), &temp[0], 1000);
		temp.resize(count);

		m_path.SetPath(temp);
		m_splitCoachIndex = GetPortInt(pActInfo,IN_SPLIT_COACH);
		m_loopCount = 0;
		m_loopTotal = GetPortInt(pActInfo,IN_LOOPCOUNT);
		m_bXAxisFwd = GetPortBool(pActInfo, IN_XAXIS_FWD);
		m_bFirstUpdate = true;
		m_atEndOfPath = false;
		StopAllSounds();
		break;
	}
}