================================ SYSTEM ================================

Instead of FFTing silence before time=0, FFT the inverse of the
mirror image of the input, hoping to lose the boom at the start
of the spectrogram of a synth sine tone.
------------------------------------------------------------------------
Make it always read the file in sequence without seeking on normal play.
------------------------------------------------------------------------
Use SLEEF.org for faster math and sometimes DFT.
------------------------------------------------------------------------
Jarabe De Palo - Somos/09 Jarabe De Palo - Lo Que Te Voy A Decir
jumps
------------------------------------------------------------------------
When nexting, open the new window at the same position as the old one.
------------------------------------------------------------------------
Lock spettro into RAM to prevent it being swapped.
------------------------------------------------------------------------
Piano key axis is missing in fullscreen mode.
------------------------------------------------------------------------
Add repeat mode - presumably for one track.
------------------------------------------------------------------------
Be able to record from the green line, e.g.
spettro -R (for record) session.au input.au?
-O is also untaken.
No multitrack yet unless we tell the exec'd version to append
to the output file instead of overwriting it.
Arg to the next invocation. -A like -O?
------------------------------------------------------------------------
It has difficulty keeping up in high-res full-screen mode,
using about 100% CPU (not both of them) doing screen updating.
Can we delay screen updates from received results until the next scroll?
------------------------------------------------------------------------
Be able to set arguments with time parameters in sample frames
instead of seconds. -r 19088640f ?
------------------------------------------------------------------------
Be able to set bar lines with negative numbers meaning that long before
the end of the piece. Make sure -0 means the end of piece.
------------------------------------------------------------------------
Add Ctrl-A to select the whole piece by setting the bar lines
at the start and the end of the piece.
------------------------------------------------------------------------
Maybe also Ctrl-Shift-A to set the bar lines
at the left and right edges of the screen.
------------------------------------------------------------------------
Add -O flag to output from -l to -r, 0 to -r or -l to end.
------------------------------------------------------------------------
Make it possible to "Open with..."
------------------------------------------------------------------------
Make fftlen change according to X zoom.
------------------------------------------------------------------------
Carve off the audio file reading routines (and cache?) for libaudio.
------------------------------------------------------------------------
Store settings-over-exec at the end of SPETTROFLAGS
instead of modifying the command line;
remove duplicates from the command line.
------------------------------------------------------------------------
Include all gui/audio drivers and choose between them on startup.
------------------------------------------------------------------------
If libsox opens mp3s before libsndfile, does it work with the broken ones?
------------------------------------------------------------------------
What's the allocated size of *argv? Can we blithely add items?
------------------------------------------------------------------------
Can I remote-control it and see on one computer what it's showing
as well as be able to key-stroke it as it I were on its own window?
i.e. Connect to a running instance over the net and get a second copy
of its display and controls.
------------------------------------------------------------------------
Running Cucurucucu Paloma 100x100 the right edge flashes white
probably bcos the lookahead is less and it can't complete the
FFTs in time.
------------------------------------------------------------------------
If DISPLAY is not set, use the dummy X server for the test suite.
------------------------------------------------------------------------
Compile the Enlightenment port for Android, iOS and Windows.
------------------------------------------------------------------------
Be able to play jpgs

============================= PERFORMANCE ==============================

