Exemplo n.º 1
0
//-----------------------------------------------------------------------------
MidiCCReset::MidiCCReset (audioMasterCallback audioMaster)
	: PizMidi (audioMaster, kNumPrograms, kNumParams) 
{ 
    programsAreChunks();

	firstTime=true;

    init();
    programs = new MidiCCResetProgram[numPrograms];
	if (programs) {
		CFxBank* defaultBank = new CFxBank(kNumPrograms,kNumParams);
		if (readDefaultBank(PLUG_NAME,defaultBank)) {
			if((VstInt32)defaultBank->GetFxID()==PLUG_IDENT) {
				for(int i=0;i<kNumPrograms;i++){
					for (int p=0;p<kNumParams;p++) {
						programs[i].param[p] = defaultBank->GetProgParm(i,p);
					}
					strcpy(programs[i].name,defaultBank->GetProgramName(i));
				}
			}
		}
		else {
			// built-in programs
			for(int i=0;i<kNumPrograms;i++){
		        sprintf(programs[i].name,"Program %d", i+1);
			}
		}
	    setProgram (0);
	}
}
Exemplo n.º 2
0
ZynWise::ZynWise(audioMasterCallback audioMaster) 
	: AudioEffectX(audioMaster, PROGRAMS_COUNT, kParamsCount)
{
    if (audioMaster) 
	{
		isSynth(true);
		programsAreChunks(true);
		setNumInputs(INPUTS_COUNT);
        setNumOutputs(OUTPUTS_COUNT);
        setUniqueID(VST_ID);
        canProcessReplacing();

		View *view = new MainView(this);
		view->SetData(&_zasf);
		_gui = new Gui(this, GUI_WIDTH, GUI_HEIGHT);
		_gui->SetView(view);
		setEditor(_gui);
    }
}
Exemplo n.º 3
0
VSTInstrument::VSTInstrument(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, 1, 0), align16()
//, vm(new LuaVM())
, downsampler(new invader::ZResampler2x)
//, vstEditor(nullptr)
, programFile(zstrdup(ZScopedRegistryKey("Software\\Fnuque\\Invader", "ProgramPath").str))
, synth(nullptr)
{
	if (audioMaster)
	{
		setNumInputs(0);				// no inputs
		setNumOutputs(2);		// usually 2 outputs, left and right channel respectively
		canProcessReplacing();
		programsAreChunks(true);
		isSynth();
		setUniqueID('inva');
	}

	//strcpy(programName, "default");

/*
	// Init LuaVM
	#ifdef RUN_FROM_DISK
		ZScopedRegistryKey basePath("BasePath");

		// Set skin path
		char skinPath[512];
		sprintf(skinPath, "%stransgressor/vst/gui/skins/", basePath.str);
		vm->SetGlobalString("skinPath", skinPath);

		// Paths should be matched by shortcuts below
		vm->AddPackagePath("%s?.lua", basePath.str);
		vm->AddPackagePath("%sexternal/libs/lpeg/src/?.lua", basePath.str);
		vm->AddPackagePath("%stransgressor/vst/compiler/?.lua", basePath.str);
	#else
		// Set skin path
		ZScopedRegistryKey skinPath("SkinPath");
		vm->SetGlobalString("skinPath", skinPath.str);

		// Load embedded scripts and set preload shortcuts
		ZResource scripts("packedscripts.lua", "LUA");
		vm->DoString((const char* const)scripts.GetString());
		vm->AddPackageShortcut("external.libs.lpeg.src");
		vm->AddPackageShortcut("transgressor.vst.compiler");
	#endif

	vm->Require("libs.base_synth_gui.script.init");
	vm->Require("transgressor.vst.gui.script.root");

	// Create Editor
	vstEditor = new VSTEditor(this, vm);
	setEditor(vstEditor);
*/
	suspend();

//	vm->SetGlobalVariable("editor", "VSTEditor *", vstEditor);

	//invader::ZFIRInterpolator inter;
	//inter.Init();

//i	vm->SetGlobalVariable("synth", "ZSynth *", synth);
//	vm->LoadDefaultProgram();

	/*// Create test program
	synth->synth = synth;
	synth->instrument = NULL;
	synth->voice = NULL;

	synth->program = new ZVMProgram;
	synth->program->bytecodeSize = 3;
	synth->program->bytecode = new opcode_t[3];
	synth->program->bytecode[0] = kOpcodeSynthRenderInstrument;
	synth->program->bytecode[1] = 0;
	synth->program->bytecode[2] = kOpcodeStop;
	synth->entryPoint = 0;

	synth->CreateNodeInstances(synth->program);

	synth->instruments[0]->hasProgram = true;
	synth->instruments[0]->isActive = true;


	for (uint32_t i=0; i<kNumVoices; i++)
	{
		ZVoice* voice = synth->instruments[0]->voices[i];

		voice->synth = synth;
		voice->instrument = synth->instruments[0];
		voice->voice = voice;

		voice->program = new ZVMProgram;
		voice->program->bytecodeSize = 2;
		voice->program->bytecode = new opcode_t[2];
		voice->program->bytecode[0] = kOpcodeSynthSinOsc;
		voice->program->bytecode[1] = kOpcodeStop;
		voice->entryPoint = 0;

		voice->CreateNodeInstances(voice->program);
	}*/

}
Exemplo n.º 4
0
Vst::Vst (audioMasterCallback audioMaster, bool asInstrument) :
    AudioEffectX (audioMaster, 128, 128),
    myApp(0),
    myHost(0),
    myWindow(0),
    bufferSize(0),
    listEvnts(0),
    hostSendVstEvents(false),
    hostSendVstMidiEvent(false),
    hostReportConnectionChanges(false),
    hostAcceptIOChanges(false),
    hostSendVstTimeInfo(false),
    hostReceiveVstEvents(false),
    hostReceiveVstMidiEvents(false),
    hostReceiveVstTimeInfo(false),
    opened(false),
    currentHostProg(0),
    chunkData(0)
{
    setNumInputs (DEFAULT_INPUTS*2);
    setNumOutputs (DEFAULT_OUTPUTS*2);

    if(asInstrument)
        setUniqueID (uniqueIDInstrument);
    else
        setUniqueID (uniqueIDEffect);

    isSynth(asInstrument);
    canProcessReplacing(true);
    programsAreChunks(true);
    vst_strncpy (programName, "Default", kVstMaxProgNameLen);	// default program name

    qRegisterMetaType<ConnectionInfo>("ConnectionInfo");
    qRegisterMetaType<ObjectInfo>("ObjectInfo");
    qRegisterMetaType<int>("ObjType::Enum");
    qRegisterMetaType<QVariant>("QVariant");
    qRegisterMetaType<AudioBuffer*>("AudioBuffer*");

    qRegisterMetaTypeStreamOperators<ObjectInfo>("ObjectInfo");

    QCoreApplication::setOrganizationName("CtrlBrk");
    QCoreApplication::setApplicationName("VstBoard");

#ifdef QT_NO_DEBUG
    if(qtTranslator.load("qt_" + QLocale::system().name(), ":/translations/"))
        qApp->installTranslator(&qtTranslator);
    if(commonTranslator.load("common_" + QLocale::system().name(), ":/translations/"))
        qApp->installTranslator(&commonTranslator);
    if(myappTranslator.load("vstboard_" + QLocale::system().name(), ":/translations/"))
        qApp->installTranslator(&myappTranslator);
#endif
    myHost = new MainHostVst(this,0,"plugin/");
    if(myHost->doublePrecision)
        canDoubleReplacing(true);
    connect(myHost, SIGNAL(DelayChanged(long)),
            this, SLOT(DelayChanged(long)));

    myWindow = new MainWindowVst(myHost);
    qEditor = new Gui(this);
    setEditor(qEditor);
    qEditor->SetMainWindow(myWindow);
}