Exemple #1
0
void DspComponent::_ThreadTick(int threadNo)
{
    // continue only if this component has not already been ticked
    if (*_hasTickeds[threadNo] == false)
    {
        // 1. set _hasTicked flag
        *_hasTickeds[threadNo] = true;

        // 2. get outputs required from input components
        for (int i = 0; i < _inputWires.GetWireCount(); i++)
        {
            DspWire* wire = _inputWires.GetWire(i);
            wire->linkedComponent->_ThreadTick(threadNo);

            DspSignal* signal = wire->linkedComponent->_outputBuses[threadNo].GetSignal(wire->fromSignalIndex);
            _inputBuses[threadNo].SetSignal(wire->toSignalIndex, signal);
        }

        // 3. clear all outputs
        _outputBuses[threadNo].ClearAllValues();

        // 4. wait for your turn to process.
        _WaitForRelease(threadNo);

        // 5. call Process_() with newly aquired inputs
        Process_(_inputBuses[threadNo], _outputBuses[threadNo]);

        // 6. signal that you're done processing.
        _ReleaseThread(threadNo);
    }
}
Exemple #2
0
void DspComponent::Tick()
{
    // continue only if this component has not already been ticked
    if (!_hasTicked)
    {
        // 1. set _hasTicked flag
        _hasTicked = true;

        // 2. get outputs required from input components
        for (int i = 0; i < _inputWires.GetWireCount(); i++)
        {
            DspWire* wire = _inputWires.GetWire(i);
            wire->linkedComponent->Tick();

            DspSignal* signal = wire->linkedComponent->_outputBus.GetSignal(wire->fromSignalIndex);
            _inputBus.SetSignal(wire->toSignalIndex, signal);
        }

        // 3. clear all outputs
        _outputBus.ClearAllValues();

        // 4. call Process_() with newly aquired inputs
        Process_(_inputBus, _outputBus);
    }
}
Exemple #3
0
  void BaseWorker::Run() {
#ifdef ENABLE_PROFILING
    ::startSaturn();
#endif

    while (!ShouldStop()) {
      Process_();
    }

#ifdef ENABLE_PROFILING
    ::stopSaturn();
#endif
  }