Assists music production by grouping standalone programs into sessions. Community version of "Non Session Manager".
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.6KB

  1. /*******************************************************************************/
  2. /* Copyright (C) 2008 Jonathan Moore Liles */
  3. /* */
  4. /* This program is free software; you can redistribute it and/or modify it */
  5. /* under the terms of the GNU General Public License as published by the */
  6. /* Free Software Foundation; either version 2 of the License, or (at your */
  7. /* option) any later version. */
  8. /* */
  9. /* This program is distributed in the hope that it will be useful, but WITHOUT */
  10. /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
  11. /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */
  12. /* more details. */
  13. /* */
  14. /* You should have received a copy of the GNU General Public License along */
  15. /* with This program; see the file COPYING. If not,write to the Free Software */
  16. /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  17. /*******************************************************************************/
  18. #include <FL/Fl.H>
  19. #include <FL/Fl_Window.H>
  20. #include <FL/Fl_Scroll.H>
  21. #include "Waveform.H"
  22. #include <stdio.h>
  23. #include <unistd.h>
  24. #include <sys/stat.h>
  25. #include <stdlib.h>
  26. #include <string.h>
  27. Fl_Color velocity_colors[128];
  28. void
  29. init_colors ( void )
  30. {
  31. for ( int i = 128; i--; )
  32. velocity_colors[i] = fl_rgb_color( 23, 255 - i * 2, 32 );
  33. }
  34. int
  35. main ( int argc, char **argv )
  36. {
  37. init_colors();
  38. Fl_Window *main_window = new Fl_Window( 0, 0, 800, 600 );
  39. Fl_Scroll *scroll = new Fl_Scroll( 0, 0, 800, 600 );
  40. Waveform *wave = new Waveform( 0, 0, 5000, 100, "foo" );
  41. FILE *fp;
  42. fp = fopen( "peaks", "r" );
  43. struct stat st;
  44. fstat( fileno( fp ), &st );
  45. size_t len = st.st_size;
  46. /* float chunk_size; */
  47. /* fread( &chunk_size, sizeof( chunk_size ), 1, fp ); */
  48. /* printf( "%f\n", chunk_size ); */
  49. float *peaks = new float[ len / sizeof( float ) ];
  50. fread( peaks, len, 1, fp );
  51. wave->peaks( peaks );
  52. wave->start( 0 );
  53. wave->end( len );
  54. wave->color( FL_CYAN );
  55. wave->selection_color( fl_darker( FL_GRAY ) );
  56. wave->selection_color( FL_GREEN );
  57. scroll->end();
  58. main_window->end();
  59. main_window->show();
  60. wave->redraw();
  61. Fl::run();
  62. }