/[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 1777 - (show annotations) (download) (as text)
Mon Sep 15 16:58:10 2008 UTC (15 years, 7 months ago) by persson
File MIME type: text/x-c++hdr
File size: 4143 byte(s)
* added experimental support for running LinuxSampler as a DSSI, LV2
  and VST plugin

1 /***************************************************************************
2 * *
3 * Copyright (C) 2008 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 'FRAGMENTSIZE'
52 *
53 * Used to set the audio fragment size / period size.
54 */
55 class ParameterFragmentSize : public DeviceCreationParameterInt {
56 public:
57 ParameterFragmentSize();
58 ParameterFragmentSize(String s) throw (Exception);
59 String Description();
60 bool Fix();
61 bool Mandatory();
62 std::map<String,DeviceCreationParameter*> DependsAsParameters();
63 optional<int> DefaultAsInt(std::map<String,String> Parameters);
64 optional<int> RangeMinAsInt(std::map<String,String> Parameters);
65 optional<int> RangeMaxAsInt(std::map<String,String> Parameters);
66 std::vector<int> PossibilitiesAsInt(std::map<String,String> Parameters);
67 void OnSetValue(int i) throw (Exception);
68 static String Name();
69 };
70
71 // derived abstract methods from class 'AudioOutputDevice'
72 void Play();
73 bool IsPlaying();
74 void Stop();
75 uint MaxSamplesPerCycle();
76 uint SampleRate();
77 String Driver();
78 AudioChannel* CreateChannel(uint ChannelNr);
79 static String Name();
80 static String Version();
81 static String Description();
82
83 /**
84 * This should be called by the plugin implementation to let
85 * the engines render audio. The buffers where the data is
86 * rendered can be set with Channel(index)->getBuffer().
87 *
88 * @param Samples - number of sample points to be rendered
89 * @returns 0 on success or the last error return code of one
90 * engine
91 */
92 int Render(uint Samples) { return RenderAudio(Samples); }
93
94 private:
95 uint uiSampleRate;
96 uint uiMaxSamplesPerCycle;
97 };
98 }
99
100 #endif

  ViewVC Help
Powered by ViewVC