diff options
Diffstat (limited to 'tascam_fw_console/osc.py')
| -rw-r--r-- | tascam_fw_console/osc.py | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tascam_fw_console/osc.py b/tascam_fw_console/osc.py new file mode 100644 index 0000000..fb17449 --- /dev/null +++ b/tascam_fw_console/osc.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python3 +""" + Open Sound Control send/recieve daemon for Tascam Firewire control surface + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + :copyright: Copyright (c) 2018 Scott Bahling + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program (see the file COPYING); if not, write to the + Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + :license: GPL-2.0, see COPYING for details +""" + +from pythonosc import dispatcher +from pythonosc import osc_server +from pythonosc import udp_client + +client = None +server = None +dispatcher = dispatcher.Dispatcher() + + +def init_dispatcher(console): + dispatcher.map("/loop_toggle", console.loop_toggle_handler) + dispatcher.map("/transport_stop", console.transport_stop_handler) + dispatcher.map("/transport_play", console.transport_play_handler) + dispatcher.map("/ffwd", console.ffwd_handler) + dispatcher.map("/rewind", console.rewind_handler) + dispatcher.map("/rec_enable_toggle", console.rec_enable_toggle_handler) + dispatcher.map('/strip/fader', console.strip_fader_handler) + dispatcher.map('/strip/mute', console.strip_mute_handler) + dispatcher.map('/strip/solo', console.strip_solo_handler) + dispatcher.map('/strip/recenable', console.strip_recenable_handler) + dispatcher.map('/master/fader', console.master_fader_handler) + dispatcher.map('/strip/pan_stereo_position', + console.pan_stereo_position_handler) + dispatcher.map('/strip/name', console.strip_name_handler) + dispatcher.map('/bank_up', console.bank_up_handler) + dispatcher.map('/bank_down', console.bank_down_handler) + dispatcher.set_default_handler(console.default_handler) + + +def init_client(ip, port): + global client + client = udp_client.SimpleUDPClient(ip, port) + + +def init_server(ip, port, console): + global server + init_dispatcher(console) + server = osc_server.ThreadingOSCUDPServer((ip, port), dispatcher) |
