1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
// -*- c-basic-offset: 4 -*-
/*
Rosegarden
A sequencer and musical notation editor.
This program is Copyright 2000-2008
Guillaume Laurent <[email protected]>,
Chris Cannam <[email protected]>,
Richard Bown <[email protected]>
The moral right of the authors to claim authorship of this work
has been asserted.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. See the file
COPYING included with this distribution for more information.
*/
#ifndef _RUNNABLE_PLUGIN_INSTANCE_H_
#define _RUNNABLE_PLUGIN_INSTANCE_H_
#include <tqstring.h>
#include <tqstringlist.h>
#include <vector>
#include "RealTime.h"
namespace Rosegarden
{
class PluginFactory;
/**
* RunnablePluginInstance is a very trivial interface that an audio
* process can use to refer to an instance of a plugin without needing
* to know what type of plugin it is.
*
* The audio code calls run() on an instance that has been passed to
* it, and assumes that the passing code has already initialised the
* plugin, connected its inputs and outputs and so on, and that there
* is an understanding in place about the sizes of the buffers in use
* by the plugin. All of this depends on the subclass implementation.
*/
class RunnablePluginInstance
{
public:
typedef float sample_t;
virtual ~RunnablePluginInstance();
virtual bool isOK() const = 0;
virtual TQString getIdentifier() const = 0;
/**
* Run for one block, starting at the given time. The start time
* may be of interest to synths etc that may have queued events
* waiting. Other plugins can ignore it.
*/
virtual void run(const RealTime &blockStartTime) = 0;
virtual size_t getBufferSize() = 0;
virtual size_t getAudioInputCount() = 0;
virtual size_t getAudioOutputCount() = 0;
virtual sample_t **getAudioInputBuffers() = 0;
virtual sample_t **getAudioOutputBuffers() = 0;
virtual TQStringList getPrograms() { return TQStringList(); }
virtual TQString getCurrentProgram() { return TQString(); }
virtual TQString getProgram(int /* bank */, int /* program */) { return TQString(); }
virtual unsigned long getProgram(TQString /* name */) { return 0; } // bank << 16 + program
virtual void selectProgram(TQString) { }
virtual void setPortValue(unsigned int port, float value) = 0;
virtual float getPortValue(unsigned int port) = 0;
virtual TQString configure(TQString /* key */, TQString /* value */) { return TQString(); }
virtual void sendEvent(const RealTime & /* eventTime */,
const void * /* event */) { }
virtual bool isBypassed() const = 0;
virtual void setBypassed(bool value) = 0;
// This should be called after setup, but while not actually playing.
virtual size_t getLatency() = 0;
virtual void silence() = 0;
virtual void discardEvents() { }
virtual void setIdealChannelCount(size_t channels) = 0; // must also silence(); may also re-instantiate
void setFactory(PluginFactory *f) { m_factory = f; } // ew
protected:
RunnablePluginInstance(PluginFactory *factory, TQString identifier) :
m_factory(factory), m_identifier(identifier) { }
PluginFactory *m_factory;
TQString m_identifier;
friend class PluginFactory;
};
typedef std::vector<RunnablePluginInstance *> RunnablePluginInstances;
}
#endif
|