/[svn]/linuxsampler/trunk/src/drivers/audio/AudioOutputDevicePlugin.h
ViewVC logotype

Contents of /linuxsampler/trunk/src/drivers/audio/AudioOutputDevicePlugin.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2354 - (show annotations) (download) (as text)
Sun Jul 8 10:29:07 2012 UTC (9 years ago) by persson
File MIME type: text/x-c++hdr
File size: 4705 byte(s)
* DSSI bugfix: it wasn't possible to change engine type. The MIDI port
  and audio channel routing for DSSI plugins are now visible.

1 /***************************************************************************
2 * *
3 * Copyright (C) 2008 - 2009 Andreas Persson *
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., 51 Franklin St, Fifth Floor, Boston, *
18 * MA 02110-1301 USA *
19 ***************************************************************************/
20
21 #ifndef LS_AUDIOOUTPUTDEVICEPLUGIN_H
22 #define LS_AUDIOOUTPUTDEVICEPLUGIN_H
23
24 #include "AudioOutputDevice.h"
25
26 namespace LinuxSampler {
27
28 /** Plugin audio output driver
29 *
30 * Implements audio output when LinuxSampler is running as a
31 * plugin.
32 *
33 * The plugin implementation is given access to the Render
34 * function, which should be called to render audio.
35 */
36 class AudioOutputDevicePlugin : public AudioOutputDevice {
37 public:
38 AudioOutputDevicePlugin(std::map<String,DeviceCreationParameter*> Parameters);
39
40 /**
41 * Audio channel implementation for the plugin audio driver.
42 */
43 class AudioChannelPlugin : public AudioChannel {
44 protected:
45 AudioChannelPlugin(uint ChannelNr);
46
47 friend class AudioOutputDevicePlugin;
48 };
49
50 /**
51 * Device Parameter 'CHANNELS'
52 */
53 class ParameterChannelsPlugin : public ParameterChannels {
54 public:
55 ParameterChannelsPlugin() : ParameterChannels() { }
56 ParameterChannelsPlugin(String s) : ParameterChannels(s) { }
57 virtual bool Fix() { return true; }
58 void ForceSetValue(int channels);
59 };
60
61 /**
62 * Device Parameter 'FRAGMENTSIZE'
63 *
64 * Used to set the audio fragment size / period size.
65 */
66 class ParameterFragmentSize : public DeviceCreationParameterInt {
67 public:
68 ParameterFragmentSize();
69 ParameterFragmentSize(String s) throw (Exception);
70 String Description();
71 bool Fix();
72 bool Mandatory();
73 std::map<String,DeviceCreationParameter*> DependsAsParameters();
74 optional<int> DefaultAsInt(std::map<String,String> Parameters);
75 optional<int> RangeMinAsInt(std::map<String,String> Parameters);
76 optional<int> RangeMaxAsInt(std::map<String,String> Parameters);
77 std::vector<int> PossibilitiesAsInt(std::map<String,String> Parameters);
78 void OnSetValue(int i) throw (Exception);
79 static String Name();
80 };
81
82 // derived abstract methods from class 'AudioOutputDevice'
83 void Play();
84 bool IsPlaying();
85 void Stop();
86 uint MaxSamplesPerCycle();
87 uint SampleRate();
88 String Driver();
89 AudioChannel* CreateChannel(uint ChannelNr);
90 bool isAutonomousDevice();
91 static String Name();
92 static String Version();
93 static String Description();
94 static bool isAutonomousDriver();
95
96 /**
97 * This should be called by the plugin implementation to let
98 * the engines render audio. The buffers where the data is
99 * rendered can be set with Channel(index)->getBuffer().
100 *
101 * @param Samples - number of sample points to be rendered
102 * @returns 0 on success or the last error return code of one
103 * engine
104 */
105 int Render(uint Samples) { return RenderAudio(Samples); }
106
107 void AddChannels(int newChannels);
108 void RemoveChannel(AudioChannel* pChannel);
109
110 private:
111 uint uiSampleRate;
112 uint uiMaxSamplesPerCycle;
113 };
114 }
115
116 #endif

  ViewVC Help
Powered by ViewVC