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.

cmGrScFltk.h 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 cmGrScFltk_h
  4. #define cmGrScFltk_h
  5. class Fl_Menu_Bar;
  6. class cmdIf;
  7. class cmGrScFltk : public cmGrPlotFltk, public gvHashFuncArg
  8. {
  9. public:
  10. cmGrScFltk(cmCtx_t* ctx, cmdIf* cp, Fl_Menu_Bar* menuBar, int x, int y, int w, int h);
  11. virtual ~cmGrScFltk();
  12. virtual cmScMsgTypeId_t recvScoreMsg( const void* msg, unsigned msgByteCnt );
  13. void setSampleRate( double srate );
  14. virtual double sampleRate() const;
  15. virtual bool on_plot_object( cmGrPlotCbArg_t* arg );
  16. virtual void selectBar( unsigned barNumb );
  17. virtual unsigned scoreSelectedEleIndex() const;
  18. virtual void setScoreLocation( unsigned locIdx, unsigned vel, unsigned smpIdx );
  19. private:
  20. enum
  21. {
  22. kOkRC,
  23. kInsertObjFailRC
  24. };
  25. enum
  26. {
  27. kPitchMId,
  28. kAttrMId,
  29. kDynMId,
  30. kLocIdxMId,
  31. kFracMId,
  32. kSectEvenMId,
  33. kSectDynMId,
  34. kSectTempoMId,
  35. kMenuItemCnt
  36. };
  37. typedef struct
  38. {
  39. cmGrScFltk* p;
  40. int id;
  41. } item_t;
  42. typedef struct scObj_str
  43. {
  44. cmScMsgTypeId_t id; // kEventMsgScId | kSectionMsgScId
  45. union
  46. {
  47. const cmScoreEvt_t* ep;
  48. const cmScoreSection_t* sp;
  49. } u;
  50. scObj_str( const cmScoreEvt_t* e) : id(kEventMsgScId) {u.ep=e;}
  51. scObj_str( const cmScoreSection_t* s) : id(kSectionMsgScId) {u.sp=s;}
  52. } scObj_t;
  53. double _srate;
  54. cmErr_t _err;
  55. cmdIf* _cmdIf;
  56. Fl_Menu_Bar* _menuBar;
  57. unsigned _samplesMetricId;
  58. unsigned _secondsMetricId;
  59. double _objSecs;
  60. unsigned _objId;
  61. bool _togFl;
  62. cmGrPlObjH_t _lastBarPlotObjH;
  63. item_t _menuArray[ kMenuItemCnt ];
  64. void _insertSection( const cmScoreSection_t* s );
  65. void _insertEvent( const cmScoreEvt_t* m );
  66. void _createMenu();
  67. bool _isMenuChecked( int id );
  68. void _setEventLabels();
  69. void _setSectionLabels();
  70. static void _s_menuCallback(Fl_Widget* w, void* arg);
  71. };
  72. #endif