added AudioLatency and AudioBufferSize to config

This commit is contained in:
Alexander Eckart committed 2012-03-04 20:59:30 +01:00
1 parent 41afaca2b8
commit d57d43c7c8
2 files changed
+31 -3

No files matched your search

+29 -1
View File
@@ -66,6 +66,19 @@ namespace Vocaluxe.Base
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
{
PortAudio,
@@ -177,7 +190,8 @@ namespace Vocaluxe.Base
// Sound
public static EPlaybackLib PlayBackLib = EPlaybackLib.PortAudio;
public static ERecordLib RecordLib = ERecordLib.PortAudio;
public static uint PortAudioBufferSize = 1024;
public static EBufferSize AudioBufferSize = EBufferSize.b2048;
public static int AudioLatency = 200;
public static int BackgroundMusicVolume = 50;
public static EOffOn BackgroundMusic = EOffOn.TR_CONFIG_ON;
public static EBackgroundMusicSource BackgroundMusicSource = EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC;
@@ -286,6 +300,14 @@ namespace Vocaluxe.Base
#region Sound
CHelper.TryGetEnumValueFromXML<EPlaybackLib>("//root/Sound/PlayBackLib", navigator, ref PlayBackLib);
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.TryGetIntValueFromXML("//root/Sound/BackgroundMusicVolume", navigator, ref BackgroundMusicVolume);
CHelper.TryGetEnumValueFromXML("//root/Sound/BackgroundMusicSource", navigator, ref BackgroundMusicSource);
@@ -480,6 +502,12 @@ namespace Vocaluxe.Base
writer.WriteComment("RecordLib: " + ListStrings(Enum.GetNames(typeof(ERecordLib))));
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.WriteElementString("BackgroundMusicEnabled", Enum.GetName(typeof(EOffOn), BackgroundMusic));
+2 -2
View File
@@ -620,7 +620,7 @@ namespace Vocaluxe.Lib.Sound
IntPtr.Zero,
ref outputParams,
format.SamplesPerSecond,
0,//CConfig.PortAudioBufferSize,
(uint)CConfig.AudioBufferSize,
PortAudio.PaStreamFlags.paNoFlag,
_paStreamCallback,
data));
@@ -844,7 +844,7 @@ namespace Vocaluxe.Lib.Sound
else
_waiting = true;
float latency = buf.Length / _BytesPerSecond;
float latency = buf.Length / _BytesPerSecond + CConfig.AudioLatency/1000f;
float time = _TimeCode - _data.BytesNotRead / _BytesPerSecond - latency;
_CurrentTime = _SyncTimer.Update(time);