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.

134 lines
3.5KB

  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_Double_Window.H>
  21. #include <FL/Fl_Scroll.H>
  22. #include <FL/Fl_Pack.H>
  23. #include <FL/Fl_Group.H>
  24. #include "Waveform.H"
  25. #include "Region.H"
  26. #include <stdio.h>
  27. #include <unistd.h>
  28. #include <sys/stat.h>
  29. #include <stdlib.h>
  30. #include <string.h>
  31. Fl_Color velocity_colors[128];
  32. #include "Track.H"
  33. #include "Timeline.H"
  34. void
  35. init_colors ( void )
  36. {
  37. for ( int i = 128; i--; )
  38. velocity_colors[i] = fl_rgb_color( 23, 255 - i * 2, 32 );
  39. }
  40. Timeline timeline;
  41. int
  42. main ( int argc, char **argv )
  43. {
  44. init_colors();
  45. Fl_Double_Window *main_window = new Fl_Double_Window( 0, 0, 800, 600 );
  46. timeline.scroll = new Fl_Scroll( 0, 0, 800, 600 );
  47. Fl_Pack *tracks = new Fl_Pack( 0, 0, 5000, 5000 );
  48. tracks->type( Fl_Pack::VERTICAL );
  49. Fl::get_system_colors();
  50. Fl::scheme( "plastic" );
  51. // Fl_Group *pack = new Fl_Group( 0, 0, 5000, 600 );
  52. Track *track1 = new Track( 40, 0, 5000, 100 );
  53. // pack->type( Fl_Pack::VERTICAL );
  54. // pack->box( FL_DOWN_BOX );
  55. Region *wave = new Region( 0, 0, 5000, 100, "foo" );
  56. FILE *fp;
  57. fp = fopen( "peaks", "r" );
  58. struct stat st;
  59. fstat( fileno( fp ), &st );
  60. size_t len = st.st_size;
  61. /* float chunk_size; */
  62. /* fread( &chunk_size, sizeof( chunk_size ), 1, fp ); */
  63. /* printf( "%f\n", chunk_size ); */
  64. float *peaks = new float[ len / sizeof( float ) ];
  65. fread( peaks, len, 1, fp );
  66. wave->peaks( peaks );
  67. wave->start( 0 );
  68. wave->end( len );
  69. wave->color( FL_CYAN );
  70. wave->selection_color( fl_darker( FL_GRAY ) );
  71. wave->selection_color( FL_GREEN );
  72. track1->add( wave );
  73. track1->end();
  74. Track *track2 = new Track( 40, 0, 5000, 100 );
  75. // Region *wave2 = new Region( 0, 0, 350, 100, "bar" );
  76. Region *wave2 = new Region( *wave );
  77. /* wave2->peaks( peaks ); */
  78. /* wave2->start( 300 ); */
  79. /* wave2->end( len ); */
  80. track2->add( wave2 );
  81. track2->end();
  82. track1->next( track2 );
  83. track2->prev( track1 );
  84. tracks->end();
  85. timeline.scroll->end();
  86. main_window->end();
  87. main_window->show();
  88. wave->redraw();
  89. Fl::run();
  90. }