Fix close order

Close open audio streams (or at least give opportunity to do so)
This commit is contained in:
Flamefire committed 2014-05-06 18:37:46 +02:00
1 parent bafc79af15
commit c07526e195
8 files changed
+53 -55

No files matched your search

+26 -24
View File
@@ -107,26 +107,17 @@ namespace Vocaluxe
// Create folders
CSettings.CreateFolders();
Application.DoEvents();
_SplashScreen = new CSplashScreen();
Application.DoEvents();
// Init Draw
CLog.StartBenchmark("Init Draw");
if (!CDraw.InitDraw())
if (!CDraw.Init())
throw new CLoadingException("drawing");
CLog.StopBenchmark("Init Draw");
Application.DoEvents();
// Init Database
CLog.StartBenchmark("Init Database");
if (!CDataBase.Init())
throw new CLoadingException("database");
CLog.StopBenchmark("Init Database");
Application.DoEvents();
// Init Playback
CLog.StartBenchmark("Init Playback");
if (!CSound.Init())
@@ -143,6 +134,22 @@ namespace Vocaluxe
Application.DoEvents();
// Init VideoDecoder
CLog.StartBenchmark("Init Videodecoder");
if (!CVideo.Init())
throw new CLoadingException("video");
CLog.StopBenchmark("Init Videodecoder");
Application.DoEvents();
// Init Database
CLog.StartBenchmark("Init Database");
if (!CDataBase.Init())
throw new CLoadingException("database");
CLog.StopBenchmark("Init Database");
Application.DoEvents();
//Init Webcam
CLog.StartBenchmark("Init Webcam");
if (!CWebcam.Init())
@@ -172,14 +179,6 @@ namespace Vocaluxe
Application.DoEvents();
// Init VideoDecoder
CLog.StartBenchmark("Init Videodecoder");
if (!CVideo.Init())
throw new CLoadingException("video");
CLog.StopBenchmark("Init Videodecoder");
Application.DoEvents();
// Load Cover
CLog.StartBenchmark("Init Cover");
CCover.Init();
@@ -257,19 +256,22 @@ namespace Vocaluxe
private static void _CloseProgram()
{
// Unloading
// Unloading in reverse order
try
{
CVocaluxeServer.Close();
CController.Close();
CVocaluxeServer.Close();
CGraphics.Close();
CCover.Close();
CBackgroundMusic.Close();
CWebcam.Close();
CDataBase.Close();
CVideo.Close();
CRecord.Close();
CSound.Close();
CVideo.Close();
CDraw.Unload();
CDataBase.Close();
CWebcam.Close();
GC.Collect(); // Do a GC run here before we close logs to have finalizers run
CLog.CloseAll();
CLog.CloseAll(); // Do this last, so we get all log entries!
}
catch (Exception) {}
Environment.Exit(Environment.ExitCode);