Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

CMIDI - MetaTrader 5 Library | MT5 EA Download - MetaTrader 5 Resources

author EAcpu | 2 reads | 0 comments |

CMIDI - library for MetaTrader 5

CMIDI - library for MetaTrader 5

CMIDI - library for MetaTrader 5

Classes for controlling MIDI devices are located in the IncMIDI.mqh file. Examples of its usage are provided in the eMIDI.mq5 file.

The order of use of CMIDI classes

 #include
  • Declare a class:
     CMIDI meters;
  • Use the SetMusic(string & aMusic[]) method to transfer music programs.

  • Use the Play(bool aSynch=true) method to enable playback. If aSynch is true, use the Sleep() function to perform playback and pause in synchronized mode in a loop. If aSynch is false, playback occurs in synchronized mode, and you can stop playback using the Stop() method. To work in synchronous mode through the Expert Advisor's OnChartEvent() function, the ChartEvent() method must be called.

  • The Stop() method is called after the work is completed. The MIDI device must be closed, otherwise to re-run it you should restart the terminal.
  • music program

    Music programs are recorded in an array of strings. A sequence of operations is written into an array element. Actions are written with commas. First write the command, equal sign and command value. The following commands can be used:

    Chords can be used, such as "NoteDN=57, NoteDN=60, NoteDN=64". Can be played on multiple instruments in parallel, for example "Instrument=1, NoteDN=60, Instrument=123, NoteDN=60". The volume of different instruments cannot be changed, they all play at the same volume, but the volume of different parts of the performance can be changed, for example:

    CMIDI - library for MetaTrader 5

     "Scale=1500, Tool=123, Volume=100, NoteDN=60" , "Volume L=0, Volume R=100, NoteDN=64" , "Volume L=100, Volume R=0, NoteDN=57" , "Volume=50, NoteDN=67, NoneDN=57" , "Volume=25, NoteDN=64, NoneDN=67"

    CMIDI class methods


    Attachment download

    📎 incmidi.mqh (5.03 KB)

    📎 emidi.mq5 (4.68 KB)

    Source: MQL5 #1555

    Verification code Refresh