# Device.active\_preset (the index) is 0 for VST3, but 1 for VST2

**URL:** <https://forum.renoise.com/t/device-active-preset-the-index-is-0-for-vst3-but-1-for-vst2/76992>\
**Category:** Renoise Tool Development\
**Created:** [July 27, 2025, 8:25am UTC](https://forum.renoise.com/t/device-active-preset-the-index-is-0-for-vst3-but-1-for-vst2/76992 "2025-07-27T08:25:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ffx](https://forum.renoise.com/letter_avatar/ffx/32/6_449c533f586939b6e5f246632a46421f.png) [@ffx](https://forum.renoise.com/u/ffx)\
**Post date:** [July 27, 2025, 8:25am UTC](https://forum.renoise.com/t/device-active-preset-the-index-is-0-for-vst3-but-1-for-vst2/76992/1 "2025-07-27T08:25:28Z")

</div>

I stumbled over an error in Fladd’s track splitter tool. It crashes in the device copy loop, simply in the line:

```auto
new_device.active_preset = device.active_preset

```

Now I wondered how this is possible. Tracked down the behaviour and it turns out that for any given VST2, the device.active\_preset (index) is 1, but 0 for any VST3 fx. At least in my test, done with [A1 Stereo Control](https://a1audio.alexhilton.net/downloads), which is available as VST2 and VST3. Also UVI Shade.

I guess this could be considered as a bug? Or is this done for a reason?

This is the whole loop code:

```auto
if #current_song.tracks[orig_track].devices > 1 then
        for d = 2, #current_song.tracks[orig_track].devices do
          local device = current_song.tracks[orig_track].devices[d]
          current_song.tracks[group_track]:insert_device_at(
            device.device_path, d)
          local new_device = current_song.tracks[group_track].devices[d]
          new_device.display_name = device.display_name
          new_device.is_active = device.is_active
          new_device.is_maximized = device.is_maximized
          print('index', device.active_preset, device.name)
          new_device.active_preset = device.active_preset
          new_device.active_preset_data = device.active_preset_data
        end
      end

```

Tested in Renoise 3.5.2 macOS 14.6.1

---

<div class="post-metadata">

**Author:** ![ffx](https://forum.renoise.com/letter_avatar/ffx/32/6_449c533f586939b6e5f246632a46421f.png) [@ffx](https://forum.renoise.com/u/ffx)\
**Post date:** [July 27, 2025, 8:59am UTC](https://forum.renoise.com/t/device-active-preset-the-index-is-0-for-vst3-but-1-for-vst2/76992/2 "2025-07-27T08:59:56Z")

</div>

Here is a debug enabled version of the tool, search for “bug here” in the main.lua:  
[de.fladd.SplitIntoSeparateTracks.xrnx](https://forum.renoise.com/uploads/short-url/gJWxROPc6tYUgecHxJpFjTyqNyk.xrnx) (5.3 KB)

This code even hard-crashes / force-quits Renoise:

```auto
for d = 2, #current_song.tracks[orig_track_index].devices do
          print('grabbbing device at', d)
          local device = current_song.tracks[orig_track_index]:device(d)
          print('done grabbing')
          current_song.tracks[group_track]:insert_device_at(
            device.device_path, d)
          local new_device = current_song.tracks[group_track].devices[d]
          new_device.display_name = device.display_name
          new_device.is_active = device.is_active
          new_device.is_maximized = device.is_maximized
          local fixed_index = device.active_preset == 0 and 1 or device.active_preset
          print('copying active preset at index', device.active_preset, 'of device', device.name, fixed_index)
          -- BUG HERE
          new_device.active_preset = fixed_index
          new_device.active_preset_data = device.active_preset_data
        end

```

[de.fladd.SplitIntoSeparateTracks-HardCrashing.xrnx](https://forum.renoise.com/uploads/short-url/bGsLAsoDwVeox5wvoLiqf6QGnrh.xrnx) (5.3 KB)

I guess because there is no index 1.

For the crash, select a VST3 device and then enter simply:

 ![grafik](https://forum.renoise.com/uploads/default/original/3X/f/2/f2c2ac5f5e00438161929c5f0db7b7174b53607d.png)

---

<div class="post-metadata">

**Author:** ![ffx](https://forum.renoise.com/letter_avatar/ffx/32/6_449c533f586939b6e5f246632a46421f.png) [@ffx](https://forum.renoise.com/u/ffx)\
**Post date:** [July 27, 2025, 9:27am UTC](https://forum.renoise.com/t/device-active-preset-the-index-is-0-for-vst3-but-1-for-vst2/76992/3 "2025-07-27T09:27:30Z")

</div>

Btw. for a fix of the tool, simply comment out that line:

```auto
--new_device.active_preset = device.active_preset

```

Might be even considered as harmful…

Here is a working version of the tool:  
[de.fladd.SplitIntoSeparateTracks.xrnx](https://forum.renoise.com/uploads/short-url/3CGLGiGPWpzD4nFAXnEZtweRE27.xrnx) (5.4 KB)