See if not also storing floating point audio and recomputing it from the
16-bit stereo on the fly is faster.
------------------------------------------------------------------------
Check that L&R bar times are the left edge of the line and that you can
position them at EOF+1 and that saving goes from incl left edge of L bar line
to excl left edge of R bar line.
------------------------------------------------------------------------
When nexting minimized, it flashes up and disappears, causing the mouse
focus to change to the window that the pointer's in.
------------------------------------------------------------------------
Give more precedence to graph scrolling over user events so that
AAAAAAAAAAA etc. doesn't block the graph's motion.
------------------------------------------------------------------------
Playing Amarok and X-zooming out from 800 to 400 ppsec,
the zone left of the green line slobbers grey for a few seconds.
------------------------------------------------------------------------
Ideally, the lookahead would be slightly larger than the time it takes
to perform an FFT at the current FFT size.
------------------------------------------------------------------------
Check that an FFT is performed on a time period centered on the center
of the time represented by a pixel column, not centered on its left edge.
------------------------------------------------------------------------
We could halve the audio cache's size by only storing stereo 16-bit samples
and not the mono floats, at the expense of some CPU time during FFT processing.
Use a profiler to see how much CPU time this costs compared to the FFTs.
------------------------------------------------------------------------
It gets audio dropouts when there is a lot of system disk activity.
See about realtime stuff.
------------------------------------------------------------------------
At high X zoom or large FFT size, if the whole screen is refreshed
it manages to keep up but once it's refreshing individual columns
as their results come in, it loses ground.
This suggests that column refreshing is more expensive than whole
screen scrolling. Profiling says that, when it is frantically drawing
columns on-screen:
	libSDL2 takes 11%CPU instead of 1.8%.
	schedule takes 3% instead of 0.03 (more work to scan)
	remove_job takes 1.9% instead of 0.03 (ditto)
To mitigate it
- make scanning a large work queue more efficient,
- scroll only the regions displaying spectral data, not the grey areas
- group column updates to continuous blocks instead of individual columns
  by delaying the update of columns that are not continuous with the left side.
  This would also make refreshes wipe left-to-right instead of sprinkling the
  results all over as they come in.
------------------------------------------------------------------------
Use b-trees for calc_t cache indexing instead of linked lists.
See btree.c on github.

================================ AUDIO =================================

Use libsox_ng if available for all file-reading
------------------------------------------------------------------------
Be able to choose which audio file reading library to use.
------------------------------------------------------------------------
If jackd is running, it currently just fails to open any audio device.
Implement use of JACK.
------------------------------------------------------------------------
sample3.8svx is opened by libsndfile but plays at double speed.
sox instead gets it right when converting it to a WAV, so we should
probably use libsox instead of libsndfile for this type of file.
rezound also gets it right.
Libsndfile reports the sample rate as 44100Hz.
------------------------------------------------------------------------
Add speex support, currently opened with libav but giving garbage.
------------------------------------------------------------------------
Add 4vol mode, mixing to mono and sending +signal to left and -signal to right
giving 4x power output if speaker is connected between Left +ve and Right +ve.
------------------------------------------------------------------------
Add "mono" mode, sending mixed signal to both channels
------------------------------------------------------------------------
EFL: Initialization of Emotion audio object is done in gui_init()
but should probably be in audio_init().
------------------------------------------------------------------------
Try to output to jackd before SDL_audio. Otherwise if jackd is running you get:
Couldn't open SDL audio: ALSA: Couldn't open audio device: Device or resource busy.
SDL2 does not have a Jack audio driver, only pulse, alsa and others.
------------------------------------------------------------------------
Using SDL_OpenAudioDevice() instead of SDL_OpenAudio() "succeeds" when
the audio device is busy but the graph then trembles instead of playing,
presumably because the playing position that it reports doesn't advance.
Failing is better than not working.

============================= AXES & FONTS =============================

Choose the frequency axis numbering scheme according to the height
of the characters in use. At present, it is too sparse.
------------------------------------------------------------------------
Automatic kerning of the caca font would be nice, especially for OCTAVES.
------------------------------------------------------------------------
Add a key to change the axis/status bar font (t and T for smaller/bigger)
------------------------------------------------------------------------
Check use of libsdl-ttf for fonts instead of libcaca
For speed, see https://github.com/grimfang4/SDL_FontCache

================================== UI ==================================

