void HoaToolsAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
    char name[256];
    ScopedPointer<XmlElement> xmlState (getXmlFromBinary (data, sizeInBytes));

    if (xmlState != nullptr)
    {
        if (xmlState->hasTagName("HoaToolsSettings"))
        {
            setNumberOfSources(xmlState->getIntAttribute("NumberOfSources"));

            for (int i = 0; i < getNumberOfSources(); i++)
            {
                sprintf(name, "Abscissa%i", i);
                m_sources->sourceSetAbscissa(i, xmlState->getDoubleAttribute(name));
                sprintf(name, "Ordinate%i", i);
                m_sources->sourceSetOrdinate(i, xmlState->getDoubleAttribute(name));
            }
        }
    }

    AudioProcessorEditor* Editor = NULL;
    Editor = getActiveEditor();
    if(Editor)
    {
        Editor->repaint();
    }
}
void HoaToolsAudioProcessor::setParameter(int index, float newValue)
{
    int param_index = index % 2;
    int source_index = index / 2;

    if(source_index >= getNumberOfSources())
        return;

    switch (param_index)
    {
    case 0:
        m_sources->sourceSetAbscissa(source_index, Hoa::scale(newValue, 0, 1, -DISTANCE_MAX, DISTANCE_MAX) );
        break;
    case 1:
        m_sources->sourceSetOrdinate(source_index, Hoa::scale(newValue, 0, 1, -DISTANCE_MAX, DISTANCE_MAX) );
        break;
    default:
        break;
    }

    AudioProcessorEditor* Editor = NULL;
    Editor = getActiveEditor();
    if(Editor)
        Editor->repaint();
}
void HoaToolsAudioProcessor::prepareToPlay(double sampleRate, int samplesPerBlock)
{
    m_vector_size = samplesPerBlock;

    AudioProcessorEditor* Editor = NULL;
    Editor = getActiveEditor();
    if(Editor)
        Editor->repaint();
}
void HoaToolsAudioProcessor::numChannelsChanged()
{
    AudioProcessorEditor* Editor = NULL;
    Editor = getActiveEditor();
    if(Editor)
        Editor->repaint();

    updateHostDisplay();
}