Skip to content

Commit 4f6c398

Browse files
committed
Round ReadSize property up to next multiple of 4
1 parent b760f36 commit 4f6c398

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

OpenEphys.Onix1/StartAcquisition.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,14 @@ namespace OpenEphys.Onix1
4141
[Description("Starts data acquisition and frame distribution on a ContextTask.")]
4242
public class StartAcquisition : Combinator<ContextTask, IGroupedObservable<uint, oni.Frame>>
4343
{
44+
int readSize = 2048;
45+
4446
/// <summary>
4547
/// Gets or sets the number of bytes read per cycle of the <see cref="ContextTask"/>'s acquisition
4648
/// thread.
4749
/// </summary>
4850
/// <remarks>
51+
/// <para>
4952
/// This option allows control over a fundamental trade-off between closed-loop response time and
5053
/// available bandwidth. A minimal value, which is determined by <see
5154
/// cref="ContextTask.MaxReadFrameSize"/>, will provide the lowest response latency, so long as data
@@ -55,10 +58,18 @@ public class StartAcquisition : Combinator<ContextTask, IGroupedObservable<uint,
5558
/// performance for high-bandwidth data sources. The optimal value depends on the host computer and
5659
/// hardware configuration and must be determined via testing (e.g. using <see
5760
/// cref="MemoryMonitorData"/>).
61+
/// </para>
62+
/// <para>
63+
/// The number of bytes set will be rounded up to the next multiple of four.
64+
/// </para>
5865
/// </remarks>
5966
[Description("Number of bytes read per cycle of the acquisition thread.")]
6067
[Category(DeviceFactory.ConfigurationCategory)]
61-
public int ReadSize { get; set; } = 2048;
68+
public int ReadSize
69+
{
70+
get => readSize;
71+
set => readSize = (value + 3) & ~3; // NB: Round up to the next multiple of four to align with word boundaries in liboni
72+
}
6273

6374
/// <summary>
6475
/// Gets or sets the number of bytes that are pre-allocated for writing data to hardware.

0 commit comments

Comments
 (0)