Merge branch 'develop' of github.com:Vocaluxe/Vocaluxe into develop

This commit is contained in:
Florian Küpper committed 2013-03-30 13:36:42 +01:00
commit cc730e4e88
2 files changed
+44 -29

No files matched your search

+18 -11
View File
@@ -45,6 +45,9 @@ GstreamerAudioStream::~GstreamerAudioStream(void)
Close(); Close();
} }
// Loads a stream but does not wait for it to get initialized,
// so querying duration or position directly after initialization might
// return strange values! To work around this use the prescan load function!
int GstreamerAudioStream::Load(const wchar_t* Media) int GstreamerAudioStream::Load(const wchar_t* Media)
{ {
Element = gst_element_factory_make("playbin", "playbin"); Element = gst_element_factory_make("playbin", "playbin");
@@ -71,15 +74,18 @@ int GstreamerAudioStream::Load(const wchar_t* Media)
g_object_set(Element, "flags", GST_PLAY_FLAG_AUDIO, NULL); g_object_set(Element, "flags", GST_PLAY_FLAG_AUDIO, NULL);
gst_element_set_state(Element, GST_STATE_PAUSED); gst_element_set_state(Element, GST_STATE_PAUSED);
gst_bus_timed_pop_filtered(Bus, -1, GST_MESSAGE_ASYNC_DONE); //gst_bus_timed_pop_filtered(Bus, -1, GST_MESSAGE_ASYNC_DONE);
RefreshDuration(); RefreshDuration();
return ID; return ID;
} }
//Loads a stream and waits for its initialization
int GstreamerAudioStream::Load(const wchar_t* Media, bool Prescan) int GstreamerAudioStream::Load(const wchar_t* Media, bool Prescan)
{ {
Load(Media); Load(Media);
if(Prescan)
gst_bus_timed_pop_filtered(Bus, -1, GST_MESSAGE_ASYNC_DONE);
return ID; return ID;
} }
@@ -87,21 +93,22 @@ void GstreamerAudioStream::Close(void)
{ {
if(Element) if(Element)
gst_element_set_state(Element, GST_STATE_NULL); gst_element_set_state(Element, GST_STATE_NULL);
if(Bus) if(Bus)
g_object_unref(Bus); gst_object_unref(Bus);
if(Element) if(Element)
g_object_unref(Element); gst_object_unref(Element);
if(Message)
gst_message_unref(Message);
if(Convert) if(Convert)
g_object_unref(Convert); gst_object_unref(Convert);
if(Audiosink) if(Audiosink)
g_object_unref(Audiosink); gst_object_unref(Audiosink);
if(Pad) if(Pad)
g_object_unref(Pad); gst_object_unref(Pad);
if(GhostPad) if(GhostPad)
g_object_unref(GhostPad); gst_object_unref(GhostPad);
if(SinkBin) if(SinkBin)
g_object_unref(SinkBin); gst_object_unref(SinkBin);
if(FadeTimer) if(FadeTimer)
g_timer_destroy (FadeTimer); g_timer_destroy (FadeTimer);
@@ -220,14 +227,14 @@ void GstreamerAudioStream::FadeAndPause(float TargetVolume, float Seconds)
{ {
PauseStreamAfterFade = true; PauseStreamAfterFade = true;
Fade(TargetVolume, FadeTime); Fade(TargetVolume, Seconds);
} }
void GstreamerAudioStream::FadeAndStop(float TargetVolume, float Seconds) void GstreamerAudioStream::FadeAndStop(float TargetVolume, float Seconds)
{ {
CloseStreamAfterFade = true; CloseStreamAfterFade = true;
Fade(TargetVolume, FadeTime); Fade(TargetVolume, Seconds);
} }
bool GstreamerAudioStream::IsPlaying() bool GstreamerAudioStream::IsPlaying()
+26 -18
View File
@@ -210,6 +210,8 @@ namespace Vocaluxe.Screens
CConfig.PlayerInfo = (EPlayerInfo)mode; CConfig.PlayerInfo = (EPlayerInfo)mode;
CConfig.SaveConfig(); CConfig.SaveConfig();
SetVisibility(); SetVisibility();
if (CGame.GetSong() != null)
SetDuetLyricsVisibility(CGame.GetSong().IsDuet); //make sure duet lyrics remain visible
break; break;
case Keys.S: case Keys.S:
@@ -635,7 +637,7 @@ namespace Vocaluxe.Screens
SingNotes[htSingNotes(SingBars)].Reset(); SingNotes[htSingNotes(SingBars)].Reset();
bool LyricsOnTop = (CGame.NumPlayer != 1) && CConfig.LyricsOnTop == EOffOn.TR_CONFIG_ON;
if (song.IsDuet) if (song.IsDuet)
{ {
Texts[htTexts(TextDuetName1)].Text = song.DuetPart1; Texts[htTexts(TextDuetName1)].Text = song.DuetPart1;
@@ -659,24 +661,9 @@ namespace Vocaluxe.Screens
CGame.Player[i].LineNr = duet_player[i]; CGame.Player[i].LineNr = duet_player[i];
} }
} }
Statics[htStatics(StaticLyricsDuet)].Visible = true;
Lyrics[htLyrics(LyricMainDuet)].Visible = true;
Lyrics[htLyrics(LyricSubDuet)].Visible = true;
Lyrics[htLyrics(LyricMainTop)].Visible = false;
Lyrics[htLyrics(LyricSubTop)].Visible = false;
Statics[htStatics(StaticLyricsTop)].Visible = false;
}
else
{
Statics[htStatics(StaticLyricsDuet)].Visible = false;
Lyrics[htLyrics(LyricMainDuet)].Visible = false;
Lyrics[htLyrics(LyricSubDuet)].Visible = false;
Lyrics[htLyrics(LyricMainTop)].Visible = LyricsOnTop;
Lyrics[htLyrics(LyricSubTop)].Visible = LyricsOnTop;
Statics[htStatics(StaticLyricsTop)].Visible = LyricsOnTop;
} }
SetDuetLyricsVisibility(song.IsDuet);
for (int p = 0; p < CGame.NumPlayer; p++) for (int p = 0; p < CGame.NumPlayer; p++)
{ {
@@ -711,6 +698,27 @@ namespace Vocaluxe.Screens
StartSong(); StartSong();
} }
private void SetDuetLyricsVisibility(bool isDuet)
{
Statics[htStatics(StaticLyricsDuet)].Visible = isDuet;
Lyrics[htLyrics(LyricMainDuet)].Visible = isDuet;
Lyrics[htLyrics(LyricSubDuet)].Visible = isDuet;
if (isDuet)
{
Lyrics[htLyrics(LyricMainTop)].Visible = false;
Lyrics[htLyrics(LyricSubTop)].Visible = false;
Statics[htStatics(StaticLyricsTop)].Visible = false;
}
else
{
bool LyricsOnTop = (CGame.NumPlayer != 1) && CConfig.LyricsOnTop == EOffOn.TR_CONFIG_ON;
Lyrics[htLyrics(LyricMainTop)].Visible = LyricsOnTop;
Lyrics[htLyrics(LyricSubTop)].Visible = LyricsOnTop;
Statics[htStatics(StaticLyricsTop)].Visible = LyricsOnTop;
}
}
private void StartSong() private void StartSong()
{ {
PrepareTimeLine(); PrepareTimeLine();