Skip to content

Commit

Permalink
Merge pull request #5 from quaternionmedia/xair
Browse files Browse the repository at this point in the history
✖️ Xair
  • Loading branch information
mrharpo authored Jan 6, 2023
2 parents de65bad + 2be2bd5 commit 9a82853
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 10 deletions.
25 changes: 25 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
changelog:
categories:
- title: Breaking Changes 🪅
labels:
- breaking 💔

- title: New Features 🎉
labels:
- enhancement ➕

- title: Bugfixes 🐛
labels:
- bug 🐛

- title: Maintenance 🔩
labels:
- maintenance 🔧
- CI 🦾
- CD 🏗️
- production 🎭
- test 🧪

- title: Other Changes
labels:
- *
1 change: 1 addition & 0 deletions ludwig/boards/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from .qu24 import Qu24
from .gld import Gld
from .xair import XAir
4 changes: 2 additions & 2 deletions ludwig/boards/gld.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ def meters(self):
self.sysex([0x12, 0x1])

@mixer
def fader(self, channel: uint7, volume: uint8):
def fader(self, channel: uint7, volume: uint7):
self.nrpn(channel=channel, param=0x17, data1=volume, data2=0x7)

@mixer
def channel_assign_to_main_mix(self, channel: uint7, on: bool):
self.nrpn(channel=channel, param=0x18, data1=0x7F if on else 0x3F, data2=0x7)

@mixer
def aux_send_level(self, channel: uint7, snd: uint8, level: uint8):
def aux_send_level(self, channel: uint7, snd: uint8, level: uint7):
self.nrpn(channel=channel, param=snd, data1=level, data2=0x7)

@mixer
Expand Down
60 changes: 60 additions & 0 deletions ludwig/boards/xair.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
from ludwig import mixer, Mixer, Midi
from rtmidi.midiconstants import NOTE_ON, CONTROL_CHANGE
from ludwig.types import uint1, uint2, uint3, uint4, uint5, uint7, uint8
from pydantic import conint


class XAir(Midi, Mixer):
"""Behringer XAir mixer"""

@mixer
def fader(self, channel: uint5, volume: uint7):
"""Fade the channel
Fader CH CMD No. Value Comment
CH Faders 1 CC 0-15 0...127 Input Channels 1-16
CH Faders 1 CC 16 0...127 AuxLineIn 17-18 / USB Recorder Playback (stereo)
CH Faders 1 CC 17-20 0...127 FX1-4 Return (stereo)
Send Faders 1 CC 21-26 0...127 Aux1-6 / Subgroup
Send Faders 1 CC 27-30 0...127 Fx1-4
Main Fader 1 CC 31 0...127 Main LR (stereo)
"""
self.send([CONTROL_CHANGE | 0, channel, volume])

@mixer
def pan(self, channel: uint5, pan: uint7):
"""Pan the channel
Pan CH CMD No. Value Comment
CH PAN 3 CC 0-15 1...127 Panorama Input Channels 1-16, 64=center
CH PAN 3 CC 16 1...127 Balance AuxLineIn 17-18 / USB Recorder Playback, 64=center
CH PAN 3 CC 17-20 1...127 Balance FX1-4 Return, 64=center
Aux PAN (Subgroup) 3 CC 21-26 1...127 Panorama Aux1-6 / Subgroup, 64=center
Main Balance 3 CC 31 1...127 Balance Main LR, 64=center
"""
self.send([CONTROL_CHANGE | 2, channel, pan])

@mixer
def mute(self, channel: uint5):
"""Mute the channel
Mute CH CMD No. Value Comment
CH Mutes 2 CC 0-15 127 Input Channels 1-16
CH Mutes 2 CC 16 127 AuxLineIn 17-18 / USB Recorder Playback (stereo)
CH Mutes 2 CC 17-20 127 FX1-4 Return (stereo)
Send Mutes 2 CC 21-26 127 Aux1-6 / Subgroup
Send Mutes 2 CC 27-30 127 Fx1-4
Main Mute 2 CC 31 127 Main LR (stereo)
"""
self.send([CONTROL_CHANGE | 1, channel, 127])

@mixer
def unmute(self, channel: uint5):
"""Unmute the channel
Mute CH CMD No. Value Comment
CH Mutes 2 CC 0-15 0 Input Channels 1-16
CH Mutes 2 CC 16 0 AuxLineIn 17-18 / USB Recorder Playback (stereo)
CH Mutes 2 CC 17-20 0 FX1-4 Return (stereo)
Send Mutes 2 CC 21-26 0 Aux1-6 / Subgroup
Send Mutes 2 CC 27-30 0 Fx1-4
Main Mute 2 CC 31 0 Main LR (stereo)
"""
self.send([CONTROL_CHANGE | 1, channel, 0])

8 changes: 2 additions & 6 deletions ludwig/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .mixer import Mixer
from .boards import Qu24
from .boards import XAir
from pluggy import PluginManager
from argparse import ArgumentTypeError

Expand Down Expand Up @@ -36,8 +36,6 @@ def main():
action='store_true',
help='unmute the channel(s)',
)
args = parser.parse_args()

args = parser.parse_args()
# print(args)
for c in args.channels:
Expand All @@ -56,9 +54,7 @@ def main():
def get_plugin_manager():
pm = PluginManager('mixer')
pm.add_hookspecs(Mixer)
pm.register(Qu24(hook=pm.hook, port='QU-24 MIDI 1', client_name='Qu24'))
# pm.register(Qu24(hook=pm.hook, port='Launchpad X:Launchpad X MIDI 2', client_name='Qu24'))
# pm.register(Qu24(hook=pm.hook, port='FreeWheeling:FreeWheeling IN 1', input_name='FreeWheeling:FreeWheeling OUT 1', client_name='Qu24'))
pm.register(XAir(hook=pm.hook, port='X18', client_name='XAir'))
return pm


Expand Down
7 changes: 5 additions & 2 deletions ludwig/midi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from rtmidi.midiutil import open_midioutput, open_midiinput
from rtmidi.midiconstants import CONTROL_CHANGE
from ludwig.types import uint4, uint7, uint8
from rtmidi import API_UNIX_JACK


class Midi:
Expand Down Expand Up @@ -28,10 +29,12 @@ def __init__(
self.client_name = client_name
self.channel = channel
self.midi, self.name = open_midioutput(
port, client_name=client_name + '-output'
port, client_name=client_name + '-output', api=API_UNIX_JACK
)
self.input, self.input_name = open_midiinput(
input_name if input_name else port, client_name=client_name + '-input'
input_name if input_name else port,
client_name=client_name + '-input',
api=API_UNIX_JACK,
)
self.input.ignore_types(sysex=False)
self.input.set_callback(self)
Expand Down
1 change: 1 addition & 0 deletions ludwig/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
uint2 = conint(ge=0, lt=4)
uint3 = conint(ge=0, lt=8)
uint4 = conint(ge=0, lt=16)
uint5 = conint(ge=0, lt=32)
uint7 = conint(ge=0, lt=128)
uint8 = conint(ge=0, lt=256)
uint16 = conint(ge=0, lt=2**16)

0 comments on commit 9a82853

Please sign in to comment.