void RecordNode::addInputChannel(GenericProcessor* sourceNode, int chan)
{

    if (chan != AccessClass::getProcessorGraph()->midiChannelIndex)
    {

        int channelIndex = getNextChannel(false);

        channelPointers.add(sourceNode->channels[chan]);
        setPlayConfigDetails(channelIndex+1,0,44100.0,128);

        //   std::cout << channelIndex << std::endl;

        channelPointers[channelIndex]->recordIndex = channelIndex;

        EVERY_ENGINE->addChannel(channelIndex,channelPointers[channelIndex]);

    }
    else
    {

        for (int n = 0; n < sourceNode->eventChannels.size(); n++)
        {

            eventChannelPointers.add(sourceNode->eventChannels[n]);

        }

    }

}
Esempio n. 2
0
AudioResamplingNode::AudioResamplingNode()
    : GenericProcessor("Resampling Node"),
      sourceBufferSampleRate(40000.0), destBufferSampleRate(44100.0),
      ratio(1.0), lastRatio(1.0), destBuffer(0), tempBuffer(0),
      destBufferIsTempBuffer(true), isTransmitting(false), destBufferPos(0)
{

    settings.numInputs = 2;
    settings.numOutputs = 2;

    setPlayConfigDetails(getNumInputs(), // number of inputs
                         getNumOutputs(), // number of outputs
                         44100.0, // sampleRate
                         128);    // blockSize

    filter = new Dsp::SmoothedFilterDesign
    <Dsp::RBJ::Design::LowPass, 1> (1024);

    if (destBufferIsTempBuffer)
        destBufferWidth = 1024;
    else
        destBufferWidth = 1000;

    destBufferTimebaseSecs = 1.0;

    destBuffer = new AudioSampleBuffer(16, destBufferWidth);
    tempBuffer = new AudioSampleBuffer(16, destBufferWidth);

    continuousDataBuffer = new int16[10000];

}
RecordNode::RecordNode()
    : GenericProcessor("Record Node"),
      newDirectoryNeeded(true),  timestamp(0)
{

    isProcessing = false;
    isRecording = false;
	setFirstBlock = false;

    settings.numInputs = 2048;
    settings.numOutputs = 0;

    recordingNumber = -1;

    spikeElectrodeIndex = 0;

    experimentNumber = 0;
    hasRecorded = false;
    settingsNeeded = false;

    // 128 inputs, 0 outputs
    setPlayConfigDetails(getNumInputs(),getNumOutputs(),44100.0,128);
	m_recordThread = new RecordThread(engineArray);
	m_dataQueue = new DataQueue(WRITE_BLOCK_LENGTH, DATA_BUFFER_NBLOCKS);
	m_eventQueue = new EventMsgQueue(EVENT_BUFFER_NEVENTS);
	m_spikeQueue = new SpikeMsgQueue(SPIKE_BUFFER_NSPIKES);
	m_recordThread->setQueuePointers(m_dataQueue, m_eventQueue, m_spikeQueue);
}
    //==============================================================================
    void prepareToPlay (double newSampleRate, int samplesPerBlockExpected)
    {
        setPlayConfigDetails (inputs.size(), outputs.size(),
                              newSampleRate, samplesPerBlockExpected);

        setLatencySamples (0);

        initialise();

        if (initialised)
        {
            tempBuffer.setSize (jmax (1, outputs.size()), samplesPerBlockExpected);

            // dodgy hack to force some plugins to initialise the sample rate..
            if (getNumParameters() > 0)
            {
                const float old = getParameter (0);
                setParameter (0, (old < 0.5f) ? 1.0f : 0.0f);
                setParameter (0, old);
            }

            if (plugin->activate != nullptr)
                plugin->activate (handle);
        }
    }
Esempio n. 5
0
RecordNode::RecordNode()
    : GenericProcessor("Record Node"),
      isRecording(false), isProcessing(false), signalFilesShouldClose(false),
      timestamp(0)
{


    continuousDataIntegerBuffer = new int16[10000];
    continuousDataFloatBuffer = new float[10000];
    signalFilesShouldClose = false;

    settings.numInputs = 2048;
    settings.numOutputs = 0;

    eventChannel = new Channel(this, 0);
    eventChannel->isEventChannel = true;

    recordMarker = new char[10];
    for (int i = 0; i < 9; i++)
    {
        recordMarker[i] = 0;
    }
    recordMarker[9] = 255;

    // 128 inputs, 0 outputs
    setPlayConfigDetails(getNumInputs(),getNumOutputs(),44100.0,128);

}
Esempio n. 6
0
RecordNode::RecordNode()
    : GenericProcessor("Record Node"),
      newDirectoryNeeded(true),  timestamp(0)
{

    isProcessing = false;
    isRecording = false;
    allFilesOpened = false;
    signalFilesShouldClose = false;

    signalFilesShouldClose = false;

    settings.numInputs = 2048;
    settings.numOutputs = 0;

    eventChannel = new Channel(this, 0, EVENT_CHANNEL);
    recordingNumber = 0;

    spikeElectrodeIndex = 0;

    experimentNumber = 0;
    hasRecorded = false;
    settingsNeeded = false;

    // 128 inputs, 0 outputs
    setPlayConfigDetails(getNumInputs(),getNumOutputs(),44100.0,128);

}
Esempio n. 7
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);
    }
