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.

139 lines
3.9KB

  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_Scrollbar.H>
  23. #include <FL/Fl_Pack.H>
  24. #include <FL/Fl_Group.H>
  25. #include <FL/Fl_Slider.H>
  26. #include "Scalebar.H"
  27. // #include "Waveform.H"
  28. #include "Region.H"
  29. #include <stdio.h>
  30. #include <unistd.h>
  31. #include <sys/stat.h>
  32. #include <stdlib.h>
  33. #include <string.h>
  34. #include "Track.H"
  35. #include "Audio_Track.H"
  36. #include "Timeline.H"
  37. #include "Tempo_Track.H"
  38. #include "Time_Track.H"
  39. #include "Loggable.H"
  40. #include "const.h"
  41. Timeline *timeline;
  42. void
  43. cb_scroll ( Fl_Widget *w, void *v )
  44. {
  45. Scalebar *sb = (Scalebar*)w;
  46. if ( sb->zoom_changed() )
  47. {
  48. // timeline->fpp = sb->zoom() * 256;
  49. timeline->fpp = sb->zoom() * 1;
  50. /* timeline->fpp = max( min( timeline->fpp, 4096.0f ), (float)2 ); */
  51. int maxx = timeline->ts_to_x( timeline->length );
  52. sb->range( 0, maxx );
  53. // timeline->redraw();
  54. timeline->redraw();
  55. }
  56. else
  57. {
  58. timeline->position( sb->value() );
  59. }
  60. /* timeline->xoffset = timeline->x_to_ts( sb->value() ); */
  61. /* // timeline->tracks->redraw(); */
  62. /* timeline->scroll->redraw(); */
  63. printf( "%lu\n", timeline->xoffset );
  64. /* for ( int i = timeline->tracks->children(); i-- ; ) */
  65. /* { */
  66. /* Fl_Group *track = (Fl_Group*)timeline->tracks->child( i ); */
  67. /* track->damage( FL_DAMAGE_SCROLL ); */
  68. /* } */
  69. /* for ( int i = timeline->rulers->children(); i-- ; ) */
  70. /* { */
  71. /* Fl_Group *track = (Fl_Group*)timeline->rulers->child( i ); */
  72. /* track->damage( FL_DAMAGE_SCROLL ); */
  73. /* } */
  74. /* /\* for ( int j = track->children(); j-- ; ) *\/ */
  75. /* /\* ((Region*)(track->child( j )))->resize(); *\/ */
  76. /* /\* } *\/ */
  77. }
  78. int
  79. main ( int argc, char **argv )
  80. {
  81. Fl_Window *main_window = new Fl_Window( 0, 0, 800, 600 );
  82. Fl::get_system_colors();
  83. Fl::scheme( "plastic" );
  84. Loggable::open( "history" );
  85. timeline = new Timeline( 0, 0, 800, 600, "Timeline" );
  86. // Region *wave = new Region( Clip::from_file( "streambass8.wav" ) );
  87. /* track1->next( track2 ); */
  88. /* track2->prev( track1 ); */
  89. timeline->scrollbar = new Scalebar( 0, 600 - 24, 800, 24 );
  90. timeline->scrollbar->range( 0, 48000 * 2 );
  91. timeline->scrollbar->zoom_range( 2, 8192 );
  92. timeline->scrollbar->zoom( 256 );
  93. timeline->scrollbar->type( 1 );
  94. timeline->scrollbar->callback( cb_scroll, 0 );
  95. main_window->end();
  96. main_window->show();
  97. /* wave->redraw(); */
  98. Fl::run();
  99. }