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: 4
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: 4
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: 4
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: 4
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.

Post Reply