Esempio n. 1
0
const std::vector <float> & REPLAY::PlayFrame(CAR & car)
{
	if (!GetPlaying())
	{
		return inputbuffer;
	}

	frame++;

	assert(inputbuffer.size() == CARINPUT::GAME_ONLY_INPUTS_START_HERE);
	assert((unsigned int) version_info.inputs_supported == CARINPUT::GAME_ONLY_INPUTS_START_HERE);

	//fast forward through the inputframes until we're up to date
	while (cur_inputframe < inputframes.size() && inputframes[cur_inputframe].GetFrame() <= frame)
	{
		ProcessPlayInputFrame(inputframes[cur_inputframe]);
		cur_inputframe++;
	}

	//fast forward through the stateframes until we're up to date
	while (cur_stateframe < stateframes.size() && stateframes[cur_stateframe].GetFrame() <= frame)
	{
		if (stateframes[cur_stateframe].GetFrame() == frame) ProcessPlayStateFrame(stateframes[cur_stateframe], car);
		cur_stateframe++;
	}

	//detect end of input
	if (cur_stateframe == stateframes.size() && cur_inputframe == inputframes.size())
	{
		StopPlaying();
	}

	return inputbuffer;
}
Esempio n. 2
0
void LoopingBuffer::SetVolume(float _level)
{
	volume_ = _level < 0 ? 0 : _level > 1 ? 1 : _level;
	if(GetPlaying())
	{
		SoundManager::Instance().SetVolume(channel_, volume_);
	}
}
Esempio n. 3
0
void LoopingBuffer::Stop()
{
	if(GetPlaying())
	{
		SoundManager::Instance().StopChannel(channel_);
		channel_ = -1;
		running_count_--;
		Logger::DiagnosticOut() << "Active loops--= " << running_count_ << "\n";
	}
}
Esempio n. 4
0
const std::vector<float> & Replay::PlayFrame(unsigned carid, CarDynamics & car)
{
	assert(carid < carstate.size());
	assert(unsigned(version_info.inputs_supported) == CarInput::INVALID);

	if (GetPlaying() && !carstate[carid].PlayFrame(car))
	{
		replaymode = IDLE;
	}
	return carstate[carid].inputbuffer;
}
Esempio n. 5
0
const std::vector<float> & REPLAY::PlayFrame(unsigned carid, CAR & car)
{
	assert(carid < carstate.size());
	assert(unsigned(version_info.inputs_supported) == CARINPUT::GAME_ONLY_INPUTS_START_HERE);

	if (GetPlaying() && !carstate[carid].PlayFrame(car))
	{
		replaymode = IDLE;
	}
	return carstate[carid].inputbuffer;
}
Esempio n. 6
0
void LoopingBuffer::Start()
{
	if(filename_.length() == 0)
		return;
	if(!GetPlaying())
	{
		channel_ = SoundManager::Instance().PlayLoopingSample(filename_);
		SoundManager::Instance().SetVolume(channel_, volume_);
		running_count_++;
		Logger::DiagnosticOut() << "Active loops++=" << running_count_ << "\n";
	}
}
		bool GetStopped(void) const { return !GetPlaying(); }