2013-06-02 22:14:25 -04:00
|
|
|
#pragma once
|
|
|
|
#ifndef id68C60171_0140_4DE1_B7255EFF557A74F9
|
|
|
|
#define id68C60171_0140_4DE1_B7255EFF557A74F9
|
|
|
|
|
|
|
|
#include <Window.hpp>
|
2013-06-07 19:40:52 -04:00
|
|
|
#include <PianoControl.hpp>
|
2013-09-12 19:10:54 -04:00
|
|
|
#include <midifile.h>
|
2013-12-09 17:09:54 -05:00
|
|
|
#include <mkntapi.h>
|
2013-06-02 22:14:25 -04:00
|
|
|
|
|
|
|
#include <mmsystem.h>
|
|
|
|
#include <commctrl.h>
|
|
|
|
#include <shellapi.h>
|
|
|
|
|
2013-12-09 17:09:54 -05:00
|
|
|
// Some compatibility defines for poor compilers
|
|
|
|
#ifndef MAPVK_VK_TO_VSC
|
|
|
|
#define MAPVK_VK_TO_VSC 0
|
|
|
|
#endif
|
|
|
|
#ifndef MAPVK_VSC_TO_VK
|
|
|
|
#define MAPVK_VSC_TO_VK 1
|
|
|
|
#endif
|
|
|
|
#ifndef MAPVK_VK_TO_CHAR
|
|
|
|
#define MAPVK_VK_TO_CHAR 2
|
|
|
|
#endif
|
|
|
|
#ifndef GET_KEYSTATE_WPARAM
|
|
|
|
#define GET_KEYSTATE_WPARAM(wParam) (LOWORD(wParam))
|
|
|
|
#endif
|
|
|
|
|
2014-04-08 19:29:52 -04:00
|
|
|
#define KEYBOARD_IMAGE 0xAA00
|
|
|
|
#define KEYBOARD_VOLUME 0xAA01
|
|
|
|
#define KEYBOARD_FORCE 0xAA02
|
|
|
|
#define KEYBOARD_INSTRUMENT 0xAA03
|
2014-04-18 19:30:24 -04:00
|
|
|
#define KEYBOARD_DEVICE 0xAA04
|
2014-04-08 19:29:52 -04:00
|
|
|
#define KEYBOARD_USE_BEEP 0xAAFF
|
|
|
|
#define KEYBOARD_SAVE 0xAB00
|
|
|
|
#define KEYBOARD_SAVE_FILE 0xAB01
|
|
|
|
#define KEYBOARD_BROWSE 0xAB02
|
|
|
|
#define KEYBOARD_REOPEN 0xAB03
|
|
|
|
|
2013-06-02 22:14:25 -04:00
|
|
|
class MainWindow : public Window {
|
|
|
|
public:
|
|
|
|
virtual LPCTSTR ClassName() { return TEXT("MusicKeyboardMain"); }
|
|
|
|
static MainWindow *Create(LPCTSTR szTitle);
|
2013-09-09 18:14:14 -04:00
|
|
|
void PlayNote(int note, bool down);
|
2013-06-02 22:14:25 -04:00
|
|
|
protected:
|
|
|
|
LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|
|
|
LRESULT OnCreate();
|
|
|
|
LRESULT OnDestroy();
|
|
|
|
bool Play(WPARAM wCode, LPARAM lParam, bool down);
|
|
|
|
BOOL WinRegisterClass(WNDCLASS *pwc);
|
|
|
|
WORD GetQWERTYKeyCode(WORD wKeyCode);
|
|
|
|
WORD GetRealKeyCode(WORD wQWERTYCode);
|
2013-09-12 19:10:54 -04:00
|
|
|
virtual void PaintContent(PAINTSTRUCT *pps);
|
2013-09-12 19:31:05 -04:00
|
|
|
void OnReOpenMIDI();
|
2013-06-02 22:14:25 -04:00
|
|
|
|
|
|
|
virtual HICON GetIcon();
|
2013-12-09 17:09:54 -05:00
|
|
|
|
2014-04-18 14:54:46 -04:00
|
|
|
int active[128];
|
2013-12-09 17:09:54 -05:00
|
|
|
bool useBeep;
|
|
|
|
HANDLE hBeep;
|
|
|
|
unsigned lastFrequency;
|
2014-04-18 19:30:24 -04:00
|
|
|
|
|
|
|
int currentDevice, deviceCount;
|
|
|
|
|
2013-12-09 17:09:54 -05:00
|
|
|
UNICODE_STRING usBeepDevice;
|
|
|
|
T_RtlInitUnicodeString F_RtlInitUnicodeString;
|
|
|
|
T_NtCreateFile F_NtCreateFile;
|
|
|
|
|
2013-06-02 22:14:25 -04:00
|
|
|
HWND m_volumeLabel, m_volumeBar;
|
|
|
|
HWND m_forceLabel, m_forceBar;
|
|
|
|
HWND m_instruLabel, m_instruSelect;
|
2014-04-18 19:30:24 -04:00
|
|
|
HWND m_deviceLabel, m_deviceSelect;
|
2013-12-09 17:09:54 -05:00
|
|
|
HWND m_beepCheck;
|
2013-09-12 19:31:05 -04:00
|
|
|
HWND m_saveCheck, m_saveLabel, m_saveFile, m_saveBrowse, m_reopen;
|
2013-06-02 22:14:25 -04:00
|
|
|
int m_instrument, m_volume, m_force;
|
|
|
|
HMIDIOUT m_midi;
|
|
|
|
bool isQWERTY;
|
|
|
|
HKL hklQWERTY;
|
2013-06-07 19:40:52 -04:00
|
|
|
PianoControl *piano;
|
|
|
|
LPWSTR m_keychars;
|
2013-09-12 19:10:54 -04:00
|
|
|
MIDI_FILE *m_midifile;
|
2014-01-23 18:16:02 -05:00
|
|
|
DWORD lastTime;
|
2013-09-12 19:10:54 -04:00
|
|
|
bool saving;
|
2013-06-02 22:14:25 -04:00
|
|
|
private:
|
|
|
|
HFONT hFont;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|