-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from PedalPi/v0.4.0
v0.4.0
- Loading branch information
Showing
16 changed files
with
523 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ exclude_lines = | |
def __repr__ | ||
pass | ||
def __str__ | ||
[run] | ||
omit = pluginsmanager/model/lv2/lilvlib.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ Contents: | |
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
jack | ||
mod_host | ||
model | ||
model_lv2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
PedalPi - PluginsManager - Jack | ||
=============================== | ||
|
||
pluginsmanager.jack.jack_client.JackClient | ||
------------------------------------------ | ||
|
||
.. autoclass:: pluginsmanager.jack.jack_client.JackClient | ||
:members: | ||
:special-members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright 2017 SrMouraSilva | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Copyright 2017 SrMouraSilva | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import logging | ||
import jack | ||
|
||
|
||
class JackClient(object): | ||
""" | ||
Based in: http://jackclient-python.readthedocs.io/en/0.4.2/examples.html#chatty-client | ||
Through the :class:`JackClient` it is possible to be notified when `x-run` | ||
occurs and when the Jack server is closed:: | ||
>>> client = JackClient() | ||
>>> client.xrun_callback = lambda delay: print('x-run', delay) | ||
>>> client.shutdown_callback = lambda status, reason: print('shutdown: ', status, reason) | ||
When you don't use anymore, close it:: | ||
>>> client.close() | ||
:param bool no_start_server: False if starts a new JACK server | ||
True if uses a already started jack (ex: using `jackdump`) | ||
:param name: Jack client name. Default: `JackClient` | ||
""" | ||
def __init__(self, no_start_server=True, name=None): | ||
if name is None: | ||
name = self.__class__.__name__ | ||
|
||
self.client = jack.Client(name=name, no_start_server=no_start_server) | ||
|
||
self.xrun_callback = lambda delay: ... | ||
self.shutdown_callback = lambda status, reason: ... | ||
|
||
if self.client.status.server_started: | ||
logging.info('JACK server was started') | ||
else: | ||
logging.info('JACK server was already running') | ||
|
||
if self.client.status.name_not_unique: | ||
logging.info('Unique client name generated {}'.format(self.client.name)) | ||
|
||
@self.client.set_xrun_callback | ||
def xrun(delay): | ||
self.xrun_callback(delay) | ||
|
||
@self.client.set_shutdown_callback | ||
def shutdown(status, reason): | ||
self.shutdown_callback(status, reason) | ||
|
||
self.client.activate() | ||
|
||
def close(self): | ||
""" | ||
Deactive and closes the jack client | ||
""" | ||
self.client.deactivate() | ||
self.client.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.