예제 #1
0
void Plugin::setStateInformation (const void* data, int sizeInBytes)
{
    //load bank from host
    XmlElement* const xml_state = getXmlFromBinary(data, sizeInBytes);
    if (xml_state != 0) {
        program_bank->loadBankFromXml(xml_state);
        setCurrentProgram(current_program);
        delete xml_state;
        editor_program_update_pending = true;
    }
}
예제 #2
0
void Plugin::loadCurrentProgramXml(File* file)
{
    //load program from file
    XmlDocument xml_document(*file);
    XmlElement* xml_state = xml_document.getDocumentElement();
    if (xml_state != 0) {
        program_bank->loadProgramFromXml(current_program, xml_state);
        setCurrentProgram(current_program);
        delete xml_state;
        editor_program_update_pending = true;
    }
}
예제 #3
0
//==============================================================================
OppressorPlugin::OppressorPlugin()
{
	// Create parameter manager
	Pars = new OppressorParMan();

	magnus = 0;

	cp = 0;
	temppr=1;
	setCurrentProgram(cp);

	ProgName[0] = "Preset1";
	ProgName[1] = "Preset2";
	ProgName[2] = "Preset3";

}
예제 #4
0
void Plugin::setParameter(int index, float new_value)
{
    if (index != kNone) {
        if (index == kProgram) {
            if (progchange_param_enabled) {
                int selected_program = static_cast<int>(new_value * (kNumPrograms - 1));
                if (current_program != selected_program) {
                    setCurrentProgram(selected_program);
                }
            }
        } else {
            parameters->setParameter(index, new_value, false);
        }
        setParametersChangedState();
    }
}
예제 #5
0
//==============================================================================
JenSx1000AudioProcessor::JenSx1000AudioProcessor() :
ampEnvelope(JenConstants::AmpEnvMaxAttackTime, JenConstants::AmpEnvMaxDecayTime, JenConstants::AmpEnvMaxReleaseTime)

