거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Twitter에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
조회수:
5766
평가:
(35)
게시됨:
2013.03.01 13:38
업데이트됨:
2016.09.23 09:03
\MQL5\Include\
incmidi.mqh (5.03 KB) 조회
\MQL5\Experts\
emidi.mq5 (4.68 KB) 조회
이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

A class to control the MIDI device is located in the IncMIDI.mqh file. The example of its use is represented in the eMIDI.mq5 file.

The order of using the CMIDI class

  1. Connect a file with a class:
    #include <IncMIDI.mqh>
  2. Declare a class:
    CMIDI m;
  3. Transfer music program using the SetMusic(string & aMusic[]) method.

  4. Enable playback using the Play(bool aSynch=true) method. If aSynch is true, play is performed in a synchronous mode in the cycle with pauses using the Sleep() function. If aSynch is false, play is performed in a synchronous mode, besides you can stop play using the Stop() method. To work in a synchronous mode from the OnChartEvent() function of the Expert Advisor the ChartEvent() method must be called.

  5. Call the Stop() method upon completion of work. It is necessary for the MIDI device closing, otherwise to rerun it you should restart the terminal.

Music program

Music program is recorded in the string array. In one array element is written a list of actions. Actions are written by a comma. At first a command, an equal sign and a command value are written. The following commands are available:

  • Tick - time in milliseconds through which all the commands of one array element will be performed. It defines the tempo with which the play is performed.
  • Volume - the volume level, from 0 to 100.
  • VolumeL - the left channel volume level, from 0 to 100.
  • VolumeR - the right channel volume level, from 0 to 100.
  • Instrument - selection of the music instrument, from 0 to 127.
  • NoteDN - press a key. Number 60 corresponds to "do" note of the main octave, 61 - to "C sharp", 62 - to "re", etc.
  • NoteUP - release a key. For several instruments you cannot use release a key, the sound fades away itself, and for some keys it is obligatory to press.

It is possible to take chords, for example, "NoteDN=57, NoteDN=60, NoteDN=64". A possible parallel play on several instruments, for example, "Instrument=1, NoteDN=60, Instrument=123, NoteDN=60". Different instruments' volume can not be changed, all is played on the same volume, but you can change the volume of different parts of playing, for example:

"Tick=1500, Instrument=123, Volume=100, NoteDN=60",
"VolumeL=0, VolumeR=100, NoteDN=64",
"VolumeL=100, VolumeR=0, NoteDN=57",
"Volume=50, NoteDN=67, NoneDN=57",
"Volume=25, NoteDN=64, NoneDN=67"

The CMIDI class methods 

  • void ChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam) - called from the function when using play in an asynchronous mode.
  • void Play(bool aSynch=true) - enable play. If aSynch is false, from the OnChartEvent function the ChartEvent() method must be called.  
  • void Stop() - stop play in an asynchronous play. Stop play and close the device.
  • void SetMusic(string & aMusic[]) - sending an array with a music program.
  • void SetEventID(ushort aID) - setting a number of a custom event. It is necessary when using play in an asynchronous mode. It is not necessary to call, default value is 1.

MetaQuotes Ltd에서 러시아어로 번역함.
원본 코드: https://www.mql5.com/ru/code/1555

MD5 Hash MD5 Hash

Calculation of 32 digit string MD5-hash from transmitted byte array

EMAPredictive3 EMAPredictive3

The Moving Average drawn on the basis of the EMA algorithm. A linear interpolation of two different period EMA is used

i-Friday_Sig i-Friday_Sig

Signals of entries and exits on the system "Friday effect"

Narrowest Range Signal Narrowest Range Signal

The narrowest range indicator defines the moments when the market is in the "compressed" state that says of the future breakthrough in this or that side