| 780 | } |
| 781 | |
| 782 | void 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 | { |
nothing calls this directly
no test coverage detected