/[svn]/linuxsampler/trunk/src/engines/AbstractEngineChannel.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/AbstractEngineChannel.h

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

revision 2434 by schoenebeck, Thu Mar 7 19:23:24 2013 UTC revision 2500 by schoenebeck, Fri Jan 10 12:20:05 2014 UTC
# Line 5  Line 5 
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-2008 Christian Schoenebeck                         *
7   *   Copyright (C) 2009-2012 Christian Schoenebeck and Grigor Iliev        *   *   Copyright (C) 2009-2012 Christian Schoenebeck and Grigor Iliev        *
8     *   Copyright (C) 2013-2014 Christian Schoenebeck and Andreas Persson     *
9   *                                                                         *   *                                                                         *
10   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
11   *   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 55  namespace LinuxSampler { Line 56  namespace LinuxSampler {
56              virtual AudioOutputDevice* GetAudioOutputDevice() OVERRIDE;              virtual AudioOutputDevice* GetAudioOutputDevice() OVERRIDE;
57              virtual void    SetOutputChannel(uint EngineAudioChannel, uint AudioDeviceChannel) OVERRIDE;              virtual void    SetOutputChannel(uint EngineAudioChannel, uint AudioDeviceChannel) OVERRIDE;
58              virtual int     OutputChannel(uint EngineAudioChannel) OVERRIDE;              virtual int     OutputChannel(uint EngineAudioChannel) OVERRIDE;
59              virtual void    Connect(MidiInputPort* pMidiPort, midi_chan_t MidiChannel) OVERRIDE;              virtual void    Connect(MidiInputPort* pMidiPort) OVERRIDE;
60              virtual void    DisconnectMidiInputPort() OVERRIDE;              virtual void    Disconnect(MidiInputPort* pMidiPort) OVERRIDE;
61              virtual MidiInputPort* GetMidiInputPort() OVERRIDE;              virtual void    DisconnectAllMidiInputPorts() OVERRIDE;
62                virtual uint    GetMidiInputPortCount() OVERRIDE;
63                virtual MidiInputPort* GetMidiInputPort(uint index) OVERRIDE;
64              virtual midi_chan_t MidiChannel() OVERRIDE;              virtual midi_chan_t MidiChannel() OVERRIDE;
65                virtual void    SetMidiChannel(midi_chan_t MidiChannel) OVERRIDE;
66                virtual void    Connect(MidiInputPort* pMidiPort, midi_chan_t MidiChannel) OVERRIDE; // deprecated, may be removed
67                virtual void    DisconnectMidiInputPort() OVERRIDE; // deprecated, may be removed
68                virtual MidiInputPort* GetMidiInputPort() OVERRIDE; // deprecated, may be removed
69              virtual String  InstrumentFileName() OVERRIDE;              virtual String  InstrumentFileName() OVERRIDE;
70              virtual String  InstrumentName() OVERRIDE;              virtual String  InstrumentName() OVERRIDE;
71              virtual int     InstrumentIndex() OVERRIDE;              virtual int     InstrumentIndex() OVERRIDE;
# Line 88  namespace LinuxSampler { Line 95  namespace LinuxSampler {
95    
96              AbstractEngine*           pEngine;              AbstractEngine*           pEngine;
97              Mutex                     EngineMutex; ///< protects the Engine from access by the instrument loader thread when lscp is disconnecting              Mutex                     EngineMutex; ///< protects the Engine from access by the instrument loader thread when lscp is disconnecting
98                Mutex                     MidiInputMutex; ///< Introduced when support for multiple MIDI inputs per engine channel was added: protects the MIDI event input ringbuffer on this engine channel to be accessed concurrently by multiple midi input threads. As alternative one might also move the ringbuffer from this engine channel to the individual MIDI ports/devices and let the sampler engine read the events from there instead of receiving them here.
99    
100          protected:          protected:
101              AudioChannel*             pChannelLeft;             ///< encapsulates the audio rendering buffer (left)              AudioChannel*             pChannelLeft;             ///< encapsulates the audio rendering buffer (left)
102              AudioChannel*             pChannelRight;            ///< encapsulates the audio rendering buffer (right)              AudioChannel*             pChannelRight;            ///< encapsulates the audio rendering buffer (right)
103              int                       AudioDeviceChannelLeft;   ///< audio device channel number to which the left channel is connected to              int                       AudioDeviceChannelLeft;   ///< audio device channel number to which the left channel is connected to
104              int                       AudioDeviceChannelRight;  ///< audio device channel number to which the right channel is connected to              int                       AudioDeviceChannelRight;  ///< audio device channel number to which the right channel is connected to
105              MidiInputPort*            pMidiInputPort;           ///< Points to the connected MIDI input port or NULL if none assigned.              DoubleBuffer< ArrayList<MidiInputPort*> > midiInputs; ///< MIDI input ports on which this sampler engine channel shall listen to.
106              midi_chan_t               midiChannel;              ///< MIDI channel(s) on which this engine channel listens to.              midi_chan_t               midiChannel;              ///< MIDI channel(s) on which this engine channel listens to (on all MIDI input ports).
107              RingBuffer<Event,false>*  pEventQueue;              ///< Input event queue.              RingBuffer<Event,false>*  pEventQueue;              ///< Input event queue.
108              RTList<Event>*            pEvents;                  ///< All engine channel specific events for the current audio fragment.              RTList<Event>*            pEvents;                  ///< All engine channel specific events for the current audio fragment.
109              uint8_t                   ControllerTable[129];     ///< Reflects the current values (0-127) of all MIDI controllers for this engine / sampler channel. Number 128 is for channel pressure (mono aftertouch).              uint8_t                   ControllerTable[129];     ///< Reflects the current values (0-127) of all MIDI controllers for this engine / sampler channel. Number 128 is for channel pressure (mono aftertouch).
# Line 149  namespace LinuxSampler { Line 157  namespace LinuxSampler {
157              void HandleKeyGroupConflicts(uint KeyGroup, Pool<Event>::Iterator& itNoteOnEvent);              void HandleKeyGroupConflicts(uint KeyGroup, Pool<Event>::Iterator& itNoteOnEvent);
158              void ClearGroupEventLists();              void ClearGroupEventLists();
159              void DeleteGroupEventLists();              void DeleteGroupEventLists();
160    
161            private:
162                /**
163                 * Returns @c true if there are 2 ore more MidiInputPorts connected
164                 * to this engine channel.
165                 *
166                 * This method is currently only used to prevent unnecessary
167                 * MidiInputMutex.Lock() if there is not more than 1 MIDI input on
168                 * this engine channel.
169                 */
170                inline bool hasMultipleMIDIInputs() const {
171                    //FIXME: leaves tiny time frames open (shortly after 1->2 devices connected or 2->1 disconnected) which could lead to concurrency issue for the purpose described above, however in practice it "should" be acceptable
172                    return midiInputs.unsafeBack().size() > 1;
173                }
174      };      };
175    
176  } // namespace LinuxSampler  } // namespace LinuxSampler

Legend:
Removed from v.2434  
changed lines
  Added in v.2500

  ViewVC Help
Powered by ViewVC