예제 #1
0
	ofxVSTPlugin(audioMasterCallback audioMaster): AudioEffectX (audioMaster, 1, 1) {

		plugin = ofxAudioPlugin_getPlugin(this);
		
		
#ifdef ofxAudioPlugin_IsSynth
		setNumInputs(0);
		isSynth();
#else
		setNumInputs (2);		// stereo in
#endif
		setNumOutputs (2);		// stereo out
		setUniqueID (ofxAudioPlugin_PluginCode);	// identify
		canProcessReplacing ();	// supports replacing output

		
		fGain = 1.f;			// default to 0 dB
		vst_strncpy (programName, "Default", kVstMaxProgNameLen);	// default program name
		
		cEffect.numPrograms = 3;
		
		
		cEffect.numParams = plugin->getNumParameters();
		cEffect.numParams = 1;
		
		parametersChanged();
	}
예제 #2
0
NitroSynth::NitroSynth(audioMasterCallback pCallback)
:	AudioEffectX(pCallback, 0, 128),
	fSamplePeriod(1.0f/44100.0f),
	bRecording(false),
	iRecorderState(IDLE)
{
	if ( pCallback )
	{
		setNumInputs(0);
		setNumOutputs(2);
		canProcessReplacing();
		isSynth();
		setUniqueID('SRTN');
	}

	for ( int i = 0 ; i < 8 ; i++ )
		if ( i < 6 )
			pInstruments[i] = new Instrument(new WaveDuty(), & pParameters[i]);
		else
			pInstruments[i] = new Instrument(new Noise(), & pParameters[i]);

#ifndef NO_VST_GUI
	setEditor(new NitroSynthInterface(this));
#endif // NO_VST_GUI
}
예제 #3
0
SorolletVSTi::SorolletVSTi(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, kNumPrograms, kNumParams)
{
	if (audioMaster)
	{
		// TODO: load default / more varied programs!

		// initialize programs
		programs = new SorolletVSTiProgram[kNumPrograms];
		for (VstInt32 i = 0; i < 16; i++)
			channelPrograms[i] = i;

		mSorolletVoice = new SorolletVoice();

		if (programs)
		{
			setProgram(0);
		}

		setNumInputs(0); // no inputs
		setNumOutputs(kNumOutputs); // 2 outputs
		canProcessReplacing();
		isSynth();
		setUniqueID('so02');

		currentEvent = EVENT_NULL;

		initProcess();
		suspend();
	}
}
예제 #4
0
int choosePinIdx(int note, int channel) {
    int instr = playChannels[channel];
    if( isPercussion(instr) && PERCUSSION_PIN_IDX != -1 ) {
        //printf("Playing percussion channel\n");
        return PERCUSSION_PIN_IDX;
    }
    else if( isBase(instr) && BASE_PIN_IDX != -1) {
        //printf("Playing base channel\n");
        return BASE_PIN_IDX;
    }
    else if( isSynth(instr) && SYNTH_PIN_IDX != -1) {
        
        //printf("Playing synth channel\n");
        return SYNTH_PIN_IDX;
    }
    else { //Is a melody type instrument
        //There are 12 different kinds of notes.
        int noteMod = note % 12;
        
        //Cast to double
        double noteModDouble = noteMod;
        
        //The pin to use is determined by:
        // ( pitch  /  ( Total number of notes / Total Number of Pins) )
        double noteBin = noteModDouble / (12.0 / NUM_MELODY_PINS);
        
        //Cast back to int
        int pinIdx = (int)noteBin;
        return pinIdx;
    }
    
    
    
}
예제 #5
0
Vst2413r::Vst2413r(audioMasterCallback audioMaster)
:   AudioEffectX(audioMaster, 0, 0),
    driver_(44100)
{
    if(audioMaster != NULL) {
        setNumInputs(0);
        setNumOutputs(1);
        setUniqueID(kUniqueId);
        canProcessReplacing();
        isSynth();
    }
    suspend();
}
예제 #6
0
//-----------------------------------------------------------------------------------------
tf3Synth::tf3Synth (audioMasterCallback audioMaster, void* hInstance)
	: AudioEffectX (audioMaster, kNumPrograms, TF_PARAM_COUNT)
{
	// Initialize module path
	eChar mpath[512];
	eMemSet(mpath, 0, 512);
	GetModuleFileName((HMODULE)hInstance, mpath, 512);

	eChar *str = &mpath[511];
	while (str != mpath && *str!='/' && *str!='\\')
	{
		*str-- = '\0';
	}
	
	modulePath = QString(mpath);

	// Initialize tunefish
	tf = new tfInstrument();

	// initialize programs
	for (long i = 0; i < kNumPrograms; i++)
		programs[i].loadDefault(i);

	loadProgramAll();

	for (long i = 0; i < 16; i++)
		channelPrograms[i] = i;

	if (programs)
		setProgram (0);

    editor = new tfEditor(this);
	
	if (audioMaster)
	{
		setNumInputs (0);				// no inputs
		setNumOutputs (kNumOutputs);	// 2 outputs, 1 for each oscillator
		canProcessReplacing ();
		hasVu (false);
		hasClip (false);
		isSynth ();
		setUniqueID ('TF3');			// <<<! *must* change this!!!!
	}
	initProcess ();

	suspend ();
}
예제 #7
0
파일: midiGain.cpp 프로젝트: Amcut/pizmidi
//-----------------------------------------------------------------------------
MidiGain::MidiGain (audioMasterCallback audioMaster) 
	: AudioEffectX(audioMaster, kNumPrograms, kNumParams),
	programs(0)
{ 
    setNumInputs(2);
    setNumOutputs(2);
    isSynth();

    setUniqueID(PLUG_IDENT);         
	canProcessReplacing();             

	programs = new MidiGainProgram[numPrograms];

	if (programs)
	    setProgram (0);

	init();
}
예제 #8
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);
    }
}
예제 #9
0
파일: vstxsynth.cpp 프로젝트: berak/vst2.0
//-----------------------------------------------------------------------------------------
// VstXSynth
//-----------------------------------------------------------------------------------------
VstXSynth::VstXSynth (audioMasterCallback audioMaster)
: AudioEffectX (audioMaster, kNumPrograms, kNumParams)
{
	// initialize programs
	programs = new VstXSynthProgram[kNumPrograms];
	for (VstInt32 i = 0; i < 16; i++)
		channelPrograms[i] = i;

	if (programs)
		setProgram (0);
	
	if (audioMaster)
	{
		setNumInputs (0);				// no inputs
		setNumOutputs (kNumOutputs);	// 2 outputs, 1 for each oscillator
		canProcessReplacing ();
		isSynth ();
		setUniqueID ('P451');			// <<<! *must* change this!!!!
	}

	initProcess ();
	suspend ();
}
예제 #10
0
파일: vstep.cpp 프로젝트: eriser/vstep
//------------------------------------------------------------------------------
VStep::VStep(audioMasterCallback audioMaster)
: AudioEffectX(audioMaster, 1, 0) // 1 program, 0 parameters
, keyForChannel(pattern.numChannels())
, pattern(8, 16) // 8 channels, 16 steps
, listener("7770", &pattern)
, keepAlive(0)
{
  setUniqueID('VSTP');

  setNumInputs(0);
  setNumOutputs(2);
  isSynth();

  canProcessReplacing();
  canDoubleReplacing();

  vst_strncpy(programName, "Default", kVstMaxProgNameLen);

  for (unsigned int channel = 0; channel < pattern.numChannels(); ++channel)
  {
    keyForChannel[channel] = 36 + channel;
  }
}
예제 #11
0
//----------------------------------------------------------------------------
//Plugin Constructor - create programs, set certain variables
//----------------------------------------------------------------------------
AmplitudeImposer::AmplitudeImposer(audioMasterCallback audioMaster)
	: AudioEffectX(audioMaster, kNumPrograms, kNumParams)
{	
	programs = 0;

	fDepth = 1.0f;
	fThreshold = 0.5f;

	for(int i=0;i<NUM_EVENTS_MAX;i++)
	{
		MIDIEvent[i] = new VstMidiEvent;

		MIDIEvent[i]->type = 1;
		MIDIEvent[i]->midiData[3] = 0;
		MIDIEvent[i]->reserved1 = 99;
		MIDIEvent[i]->deltaFrames = -99;
		MIDIEvent[i]->noteLength = 0;
		MIDIEvent[i]->noteOffset = 0;

		EventNumArray[i] = -1;
	}
	NumPendingEvents = 0;
	Events = new VstEvents;
	Events->numEvents = 1;
	Events->events[0] = (VstEvent *)MIDIEvent[0];
	NumEvents = 0;

	Frames = 0;

    programs = new AmplitudeImposerProg[numPrograms];
	
	if(programs)
	{
		setProgram(0);
		setParameter(kDepth, 1.0f);
		setParameter(kThreshold, 0.5f);
	    setProgramName("Amplitude Imposer");
	}
		
	strcpy(kEffectName, "Amplitude Imposer");
	strcpy(kProduct, "ndc Plugs Amp Imposer");
	strcpy(kVendor, "ndc Plugs");
	

	AudioEffect::__hasVuDeprecated(kVU);
    setNumInputs(kNumInputs);
    setNumOutputs(kNumOutputs);
    AudioEffect::__canMonoDeprecated(kCanMono);
    canProcessReplacing(kCanReplacing);
    isSynth(kIsSynth);
    setUniqueID(kID);

	tempo = 125.0f;
	samplerate = getSampleRate();
	if(samplerate <= 11025.0f)
		samplerate = 44100.0f;

	checkTooSoon = 0;
	checkTempo = 1024;
	checkBSZero = false;

	ampEnvelope_l = 0.0f;
	ampEnvelope_r = 0.0f;
	envDecay = 0.0001f;
	audioEnvelope_l = 0.0f;
	audioEnvelope_r = 0.0f;

	//----------------

	editor = new AmplitudeImposerEditor(this);
	if(!editor)
		oome = true;
 }
