File rtmidi-5.0.patch of Package zrythm

From e053898d2545df68de3f214ae4163a93e56c8e40 Mon Sep 17 00:00:00 2001
From: Alexandros Theodotou <alex@zrythm.org>
Date: Sat, 27 Nov 2021 08:10:35 +0000
Subject: [PATCH] bump rtmidi dep to 5.0.0

---
 meson.build               | 10 +++-------
 src/audio/ext_port.c      | 10 +++++++---
 src/audio/rtmidi_device.c |  8 ++++++--
 3 files changed, 16 insertions(+), 12 deletions(-)

Index: zrythm-1.0.0-alpha.26.0.13/meson.build
===================================================================
--- zrythm-1.0.0-alpha.26.0.13.orig/meson.build
+++ zrythm-1.0.0-alpha.26.0.13/meson.build
@@ -1140,14 +1140,10 @@ if portaudio_dep.found ()
 endif
 
 rtmidi_dep = dependency (
-  'rtmidi', version: '>= 4.0.0',
+  'rtmidi', version: '>= 5.0.0',
   required: get_option ('rtmidi'),
+  fallback: ['rtmidi', 'zrythm_rtmidi_dep'],
   static: all_static)
-if not rtmidi_dep.found () and not get_option ('rtmidi').disabled ()
-  rtmidi_proj = subproject('rtmidi')
-  rtmidi_dep = rtmidi_proj.get_variable(
-    'zrythm_rtmidi_dep')
-endif
 if rtmidi_dep.found ()
   cdata.set('HAVE_RTMIDI', 1)
 endif
Index: zrythm-1.0.0-alpha.26.0.13/src/audio/ext_port.c
===================================================================
--- zrythm-1.0.0-alpha.26.0.13.orig/src/audio/ext_port.c
+++ zrythm-1.0.0-alpha.26.0.13/src/audio/ext_port.c
@@ -604,9 +604,13 @@ ext_port_from_rtmidi (
   RtMidiDevice * dev =
     rtmidi_device_new (1, NULL, id, NULL);
   self->rtmidi_id = id;
-  self->full_name =
-    g_strdup (
-      rtmidi_get_port_name (dev->in_handle, id));
+  int buf_len;
+  rtmidi_get_port_name (
+    dev->in_handle, id, NULL, &buf_len);
+  char buf[buf_len];
+  rtmidi_get_port_name (
+    dev->in_handle, id, buf, &buf_len);
+  self->full_name = g_strdup (buf);
   self->type = EXT_PORT_TYPE_RTMIDI;
   rtmidi_device_free (dev);
 
Index: zrythm-1.0.0-alpha.26.0.13/src/audio/rtmidi_device.c
===================================================================
--- zrythm-1.0.0-alpha.26.0.13.orig/src/audio/rtmidi_device.c
+++ zrythm-1.0.0-alpha.26.0.13/src/audio/rtmidi_device.c
@@ -135,8 +135,12 @@ rtmidi_device_get_id_from_name (
         rtmidi_get_port_count (dev->in_handle);
       for (unsigned int i = 0; i < num_ports; i++)
         {
-          const char * dev_name =
-            rtmidi_get_port_name (dev->in_handle, i);
+          int buf_len;
+          rtmidi_get_port_name (
+            dev->in_handle, i, NULL, &buf_len);
+          char dev_name[buf_len];
+          rtmidi_get_port_name (
+            dev->in_handle, i, dev_name, &buf_len);
           if (string_is_equal (dev_name, name))
             {
               rtmidi_device_free (dev);
openSUSE Build Service is sponsored by