Reload spettro (re-exec it from the same point) with the 'R' key.
Needs preservation of settings over exec.
------------------------------------------------------------------------
When the frequency legend becomes narrower, shrink the frequency axis bar.
------------------------------------------------------------------------
When left-clicking in the frequency scale, show a slidable horizontal ruler
instead of setting the left bar line off-screen.
------------------------------------------------------------------------
Implement resizing by zoom in SDL.
------------------------------------------------------------------------
's' or 'g' again could make the lines black.
------------------------------------------------------------------------
Ledger lines in green (key L for on/off?)
------------------------------------------------------------------------
Make h show a help screen
------------------------------------------------------------------------
Make -o able to dump a PNG without needing X (needs the dummy video driver).
------------------------------------------------------------------------
On a tablet, a swipe up/down should move the position in the freq direction
and left/right swipes should seek, maybe with iPhone-like inertia,
as if the graph had weight on a resistive background.
That would also make rapper-like scatching possible!
It should be implementable as mouse click-move and making it Ctrl-click
At present Shift and Ctrl are ignored for mouse clicks.
That means that click and hold would pause the audio, which may be OK,
though a click to raise the window would make a pause.
Wait a short time interval before scratching? Or make it a mode?
However, that woudl require, at least, a very short SDL audio buffer,
preferably of 1 sample.
------------------------------------------------------------------------
Make it more usable on cellphones/tablets where there are no Shift/Ctrl keys.
Come to that, there's no keyboard! For panning they can swipe; for the rest?
A load of buttons along the short edge(s) and Settings? Yuk!
------------------------------------------------------------------------
Update the status line to include pause mode, mono mode and more state
variables.
------------------------------------------------------------------------
Be able to run with no title bar. Think icon top right.
------------------------------------------------------------------------
Be able to go back to the previous file, by remembering the previously
played audio files and where they were in the argument list.
If you go back and then forward in shuffle mode, it should remember
the order in which they were played before, overriding -S for those files.
Maybe by undocumented SPETTRO_PREV and SPETTRO_NEXT environment variables?
------------------------------------------------------------------------
Be able to pick a file from the list given on the command line.
------------------------------------------------------------------------
Add a softvol level meter below the status bar.
------------------------------------------------------------------------
Make Intensity steps smaller.
------------------------------------------------------------------------
Can we have the score lines black?
------------------------------------------------------------------------
Horizontal line before ^P output
------------------------------------------------------------------------
Be able to create a custom equalizer at the green line with mouse
clicks/drags to create and drag filter points up/down in freq and left/right in depth to create a custom equalizer.
be able to place multiple equalizer lines at different moments in time
and have it morph between them.
The first applies to everything before and the last to everything after,
so if there's only one, shown at the green line, it applies to the whole piece.
------------------------------------------------------------------------
Finish libcaca interface for terminals. It needs a separate mechanism
for notifying of scroll events and the arrival of results, and something
to decode its keystrokes into out key codes.
This also implies making {SDL,EFL,CACA}_{MAIN,AUDIO,VIDEO,TIMER,LOCKS}
runtime choices like video_driver in gui.c.
------------------------------------------------------------------------
Implement vertical mode as an alternative to horizontal mode:
bass on the left, treble on the right. THe future above, the past below
so scrolling is a waterfall. -d and ctrl-d are untaken ("down").
------------------------------------------------------------------------
Make 'o' put the start time in the filename as HH:MM:SS.FF not SSS.FF.
------------------------------------------------------------------------
Add 'm' to enable/disable mute mode.
------------------------------------------------------------------------
Add 'S' to enable/disable random play mode.
------------------------------------------------------------------------
Add command-line option for an n-second gap between tracks when nexting.
------------------------------------------------------------------------
Drop environment variable DISP_OFFSET and implement it as a command-line
option.
------------------------------------------------------------------------
If clicking in the grey area, set L or R bar time to 0 or EOF
------------------------------------------------------------------------
Be able to move to the left or right bar line marker (Shift-L / Shift-R)
------------------------------------------------------------------------
Be able to say "Pause when this track gets to the end"
------------------------------------------------------------------------
Add gradual softvol increase
------------------------------------------------------------------------
Be able to say "Pause when this track gets to the end"
------------------------------------------------------------------------
Add gradual softvol increase
------------------------------------------------------------------------
Be able to show filename or Albumtitle and Tracktitle at the bottom
of the display.
------------------------------------------------------------------------
Implement waveform view
------------------------------------------------------------------------
Implement '=' key to do --fit on the fly and remember where they were so as
to be able to undo it if they press = again.
------------------------------------------------------------------------
Suppress a harmless error message from libmpg123:
Playing /home/martin/audio/misc/Billy Taylor - I Wish I Knew How It Would Feel To Be Free.mp3
[src/libmpg123/id3.c:process_comment():584] error: No comment text / valid description?
------------------------------------------------------------------------
Be able to mouse-grab the progress indicator and drag it.
------------------------------------------------------------------------
When playing next file, keep whether it's playing, FFT size, disp_offset etc.
------------------------------------------------------------------------
When intensity changes but remains at max, don't refresh the graph
------------------------------------------------------------------------
When the -o flag is given, it should not respond to keystrokes
while it is generating the graph.
They should always be visible.
------------------------------------------------------------------------
In autoplay mode, if they pause and go to the end of the file, don't quit.
In general, only go to the next file when *playing* at EOF.
------------------------------------------------------------------------
When skipping to the next file, it would be nice to clean up and move on
in the same process and graphic window instead of exec'ing ourselves.
That said, it solves all memory leak problems and other state-related ones
and lets me update the running version of spettro in the middle of a concert
without an interruption.
------------------------------------------------------------------------
When adding score lines when there were none, just draw them on the display
instead of redisplaying the columns' spectral data.
When removing/changing such lines, just repaint the appropriate rows
------------------------------------------------------------------------
Be able to change disp_height and disp_width while running, so that
proper GUI window resizing becomes possible.
------------------------------------------------------------------------
Make 'Y' and 'y' zoom in by less than a factor of two,
say by a tenth or two tenths of the screen height, like the default time pan.
------------------------------------------------------------------------
When scrolling to playing position, take into account the timer interval
to position the display at the middle of the forthcoming timer interval.
Currently it syncs to the playing time, which then moves ahead so it
lags a little.
------------------------------------------------------------------------
Rework barline code to place at appropriate column, not at constant
multiple of a number of pixels.

