/[svn]/linuxsampler/trunk/src/Sampler.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/Sampler.h

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

revision 57 by schoenebeck, Sun May 2 17:45:43 2004 UTC revision 155 by senkov, Mon Jun 28 04:30:11 2004 UTC
# Line 2  Line 2 
2   *                                                                         *   *                                                                         *
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003 by Benno Senoner and Christian Schoenebeck         *   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *
6   *                                                                         *   *                                                                         *
7   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
8   *   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 33  Line 33 
33    
34  namespace LinuxSampler {  namespace LinuxSampler {
35    
     /**  
      * Which sampler engine to be used.  
      */  
     enum engine_type_t {  
         engine_type_gig  
     };  
   
     /**  
      * Which audio output system to be used.  
      */  
     enum audio_output_type_t {  
         audio_output_type_alsa,  
         audio_output_type_jack  
     };  
   
     /**  
      * Which MIDI input system to be used.  
      */  
     enum midi_input_type_t {  
         midi_input_type_alsa  
     };  
   
36      // just symbol prototyping      // just symbol prototyping
37      class Sampler;      class Sampler;
38    
# Line 62  namespace LinuxSampler { Line 40  namespace LinuxSampler {
40       *       *
41       * Encapsulates one sampler engine, one connection to a MIDI input       * Encapsulates one sampler engine, one connection to a MIDI input
42       * device and one connection to an audio output device. You cannot       * device and one connection to an audio output device. You cannot
43       * create an instance of this class on you own, you have to use the       * create an instance of this class on your own, you have to use the
44       * AddSamplerChannel() method of the Sampler object to create a new       * AddSamplerChannel() method of the Sampler object to create a new
45       * sampler channel.       * sampler channel.
46       */       */
# Line 76  namespace LinuxSampler { Line 54  namespace LinuxSampler {
54               *               *
55               * @param EngineType - type of the engine to deploy               * @param EngineType - type of the engine to deploy
56               */               */
57              void LoadEngine(engine_type_t EngineType);              void LoadEngine(Engine::type_t EngineType); // TODO: to be changed to 'void LoadEngine(String EngineType) throws (LinuxSamplerException);'
58    
59              /**              /**
60               * Connect this sampler channel to an audio output device (that               * Connect this sampler channel to an audio output device, that
61               * is audio output driver) of the given type. If the audio               * is an instance of an audio output driver. If this sampler
62               * output for the desired audio output system is not yet               * channel was already connected to an audio output device, then
63               * created, then it will be created automatically, but with               * the old connection will automatically be removed before.
              * default settings though. If this sampler channel was already  
              * connected to an audio output device, then the old connection  
              * will automatically be removed before.  
64               *               *
65               * @param AudioType - audio output system to connect to               * @param pDevice - audio output device to connect to
66               */               */
67              void SetAudioOutputDevice(audio_output_type_t AudioType);              void SetAudioOutputDevice(AudioOutputDevice* pDevice);
68    
69              /**              /**
70               * Connect this sampler channel to and MIDI input device (that               * Connect this sampler channel to and MIDI input port
              * is MIDI input driver) of the given type. If the MIDI input  
              * driver for the desired MIDI input system is not yet created,  
              * then it will be created automatically, but with default  
              * settings though. If this sampler channel was already  
              * connected to a MIDI input device, then the old connection  
              * will automatically be removed before.  
71               *               *
72               * @param MidiType    - MIDI input system to connect to               * @param MidiInputDevice - MIDI input device to connect to
73                 * @param MidiInputPort - MIDI port to connect to
74               * @param MidiChannel - optional: MIDI channel on which the               * @param MidiChannel - optional: MIDI channel on which the
75               *                      sampler channel should listen to               *                      sampler channel should listen to
76               *                      (default: listen on all MIDI channels)               *                      (default: listen on all MIDI channels)
77               */               */
78              void SetMidiInputDevice(midi_input_type_t MidiType, MidiInputDevice::midi_chan_t MidiChannel = MidiInputDevice::midi_chan_all);              void SetMidiInputPort(MidiInputDevice* pDevice, int midiPort, MidiInputDevice::MidiInputPort::midi_chan_t MidiChannel = MidiInputDevice::MidiInputPort::midi_chan_all);
79    
80              /**              /**
81               * Returns the engine that was deployed on this sampler channel.               * Returns the engine that was deployed on this sampler channel.
# Line 121  namespace LinuxSampler { Line 91  namespace LinuxSampler {
91               * @returns  pointer to MIDI input device or NULL if not               * @returns  pointer to MIDI input device or NULL if not
92               *           connected               *           connected
93               */               */
94              MidiInputDevice* GetMidiInputDevice();              MidiInputDevice::MidiInputPort* GetMidiInputPort();
95    
96              /**              /**
97               * Returns the audio output device to which this sampler channel               * Returns the audio output device to which this sampler channel
# Line 133  namespace LinuxSampler { Line 103  namespace LinuxSampler {
103              AudioOutputDevice* GetAudioOutputDevice();              AudioOutputDevice* GetAudioOutputDevice();
104    
105              /**              /**
106                 * Returns the audio output device to which this sampler channel
107                 * is currently connected to.
108                 *
109                 * @returns  pointer to audio output device or NULL if not
110                 *           connected
111                 */
112                MidiInputDevice* GetMidiInputDevice();
113    
114                /**
115               * Returns the index number of this sampler channel within the               * Returns the index number of this sampler channel within the
116               * Sampler instance.               * Sampler instance.
117               */               */
118              uint Index();              uint Index();
119    
120                /**
121                 * Returns midi channel
122                 */
123                MidiInputDevice::MidiInputPort::midi_chan_t GetMidiInputChannel() { return midiChannel; }
124    
125          protected:          protected:
126              SamplerChannel(Sampler* pS);              SamplerChannel(Sampler* pS);
127             ~SamplerChannel();             ~SamplerChannel();
128    
129              Sampler*           pSampler;              Sampler*           pSampler;
130              Engine*            pEngine;              Engine*            pEngine;
131              MidiInputDevice*   pMidiInputDevice;              MidiInputDevice::MidiInputPort*     pMidiInputPort;
132              AudioOutputDevice* pAudioOutputDevice;              AudioOutputDevice* pAudioOutputDevice;
133              int                iIndex;              int                iIndex;
134                MidiInputDevice::MidiInputPort::midi_chan_t midiChannel;
135    
136              friend class Sampler;              friend class Sampler;
137      };      };
# Line 248  namespace LinuxSampler { Line 233  namespace LinuxSampler {
233               */               */
234              void RemoveSamplerChannel(uint uiSamplerChannel);              void RemoveSamplerChannel(uint uiSamplerChannel);
235    
236                std::vector<String> AvailableAudioOutputDrivers();
237    
238              /**              /**
239               * Create an audio output device of the given type.               * Create an audio output device.
240               *               *
241               * @param AudioType - desired audio output system to use               * @param AudioDriver - name of the audio driver
242                 * @param Parameters - eventually needed driver parameters to
243                 *                     create the device
244               * @returns  pointer to created audio output device               * @returns  pointer to created audio output device
245                 * @throws LinuxSamplerException  if device could not be created
246               */               */
247              AudioOutputDevice* CreateAudioOutputDevice(audio_output_type_t AudioType);              AudioOutputDevice* CreateAudioOutputDevice(String AudioDriver, std::map<String,String> Parameters) throw (LinuxSamplerException);
248    
249              /**              /**
250               * Returns the audio output device of the given type.               * Create a midi input device.
251               *               *
252               * @param AudioType - desired audio output system to use               * @param MidiDriver - name of the midi driver
253               * @returns  pointer to audio output device or NULL if device of               * @param Parameters - eventually needed driver parameters to
254               *           desired type is not yet created               *                     create the device
255                 * @returns  pointer to created midi input device
256                 * @throws LinuxSamplerException  if device could not be created
257               */               */
258              AudioOutputDevice* GetAudioOutputDevice(audio_output_type_t AudioType);              MidiInputDevice* CreateMidiInputDevice(String MidiDriver, std::map<String,String> Parameters) throw (LinuxSamplerException);
259    
260              /**              uint AudioOutputDevices();
261               * Create a MIDI input device of the given type.              uint MidiInputDevices();
              *  
              * @param MidiType - desired MIDI input system to use  
              * @returns  pointer to created MIDI input device  
              */  
             MidiInputDevice* CreateMidiInputDevice(midi_input_type_t MidiType);  
