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

This commit is contained in:
Florian Küpper committed 2013-01-04 15:08:27 +01:00
commit 597a838360
7 files changed
+82 -48

No files matched your search

+2
View File
@@ -51,6 +51,7 @@ namespace Vocaluxe.Base
InitHighscoreDB();
InitCoverDB();
InitCreditsRessourcesDB();
GC.Collect();
}
#region Highscores
@@ -1242,6 +1243,7 @@ namespace Vocaluxe.Base
{
_TransactionCover.Commit();
_TransactionCover = null;
GC.Collect();
}
}
+6
View File
@@ -1048,6 +1048,12 @@ namespace Vocaluxe.Base
STexture texture = song.CoverTextureSmall;
song.CoverTextureBig = texture;
_CoverLoadIndex++;
if (i % 100 == 0)
{
CDataBase.CommitCovers();
GC.Collect();
}
}
_CoverLoaded = true;
+10 -4
View File
@@ -37,6 +37,7 @@ namespace Vocaluxe.Lib.Sound
CloseAll();
AC = new AudioContext();
AC.MakeCurrent();
@@ -400,8 +401,8 @@ namespace Vocaluxe.Lib.Sound
class OpenAlStream
{
const int buffer_size = 16384;
const int buffer_count = 2;
const int buffer_size = 2048;
const int buffer_count = 5;
const long BUFSIZE = 50000L;
Object CloseMutex;
@@ -628,7 +629,12 @@ namespace Vocaluxe.Lib.Sound
try
{
_source = AL.GenSource();
_buffers = AL.GenBuffers(buffer_count);
_buffers = new int[buffer_count];
for (int i = 0; i < buffer_count; i++)
{
_buffers[i] = AL.GenBuffer();
}
_state = 0;
//AL.SourceQueueBuffers(_source, _buffers.Length, _buffers);
}
@@ -833,7 +839,7 @@ namespace Vocaluxe.Lib.Sound
AL.GetSource(_source, ALGetSourcei.BuffersQueued, out queued_count);
int processed_count = buffer_count;
if (queued_count != 0)
if (queued_count > 0)
{
AL.GetSource(_source, ALGetSourcei.BuffersProcessed, out processed_count);
doit = false;
+7 -6
View File
@@ -384,7 +384,8 @@ namespace Vocaluxe.Lib.Sound
class PortAudioStream
{
const long BUFSIZE = 50000L;
const long BUFSIZE = 1000000L;
const long BEGINREFILL = 800000L;
private CSyncTimer _SyncTimer;
private bool _Initialized;
@@ -649,7 +650,7 @@ namespace Vocaluxe.Lib.Sound
outputParams.suggestedLatency = _outputDeviceInfo.defaultLowOutputLatency;
uint bufsize = (uint)CConfig.AudioBufferSize;
errorCheck("OpenDefaultStream", PortAudio.Pa_OpenStream(
errorCheck("OpenDefaultStream (playback)", PortAudio.Pa_OpenStream(
out _Ptr,
IntPtr.Zero,
ref outputParams,
@@ -760,7 +761,7 @@ namespace Vocaluxe.Lib.Sound
bool DoIt = false;
lock (_LockData)
{
if (!_skip && BUFSIZE - 10000L > _data.BytesNotRead)
if (!_skip && BEGINREFILL > _data.BytesNotRead)
DoIt = true;
}
@@ -792,7 +793,7 @@ namespace Vocaluxe.Lib.Sound
{
_data.Write(Buffer);
_TimeCode = Timecode;
if (_data.BytesNotRead < BUFSIZE - 10000L)
if (_data.BytesNotRead < BEGINREFILL)
{
_waiting = false;
EventDecode.Set();
@@ -866,7 +867,7 @@ namespace Vocaluxe.Lib.Sound
}
}
if (_data.BytesNotRead < BUFSIZE - 10000L)
if (_data.BytesNotRead < BEGINREFILL)
{
EventDecode.Set();
_waiting = false;
@@ -901,7 +902,7 @@ namespace Vocaluxe.Lib.Sound
if (errorCode == PortAudio.PaError.paStreamIsNotStopped)
return false;
CLog.LogError(action + " error: " + PortAudio.Pa_GetErrorText(errorCode));
CLog.LogError(action + " error (playback): " + PortAudio.Pa_GetErrorText(errorCode));
if (errorCode == PortAudio.PaError.paUnanticipatedHostError)
{
PortAudio.PaHostErrorInfo errorInfo = PortAudio.Pa_GetLastHostErrorInfo();
+4 -4
View File
@@ -148,7 +148,7 @@ namespace Vocaluxe.Lib.Sound
inputParams.sampleFormat = PortAudio.PaSampleFormat.paInt16;
inputParams.suggestedLatency = PortAudio.Pa_GetDeviceInfo(_DeviceConfig[i].ID).defaultLowInputLatency;
if (errorCheck("OpenStream", PortAudio.Pa_OpenStream(
if (errorCheck("OpenStream (rec)", PortAudio.Pa_OpenStream(
out _recHandle[i],
ref inputParams,
IntPtr.Zero,
@@ -159,7 +159,7 @@ namespace Vocaluxe.Lib.Sound
new IntPtr(i))))
return false;
if (errorCheck("Start Stream", PortAudio.Pa_StartStream(_recHandle[i])))
if (errorCheck("Start Stream (rec)", PortAudio.Pa_StartStream(_recHandle[i])))
return false;
}
}
@@ -321,7 +321,7 @@ namespace Vocaluxe.Lib.Sound
}
catch (Exception e)
{
CLog.LogError("Error on Stream Callback: " + e.ToString());
CLog.LogError("Error on Stream Callback (rec): " + e.ToString());
}
return PortAudio.PaStreamCallbackResult.paContinue;
@@ -331,7 +331,7 @@ namespace Vocaluxe.Lib.Sound
{
if (errorCode != PortAudio.PaError.paNoError)
{
CLog.LogError(action + " error: " + PortAudio.Pa_GetErrorText(errorCode));
CLog.LogError(action + " error (rec): " + PortAudio.Pa_GetErrorText(errorCode));
if (errorCode == PortAudio.PaError.paUnanticipatedHostError)
{
PortAudio.PaHostErrorInfo errorInfo = PortAudio.Pa_GetLastHostErrorInfo();
+24 -14
View File
@@ -16,36 +16,35 @@ namespace Vocaluxe.Lib.Webcam
{
class CAForgeNet : IWebcam
{
private Bitmap _CurrentFrame = new Bitmap(1, 1);
private List<SWebcamDevice> _Devices = new List<SWebcamDevice>();
private bool _Paused;
private VideoCaptureDevice _Webcam;
private FilterInfoCollection _WebcamDevices;
private SWebcamConfig _Config;
byte[] data = new byte[1];
int _Width, _Height;
public void Close()
{
if (_Webcam != null)
{
_Webcam.SignalToStop();
_Webcam.WaitForStop();
_Webcam.NewFrame -= new NewFrameEventHandler(OnFrame);
data = new byte[1];
}
}
public bool GetFrame(ref STexture Frame)
{
if ((_CurrentFrame != null) && (_Webcam != null))
if (_Webcam != null && _Width > 0 && _Height > 0 && data.Length == _Width * _Height * 4)
{
lock (_CurrentFrame)
lock (data)
{
BitmapData bitmapdata = _CurrentFrame.LockBits(new Rectangle(0, 0, _CurrentFrame.Width, _CurrentFrame.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
byte[] data = new byte[4 * _CurrentFrame.Width * _CurrentFrame.Height];
Marshal.Copy(bitmapdata.Scan0, data, 0, data.Length);
_CurrentFrame.UnlockBits(bitmapdata);
if (((Frame.index == -1) || (_CurrentFrame.Width != Frame.width)) || (_CurrentFrame.Height != Frame.height))
if (Frame.index == -1 || _Width != Frame.width || _Height != Frame.height)
{
CDraw.RemoveTexture(ref Frame);
Frame = CDraw.AddTexture(_CurrentFrame.Width, _CurrentFrame.Height, ref data);
Frame = CDraw.AddTexture(_Width, _Height, ref data);
}
else
{
@@ -58,11 +57,15 @@ namespace Vocaluxe.Lib.Webcam
public Bitmap GetBitmap()
{
if ((_CurrentFrame != null) && (_Webcam != null))
if (_Webcam != null && _Width > 0 && _Height > 0 && data.Length == _Height * _Width * 4)
{
lock (_CurrentFrame)
lock (data)
{
return (Bitmap)_CurrentFrame.Clone();
Bitmap bmp = new Bitmap(_Width, _Height);
BitmapData bitmapdata = bmp.LockBits(new Rectangle(0, 0, _Width, _Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
Marshal.Copy(data, 0, bitmapdata.Scan0, data.Length);
bmp.UnlockBits(bitmapdata);
return bmp;
}
}
else
@@ -103,9 +106,16 @@ namespace Vocaluxe.Lib.Webcam
{
if (!_Paused)
{
lock (_CurrentFrame)
lock (data)
{
_CurrentFrame = (Bitmap) e.Frame.Clone();
if (_Width != e.Frame.Width || _Height != e.Frame.Height || data.Length != e.Frame.Width * e.Frame.Height * 4)
data = new byte[4 * e.Frame.Width * e.Frame.Height];
_Width = e.Frame.Width;
_Height = e.Frame.Height;
BitmapData bitmapdata = e.Frame.LockBits(new Rectangle(0, 0, _Width, _Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
Marshal.Copy(bitmapdata.Scan0, data, 0, data.Length);
e.Frame.UnlockBits(bitmapdata);
}
}
}
+29 -20
View File
@@ -165,33 +165,42 @@ namespace Vocaluxe.Screens
SWebcamDevice[] devices = CWebcam.GetDevices();
if (devices != null)
try
{
if (devices.Length > 0)
if (devices != null)
{
_DeviceNr = 0;
_CapabilityNr = 0;
GetFirstConfiguredWebcamDevice(ref _DeviceNr, ref _CapabilityNr);
foreach (SWebcamDevice d in devices)
if (devices.Length > 0)
{
SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].AddValue(d.Name);
}
SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection = _DeviceNr;
_DeviceNr = 0;
_CapabilityNr = 0;
GetFirstConfiguredWebcamDevice(ref _DeviceNr, ref _CapabilityNr);
foreach (SCapabilities c in devices[_DeviceNr].Capabilities)
{
SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].AddValue(c.Width.ToString() + " x " + c.Height.ToString() + " @ " + c.Framerate.ToString() + " FPS ");
foreach (SWebcamDevice d in devices)
{
SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].AddValue(d.Name);
}
SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection = _DeviceNr;
foreach (SCapabilities c in devices[_DeviceNr].Capabilities)
{
SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].AddValue(c.Width.ToString() + " x " + c.Height.ToString() + " @ " + c.Framerate.ToString() + " FPS ");
}
_Config.MonikerString = devices[SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection].MonikerString;
_Config.Width = devices[SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection].Capabilities[SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Selection].Width;
_Config.Height = devices[SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection].Capabilities[SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Selection].Height;
_Config.Framerate = devices[SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection].Capabilities[SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Selection].Framerate;
CWebcam.Close();
CWebcam.Select(CConfig.WebcamConfig);
CWebcam.Start();
}
_Config.MonikerString = devices[SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection].MonikerString;
_Config.Width = devices[SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection].Capabilities[SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Selection].Width;
_Config.Height = devices[SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection].Capabilities[SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Selection].Height;
_Config.Framerate = devices[SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection].Capabilities[SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Selection].Framerate;
CWebcam.Close();
CWebcam.Select(CConfig.WebcamConfig);
CWebcam.Start();
}
}
catch (Exception e)
{
CLog.LogError("Error on listing webcam capabilities: " + e.Message);
devices = null;
}
SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Visible = (devices != null && devices.Length > 0);
SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Visible = (devices != null && devices.Length > 0);
Statics[htStatics(StaticWebcamOutput)].Visible = (devices != null && devices.Length > 0);