{
    //Run Unit tests
    if (true){
        std::cout << "processor created";
        UnitTestRunner runner;
        runner.runAllTests();
    }
    
    //------- VCO Params -------------------------------------------------------
    addParameter(vcoTuneParam = new JenParameter(*this, "VCO tune", 0.5));
    addParameter(vcoOctaveParam = new JenParameter(*this, "VCO octave", 0, 4));
    addParameter(vcoVibratoParam = new JenParameter(*this, "VCO vibrato", 0.5));
    addParameter(vcoWaveformParam = new JenParameter(*this, "VCO waveform", 0.5, 3));
    addParameter(vcoPulseWidthParam = new JenParameter(*this, "VCO pulse width", 0.5));
    addParameter(vcoPWMParam = new JenParameter(*this, "VCO PWM", 0.5));
    addParameter(vcoLevelParam = new JenParameter(*this, "VCO level", 0.5));
    addParameter(vcoGlideParam = new JenParameter(*this, "VCO glide", 0.5));
    
    //------- LFO Params ------------------------------------------------------
    addParameter(lfoSpeedParam = new JenParameter(*this, "LFO speed", 0.5));
    
    //------- VCF Params ------------------------------------------------------
    addParameter(vcfFrequencyParam = new JenParameter(*this, "VCF frequency", 0.5));
    addParameter(vcfResonanceParam = new JenParameter(*this, "VCF resonance", 0.5));
    addParameter(vcfLFOParam = new JenParameter(*this, "VCF LFO", 0.5));
    addParameter(vcfEnvLevelParam = new JenParameter(*this, "VCF env. level", 0.5));
    addParameter(vcfAttackParam = new JenParameter(*this, "VCF attack", 0.3));
    addParameter(vcfDecayParam = new JenParameter(*this, "VCF decay", 0.3));
    addParameter(vcfSustainParam = new JenParameter(*this, "VCF sustain", 0.5));
    addParameter(vcfReleaseParam = new JenParameter(*this, "VCF release", 0.3));
    
    //------- Noise Params ----------------------------------------------------
    addParameter(noiseNoiseParam = new JenParameter(*this, "NOISE noise", 0.5, 3));
    addParameter(noiseLevelParam = new JenParameter(*this, "NOISE level", 0.5));
    
    //------- VCA Params ------------------------------------------------------
    addParameter(vcaOutputVolumeParam = new JenParameter(*this, "VCA level", 0.5));
    addParameter(vcaAttackParam = new JenParameter(*this, "VCA attack", 0.3));
    addParameter(vcaDecayParam = new JenParameter(*this, "VCA decay", 0.3));
    addParameter(vcaSustainParam = new JenParameter(*this, "VCA sustain", 0.5));
    addParameter(vcaReleaseParam = new JenParameter(*this, "VCA release", 0.3));
    
    setCurrentProgram(0);
}
예제 #6
0
    void initialise (double initialSampleRate, int initialBlockSize)
    {
        setPlayConfigDetails (inputs.size(), outputs.size(), initialSampleRate, initialBlockSize);

        if (initialised || plugin == nullptr || handle == nullptr)
            return;

        JUCE_LADSPA_LOG ("Initialising LADSPA: " + name);

        initialised = true;

        inputs.clear();
        outputs.clear();
        parameters.clear();

        for (unsigned int i = 0; i < plugin->PortCount; ++i)
        {
            const LADSPA_PortDescriptor portDesc = plugin->PortDescriptors[i];

            if ((portDesc & LADSPA_PORT_CONTROL) != 0)
                parameters.add (i);

            if ((portDesc & LADSPA_PORT_AUDIO) != 0)
            {
                if ((portDesc & LADSPA_PORT_INPUT) != 0)    inputs.add (i);
                if ((portDesc & LADSPA_PORT_OUTPUT) != 0)   outputs.add (i);
            }
        }

        parameterValues.calloc (parameters.size());

        for (int i = 0; i < parameters.size(); ++i)
            plugin->connect_port (handle, parameters[i], &(parameterValues[i].scaled));

        setPlayConfigDetails (inputs.size(), outputs.size(), initialSampleRate, initialBlockSize);

        setCurrentProgram (0);
        setLatencySamples (0);

        // Some plugins crash if this doesn't happen:
        if (plugin->activate   != nullptr)   plugin->activate (handle);
        if (plugin->deactivate != nullptr)   plugin->deactivate (handle);
    }
