Ofxtimeline developmnet


#1

I guess this question goes directly to @obviousjim but as I could not find answers here, it could be useful for others.

What is the status of ofxTimeline. At the moment on OSX OF0.8.4 it has become difficult to use, the project generator does not recognise the addon, and when I use the OFPLUGIN for xcode it does not add the correct dependancies- it works for some projects but cannot be used with audio or video tracks it says they are not recognised. Is the project still being developed? (from my lack of skills I am working from a duplicated example)

A few other quick things-

There is a clash when using ofxMidi, timeline contains duplicates of the midi errors from rtaudio that clash with rtmidi.

Is there a limit to the duration of audio files? I have a 30 minute file (AIFF stereo 16bit 48k) and the gui becomes super super slow if I am looking at more that a minute or two (zoomed in is ok) - I guess zoomed out it is trying to draw every sample, instead of skipping them, or as many DAW do creating a cache of waveforms to speed things up. (mpb retina gt750m 16g ram- live cam (SD via ofxBlackmagic) and 1 SD video blended-3 curves tracks not much going on)

Last, I want to be able to add values to the timeline programatically, not using a mouse-I want to do a kind of record pass using a midi controller and have it play back. Is there any way to do this now? If not, any clues on where I start breaking things?

Cheers
Fred


#2

Hey Fresla, I might be able to help you out a bit. A few months ago I needed to program a 25 minute show alongside a track. I tried to load the whole .aif file into a TLAudioTrack but it was causing MASSIVE and I mean MASSIVE memory problems leading to intermittent crashes and super frustration. In the end the only way I could make sure the show could play through without crashing was to split the file into 3 separate smaller files. I then created an ofEvent that triggered when the first part of the TLAudioTrack had reached the end so it would load the next part in. Bit of a workaround hack but it works…

Not sure why ofxMidi and ofxTimeline are giving you problems. I have them both working fine in my project. When you bring ofxMidi into a project you need to locate the src/ios folder if you are on a desktop and remove it otherwise you will get some nasty errors.

In terms of programatically adding in keyframes thats totally doable. Do something like the following.

.h file

vector<ofxTLKeyframes*> tracks;
vector<ofxTLFlags*> flags;

.cpp

timeline.addFlags("myFlagTrack");
timeline.addCurves("myCurveTrack", ofRange(0.0, 1.0));

ofxTLKeyframes* myCurveTrack = (ofxTLKeyframes*) timeline.getTrack("myCurveTrack");
tracks.push_back(myCurveTrack);

ofxTLFlags* myFlagTrack = (ofxTLFlags*) timeline.getTrack("myFlagTrack");
flags.push_back(myFlagTrack);

//Add Key Frames ---- Probably best in a keyPressed or ofxMidiEvent function

int position = timeline.getCurrentTimeMillis() - 1;

for(int i = 0; i < tracks.size(); i++){
     tracks[i]->addKeyframeAtMillis(ofRandomuf(), position);
}

for(int i = 0; i < flags.size(); i++){
     string val;
     if((int)ofRandom(0,2) == 1){ val = "on"; }
     else { val = "off"; }
     flags[i]->addFlagAtTime(val, position);
}

Hopefully that gets you on the right track. obviously for your example you would replace the ofRandomuf() call in addKeyframeAtMillis with something like myMidi.getCC(20) or something. Obviously you will have to implement your own functions to do that but then pass those functions in here. Have fun!


#3

Hey thanks, I was not able to get back to the internet but I did find a similar solution for adding keyframes. Your solution was much neater, I wlll integrate it into my code, thanks.

I never solved the long file problem, I used aiff and wav and did not get crashes or memory leaks, just the draw loop was crippled on any interaction. I ended up just living with it.

Cheers


#4

Sorry for the thready necromancy, but just in case , I had to revive an old project where I started with your tip. Things changed a little and now I programatiically add a lot of flags (like 3000) to a timeline track. Every time I add the flags it writes it to an XML and it takes a very very long time.

Just in case you had some experience with this it would be great to knopw (as I now have 10 minutes free time every time I launch my app).

Cheers

Fred


#5

Hey @fresla, hmmm that’s odd. Not sure why it would be taking that long to write to an XML file. Maybe try off loading the writing and reading of XML data to a threadedFunction() so it doesn’t block your main window. I stopped using XML and moved to JSON years ago and haven’t looked back, so much nicer. Can’t remember how integrated XML is in ofxTimeline but could be worth trying to store presets in JSON instead…?


#6

I sam it was sorting all the entries every time a new entry was added. Disabling this sped things up a thousandfold. As I am adding all my values in order they dont need to be sorted.

This is inside the
addFlagAtTime()
function.