/*
Ear training for Reaper EQ. See YouTube video: http://www.youtube.com/watch?v=s3mqrHVPb90
*/
#NoEnv
#SingleInstance force
#InstallKeybdHook
SetTitleMatchMode, 2
SendMode Input
DetectHiddenWindows, On
hz1 := 100
hz2 := 4000
*F11::
Gui Destroy
Gui, Add, Text,, Minimum Hz:
Gui, Add, Text,, Maximum Hz:
Gui, Add, Edit, vhz1 ym
Gui, Add, Edit, vhz2
Gui, Add, Button, default, OK
Gui, Show,, EQ Range
return
GuiClose:
ButtonOK:
Gui, Submit
MsgBox, Selected EQ Range is %hz1% - %hz2%.
return
*F12:: ; +8 dB ear training
{
CheckReaEq()
random, eq, %hz1%, %hz2%
ProblemFrequency := eq
DbChange := 8
;send, %eq%
;send, {Enter}
ControlSetText, Edit2, %eq% , a ; Edit2 is Frequency in Hz
ControlSetText, Edit3, %DbChange% , a ; Edit3 is Gain in dB
ControlSetText, Edit4, 0.5, a ; Edit4 is Bandwidth in octave
ControlGetText, FrequencyNote, Edit5, a ; Edit5 is note name of the selected frequency
MinimizeActiveWindow()
return
}
~F10:: ; showing ReaEQ window
{
CheckReaEq()
return
}
*F9:: ; -8 dB ear training
{
CheckReaEq()
random, eq, %hz1%, %hz2%
ProblemFrequency := eq
DbChange := -8
;send, %eq%
;send, {Enter}
ControlSetText, Edit2, %eq% , a ; Edit2 is Frequency in Hz
ControlSetText, Edit3, %DbChange% , a ; Edit3 is Gain in dB
ControlSetText, Edit4, 0.5, a ; Edit4 is Bandwidth in octave
ControlGetText, FrequencyNote, Edit5, a ; Edit5 is note name of the selected frequency
MinimizeActiveWindow()
return
}
*F8:: ; showing the current processing values in dB value and frequency
{
Clipboard := ProblemFrequency . "with " . DbChange . " , dB change, note name is " . FrequencyNote
MsgBox, %ProblemFrequency% with %DbChange% dB change, note name is %FrequencyNote%.
return
}
CheckReaEq()
{
; Is ReaEq running?
WinGet ReaEqMain, ID, reaeq-standalone ahk_class XLTP_EDITOR1
if (!ReaEqMain)
{
MsgBox, Hey, ReaEq seems not to be running, so no further actions will occur.
}
else
{
;MsgBox, Good, ReaEq is running, something will happen.
WinActivate, reaeq-standalone ahk_class XLTP_EDITOR1
Sleep, 1000
}
return
}
MinimizeActiveWindow()
{
global
lastMinTime := A_TickCount
lastMinID := WinExist("A")
; unlike WinMinimize, using WM_SYSCOMMAND, SC_MINIMIZE
; causes the system-wide "Minimize" sound to be played
PostMessage, 0x112, 0xF020
}