Esempio n. 1
0
void AudioController::OnSubtitlesSave()
{
	if (IsAudioOpen())
		context->ass->SetScriptInfo("Audio URI", config::path->MakeRelative(audio_url, "?script").generic_string());
	else
		context->ass->SetScriptInfo("Audio URI", "");
}
Esempio n. 2
0
void AudioController::PlayToEndOfPrimary(int start_ms)
{
	if (!IsAudioOpen()) return;

	PlayRange(TimeRange(start_ms, GetPrimaryPlaybackRange().end()));
	if (playback_mode == PM_Range)
		playback_mode = PM_PrimaryRange;
}
Esempio n. 3
0
void AudioController::Stop()
{
	if (!IsAudioOpen()) return;

	player->Stop();
	playback_mode = PM_NotPlaying;
	playback_timer.Stop();

	AnnouncePlaybackStop();
}
Esempio n. 4
0
void AudioController::PlayRange(const TimeRange &range)
{
	if (!IsAudioOpen()) return;

	player->Play(SamplesFromMilliseconds(range.begin()), SamplesFromMilliseconds(range.length()));
	playback_mode = PM_Range;
	playback_timer.Start(20);

	AnnouncePlaybackPosition(range.begin());
}
Esempio n. 5
0
void AudioController::PlayToEnd(int64_t start_sample)
{
	if (!IsAudioOpen()) return;

	player->Play(start_sample, provider->GetNumSamples()-start_sample);
	playback_mode = PM_ToEnd;
	playback_timer.Start(20);

	AnnouncePlaybackPosition(start_sample);
}
Esempio n. 6
0
void AudioController::OnSubtitlesSave()
{
	if (IsAudioOpen())
	{
		context->ass->SetScriptInfo("Audio URI", MakeRelativePath(audio_url, context->ass->filename));
	}
	else
	{
		context->ass->SetScriptInfo("Audio URI", "");
	}
}
Esempio n. 7
0
void AudioController::OnAudioPlayerChanged()
{
	if (!IsAudioOpen()) return;

	Stop();

	delete player;

	try
	{
		player = AudioPlayerFactory::GetAudioPlayer(provider);
	}
	catch (...)
	{
		CloseAudio();
		throw;
	}
}
Esempio n. 8
0
void AudioController::SetVolume(double volume)
{
	if (!IsAudioOpen()) return;
	player->SetVolume(volume);
}
Esempio n. 9
0
double AudioController::GetVolume() const
{
	if (!IsAudioOpen()) return 1.0;
	return player->GetVolume();
}
Esempio n. 10
0
bool AudioController::IsPlaying()
{
	return IsAudioOpen() && playback_mode != PM_NotPlaying;
}
Esempio n. 11
0
void AudioController::OnAudioProviderChanged()
{
	if (IsAudioOpen())
		// url is cloned because CloseAudio clears it and OpenAudio takes a const reference
		OpenAudio(audio_url.Clone());
}