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.

115 lines
3.0KB

  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. #pragma once
  19. #include <FL/Fl_Scroll.H>
  20. #include <FL/Fl_Pack.H>
  21. #include <FL/Fl_Scrollbar.H>
  22. #include "Clip.H"
  23. #include <math.h>
  24. #include <assert.h>
  25. #include <FL/fl_draw.H>
  26. class Timeline;
  27. extern Timeline timeline;
  28. #include "Track.H"
  29. // #include "Tempo_Track.H"
  30. class Tempo_Track;
  31. // #include "Tempo_Point.H"
  32. // #include "Region.H"
  33. #include <list>
  34. using std::list;
  35. class timestamped
  36. {
  37. public:
  38. nframes_t timestamp;
  39. bool
  40. operator< ( const timestamped &rhs ) const { return timestamp < rhs.timestamp; }
  41. };
  42. struct Timeline {
  43. struct tempo_event : timestamped
  44. {
  45. float beats_per_minute;
  46. };
  47. struct signature_event : timestamped
  48. {
  49. int beats_per_bar;
  50. int beat_type;
  51. };
  52. enum snap_flags_e {
  53. SNAP_TO_REGION,
  54. SNAP_TO_BAR,
  55. SNAP_TO_BEAT
  56. } snap_to;
  57. list <tempo_event> tempo_points;
  58. list <signature_event> signature_points;
  59. Fl_Scroll *scroll;
  60. Fl_Pack *tracks;
  61. Fl_Scrollbar *scrollbar;
  62. Tempo_Track *tempo_track;
  63. float fpp; /* frames per pixel */
  64. // nframes_t fpp;
  65. nframes_t sample_rate;
  66. nframes_t xoffset;
  67. nframes_t length;
  68. int _beats_per_bar;
  69. float _beats_per_minute;
  70. int
  71. ts_to_x( nframes_t ts )
  72. {
  73. // assert( ts / fpp > 0 );
  74. return ts / fpp;
  75. }
  76. nframes_t
  77. x_to_ts ( int x )
  78. {
  79. return x * fpp;
  80. }
  81. float beats_per_minute ( nframes_t when ) const;
  82. void beats_per_minute ( nframes_t when, float bpm );
  83. void draw_measure_lines ( int X, int Y, int W, int H, Fl_Color color );
  84. };