Programmable real-time audio signal processing application
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.

cmGrTlFltk.h 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. //| Copyright: (C) 2019-2020 Kevin Larke <contact AT larke DOT org>
  2. //| License: GNU GPL version 3.0 or above. See the accompanying LICENSE file.
  3. #ifndef cmGrTlFltk_h
  4. #define cmGrTlFltk_h
  5. class Fl_Menu_Bar;
  6. class cmdIf;
  7. class cmGrTlFltk : public cmGrPlotFltk, public gvHashFuncArg
  8. {
  9. public:
  10. cmGrTlFltk(cmCtx_t* ctx, cmdIf* cp, Fl_Menu_Bar* menuBar, int x, int y, int w, int h);
  11. virtual ~cmGrTlFltk();
  12. virtual cmTlUiMsgTypeId_t recvTimeLineMsg( const void* msg, unsigned msgByteCnt );
  13. virtual void recvAudioFileLoad( unsigned fileId );
  14. virtual double sampleRate() const { return _srate; }
  15. // Call these functions to notify the UI of changes of state that
  16. // occurred programmatically. These notifications are bubbling up
  17. // from the engine.
  18. typedef enum { kSamplesMetricId, kSecondsMetricId } timeAxisMetricId_t;
  19. virtual void setTimeAxisMetric( timeAxisMetricId_t metricId );
  20. virtual void toggleMarkerText();
  21. virtual unsigned timeLineSelectedMarkerId() const;
  22. virtual void setAudioFileCursor( unsigned smpIdx );
  23. virtual void selectBar( unsigned barNumb );
  24. // This function is called to notify the timeline UI that that state of one of it's
  25. // UI elements has been changed/manipulated by the user. This is the first
  26. // point of contact with a requested change from the user which is being
  27. // directed down to the engine.
  28. virtual bool on_plot_object( cmGrPlotCbArg_t* arg );
  29. private:
  30. enum
  31. {
  32. kOkRC,
  33. kParentObjNotFoundRC,
  34. kInsertObjFailRC,
  35. kAudioObjFailRC,
  36. };
  37. enum
  38. {
  39. kAudioVwIdx,
  40. kMidiVwIdx,
  41. kViewCnt
  42. };
  43. enum
  44. {
  45. kViewSamplesMId,
  46. kViewSecondsMId,
  47. kViewMarkTextMId,
  48. kViewPitchMId,
  49. kViewVelocityMId,
  50. kViewIdMId,
  51. kGenOnsetMarksMId,
  52. kDelOnsetMarksMId,
  53. kMenuItemCnt
  54. };
  55. // Flags returned by _getMenuCheckFlags();
  56. enum { kPitchChkFl=0x01, kVelChkFl=0x02, kIdChkFl=0x04 };
  57. typedef struct item_str
  58. {
  59. cmGrTlFltk* p;
  60. int id;
  61. } item_t;
  62. cmErr_t _err;
  63. double _srate;
  64. cmdIf* _cmdIf;
  65. Fl_Menu_Bar* _menuBar;
  66. int _seqMenuIdx;
  67. int _seqCnt;
  68. item_t* _seqItemArray;
  69. int _markCnt;
  70. unsigned _samplesMetricId;
  71. unsigned _secondsMetricId;
  72. cmGrPlObjH_t _selMarkPlotObjH;
  73. unsigned _curSeqId;
  74. item_t _menuArray[ kMenuItemCnt ];
  75. void _insertTimeLineObj( const cmTlUiMsg_t* m );
  76. void _updateSeqMenu(int newSeqCnt, unsigned seqId);
  77. void _createMenu();
  78. bool _isMenuChecked(int id);
  79. unsigned _getMenuCheckFlags();
  80. void _setLabels();
  81. void _setMidiEventLabels( cmGrPlObjH_t poH, unsigned flags);
  82. static void _s_seqMenuCallback( Fl_Widget* w, void* vp );
  83. static void _s_midiSciPitchValueFunc( void* arg, cmChar_t* label, unsigned labelCharCnt, cmGrV_t value );
  84. static void _s_roundHashValueFunc( void* arg, cmChar_t* label, unsigned labelCharCnt, cmGrV_t value );
  85. static void _s_minSecMsHashValueFunc( void* arg, cmChar_t* label, unsigned labelCharCnt, cmGrV_t value );
  86. static void _s_menuCallback( Fl_Widget* w, void* arg );
  87. };
  88. #endif