Skip to content

Commit d774b67

Browse files
authored
Merge pull request #510 from open-ephys/issue-498
Round ReadSize property up to next multiple of 4
2 parents cb94685 + f5f62aa commit d774b67

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

OpenEphys.Onix1/StartAcquisition.cs

Lines changed: 13 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,19 @@ 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+
/// If a value is set that is not aligned to a 32-bit word boundary, it will be rounded up
64+
/// to the next 32-bit aligned value.
65+
/// </para>
5866
/// </remarks>
5967
[Description("Number of bytes read per cycle of the acquisition thread.")]
6068
[Category(DeviceFactory.ConfigurationCategory)]
61-
public int ReadSize { get; set; } = 2048;
69+
public int ReadSize
70+
{
71+
get => readSize;
72+
set => readSize = (value + 3) & ~3; // NB: Round up to the next multiple of four to align with word boundaries in liboni
73+
}
6274

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

0 commit comments

Comments
 (0)