Merge branch 'release-0.4.1' into develop
This commit is contained in:
commit
5d735503d3
15 files changed
+371
-81
No files matched your search
@@ -125,6 +125,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
|||||||
_AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]);
|
_AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]);
|
||||||
_NextPlayerStatics.Add(GetNewStatic(_Statics[_StaticNextPlayer]));
|
_NextPlayerStatics.Add(GetNewStatic(_Statics[_StaticNextPlayer]));
|
||||||
_AddStatic(_NextPlayerStatics[_NextPlayerStatics.Count - 1]);
|
_AddStatic(_NextPlayerStatics[_NextPlayerStatics.Count - 1]);
|
||||||
|
_NextPlayerStatics[_NextPlayerStatics.Count - 1].Aspect = EAspect.Crop;
|
||||||
}
|
}
|
||||||
_Statics[_StaticNextPlayer].Visible = false;
|
_Statics[_StaticNextPlayer].Visible = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,6 +98,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
|
|
||||||
_CreateFields();
|
_CreateFields();
|
||||||
_Buttons[_ButtonField].Visible = false;
|
_Buttons[_ButtonField].Visible = false;
|
||||||
|
|
||||||
|
_Statics[_StaticAvatarT1].Aspect = EAspect.Crop;
|
||||||
|
_Statics[_StaticAvatarT2].Aspect = EAspect.Crop;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool HandleInput(SKeyEvent keyEvent)
|
public override bool HandleInput(SKeyEvent keyEvent)
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ namespace Vocaluxe.Base
|
|||||||
private static Task _PreviewStartHelperTask;
|
private static Task _PreviewStartHelperTask;
|
||||||
private static int _PreviewStartWaitCounter;
|
private static int _PreviewStartWaitCounter;
|
||||||
private const int _PreviewStartWaitMaxTries = 10;
|
private const int _PreviewStartWaitMaxTries = 10;
|
||||||
|
private static readonly object _PreviewStartHelperTaskLock = new Object();
|
||||||
|
|
||||||
public static bool VideoEnabled
|
public static bool VideoEnabled
|
||||||
{
|
{
|
||||||
@@ -256,10 +257,17 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
if (_PreviewStartHelperTask != null && ( _PreviewPlayer.Length > 0 || _PreviewStartWaitCounter++ >= _PreviewStartWaitMaxTries))
|
if (_PreviewStartHelperTask != null && ( _PreviewPlayer.Length > 0 || _PreviewStartWaitCounter++ >= _PreviewStartWaitMaxTries))
|
||||||
{
|
{
|
||||||
_PreviewStartHelperTask.RunSynchronously(TaskScheduler.FromCurrentSynchronizationContext());
|
lock (_PreviewStartHelperTaskLock)
|
||||||
_PreviewStartHelperTask.Dispose();
|
{
|
||||||
_PreviewStartHelperTask = null;
|
// Recheck the condition as it cloud have change before we got the lock
|
||||||
_PreviewStartWaitCounter = 0;
|
if (_PreviewStartHelperTask != null && (_PreviewPlayer.Length > 0 || _PreviewStartWaitCounter++ >= _PreviewStartWaitMaxTries))
|
||||||
|
{
|
||||||
|
_PreviewStartHelperTask.RunSynchronously(TaskScheduler.FromCurrentSynchronizationContext());
|
||||||
|
_PreviewStartHelperTask.Dispose();
|
||||||
|
_PreviewStartHelperTask = null;
|
||||||
|
_PreviewStartWaitCounter = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsPlaying)
|
if (!IsPlaying)
|
||||||
@@ -317,28 +325,46 @@ namespace Vocaluxe.Base
|
|||||||
//Change song position only if song is changed or near to end
|
//Change song position only if song is changed or near to end
|
||||||
if (songChanged || _CurPlayer.Position + 30 < _CurPlayer.Length)
|
if (songChanged || _CurPlayer.Position + 30 < _CurPlayer.Length)
|
||||||
{
|
{
|
||||||
_PreviewStartHelperTask = new Task(() =>
|
lock (_PreviewStartHelperTaskLock)
|
||||||
{
|
{
|
||||||
float length = _PreviewPlayer.Length;
|
// Check if the old _PreviewStartHelperTask needs to disposed
|
||||||
if (length < 1)
|
if (_PreviewStartHelperTask != null)
|
||||||
length = 30; // If length is unknow or invalid assume a length of 30s
|
{
|
||||||
|
_PreviewStartHelperTask.Dispose();
|
||||||
|
}
|
||||||
|
_PreviewStartHelperTask = new Task(() =>
|
||||||
|
{
|
||||||
|
float length = _PreviewPlayer.Length;
|
||||||
|
if (length < 1)
|
||||||
|
length = 30; // If length is unknow or invalid assume a length of 30s
|
||||||
|
|
||||||
if (start < 0)
|
if (start < 0)
|
||||||
start = (song.Preview.Source == EDataSource.None) ? length / 4f : song.Preview.StartTime;
|
start = (song.Preview.Source == EDataSource.None) ? length / 4f : song.Preview.StartTime;
|
||||||
if (start > length - 5f)
|
if (start > length - 5f)
|
||||||
start = Math.Max(0f, Math.Min(length / 4f, length - 5f));
|
start = Math.Max(0f, Math.Min(length / 4f, length - 5f));
|
||||||
if (start >= 0.5f)
|
if (start >= 0.5f)
|
||||||
start -= 0.5f;
|
start -= 0.5f;
|
||||||
|
|
||||||
_PreviewPlayer.Position = start;
|
_PreviewPlayer.Position = start;
|
||||||
Play();
|
Play();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
_CurPlayer = _PreviewPlayer;
|
_CurPlayer = _PreviewPlayer;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_PreviewStartHelperTask.Dispose();
|
if (_PreviewStartHelperTask != null)
|
||||||
_PreviewStartHelperTask = null;
|
{
|
||||||
|
lock (_PreviewStartHelperTaskLock)
|
||||||
|
{
|
||||||
|
// Recheck the condition as it cloud have change before we got the lock
|
||||||
|
if (_PreviewStartHelperTask != null)
|
||||||
|
{
|
||||||
|
_PreviewStartHelperTask.Dispose();
|
||||||
|
_PreviewStartHelperTask = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
_PreviewPlayer.Position = _CurPlayer.Position;
|
_PreviewPlayer.Position = _CurPlayer.Position;
|
||||||
_CurPlayer = _PreviewPlayer;
|
_CurPlayer = _PreviewPlayer;
|
||||||
Play();
|
Play();
|
||||||
|
|||||||
+27
-11
@@ -236,13 +236,14 @@ namespace Vocaluxe.Base
|
|||||||
public static event OnSongMenuChanged SongMenuChanged;
|
public static event OnSongMenuChanged SongMenuChanged;
|
||||||
|
|
||||||
//Folders
|
//Folders
|
||||||
|
//We need full path for folders for matching folder path with textfile path when loading
|
||||||
public static readonly List<string> SongFolders = new List<string>
|
public static readonly List<string> SongFolders = new List<string>
|
||||||
{
|
{
|
||||||
#if INSTALLER
|
#if INSTALLER
|
||||||
Path.Combine(CSettings.DataFolder, CSettings.FolderNameSongs),
|
Path.Combine(CSettings.DataFolder, CSettings.FolderNameSongs),
|
||||||
CSettings.FolderNameSongs
|
Path.Combine(CSettings.ProgramFolder, FolderNameSongs)
|
||||||
#elif WIN
|
#elif WIN
|
||||||
CSettings.FolderNameSongs
|
Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameSongs)
|
||||||
#elif LINUX
|
#elif LINUX
|
||||||
Path.Combine(CSettings.DataFolder, CSettings.FolderNameSongs)
|
Path.Combine(CSettings.DataFolder, CSettings.FolderNameSongs)
|
||||||
#endif
|
#endif
|
||||||
@@ -380,15 +381,7 @@ namespace Vocaluxe.Base
|
|||||||
else
|
else
|
||||||
Config = xml.DeserializeString<SConfig>("<root />");
|
Config = xml.DeserializeString<SConfig>("<root />");
|
||||||
|
|
||||||
if (Config.Game.SongFolder.Length > 0 && Config.Game.SongFolder[0] != "")
|
NormalizeSongPaths();
|
||||||
{
|
|
||||||
SongFolders.Clear();
|
|
||||||
SongFolders.AddRange(Config.Game.SongFolder);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Config.Game.SongFolder = SongFolders.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Config.Game.MinLineBreakTime < 0)
|
if (Config.Game.MinLineBreakTime < 0)
|
||||||
Config.Game.MinLineBreakTime = 0.1f;
|
Config.Game.MinLineBreakTime = 0.1f;
|
||||||
@@ -680,6 +673,29 @@ namespace Vocaluxe.Base
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set song path if none is find in config and check if every path exists
|
||||||
|
/// </summary>
|
||||||
|
public static void NormalizeSongPaths()
|
||||||
|
{
|
||||||
|
//Check if there are configured songfolders
|
||||||
|
if (Config.Game.SongFolder.Length > 0 && Config.Game.SongFolder[0] != "")
|
||||||
|
{
|
||||||
|
SongFolders.Clear();
|
||||||
|
|
||||||
|
foreach (string folder in Config.Game.SongFolder)
|
||||||
|
{
|
||||||
|
//Check if folder exists
|
||||||
|
if (Directory.Exists(folder))
|
||||||
|
SongFolders.Add(folder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Test if songfolders are still empty or now empty
|
||||||
|
if(Config.Game.SongFolder.Length == 0)
|
||||||
|
Config.Game.SongFolder = SongFolders.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load command-line-parameters and their values to lists.
|
/// Load command-line-parameters and their values to lists.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
+24
-3
@@ -837,7 +837,14 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public void Close(ref CVideoStream stream)
|
public void Close(ref CVideoStream stream)
|
||||||
{
|
{
|
||||||
CVideo.Close(ref stream);
|
try
|
||||||
|
{
|
||||||
|
CVideo.Close(ref stream);
|
||||||
|
}
|
||||||
|
catch (NotSupportedException e)
|
||||||
|
{
|
||||||
|
CLog.LogError($"Clould not close the background video: {e.Message}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetLoop(CVideoStream stream, bool loop = true)
|
public void SetLoop(CVideoStream stream, bool loop = true)
|
||||||
@@ -847,12 +854,26 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public void Pause(CVideoStream stream)
|
public void Pause(CVideoStream stream)
|
||||||
{
|
{
|
||||||
CVideo.Pause(stream);
|
try
|
||||||
|
{
|
||||||
|
CVideo.Pause(stream);
|
||||||
|
}
|
||||||
|
catch (NotSupportedException e)
|
||||||
|
{
|
||||||
|
CLog.LogError($"Clould not pause the background video: {e.Message}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Resume(CVideoStream stream)
|
public void Resume(CVideoStream stream)
|
||||||
{
|
{
|
||||||
CVideo.Resume(stream);
|
try
|
||||||
|
{
|
||||||
|
CVideo.Resume(stream);
|
||||||
|
}
|
||||||
|
catch (NotSupportedException e)
|
||||||
|
{
|
||||||
|
CLog.LogError($"Clould not resume the background video: {e.Message}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
using Vocaluxe.Lib.Video;
|
using Vocaluxe.Lib.Video;
|
||||||
using VocaluxeLib;
|
using VocaluxeLib;
|
||||||
|
|
||||||
@@ -61,6 +62,10 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static CVideoStream Load(string videoFileName)
|
public static CVideoStream Load(string videoFileName)
|
||||||
{
|
{
|
||||||
|
if (_VideoDecoder == null)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException("_VideoDecoder is null (already closed?)");
|
||||||
|
}
|
||||||
return _VideoDecoder.Load(videoFileName);
|
return _VideoDecoder.Load(videoFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,41 +78,109 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static float GetLength(CVideoStream stream)
|
public static float GetLength(CVideoStream stream)
|
||||||
{
|
{
|
||||||
|
if (stream == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("stream is null");
|
||||||
|
}
|
||||||
|
if (_VideoDecoder == null)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException("_VideoDecoder is null (already closed?)");
|
||||||
|
}
|
||||||
|
|
||||||
return _VideoDecoder.GetLength(stream);
|
return _VideoDecoder.GetLength(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool GetFrame(CVideoStream stream, float time)
|
public static bool GetFrame(CVideoStream stream, float time)
|
||||||
{
|
{
|
||||||
|
if (stream == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("stream is null");
|
||||||
|
}
|
||||||
|
if (_VideoDecoder == null)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException("_VideoDecoder is null (already closed?)");
|
||||||
|
}
|
||||||
|
|
||||||
return _VideoDecoder.GetFrame(stream, time);
|
return _VideoDecoder.GetFrame(stream, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool Skip(CVideoStream stream, float start, float gap)
|
public static bool Skip(CVideoStream stream, float start, float gap)
|
||||||
{
|
{
|
||||||
|
if (stream == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("stream is null");
|
||||||
|
}
|
||||||
|
if (_VideoDecoder == null)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException("_VideoDecoder is null (already closed?)");
|
||||||
|
}
|
||||||
|
|
||||||
return _VideoDecoder.Skip(stream, start, gap);
|
return _VideoDecoder.Skip(stream, start, gap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetLoop(CVideoStream stream, bool loop)
|
public static void SetLoop(CVideoStream stream, bool loop)
|
||||||
{
|
{
|
||||||
|
if (stream == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("stream is null");
|
||||||
|
}
|
||||||
|
if (_VideoDecoder == null)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException("_VideoDecoder is null (already closed?)");
|
||||||
|
}
|
||||||
|
|
||||||
_VideoDecoder.SetLoop(stream, loop);
|
_VideoDecoder.SetLoop(stream, loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Pause(CVideoStream stream)
|
public static void Pause(CVideoStream stream)
|
||||||
{
|
{
|
||||||
|
if (stream == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("stream is null");
|
||||||
|
}
|
||||||
|
if (_VideoDecoder == null)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException("_VideoDecoder is null (already closed?)");
|
||||||
|
}
|
||||||
|
|
||||||
_VideoDecoder.Pause(stream);
|
_VideoDecoder.Pause(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Resume(CVideoStream stream)
|
public static void Resume(CVideoStream stream)
|
||||||
{
|
{
|
||||||
|
if (stream == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("stream is null");
|
||||||
|
}
|
||||||
|
if (_VideoDecoder == null)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException("_VideoDecoder is null (already closed?)");
|
||||||
|
}
|
||||||
|
|
||||||
_VideoDecoder.Resume(stream);
|
_VideoDecoder.Resume(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool Finished(CVideoStream stream)
|
public static bool Finished(CVideoStream stream)
|
||||||
{
|
{
|
||||||
|
if (stream == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("stream is null");
|
||||||
|
}
|
||||||
|
if (_VideoDecoder == null)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException("_VideoDecoder is null (already closed?)");
|
||||||
|
}
|
||||||
|
|
||||||
return _VideoDecoder.Finished(stream);
|
return _VideoDecoder.Finished(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Update()
|
public static void Update()
|
||||||
{
|
{
|
||||||
|
if (_VideoDecoder == null)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException("_VideoDecoder is null (already closed?)");
|
||||||
|
}
|
||||||
|
|
||||||
_VideoDecoder.Update();
|
_VideoDecoder.Update();
|
||||||
}
|
}
|
||||||
#endregion Interface
|
#endregion Interface
|
||||||
|
|||||||
@@ -53,6 +53,10 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
_VideoTimer.Reset();
|
_VideoTimer.Reset();
|
||||||
_Finished = false;
|
_Finished = false;
|
||||||
|
if (_VideoStream == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
//CVideo.VdSkip(_VideoStream, 0f, 0f);
|
//CVideo.VdSkip(_VideoStream, 0f, 0f);
|
||||||
_VideoTimer.Start();
|
_VideoTimer.Start();
|
||||||
CVideo.Resume(_VideoStream);
|
CVideo.Resume(_VideoStream);
|
||||||
@@ -60,12 +64,19 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public void Pause()
|
public void Pause()
|
||||||
{
|
{
|
||||||
CVideo.Pause(_VideoStream);
|
if (_VideoStream != null)
|
||||||
|
{
|
||||||
|
CVideo.Pause(_VideoStream);
|
||||||
|
}
|
||||||
_VideoTimer.Stop();
|
_VideoTimer.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Resume()
|
public void Resume()
|
||||||
{
|
{
|
||||||
|
if (_VideoStream == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
CVideo.Resume(_VideoStream);
|
CVideo.Resume(_VideoStream);
|
||||||
_VideoTimer.Start();
|
_VideoTimer.Start();
|
||||||
}
|
}
|
||||||
@@ -92,7 +103,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public void PreLoad()
|
public void PreLoad()
|
||||||
{
|
{
|
||||||
if (!_Loaded)
|
if (!_Loaded || _VideoStream == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -111,7 +122,10 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
CVideo.Close(ref _VideoStream);
|
if (_VideoStream != null)
|
||||||
|
{
|
||||||
|
CVideo.Close(ref _VideoStream);
|
||||||
|
}
|
||||||
_Loaded = false;
|
_Loaded = false;
|
||||||
_Finished = false;
|
_Finished = false;
|
||||||
_VideoTimer.Reset();
|
_VideoTimer.Reset();
|
||||||
|
|||||||
@@ -74,12 +74,23 @@ namespace Vocaluxe.Lib.Sound
|
|||||||
}
|
}
|
||||||
lock (_Mutex)
|
lock (_Mutex)
|
||||||
{
|
{
|
||||||
|
if (_Disposed)
|
||||||
|
return;
|
||||||
Debug.Assert(_RefCount > 0);
|
Debug.Assert(_RefCount > 0);
|
||||||
_RefCount--;
|
_RefCount--;
|
||||||
if (_RefCount == 0)
|
if (_RefCount == 0)
|
||||||
PortAudio.Pa_Terminate();
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
PortAudio.Pa_Terminate();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
CLog.LogError(errorText: $"Error disposing PortAudio: {ex.Message}", e: ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_Disposed = true;
|
||||||
}
|
}
|
||||||
_Disposed = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
@@ -100,11 +111,11 @@ namespace Vocaluxe.Lib.Sound
|
|||||||
double sampleRate, uint framesPerBuffer, PortAudio.PaStreamFlags streamFlags,
|
double sampleRate, uint framesPerBuffer, PortAudio.PaStreamFlags streamFlags,
|
||||||
PortAudio.PaStreamCallbackDelegate streamCallback, IntPtr userData)
|
PortAudio.PaStreamCallbackDelegate streamCallback, IntPtr userData)
|
||||||
{
|
{
|
||||||
if (_Disposed)
|
|
||||||
throw new ObjectDisposedException("PortAudioHandle already disposed");
|
|
||||||
|
|
||||||
lock (_Mutex)
|
lock (_Mutex)
|
||||||
{
|
{
|
||||||
|
if (_Disposed)
|
||||||
|
throw new ObjectDisposedException("PortAudioHandle already disposed");
|
||||||
|
|
||||||
PortAudio.PaError res = PortAudio.Pa_OpenStream(out stream, ref inputParameters, ref outputParameters, sampleRate, framesPerBuffer, streamFlags, streamCallback,
|
PortAudio.PaError res = PortAudio.Pa_OpenStream(out stream, ref inputParameters, ref outputParameters, sampleRate, framesPerBuffer, streamFlags, streamCallback,
|
||||||
userData);
|
userData);
|
||||||
if (res == PortAudio.PaError.paNoError)
|
if (res == PortAudio.PaError.paNoError)
|
||||||
@@ -157,12 +168,19 @@ namespace Vocaluxe.Lib.Sound
|
|||||||
|
|
||||||
public void CloseStream(IntPtr stream)
|
public void CloseStream(IntPtr stream)
|
||||||
{
|
{
|
||||||
if (_Disposed)
|
|
||||||
throw new ObjectDisposedException("PortAudioHandle already disposed");
|
|
||||||
|
|
||||||
lock (_Mutex)
|
lock (_Mutex)
|
||||||
{
|
{
|
||||||
PortAudio.Pa_CloseStream(stream);
|
if (_Disposed)
|
||||||
|
throw new ObjectDisposedException("PortAudioHandle already disposed");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
PortAudio.Pa_CloseStream(stream);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
CLog.LogError(errorText:$"Error closing stream: {ex.Message}", e:ex);
|
||||||
|
}
|
||||||
_Streams.Remove(stream);
|
_Streams.Remove(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Vocaluxe.Base;
|
using Vocaluxe.Base;
|
||||||
@@ -142,9 +144,13 @@ namespace Vocaluxe.Lib.Sound.Record.PortAudio
|
|||||||
|
|
||||||
foreach (IntPtr handle in _RecHandle)
|
foreach (IntPtr handle in _RecHandle)
|
||||||
{
|
{
|
||||||
PortAudioSharp.PortAudio.Pa_StopStream(handle);
|
if (handle != IntPtr.Zero)
|
||||||
PortAudioSharp.PortAudio.Pa_CloseStream(handle);
|
{
|
||||||
|
PortAudioSharp.PortAudio.Pa_StopStream(handle);
|
||||||
|
PortAudioSharp.PortAudio.Pa_CloseStream(handle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
_RecHandle = new IntPtr[_Devices.Count];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,13 +159,17 @@ namespace Vocaluxe.Lib.Sound.Record.PortAudio
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public override void Close()
|
public override void Close()
|
||||||
{
|
{
|
||||||
if (_RecHandle != null)
|
if (_RecHandle != null && _RecHandle.Length > 0)
|
||||||
{
|
{
|
||||||
foreach (IntPtr handle in _RecHandle)
|
foreach (IntPtr handle in _RecHandle)
|
||||||
{
|
{
|
||||||
if (handle != IntPtr.Zero)
|
if (handle != IntPtr.Zero)
|
||||||
|
{
|
||||||
_PaHandle.CloseStream(handle);
|
_PaHandle.CloseStream(handle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_RecHandle = new IntPtr[_Devices.Count];
|
||||||
}
|
}
|
||||||
if (_PaHandle != null)
|
if (_PaHandle != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -429,7 +429,18 @@ namespace Vocaluxe.Lib.Video.Acinerella
|
|||||||
private bool _CopyDecodedFrameToBuffer()
|
private bool _CopyDecodedFrameToBuffer()
|
||||||
{
|
{
|
||||||
bool result;
|
bool result;
|
||||||
var decoder = (SACDecoder)Marshal.PtrToStructure(_Videodecoder, typeof(SACDecoder));
|
SACDecoder decoder;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
decoder = (SACDecoder)Marshal.PtrToStructure(_Videodecoder, typeof(SACDecoder));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
CLog.LogError("Couldn't copy the frame to the managed environment.", false, false, e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (decoder.Buffer != IntPtr.Zero)
|
if (decoder.Buffer != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
_LastDecodedTime = (float)decoder.Timecode;
|
_LastDecodedTime = (float)decoder.Timecode;
|
||||||
|
|||||||
+98
-1
@@ -285,23 +285,120 @@ namespace Vocaluxe
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
CController.Close();
|
CController.Close();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
CLog.LogError("Error during shutdown! (CController)", false, false, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
CVocaluxeServer.Close();
|
CVocaluxeServer.Close();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
CLog.LogError("Error during shutdown! (CVocaluxeServer)", false, false, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
CGraphics.Close();
|
CGraphics.Close();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
CLog.LogError("Error during shutdown! (CGraphics)", false, false, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
CThemes.Close();
|
CThemes.Close();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
CLog.LogError("Error during shutdown! (CThemes)", false, false, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
CCover.Close();
|
CCover.Close();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
CLog.LogError("Error during shutdown! (CCover)", false, false, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
CFonts.Close();
|
CFonts.Close();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
CLog.LogError("Error during shutdown! (CFonts)", false, false, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
CBackgroundMusic.Close();
|
CBackgroundMusic.Close();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
CLog.LogError("Error during shutdown! (CBackgroundMusic)", false, false, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
CWebcam.Close();
|
CWebcam.Close();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
CLog.LogError("Error during shutdown! (CWebcam)", false, false, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
CDataBase.Close();
|
CDataBase.Close();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
CLog.LogError("Error during shutdown! (CDataBase)", false, false, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
CVideo.Close();
|
CVideo.Close();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
CLog.LogError("Error during shutdown! (CVideo)", false, false, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
CRecord.Close();
|
CRecord.Close();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
CLog.LogError("Error during shutdown! (CRecord)", false, false, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
CSound.Close();
|
CSound.Close();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
CLog.LogError("Error during shutdown! (CSound)", false, false, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
CDraw.Close();
|
CDraw.Close();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
CLog.LogError("Error during shutdown!", false, false, e);
|
CLog.LogError("Error during shutdown! (CDraw)", false, false, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
GC.Collect(); // Do a GC run here before we close logs to have finalizers run
|
GC.Collect(); // Do a GC run here before we close logs to have finalizers run
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -138,6 +138,9 @@ namespace Vocaluxe.Screens
|
|||||||
_SetVisibility();
|
_SetVisibility();
|
||||||
_UpdateRatings();
|
_UpdateRatings();
|
||||||
_SlideShowBG.Visible = _UpdateBackground();
|
_SlideShowBG.Visible = _UpdateBackground();
|
||||||
|
|
||||||
|
for (int p = 0; p < CGame.NumPlayers; p++)
|
||||||
|
_Statics[_StaticAvatar[p, CGame.NumPlayers - 1]].Aspect = EAspect.Crop;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool UpdateGame()
|
public override bool UpdateGame()
|
||||||
|
|||||||
@@ -220,8 +220,6 @@ namespace Vocaluxe.Screens
|
|||||||
CConfig.Config.Theme.PlayerInfo = (EPlayerInfo)mode;
|
CConfig.Config.Theme.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:
|
||||||
@@ -634,7 +632,6 @@ namespace Vocaluxe.Screens
|
|||||||
for (int p = 0; p < CGame.NumPlayers; p++)
|
for (int p = 0; p < CGame.NumPlayers; p++)
|
||||||
_ProgressBars[_PlayerProgressBarRating[p]].Reset();
|
_ProgressBars[_PlayerProgressBarRating[p]].Reset();
|
||||||
|
|
||||||
_SetDuetLyricsVisibility(song.IsDuet);
|
|
||||||
_SetNormalLyricsVisibility();
|
_SetNormalLyricsVisibility();
|
||||||
|
|
||||||
_TimerSongText.Reset();
|
_TimerSongText.Reset();
|
||||||
@@ -647,37 +644,36 @@ namespace Vocaluxe.Screens
|
|||||||
_StartSong();
|
_StartSong();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _SetDuetLyricsVisibility(bool isDuet)
|
|
||||||
{
|
|
||||||
_Statics[_StaticLyricsDuet].Visible = isDuet;
|
|
||||||
_Lyrics[_LyricMainDuet].Visible = isDuet;
|
|
||||||
_Lyrics[_LyricSubDuet].Visible = isDuet;
|
|
||||||
|
|
||||||
if (isDuet)
|
|
||||||
{
|
|
||||||
_Lyrics[_LyricMainTop].Visible = false;
|
|
||||||
_Lyrics[_LyricSubTop].Visible = false;
|
|
||||||
_Statics[_StaticLyricsTop].Visible = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bool lyricsOnTop = CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_TOP
|
|
||||||
|| CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH
|
|
||||||
|| (CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsTop);
|
|
||||||
_Lyrics[_LyricMainTop].Visible = lyricsOnTop;
|
|
||||||
_Lyrics[_LyricSubTop].Visible = lyricsOnTop;
|
|
||||||
_Statics[_StaticLyricsTop].Visible = lyricsOnTop;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void _SetNormalLyricsVisibility()
|
private void _SetNormalLyricsVisibility()
|
||||||
{
|
{
|
||||||
bool visible = CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTTOM
|
bool bottomLyricsVisible = CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTTOM
|
||||||
|| CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH
|
|| CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH
|
||||||
|| (CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsBottom);
|
|| (CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsBottom);
|
||||||
_Lyrics[_LyricMain].Visible = visible;
|
|
||||||
_Lyrics[_LyricSub].Visible = visible;
|
bool topLyricsVisible = CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_TOP
|
||||||
_Statics[_StaticLyrics].Visible = visible;
|
|| CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH
|
||||||
|
|| (CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsTop);
|
||||||
|
|
||||||
|
bool duetLyricsVisible = false;
|
||||||
|
|
||||||
|
if (CGame.GetSong() != null && CGame.GetSong().IsDuet)
|
||||||
|
{
|
||||||
|
bottomLyricsVisible = true;
|
||||||
|
topLyricsVisible = false;
|
||||||
|
duetLyricsVisible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
_Lyrics[_LyricMain].Visible = bottomLyricsVisible;
|
||||||
|
_Lyrics[_LyricSub].Visible = bottomLyricsVisible;
|
||||||
|
_Statics[_StaticLyrics].Visible = bottomLyricsVisible;
|
||||||
|
|
||||||
|
_Lyrics[_LyricMainTop].Visible = topLyricsVisible;
|
||||||
|
_Lyrics[_LyricSubTop].Visible = topLyricsVisible;
|
||||||
|
_Statics[_StaticLyricsTop].Visible = topLyricsVisible;
|
||||||
|
|
||||||
|
_Lyrics[_LyricMainDuet].Visible = duetLyricsVisible;
|
||||||
|
_Lyrics[_LyricSubDuet].Visible = duetLyricsVisible;
|
||||||
|
_Statics[_StaticLyricsDuet].Visible = duetLyricsVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _StartSong()
|
private void _StartSong()
|
||||||
|
|||||||
@@ -469,6 +469,7 @@ namespace VocaluxeLib.Menu
|
|||||||
Text = new CText(0, 0, 0, _TextH, _MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, _TextColor, "T", _PartyModeID),
|
Text = new CText(0, 0, 0, _TextH, _MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, _TextColor, "T", _PartyModeID),
|
||||||
Img = new CStatic(_PartyModeID)
|
Img = new CStatic(_PartyModeID)
|
||||||
};
|
};
|
||||||
|
el.Img.Aspect = EAspect.Crop;
|
||||||
_VisibleElements.Add(el);
|
_VisibleElements.Add(el);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace VocaluxeLib.Profile
|
|||||||
{
|
{
|
||||||
Avatar = CBase.Profiles.GetAvatarByFilename(value);
|
Avatar = CBase.Profiles.GetAvatarByFilename(value);
|
||||||
if (Avatar == null)
|
if (Avatar == null)
|
||||||
throw new Exception("Avatar '" + value + "' not found");
|
CBase.Log.LogError("Avatar '" + value + "' not found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user