Merge pull request #18 from Vocaluxe/release-0.1

merge Release 0.1 branch changes into develop branch
This commit is contained in:
Alexander Eckart committed 2012-03-08 07:43:32 -08:00
commit 243ecb8862
8 files changed
+254 -46

No files matched your search

+1 -1
View File
@@ -55,7 +55,7 @@
<!--Config: Song-Menu-Style--> <!--Config: Song-Menu-Style-->
<TR_CONFIG_LIST>Lista</TR_CONFIG_LIST> <TR_CONFIG_LIST>Lista</TR_CONFIG_LIST>
<TR_CONFIG_DREIDEL>Dreidel</TR_CONFIG_DREIDEL> <TR_CONFIG_DREIDEL>Dreidel</TR_CONFIG_DREIDEL>
<TR_CONFIG_TILE_BOARD>TileBoard</TR_CONFIG_TILE_BOARD> <TR_CONFIG_TILE_BOARD>Cuadrícula</TR_CONFIG_TILE_BOARD>
<TR_CONFIG_BOOK>Libro</TR_CONFIG_BOOK> <TR_CONFIG_BOOK>Libro</TR_CONFIG_BOOK>
<!--Config: Cover-Loading--> <!--Config: Cover-Loading-->
<TR_CONFIG_COVERLOADING_ONDEMAND>Según Sean Necesarias</TR_CONFIG_COVERLOADING_ONDEMAND> <TR_CONFIG_COVERLOADING_ONDEMAND>Según Sean Necesarias</TR_CONFIG_COVERLOADING_ONDEMAND>
+29 -1
View File
@@ -66,6 +66,19 @@ namespace Vocaluxe.Base
TR_CONFIG_LEVEL_MAX //all debug infos TR_CONFIG_LEVEL_MAX //all debug infos
} }
public enum EBufferSize
{
b0 = 0,
b512 = 512,
b1024 = 1024,
b1536 = 1536,
b2048 = 2048,
b2560 = 2560,
b3072 = 3072,
b3584 = 3584,
b4096 = 4096
}
public enum EPlaybackLib public enum EPlaybackLib
{ {
PortAudio, PortAudio,
@@ -177,7 +190,8 @@ namespace Vocaluxe.Base
// Sound // Sound
public static EPlaybackLib PlayBackLib = EPlaybackLib.PortAudio; public static EPlaybackLib PlayBackLib = EPlaybackLib.PortAudio;
public static ERecordLib RecordLib = ERecordLib.PortAudio; public static ERecordLib RecordLib = ERecordLib.PortAudio;
public static uint PortAudioBufferSize = 1024; public static EBufferSize AudioBufferSize = EBufferSize.b2048;
public static int AudioLatency = 100;
public static int BackgroundMusicVolume = 50; public static int BackgroundMusicVolume = 50;
public static EOffOn BackgroundMusic = EOffOn.TR_CONFIG_ON; public static EOffOn BackgroundMusic = EOffOn.TR_CONFIG_ON;
public static EBackgroundMusicSource BackgroundMusicSource = EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC; public static EBackgroundMusicSource BackgroundMusicSource = EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC;
@@ -286,6 +300,14 @@ namespace Vocaluxe.Base
#region Sound #region Sound
CHelper.TryGetEnumValueFromXML<EPlaybackLib>("//root/Sound/PlayBackLib", navigator, ref PlayBackLib); CHelper.TryGetEnumValueFromXML<EPlaybackLib>("//root/Sound/PlayBackLib", navigator, ref PlayBackLib);
CHelper.TryGetEnumValueFromXML<ERecordLib>("//root/Sound/RecordLib", navigator, ref RecordLib); CHelper.TryGetEnumValueFromXML<ERecordLib>("//root/Sound/RecordLib", navigator, ref RecordLib);
CHelper.TryGetEnumValueFromXML<EBufferSize>("//root/Sound/AudioBufferSize", navigator, ref AudioBufferSize);
CHelper.TryGetIntValueFromXML("//root/Sound/AudioLatency", navigator, ref AudioLatency);
if (AudioLatency < -500)
AudioLatency = -500;
if (AudioLatency > 500)
AudioLatency = 500;
CHelper.TryGetEnumValueFromXML("//root/Sound/BackgroundMusic", navigator, ref BackgroundMusic); CHelper.TryGetEnumValueFromXML("//root/Sound/BackgroundMusic", navigator, ref BackgroundMusic);
CHelper.TryGetIntValueFromXML("//root/Sound/BackgroundMusicVolume", navigator, ref BackgroundMusicVolume); CHelper.TryGetIntValueFromXML("//root/Sound/BackgroundMusicVolume", navigator, ref BackgroundMusicVolume);
CHelper.TryGetEnumValueFromXML("//root/Sound/BackgroundMusicSource", navigator, ref BackgroundMusicSource); CHelper.TryGetEnumValueFromXML("//root/Sound/BackgroundMusicSource", navigator, ref BackgroundMusicSource);
@@ -480,6 +502,12 @@ namespace Vocaluxe.Base
writer.WriteComment("RecordLib: " + ListStrings(Enum.GetNames(typeof(ERecordLib)))); writer.WriteComment("RecordLib: " + ListStrings(Enum.GetNames(typeof(ERecordLib))));
writer.WriteElementString("RecordLib", Enum.GetName(typeof(ERecordLib), RecordLib)); writer.WriteElementString("RecordLib", Enum.GetName(typeof(ERecordLib), RecordLib));
writer.WriteComment("AudioBufferSize: " + ListStrings(Enum.GetNames(typeof(EBufferSize))));
writer.WriteElementString("AudioBufferSize", Enum.GetName(typeof(EBufferSize), AudioBufferSize));
writer.WriteComment("AudioLatency from -500 to 500 ms");
writer.WriteElementString("AudioLatency", AudioLatency.ToString());
writer.WriteComment("Background Music"); writer.WriteComment("Background Music");
writer.WriteElementString("BackgroundMusicEnabled", Enum.GetName(typeof(EOffOn), BackgroundMusic)); writer.WriteElementString("BackgroundMusicEnabled", Enum.GetName(typeof(EOffOn), BackgroundMusic));
+1 -1
View File
@@ -47,7 +47,7 @@ namespace Vocaluxe.Base
public const int iVersionSub = 0; // steps public const int iVersionSub = 0; // steps
public const ERevision VersionRevision = ERevision.Beta; public const ERevision VersionRevision = ERevision.Beta;
public const int iBuild = 53; // Increase on every published version! Never Reset! public const int iBuild = 54; // Increase on every published version! Never Reset!
public const int iDatabaseHighscoreVersion = 1; public const int iDatabaseHighscoreVersion = 1;
public const int iDatabaseCoverVersion = 1; public const int iDatabaseCoverVersion = 1;
+4 -4
View File
@@ -501,7 +501,7 @@ namespace Vocaluxe.Base
long ticks = _Timer.ElapsedTicks; long ticks = _Timer.ElapsedTicks;
float dt = _Timer.ElapsedMilliseconds / 1000f; float dt = _Timer.ElapsedMilliseconds / 1000f;
if (nanosecPerTick > 0L) if (Stopwatch.IsHighResolution)
dt = (float)(ticks * nanosecPerTick / 1000000000.0); dt = (float)(ticks * nanosecPerTick / 1000000000.0);
return _SetValue + dt; return _SetValue + dt;
@@ -581,7 +581,7 @@ namespace Vocaluxe.Base
long ticks = _STimer.ElapsedTicks; long ticks = _STimer.ElapsedTicks;
float dt = _STimer.ElapsedMilliseconds / 1000f; float dt = _STimer.ElapsedMilliseconds / 1000f;
if (nanosecPerTick > 0L) if (Stopwatch.IsHighResolution)
dt = (float)(ticks * nanosecPerTick / 1000000000.0); dt = (float)(ticks * nanosecPerTick / 1000000000.0);
return _CurrentTime + dt; return _CurrentTime + dt;
@@ -617,9 +617,9 @@ namespace Vocaluxe.Base
long ticks = _STimer.ElapsedTicks; long ticks = _STimer.ElapsedTicks;
float dt = _STimer.ElapsedMilliseconds / 1000f; float dt = _STimer.ElapsedMilliseconds / 1000f;
if (nanosecPerTick > 0L) if (Stopwatch.IsHighResolution)
dt = (float)(ticks * nanosecPerTick / 1000000000.0); dt = (float)(ticks * nanosecPerTick / 1000000000.0);
float Ts = 0f; float Ts = 0f;
if (dt > 0) if (dt > 0)
Ts = 1 / (_T / dt + 1); Ts = 1 / (_T / dt + 1);
+4 -4
View File
@@ -620,7 +620,7 @@ namespace Vocaluxe.Lib.Sound
IntPtr.Zero, IntPtr.Zero,
ref outputParams, ref outputParams,
format.SamplesPerSecond, format.SamplesPerSecond,
0,//CConfig.PortAudioBufferSize, (uint)CConfig.AudioBufferSize,
PortAudio.PaStreamFlags.paNoFlag, PortAudio.PaStreamFlags.paNoFlag,
_paStreamCallback, _paStreamCallback,
data)); data));
@@ -844,10 +844,10 @@ namespace Vocaluxe.Lib.Sound
else else
_waiting = true; _waiting = true;
float latency = buf.Length / _BytesPerSecond; float latency = buf.Length / _BytesPerSecond + CConfig.AudioLatency/1000f;
float time = _TimeCode - _data.BytesNotRead / _BytesPerSecond - latency; float time = _TimeCode - _data.BytesNotRead / _BytesPerSecond - latency;
_CurrentTime = _SyncTimer.Update(time); _CurrentTime = time; // _SyncTimer.Update(time);
} }
try try
@@ -856,7 +856,7 @@ namespace Vocaluxe.Lib.Sound
} }
catch (Exception e) catch (Exception e)
{ {
Console.WriteLine(e.ToString()); CLog.LogError("Error PortAudio.StreamCallback: " + e.Message);
} }
return PortAudio.PaStreamCallbackResult.paContinue; return PortAudio.PaStreamCallbackResult.paContinue;
+14 -24
View File
@@ -260,7 +260,6 @@ namespace Vocaluxe.Lib.Video
AutoResetEvent EventDecode = new AutoResetEvent(false); AutoResetEvent EventDecode = new AutoResetEvent(false);
SFrameBuffer[] _FrameBuffer = new SFrameBuffer[5]; SFrameBuffer[] _FrameBuffer = new SFrameBuffer[5];
Object MutexFramebuffer = new Object(); Object MutexFramebuffer = new Object();
Object MutexFrame = new Object();
Object MutexSyncSignals = new Object(); Object MutexSyncSignals = new Object();
public Decoder() public Decoder()
@@ -595,17 +594,13 @@ namespace Vocaluxe.Lib.Video
if (!_BeforeLoop && (!DropFrame || FrameFinished != 0)) if (!_BeforeLoop && (!DropFrame || FrameFinished != 0))
{ {
lock (MutexFrame) try
{ {
try FrameFinished = CAcinerella.ac_get_frame(_instance, _videodecoder);
{ }
FrameFinished = CAcinerella.ac_get_frame(_instance, _videodecoder); catch (Exception)
} {
catch (Exception) CLog.LogError("Error AcGetFrame " + _FileName);
{
CLog.LogError("Error AcGetFrame " + _FileName);
}
} }
} }
@@ -673,23 +668,18 @@ namespace Vocaluxe.Lib.Video
_waiting = true; _waiting = true;
else else
{ {
TAc_decoder Videodecoder = (TAc_decoder)Marshal.PtrToStructure(_videodecoder, typeof(TAc_decoder));
lock (MutexFrame) _VideoTime = (float)Videodecoder.timecode;
_FrameBuffer[num].time = _VideoTime;
if (Videodecoder.buffer != IntPtr.Zero)
{ {
TAc_decoder Videodecoder = (TAc_decoder)Marshal.PtrToStructure(_videodecoder, typeof(TAc_decoder)); Marshal.Copy(Videodecoder.buffer, _FrameBuffer[num].data, 0, _Width * _Height * 4);
_FrameBuffer[num].time = _VideoTime;
_VideoTime = (float)Videodecoder.timecode;
if (Videodecoder.buffer != IntPtr.Zero)
{
Marshal.Copy(Videodecoder.buffer, _FrameBuffer[num].data, 0, _Width * _Height * 4);
_FrameBuffer[num].displayed = false; _FrameBuffer[num].displayed = false;
}
} }
_waiting = false; _waiting = false;
} }
} }
+197 -7
View File
@@ -15,7 +15,8 @@ namespace Vocaluxe.Menu
{ {
Fill, Fill,
Jump, Jump,
Slide Slide,
Zoom
} }
struct SNote struct SNote
@@ -23,6 +24,7 @@ namespace Vocaluxe.Menu
public string Text; public string Text;
public int StartBeat; public int StartBeat;
public int EndBeat; public int EndBeat;
public int Duration;
public ENoteType Type; public ENoteType Type;
} }
@@ -205,6 +207,7 @@ namespace Vocaluxe.Menu
n.Text = note.Text; n.Text = note.Text;
n.StartBeat = note.StartBeat; n.StartBeat = note.StartBeat;
n.EndBeat = note.EndBeat; n.EndBeat = note.EndBeat;
n.Duration = note.Duration;
n.Type = note.NoteType; n.Type = note.NoteType;
_Text.Text = note.Text; _Text.Text = note.Text;
@@ -229,6 +232,7 @@ namespace Vocaluxe.Menu
return _X - _width / 2; return _X - _width / 2;
} }
#region draw
public void Draw(float ActualBeat) public void Draw(float ActualBeat)
{ {
if (Visible || CSettings.GameState == EGameState.EditTheme) if (Visible || CSettings.GameState == EGameState.EditTheme)
@@ -236,12 +240,17 @@ namespace Vocaluxe.Menu
switch (_Style) switch (_Style)
{ {
case ELyricStyle.Fill: case ELyricStyle.Fill:
DrawFill(ActualBeat);
break; break;
case ELyricStyle.Jump: case ELyricStyle.Jump:
DrawJump(ActualBeat);
break; break;
case ELyricStyle.Slide: case ELyricStyle.Slide:
DrawSlide(ActualBeat); DrawSlide(ActualBeat);
break; break;
case ELyricStyle.Zoom:
DrawZoom(ActualBeat);
break;
default: default:
DrawSlide(ActualBeat); DrawSlide(ActualBeat);
break; break;
@@ -257,6 +266,8 @@ namespace Vocaluxe.Menu
{ {
_Text.X = x; _Text.X = x;
_Text.Style = EStyle.Bold; _Text.Style = EStyle.Bold;
_Text.Text = note.Text;
RectangleF rect = CDraw.GetTextBounds(_Text);
if (note.Type == ENoteType.Freestyle) if (note.Type == ENoteType.Freestyle)
_Text.Style = EStyle.BoldItalic; _Text.Style = EStyle.BoldItalic;
@@ -266,7 +277,7 @@ namespace Vocaluxe.Menu
if (CurrentBeat <= note.EndBeat) if (CurrentBeat <= note.EndBeat)
{ {
_Text.Color = ColorProcessed; _Text.Color = ColorProcessed;
_Text.Text = note.Text;
float diff = note.EndBeat - note.StartBeat; float diff = note.EndBeat - note.StartBeat;
if (diff == 0) if (diff == 0)
@@ -280,23 +291,202 @@ namespace Vocaluxe.Menu
} }
else else
{ {
_Text.Color = ColorProcessed; _Text.Color = ColorProcessed;
_Text.Text = note.Text;
_Text.Draw(); _Text.Draw();
} }
} }
else else
{ {
_Text.Color = Color; _Text.Color = Color;
_Text.Text = note.Text;
_Text.Draw(); _Text.Draw();
} }
RectangleF rect = CDraw.GetTextBounds(_Text);
x += rect.Width; x += rect.Width;
} }
} }
private void DrawZoom(float CurrentBeat)
{
float x = _X - _width / 2; // most left position
//find last active note
int last_note = -1;
for (int i = 0; i < _Notes.Count; i++)
{
if (CurrentBeat >= _Notes[i].StartBeat)
last_note = i;
}
int zoom_note = -1;
float zoomx = 0f;
int current_note = -1;
foreach (SNote note in _Notes)
{
current_note++;
_Text.X = x;
_Text.Style = EStyle.Bold;
_Text.Text = note.Text;
RectangleF rect = CDraw.GetTextBounds(_Text);
if (note.Type == ENoteType.Freestyle)
_Text.Style = EStyle.BoldItalic;
if (CurrentBeat >= note.StartBeat)
{
if (CurrentBeat <= note.EndBeat)
{
zoom_note = current_note;
zoomx = _Text.X;
}
else
{
// already passed
if (current_note == last_note)
_Text.Color = ColorProcessed;
else
_Text.Color = Color;
_Text.Draw();
}
}
else
{
// not passed
_Text.Color = Color;
_Text.Draw();
}
x += rect.Width;
}
if (zoom_note > -1)
{
if (_Notes[zoom_note].Duration == 0)
return;
_Text.X = zoomx;
_Text.Text = _Notes[zoom_note].Text;
_Text.Color = ColorProcessed;
_Text.Style = EStyle.Bold;
if (_Notes[zoom_note].Type == ENoteType.Freestyle)
_Text.Style = EStyle.BoldItalic;
RectangleF rect = CDraw.GetTextBounds(_Text);
float diff = _Notes[zoom_note].EndBeat - _Notes[zoom_note].StartBeat;
float p = (CurrentBeat - _Notes[zoom_note].StartBeat) / _Notes[zoom_note].Duration;
if (p > 1f)
p = 1f;
p = 1f - p;
float ty = _Text.Y;
float tx = _Text.X;
float th = _Text.Height;
float tz = _Text.Z;
_Text.Height += _Text.Height * p * 0.4f;
RectangleF rectz = CDraw.GetTextBounds(_Text);
_Text.X -= (rectz.Width - rect.Width) / 2f;
_Text.Y -= (rectz.Height - rect.Height) / 2f;
_Text.Z -= 0.1f;
_Text.Draw();
_Text.Y = ty;
_Text.X = tx;
_Text.Height = th;
_Text.Z = tz;
}
}
private void DrawFill(float CurrentBeat)
{
float x = _X - _width / 2; // most left position
foreach (SNote note in _Notes)
{
_Text.X = x;
_Text.Style = EStyle.Bold;
_Text.Text = note.Text;
RectangleF rect = CDraw.GetTextBounds(_Text);
if (note.Type == ENoteType.Freestyle)
_Text.Style = EStyle.BoldItalic;
if (CurrentBeat >= note.StartBeat)
{
_Text.Color = ColorProcessed;
_Text.Draw();
}
else
{
// not passed
_Text.Color = Color;
_Text.Draw();
}
x += rect.Width;
}
}
private void DrawJump(float CurrentBeat)
{
float x = _X - _width / 2; // most left position
foreach (SNote note in _Notes)
{
_Text.X = x;
_Text.Style = EStyle.Bold;
_Text.Text = note.Text;
RectangleF rect = CDraw.GetTextBounds(_Text);
if (note.Type == ENoteType.Freestyle)
_Text.Style = EStyle.BoldItalic;
if (CurrentBeat >= note.StartBeat)
{
if (CurrentBeat <= note.EndBeat)
{
_Text.Color = ColorProcessed;
float diff = note.EndBeat - note.StartBeat;
if (diff == 0)
_Text.Draw();
else
{
float y = _Text.Y;
_Text.Y -= _Text.Height * 0.1f;
_Text.Draw();
_Text.Y = y;
}
}
else
{
// already passed
_Text.Color = Color;
_Text.Draw();
}
}
else
{
// not passed
_Text.Color = Color;
_Text.Draw();
}
x += rect.Width;
}
}
#endregion draw
public void UnloadTextures() public void UnloadTextures()
{ {
} }
+4 -4
View File
@@ -382,16 +382,16 @@ namespace Vocaluxe.Screens
} }
break; break;
} }
Lyrics[htLyrics(LyricMain)].Draw(CGame.Beat);
Lyrics[htLyrics(LyricSub)].Draw(-100); Lyrics[htLyrics(LyricSub)].Draw(-100);
Lyrics[htLyrics(LyricMain)].Draw(CGame.Beat);
Lyrics[htLyrics(LyricMainDuet)].Draw(CGame.Beat);
Lyrics[htLyrics(LyricSubDuet)].Draw(-100); Lyrics[htLyrics(LyricSubDuet)].Draw(-100);
Lyrics[htLyrics(LyricMainDuet)].Draw(CGame.Beat);
Lyrics[htLyrics(LyricMainTop)].Draw(CGame.Beat);
Lyrics[htLyrics(LyricSubTop)].Draw(-100); Lyrics[htLyrics(LyricSubTop)].Draw(-100);
Lyrics[htLyrics(LyricMainTop)].Draw(CGame.Beat);
for (int i = 0; i < CGame.NumPlayer; i++) for (int i = 0; i < CGame.NumPlayer; i++)
{ {