cwIoMidiRecordPlay.cpp : Fix bug in vel_table_disable() where velTableN was not set to 0 when the vel table was released.

This commit is contained in:
kevin 2023-12-30 12:40:33 -05:00
parent ca53e712a6
commit d45d86b8be

View File

@ -2161,23 +2161,22 @@ cw::rc_t cw::midi_record_play::vel_table_disable( handle_t h, unsigned devIdx )
{
rc_t rc = kOkRC;
midi_record_play_t* p = _handleToPtr(h);
unsigned begDevIdx = devIdx==kInvalidIdx ? 0 : devIdx;
unsigned endDevIdx = devIdx==kInvalidIdx ? p->midiDevN : begDevIdx+1;
if( devIdx != kInvalidIdx )
{
if( devIdx > p->midiDevN )
if( devIdx != kInvalidIdx && devIdx > p->midiDevN )
{
rc = cwLogError(kInvalidArgRC,"The device index '%i'is invalid.",devIdx);
goto errLabel;
}
p->midiDevA[devIdx].velTableArray = nullptr;
}
else
for(unsigned i=begDevIdx; i<endDevIdx; ++i)
{
for(unsigned i=0; i<p->midiDevN; ++i)
p->midiDevA[i].velTableArray = nullptr;
mem::release(p->midiDevA[i].velTableArray);
p->midiDevA[i].velTableN = 0;
}
errLabel:
return rc;
}