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.

135 lines
3.7KB

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