Esempio n. 8
0
AudioNode::AudioNode()
	: GenericProcessor("Audio Node")
{

	// 64 inputs, 2 outputs (left and right channel)
	setPlayConfigDetails(64,2,44100.0,128);

	leftChan.add(0);
	rightChan.add(1);
}
Esempio n. 9
0
RecordNode::RecordNode()
	: GenericProcessor("Record Node"), isRecording(false)
{

	// need to update this:
	setPlayConfigDetails(64,0,44100.0,128);

	outputFile = File("./data"); // create output file
	outputStream = 0;
	
}
Esempio n. 10
0
ProcessorGraph::ProcessorGraph() : currentNodeId(100)
{

    // The ProcessorGraph will always have 0 inputs (all content is generated within graph)
    // but it will have N outputs, where N is the number of channels for the audio monitor
    setPlayConfigDetails(0, // number of inputs
                         2, // number of outputs
                         44100.0, // sampleRate
                         1024);    // blockSize

}
Esempio n. 11
0
void AudioNode::addInputChannel(GenericProcessor* sourceNode, int chan)
{


    int channelIndex = getNextChannel(false);

    setPlayConfigDetails(channelIndex+1,0,44100.0,128);

    channelPointers.add(sourceNode->channels[chan]);

}
Esempio n. 12
0
void LfpDisplayNode::setNumInputs(int inputs)
{
	std::cout << "Setting num inputs on LfpDisplayNode to " << inputs << std::endl;
	numInputs = inputs;	
	setNumOutputs(0);

	setPlayConfigDetails(getNumInputs(),0,44100.0,128);

	LfpDisplayEditor* editor = (LfpDisplayEditor*) getEditor();
	editor->updateNumInputs(inputs);
}
Esempio n. 13
0
MessageCenter::MessageCenter() :
    GenericProcessor("Message Center"), newEventAvailable(false), isRecording(false), sourceNodeId(0), 
	timestampSource(nullptr), lastTime(0), softTimestamp(0)
{

    setPlayConfigDetails(0, // number of inputs
                         0, // number of outputs
                         44100.0, // sampleRate
                         128);    // blockSize

    Channel* ch = new Channel(this, 0, EVENT_CHANNEL);
    eventChannels.add(ch);

}
Esempio n. 14
0
LfpDisplayNode::LfpDisplayNode()
	: GenericProcessor("LFP Viewer"),
	  bufferLength(5.0f), displayGain(1),
	  displayBufferIndex(0), abstractFifo(100)

