def getAdminForm(): #We need to list a selection of available input devices mapped to the Keyboard parts. page = """ <form target="" method="POST"> """ midiInDevices = MIDIDevice.getAvailableMIDIInDevices() for keysNum in range(1,4): keyboard = 'Keyboard {}'.format(keysNum) page += """ <h1>{keyboard}</h1> <p> """.format(keyboard=keyboard) for device in midiInDevices: page += """ <input type="submit" name="{keyboard}/device" value="{device}"> """.format(keyboard=keyboard, device=device) page += """ </p> </form> """ return page
from synthesizers.roland_fantom import RolandFantomXR from synthesizers.nord import NordStage2 from synthesizers import MIDIDevice from webpages import COEVoices import itertools import re class MIDIDeviceLocationError(Exception): pass class NotEnoughArgs(Exception): pass ## MIDIOutDevices (Just the Roland for now...) midiOutDeviceIDs = MIDIDevice.getMIDIOutDevices() print('\nFound MIDI Out Devices: "{0}"'.format(midiOutDeviceIDs)) MIDI_OUT_ROLAND = None for port, name in midiOutDeviceIDs: if re.match(r'.*FANTOM-X.*', name): #Roland Fantom-XR Found! MIDI_OUT_ROLAND = NordStage2.MIDIOutDevice(port, 15) break if MIDI_OUT_ROLAND is None: raise MIDIDeviceLocationError('Unable to find Roland USB Device. ;_;') ## MIDIInDevice(s) #Figure out the MIDI Input devices. midiInDeviceIDs = MIDIDevice.getMIDIInDevices() print('\nFound MIDI In Devices: "{0}"'.format(midiOutDeviceIDs)) #Find the Nord