예제 #12
0
파일: mirsynth.cpp 프로젝트: EQ4/miriyaki
//-----------------------------------------------------------------------------------------
// MirSynth
//-----------------------------------------------------------------------------------------
MirSynth::MirSynth (audioMasterCallback audioMaster)
: AudioEffectX (audioMaster, kNumPrograms, kNumParams)
{
	out_buffer = new float [2];
	voice_buffer = new float [2];
	globals = new cGlobals();
	Glob = globals;
	Glob->sampleRate = getSampleRate();
	Glob->sampleTime = 1.0f / Glob->sampleRate;

	lfo[0] = new cLFO(1,	&(Glob->zLfoRate[0]),
							&(Glob->parameters[kLfo1PhaseShift]->value),
							&(Glob->parameters[kLfo1Delay]->value),
							&(Glob->parameters[kLfo1Fade]->value),
							&(Glob->iLfoWave[0]),
							&(Glob->parameters[kLfo1Mono]->value),
							&(Glob->lfoValue[0]));
	lfo[1] = new cLFO(2,	&(Glob->zLfoRate[1]),
							&(Glob->parameters[kLfo2PhaseShift]->value),
							&(Glob->parameters[kLfo2Delay]->value),
							&(Glob->parameters[kLfo2Fade]->value),
							&(Glob->iLfoWave[1]),
							&(Glob->parameters[kLfo2Mono]->value),
							&(Glob->lfoValue[1]));
	lfo[2] = new cLFO(3,	&(Glob->zLfoRate[2]),
							&(Glob->parameters[kLfo3PhaseShift]->value),
							&(Glob->parameters[kLfo3Delay]->value),
							&(Glob->parameters[kLfo3Fade]->value),
							&(Glob->iLfoWave[2]),
							&(Glob->parameters[kLfo3Mono]->value),
							&(Glob->lfoValue[2]));
	lfo[3] = new cLFO(4,	&(Glob->zLfoRate[3]),
							&(Glob->parameters[kLfo4PhaseShift]->value),
							&(Glob->parameters[kLfo4Delay]->value),
							&(Glob->parameters[kLfo4Fade]->value),
							&(Glob->iLfoWave[3]),
							&(Glob->parameters[kLfo4Mono]->value),
							&(Glob->lfoValue[3]));
	for (VstInt32 i=0;i<4;i++)
	{
		if (lfo[i])	lfo[i]->resetGlobal();
	}

	filter[0] = new cGlobFilter();
	filter[1] = new cGlobFilter();

	programs = new MirSynthProgram[kNumPrograms];

	char *str;
	str = new char[kVstMaxProgNameLen];
	for (VstInt32 i = 0; i < 16; i++)
	{
		sprintf(str, "Preset %.2d", i);
		vst_strncpy (programs[i].name, str, kVstMaxProgNameLen);
		channelPrograms[i] = i;
	}

	if (programs) 
	{
		defaultPresets();
		defaultPresets2();
		defaultPresets3();
	/*	defaultPresets4();
		defaultPresets5();
		defaultPresets6();
		defaultPresets7();
		defaultPresets8();
		defaultPresets9();
		defaultPresets10();*/
	}

	if (audioMaster)
	{
		setNumInputs (0);
		setNumOutputs (kNumOutputs);
		canProcessReplacing ();
		isSynth ();
		setUniqueID ('tst2');			
	}

	for (int i=0;i<MAX_POLYPHONY;i++)
  	  voices[i] = new cVoice();
	
	editor = new cMirEditor(this);

	initProcess ();
	suspend ();
}
예제 #13
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);
	}*/

}
예제 #14
0
SynthCore::SynthCore(audioMasterCallback audioMaster, bool *error, int numprogs)
: VstWrap(audioMaster, numprogs, NUM_VST_PARAMS)
{
	const char *errfmt = "*** NeuronVS Core(err): %s failed\n";
	*error = false;
	
	remote = 0;
	snddat = 0;
	engine = NULL;
	params = 0;
	noise  = 0;
	editor = 0;
	
	if(audioMaster)
	{
		SynthEditor *sed=0;
		bool err=false, test=true;
		int i;
		
		for(i=0; i<NUM_VST_PARAMS; i++)
		{
			mVstParams[i] = 0;
		}
		
		remote = new CRemote;
		test = (!remote) ? true : remote->IsBad();
		err |= test; if(test) fprintf(stderr,errfmt,"remote");
		
		snddat = new SoundParams;
		test = (!snddat) ? true : snddat->IsBad();
		err |= test; if(test) fprintf(stderr,errfmt,"snddat"); 
		
		engine = NASEngineCreate();
		test = (!engine) ? true : false;
		err |= test; if(test) fprintf(stderr,errfmt,"engine");
		
		params = new ModuleParams(engine,snddat);
		test = (!params) ? true : params->IsBad();
		err |= test; if(test) fprintf(stderr,errfmt,"params");
		
		// need to do this here, examine why
		{
			mActualSound.mMin = 0.;
			mActualSound.mMax = 999.;
			mActualSoundNtf.inf[0] = this;
			mActualSoundNtf.inf[1] = 0;
			mActualSoundNtf.PstCbFn = stNewSound;
			mActualSound.AddNotify(&mActualSoundNtf,true);
		}
		
		noise  = new ModuleEngine(this,engine,params);
		test = (!noise) ? true : noise->IsBad();
		err |= test; if(test) fprintf(stderr,errfmt,"noise");
		
		sed = new SynthEditor(this);
		test = (!sed) ? true : sed->IsBad();
		err |= test; if(test) fprintf(stderr,errfmt,"editor");
		
		if(!err)
		{
			for(i=0; i<NUM_VST_PARAMS; i++)
			{
				const static int autparam[NUM_VST_PARAMS] =
				{
					R1L1Sphere1Value,R1L1Sphere2Value,
					R1L2Sphere1Value,R1L2Sphere2Value,
					R1L3Sphere1Value,R1L3Sphere2Value,
					R1L1Scape1Value,R1L1Scape2Value,
					R1L2Scape1Value,R1L2Scape2Value,
					R1L3Scape1Value,R1L3Scape2Value,
					
					R2L1Sphere1Value,R2L1Sphere2Value,
					R2L2Sphere1Value,R2L2Sphere2Value,
					R2L3Sphere1Value,R2L3Sphere2Value,
					R2L1Scape1Value,R2L1Scape2Value,
					R2L2Scape1Value,R2L2Scape2Value,
					R2L3Scape1Value,R2L3Scape2Value,
					
					FilterFreq, FilterReso,
				};
				
				mVstParamsNtf[i].clear();
				mVstParamsNtf[i].min = 0.;
				mVstParamsNtf[i].max = 1.;
				mVstParamsNtf[i].inf[0] = this;
				mVstParamsNtf[i].inf[1] = (void *)i;
				mVstParamsNtf[i].PstCbFn = stVstParam;
				mVstParams[i] = snddat->mParam + autparam[i];
				mVstParams[i]->AddNotify(&mVstParamsNtf[i],false,NFLG_FORCE|NFLG_ALL);
			}
			
			noise->SetNewPrgCb(stNewPrg,this);
			
			setNumInputs(0);  // no inputs, doesn't work anyways
			setNumOutputs(2); // 2 outputs
			canProcessReplacing();
			hasVu(false);
			hasClip(false);
			isSynth();
			setUniqueID('NAS2');			// NeuronVS tag
			editor = sed;
			
			
			if(remote)
			{
				void (*authcb[])(void*) = {stDeny,stAllow};
				remote->SetAuthCb(authcb,sed);
			}
			
			// SMB NEW
			//			stAllow(sed);
			
		}
		else
		{
			*error = true;
			fprintf(stderr,errfmt,"components");
			this->~SynthCore();
		}
	}
	else
	{
		fprintf(stderr,errfmt,"audiomaster");
		*error = true;
	}
	
	suspend();
}
예제 #15
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);
}