Пример #1
0
//-------------------------------------------------------------------------------------------------------
long AudioEffectX::dispatcher (long opCode, long index, long value, void *ptr, float opt)
{
	long v = 0;
	switch(opCode)
	{
		// VstEvents
		case effProcessEvents:
			v = processEvents ((VstEvents*)ptr);
			break;

		// parameters and programs
		case effCanBeAutomated:
			v = canParameterBeAutomated (index) ? 1 : 0;
			break;
		case effString2Parameter:
			v = string2parameter (index, (char*)ptr) ? 1 : 0;
			break;

		case effGetNumProgramCategories:
			v = getNumCategories ();
			break;
		case effGetProgramNameIndexed:
			v = getProgramNameIndexed (value, index, (char*)ptr) ? 1 : 0;
			break;
		case effCopyProgram:
			v = copyProgram (index) ? 1 : 0;
			break;

		// connections, configuration
		case effConnectInput:
			inputConnected (index, value ? true : false);
			v = 1;
			break;	
		case effConnectOutput:
			outputConnected (index, value ? true : false);
			v = 1;
			break;	
		case effGetInputProperties:
			v = getInputProperties (index, (VstPinProperties*)ptr) ? 1 : 0;
			break;
		case effGetOutputProperties:
			v = getOutputProperties (index, (VstPinProperties*)ptr) ? 1 : 0;
			break;
		case effGetPlugCategory:
			v = (long)getPlugCategory ();
			break;

		// realtime
		case effGetCurrentPosition:
			v = reportCurrentPosition ();
			break;
			
		case effGetDestinationBuffer:
			v = (long)reportDestinationBuffer ();
			break;

		// offline
		case effOfflineNotify:
			v = offlineNotify ((VstAudioFile*)ptr, value, index != 0);
			break;
		case effOfflinePrepare:
			v = offlinePrepare ((VstOfflineTask*)ptr, value);
			break;
		case effOfflineRun:
			v = offlineRun ((VstOfflineTask*)ptr, value);
			break;

		// other
		case effSetSpeakerArrangement:
			v = setSpeakerArrangement ((VstSpeakerArrangement*)value, (VstSpeakerArrangement*)ptr) ? 1 : 0;
			break;
		case effProcessVarIo:
			v = processVariableIo ((VstVariableIo*)ptr) ? 1 : 0;
			break;
		case effSetBlockSizeAndSampleRate:
			setBlockSizeAndSampleRate (value, opt);
			v = 1;
			break;
		case effSetBypass:
			v = setBypass (value ? true : false) ? 1 : 0;
			break;
		case effGetEffectName:
			v = getEffectName ((char *)ptr) ? 1 : 0;
			break;
		case effGetErrorText:
			v = getErrorText ((char *)ptr) ? 1 : 0;
			break;
		case effGetVendorString:
			v = getVendorString ((char *)ptr) ? 1 : 0;
			break;
		case effGetProductString:
			v = getProductString ((char *)ptr) ? 1 : 0;
			break;
		case effGetVendorVersion:
			v = getVendorVersion ();
			break;
		case effVendorSpecific:
			v = vendorSpecific (index, value, ptr, opt);
			break;
		case effCanDo:
			v = canDo ((char*)ptr);
			break;
		case effGetIcon:
			v = (long)getIcon ();
			break;
		case effSetViewPosition:
			v = setViewPosition (index, value) ? 1 : 0;
			break;		
		case effGetTailSize:
			v = getGetTailSize ();
			break;
		case effIdle:
			v = fxIdle ();
			break;

		case effGetParameterProperties:
			v = getParameterProperties (index, (VstParameterProperties*)ptr) ? 1 : 0;
			break;

		case effKeysRequired:
			v = (keysRequired () ? 0 : 1);	// reversed to keep v1 compatibility
			break;
		case effGetVstVersion:
			v = getVstVersion ();
			break;

		// version 1.0 or unknown
		default:
			v = AudioEffect::dispatcher (opCode, index, value, ptr, opt);
	}
	return v;
}
Пример #2
0
//-------------------------------------------------------------------------------------------------------
long AudioEffectX::dispatcher (long opCode, long index, long value, void *ptr, float opt)
{
    long v = 0;
    switch(opCode)
    {
    // VstEvents
    case effProcessEvents:
        v = processEvents ((VstEvents*)ptr);
        break;

    // parameters and programs
    case effCanBeAutomated:
        v = canParameterBeAutomated (index) ? 1 : 0;
        break;
    case effString2Parameter:
        v = string2parameter (index, (char*)ptr) ? 1 : 0;
        break;

    case effGetNumProgramCategories:
        v = getNumCategories ();
        break;
    case effGetProgramNameIndexed:
        v = getProgramNameIndexed (value, index, (char*)ptr) ? 1 : 0;
        break;
    case effCopyProgram:
        v = copyProgram (index) ? 1 : 0;
        break;

    // connections, configuration
    case effConnectInput:
        inputConnected (index, value ? true : false);
        v = 1;
        break;
    case effConnectOutput:
        outputConnected (index, value ? true : false);
        v = 1;
        break;
    case effGetInputProperties:
        v = getInputProperties (index, (VstPinProperties*)ptr) ? 1 : 0;
        break;
    case effGetOutputProperties:
        v = getOutputProperties (index, (VstPinProperties*)ptr) ? 1 : 0;
        break;
    case effGetPlugCategory:
        v = (long)getPlugCategory ();
        break;

    // realtime
    case effGetCurrentPosition:
        v = reportCurrentPosition ();
        break;

    case effGetDestinationBuffer:
        v = (long)reportDestinationBuffer ();
        break;

    // offline
    case effOfflineNotify:
        v = offlineNotify ((VstAudioFile*)ptr, value, index != 0);
        break;
    case effOfflinePrepare:
        v = offlinePrepare ((VstOfflineTask*)ptr, value);
        break;
    case effOfflineRun:
        v = offlineRun ((VstOfflineTask*)ptr, value);
        break;

    // other
    case effSetSpeakerArrangement:
        v = setSpeakerArrangement ((VstSpeakerArrangement*)value, (VstSpeakerArrangement*)ptr) ? 1 : 0;
        break;
    case effProcessVarIo:
        v = processVariableIo ((VstVariableIo*)ptr) ? 1 : 0;
        break;
    case effSetBlockSizeAndSampleRate:
        setBlockSizeAndSampleRate (value, opt);
        v = 1;
        break;
    case effSetBypass:
        v = setBypass (value ? true : false) ? 1 : 0;
        break;
    case effGetEffectName:
        v = getEffectName ((char *)ptr) ? 1 : 0;
        break;
    case effGetErrorText:
        v = getErrorText ((char *)ptr) ? 1 : 0;
        break;
    case effGetVendorString:
        v = getVendorString ((char *)ptr) ? 1 : 0;
        break;
    case effGetProductString:
        v = getProductString ((char *)ptr) ? 1 : 0;
        break;
    case effGetVendorVersion:
        v = getVendorVersion ();
        break;
    case effVendorSpecific:
        v = vendorSpecific (index, value, ptr, opt);
        break;
    case effCanDo:
        v = canDo ((char*)ptr);
        break;
    case effGetIcon:
        v = (long)getIcon ();
        break;
    case effSetViewPosition:
        v = setViewPosition (index, value) ? 1 : 0;
        break;
    case effGetTailSize:
        v = getGetTailSize ();
        break;
    case effIdle:
        v = fxIdle ();
        break;

    case effGetParameterProperties:
        v = getParameterProperties (index, (VstParameterProperties*)ptr) ? 1 : 0;
        break;

    case effKeysRequired:
        v = (keysRequired () ? 0 : 1);	// reversed to keep v1 compatibility
        break;
    case effGetVstVersion:
        v = getVstVersion ();
        break;

#if VST_2_1_EXTENSIONS
    case effEditKeyDown:
        if (editor)
        {
            VstKeyCode keyCode = {index, (unsigned char)value, (unsigned char)opt};
            v = editor->onKeyDown (keyCode);
        }
        break;

    case effEditKeyUp:
        if (editor)
        {
            VstKeyCode keyCode = {index, (unsigned char)value, (unsigned char)opt};
            v = editor->onKeyUp (keyCode);
        }
        break;

    case effSetEditKnobMode:
        if (editor)
            v = editor->setKnobMode (value);
        break;

    case effGetMidiProgramName:
        v = getMidiProgramName (index, (MidiProgramName*)ptr);
        break;
    case effGetCurrentMidiProgram:
        v = getCurrentMidiProgram (index, (MidiProgramName*)ptr);
        break;
    case effGetMidiProgramCategory:
        v = getMidiProgramCategory (index, (MidiProgramCategory*)ptr);
        break;
    case effHasMidiProgramsChanged:
        v = hasMidiProgramsChanged (index) ? 1 : 0;
        break;
    case effGetMidiKeyName:
        v = getMidiKeyName (index, (MidiKeyName*)ptr) ? 1 : 0;
        break;

    case effBeginSetProgram:
        v = beginSetProgram () ? 1 : 0;
        break;
    case effEndSetProgram:
        v = endSetProgram () ? 1 : 0;
        break;

#endif // VST_2_1_EXTENSIONS

#if VST_2_3_EXTENSIONS
    case effGetSpeakerArrangement:
        v = getSpeakerArrangement ((VstSpeakerArrangement**)value, (VstSpeakerArrangement**)ptr) ? 1 : 0;
        break;

    case effSetTotalSampleToProcess:
        v = setTotalSampleToProcess (value);
        break;

    case effShellGetNextPlugin:
        v = getNextShellPlugin ((char*)ptr);
        break;

    case effStartProcess:
        v = startProcess ();
        break;
    case effStopProcess:
        v = stopProcess ();
        break;

    case effSetPanLaw:
        v = setPanLaw (value, opt) ? 1 : 0;
        break;

    case effBeginLoadBank:
        v = beginLoadBank ((VstPatchChunkInfo*)ptr);
        break;
    case effBeginLoadProgram:
        v = beginLoadProgram ((VstPatchChunkInfo*)ptr);
        break;
#endif // VST_2_3_EXTENSIONS

    // version 1.0 or unknown
    default:
        v = AudioEffect::dispatcher (opCode, index, value, ptr, opt);
    }
    return v;
}