void MusicBar::updateTimeSig(QAction *action) { QRegExp regex("[123469]{1,2}/[248]"); // TimeSignature Action if(regex.indexIn(action->text()) != -1 ){ setTimeSig(action->data().toInt()); } }
// read the file ahead to collect info about the song first void CSong::midiFileInfo() { m_trackList->clear(); setTimeSig(0,0); CStavePos::setKeySignature( NOT_USED, 0 ); // Read the next events to find the active channels CMidiEvent event; while ( true ) { event = m_midiFile->readMidiEvent(); m_trackList->examineMidiEvent(event); if (event.type() == MIDI_PB_timeSignature) { setTimeSig(event.data1(),event.data2()); } if (event.type() == MIDI_PB_EOF) break; } }
PianoRoll::PianoRoll(AudioProcessor* _plugin, AudioProcessorEditor* _owner, Timeline* _timeline) : sequence(0), hoveringNoteIndex(-1), hoveringNote(0), timebase(960.0), numEvents(0), snapToGrid(true), defaultChannel(0), playTime(0.0), timeSigN(0), timeSigD(0), beatSize(0), barSize(0), gridSize(0), timeline(0), draggingNoteTransposition(0), draggingNoteTimeDelta(0) { plugin = _plugin; owner = _owner; timeline = _timeline; blankLength=timebase*16.0; pixelsPerPpq = (float)(800.0/blankLength); setNoteLength(4.f); setTimeSig(4,4); addAndMakeVisible(bg = new PianoRollBackground()); bg->setInterceptsMouseClicks(false,false); addAndMakeVisible(noteLayer = new PianoRollNotes()); noteLayer->setInterceptsMouseClicks(false,false); addAndMakeVisible(playline = new Playbar(this)); playline->setInterceptsMouseClicks(false,false); setSize(800,800); lasso.setBounds(0,0,0,0); wasResizing = false; }