Skip to content
Snippets Groups Projects
Commit 360711e7 authored by q3k's avatar q3k
Browse files

py: initial bl00mbox stubs

parent 9ab0aee1
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,7 @@ from st3m.ui.view import ViewManager
from ctx import Context
octave = 0
synths = []
synths: List[bl00mbox.patches.tinysynth_fm] = []
scale = [0, 2, 4, 5, 7, 9, 11]
......
......@@ -5,17 +5,26 @@ import leds
from st3m.application import Application
from st3m.input import InputState
from st3m.goose import Tuple
from ctx import Context
class Dot:
def __init__(self, sizex, sizey, imag, real, col):
def __init__(
self,
sizex: float,
sizey: float,
imag: float,
real: float,
col: Tuple[float, float, float],
) -> None:
self.sizex = sizex
self.sizey = sizey
self.imag = imag
self.real = real
self.col = col
def draw(self, i, ctx):
def draw(self, i: int, ctx: Context) -> None:
imag = self.imag
real = self.real
sizex = self.sizex
......@@ -47,14 +56,11 @@ class SimpleDrums(Application):
self.seq.bpm = 80
self.blm.background_mute_override = True
def _highlight_petal(self, num, r, g, b):
def _highlight_petal(self, num: int, r: int, g: int, b: int) -> None:
for i in range(5):
leds.set_rgb((4 * num - i + 2) % 40, r, g, b)
def on_foreground(self):
pass
def _track_col(self, track, smol=False):
def _track_col(self, track: int) -> Tuple[int, int, int]:
rgb = (20, 20, 20)
if track == 0:
rgb = (0, 255, 0)
......@@ -62,11 +68,9 @@ class SimpleDrums(Application):
rgb = (0, 0, 255)
elif track == 2:
rgb = (255, 0, 0)
if smol:
rgb = [x / 256 for x in rgb]
return rgb
def draw(self, ctx):
def draw(self, ctx: Context) -> None:
dots = []
groupgap = 4
for i in range(4):
......@@ -82,7 +86,8 @@ class SimpleDrums(Application):
)
for track in range(3):
rgb = self._track_col(track, smol=True)
rgb = self._track_col(track)
rgbf = (rgb[0] / 256, rgb[1] / 256, rgb[2] / 256)
y = 12 * (track - 1)
for i in range(16):
trigger_state = self.seq.trigger_state(track, i)
......@@ -92,7 +97,7 @@ class SimpleDrums(Application):
x = 12 * (7.5 - i)
x += groupgap * (1.5 - (i // 4))
x = int(x)
dots.append(Dot(size, size, x, y, rgb))
dots.append(Dot(size, size, x, y, rgbf))
dots.append(Dot(1, 40, 0, 0, (0.5, 0.5, 0.5)))
dots.append(Dot(1, 40, 4 * 12 + groupgap, 0, (0.5, 0.5, 0.5)))
......
class tinysynth:
def __init__(self, note: int) -> None:
pass
def tone(self, note: int) -> None:
pass
def start(self) -> None:
pass
def stop(self) -> None:
pass
def attack_ms(self, ms: int) -> None:
pass
def decay_ms(self, ms: int) -> None:
pass
def sustain_ms(self, ms: int) -> None:
pass
def release_ms(self, ms: int) -> None:
pass
def volume(self, v: float) -> None:
pass
def sustain(self, s: float) -> None:
pass
def waveform(self, i: int) -> None:
pass
from bl00mbox import patches
from typing import Optional, TypeVar, Any, Type
patches = patches
class Signal:
value: int
class SignalList:
def __setattr__(self, name: str, value: Signal) -> None: ...
def __getattr__(self, name: str) -> Signal: ...
class Bud:
signals: SignalList
T = TypeVar("T")
P = TypeVar("P", bound=patches._Patch)
class Channel:
background_mute_override: bool
def new(self, thing: Type[T], init_var: Optional[Any] = None) -> T: ...
def new_patch(self, patch: Type[T], init_var: Optional[Any] = None) -> T: ...
import bl00mbox
from typing import List
class _Patch: ...
class tinysynth(_Patch):
def decay(self, v: float) -> None: ...
def waveform(self, v: int) -> None: ...
def attack(self, v: float) -> None: ...
def volume(self, v: float) -> None: ...
def sustain(self, v: float) -> None: ...
def release(self, v: float) -> None: ...
def tone(self, v: float) -> None: ...
def start(self) -> None: ...
def stop(self) -> None: ...
class tinysynth_fm(tinysynth):
def fm_waveform(self, v: int) -> None: ...
def fm(self, v: float) -> None: ...
class step_sequencer(_Patch):
seqs: List[bl00mbox.Bud]
bpm: int
def trigger_state(self, track: int, i: int) -> bool: ...
def trigger_toggle(self, track: int, i: int) -> None: ...
class sampler(_Patch):
sampler: bl00mbox.Bud
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment