Tuesday, September 19, 2006

Move bug

After repeated drag moves, plugins weren't matching their titles and parameter rows. Inserting source first was a bad idea. The correct method is: copy source to a temp, delete source, insert destination, copy temp to destination. This also gets rid of the bump source/dest kludge.

Useful debug code that helped solve it:

void CFFPluginArray::Dump()
printf("Count = %d, LastLoadedIdx = %d\n", m_Count, m_LastLoadedIdx);
for (int i = 0; i < m_Count; i++) {
CString s;
if (m_Plugin[i].IsLoaded()) {
CFFPlugin *pp = &m_Plugin[i].m_Plugin;
printf("%d: '%s' %s\n", i, s, m_Plugin[i].IsBypassed() ? "[BYPASS]" : "");
for (int j = 0; j < pp->GetNumParams(); j++) {
pp->GetParamName(j, s);
if (m_Plugin[i].IsCreated()) {
printf("\t'%s' = %g\n", s, m_Plugin[i].m_Instance.GetParam(j));
} else
printf("\t'%s'\n", s);
} else
printf("%d: (empty)\n", i);

No comments: