Post by Rob on Oct 4, 2015 19:50:44 GMT 1
This is a small addition to Jeff his online documentation on how to send (float) values from DSP to GUI.
In the SDK there is also an example, but I wanted to place it here for easy reference.
.xml file:
DSP .h file:
DSP .cpp file:
GUI .h file:
GUI .cpp file:
In the SDK there is also an example, but I wanted to place it here for easy reference.
.xml file:
<Parameters>
<Parameter id="0" name="" datatype="float"/>
</Parameters>
<Audio>
<Pin id="0" name="Value In" direction="in" datatype="float"/>
<Pin id="1" name="Value Out" direction="out" datatype="float" parameterId="0" private="true"/>
</Audio>
<GUI>
<Pin id="0" name="Value In" direction="in" datatype="float" parameterId="0" private="true"/>
<Pin id="1" name="Value Out" direction="out" datatype="float"/>
</GUI>
DSP .h file:
private:
FloatInPin pinValueIn;
FloatOutPin pinValueOut;
DSP .cpp file:
dsp2gui::dsp2gui( IMpUnknown* host ) : MpBase( host )
{
// Register pins.
initializePin( 0, pinValueIn );
initializePin( 1, pinValueOut );
}
void dsp2gui::subProcess( int bufferOffset, int sampleFrames )
{
// get pointers to in/output buffers.
for( int s = sampleFrames; s > 0; --s )
{
}
}
void dsp2gui::onSetPins(void)
{
// Check which pins are updated.
if( pinValueIn.isUpdated() )
{
pinValueOut = pinValueIn;
}
// Set processing method.
SET_PROCESS(&dsp2gui::subProcess);
}
GUI .h file:
private:
void onSetValueIn();
void onSetValueOut();
FloatGuiPin pinValueIn;
FloatGuiPin pinValueOut;
GUI .cpp file:
dsp2guiGui::dsp2guiGui( IMpUnknown* host ) : MpGuiBase(host)
{
// initialise pins.
pinValueIn.initialize( this, 0, static_cast<MpGuiBaseMemberPtr>(&dsp2guiGui::onSetValueIn) );
pinValueOut.initialize( this, 1, static_cast<MpGuiBaseMemberPtr>(&dsp2guiGui::onSetValueOut) );
}
// handle pin updates.
void dsp2guiGui::onSetValueIn()
{
// pinValueIn changed
pinValueOut = pinValueIn;
}
void dsp2guiGui::onSetValueOut()
{
}