Timeline Track Editor wxWidgets only

If you have a cool piece of software to share, but you are not hosting it officially yet, please dump it in here. If you have code snippets that are useful, please donate!
Post Reply
experimental-design
In need of some credit
In need of some credit
Posts: 8
Joined: Mon May 27, 2019 7:37 pm

Timeline Track Editor wxWidgets only

Post by experimental-design » Mon May 27, 2019 8:00 pm

I needed some sort of GUI with a timeline and track editor for my binaural audio editor to change a variable with time.

I noticed that there wasn't code for a timeline track editor for wxWidgets that was freely available and easy to copy and integrate.

So I made my own and released it under the BSD license so anyone can copy it and use it for their open-source or closed-source projects.

https://github.com/adct-the-experimente ... ack-editor

Try it out and let me know if you find some bugs or have ideas to improve it.

The project aims to be non-application specific.

In its current state:
-Can add point to a graph with a left click on the mouse.
-Can remove point from the graph with right click on the mouse.
-Can change double-type variable according to information represented by points on the graph.
-Can add any number of tracks to change variables.

experimental-design
In need of some credit
In need of some credit
Posts: 8
Joined: Mon May 27, 2019 7:37 pm

Re: Timeline Track Editor wxWidgets only

Post by experimental-design » Fri May 31, 2019 11:27 pm

Big Update:
-Added ability to pass functions to execute during playback only during state of play.
-Updated README.md for better instructions.

For an example of how to create a custom class that uses DoubleTrack as a member in a Track derived class see
soundproducer-track.cpp and osgViewerWx.cpp in github.com/adct-the-experimenter/binaural-audio-editor .

IMPORTANT NOTE: Make sure double track gets added to timeframe not through inheritance but explicitly by TimeFrame class object!

Here is a video of the timeline-track-editor GUI code in use for my other project Binaural Audio Editor.
https://www.youtube.com/watch?v=41bjS_eg-Ps

experimental-design
In need of some credit
In need of some credit
Posts: 8
Joined: Mon May 27, 2019 7:37 pm

Re: Timeline Track Editor wxWidgets only

Post by experimental-design » Tue Jun 11, 2019 2:09 am

Update 3:

Added ability to call separate functions for separate playback states such as play, pause, rewind, fast forward, null(state after stop button pressed).

experimental-design
In need of some credit
In need of some credit
Posts: 8
Joined: Mon May 27, 2019 7:37 pm

Re: Timeline Track Editor wxWidgets only

Post by experimental-design » Wed Jun 19, 2019 6:09 pm

Update 4:
Added capability to handle audio. OpenAL Soft and libsndfile libraries need to be installed.

-Added AudioTrack to handle data operations and graphing for audio.
-Added StereoAudioTrack to graph mono audio data and stereo audio data and audio playback.
-Added MonoAudioTrack to graph mono audio data and audio playback.

The audio playback does not work very well at the moment, but it does currently load and play audio from start to finish.

If anyone wants to graph audio, look at AudioTrack and AudioGraph classes.

The general process for graphing audio.
1. Use a library(libsndfile,FFmpeg,LAME,etc) to open audio files and do data reading and writing.

2. Load audio data into a vector of double, or int, or uint16_t, etc. In my case, I did vector of double.

3. Read each sample(index) in vector containing audio data.
Have some code to get the max value every n samples e.g. from samples 0-499, get max value and save it along with the sample number.
Restart process at sample 500. Look at samples from 500-999 to get next max and sample number where max is.
Cap max at +1.
*Important Note: Stereo has left channel samples and right channel samples every other sample i.e. sample 0 is for left channel sample 1 is for right channel.

4.After reading through the vector, convert max values into a y-axis coordinate for graph,
and convert sample numbers where max values occur to time values with sample rate, then to x-axis coordinate for time axis.
Save those graph points into a vector in chronological order.
*Note: time value = sample / sample_rate; // sample # * (1s / (# of samples in 1 second) ) = time in seconds

5. Use wxPaintDC Draw circle to draw points to graph and use draw line function to draw lines between points in vector.

experimental-design
In need of some credit
In need of some credit
Posts: 8
Joined: Mon May 27, 2019 7:37 pm

Re: Timeline Track Editor wxWidgets only

Post by experimental-design » Mon Jul 01, 2019 8:49 pm

Minor Update 4.1

-Improved graphing of audio to be more accurate.
-Fix most audio playback issues. Can now start audio playback at any point and rewind and fast forward audio.

User avatar
doublemax
Moderator
Moderator
Posts: 13873
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Timeline Track Editor wxWidgets only

Post by doublemax » Tue Jul 02, 2019 5:36 am

Although i currently have no need for a control like this, i just wanted to say thanks for posting this. I felt sorry that you didn't get any feedback :)
Use the source, Luke!

experimental-design
In need of some credit
In need of some credit
Posts: 8
Joined: Mon May 27, 2019 7:37 pm

Re: Timeline Track Editor wxWidgets only

Post by experimental-design » Tue Jul 02, 2019 4:04 pm

Thanks! You made my day.

I haven't gotten feedback, but the good news is most of the views on the github project come from this forum.

experimental-design
In need of some credit
In need of some credit
Posts: 8
Joined: Mon May 27, 2019 7:37 pm

Re: Timeline Track Editor wxWidgets only

Post by experimental-design » Sat Jul 06, 2019 9:42 pm

Update 5:
I fixed a critical bug that caused the program to crash whenever a graph point was removed!

It was just a really dumb mistake of passing the last iterator from vector and assuming that iterator was the iterator pointing to the element that was pushed back into vector. It was actually the second-to-last iterator that points to the new element pushed back into vector.

Edit:
Never mind. It is only partially fixed

Edit 2:
I have it fully fixed now. Multiple graph points can be removed without program crashing.

Post Reply