void WaveTrack::read(Xml& xml) { for (;;) { Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { case Xml::Error: case Xml::End: goto out_of_WaveTrackRead_forloop; case Xml::TagStart: if (tag == "part") { Part* p = 0; p = Part::readFromXml(xml, this); if(p) parts()->add(p); } else if (AudioTrack::readProperties(xml, tag)) xml.unknown("WaveTrack"); break; case Xml::Attribut: break; case Xml::TagEnd: if (tag == "wavetrack") { mapRackPluginsToControllers(); goto out_of_WaveTrackRead_forloop; } default: break; } } out_of_WaveTrackRead_forloop: chainTrackParts(this); }
void Song::doRedo2() { Undo& u = redoList->back(); for (iUndoOp i = u.begin(); i != u.end(); ++i) { switch (i->type) { case UndoOp::AddTrack: insertTrack2(i->oTrack, i->trackno); // Added by T356. chainTrackParts(i->oTrack, true); updateFlags |= SC_TRACK_INSERTED; break; case UndoOp::DeleteTrack: removeTrack2(i->oTrack); updateFlags |= SC_TRACK_REMOVED; break; case UndoOp::ModifyTrack: { // Unchain the track parts, but don't touch the ref counts. unchainTrackParts(i->nTrack, false); //Track* track = i->nTrack->clone(); Track* track = i->nTrack->clone(false); *(i->nTrack) = *(i->oTrack); // Prevent delete i->oTrack from crashing. switch (i->oTrack->type()) { case Track::AUDIO_OUTPUT: { AudioOutput* ao = (AudioOutput*) i->oTrack; for (int ch = 0; ch < ao->channels(); ++ch) ao->setJackPort(ch, 0); } break; case Track::AUDIO_INPUT: { AudioInput* ai = (AudioInput*) i->oTrack; for (int ch = 0; ch < ai->channels(); ++ch) ai->setJackPort(ch, 0); } break; default: break; } if (!i->oTrack->isMidiTrack()) ((AudioTrack*) i->oTrack)->clearEfxList(); delete i->oTrack; i->oTrack = track; // Chain the track parts, but don't touch the ref counts. chainTrackParts(i->nTrack, false); // Connect and register ports. switch (i->nTrack->type()) { case Track::AUDIO_OUTPUT: { AudioOutput* ao = (AudioOutput*) i->nTrack; ao->setName(ao->name()); } break; case Track::AUDIO_INPUT: { AudioInput* ai = (AudioInput*) i->nTrack; ai->setName(ai->name()); } break; default: break; } // Update solo states, since the user may have changed soloing on other tracks. updateSoloStates(); updateFlags |= SC_TRACK_MODIFIED; } break; /* // Prevent delete i->oTrack from crashing. switch(i->oTrack->type()) { case Track::AUDIO_OUTPUT: { AudioOutput* ao = (AudioOutput*)i->oTrack; for(int ch = 0; ch < ao->channels(); ++ch) ao->setJackPort(ch, 0); } break; case Track::AUDIO_INPUT: { AudioInput* ai = (AudioInput*)i->oTrack; for(int ch = 0; ch < ai->channels(); ++ch) ai->setJackPort(ch, 0); } break; default: break; } if(!i->oTrack->isMidiTrack()) ((AudioTrack*)i->oTrack)->clearEfxList(); //delete i->oTrack; //i->oTrack = track; // Remove the track. removeTrack2 takes care of unchaining the old track. removeTrack2(i->oTrack); // Connect and register ports. switch(i->nTrack->type()) { case Track::AUDIO_OUTPUT: { AudioOutput* ao = (AudioOutput*)i->nTrack; ao->setName(ao->name()); } break; case Track::AUDIO_INPUT: { AudioInput* ai = (AudioInput*)i->nTrack; ai->setName(ai->name()); } break; default: break; } // Insert the new track. insertTrack2(i->nTrack, i->trackno); // Chain the new track parts. (removeTrack2, above, takes care of unchaining the old track). chainTrackParts(i->nTrack, true); // Update solo states, since the user may have changed soloing on other tracks. updateSoloStates(); updateFlags |= SC_TRACK_MODIFIED; } break; */ case UndoOp::SwapTrack: { Track* track = _tracks[i->a]; _tracks[i->a] = _tracks[i->b]; _tracks[i->b] = track; updateFlags |= SC_TRACK_MODIFIED; } break; case UndoOp::AddPart: addPart(i->oPart); updateFlags |= SC_PART_INSERTED; i->oPart->events()->incARef(1); //i->oPart->chainClone(); chainClone(i->oPart); break; case UndoOp::DeletePart: removePart(i->oPart); updateFlags |= SC_PART_REMOVED; i->oPart->events()->incARef(-1); //i->oPart->unchainClone(); unchainClone(i->oPart); break; case UndoOp::ModifyPart: if (i->doCtrls) removePortCtrlEvents(i->nPart, i->doClones); changePart(i->nPart, i->oPart); i->oPart->events()->incARef(1); i->nPart->events()->incARef(-1); //i->nPart->replaceClone(i->oPart); replaceClone(i->nPart, i->oPart); if (i->doCtrls) addPortCtrlEvents(i->oPart, i->doClones); updateFlags |= SC_PART_MODIFIED; break; case UndoOp::AddEvent: addEvent(i->nEvent, i->part); if (i->doCtrls) addPortCtrlEvents(i->nEvent, i->part, i->doClones); updateFlags |= SC_EVENT_INSERTED; break; case UndoOp::DeleteEvent: if (i->doCtrls) removePortCtrlEvents(i->nEvent, i->part, i->doClones); deleteEvent(i->nEvent, i->part); updateFlags |= SC_EVENT_REMOVED; break; case UndoOp::ModifyEvent: if (i->doCtrls) removePortCtrlEvents(i->nEvent, i->part, i->doClones); changeEvent(i->nEvent, i->oEvent, i->part); if (i->doCtrls) addPortCtrlEvents(i->oEvent, i->part, i->doClones); updateFlags |= SC_EVENT_MODIFIED; break; case UndoOp::AddTempo: //printf("doRedo2: UndoOp::AddTempo. adding tempo at: %d with tempo=%d\n", i->a, i->b); tempomap.addTempo(i->a, i->b); updateFlags |= SC_TEMPO; break; case UndoOp::DeleteTempo: //printf("doRedo2: UndoOp::DeleteTempo. deleting tempo at: %d with tempo=%d\n", i->a, i->b); tempomap.delTempo(i->a); updateFlags |= SC_TEMPO; break; case UndoOp::AddSig: ///sigmap.add(i->a, i->b, i->c); AL::sigmap.add(i->a, AL::TimeSignature(i->b, i->c)); updateFlags |= SC_SIG; break; case UndoOp::DeleteSig: ///sigmap.del(i->a); AL::sigmap.del(i->a); updateFlags |= SC_SIG; break; case UndoOp::ModifyClip: case UndoOp::ModifyMarker: break; } } }