Esempio n. 1
0
    void SelectionController::
            receiveCropSelection()
    {
        if (!_model->current_selection())
            return;

        Signal::OperationDesc::ptr o = _model->current_selection_copy( SelectionModel::SaveInside_TRUE );

        _model->set_current_selection( Signal::OperationDesc::ptr() );
        _model->project()->appendOperation( o );

        Signal::OperationDesc::Extent x = o.read ()->extent();
        if (x.interval.is_initialized ())
          {
            Signal::Interval xi = x.interval.get ();
            if (xi.first != 0)
              {
                Signal::OperationDesc::ptr shift(
                            new Support::OperationShift(-xi.first, Signal::Interval(0, xi.count ())));
                _model->project()->appendOperation( shift );
              }
          }

        Log("Crop selection\n%s") % o.read ()->toString().toStdString();
    }
Esempio n. 2
0
void WorkerCrashLogger::
        log(const boost::exception& x)
{
    // Fetch various info from the exception to make a prettier log
    std::string crashed_engine_typename = "<no info>";
    std::string operation_desc_text;

    if( std::string const * mi = boost::get_error_info<Workers::crashed_engine_typename>(x) )
      {
        crashed_engine_typename = *mi;
      }

    if( Step::ptr const * mi = boost::get_error_info<Step::crashed_step>(x) )
      {
        Signal::OperationDesc::ptr od;
        {
            auto s = mi->write ();
            s->mark_as_crashed_and_get_invalidator ();
            od = Step::get_crashed (*mi);
        }

        if (od)
        {
            auto o = od.read ();
            o->getInvalidator()->deprecateCache (Signal::Intervals::Intervals_ALL);
            operation_desc_text = " in " + o->toString().toStdString();
        }
      }

    if( Signal::Interval const * mi = boost::get_error_info<Task::crashed_expected_output>(x) )
      {
        operation_desc_text += " " + mi->toString ();
      }


    // Ignore logging in UnitTest
    if (dynamic_cast<const DummyException*>(&x))
      {
        // Execute to_string for all tagged info (i.e force the slow backtrace beautifier if it's included)
        boost::diagnostic_information(x);
        return;
      }

    TaskInfo(boost::format("1 of %d workers crashed: '%s'%s")
             % workers_.read ()->n_workers()
             % crashed_engine_typename
             % operation_desc_text);

    bool send_feedback = true;
    if (send_feedback)
        ApplicationErrorLogController::registerException (boost::current_exception ());
    else
        TaskInfo(boost::format("%s") % boost::diagnostic_information(x));
}
Esempio n. 3
0
void RenderOperationDesc::
        transform_desc(Tfr::TransformDesc::ptr t)
{
    Signal::OperationDesc::ptr wo = getWrappedOperationDesc();
    if (!wo)
        return;

    auto o = wo.write ();
    Tfr::TransformOperationDesc* f = dynamic_cast<Tfr::TransformOperationDesc*>(&*o);
    if (f)
        f->transformDesc (t);
}
Esempio n. 4
0
Tfr::TransformDesc::ptr RenderOperationDesc::
        transform_desc() const
{
    Signal::OperationDesc::ptr wo = getWrappedOperationDesc();
    if (!wo)
        return Tfr::TransformDesc::ptr();

    auto o = wo.read ();
    const Tfr::TransformOperationDesc* f = dynamic_cast<const Tfr::TransformOperationDesc*>(&*o);
    if (f)
        return f->transformDesc ();

    return Tfr::TransformDesc::ptr();
}
Esempio n. 5
0
    void SelectionController::
            receiveAddClearSelection()
    {
        if (!_model->current_selection())
            return;

        Signal::OperationDesc::ptr o = _model->current_selection_copy( SelectionModel::SaveInside_FALSE );

        _model->set_current_selection( Signal::OperationDesc::ptr() );
        _model->project()->appendOperation( o );
        _model->set_current_selection( o );
        _model->all_selections.push_back( o );

        Log("Clear selection\n%s") % o.read ()->toString().toStdString();
    }
Esempio n. 6
0
Signal::OperationDesc::ptr parseFile(QUrl url)
{
    Signal::OperationDesc::ptr d;
    try {
#if !defined(TARGET_IPHONE_SIMULATOR) || !TARGET_IPHONE_SIMULATOR
        d.reset(new FlacFile(url));
        if (d->extent().sample_rate.is_initialized ())
            return d;
#endif
    } catch(...) {}

    try {
        d.reset(new QtAudiofile(url));
        if (d->extent().sample_rate.is_initialized ())
            return d;
    } catch(...) {}

    return Signal::OperationDesc::ptr();
}
Esempio n. 7
0
void EllipseModel::
        tryFilter(Signal::OperationDesc::ptr filterp)
{
    auto filter = filterp.read ();
    const Filters::Ellipse* e = dynamic_cast<const Filters::Ellipse*>(filter.get());
    if (!e)
    {
        centrePlusRadius.time = centre.time;
        centrePlusRadius.scale = centre.scale;
        return;
    }

    centre.time = e->_centre_t;
    centrePlusRadius.time = e->_centre_plus_radius_t;
    centre.scale = freqAxis().getFrequencyScalar( e->_centre_f );
    centrePlusRadius.scale = freqAxis().getFrequencyScalar( e->_centre_plus_radius_f );
}