jvconnected.interfaces.midi.mapper
- class jvconnected.interfaces.midi.mapper.Map(name: str = '', group_name: str = '', full_name: str = '', index: int = -1)[source]
Bases:
objectStores information for mapping MIDI messages to
ParameterGroupSpecdefinitions- name: str = ''
The
nameof the parameter within itsParameterGroupSpec
- group_name: str = ''
The
nameof theParameterGroupSpec
- full_name: str = ''
Combination of
group_nameandname, separated by a “.”"{group_name}.{name}"
- index: int = -1
The map index
If not set (or
-1), this will be assigned byMidiMapperwhen the instance is added to it
- class jvconnected.interfaces.midi.mapper.ControllerMap(name: str = '', group_name: str = '', full_name: str = '', index: int = -1, controller: int = 0)[source]
Bases:
Map
- class jvconnected.interfaces.midi.mapper.Controller14BitMap(name: str = '', group_name: str = '', full_name: str = '', index: int = -1, controller: int = 0)[source]
Bases:
ControllerMap- property controller_msb: int
The controller index containing the most-significant 7 bits
This will always be equal to the
controllervalue
- property controller_lsb: int
The controller index containing the least-significant 7 bits
Per the MIDI 1.0 specification, this will be
controller_msb+ 32
- class jvconnected.interfaces.midi.mapper.NoteMap(name: str = '', group_name: str = '', full_name: str = '', index: int = -1, note: int = 0)[source]
Bases:
Map
- class jvconnected.interfaces.midi.mapper.AdjustControllerMap(name: str = '', group_name: str = '', full_name: str = '', index: int = -1, controller: int = 0)[source]
Bases:
Map
- jvconnected.interfaces.midi.mapper.DEFAULT_MAPPING: Sequence[Map] = (Controller14BitMap(name='iris_pos', group_name='exposure', full_name='exposure.iris_pos', index=-1, controller=0), AdjustControllerMap(name='master_black_pos', group_name='exposure', full_name='exposure.master_black_pos', index=-1, controller=1), AdjustControllerMap(name='gain_pos', group_name='exposure', full_name='exposure.gain_pos', index=-1, controller=2), ControllerMap(name='red_normalized', group_name='paint', full_name='paint.red_normalized', index=-1, controller=3), ControllerMap(name='blue_normalized', group_name='paint', full_name='paint.blue_normalized', index=-1, controller=4), AdjustControllerMap(name='detail_pos', group_name='paint', full_name='paint.detail_pos', index=-1, controller=5), NoteMap(name='preview', group_name='tally', full_name='tally.preview', index=-1, note=126), NoteMap(name='program', group_name='tally', full_name='tally.program', index=-1, note=127))
Default Midi mapping
The mapping uses the following layout for each camera index (where the channels will become the camera index)
Index
Parameter
Type
Controller/Note
0
Iris
0 (MSB), 32 (LSB)
1
Master Black
1
2
Gain
2
3
Red Paint
3
4
Blue Paint
4
5
Detail
5
6
PGM Tally
126
7
PVW Tally
127
- class jvconnected.interfaces.midi.mapper.MidiMapper(maps: Optional[Sequence[Union[Map, Dict]]] = None)[source]
Bases:
objectContainer for MIDI mapping definitions
- Parameters
maps (Optional[Sequence[Union[Map, Dict]]]) – If given, a sequence of either
Mapinstances ordictsto pass to theadd_map()method. If not provided, theDEFAULT_MAPPINGwill be used.
The maps can be accessed by their
full_nameusingdictmethods.>>> from jvconnected.interfaces.midi.mapper import MidiMapper, ControllerMap, NoteMap >>> mapper = MidiMapper() >>> gain = mapper['exposure.gain_pos'] >>> print(gain) AdjustControllerMap(name='gain_pos', group_name='exposure', full_name='exposure.gain_pos', index=2, controller=2) >>> mapper.get('exposure.gain_pos') AdjustControllerMap(name='gain_pos', group_name='exposure', full_name='exposure.gain_pos', index=2, controller=2) >>> 'exposure.gain_pos' in mapper True
When iterating over the mapper, either directly or through the
keys(),values()oritems()methods, the results will be sorted by theirgroup_namethen theirnameattributes>>> [key for key in mapper] ['exposure.gain_pos', 'exposure.iris_pos', 'exposure.master_black_pos', 'paint.blue_normalized', 'paint.detail_pos', 'paint.red_normalized', 'tally.preview', 'tally.program'] >>> [map_obj.full_name for map_obj in mapper.values()] ['exposure.gain_pos', 'exposure.iris_pos', 'exposure.master_black_pos', 'paint.blue_normalized', 'paint.detail_pos', 'paint.red_normalized', 'tally.preview', 'tally.program']
Maps can also be sorted by their
indicesusing theiter_indexed()method>>> [map_obj.full_name for map_obj in mapper.iter_indexed()] ['exposure.iris_pos', 'exposure.master_black_pos', 'exposure.gain_pos', 'paint.red_normalized', 'paint.blue_normalized', 'paint.detail_pos', 'tally.preview', 'tally.program'] >>> [map_obj.index for map_obj in mapper.values()] [2, 0, 1, 4, 5, 3, 6, 7]
By default, MidiMapper will use a set of
predefined mapswhen initialized. This can be overridden by passing a sequence of map definitions (or an empty one) when creating it>>> mapper = MidiMapper([]) >>> len(mapper) 0
Then use
add_map()to create maps using adict>>> pgm_tally = mapper.add_map(dict(map_type='note', full_name='tally.program', note=127)) >>> mapper['tally.program'] NoteMap(name='program', group_name='tally', full_name='tally.program', index=0, note=127)
Or existing
Mapinstances>>> pvw_tally = NoteMap(group_name='tally', name='preview', note=126) >>> pvw_tally NoteMap(name='preview', group_name='tally', full_name='tally.preview', index=-1, note=126) >>> mapper.add_map(pvw_tally) >>> mapper['tally.preview'] NoteMap(name='preview', group_name='tally', full_name='tally.preview', index=1, note=126) >>> mapper['tally.preview'] is pvw_tally True
- map_grouped: Dict[str, Dict[str, Map]]
The
Mapdefinitions stored as nested dicts bygroup_nameandname
- add_map(map_obj: Union[Map, Dict]) Map[source]
Add or create a
MapdefinitionIf the given argument is a
dict, it must contain a value for “map_type” as described in thecreate_map()method, with the remaining items passed as keyword arguments.If the given argument is a
Mapinstance, it is added usingadd_map_obj().
- get(full_name: str) Optional[Map][source]
Get the
Mapinstance matching the givenfull_nameIf not found,
Noneis returned