# Rigbuffer size depends on how device is opened

**URL:** https://forum.commonvisionblox.com/t/rigbuffer-size-depends-on-how-device-is-opened/2110
**Category:** .Net API
**Tags:** csharp, genicam, gigevision
**Created:** [February 1, 2024, 10:56am UTC](https://forum.commonvisionblox.com/t/rigbuffer-size-depends-on-how-device-is-opened/2110 "2024-02-01T10:56:14Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![B9611](https://avatars.discourse-cdn.com/v4/letter/b/b5a626/32.png) [@B9611](https://forum.commonvisionblox.com/u/B9611)
#### Post date: [February 1, 2024, 10:56am UTC](https://forum.commonvisionblox.com/t/rigbuffer-size-depends-on-how-device-is-opened/2110/1 "2024-02-01T10:56:14Z")

</div>

I found that the ringbuffer size depends on the way how I open the camera. Here is a very short example:

```auto
using Stemmer.Cvb;
using Stemmer.Cvb.Driver;
using System;

namespace ConsoleCamera2
{
    class Program
    {
        static void Main(string[] args)
        {
            // Ringbuffer depth is whatever is set in GenICam.ini (NumBuffer).
            Device device = DeviceFactory.Open("%CVB%drivers\\GenICam.vin");

            // Ringbuffer depth is 3 if the camera is opened through foundDevices.
            // DiscoveryInformationList foundDevices = DeviceFactory.Discover();
            // Device device = DeviceFactory.Open(foundDevices[0]);

            var depth = device.Stream.RingBuffer.Count;
            Console.WriteLine($"Ringbuffer depth: {depth}");

            Console.ReadLine();
        }
    }
}

```

Is this behavior intentional? Where is it documented?  
Thanks in advance for your advice.

---

<div class="post-metadata">

### Author: ![Chris](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/chris/32/1154_2.png) [@Chris](https://forum.commonvisionblox.com/u/Chris)
#### Post date: [February 2, 2024, 2:03pm UTC](https://forum.commonvisionblox.com/t/rigbuffer-size-depends-on-how-device-is-opened/2110/2 "2024-02-02T14:03:57Z")

</div>

Hi @B9611

the reason you see differences in Rinbuffersize is, that when loading the driver direktly, the setup configured in the inifile is being loaded.

However, when you load the driver by the device you found through disvocery, we dont necessarily need the driver to be cofigured (could be a new camera that was never on the machine).  
If you wish to change values on the device loaded that way, you will need to use the “SetValue()” method of the DiscoveryInformation class:  
[https://help.commonvisionblox.com/NextGen/14.0/cvbnet/d1/d19/struct\_stemmer\_1\_1\_cvb\_1\_1\_driver\_1\_1\_discovery\_information.html](https://help.commonvisionblox.com/NextGen/14.0/cvbnet/d1/d19/struct_stemmer_1_1_cvb_1_1_driver_1_1_discovery_information.html)

The names and values are equal to what you can see in the GenICam.ini.

Give it a try and let me know if this solved your question.

---

<div class="post-metadata">

### Author: ![illusive](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/illusive/32/61_2.png) [@illusive](https://forum.commonvisionblox.com/u/illusive)
#### Post date: [February 2, 2024, 2:25pm UTC](https://forum.commonvisionblox.com/t/rigbuffer-size-depends-on-how-device-is-opened/2110/3 "2024-02-02T14:25:00Z")

</div>

Hi @Chris and @B9611,

The difference is most certainly what @Chris mentioned. Today, CVB basically supports two different acquisition stacks (“stack” in the sense that there is a pile of dynamically loaded binaries involved in making happen what you want). They are denoted by the (currently) two different enum values in the `AcquisitionStack` enumeration (`PreferVin` and `PreferGenTL`) that may be passed as a 2nd argument to the `DeviceFactory.Open` method:

- **`PreferVin`**  
Tells :cvb: to use the acquisition stack that has been around sind version 9 (for :cvb: veterans: The functions `G2Grab`, `G2Wait` and `G2Freeze` are the key functions here…). This acquisition stack will be the only one that works with legacy drivers (file extension _\*.vin_ - with the notorious exception of the _GenICam.vin_.

- **`PreferGenTL`**  
Tells :cvb: to make use of the stack that has been added in version 13.4 - this stack supports more up-to-date GenICam features like multi part images or flow sets and will only work with the GenICam.vin (which, despite the file extension, is _not_ a legacy entity).

The _GenICam.ini_ file located in the folder _%CVBDATA%Drivers_ will only be evaluated when opening with the Legacy Vin stack - but not when opening the GenTL stack. In the latter case the driver will be opened with a default number of buffers (usually 3) - unless you use the `Discover` method to get a list of devices and then change the settings of the device before opening it.

So I agree with Chris’s assessment that the difference you see is to be attributed to a difference in the driver stack that is being used. You can validate our assumption by specifying `AcquisitionStack.PreferVin`/`AcquisitionStack.PreferGenTL` explicitly in the `Open` call.

Also, the exact version of :cvb: that you are using would be interesting to us: The default should actually be `AcquisitionStack.PreferVin` if you don’t specify anything else - at least in CVB 14.0 and higher, but I vaguely remember that at some point, the GenTL stack would have been the default.

---

<div class="post-metadata">

### Author: ![B9611](https://avatars.discourse-cdn.com/v4/letter/b/b5a626/32.png) [@B9611](https://forum.commonvisionblox.com/u/B9611)
#### Post date: [February 6, 2024, 12:54pm UTC](https://forum.commonvisionblox.com/t/rigbuffer-size-depends-on-how-device-is-opened/2110/4 "2024-02-06T12:54:20Z")

</div>

Thank you @illusive and @Chris ,  
I’m now setting `NumBuffer` and `PacketSize` using the `SetParameter` method on the devices found before opening them. It works as desired now. The CVB version is 14.0.9.  
If I understand [Setting PacketSize with Device.Discover](https://forum.commonvisionblox.com/t/setting-packetsize-with-device-discover/1014) correctly, the values in the GenICam.ini file are completely ignored, if the `Discover` interface is used. So the information is here, you just have to find and understand it 😉 .  
Thanks again.
