1 /**
2  * Generic host commands.
3  *
4  * Copyright: Copyright Auburn Sounds 2015-2016
5  * License:   $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
6  * Authors:   Guillaume Piolat
7  */
8 module dplug.host.host;
9 
10 interface IPluginHost
11 {
12     /// Process some audio.
13     /// `setSampleRate` and `setMaxBufferSize` must be called before use.
14     /// samples must <= the maximum buffer size asked in 
15     void processAudioFloat(float** inputs, float** ouputs, int samples);
16 
17     /// Sets the desired sampleRate
18     void setSampleRate(float sampleRate);
19 
20     /// Sets the maximum buffer size
21     void setMaxBufferSize(int samples);
22 
23     /// Sets a parameter's value.
24     void setParameter(int paramIndex, float normalizedValue);
25 
26     /// Returns: Normalized value for parameter.
27     float getParameter(int paramIndex);
28 
29     /// Loads a preset.
30     void loadPreset(int presetIndex);
31 
32     /// Serialize state of the plugin.
33     ubyte[] saveState();
34 
35     /// Restore state of the plugin.
36     void restoreState(ubyte[] chunk);
37 
38     /// Gets current "program" index.
39     int getCurrentProgram();
40 
41     /// Free all resources associated with the plugin host.
42     void close();
43 
44     /// Get plugin information
45     string getProductString();
46     
47     ///ditto
48     string getEffectName();
49     
50     ///ditto
51     string getVendorString();
52 
53     /// Opens the editor window.
54     /// On Windows, pass a HWND
55     /// On Mac, a NSView    
56     void openUI(void* windowHandle);
57 
58     /// Closes the editor.
59     void closeUI();
60 
61     /// Gets the UI size.
62     int[2] getUISize();
63 
64     /// Switch on the plugin. Call it before processing.
65     void beginAudioProcessing();
66 
67     /// Switch off the plugin. Call it after processing.
68     void endAudioProcessing();
69 }
70 
71