{

	numInputs = 2;
	numOutputs = 0;
	sampleRate = 44100.0;

	setPlayConfigDetails(2,0,44100.0,128);

	displayBuffer = new AudioSampleBuffer (8, 100);
	eventBuffer = new MidiBuffer();
}
Esempio n. 15
0
void RecordNode::addInputChannel(GenericProcessor* sourceNode, int chan)
{

    if (chan != getProcessorGraph()->midiChannelIndex)
    {

        int channelIndex = getNextChannel(false);

        setPlayConfigDetails(channelIndex+1,0,44100.0,128);

        channelPointers.add(sourceNode->channels[chan]);

        //   std::cout << channelIndex << std::endl;

        updateFileName(channelPointers[channelIndex]);



        //if (channelPointers[channelIndex]->isRecording)
        //	std::cout << "  This channel will be recorded." << std::endl;
        //else
        //	std::cout << "  This channel will NOT be recorded." << std::endl;

        //std::cout << "adding channel " << getNextChannel(false) << std::endl;

        //std::pair<int, Channel> newPair (getNextChannel(false), newChannel);

        //std::cout << "adding channel " << getNextChannel(false) << std::endl;

        //continuouschannelPointers.insert(newPair);


    }
    else
    {

        for (int n = 0; n < sourceNode->eventChannels.size(); n++)
        {

            eventChannelPointers.add(sourceNode->eventChannels[n]);

        }

    }

}
Esempio n. 16
0
AudioNode::AudioNode()
	: GenericProcessor("Audio Node"), volume(0.00001f), audioEditor(0)
{

	settings.numInputs = 128;
	settings.numOutputs = 2;

	// 64 inputs, 2 outputs (left and right channel)
	setPlayConfigDetails(getNumInputs(),getNumOutputs(),44100.0,128);

	leftChan.clear();
	rightChan.clear();

	nextAvailableChannel = 2; // keep first two channels empty


}
Esempio n. 17
0
AudioNode::AudioNode()
    : GenericProcessor("Audio Node"), audioEditor(0), volume(0.00001f), noiseGateLevel(0.0f),
      bufferA(2,10000),
      bufferB(2,10000)
{

    settings.numInputs = 2048;
    settings.numOutputs = 2;

    // 128 inputs, 2 outputs (left and right channel)
    setPlayConfigDetails(getNumInputs(), getNumOutputs(), 44100.0, 128);

    nextAvailableChannel = 2; // keep first two channels empty

    numSamplesExpected = 1024;

    samplesInOverflowBuffer = 0;
    samplesInBackupBuffer = 0;

}
Esempio n. 18
0
SourceNode::SourceNode(const String& name_)
	: GenericProcessor(name_),
	  dataThread(0)
{
	if (getName().equalsIgnoreCase("Intan Demo Board")) {
		setNumOutputs(16);
		setNumInputs(0);
	} else if (getName().equalsIgnoreCase("Custom FPGA")) {
		setNumOutputs(32);
		setNumInputs(0);
	} else if (getName().equalsIgnoreCase("File Reader")) {
		setNumOutputs(16);
		setNumInputs(0);
	}

	setPlayConfigDetails(getNumInputs(), getNumOutputs(), 44100.0, 128);

	//sendActionMessage("Intan Demo Board source created.");
	//sendMessage("Intan Demo Board source created.");

}
Esempio n. 19
0
RecordNode::RecordNode()
    : GenericProcessor("Record Node"),
      newDirectoryNeeded(true),  zeroBuffer(1, 50000),  timestamp(0),
      appendTrialNum(false), trialNum(0)
{

    isProcessing = false;
    isRecording = false;
    allFilesOpened = false;
    blockIndex = 0;
    signalFilesShouldClose = false;

    continuousDataIntegerBuffer = new int16[10000];
    continuousDataFloatBuffer = new float[10000];
    signalFilesShouldClose = false;

    settings.numInputs = 2048;
    settings.numOutputs = 0;

    eventChannel = new Channel(this, 0);
    eventChannel->isEventChannel = true;

    recordMarker = new char[10];
    for (int i = 0; i < 9; i++)
    {
        recordMarker[i] = i;
    }
    recordMarker[9] = 255;

    recordingNumber = 0;

    // 128 inputs, 0 outputs
    setPlayConfigDetails(getNumInputs(),getNumOutputs(),44100.0,128);

    zeroBuffer.clear();

}
Esempio n. 20
0
/*
Congigures the channelStripProcess and preares it to play
*/
void ChannelStripProcessor::prepareToPlay(double, int)
{
    setPlayConfigDetails(2, 2, getSampleRate(), getBlockSize());
}
Esempio n. 21
0
void GenericProcessor::update()
{

	std::cout << getName() << " updating settings." << std::endl;

	clearSettings();
	
	if (sourceNode != 0)
	{
		// everything is inherited except numOutputs
		settings = sourceNode->settings;
		settings.numInputs = settings.numOutputs;
		settings.numOutputs = settings.numInputs;

		for (int i = 0; i < sourceNode->channels.size(); i++)
		{
			Channel* sourceChan = sourceNode->channels[i];
			Channel* ch = new Channel(*sourceChan);
			ch->setProcessor(this);
			channels.add(ch);
		}

		for (int i = 0; i < sourceNode->eventChannels.size(); i++)
		{
			Channel* sourceChan = sourceNode->eventChannels[i];
			Channel* ch = new Channel(*sourceChan);
			eventChannels.add(ch);
		}

	} else {

		settings.numOutputs = getDefaultNumOutputs();
		settings.sampleRate = getDefaultSampleRate();

		for (int i = 0; i < getNumOutputs(); i++)
		{
			Channel* ch = new Channel(this, i);
			ch->sampleRate = getDefaultSampleRate();
			ch->bitVolts = getDefaultBitVolts();

			channels.add(ch);
		}

	}

	if (this->isSink())
	{
		settings.numOutputs = 0;
	}

	updateSettings(); // custom settings code

	// required for the ProcessorGraph to know the
	// details of this processor:
	setPlayConfigDetails(getNumInputs(),  // numIns
		                 getNumOutputs(), // numOuts
		                 44100.0,         // sampleRate
		                 128);            // blockSize

	editor->update(); // update editor settings

}