simple-carla 1.2.0__tar.gz → 1.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {simple_carla-1.2.0 → simple_carla-1.3.1}/PKG-INFO +3 -2
- {simple_carla-1.2.0 → simple_carla-1.3.1}/pyproject.toml +1 -1
- {simple_carla-1.2.0 → simple_carla-1.3.1}/simple_carla/__init__.py +34 -16
- {simple_carla-1.2.0 → simple_carla-1.3.1}/simple_carla/qt.py +11 -6
- {simple_carla-1.2.0 → simple_carla-1.3.1}/.gitignore +0 -0
- {simple_carla-1.2.0 → simple_carla-1.3.1}/LICENSE +0 -0
- {simple_carla-1.2.0 → simple_carla-1.3.1}/README.md +0 -0
- {simple_carla-1.2.0 → simple_carla-1.3.1}/simple_carla/plugin_dialog.py +0 -0
- {simple_carla-1.2.0 → simple_carla-1.3.1}/simple_carla/scripts/__init__.py +0 -0
- {simple_carla-1.2.0 → simple_carla-1.3.1}/simple_carla/scripts/sc_plugin_def.py +0 -0
- {simple_carla-1.2.0 → simple_carla-1.3.1}/tests/carla.py +0 -0
- {simple_carla-1.2.0 → simple_carla-1.3.1}/tests/qt_carla.py +0 -0
@@ -1,10 +1,11 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: simple_carla
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.3.1
|
4
4
|
Summary: An easy-to-use, object-oriented interface to the carla plugin host.
|
5
5
|
Author-email: Leon Dionne <ldionne@dridesign.sh.cn>
|
6
6
|
Description-Content-Type: text/markdown
|
7
7
|
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
8
|
+
License-File: LICENSE
|
8
9
|
Requires-Dist: numpy
|
9
10
|
Requires-Dist: log_soso
|
10
11
|
Requires-Dist: PyQt5
|
@@ -18,7 +18,7 @@ build-backend = "flit_core.buildapi"
|
|
18
18
|
sc-plugin-def = "simple_carla.scripts.sc_plugin_def:main"
|
19
19
|
|
20
20
|
[bumpver]
|
21
|
-
current_version = "1.
|
21
|
+
current_version = "1.3.1"
|
22
22
|
version_pattern = "MAJOR.MINOR.PATCH"
|
23
23
|
commit_message = "Bump version {old_version} -> {new_version}"
|
24
24
|
commit = true
|
@@ -22,7 +22,7 @@ An easy-to-use, object-oriented interface to the carla plugin host.
|
|
22
22
|
"""
|
23
23
|
import os, sys, threading, time, logging, traceback
|
24
24
|
from ctypes import byref, cast, c_char_p, c_void_p, POINTER
|
25
|
-
from functools import wraps
|
25
|
+
from functools import wraps
|
26
26
|
from struct import pack
|
27
27
|
from numpy import zeros as np_zeros
|
28
28
|
from log_soso import StreamToLogger
|
@@ -234,7 +234,7 @@ from carla_backend import (
|
|
234
234
|
)
|
235
235
|
|
236
236
|
|
237
|
-
__version__ = "1.
|
237
|
+
__version__ = "1.3.1"
|
238
238
|
|
239
239
|
|
240
240
|
# -------------------------------------------------------------------
|
@@ -354,16 +354,6 @@ class _SimpleCarla(CarlaHostDLL):
|
|
354
354
|
self.set_engine_option(ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT, self.showLogs, "")
|
355
355
|
self.set_engine_option(ENGINE_OPTION_CLIENT_NAME_PREFIX, 0, self.client_name)
|
356
356
|
|
357
|
-
# -------------------------------------------------------------------
|
358
|
-
# Save state (pathcbay connections)
|
359
|
-
|
360
|
-
def encode_saved_state(self):
|
361
|
-
"""
|
362
|
-
Return an object comprised of only basic data types for serialization as JSON
|
363
|
-
in prepration for saving the current project.
|
364
|
-
"""
|
365
|
-
return [ conn.encode_saved_state() for conn in self._connections.values() ]
|
366
|
-
|
367
357
|
# -------------------------------------------------------------------
|
368
358
|
# Engine control / idle loop
|
369
359
|
|
@@ -700,13 +690,16 @@ class _SimpleCarla(CarlaHostDLL):
|
|
700
690
|
Remove a plugin.
|
701
691
|
plugin_id: Plugin to remove.
|
702
692
|
"""
|
703
|
-
|
693
|
+
if not self.lib.carla_remove_plugin(self.handle, plugin_id):
|
694
|
+
raise RuntimeError('Carla will not remove plugin')
|
704
695
|
|
705
696
|
@polite_function
|
706
697
|
def remove_all_plugins(self):
|
707
698
|
"""
|
708
699
|
Remove all plugins.
|
709
700
|
"""
|
701
|
+
for plugin in self._plugin_by_uuid.values():
|
702
|
+
plugin.removing_from_carla = True
|
710
703
|
return bool(self.lib.carla_remove_all_plugins(self.handle))
|
711
704
|
|
712
705
|
@polite_function
|
@@ -1515,6 +1508,7 @@ class _SimpleCarla(CarlaHostDLL):
|
|
1515
1508
|
in_port.connection_added(connection)
|
1516
1509
|
out_client.output_connection_change(connection, True)
|
1517
1510
|
in_client.input_connection_change(connection, True)
|
1511
|
+
self._alert_connection_added(connection)
|
1518
1512
|
|
1519
1513
|
def cb_patchbay_connection_removed(self, connection_id, zero_1, zero_2):
|
1520
1514
|
"""
|
@@ -1526,6 +1520,7 @@ class _SimpleCarla(CarlaHostDLL):
|
|
1526
1520
|
connection.in_port.connection_removed(connection)
|
1527
1521
|
self._clients[connection.out_port.client_id].output_connection_change(connection, False)
|
1528
1522
|
self._clients[connection.in_port.client_id].input_connection_change(connection, False)
|
1523
|
+
self._alert_connection_removed(connection)
|
1529
1524
|
del self._connections[connection_id]
|
1530
1525
|
else:
|
1531
1526
|
logging.warning('cb_patchbay_connection_removed: Connection %s not in ._connections',
|
@@ -1789,6 +1784,8 @@ class Carla(_SimpleCarla):
|
|
1789
1784
|
_cb_client_removed = None
|
1790
1785
|
_cb_port_added = None
|
1791
1786
|
_cb_port_removed = None
|
1787
|
+
_cb_connection_added = None
|
1788
|
+
_cb_connection_removed = None
|
1792
1789
|
_cb_plugin_removed = None
|
1793
1790
|
_cb_last_plugin_removed = None
|
1794
1791
|
_cb_engine_started = None
|
@@ -1819,6 +1816,12 @@ class Carla(_SimpleCarla):
|
|
1819
1816
|
def on_port_removed(self, callback):
|
1820
1817
|
self._cb_port_removed = callback
|
1821
1818
|
|
1819
|
+
def on_connection_added(self, callback):
|
1820
|
+
self._cb_connection_added = callback
|
1821
|
+
|
1822
|
+
def on_connection_removed(self, callback):
|
1823
|
+
self._cb_connection_removed = callback
|
1824
|
+
|
1822
1825
|
def on_plugin_removed(self, callback):
|
1823
1826
|
self._cb_plugin_removed = callback
|
1824
1827
|
|
@@ -2071,6 +2074,14 @@ class Carla(_SimpleCarla):
|
|
2071
2074
|
if self._cb_port_removed is not None:
|
2072
2075
|
self._cb_port_removed(port)
|
2073
2076
|
|
2077
|
+
def _alert_connection_added(self, connection):
|
2078
|
+
if self._cb_connection_added is not None:
|
2079
|
+
self._cb_connection_added(connection)
|
2080
|
+
|
2081
|
+
def _alert_connection_removed(self, connection):
|
2082
|
+
if self._cb_connection_removed is not None:
|
2083
|
+
self._cb_connection_removed(connection)
|
2084
|
+
|
2074
2085
|
def _alert_plugin_removed(self, plugin):
|
2075
2086
|
if self._cb_plugin_removed is not None:
|
2076
2087
|
self._cb_plugin_removed(plugin)
|
@@ -2087,6 +2098,9 @@ class PatchbayClient:
|
|
2087
2098
|
"""
|
2088
2099
|
Patchbay client which has patchbay ports.
|
2089
2100
|
|
2101
|
+
This class is not instantiated directly, but is inherited by
|
2102
|
+
SystemPatchbayClient and Plugin
|
2103
|
+
|
2090
2104
|
Members of interest
|
2091
2105
|
-------------------
|
2092
2106
|
ports: (dict) PatchbayPort objects indexed on port_id
|
@@ -2517,12 +2531,14 @@ class PatchbayPort:
|
|
2517
2531
|
Returns PatchbayClient.
|
2518
2532
|
(May return class extending PatchbayClient, i.e. SystemPatchbayClient / Plugin)
|
2519
2533
|
"""
|
2534
|
+
# TODO: Make this a cached property
|
2520
2535
|
return Carla.instance.client(self.client_id)
|
2521
2536
|
|
2522
2537
|
def client_name(self):
|
2523
2538
|
"""
|
2524
2539
|
Returns (str) the JACK client name of the PatchbayClient which "owns" this PatchbayPort.
|
2525
2540
|
"""
|
2541
|
+
# TODO: Make this a property
|
2526
2542
|
return self.client().client_name
|
2527
2543
|
|
2528
2544
|
def jack_name(self):
|
@@ -2677,6 +2693,7 @@ class Plugin(PatchbayClient):
|
|
2677
2693
|
self.moniker = None
|
2678
2694
|
self.ports_ready = False
|
2679
2695
|
self.added_to_carla = False
|
2696
|
+
self.removing_from_carla = False
|
2680
2697
|
self.is_ready = False
|
2681
2698
|
self.can_drywet = False
|
2682
2699
|
self.can_volume = False
|
@@ -2838,6 +2855,7 @@ class Plugin(PatchbayClient):
|
|
2838
2855
|
|
2839
2856
|
(See also "got_removed")
|
2840
2857
|
"""
|
2858
|
+
self.removing_from_carla = True
|
2841
2859
|
Carla.instance.remove_plugin(self.plugin_id)
|
2842
2860
|
|
2843
2861
|
def plugin_id_changed(self, new_plugin_id):
|
@@ -2871,11 +2889,11 @@ class Plugin(PatchbayClient):
|
|
2871
2889
|
for key, value in self.saved_state["vars"].items():
|
2872
2890
|
setattr(self, key, value)
|
2873
2891
|
for key, value in self.saved_state["parameters"].items():
|
2874
|
-
if not value is None:
|
2892
|
+
if not value is None and int(key) in self.parameters:
|
2875
2893
|
self.parameters[int(key)].value = value
|
2876
2894
|
|
2877
2895
|
# -------------------------------------------------------------------
|
2878
|
-
#
|
2896
|
+
# Port parameter counts
|
2879
2897
|
|
2880
2898
|
@property
|
2881
2899
|
def audio_in_count(self):
|
@@ -3211,7 +3229,7 @@ class Plugin(PatchbayClient):
|
|
3211
3229
|
self._ctrl_channel = value
|
3212
3230
|
|
3213
3231
|
# -------------------------------------------------------------------
|
3214
|
-
# Functions called from
|
3232
|
+
# Functions called from outside
|
3215
3233
|
|
3216
3234
|
def mute(self):
|
3217
3235
|
"""
|
@@ -23,7 +23,7 @@ Qt -enabled classes which utilize signals rather than callbacks.
|
|
23
23
|
import logging, traceback, os, sys
|
24
24
|
import qt_extras.autofit
|
25
25
|
from PyQt5.QtCore import QObject, pyqtSignal
|
26
|
-
from simple_carla import _SimpleCarla, Plugin, PatchbayClient, PatchbayPort
|
26
|
+
from simple_carla import _SimpleCarla, Plugin, PatchbayClient, PatchbayPort, PatchbayConnection
|
27
27
|
|
28
28
|
from carla_backend import (
|
29
29
|
|
@@ -92,6 +92,8 @@ class CarlaQt(_SimpleCarla, QObject):
|
|
92
92
|
sig_patchbay_client_removed = pyqtSignal(PatchbayClient)
|
93
93
|
sig_patchbay_port_added = pyqtSignal(PatchbayPort)
|
94
94
|
sig_patchbay_port_removed = pyqtSignal(PatchbayPort)
|
95
|
+
sig_connection_added = pyqtSignal(PatchbayConnection)
|
96
|
+
sig_connection_removed = pyqtSignal(PatchbayConnection)
|
95
97
|
sig_plugin_removed = pyqtSignal(QObject)
|
96
98
|
sig_last_plugin_removed = pyqtSignal()
|
97
99
|
sig_engine_started = pyqtSignal(int, int, int, int, float, str)
|
@@ -298,6 +300,12 @@ class CarlaQt(_SimpleCarla, QObject):
|
|
298
300
|
def _alert_port_removed(self, port):
|
299
301
|
self.sig_patchbay_port_removed.emit(port)
|
300
302
|
|
303
|
+
def _alert_connection_added(self, connection):
|
304
|
+
self.sig_connection_added.emit(connection)
|
305
|
+
|
306
|
+
def _alert_connection_removed(self, connection):
|
307
|
+
self.sig_connection_removed.emit(connection)
|
308
|
+
|
301
309
|
def _alert_plugin_removed(self, plugin):
|
302
310
|
self.sig_plugin_removed.emit(plugin)
|
303
311
|
|
@@ -327,26 +335,23 @@ class QtPlugin(Plugin, QObject):
|
|
327
335
|
def __init__(self, plugin_def=None, saved_state=None):
|
328
336
|
QObject.__init__(self)
|
329
337
|
Plugin.__init__(self, plugin_def, saved_state)
|
330
|
-
self.was_removed = False
|
331
338
|
|
332
339
|
def ready(self):
|
333
340
|
"""
|
334
341
|
Called after post_embed_init() and all ports ready.
|
335
342
|
You can check the state of this plugin using the "Plugin.is_ready" property.
|
336
343
|
"""
|
337
|
-
#logging.debug('%s ready', self)
|
338
344
|
self.sig_ready.emit(self)
|
339
345
|
|
340
346
|
def got_removed(self):
|
341
|
-
self.was_removed = True
|
342
347
|
self.sig_removed.emit(self)
|
343
348
|
|
344
349
|
def input_connection_change(self, connection, state):
|
345
|
-
if not self.
|
350
|
+
if not self.removing_from_carla:
|
346
351
|
self.sig_connection_change.emit(connection.in_port, connection.out_port, state)
|
347
352
|
|
348
353
|
def output_connection_change(self, connection, state):
|
349
|
-
if not self.
|
354
|
+
if not self.removing_from_carla:
|
350
355
|
self.sig_connection_change.emit(connection.out_port, connection.in_port, state)
|
351
356
|
|
352
357
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|