aboutsummaryrefslogtreecommitdiff
path: root/Src/external_dependencies/openmpt-trunk/mptrack/plugins/MidiInOutEditor.h
blob: 1ac7cdf95591bf3d39529678a2966c8eff8a7945 (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
/*
 * MidiInOutEditor.h
 * -----------------
 * Purpose: Editor interface for the MidiInOut plugin.
 * Notes  : (currently none)
 * Authors: Johannes Schultz (OpenMPT Devs)
 * The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
 */


#pragma once

#include "openmpt/all/BuildSettings.hpp"

#ifdef MODPLUG_TRACKER

#include "../AbstractVstEditor.h"
#include "../CDecimalSupport.h"

OPENMPT_NAMESPACE_BEGIN

class MidiInOut;

class MidiInOutEditor : public CAbstractVstEditor
{
protected:
	CComboBox m_inputCombo, m_outputCombo;
	CNumberEdit m_latencyEdit;
	CSpinButtonCtrl m_latencySpin;
	bool m_locked = true;

public:

	MidiInOutEditor(MidiInOut &plugin);

	// Refresh current input / output device in GUI
	void SetCurrentDevice(bool asInputDevice, MidiDevice::ID device)
	{
		CComboBox &combo = asInputDevice ? m_inputCombo : m_outputCombo;
		SetCurrentDevice(combo, device);
	}

	bool OpenEditor(CWnd *parent) override;
	bool IsResizable() const override { return false; }
	bool SetSize(int, int) override { return false; }

protected:

	// Update lists of available input / output devices
	static void PopulateList(CComboBox &combo, RtMidi &rtDevice, MidiDevice &midiDevice, bool isInput);
	// Refresh current input / output device in GUI
	void SetCurrentDevice(CComboBox &combo, MidiDevice::ID device);

	void DoDataExchange(CDataExchange* pDX) override;

	afx_msg void OnInputChanged();
	afx_msg void OnOutputChanged();
	afx_msg void OnLatencyChanged();
	afx_msg void OnTimingMessagesChanged();

	DECLARE_MESSAGE_MAP()
};

OPENMPT_NAMESPACE_END

#endif // MODPLUG_TRACKER