Skip to content

Commit

Permalink
fix notes not getting popped off sometimes...again
Browse files Browse the repository at this point in the history
  • Loading branch information
khang06 committed Mar 19, 2020
1 parent 6019f87 commit aa3df6f
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions PianoFromAbove/GameState.cpp
Expand Up @@ -1103,10 +1103,25 @@ void MainScreen::UpdateState( int iPos )
m_pNoteState[iNote] = -1;

{
// binary search
auto pos = sse_bin_search(m_vState, iSisterIdx);
if (pos != -1)
m_vState.erase(m_vState.begin() + pos);
if (iSisterIdx != -1) {
// binary search
auto pos = sse_bin_search(m_vState, iSisterIdx);
if (pos != -1)
m_vState.erase(m_vState.begin() + pos);
} else {
// slow path, should rarely happen
vector< int >::iterator it = m_vState.begin();
MIDIChannelEvent* pSearch = pEvent->GetSister();
while (it != m_vState.end())
{
if (m_vEvents[*it] == pSearch) {
it = m_vState.erase(it);
break;
} else {
++it;
}
}
}
}

{
Expand Down

0 comments on commit aa3df6f

Please sign in to comment.