MCPcopy Create free account
hub / github.com/YCAMInterlab/Duration / addTrack

Method addTrack

Duration/src/DurationController.cpp:1039–1090  ·  view source on GitHub ↗

--------------------------------------------------------------

Source from the content-addressed store, hash-verified

1037
1038//--------------------------------------------------------------
1039ofxTLTrack* DurationController::addTrack(string trackType, string trackName, string xmlFileName){
1040 ofxTLTrack* newTrack = NULL;
1041
1042 trackType = ofToLower(trackType);
1043 if(trackName == ""){
1044 trackName = trackType;
1045 }
1046
1047 if(xmlFileName == ""){
1048 string uniqueName = timeline.confirmedUniqueName(trackName);
1049 xmlFileName = ofToDataPath(settings.path + "/" + uniqueName + "_.xml");
1050 }
1051
1052 if(trackType == translation.translateKey("bangs") || trackType == "bangs"){
1053 newTrack = timeline.addBangs(trackName, xmlFileName);
1054 }
1055 else if(trackType == translation.translateKey("flags") || trackType == "flags"){
1056 newTrack = timeline.addFlags(trackName, xmlFileName);
1057 }
1058 else if(trackType == translation.translateKey("curves") || trackType == "curves"){
1059 newTrack = timeline.addCurves(trackName, xmlFileName);
1060 }
1061 else if(trackType == translation.translateKey("switches")|| trackType == "switches"){
1062 newTrack = timeline.addSwitches(trackName, xmlFileName);
1063 }
1064 else if(trackType == translation.translateKey("colors") || trackType == "colors"){
1065 newTrack = timeline.addColors(trackName, xmlFileName);
1066 }
1067 else if(trackType == translation.translateKey("lfo") || trackType == "lfo"){
1068 newTrack = timeline.addLFO(trackName, xmlFileName);
1069 }
1070 else if(trackType == translation.translateKey("audio") || trackType == "audio"){
1071 if(audioTrack != NULL){
1072 ofLogError("DurationController::addTrack") << "Trying to add an additional audio track";
1073 }
1074 else{
1075 audioTrack = new ofxTLAudioTrack();
1076 timeline.addTrack(trackName, audioTrack);
1077 timeline.bringTrackToTop(audioTrack);
1078 newTrack = audioTrack;
1079 }
1080 }
1081 else {
1082 ofLogError("DurationController::addTrack") << "Unsupported track type: " << trackType;
1083 }
1084
1085 if(newTrack != NULL){
1086 createHeaderForTrack(newTrack);
1087 needsSave = true;
1088 }
1089 return newTrack;
1090}
1091
1092//--------------------------------------------------------------
1093void DurationController::update(ofEventArgs& args){

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected