vsthostutils.h

Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 // Project     : VST SDK
00003 // Version     : 3.0
00004 //
00005 // Category    : Helpers
00006 // Filename    : vsthostutils.h
00007 // Created by  : Steinberg, 10/2005
00008 // Modified    : $Date: 2008/01/10 10:36:23 $
00009 // Description : VST Hosting Utilities
00010 //
00011 //-----------------------------------------------------------------------------
00012 // LICENSE
00013 // © 2008, Steinberg Media Technologies GmbH, All Rights Reserved
00014 //-----------------------------------------------------------------------------
00015 // This Software Development Kit may not be distributed in parts or its entirety  
00016 // without prior written agreement by Steinberg Media Technologies GmbH. 
00017 // This SDK must not be used to re-engineer or manipulate any technology used  
00018 // in any Steinberg or Third-party application or software module, 
00019 // unless permitted by law.
00020 // Neither the name of the Steinberg Media Technologies nor the names of its
00021 // contributors may be used to endorse or promote products derived from this
00022 // software without specific prior written permission.
00023 // 
00024 // THIS SDK IS PROVIDED BY STEINBERG MEDIA TECHNOLOGIES GMBH "AS IS" AND
00025 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
00026 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00027 // IN NO EVENT SHALL STEINBERG MEDIA TECHNOLOGIES GMBH BE LIABLE FOR ANY DIRECT, 
00028 // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
00029 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
00030 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
00031 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
00032 // OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
00033 // OF THE POSSIBILITY OF SUCH DAMAGE.
00034 //----------------------------------------------------------------------------------
00035 
00036 #ifndef __vsthostutils__
00037 #define __vsthostutils__
00038 
00039 #include "pluginterfaces/vst/ivstcomponent.h"
00040 #include "pluginterfaces/vst/ivstaudioprocessor.h"
00041 
00042 //------------------------------------------------------------------------
00043 namespace Steinberg {
00044 namespace Vst {
00045 
00046 //------------------------------------------------------------------------
00047 // HostProcessData
00048 //------------------------------------------------------------------------
00049 class HostProcessData: public ProcessData
00050 {
00051 public:
00052 //------------------------------------------------------------------------
00053         HostProcessData ();
00054         ~HostProcessData ();
00055 
00057         bool prepare (IComponent& component);
00058 
00060         void unprepare ();
00061 
00063         void setChannelBuffers (BusDirection dir, int32 busIndex, Sample32* sampleBuffer);
00064 
00066         void setChannelBuffers (BusDirection dir, int32 busIndex, Sample32* sampleBuffers[], int32 bufferCount);
00067 //------------------------------------------------------------------------
00068 protected:
00069         AudioBusBuffers* createBusBuffers (IComponent& component, BusDirection dir, int32 busCount);
00070         void destroyBusBuffers (AudioBusBuffers* buffers, int32 busCount);
00071 };
00072 
00073 //------------------------------------------------------------------------
00074 // inline
00075 //------------------------------------------------------------------------
00076 inline void HostProcessData::setChannelBuffers (BusDirection dir, int32 busIndex, Sample32* sampleBuffer)
00077 {
00078         // Hotfix for DevTrack 3139, Yvan need to have a look. Seems that Sidechain is not correctly removed
00079         if (dir == kInput && (!inputs || busIndex >= numInputs))
00080                 return;
00081         if (dir == kOutput && (!outputs || busIndex >= numOutputs))
00082                 return;
00083 //      if (dir == kInput && !inputs)
00084 //              return;
00085 //      if (dir == kOutput && !outputs)
00086 //              return;
00087         AudioBusBuffers& busBuffers = dir == kInput ? inputs[busIndex] : outputs[busIndex];
00088         for (int32 i = 0; i < busBuffers.numChannels; i++)
00089                 busBuffers.channelBuffers32[i] = sampleBuffer;
00090 }
00091 
00092 //------------------------------------------------------------------------
00093 inline void HostProcessData::setChannelBuffers (BusDirection dir, int32 busIndex, Sample32* sampleBuffers[], int32 bufferCount)
00094 {
00095         // Hotfix for DevTrack 3139, Yvan need to have a look. Seems that Sidechain is not correctly removed
00096         if (dir == kInput && (!inputs || busIndex >= numInputs))
00097                 return;
00098         if (dir == kOutput && (!outputs || busIndex >= numOutputs))
00099                 return;
00100 //      if (dir == kInput && !inputs)
00101 //              return;
00102 //      if (dir == kOutput && !outputs)
00103 //              return;
00104         AudioBusBuffers& busBuffers = dir == kInput ? inputs[busIndex] : outputs[busIndex];
00105         int32 count = bufferCount < busBuffers.numChannels ? bufferCount : busBuffers.numChannels;
00106         for (int32 i = 0; i < count; i++)
00107                 busBuffers.channelBuffers32[i] = sampleBuffers ? sampleBuffers[i] : 0;
00108 }
00109 //------------------------------------------------------------------------
00110 
00111 }} // namespace Vst
00112 
00113 #endif  // __vsthostutils__
Empty

Copyright ©2008 Steinberg Media Technologies. All Rights Reserved.