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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2354 - (hide annotations) (download) (as text)
Sun Jul 8 10:29:07 2012 UTC (11 years, 9 months 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 persson 1777 /***************************************************************************
2     * *
3 schoenebeck 1934 * Copyright (C) 2008 - 2009 Andreas Persson *
4 persson 1777 * *
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 iliev 1907 * 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 persson 2354 void ForceSetValue(int channels);
59 iliev 1907 };
60    
61     /**
62 persson 1777 * 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 schoenebeck 1934 bool isAutonomousDevice();
91 persson 1777 static String Name();
92     static String Version();
93     static String Description();
94 schoenebeck 1934 static bool isAutonomousDriver();
95 persson 1777
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 persson 2354 void AddChannels(int newChannels);
108     void RemoveChannel(AudioChannel* pChannel);
109    
110 persson 1777 private:
111     uint uiSampleRate;
112     uint uiMaxSamplesPerCycle;
113     };
114     }
115    
116     #endif

  ViewVC Help
Powered by ViewVC