Exemple #1
0
void HelmPlugin::getStateInformation(MemoryBlock& dest_data) {
  var state = LoadSave::stateToVar(&synth_, gui_state_, getCallbackLock());
  String data_string = JSON::toString(state);
  MemoryOutputStream stream;
  stream.writeString(data_string);
  dest_data.append(stream.getData(), stream.getDataSize());
}
void AudioLassoAudioProcessor::addSelectedRegion(Path* specPath)
{
    const CriticalSection& lock = getCallbackLock();
    
    lock.enter();
    specHandler->addSelectedRegion(specPath);
    lock.exit();
}
Exemple #3
0
void HelmPlugin::setStateInformation(const void* data, int size_in_bytes) {
  set_state_time_ = Time::getMillisecondCounter();

  MemoryInputStream stream(data, size_in_bytes, false);
  String data_string = stream.readEntireStreamAsString();
  var state;
  if (JSON::parse(data_string, state).wasOk())
    LoadSave::varToState(&synth_, gui_state_, getCallbackLock(), state);
}
Exemple #4
0
void HelmPlugin::setCurrentProgram(int index) {
  // Hack for some DAWs that set program on load for VSTs.
  if (Time::getMillisecondCounter() - set_state_time_ < SET_PROGRAM_WAIT_MILLISECONDS)
    return;

  current_program_ = index;
  LoadSave::loadPatch(-1, -1, index, &synth_, gui_state_, getCallbackLock());
  AudioProcessorEditor* editor = getActiveEditor();
  if (editor) {
    HelmEditor* t_editor = dynamic_cast<HelmEditor*>(editor);
    t_editor->updateFullGui();
  }
}
//==============================================================================
bool AudioLassoAudioProcessor::setAudioFile(const String& audioFileAbsPath) {
    ScopedPointer<File> audioFile = new File(audioFileAbsPath);
    if (!audioFile->existsAsFile()) {
        std::cout << "!audioFile->existsAsFile()" << std::endl;
        return false;
    }
    ScopedPointer<AudioFormatReader> audioFormatReader = audioFormatManager->createReaderFor(*audioFile);
    int numChannels = audioFormatReader->numChannels;
    int numSamples = audioFormatReader->lengthInSamples;
    float sampleRate = audioFormatReader->sampleRate;
    AudioSampleBuffer* sourceAudio = new AudioSampleBuffer(numChannels, numSamples);
    audioFormatReader->read(sourceAudio, 0, numSamples, 0, true, true);
    
    const CriticalSection& lock = getCallbackLock();
    lock.enter();
    specHandler->setSourceAudio(sourceAudio, sampleRate);
    lock.exit();
    return true;
}
Exemple #6
0
HelmPlugin::HelmPlugin() {
  output_memory_ = new mopo::Memory(MAX_MEMORY_SAMPLES);
  keyboard_state_ = new MidiKeyboardState();
  midi_manager_ = new MidiManager(&synth_, keyboard_state_, &gui_state_, &getCallbackLock(), this);
  set_state_time_ = 0;

  current_program_ = 0;
  num_programs_ = LoadSave::getNumPatches();
  if (num_programs_ <= 0)
    num_programs_ = 1;

  Startup::doStartupChecks(midi_manager_);

  controls_ = synth_.getControls();
  for (auto control : controls_) {
    ValueBridge* bridge = new ValueBridge(control.first, control.second);
    bridge->setListener(this);
    bridge_lookup_[control.first] = bridge;
    addParameter(bridge);
  }
}