예제 #7
0
//==============================================================================
Tunefish4AudioProcessor::Tunefish4AudioProcessor() :
tf(nullptr),
synth(nullptr),
currentProgramIndex(0),
adapterWriteOffset(0),
adapterDataAvailable(0)
{
    pluginLocation = File::getSpecialLocation(File::currentApplicationFile).getParentDirectory().getFullPathName();

    adapterBuffer[0] = new eF32[TF_BUFFERSIZE];
    adapterBuffer[1] = new eF32[TF_BUFFERSIZE];

    synth = new eTfSynth();
    eTfSynthInit(*synth);
    synth->sampleRate = 44100;

    synth->instr[0] = tf = new eTfInstrument();
    eTfInstrumentInit(*synth, *tf);

    for (eU32 i=0; i<TF_PLUG_NUM_PROGRAMS; i++)
    {
        programs[i].loadDefault(i);

        for (eU32 j=0; j<TF_PARAM_COUNT; j++)
        {
            programs[i].setParam(j, TF_DEFAULTPROG[j]);
        }
    }

    loadProgramAll();

    for (eU32 j=0; j<TF_PARAM_COUNT; j++)
    {
        tf->params[j] = programs[0].getParam(j);
    }

    resetParamDirty(eTRUE);
    setCurrentProgram(0);
}
예제 #8
0
파일: midiOut.cpp 프로젝트: Amcut/pizmidi
//==============================================================================
MidiOutFilter::MidiOutFilter()
{
    programs = new JuceProgram[getNumPrograms()];

    devices = MidiOutput::getDevices();
    midiOutput = 0;
	loadDefaultFxb();
    curProgram=0;
    init=true;
    setCurrentProgram (0);

    samplesToNextClock=0;
    samplesToNextMTC=0;
    wasPlaying=false;
    startAt=-999.0;
    startMTCAt=-999.0;
    sendclock=false;
    sendmtc=false;
    mtcNumber=0;

    zeromem (&lastPosInfo, sizeof (lastPosInfo));
}
//==============================================================================
DetunerPlugin::DetunerPlugin()
{
	//Create parameter manager
	Pars = new DetunerParMan();

	///initialise...
	buf = new float[BUFMAX];
	win = new float[BUFMAX];
	buflen=0;

	magnus=0;

	cp = 0;
	temppr=1;
	setCurrentProgram(cp);
	

	ProgName[0] = "Phantom";
	ProgName[1] = "Little";
	ProgName[2] = "Heavy";
   
   setNumParameters(Pars->getNumPars()); // dud parameters so we are good for our promise   
}
예제 #10
0
void
RemotePluginServer::dispatchProcessEvents()
{    
    RemotePluginOpcode opcode = RemotePluginNoOpcode;

    tryRead(&m_shmControl->ringBuffer, &opcode, sizeof(RemotePluginOpcode));

//    std::cerr << "read opcode: " << opcode << std::endl;

    switch (opcode) {

    case RemotePluginProcess:
    {
	if (m_bufferSize < 0) {
	    std::cerr << "ERROR: RemotePluginServer: buffer size must be set before process" << std::endl;
	    return;
	}
	if (m_numInputs < 0) {
	    std::cerr << "ERROR: RemotePluginServer: input count must be tested before process" << std::endl;
	    return;
	}
	if (m_numOutputs < 0) {
	    std::cerr << "ERROR: RemotePluginServer: output count must be tested before process" << std::endl;
	    return;
	}
	if (!m_shm) {
	    sizeShm();
	    if (!m_shm) {
		std::cerr << "ERROR: RemotePluginServer: no shared memory region available" << std::endl;
		return;
	    }
	}

//	std::cerr << "server process: entering" << std::endl;

	size_t blocksz = m_bufferSize * sizeof(float);

	for (int i = 0; i < m_numInputs; ++i) {
	    m_inputs[i] = (float *)(m_shm + i * blocksz);
	}
	for (int i = 0; i < m_numOutputs; ++i) {
	    m_outputs[i] = (float *)(m_shm + (i + m_numInputs) * blocksz);
	}

	process(m_inputs, m_outputs);

//	std::cerr << "server process: written" << std::endl;
	break;
    }
	
    case RemotePluginSetParameter:
    {
        int pn(readInt(&m_shmControl->ringBuffer));
        setParameter(pn, readFloat(&m_shmControl->ringBuffer));
	break;
    }

    case RemotePluginSetCurrentProgram:
	setCurrentProgram(readInt(&m_shmControl->ringBuffer));
	break;

    case RemotePluginSendMIDIData:
    {
	int events = 0;
	int *frameoffsets = 0;
	unsigned char *data = readMIDIData(&m_shmControl->ringBuffer, &frameoffsets, events);
	if (events && data && frameoffsets) {
//    std::cerr << "RemotePluginServer::sendMIDIData(" << events << ")" << std::endl;

	    sendMIDIData(data, frameoffsets, events);
	}
	break;
    }

    case RemotePluginSetBufferSize:
    {
	int newSize = readInt(&m_shmControl->ringBuffer);
	setBufferSize(newSize);
	m_bufferSize = newSize;
	break;
    }

    case RemotePluginSetSampleRate:
	setSampleRate(readInt(&m_shmControl->ringBuffer));
	break;
    
    default:
	std::cerr << "WARNING: RemotePluginServer::dispatchProcessEvents: unexpected opcode "
		  << opcode << std::endl;
    }
}