simple-carla 1.3.0__tar.gz → 1.4.0__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.3.0 → simple_carla-1.4.0}/PKG-INFO +1 -1
- {simple_carla-1.3.0 → simple_carla-1.4.0}/pyproject.toml +1 -1
- {simple_carla-1.3.0 → simple_carla-1.4.0}/simple_carla/__init__.py +24 -36
- {simple_carla-1.3.0 → simple_carla-1.4.0}/simple_carla/qt.py +63 -18
- {simple_carla-1.3.0 → simple_carla-1.4.0}/.gitignore +0 -0
- {simple_carla-1.3.0 → simple_carla-1.4.0}/LICENSE +0 -0
- {simple_carla-1.3.0 → simple_carla-1.4.0}/README.md +0 -0
- {simple_carla-1.3.0 → simple_carla-1.4.0}/simple_carla/plugin_dialog.py +0 -0
- {simple_carla-1.3.0 → simple_carla-1.4.0}/simple_carla/scripts/__init__.py +0 -0
- {simple_carla-1.3.0 → simple_carla-1.4.0}/simple_carla/scripts/sc_plugin_def.py +0 -0
- {simple_carla-1.3.0 → simple_carla-1.4.0}/tests/carla.py +0 -0
- {simple_carla-1.3.0 → simple_carla-1.4.0}/tests/qt_carla.py +0 -0
@@ -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.4.0"
|
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
|
@@ -233,8 +233,10 @@ from carla_backend import (
|
|
233
233
|
FILE_CALLBACK_SAVE
|
234
234
|
)
|
235
235
|
|
236
|
+
from resources_rc import qCleanupResources
|
236
237
|
|
237
|
-
|
238
|
+
|
239
|
+
__version__ = "1.4.0"
|
238
240
|
|
239
241
|
|
240
242
|
# -------------------------------------------------------------------
|
@@ -698,6 +700,8 @@ class _SimpleCarla(CarlaHostDLL):
|
|
698
700
|
"""
|
699
701
|
Remove all plugins.
|
700
702
|
"""
|
703
|
+
for plugin in self._plugin_by_uuid.values():
|
704
|
+
plugin.removing_from_carla = True
|
701
705
|
return bool(self.lib.carla_remove_all_plugins(self.handle))
|
702
706
|
|
703
707
|
@polite_function
|
@@ -1532,7 +1536,7 @@ class _SimpleCarla(CarlaHostDLL):
|
|
1532
1536
|
self._plugin_by_uuid[plugin.uuid] = plugin
|
1533
1537
|
if self.is_engine_running():
|
1534
1538
|
if not self._add_plugin( # Carla parameter
|
1535
|
-
|
1539
|
+
# ----------------------------------------- # ---------------
|
1536
1540
|
plugin.plugin_def['build'], # btype
|
1537
1541
|
plugin.plugin_def['type'], # ptype
|
1538
1542
|
plugin.plugin_def['filename'], # filename
|
@@ -1541,7 +1545,7 @@ class _SimpleCarla(CarlaHostDLL):
|
|
1541
1545
|
int(plugin.plugin_def['uniqueId'] or 0), # uniqueId
|
1542
1546
|
None, # extraPtr
|
1543
1547
|
PLUGIN_OPTIONS_NULL # options
|
1544
|
-
|
1548
|
+
# ----------------------------------------- # ---------------
|
1545
1549
|
): raise Exception("Failed to add plugin")
|
1546
1550
|
|
1547
1551
|
# -------------------------------------------------------------------
|
@@ -2678,7 +2682,7 @@ class Plugin(PatchbayClient):
|
|
2678
2682
|
# -------------------------------------------------------------------
|
2679
2683
|
# Internal lifecycle events
|
2680
2684
|
|
2681
|
-
def __init__(self, plugin_def=None, saved_state=None):
|
2685
|
+
def __init__(self, plugin_def = None, saved_state = None):
|
2682
2686
|
if plugin_def is None:
|
2683
2687
|
if self.plugin_def is None:
|
2684
2688
|
raise RuntimeError("No definition for plugin")
|
@@ -2891,7 +2895,7 @@ class Plugin(PatchbayClient):
|
|
2891
2895
|
self.parameters[int(key)].value = value
|
2892
2896
|
|
2893
2897
|
# -------------------------------------------------------------------
|
2894
|
-
#
|
2898
|
+
# Port parameter counts
|
2895
2899
|
|
2896
2900
|
@property
|
2897
2901
|
def audio_in_count(self):
|
@@ -2995,7 +2999,7 @@ class Plugin(PatchbayClient):
|
|
2995
2999
|
|
2996
3000
|
def parameter_internal_value_changed(self, parameter, value):
|
2997
3001
|
"""
|
2998
|
-
Called by the
|
3002
|
+
Called by the Carla host engine when the internal value of a parameter has changed.
|
2999
3003
|
"parameter" is a Parameter object.
|
3000
3004
|
"value" is the new value of the Parameter.
|
3001
3005
|
The value of the Parameter object will have already been set when this is called.
|
@@ -3227,7 +3231,7 @@ class Plugin(PatchbayClient):
|
|
3227
3231
|
self._ctrl_channel = value
|
3228
3232
|
|
3229
3233
|
# -------------------------------------------------------------------
|
3230
|
-
# Functions called from
|
3234
|
+
# Functions called from outside
|
3231
3235
|
|
3232
3236
|
def mute(self):
|
3233
3237
|
"""
|
@@ -3305,27 +3309,17 @@ class Parameter:
|
|
3305
3309
|
setattr(self, k, v)
|
3306
3310
|
self.range = self.max - self.min
|
3307
3311
|
|
3308
|
-
#logging.debug('%s min %s max %s step %s stepSmall %s stepLarge %s using unit "%s"',
|
3309
|
-
#self.name, self.min, self.max, self.step, self.stepSmall, self.stepLarge, self.unit)
|
3310
|
-
|
3311
3312
|
# Scale points (get_parameter_scalepoint_info) if necessary
|
3312
|
-
self.
|
3313
|
-
|
3314
|
-
for
|
3315
|
-
|
3316
|
-
for sc_idx in range(self.scalePointCount)
|
3317
|
-
]} if self.uses_scalepoints else None
|
3318
|
-
if not self.__scale_points is None and len(self.__scale_points) > 2:
|
3319
|
-
logging.debug('%s SCALEPOINTS USED:', str(self.plugin()))
|
3320
|
-
with StreamToLogger() as slog:
|
3321
|
-
print(self.__scale_points, file = slog)
|
3313
|
+
self.scale_points = [ ( sp['label'], sp['value'] ) for sp in [
|
3314
|
+
carla.get_parameter_scalepoint_info(self.plugin_id, self.parameter_id, sc_idx) \
|
3315
|
+
for sc_idx in range(self.scalePointCount)
|
3316
|
+
]] if self.uses_scalepoints else None
|
3322
3317
|
|
3323
3318
|
def internal_value_changed(self, value):
|
3324
3319
|
"""
|
3325
|
-
Called from Carla engine when the value of this Parameter changed
|
3320
|
+
Called from Carla engine when the value of this Parameter changed, as by a
|
3321
|
+
custom dialog rendered via carla.
|
3326
3322
|
"""
|
3327
|
-
#TODO: Test if called when parameter is set, and note in docs
|
3328
|
-
#logging.debug('internal_value_changed %s %s', self, value)
|
3329
3323
|
self.__value = value
|
3330
3324
|
|
3331
3325
|
@property
|
@@ -3342,19 +3336,13 @@ class Parameter:
|
|
3342
3336
|
Sets the value of this Parameter both in Carla and cached.
|
3343
3337
|
"value" must be in the range of this Parameter's "min" and "max".
|
3344
3338
|
"""
|
3345
|
-
if
|
3346
|
-
if
|
3347
|
-
|
3348
|
-
|
3349
|
-
self.__value = value
|
3350
|
-
Carla.instance.set_parameter_value(self.plugin_id, self.parameter_id, value)
|
3351
|
-
else:
|
3352
|
-
logging.warning('Parameter "%s" (%s) out of range. Min: %s Max %s',
|
3353
|
-
self.name, value, self.min, self.max)
|
3339
|
+
if self.__value != value:
|
3340
|
+
if self.min <= value <= self.max:
|
3341
|
+
self.__value = value
|
3342
|
+
Carla.instance.set_parameter_value(self.plugin_id, self.parameter_id, value)
|
3354
3343
|
else:
|
3355
|
-
logging.
|
3356
|
-
|
3357
|
-
logging.debug('PLUGIN %s PARAMETER %s HAS NO min', self.plugin(), self)
|
3344
|
+
logging.warning('Parameter "%s" (%s) out of range. Min: %s Max %s',
|
3345
|
+
self.name, value, self.min, self.max)
|
3358
3346
|
|
3359
3347
|
def get_internal_value(self):
|
3360
3348
|
"""
|
@@ -22,8 +22,9 @@ Qt -enabled classes which utilize signals rather than callbacks.
|
|
22
22
|
"""
|
23
23
|
import logging, traceback, os, sys
|
24
24
|
import qt_extras.autofit
|
25
|
-
from PyQt5.QtCore import
|
26
|
-
from simple_carla import
|
25
|
+
from PyQt5.QtCore import QObject, pyqtSignal
|
26
|
+
from simple_carla import _SimpleCarla, Plugin, Parameter, \
|
27
|
+
PatchbayClient, PatchbayPort, PatchbayConnection
|
27
28
|
|
28
29
|
from carla_backend import (
|
29
30
|
|
@@ -314,27 +315,36 @@ class CarlaQt(_SimpleCarla, QObject):
|
|
314
315
|
|
315
316
|
|
316
317
|
|
317
|
-
class
|
318
|
+
class AbstractQtPlugin(Plugin):
|
318
319
|
"""
|
319
|
-
This is an abstract class
|
320
|
-
|
321
|
-
TrackWidget). (Qt does not allow inheriting from multiple classes which
|
322
|
-
extend QObject)
|
320
|
+
This is an abstract class for use by classes which you wish to inherit from a
|
321
|
+
class which itself already inherits from QObject.
|
323
322
|
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
plugin.add_to_carla()
|
323
|
+
Qt does not allow inheriting from multiple classes which extend QObject, so
|
324
|
+
extending QObject in THIS class would make it impossible for you to use it as
|
325
|
+
a base class.
|
328
326
|
|
329
|
-
|
327
|
+
For example:
|
330
328
|
|
331
|
-
|
332
|
-
sig_removed = pyqtSignal(Plugin)
|
333
|
-
sig_connection_change = pyqtSignal(PatchbayPort, PatchbayPort, bool)
|
329
|
+
class MyVisualPlugin(QFrame, AbstractQtPlugin):
|
334
330
|
|
335
|
-
|
336
|
-
|
337
|
-
Plugin
|
331
|
+
# You must define these signals!
|
332
|
+
sig_ready = pyqtSignal(Plugin)
|
333
|
+
sig_removed = pyqtSignal(Plugin)
|
334
|
+
sig_connection_change = pyqtSignal(PatchbayPort, PatchbayPort, bool)
|
335
|
+
sig_parameter_changed = pyqtSignal(Plugin, Parameter, float)
|
336
|
+
|
337
|
+
plugin_def = {...}
|
338
|
+
|
339
|
+
def __init__(self, parent, plugin_def, saved_state = None):
|
340
|
+
QFrame.__init__(self, parent)
|
341
|
+
AbstractQtPlugin.__init__(self, plugin_def, saved_state)
|
342
|
+
|
343
|
+
plugin = MyVisualPlugin()
|
344
|
+
plugin.sig_ready.connect(self.plugin_ready)
|
345
|
+
plugin.add_to_carla()
|
346
|
+
layout.addWidget(plugin)
|
347
|
+
"""
|
338
348
|
|
339
349
|
def ready(self):
|
340
350
|
"""
|
@@ -354,5 +364,40 @@ class QtPlugin(Plugin, QObject):
|
|
354
364
|
if not self.removing_from_carla:
|
355
365
|
self.sig_connection_change.emit(connection.out_port, connection.in_port, state)
|
356
366
|
|
367
|
+
def parameter_internal_value_changed(self, parameter, value):
|
368
|
+
"""
|
369
|
+
Called by the Carla host engine when the internal value of a parameter has changed.
|
370
|
+
"parameter" is a Parameter object.
|
371
|
+
"value" is the new value of the Parameter.
|
372
|
+
|
373
|
+
The value of the Parameter object will have already been set when this is called.
|
374
|
+
"""
|
375
|
+
self.sig_parameter_changed.emit(self, parameter, value)
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
class QtPlugin(AbstractQtPlugin, QObject):
|
380
|
+
"""
|
381
|
+
A class which inherits from both Plugin and QObject. It can be used by plugins
|
382
|
+
which have no direct user-interface, but still need to emit signals.
|
383
|
+
|
384
|
+
For example:
|
385
|
+
|
386
|
+
plugin = QtPlugin(plugin_def)
|
387
|
+
plugin.sig_ready.connect(self.plugin_ready)
|
388
|
+
plugin.add_to_carla()
|
389
|
+
|
390
|
+
"""
|
391
|
+
|
392
|
+
sig_ready = pyqtSignal(Plugin)
|
393
|
+
sig_removed = pyqtSignal(Plugin)
|
394
|
+
sig_connection_change = pyqtSignal(PatchbayPort, PatchbayPort, bool)
|
395
|
+
sig_parameter_changed = pyqtSignal(Plugin, Parameter, float)
|
396
|
+
|
397
|
+
def __init__(self, plugin_def=None, saved_state=None):
|
398
|
+
QObject.__init__(self)
|
399
|
+
Plugin.__init__(self, plugin_def, saved_state)
|
400
|
+
|
401
|
+
|
357
402
|
|
358
403
|
# end simple_carla/qt.py
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|