aboutsummaryrefslogtreecommitdiff
path: root/Src/external_dependencies/openmpt-trunk/mptrack/mod2midi.h
blob: e6478f24a99e2402cc7d2067cc8cb7828c2ee9e6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
 * mod2midi.h
 * ----------
 * Purpose: Module to MIDI conversion (dialog + conversion code).
 * Notes  : (currently none)
 * Authors: OpenMPT Devs
 * The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
 */


#pragma once

#include "openmpt/all/BuildSettings.hpp"

#ifndef NO_PLUGINS
#include "ProgressDialog.h"

OPENMPT_NAMESPACE_BEGIN


namespace MidiExport
{
	struct Mod2MidiInstr
	{
		uint8 channel = MidiMappedChannel; // See enum MidiChannel
		uint8 program = 0;
	};
	using InstrMap = std::vector<Mod2MidiInstr>;
}


class CModToMidi: public CDialog
{
protected:
	CComboBox m_CbnInstrument, m_CbnChannel, m_CbnProgram;
	CSpinButtonCtrl m_SpinInstrument;
	CSoundFile &m_sndFile;
	UINT m_currentInstr;
	bool m_percussion;
public:
	MidiExport::InstrMap m_instrMap;
	static bool s_overlappingInstruments;

public:
	CModToMidi(CSoundFile &sndFile, CWnd *pWndParent = nullptr);

protected:
	void OnOK() override;
	BOOL OnInitDialog() override;
	void DoDataExchange(CDataExchange *pDX) override;
	void FillProgramBox(bool percussion);
	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void UpdateDialog();
	afx_msg void OnChannelChanged();
	afx_msg void OnProgramChanged();
	afx_msg void OnOverlapChanged();
	DECLARE_MESSAGE_MAP();
};


class CDoMidiConvert: public CProgressDialog
{
public:
	CSoundFile &m_sndFile;
	mpt::ofstream &m_file;
	const MidiExport::InstrMap &m_instrMap;

public:
	CDoMidiConvert(CSoundFile &sndFile, mpt::ofstream &f, const MidiExport::InstrMap &instrMap, CWnd *parent = nullptr)
		: CProgressDialog(parent)
		, m_sndFile(sndFile)
		, m_file(f)
		, m_instrMap(instrMap)
	{ }
	void Run() override;
};


OPENMPT_NAMESPACE_END

#endif // NO_PLUGINS