1 /**
2 Generic host commands.
3 Copyright: Auburn Sounds 2015-2016.
4 License:   $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
5 */
6 module dplug.host.host;
7 
8 interface IPluginHost
9 {
10     /// Process some audio.
11     /// `setSampleRate` and `setMaxBufferSize` must be called before use.
12     /// samples must <= the maximum buffer size asked in 
13     void processAudioFloat(float** inputs, float** ouputs, int samples);
14 
15     /// Sets the desired sampleRate
16     void setSampleRate(float sampleRate);
17 
18     /// Sets the maximum buffer size
19     void setMaxBufferSize(int samples);
20 
21     /// Sets I/O arrangement (simple right now).
22     bool setIO(int numInputs, int numOutputs);
23 
24     /// Sets a parameter's value.
25     void setParameter(int paramIndex, float normalizedValue);
26 
27     /// Returns: Normalized value for parameter.
28     float getParameter(int paramIndex);
29 
30     /// Returns: Full name for parameter.
31     const(char)[] getParameterName(int paramIndex);
32 
33     /// Returns: Number of parameters.
34     int getParameterCount();
35 
36     /// Loads a preset.
37     void loadPreset(int presetIndex);
38 
39     /// Serialize state of the plugin.
40     ubyte[] saveState();
41 
42     /// Restore state of the plugin.
43     void restoreState(ubyte[] chunk);
44 
45     /// Gets current "program" index.
46     int getCurrentProgram();
47 
48     /// Free all resources associated with the plugin host.
49     void close();
50 
51     /// Get plugin information
52     string getProductString();
53     
54     ///ditto
55     string getEffectName();
56     
57     ///ditto
58     string getVendorString();
59 
60     /// Opens the editor window.
61     /// On Windows, pass a HWND
62     /// On Mac, a NSView    
63     void openUI(void* windowHandle);
64 
65     /// Closes the editor.
66     void closeUI();
67 
68     /// Gets the UI size.
69     int[2] getUISize();
70 
71     /// Switch on the plugin. Call it before processing.
72     void beginAudioProcessing();
73 
74     /// Switch off the plugin. Call it after processing.
75     void endAudioProcessing();
76 
77     /// Get current plug-in latency in samples.
78     /// Because of VST2 limitations, this number of only valid between a 
79     /// `beginAudioProcessing` and `endAudioProcessing` call, and won't move while
80     /// processing.
81     int getLatencySamples();
82 
83     /// Get tail size in seconds. Precise semantics TBD.
84     double getTailSizeInSeconds();
85 }
86 
87