Esempio n. 1
0
void GData::fastforward()
{
  double speed = 16;
  double diffTime = view->zoomX() * speed;
  if(getActiveChannel())
    diffTime = MAX(diffTime, getActiveChannel()->timePerChunk());
  updateActiveChunkTime(view->currentTime() + diffTime);
  view->doSlowUpdate();
}
Esempio n. 2
0
int GData::getActiveIntThreshold()
{
  Channel* active = getActiveChannel();
  if(active) return toInt(active->threshold() * 100.0f);
  //else return settings.getInt("Analysis", "thresholdValue");
  else return qsettings->value("Analysis/thresholdValue", 93).toInt();
}
Esempio n. 3
0
void GData::removeFileFromList(SoundFile *s)
{
  int j;
  int curPos;
  int prevPos;  
  //remove all the channels in s from the channels list
  for(j=0; j<s->numChannels(); j++) {
    Channel *c = s->channels(j);
    //if(c == getActiveChannel()) { setActiveChannel(NULL); }
    curPos = prevPos = 0;
    for(std::vector<Channel*>::iterator it1=channels.begin(); it1 != channels.end(); it1++, curPos++) {
      if((*it1) == c) {
        if(c == getActiveChannel()) prevPos = curPos;
        it1 = channels.erase(it1) - 1;
      }
    }
    if(channels.empty()) setActiveChannel(NULL);
    else setActiveChannel(channels.at(bound(prevPos, 0, int(channels.size()-1))));
  }
  //remove the soundFile from the soundFiles list
  for(std::vector<SoundFile*>::iterator it2=soundFiles.begin(); it2 != soundFiles.end(); it2++) {
    if((*it2) == s) {
      it2 = soundFiles.erase(it2) - 1;
    }
  }
  emit channelsChanged();
  //view->doSlowUpdate();
}
Esempio n. 4
0
eventBits_t CSong::task(int ticks)
{
    realTimeEngine(ticks);


    while (true)
    {
        if (m_reachedMidiEof == true)
            goto exitTask;

        while (true)
        {
            // Check that there is space
            if (midiEventSpace() <= 10 || chordEventSpace() <= 10)
                break;

            // and that the Score has space also
            if (m_scoreWin->midiEventSpace() <= 100)
                break;

            // Read the next events
            CMidiEvent event = m_midiFile->readMidiEvent();

            //ppLogTrace("Song event delta %d type 0x%x chan %d Note %d", event.deltaTime(), event.type(), event.channel(), event.note());

            // Find the next chord
            if (m_findChord.findChord(event, getActiveChannel(), PB_PART_both) == true)
                chordEventInsert( m_findChord.getChord() ); // give the Conductor the chord event

            // send the events to the other end
            m_scoreWin->midiEventInsert(event);

            // send the events to the other end
            midiEventInsert(event);


            if (event.type() == MIDI_PB_EOF)
            {
                m_reachedMidiEof = true;
                break;
            }
        }

        // carry on with the data until we reach the bar we want
        if (seekingBarNumber() && m_reachedMidiEof == false && playingMusic())
        {
            realTimeEngine(0);
            m_scoreWin->drawScrollingSymbols(false); // don't display any thing just  remove from the queue
        }
        else
            break;

    }

exitTask:
    eventBits_t eventBits = m_realTimeEventBits;
    m_realTimeEventBits = 0;
    return eventBits;
}
Esempio n. 5
0
void GData::updateActiveChunkTime(double t)
{
  if((running != STREAM_STOP) && (soundMode & SOUND_REC)) return;

  Channel *active = getActiveChannel();
  t = bound(t, leftTime(), rightTime());
  if(active) {
    //t = active->timeAtChunk(active->chunkAtTime(t)); //align time to an integer sample step
    active->jumpToTime(t);
    if(gdata->doingActive()) {
	    active->lock();
      active->processChunk(active->currentChunk());
	    active->unlock();
    }
  }
  view->setCurrentTime(t);
  doChunkUpdate();
}
Esempio n. 6
0
void CSong::regenerateChordQueue()
{
    int i;
    int length;
    CMidiEvent event;

    m_wantedChordQueue->clear();
    m_findChord.reset();

    length = m_songEventQueue->length();

    for (i = 0; i < length; i++)
    {
        event = m_songEventQueue->index(i);
        // Find the next chord
        if (m_findChord.findChord(event, getActiveChannel(), PB_PART_both) == true)
            chordEventInsert( m_findChord.getChord() ); // give the Conductor the chord event

    }
    resetWantedChord();
}
Esempio n. 7
0
void GData::resetActiveIntThreshold(int thresholdPercentage)
{
  Channel* active = getActiveChannel();
  if(active) active->resetIntThreshold(thresholdPercentage);
}