mod2midi.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * mod2midi.h
  3. * ----------
  4. * Purpose: Module to MIDI conversion (dialog + conversion code).
  5. * Notes : (currently none)
  6. * Authors: OpenMPT Devs
  7. * The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
  8. */
  9. #pragma once
  10. #include "openmpt/all/BuildSettings.hpp"
  11. #ifndef NO_PLUGINS
  12. #include "ProgressDialog.h"
  13. OPENMPT_NAMESPACE_BEGIN
  14. namespace MidiExport
  15. {
  16. struct Mod2MidiInstr
  17. {
  18. uint8 channel = MidiMappedChannel; // See enum MidiChannel
  19. uint8 program = 0;
  20. };
  21. using InstrMap = std::vector<Mod2MidiInstr>;
  22. }
  23. class CModToMidi: public CDialog
  24. {
  25. protected:
  26. CComboBox m_CbnInstrument, m_CbnChannel, m_CbnProgram;
  27. CSpinButtonCtrl m_SpinInstrument;
  28. CSoundFile &m_sndFile;
  29. UINT m_currentInstr;
  30. bool m_percussion;
  31. public:
  32. MidiExport::InstrMap m_instrMap;
  33. static bool s_overlappingInstruments;
  34. public:
  35. CModToMidi(CSoundFile &sndFile, CWnd *pWndParent = nullptr);
  36. protected:
  37. void OnOK() override;
  38. BOOL OnInitDialog() override;
  39. void DoDataExchange(CDataExchange *pDX) override;
  40. void FillProgramBox(bool percussion);
  41. afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  42. afx_msg void UpdateDialog();
  43. afx_msg void OnChannelChanged();
  44. afx_msg void OnProgramChanged();
  45. afx_msg void OnOverlapChanged();
  46. DECLARE_MESSAGE_MAP();
  47. };
  48. class CDoMidiConvert: public CProgressDialog
  49. {
  50. public:
  51. CSoundFile &m_sndFile;
  52. mpt::ofstream &m_file;
  53. const MidiExport::InstrMap &m_instrMap;
  54. public:
  55. CDoMidiConvert(CSoundFile &sndFile, mpt::ofstream &f, const MidiExport::InstrMap &instrMap, CWnd *parent = nullptr)
  56. : CProgressDialog(parent)
  57. , m_sndFile(sndFile)
  58. , m_file(f)
  59. , m_instrMap(instrMap)
  60. { }
  61. void Run() override;
  62. };
  63. OPENMPT_NAMESPACE_END
  64. #endif // NO_PLUGINS