added AudioLatency and AudioBufferSize to config
This commit is contained in:
1 parent
41afaca2b8
commit
d57d43c7c8
2 files changed
+31
-3
No files matched your search
@@ -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 = 200;
|
||||||
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));
|
||||||
|
|
||||||
|
|||||||
@@ -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,7 +844,7 @@ 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 = _SyncTimer.Update(time);
|
||||||
|
|||||||
Reference in new issue
Block a user