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 2.9KB

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