================================== GUI ==================================

Add a bar showing the track name, big and maybe scrolling.
------------------------------------------------------------------------
Don't make painting of score lines etc wait for results to arrive.
------------------------------------------------------------------------
Scroll the graphic up and down when they scroll the mouse wheel.
------------------------------------------------------------------------
Make the left and right bar line markers red and green
(like ships' port and starboard lights)?
------------------------------------------------------------------------
Be able to mouse-drag extended bar lines, keeping the further bar line in place.
------------------------------------------------------------------------
Make Ctrl 'x' and 'X' zoom by one pixel like Ctrl-[yY].

================================ OTHER =================================

Add the Hamming window and adjust the manual.
------------------------------------------------------------------------
The spectrogram of a fragment that has a constant non-zero DC component
isn't all black; it has a blob at the bottom fading from the lowest
frequency to 4 times the lowest frequency. Is it interpolating from the
DC component?
------------------------------------------------------------------------
Be able to tune A to a different frequency & up/down it via the GUI.
Or cmdline --tune A4=440.
If no octave is given, --tune F#=710 retunes the F# nearest to 710.
------------------------------------------------------------------------
Add finer FFT frequency control.
------------------------------------------------------------------------
Be able to produce video output of a piece being played
------------------------------------------------------------------------
On startup, find the max amplitude of the first screenful before painting.
Indeed, wait for the whole screenful to be ready before painting anyway,
as the column-at-a-time repainting is slower and ugly.
------------------------------------------------------------------------
Resynthesize the piece from the spectrogram - maybe keep phase info in
FFT results or real & imaginary parts, then be able to play image files
(JPG, PNG ecc) by resynthesizing.
------------------------------------------------------------------------
