VST 3 Examples: VoiceProcessor Class Reference
Author: Steinberg

VST 3 Examples VST 3.7 SDK for developing VST plug-in

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
VoiceProcessor Class Referenceabstract

A Voice Processor class. More...

`#include <voiceprocessor.h>`

Inheritance diagram for VoiceProcessor:

## Public Member Functions
| VoiceProcessor ()
virtual | ~VoiceProcessor ()
virtual tresult | process (ProcessData &data)=0
virtual void | processEvent (Event evt)=0
int32 | getActiveVoices () const
| Returns the number of active voices.
void | clearOutputNeeded (bool val)

## Protected Attributes
int32 | activeVoices
bool | mClearOutputNeeded

## Detailed Description

A Voice Processor class.

A virtual base class for a voice manager implementation.

The idea behind this class is to make it easier to support either single precision or double precision samples (float or double) or different channel layouts.

Example:

//------------------------------------------------------------------------
class MySynthProcessor : public AudioEffect
{
public:
tresult PLUGIN_API setActive (TBool state);
tresult PLUGIN_API process (ProcessData& data);
protected:
VoiceProcessor* voiceProcessor;
};
tresult PLUGIN_API MySynthProcessor::setActive (TBool state)
{
if (state)
{
if (processSetup.symbolicSampleSize == kSample32)
voiceProcessor = new VoiceProcessorImplementation<float, Voice<float>, 2, MAX_VOICES, void> (processSetup.sampleRate, 0);
else if (processSetup.symbolicSampleSize == kSample64)
voiceProcessor = new VoiceProcessorImplementation<double, Voice<double>, 2, MAX_VOICES, void> (processSetup.sampleRate, 0);
else
return kInvalidArgument;
}
else
{
delete voiceProcessor;
voiceProcessor = 0;
}
return kResultTrue;
}
tresult PLUGIN_API MySynthProcessor::process (ProcessData& data)
{
return voiceProcessor->process (data);
}

See Also
  Steinberg::Vst::VoiceProcessorImplementation

## Constructor & Destructor Documentation

VoiceProcessor | ( |  | ) |
| inline

virtual ~VoiceProcessor | ( |  | ) |
| inlinevirtual

## Member Function Documentation

virtual tresult process | ( | ProcessData & | data | ) |
| pure virtual

Implemented in VoiceProcessorImplementation< Precision, VoiceClass, numChannels, maxVoices, GlobalParameterStorage >.

virtual void processEvent | ( | Event | evt | ) |
| pure virtual

Implemented in VoiceProcessorImplementation< Precision, VoiceClass, numChannels, maxVoices, GlobalParameterStorage >.

int32 getActiveVoices | ( |  | ) | const
| inline

Returns the number of active voices.

void clearOutputNeeded | ( | bool | val | ) |
| inline

## Member Data Documentation

int32 activeVoices
| protected

bool mClearOutputNeeded
| protected

Empty

Copyright ©2023 Steinberg Media Technologies GmbH. All Rights Reserved. This documentation is under this license.