/[svn]/linuxsampler/trunk/src/drivers/midi/MidiInputPort.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/drivers/midi/MidiInputPort.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1695 by schoenebeck, Sat Feb 16 01:09:33 2008 UTC revision 2380 by schoenebeck, Wed Nov 21 21:52:15 2012 UTC
# Line 3  Line 3 
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *
6   *   Copyright (C) 2005 - 2008 Christian Schoenebeck                       *   *   Copyright (C) 2005 - 2012 Christian Schoenebeck                       *
7   *                                                                         *   *                                                                         *
8   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
9   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 133  namespace LinuxSampler { Line 133  namespace LinuxSampler {
133               * Disconnect the previously connected virtual MIDI device.               * Disconnect the previously connected virtual MIDI device.
134               */               */
135              void Disconnect(VirtualMidiDevice* pDevice);              void Disconnect(VirtualMidiDevice* pDevice);
136                
137                /**
138                 * Registers the given @a filter to be applied against all note on
139                 * events, adjusting their MIDI velocity data. The vector supplied
140                 * here must exactly be either of size 128 or 0. In case the given
141                 * vector is of size 128, it will be used as lookup table by this
142                 * MIDI inpurt port to remap any incoming MIDI note on velocity
143                 * data to the respective value in that vector, or exactly:
144                 * @code
145                 * velocity = filter[velocity];
146                 * @endcode
147                 * Accordingly the values in the vector have to be in the range
148                 * 0..127, however note that a value 0 should actually never be
149                 * used, since by MIDI specification, a note on with velocity 0 is
150                 * interpreted as note off event instead!
151                 *
152                 * If a vector of size 0 is supplied, this note on velocity filter
153                 * mechanism will be disabled.
154                 *
155                 * @param filter - lookup table in the format described above
156                 * @throws MidiInputException - if filter is in invalid format
157                 */
158                void SetNoteOnVelocityFilter(const std::vector<uint8_t>& filter);
159    
160    
161              /////////////////////////////////////////////////////////////////              /////////////////////////////////////////////////////////////////
# Line 277  namespace LinuxSampler { Line 300  namespace LinuxSampler {
300    
301              /**              /**
302               * Should be called by the implementing MIDI input device               * Should be called by the implementing MIDI input device
303               * whenever a program change event arrived, this will cause the               * whenever a program change event arrived. In case the
304               * appropriate sampler channel to be connected with this MIDI               * respective sampler channel(s) are enabled for MIDI
305               * device.               * instrument mapping, the respective sampler engine and
306               *               * instrument will be loaded on the connected sampler
307               * For example consider a program change event on MIDI channel               * channel(s) as defined by the respective entry in the
308               * 3 for program number 18. This would cause this MIDI input               * MIDI instrument map.
309               * device to be connected to sampler channel 18 and would cause               *
310               * sampler channel 18 to listen to MIDI channel 3.               * @e Note: the MIDI instrument map is empty by default on
311               *               * sampler startup. It has to be explicitly filled with
312               * This is the current, general implementation of program               * entries and the sampler channel(s) have to be enabled for
313               * change events. It might change in future, e.g to allow               * a certain MIDI instrument table, otherwise program change
314               * sampler engines to allow by themselfes how to act on a               * messages are ignored!
315               * program change event.               *
316               *               * @param Program     - MIDI program change number
317               * @param Program     - sampler channel to connect to this MIDI               * @param MidiChannel - MIDI channel on which this program
318               *                      input device               *                      change occured
319               * @param MidiChannel - MIDI channel on which sampler channel               * @see MidiInstrumentMapper
              *                      \a Program should listen to  
320               */               */
321              void DispatchProgramChange(uint8_t Program, uint MidiChannel);              void DispatchProgramChange(uint8_t Program, uint MidiChannel);
322    
# Line 312  namespace LinuxSampler { Line 334  namespace LinuxSampler {
334               */               */
335              void DispatchSysex(void* pData, uint Size);              void DispatchSysex(void* pData, uint Size);
336    
337                /**
338                 * Helper function for MIDI input devices that have the
339                 * MIDI data as raw bytes.
340                 *
341                 * @param pData       - pointer to the raw MIDI data
342                 */
343                void DispatchRaw(uint8_t* pData);
344    
345                /**
346                 * Helper function for MIDI input devices that have the
347                 * MIDI data as raw bytes.
348                 *
349                 * @param pData       - pointer to the raw MIDI data
350                 * @param FragmentPos - event's sample point position in the
351                 *                      current audio fragment
352                 */
353                void DispatchRaw(uint8_t* pData, int32_t FragmentPos);
354    
355          protected:          protected:
356              MidiInputDevice* pDevice;              MidiInputDevice* pDevice;
357              int portNumber;              int portNumber;
# Line 324  namespace LinuxSampler { Line 364  namespace LinuxSampler {
364              SynchronizedConfig<std::vector<VirtualMidiDevice*> > virtualMidiDevices;              SynchronizedConfig<std::vector<VirtualMidiDevice*> > virtualMidiDevices;
365              SynchronizedConfig<std::vector<VirtualMidiDevice*> >::Reader virtualMidiDevicesReader;              SynchronizedConfig<std::vector<VirtualMidiDevice*> >::Reader virtualMidiDevicesReader;
366              Mutex virtualMidiDevicesMutex;              Mutex virtualMidiDevicesMutex;
367                SynchronizedConfig<std::vector<uint8_t> > noteOnVelocityFilter;
368                SynchronizedConfig<std::vector<uint8_t> >::Reader noteOnVelocityFilterReader;
369                Mutex noteOnVelocityFilterMutex;
370    
371              /**              /**
372               * Constructor               * Constructor

Legend:
Removed from v.1695  
changed lines
  Added in v.2380

  ViewVC Help
Powered by ViewVC