static AutomationType AutomationTypeToCpp(JNIEnv *env, jobject jType)
{
    static jmethodID ordinalMID = env->GetMethodID(
                                      gSimulatorClassRefs.automationTypeCls, "ordinal", "()I");

    int ordinal = env->CallIntMethod(jType, ordinalMID);
    return AutomationType(ordinal);
}
Example #2
0
File: strip.cpp Project: songo/muse
void Strip::setAutomationType(int t)
{
  // If going to OFF mode, need to update current 'manual' values from the automation values at this time...   
  if(t == AUTO_OFF && track->automationType() != AUTO_OFF) // && track->automationType() != AUTO_WRITE)
  {
    // May have a lot to do in updateCurValues, so try using idle.
    MusEGlobal::audio->msgIdle(true);
    track->setAutomationType(AutomationType(t));
    if(!track->isMidiTrack())
      (static_cast<MusECore::AudioTrack*>(track))->controller()->updateCurValues(MusEGlobal::audio->curFramePos());
    MusEGlobal::audio->msgIdle(false);
  }
  else
    // Try it within one message.
    MusEGlobal::audio->msgSetTrackAutomationType(track, t);   
  
  MusEGlobal::song->update(SC_AUTOMATION);
}
Example #3
0
void Strip::setAutomationType(int t, int)
{
	track->setAutomationType(AutomationType(t));
	song->update(SC_AUTOMATION);
}
Example #4
0
bool AudioTrack::readProperties(Xml& xml, const QString& tag)
{
    if (tag == "LadspaPlugin" || tag == "plugin")
    {
         BasePlugin* pi = new LadspaPlugin();
         pi->setTrack(this);
         pi->setId((int)_efxPipe->size());
         if (pi->readConfiguration(xml, false))
            delete pi;
         else
            _efxPipe->addPlugin(pi, -1);
    }
    else if (tag == "Lv2Plugin")
    {
         Lv2Plugin* pi = new Lv2Plugin();
         pi->setTrack(this);
         pi->setId((int)_efxPipe->size());
         if (pi->readConfiguration(xml, false))
            delete pi;
         else
            _efxPipe->addPlugin(pi, -1);
    }
    else if (tag == "VstPlugin")
    {
         VstPlugin* pi = new VstPlugin();
         pi->setTrack(this);
         pi->setId((int)_efxPipe->size());
         if (pi->readConfiguration(xml, false))
            delete pi;
         else
            _efxPipe->addPlugin(pi, -1);
    }
    else if (tag == "auxSend")
        readAuxSend(xml);
    else if (tag == "prefader")
        _prefader = xml.parseInt();
    else if (tag == "sendMetronome")
        _sendMetronome = xml.parseInt();
    else if (tag == "automation")
        setAutomationType(AutomationType(xml.parseInt()));
    else if (tag == "controller")
    {
        CtrlList* l = new CtrlList();
        l->read(xml);

        // Since (until now) oom wrote a 'zero' for plugin controller current value
        //  in the XML file, we can't use that value, now that plugin automation is added.
        // We must take the value from the plugin control value.
        // Otherwise we break all existing .oom files with plugins, because the gui
        //  controls would all be set to zero.
        // But we will allow for the (unintended, useless) possibility of a controller
        //  with no matching plugin control.
        BasePlugin* p = 0;
        bool ctlfound = false;
        int m = l->id() & AC_PLUGIN_CTL_ID_MASK;
        int n = (l->id() >> AC_PLUGIN_CTL_BASE_POW) - 1;
		int pdepth = _efxPipe->size();
        if (n >= 0 && n < pdepth)
        {
            p = (*_efxPipe)[n];
            if (p)
            {
                ParameterPort* cport = p->getParameterPort(m);
                if (cport && cport->type == PARAMETER_INPUT && (cport->hints & PARAMETER_IS_AUTOMABLE) > 0)
                    ctlfound = true;
            }
        }

        iCtrlList icl = _controller.find(l->id());
        if (icl == _controller.end())
            _controller.add(l);
        else
        {
            CtrlList* d = icl->second;
            for (iCtrl i = l->begin(); i != l->end(); ++i)
                d->add(i->second.getFrame(), i->second.val);

            if (!ctlfound)
                d->setCurVal(l->curVal());
            d->setColor(l->color());
            d->setVisible(l->isVisible());

            d->setDefault(l->getDefault());
            delete l;
            l = d;
        }

        if (ctlfound)
        {
            l->setCurVal(p->getParameterValue(m));
            ParameterPort* cport = p->getParameterPort(m);
            if (cport && cport->hints & PARAMETER_IS_TOGGLED)
                l->setMode(CtrlList::DISCRETE);
            else
                l->setMode(CtrlList::INTERPOLATE);
        }
    }