diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2010-04-27 19:09:40 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2010-04-27 19:09:40 +0000 |
commit | 27b3e332076162b37a7a53f059004d23ad69f9d2 (patch) | |
tree | 3a72ac46223805dcd6957c8075e2ed8025341473 /src/base | |
parent | 074d15b66dc7a585c28af26ff1df041349198b8c (diff) | |
download | usdx-27b3e332076162b37a7a53f059004d23ad69f9d2.tar.gz usdx-27b3e332076162b37a7a53f059004d23ad69f9d2.tar.xz usdx-27b3e332076162b37a7a53f059004d23ad69f9d2.zip |
- device input latency is now configurable via config.ini
- latency[i] determines the latency for device i in milliseconds or -1 for autodetection (default)
- this is necessary as mic capturing with portaudio (on linux) gets stuck if latency is too low. Either because portaudio's latency autodetection does not work or because the mic capture callback takes too long before it returns. In both cases the user should set the latency to a value of 100 (ms).
- better input device test, it should not remove working devices anymore.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2313 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/UIni.pas | 7 | ||||
-rw-r--r-- | src/base/URecord.pas | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/base/UIni.pas b/src/base/UIni.pas index 3ed3f3d5..ec229c54 100644 --- a/src/base/UIni.pas +++ b/src/base/UIni.pas @@ -63,9 +63,13 @@ type TInputDeviceConfig = record Name: string; Input: integer; + Latency: integer; //**< latency in ms, or LATENCY_AUTODETECT for default ChannelToPlayerMap: array of integer; end; +const + LATENCY_AUTODETECT = -1; + type //Options @@ -640,6 +644,7 @@ begin DeviceCfg := @InputDeviceConfig[High(InputDeviceConfig)]; DeviceCfg.Name := IniFile.ReadString('Record', Format('DeviceName[%d]', [DeviceIndex]), ''); DeviceCfg.Input := IniFile.ReadInteger('Record', Format('Input[%d]', [DeviceIndex]), 0); + DeviceCfg.Latency := IniFile.ReadInteger('Record', Format('Latency[%d]', [DeviceIndex]), LATENCY_AUTODETECT); // find the largest channel-number of the current device in the ini-file ChannelCount := GetMaxKeyIndex(RecordKeys, 'Channel', Format('[%d]', [DeviceIndex])); @@ -678,6 +683,8 @@ begin InputDeviceConfig[DeviceIndex].Name); IniFile.WriteInteger('Record', Format('Input[%d]', [DeviceIndex+1]), InputDeviceConfig[DeviceIndex].Input); + IniFile.WriteInteger('Record', Format('Latency[%d]', [DeviceIndex+1]), + InputDeviceConfig[DeviceIndex].Latency); // Channel-to-Player Mapping for ChannelIndex := 0 to High(InputDeviceConfig[DeviceIndex].ChannelToPlayerMap) do diff --git a/src/base/URecord.pas b/src/base/URecord.pas index 09ac92de..245d85a6 100644 --- a/src/base/URecord.pas +++ b/src/base/URecord.pas @@ -577,6 +577,7 @@ begin deviceCfg.Name := Trim(device.Name); deviceCfg.Input := 0; + deviceCfg.Latency := LATENCY_AUTODETECT; channelCount := device.AudioFormat.Channels; SetLength(deviceCfg.ChannelToPlayerMap, channelCount); |