diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ab9b09..5df3e6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,23 @@ Before any major/minor/patch bump all unit tests will be run to verify they pass - [x] +## [0.8.0] - 2022-09-29 + +### Added + +- Logging level INFO set on all examples. +- Minor version bump +- vm.subject subsection added to README + +### Changed + +- Logging module used in place of print statements across the interface. +- time.time() now used to steady rate of updates in updater thread. + +### Fixed + +- call to cache bug in updater thread + ## [0.7.0] - 2022-09-03 ### Added diff --git a/README.md b/README.md index bf0eadc..babf779 100644 --- a/README.md +++ b/README.md @@ -579,36 +579,9 @@ with voicemeeterlib.api('banana') as vm: will load a user config file at configs/banana/example.toml for Voicemeeter Banana. -## `Base Module` +## Events -### Remote class - -`voicemeeterlib.api(kind_id: str)` - -You may pass the following optional keyword arguments: - -- `sync`: boolean=False, force the getters to wait for dirty parameters to clear. For most cases leave this as False. -- `ratelimit`: float=0.033, how often to check for updates in ms. -- `subs`: dict={"pdirty": True, "mdirty": True, "midi": True, "ldirty": False}, initialize which event updates to listen for. - - `pdirty`: parameter updates - - `mdirty`: macrobutton updates - - `midi`: midi updates - - `ldirty`: level updates - -#### Event updates - -To receive event updates you should do the following: - -- register your app to receive updates using the `vm.subject.add(observer)` method, where observer is your app. -- define an `on_update(subject)` callback function in your app. The value of subject may be checked for the type of event. - -See `examples/observer` for a demonstration. - -Level updates are considered high volume, by default they are NOT listened for. However, polling them with strip.levels and bus.levels methods will still work. - -So if you don't wish to receive level updates, or you prefer to handle them yourself simply leave ldirty as default (False). - -Each of the update types may be enabled/disabled separately. Don't use a midi controller? You have the option to disable midi updates. +Level updates are considered high volume, by default they are NOT listened for. Use subs keyword arg to initialize event updates. example: @@ -620,6 +593,22 @@ with voicemeeterlib.api('banana', ratelimit=0.05, subs={"ldirty": True, "midi": ... ``` +#### `vm.subject` + +Use the Subject class to register an app as event observer. + +The following methods are available: + +- `add`: registers an app as an event observer +- `remove`: deregisters an app as an event observer + +example: + +```python +# register the app self as an event observer +self.vm.subject.add(self) +``` + #### `vm.event` You may also add/remove event subscriptions as necessary with the Event class. @@ -635,6 +624,20 @@ vm.event.remove("pdirty") print(vm.event.get()) ``` +## Remote class + +`voicemeeterlib.api(kind_id: str)` + +You may pass the following optional keyword arguments: + +- `sync`: boolean=False, force the getters to wait for dirty parameters to clear. For most cases leave this as False. +- `ratelimit`: float=0.033, how often to check for updates in ms. +- `subs`: dict={"pdirty": True, "mdirty": True, "midi": True, "ldirty": False}, initialize which event updates to listen for. + - `pdirty`: parameter updates + - `mdirty`: macrobutton updates + - `midi`: midi updates + - `ldirty`: level updates + Access to lower level Getters and Setters are provided with these functions: - `vm.get(param, is_string=False)`: For getting the value of any parameter. Set string to True if getting a property value expected to return a string. diff --git a/pyproject.toml b/pyproject.toml index 20d175a..e5dceea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "voicemeeter-api" -version = "0.7.2" +version = "0.8.0" description = "A Python wrapper for the Voiceemeter API" authors = ["onyx-and-iris "] license = "MIT"