262    
263              /**              std::map<uint, AudioOutputDevice*> GetAudioOutputDevices();
264               * Returns the MIDI input device of the given type.  
265               *              std::map<uint, MidiInputDevice*> GetMidiInputDevices();
266               * @param MidiType - desired MIDI input system to use  
267               * @returns  pointer to MIDI input device or NULL if device of              void DestroyAudioOutputDevice(AudioOutputDevice* pDevice) throw (LinuxSamplerException);
268               *           desired type is not yet created              void DestroyMidiInputDevice(MidiInputDevice* pDevice) throw (LinuxSamplerException);
              */  
             MidiInputDevice* GetMidiInputDevice(midi_input_type_t MidiType);  
269    
270          protected:          protected:
271              typedef std::map<audio_output_type_t, AudioOutputDevice*> AudioOutputDeviceMap;              typedef std::map<uint, AudioOutputDevice*> AudioOutputDeviceMap;
272              typedef std::map<midi_input_type_t, MidiInputDevice*> MidiInputDeviceMap;              typedef std::map<uint, MidiInputDevice*> MidiInputDeviceMap;
273    
274              std::vector<SamplerChannel*> vSamplerChannels;   ///< contains all created sampler channels              std::vector<SamplerChannel*> vSamplerChannels;   ///< contains all created sampler channels
275              AudioOutputDeviceMap         AudioOutputDevices; ///< contains all created audio output devices              AudioOutputDeviceMap         mAudioOutputDevices; ///< contains all created audio output devices
276              MidiInputDeviceMap           MidiInputDevices;              MidiInputDeviceMap           mMidiInputDevices;
277    
278                template<class T> inline String ToString(T o) {
279                    std::stringstream ss;
280                    ss << o;
281                    return ss.str();
282                }
283    
284              friend class SamplerChannel;              friend class SamplerChannel;
285      };      };

Legend:
Removed from v.57  
changed lines
  Added in v.155

  ViewVC Help
Powered by ViewVC