diff --git a/README.md b/README.md index 8915f01..d420996 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,7 @@ The CamillaConnection class provides the following methods: |`disconnect()` | Close the connection to the websocket.| |`is_connected()` | Is websocket connected? Returns True or False.| |`get_version()` | Read CamillaDSP version, returns a tuple with 3 elements| +|`get_library_version()` | Read pyCamillaDSP version, returns a tuple with 3 elements| |`get_state()` | Get current processing state. Returns one of "RUNNING", "PAUSED" or "INACTIVE".| |`get_signal_range()` | Get current signal range.| |`get_signal_range_dB()` | Get current signal range in dB.| diff --git a/camilladsp/camilladsp.py b/camilladsp/camilladsp.py index 34d2da1..02118ce 100644 --- a/camilladsp/camilladsp.py +++ b/camilladsp/camilladsp.py @@ -4,7 +4,9 @@ import math from threading import Lock -standard_rates = [ +VERSION = (0, 4, 1) + +STANDARD_RATES = [ 8000, 11025, 16000, @@ -121,6 +123,10 @@ def get_version(self): """Read CamillaDSP version, returns a tuple of (major, minor, patch).""" return self._version + def get_library_version(self): + """Read pycamilladsp version, returns a tuple of (major, minor, patch).""" + return VERSION + def get_state(self): """ Get current processing state. @@ -158,8 +164,8 @@ def get_capture_rate(self): Get current capture rate. Returns the nearest common value. """ rate = self.get_capture_rate_raw() - if 0.9 * standard_rates[0] < rate < 1.1 * standard_rates[-1]: - return min(standard_rates, key=lambda val: abs(val - rate)) + if 0.9 * STANDARD_RATES[0] < rate < 1.1 * STANDARD_RATES[-1]: + return min(STANDARD_RATES, key=lambda val: abs(val - rate)) else: return None @@ -340,3 +346,5 @@ def validate_config(self, config_object): print("ValidateConfig OK:", valconf) except CamillaError as e: print("ValidateConfig Error:", e) + + #cdsp.disconnect() diff --git a/setup.py b/setup.py index 53c715e..80c9ba2 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="camilladsp", - version="0.4.0", + version="0.4.1", author="Henrik Enquist", author_email="henrik.enquist@gmail.com", description="A library for comminucating with CamillaDSP", diff --git a/tests/test_camillaws.py b/tests/test_camillaws.py index 44218a1..b5b819b 100644 --- a/tests/test_camillaws.py +++ b/tests/test_camillaws.py @@ -82,6 +82,7 @@ def test_connect(camilla_mockws): assert camilla_mockws.is_connected() assert camilla_mockws.get_state() == "IDLE" assert camilla_mockws.get_version() == ('0', '3', '2') + assert camilla_mockws.get_library_version() == camilladsp.camilladsp.VERSION camilla_mockws.disconnect() assert not camilla_mockws.is_connected()