bool alsLinkEventHandler::parseNoteEvents( LiveSet& LS ){ // ALS loaded ? if( !LS.isLoaded() ){ ofLogNotice("OfxAbletonLiveSet::alsLinkEventHandler::parseNoteEvents()", "before parsing events, make sure to parse() a live set."); return false; } // clean up LSNoteEvents.clear(); // loop trough LS data for (int trackNb = 0; trackNb < LS.miditracks.size(); trackNb++){ int nthNote=0; for(int clipNb=0; clipNb < LS.miditracks[trackNb].clips.size(); clipNb++){ string clipName = LS.miditracks[trackNb].clips[clipNb].name; int clipColor = LS.miditracks[trackNb].clips[clipNb].color; int nthInClip = 0; for( vector<Note>::iterator it=LS.miditracks[trackNb].clips[clipNb].notes.begin(); it != LS.miditracks[trackNb].clips[clipNb].notes.end(); it++ ){ LSNoteEvent noteEvent( clipName, clipColor, nthNote, nthInClip, trackNb, *it ); LSNoteEvents.push_back(noteEvent); nthInClip ++; } } } std:sort(LSNoteEvents.begin(), LSNoteEvents.end(), sort_by_time<LSNoteEvent>); return true; }
//----------- void AudioUnitMantaController::mantaPadVelocityEvent(ofxMantaEvent &e) { if (e.value > 0) { MantaElement m(PAD, e.col + 8 * e.row, 0); if (mantaNoteMap.count(m) > 0) { int note = mantaNoteMap[m]; int velocity = e.value; noteEvent(noteAuto ? NOTE_AUTO : NOTE_ON, note, velocity); } } else if (!noteAuto) { MantaElement m(PAD, e.col + 8 * e.row, 0); if (mantaNoteMap.count(m) > 0) { int note = mantaNoteMap[m]; noteEvent(NOTE_OFF, note, noteAutoOffVelocity); } } }
void wxSTEditorNotebook::SortTabs(int style) { if ((int)GetPageCount() < 2) return; if (STE_HASBIT(style, STN_ALPHABETICAL_TABS)) { int sel = GetSelection(); int new_sel = sel; size_t page_count = GetPageCount(); size_t n; if (page_count < 2) return; wxString curPageName; wxArrayString names; for (n = 0; n < page_count; n++) { wxString name(GetPageText(n)); if ((name.Length() > 0) && (name[0u] == wxT('*'))) name = name.Mid(1); names.Add(name + wxString::Format(wxT("=%d"), (int)n)); } names.Sort(STN_SortNameCompareFunction); bool sel_changed = false; for (n = 0; n < page_count; n++) { long old_page = 0; names[n].AfterLast(wxT('=')).ToLong(&old_page); if (old_page != long(n)) { wxWindow *oldWin = GetPage(old_page); wxString oldName(GetPageText(old_page)); if (oldWin && RemovePage(old_page)) { sel_changed = true; if (old_page == sel) new_sel = (int)n; if (n < page_count - 1) InsertPage((int)(n+1), oldWin, oldName, old_page == sel); else AddPage(oldWin, oldName, old_page == sel); } } } if (sel_changed) { wxNotebookEvent noteEvent(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, GetId(), new_sel, new_sel); noteEvent.SetString(wxT("wxSTEditorNotebook Page Change")); noteEvent.SetExtraLong(new_sel); // FIXME no Clone in wxNotebookEvent // NOTE: this may have to be AddPendingEvent for wx < 2.7 since gtk // can become reentrant GetEventHandler()->AddPendingEvent(noteEvent); } // causes reentrant assert in gtk, even though it's necessary sometimes //SetSelection(new_sel); // force selection for GTK } }