From 93ffa46e65433ea4e1ab12d9ef44e3c0d655dc6d Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Sun, 23 Feb 2025 13:15:21 +0100 Subject: Clean up MIDI controller --- solo-tool-project/src/solo_tool/handlers.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'solo-tool-project/src/solo_tool/handlers.py') diff --git a/solo-tool-project/src/solo_tool/handlers.py b/solo-tool-project/src/solo_tool/handlers.py index 0a4ee21..040928c 100644 --- a/solo-tool-project/src/solo_tool/handlers.py +++ b/solo-tool-project/src/solo_tool/handlers.py @@ -2,6 +2,14 @@ from collections.abc import Callable from solo_tool.solo_tool import SoloTool +def playPause(st: SoloTool) -> Callable[[], None]: + def f(): + if st.isPlaying(): + st.pause() + else: + st.play() + return f + def changeSong(st: SoloTool, delta: int) -> Callable[[], None]: def f(): if st.song is None: @@ -33,3 +41,12 @@ def changeKeyPoint(st: SoloTool, delta: int) -> Callable[[], None]: st.keyPoint = st.keyPoints[new] return f +def rateAbsolute(st: SoloTool, value: float) -> Callable[[], None]: + def f(): + st.rate = value + return f + +def volumeAbsolute(st: SoloTool, value: float) -> Callable[[], None]: + def f(): + st.volume = value + return f -- cgit v1.2.3