MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / Poll

Method Poll

Source/MidiController.cpp:782–975  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

780}
781
782void MidiController::Poll()
783{
784 bool lastBlink = mBlink;
785 mBlink = int(TheTransport->GetMeasurePos(gTime) * TheTransport->GetTimeSigTop() * 2) % 2 == 0;
786
787 if (IsInputConnected(!K(immediate)) || mReconnectWaitTimer > 0)
788 {
789 if (!mIsConnected && gTime - mInitialConnectionTime > 1000)
790 {
791 if (mNonstandardController)
792 {
793 if (mNonstandardController->Reconnect())
794 {
795 ResyncControllerState();
796 mIsConnected = true;
797
798 for (auto* grid : mGrids)
799 {
800 if (grid->mGridControlTarget[mControllerPage] != nullptr && grid->mGridControlTarget[mControllerPage]->GetGridController() != nullptr)
801 dynamic_cast<GridControllerMidi*>(grid->mGridControlTarget[mControllerPage]->GetGridController())->OnControllerPageSelected();
802 }
803 }
804 }
805 else
806 {
807 if (mReconnectWaitTimer <= 0)
808 {
809 mReconnectWaitTimer = 1000;
810 mDevice.DisconnectInput();
811 mDevice.DisconnectOutput();
812 }
813 else
814 {
815 mReconnectWaitTimer -= 1 / (ofGetFrameRate()) * 1000;
816 if (mReconnectWaitTimer <= 0)
817 ConnectDevice();
818 }
819 }
820
821 if (mIsConnected)
822 {
823 for (auto i = mListeners[mControllerPage].begin(); i != mListeners[mControllerPage].end(); ++i)
824 (*i)->ControllerPageSelected();
825 }
826 }
827 }
828 else
829 {
830 if (mIsConnected)
831 {
832 mDevice.DisconnectInput();
833 mDevice.DisconnectOutput();
834 mIsConnected = false;
835 }
836 }
837
838 if (mTwoWay)
839 {

Callers

nothing calls this directly

Calls 15

ofGetFrameRateFunction · 0.85
StringCopyFunction · 0.85
ofToStringFunction · 0.85
GetTimeSigTopMethod · 0.80
GetGridControllerMethod · 0.80
DisconnectInputMethod · 0.80
DisconnectOutputMethod · 0.80
emptyMethod · 0.80
PathMethod · 0.80
SetInErrorModeMethod · 0.80
ClearPatchCablesMethod · 0.80

Tested by

no test coverage detected