benkuper / Chataigne

Artist-friendly Modular Machine for Art and Technology

Home Page:https://benjamin.kuperberg.fr/chataigne

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lag when no MIDI device is opened

EmerickH opened this issue · comments

Environment

  • OS: Linux (tested on 2 x86 computers with Arch and 1 ARM device on Ubuntu)
  • Version: all versions since 1.9.14 included
    Windows versions are not affected tho, not tested on MacOs.

EDIT: I narrowed down, the bug has appeared in 1.9.14b12 and was not present in 1.9.14b11

Describe the bug (edited)
The whole software is laggy until a MIDI device is opened.
This is mostly visible on the timeline in sequences: while playing the time is moving normally for 500ms then pausing for 100ms and starting back again for a second, in a loop.

To Reproduce
Steps to reproduce the behavior:

  1. Open a new project
  2. Create a new sequence
  3. Hit play

Expected behavior
Smooth playback

Additional context
This is not just a graphical bug, affected values are also out of sync.
Tried enabling OpenGL rendering, doesn't make a difference.
1.9.13 doesn't have this issue, all the versions since 1.9.14 do on every computer I own (only on Linux tho).
The timeline is not be the only thing affected by the laggyness, it's maybe just the most obvious one.

I'll try to investigate that a bit myself but if you have any idea on why this happens, it could be useful.

just checking the code between b11 and b12, I don't see any obvious reason for such a change, only on linux... I just didn't check the JUCE core code updates at that time, but best way would be to profile on linux and see what is consuming all the CPU. I don't have a linux system to test so if you're willing to do the work that would be fantastic

Chataigne 1.9.14b11 compiled with latest JUCE = the bug is present so yes it's probably a problem with JUCE

VERY interesting discovery: if I add a MIDI module and open a port, the problem goes away and if I close it back it comes back again! Probably the reason I didn't discover this sooner. Also works if I choose a device to sync to/from on the sequence.
There has been some Linux specific changes to MIDI classes in JUCE between b11 and b12, like this one.
I'm actually loosing my hair with stupid compilation errors with versions that worked 3min ago... I'll keep you updated if I manage to find the problematic change!

Unfortunately it would seem like this issue is back (version 1.9.17 but repeatable in 1.9.16). I'm seeing lag spikes about 2 times per second, if I add a MIDI protocol module and add either an input or output (in my case just a virtual dummy device provided by PipeWire) it's smooth as butter.

My test case is connecting a gamepad, adding the gamepad module and watching the live values as I move one of the analog sticks.

I don't know if it's relevant but this is on a ThinkPad P50 (i7-6820HQ + Quadro M2000M), Debian Sid with Intel graphics on KDE 5 Plasma (Wayland) and PipeWire as Audio/MIDI backend.

@Djhg2000 the bugfix was merged after 1.9.17 and will be included in the next release (1.9.18) when it will be out. In the meantime you have to use the beta (e.g. 1.9.18b3) or bleeding edge version of Chataigne not to have the bug.

Ah, I misread the dates and thought it was supposed to have been fixed in 1.9.15. Sorry for the noise, my bad.