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

Annotation of /linuxsampler/trunk/src/engines/common/EngineChannel.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 705 - (hide annotations) (download) (as text)
Wed Jul 20 21:43:23 2005 UTC (18 years, 9 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 5771 byte(s)
* support for muting sampler channels and solo mode of the same, two new
  LSCP commands ("SET CHANNEL MUTE" and "SET CHANNEL SOLO") and two new
  fields ("MUTE" and "SOLO") for command "GET CHANNEL INFO" were
  introduced for this (patch by Grigor Iliev, a bit adjusted)

1 schoenebeck 411 /***************************************************************************
2     * *
3     * Copyright (C) 2005 Christian Schoenebeck *
4     * *
5     * This program is free software; you can redistribute it and/or modify *
6     * it under the terms of the GNU General Public License as published by *
7     * the Free Software Foundation; either version 2 of the License, or *
8     * (at your option) any later version. *
9     * *
10     * This program is distributed in the hope that it will be useful, *
11     * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13     * GNU General Public License for more details. *
14     * *
15     * You should have received a copy of the GNU General Public License *
16     * along with this program; if not, write to the Free Software *
17     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
18     * MA 02111-1307 USA *
19     ***************************************************************************/
20    
21     #ifndef __LS_ENGINECHANNEL_H__
22     #define __LS_ENGINECHANNEL_H__
23    
24     #include "../../drivers/audio/AudioOutputDevice.h"
25 schoenebeck 675 #include "../../drivers/midi/midi.h"
26     #include "../../drivers/midi/MidiInputDevice.h"
27     #include "../../drivers/midi/MidiInputPort.h"
28 schoenebeck 411 #include "Engine.h"
29    
30     namespace LinuxSampler {
31    
32     // just symbol prototyping
33     class AudioOutputDevice;
34 schoenebeck 675 class MidiInputPort;
35 schoenebeck 411
36     /** @brief Channel Interface for LinuxSampler Sampler Engines
37     *
38     * Every sampler engine can be used on several sampler channels and
39     * usually the same Engine instance is used on multiple sampler
40     * channels. For this every sampler engine must also implement a class
41     * which handles all channel dependant parameters and channel
42     * dependant execution code.
43     *
44     * This abstract base interface class defines all mandatory methods
45     * which have to be implemented by all engine channel implementations.
46     */
47     class EngineChannel {
48     public:
49 schoenebeck 660
50 schoenebeck 705 EngineChannel();
51    
52 schoenebeck 411 /////////////////////////////////////////////////////////////////
53     // abstract methods
54     // (these have to be implemented by the descendant)
55 schoenebeck 660
56 schoenebeck 411 virtual void PrepareLoadInstrument(const char* FileName, uint Instrument) = 0;
57     virtual void LoadInstrument() = 0;
58 schoenebeck 670 virtual void Reset() = 0;
59 schoenebeck 411 virtual void SendNoteOn(uint8_t Key, uint8_t Velocity) = 0;
60     virtual void SendNoteOff(uint8_t Key, uint8_t Velocity) = 0;
61     virtual void SendPitchbend(int Pitch) = 0;
62 schoenebeck 660 virtual void SendControlChange(uint8_t Controller, uint8_t Value) = 0;
63 schoenebeck 670 virtual bool StatusChanged(bool bNewStatus = false) = 0;
64 schoenebeck 411 virtual float Volume() = 0;
65     virtual void Volume(float f) = 0;
66 schoenebeck 660 virtual uint Channels() = 0;
67 schoenebeck 411 virtual void Connect(AudioOutputDevice* pAudioOut) = 0;
68     virtual void DisconnectAudioOutputDevice() = 0;
69     virtual void SetOutputChannel(uint EngineAudioChannel, uint AudioDeviceChannel) = 0;
70 schoenebeck 660 virtual int OutputChannel(uint EngineAudioChannel) = 0;
71 schoenebeck 675 virtual void Connect(MidiInputPort* pMidiPort, midi_chan_t MidiChannel) = 0;
72     virtual void DisconnectMidiInputPort() = 0;
73     virtual MidiInputPort* GetMidiInputPort() = 0;
74     virtual midi_chan_t MidiChannel() = 0;
75 schoenebeck 411 virtual String InstrumentFileName() = 0;
76     virtual String InstrumentName() = 0;
77     virtual int InstrumentIndex() = 0;
78     virtual int InstrumentStatus() = 0;
79     virtual Engine* GetEngine() = 0;
80 schoenebeck 475 virtual String EngineName() = 0;
81 schoenebeck 411
82 schoenebeck 705 /**
83     * Sets the mute state of this channel.
84     *
85     * @param state - specifies the mute state of this sampler channel.
86     * @throws LinuxSamplerException - if state does not contain valid
87     * value.
88     */
89     void SetMute(int state) throw (LinuxSamplerException);
90    
91     /**
92     * Determines whether this channel is muted.
93     *
94     * @returns 1 if the channel is muted, 0 if the channel is not muted
95     * and -1 if the channel is muted because of presence of at least
96     * one solo channel.
97     */
98     int GetMute();
99    
100     /**
101     * Sets the solo state of this channel.
102     *
103     * @param solo - specifies whether this is a solo channel.
104     */
105     void SetSolo(bool solo);
106    
107     /**
108     * Determines whether this is a solo channel.
109     *
110     * @returns true if this is a solo channel, false otherwise.
111     */
112     bool GetSolo();
113    
114 schoenebeck 660 int iSamplerChannelIndex; ///< FIXME: nasty hack, might be removed (should be 'virtual EngineChannel* EngineChannel() = 0;', but due to cyclic dependencies only a void* solution would be possible ATM)
115    
116     protected:
117     virtual ~EngineChannel() {}; // MUST only be destroyed by EngineChannelFactory
118     friend class EngineChannelFactory;
119 schoenebeck 705
120     private:
121     int iMute;
122     bool bSolo;
123 schoenebeck 411 };
124 schoenebeck 660
125 schoenebeck 411 } // namespace LinuxSampler
126 schoenebeck 660
127 schoenebeck 411 #endif // __LS_ENGINECHANNEL_H__

  ViewVC Help
Powered by ViewVC