With listenNoteRange you can have each note call a different function (set flag 1), where the function name is of the form funcName#, and # = position of the key within the specified range.Į.g. Leave deviceID blank to default to no input and select it laterĢ: call listen*** for all input types you want to react toĪ specified function will be called when matching midi message is received. I guess I should make better documentation before posting stuff like this. (launch apps, key presses, numerical data input with knobs.) ![]() The point here is to make your midi controller useful outside the standard midi applications. I only need to run a midi player AHK script.In theory you could make the script play sounds on midi input but what's the point of that? If you want music, just play a vst soft synth or the sound card's midi out with something like midi-ox. That is, I don’t need another set of speakers or sound synthesizers. I connect my USB midi keyboard to a PC, I can play music and listen to it through the PC sound system. (It is not documented, how many unprocessed messages can AHK buffer – hopefully enough for normal players.) One can experiment with Critical, too, (or globally, with Thread, Interrupt, -1) what should buffer messages until the function returns. An alternative is to set MaxThreads to a large value (20) in the AHK script. A timer subroutine will then perform the actions (sound playing), otherwise some keys get lost at fast music playing. Maybe it has just to queue up requests and return. The player function has to return really fast, so it can handle frequent calls. The maximum is 0xFFFFFFFF, that will practically never be reached: 0xFFFFDFFF/10/60/60/24/365 = ~13.6 years of continuous playing, with 10 keys hit every second, therefore we need not worry about recycling expired message numbers. Similarly, in the call to listenWheel another function name is given, which has to process the wheel events.Īt every call the listening functions increase the message number, starting from 0x2000, for which the player function reacts. These functions have to call the necessary Windows midi API functions to play the sound. ![]() They will be called, whenever a keyboard key is hit, with the parameters note, and the velocity of the key press. In the call to listenNoteRange a function name is given (which can have a 0.7 number affixed). The logic of the player script has to be: I only need to run a midi player AHK script. Thanks for sharing it!ĭo I understand right the following? If I connect my USB midi keyboard to a PC, I can play music and listen to it through the PC sound system. ListenNoteRange(48, 52, "playSomeSounds", 0x02) Return DllCall("midi_in.dll\getChanAT", Int,channel)Īnd an example script to use the library: Return DllCall("midi_in.dll\getWheel", Int,channel) Return DllCall("midi_in.dll\getCC", Int,ccNumber, Int,channel) Return DllCall("midi_in.dll\getNoteOn", Int,noteNumber, Int,channel) MsgCount := DllCall("midi_in.dll\listenNoteRange", int,rangeStart, int,rangeEnd, int,(flags
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |