Skip to content

Commit

Permalink
Implement unified contexts (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
josiah-wolf-oberholtzer authored Feb 24, 2023
1 parent e00e388 commit ef3de35
Show file tree
Hide file tree
Showing 29 changed files with 9,035 additions and 57 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ jobs:
if: ${{ matrix.os == 'windows-latest' }}
run: |
choco install supercollider
mkdir C:\Users\runneradmin\AppData\Local\SuperCollider\synthdefs
- name: Setup audio (Windows) # https://github.com/actions/runner-images/issues/2528#issuecomment-934857719
if: ${{ matrix.os == 'windows-latest' }}
shell: powershell
Expand Down
16 changes: 16 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import asyncio

import pytest
import pytest_asyncio

import supriya
from supriya import scsynth
from supriya.contexts.realtime import BaseServer
from supriya.realtime.servers import AsyncServer, Server


Expand Down Expand Up @@ -34,3 +37,16 @@ async def shutdown_async_servers(shutdown_scsynth, event_loop):
yield
for server in tuple(AsyncServer._servers):
await server._shutdown()


@pytest_asyncio.fixture(autouse=True)
async def shutdown_realtime_contexts(shutdown_scsynth, event_loop):
for context in tuple(BaseServer._contexts):
result = context._shutdown()
if asyncio.iscoroutine(result):
await result
yield
for context in tuple(BaseServer._contexts):
result = context._shutdown()
if asyncio.iscoroutine(result):
await result
19 changes: 10 additions & 9 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@

### UQBAR BOOK ###

uqbar_book_console_setup = [
"import supriya"
]
uqbar_book_console_setup = ["import supriya"]
uqbar_book_console_teardown = [
"for server in tuple(supriya.Server._servers):",
" server._shutdown()",
Expand All @@ -86,7 +84,7 @@
### THEME ###

html_css_files = [
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css",
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"
]
html_domain_indices = True
html_favicon = "favicon.ico"
Expand All @@ -95,18 +93,16 @@
html_static_path = ["_static"]
html_theme = "sphinx_immaterial"
html_theme_options = {
"icon": {
"repo": "fontawesome/brands/github",
},
"icon": {"repo": "fontawesome/brands/github"},
"site_url": "https://josiahwolfoberholtzer.com/supriya/",
"repo_url": "https://github.com/josiah-wolf-oberholtzer/supriya/",
"repo_name": "supriya",
"repo_type": "github",
"edit_uri": "blob/main/docs",
"globaltoc_collapse": True,
"globaltoc_collapse": False,
"features": [
# "header.autohide",
"navigation.expand",
# "navigation.expand",
# "navigation.instant",
# "navigation.sections",
"navigation.tabs",
Expand Down Expand Up @@ -141,3 +137,8 @@
}
html_title = "Supriya"
html_use_index = True
object_description_options = [
("py:.*", dict(include_fields_in_toc=False)), # Hide "Parameters" in TOC
("py:parameter", dict(include_in_toc=False)), # Hide "p" parameter entries in TOC
("py:exception", {"toc_icon_class": "data", "toc_icon_text": "X"}),
]
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ classifiers = [
dependencies = [
"PyYAML >= 6.0",
"platformdirs >= 2.6.0",
"uqbar >= 0.6.6",
"uqbar >= 0.6.9",
'typing-extensions; python_version<"3.8"',
]
description = "A Python API for SuperCollider"
Expand Down
19 changes: 19 additions & 0 deletions supriya/contexts/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""
Tools for interacting with scsynth-compatible execution contexts.
"""

from .core import Buffer, Bus, Context, Group, Node, Synth
from .nonrealtime import Score
from .realtime import AsyncServer, Server

__all__ = [
"AsyncServer",
"Buffer",
"Bus",
"Context",
"Group",
"Node",
"Score",
"Server",
"Synth",
]
Loading

0 comments on commit ef3de35

Please sign in to comment.