找回密码
 加入
搜索
查看: 3543|回复: 5

[转贴] 官网看见的超级玛丽音乐

[复制链接]
发表于 2009-8-11 14:27:45 | 显示全部楼层 |阅读模式
Mario Theme Song.au3
#include <midiudf.au3>

Global $BeatsPerMinute = 180
Global $QuarterNote = Round(60 / $BeatsPerMinute * 1000, 3)
Global $EightNote = Round($QuarterNote / 2, 3)
Global $Triplet = Round($QuarterNote * 2 / 3, 3)
Global $handle = _midiOutOpen()

Dim $Note[88][2] = [ _
                [$A0_ON, $A0_OFF],[$A0SHARP_ON, $A0SHARP_OFF],[$B0_ON, $B0_OFF], _
                [$C1_ON, $C1_OFF],[$C1SHARP_ON, $C1SHARP_OFF],[$D1_ON, $D1_OFF],[$D1SHARP_ON, $D1SHARP_OFF],[$E1_ON, $E1_OFF],[$F1_ON, $F1_OFF],[$F1SHARP_ON, $F1SHARP_OFF],[$G1_ON, $G1_OFF],[$G1SHARP_ON, $G1SHARP_OFF],[$A1_ON, $A1_OFF],[$A1SHARP_ON, $A1SHARP_OFF],[$B1_ON, $B1_OFF], _
                [$C2_ON, $C2_OFF],[$C2SHARP_ON, $C2SHARP_OFF],[$D2_ON, $D2_OFF],[$D2SHARP_ON, $D2SHARP_OFF],[$E2_ON, $E2_OFF],[$F2_ON, $F2_OFF],[$F2SHARP_ON, $F2SHARP_OFF],[$G2_ON, $G2_OFF],[$G2SHARP_ON, $G2SHARP_OFF],[$A2_ON, $A2_OFF],[$A2SHARP_ON, $A2SHARP_OFF],[$B2_ON, $B2_OFF], _
                [$C3_ON, $C3_OFF],[$C3SHARP_ON, $C3SHARP_OFF],[$D3_ON, $D3_OFF],[$D3SHARP_ON, $D3SHARP_OFF],[$E3_ON, $E3_OFF],[$F3_ON, $F3_OFF],[$F3SHARP_ON, $F3SHARP_OFF],[$G3_ON, $G3_OFF],[$G3SHARP_ON, $G3SHARP_OFF],[$A3_ON, $A3_OFF],[$A3SHARP_ON, $A3SHARP_OFF],[$B3_ON, $B3_OFF], _
                [$C4_ON, $C4_OFF],[$C4SHARP_ON, $C4SHARP_OFF],[$D4_ON, $D4_OFF],[$D4SHARP_ON, $D4SHARP_OFF],[$E4_ON, $E4_OFF],[$F4_ON, $F4_OFF],[$F4SHARP_ON, $F4SHARP_OFF],[$G4_ON, $G4_OFF],[$G4SHARP_ON, $G4SHARP_OFF],[$A4_ON, $A4_OFF],[$A4SHARP_ON, $A4SHARP_OFF],[$B4_ON, $B4_OFF], _
                [$C5_ON, $C5_OFF],[$C5SHARP_ON, $C5SHARP_OFF],[$D5_ON, $D5_OFF],[$D5SHARP_ON, $D5SHARP_OFF],[$E5_ON, $E5_OFF],[$F5_ON, $F5_OFF],[$F5SHARP_ON, $F5SHARP_OFF],[$G5_ON, $G5_OFF],[$G5SHARP_ON, $G5SHARP_OFF],[$A5_ON, $A5_OFF],[$A5SHARP_ON, $A5SHARP_OFF],[$B5_ON, $B5_OFF], _
                [$C6_ON, $C6_OFF],[$C6SHARP_ON, $C6SHARP_OFF],[$D6_ON, $D6_OFF],[$D6SHARP_ON, $D6SHARP_OFF],[$E6_ON, $E6_OFF],[$F6_ON, $F6_OFF],[$F6SHARP_ON, $F6SHARP_OFF],[$G6_ON, $G6_OFF],[$G6SHARP_ON, $G6SHARP_OFF],[$A6_ON, $A6_OFF],[$A6SHARP_ON, $A6SHARP_OFF],[$B6_ON, $B6_OFF], _
                [$C7_ON, $C7_OFF],[$C7SHARP_ON, $C7SHARP_OFF],[$D7_ON, $D7_OFF],[$D7SHARP_ON, $D7SHARP_OFF],[$E7_ON, $E7_OFF],[$F7_ON, $F7_OFF],[$F7SHARP_ON, $F7SHARP_OFF],[$G7_ON, $G7_OFF],[$G7SHARP_ON, $G7SHARP_OFF],[$A7_ON, $A7_OFF],[$A7SHARP_ON, $A7SHARP_OFF],[$B7_ON, $B7_OFF], _
                [$C8_ON, $C8_OFF]]

SetInstrument(1)

#Region Measure 1
On(56)
On(46)
On(30)
Sleep($EightNote)
Off(56)
Off(46)
Off(30)

On(56)
On(46)
On(30)
Sleep($EightNote)
Off(56)
Off(46)
Off(30)

Sleep($EightNote)

On(56)
On(46)
On(30)
Sleep($EightNote)
Off(56)
Off(46)
Off(30)

Sleep($EightNote)

On(52)
On(46)
On(30)
Sleep($EightNote)
Off(52)
Off(46)
Off(30)

Sleep($EightNote / 10)

On(56)
On(46)
On(30)
Sleep($QuarterNote)
Off(56)
Off(46)
Off(30)
#EndRegion Measure 1

#Region Measure 2
On(59)
On(51)
On(47)
On(35)
Sleep($QuarterNote)
Off(59)
Off(51)
Off(47)
Off(35)

Sleep($QuarterNote)

On(47)
On(23)
Sleep($QuarterNote)
Off(47)
Off(23)

Sleep($QuarterNote)
#EndRegion Measure 2

For $x = 1 To 2
        #Region Measure 3
        On(52)
        On(44)
        On(35)
        Sleep($QuarterNote)
        Off(52)
        Off(44)
        Off(35)

        Sleep($EightNote)

        On(47)
        On(40)
        On(32)
        Sleep($QuarterNote)
        Off(47)
        Off(40)
        Off(32)

        Sleep($EightNote)

        On(44)
        On(35)
        On(28)
        Sleep($QuarterNote)
        Off(44)
        Off(35)
        Off(28)
        #EndRegion Measure 3

        #Region Measure 4
        Sleep($EightNote)

        On(49)
        On(40)
        On(33)
        Sleep($QuarterNote - $EightNote / 10)
        Off(49)
        Off(40)
        Off(33)

        Sleep($EightNote / 10)

        On(51)
        On(42)
        On(35)
        Sleep($QuarterNote - $EightNote / 10)
        Off(51)
        Off(42)
        Off(35)

        Sleep($EightNote / 10)

        On(50)
        On(41)
        On(34)
        Sleep($EightNote - $EightNote / 10)
        Off(50)
        Off(41)
        Off(34)

        Sleep($EightNote / 10)

        On(49)
        On(40)
        On(33)
        Sleep($QuarterNote)
        Off(49)
        Off(40)
        Off(33)
        #EndRegion Measure 4

        #Region Measure 5
        On(47)
        On(40)
        On(32)
        Sleep($Triplet)
        Off(47)
        Off(40)
        Off(32)

        on(40)
        on(47)
        on(56)
        Sleep($Triplet)
        off(40)
        off(47)
        off(56)

        on(59)
        on(51)
        on(44)
        Sleep($Triplet)
        off(59)
        off(51)
        off(44)

        on(61)
        on(52)
        on(45)
        Sleep($QuarterNote)
        off(61)
        off(52)
        off(45)

        on(57)
        on(49)
        on(42)
        Sleep($EightNote)
        off(57)
        off(49)
        off(42)

        on(59)
        on(51)
        on(44)
        Sleep($EightNote)
        off(59)
        off(51)
        off(44)
        #EndRegion Measure 5

        #Region Measure 6
        Sleep($EightNote)

        on(40)
        on(47)
        on(56)
        Sleep($QuarterNote)
        off(40)
        off(47)
        off(56)

        On(52)
        On(44)
        On(37)
        Sleep($EightNote)
        Off(52)
        Off(44)
        Off(37)

        On(54)
        On(45)
        On(39)
        Sleep($EightNote)
        Off(54)
        Off(45)
        Off(39)

        On(51)
        On(42)
        On(35)
        Sleep($QuarterNote)
        Off(51)
        Off(42)
        Off(35)

        Sleep($EightNote)
        #EndRegion Measure 6
Next

For $x = 1 To 2
        #Region Measure 7
        on(28)
        Sleep($QuarterNote)
        off(28)

        on(59)
        on(56)
        Sleep($EightNote)
        off(59)
        off(56)

        on(58)
        on(55)
        on(35)
        Sleep($EightNote)
        off(58)
        off(55)
        off(35)

        on(57)
        on(54)
        Sleep($EightNote)
        off(57)
        off(54)

        on(55)
        on(51)
        Sleep($EightNote)
        on(40)
        Sleep($EightNote)
        off(55)
        off(51)
        on(56)
        on(52)
        Sleep($EightNote)
        off(56)
        off(52)
        off(40)
        #EndRegion Measure 7

        #Region Measure 8
        on(33)
        Sleep($EightNote)
        on(48)
        on(44)
        Sleep($EightNote)
        off(48)
        off(44)
        off(33)

        on(49)
        on(45)
        Sleep($EightNote)
        off(49)
        off(45)

        on(52)
        on(47)
        on(40)
        Sleep($EightNote)
        off(52)
        off(47)
        off(40)

        on(40)
        Sleep($EightNote)
        on(49)
        on(40)
        Sleep($EightNote)
        off(49)
        off(40)

        on(52)
        on(44)
        on(33)
        Sleep($EightNote)
        off(52)
        off(44)
        on(54)
        on(45)
        Sleep($EightNote)
        off(54)
        off(45)
        #EndRegion Measure 8

        #Region Measure 9
        on(28)
        Sleep($QuarterNote)
        off(28)

        on(59)
        on(56)
        Sleep($EightNote)
        off(59)
        off(56)

        on(58)
        on(55)
        on(32)
        Sleep($EightNote)
        off(58)
        off(55)
        off(32)

        on(57)
        on(54)
        Sleep($EightNote)
        off(57)
        off(54)

        on(55)
        on(51)
        Sleep($EightNote)
        on(35)
        Sleep($EightNote)
        off(55)
        off(51)
        off(35)
        on(56)
        on(52)
        on(40)
        Sleep($EightNote)
        off(56)
        off(52)
        off(40)
        #EndRegion Measure 9

        #Region Measure 10
        Sleep($EightNote)

        on(64)
        on(59)
        on(57)
        Sleep($QuarterNote - $EightNote / 10)
        off(64)
        off(59)
        off(57)

        Sleep($EightNote / 10)

        on(64)
        on(59)
        on(57)
        Sleep($EightNote)
        off(64)
        off(59)
        off(57)

        on(64)
        on(59)
        on(57)
        Sleep($QuarterNote)
        off(64)
        off(59)
        off(57)

        on(35)
        Sleep($QuarterNote)
        off(35)
        #EndRegion Measure 10

        #Region Measure 11
        on(28)
        Sleep($QuarterNote)
        off(28)

        on(59)
        on(56)
        Sleep($EightNote)
        off(59)
        off(56)

        on(58)
        on(55)
        on(35)
        Sleep($EightNote)
        off(58)
        off(55)
        off(35)

        on(57)
        on(54)
        Sleep($EightNote)
        off(57)
        off(54)

        on(55)
        on(51)
        Sleep($EightNote)
        on(40)
        Sleep($EightNote)
        off(55)
        off(51)
        on(56)
        on(52)
        Sleep($EightNote)
        off(56)
        off(52)
        off(40)
        #EndRegion Measure 11

        #Region Measure 12
        on(33)
        Sleep($EightNote)
        on(48)
        on(44)
        Sleep($EightNote)
        off(48)
        off(44)
        off(33)

        on(49)
        on(45)
        Sleep($EightNote)
        off(49)
        off(45)

        on(52)
        on(47)
        on(40)
        Sleep($EightNote)
        off(52)
        off(47)
        off(40)

        on(40)
        Sleep($EightNote)
        on(49)
        on(40)
        Sleep($EightNote)
        off(49)
        off(40)

        on(52)
        on(44)
        on(33)
        Sleep($EightNote)
        off(52)
        off(44)
        on(54)
        on(45)
        Sleep($EightNote)
        off(54)
        off(45)
        #EndRegion Measure 12

        #Region Measure 13
        on(28)
        Sleep($QuarterNote)
        off(28)

        on(55)
        on(48)
        on(36)
        Sleep($QuarterNote)
        off(55)
        off(48)
        off(36)

        Sleep($EightNote)

        on(54)
        on(45)
        on(38)
        Sleep($QuarterNote)
        off(54)
        off(45)
        off(38)

        Sleep($EightNote)
        #EndRegion Measure 13

        #Region Measure 14
        on(52)
        on(44)
        on(40)
        Sleep($QuarterNote)
        off(52)
        off(44)
        off(40)

        Sleep($EightNote)

        on(35)
        Sleep($EightNote)
        off(35)

        on(35)
        Sleep($QuarterNote)
        off(35)

        on(28)
        Sleep($QuarterNote)
        off(28)
        #EndRegion Measure 14
Next

#Region Measure 15
on(52)
on(48)
on(24)
Sleep($EightNote)
off(52)
off(48)
on(52)
on(48)
Sleep($EightNote)
off(52)
off(48)
off(24)

Sleep($EightNote)

on(52)
on(48)
on(31)
Sleep($EightNote)
off(52)
off(48)
off(31)

Sleep($EightNote)

on(52)
on(48)
Sleep($EightNote)
off(52)
off(48)

on(54)
on(50)
on(36)
Sleep($QuarterNote)
off(54)
off(50)
off(36)
#EndRegion Measure 15

#Region Measure 16
on(56)
on(47)
on(35)
Sleep($EightNote)
off(56)
off(47)
on(52)
on(44)
Sleep($EightNote)
off(52)
off(44)
off(35)

Sleep($EightNote)

on(49)
on(44)
on(28)
Sleep($EightNote)
off(49)
off(44)
off(28)

on(47)
on(40)
Sleep($QuarterNote)
on(23)
Sleep($QuarterNote)
off(47)
off(40)
off(23)
#EndRegion Measure 16

#Region Measure 17
on(52)
on(48)
on(24)
Sleep($EightNote)
off(52)
off(48)
on(52)
on(48)
Sleep($EightNote)
off(52)
off(48)
off(24)

Sleep($EightNote)

on(52)
on(48)
on(31)
Sleep($EightNote)
off(52)
off(48)
off(31)

Sleep($EightNote)

on(52)
on(48)
Sleep($EightNote)
off(52)
off(48)

on(54)
on(50)
on(36)
Sleep($EightNote)
off(54)
off(50)
on(56)
on(47)
Sleep($EightNote)
off(56)
off(47)
off(36)
#EndRegion Measure 17

#Region Measure 18
on(35)
Sleep($QuarterNote)
off(35)

Sleep($EightNote)

on(28)
Sleep($EightNote)
off(28)

Sleep($QuarterNote)

on(23)
Sleep($QuarterNote)
off(23)
#EndRegion Measure 18

#Region Measure 19
on(52)
on(48)
on(24)
Sleep($EightNote)
off(52)
off(48)
on(52)
on(48)
Sleep($EightNote)
off(52)
off(48)
off(24)

Sleep($EightNote)

on(52)
on(48)
on(31)
Sleep($EightNote)
off(52)
off(48)
off(31)

Sleep($EightNote)

on(52)
on(48)
Sleep($EightNote)
off(52)
off(48)

on(54)
on(50)
on(36)
Sleep($QuarterNote)
off(54)
off(50)
off(36)
#EndRegion Measure 19

#Region Measure 20
on(56)
on(47)
on(35)
Sleep($EightNote)
off(56)
off(47)
on(52)
on(44)
Sleep($EightNote)
off(52)
off(44)
off(35)

Sleep($EightNote)

on(49)
on(44)
on(28)
Sleep($EightNote)
off(49)
off(44)
off(28)

on(47)
on(40)
Sleep($QuarterNote)
on(23)
Sleep($QuarterNote)
off(47)
off(40)
off(23)
#EndRegion Measure 20

#Region Measure 21
on(56)
on(46)
on(30)
Sleep($EightNote)
off(56)
off(46)
off(30)

on(56)
on(46)
on(30)
Sleep($EightNote)
off(56)
off(46)
off(30)

Sleep($EightNote)

on(56)
on(46)
on(30)
Sleep($EightNote)
off(56)
off(46)
off(30)

Sleep($EightNote)

on(52)
on(46)
on(30)
Sleep($EightNote)
off(52)
off(46)
off(30)

on(56)
on(46)
on(30)
Sleep($QuarterNote)
off(56)
off(46)
off(30)
#EndRegion Measure 21

#Region Measure 22
on(59)
on(51)
on(47)
on(35)
Sleep($QuarterNote)
off(59)
off(51)
off(47)
off(35)

Sleep($QuarterNote)

on(47)
on(23)
Sleep($QuarterNote)
off(47)
off(23)

Sleep($QuarterNote)
#EndRegion Measure 22

For $x = 1 To 2
        #Region Measure 23
        On(52)
        On(44)
        On(35)
        Sleep($QuarterNote)
        Off(52)
        Off(44)
        Off(35)

        Sleep($EightNote)

        On(47)
        On(40)
        On(32)
        Sleep($QuarterNote)
        Off(47)
        Off(40)
        Off(32)

        Sleep($EightNote)

        On(44)
        On(35)
        On(28)
        Sleep($QuarterNote)
        Off(44)
        Off(35)
        Off(28)
        #EndRegion Measure 23

        #Region Measure 24
        Sleep($EightNote)

        On(49)
        On(40)
        On(33)
        Sleep($QuarterNote - $EightNote / 10)
        Off(49)
        Off(40)
        Off(33)

        Sleep($EightNote / 10)

        On(51)
        On(42)
        On(35)
        Sleep($QuarterNote - $EightNote / 10)
        Off(51)
        Off(42)
        Off(35)

        Sleep($EightNote / 10)

        On(50)
        On(41)
        On(34)
        Sleep($EightNote - $EightNote / 10)
        Off(50)
        Off(41)
        Off(34)

        Sleep($EightNote / 10)

        On(49)
        On(40)
        On(33)
        Sleep($QuarterNote)
        Off(49)
        Off(40)
        Off(33)
        #EndRegion Measure 24

        #Region Measure 25
        On(47)
        On(40)
        On(32)
        Sleep($Triplet)
        Off(47)
        Off(40)
        Off(32)

        on(40)
        on(47)
        on(56)
        Sleep($Triplet)
        off(40)
        off(47)
        off(56)

        on(59)
        on(51)
        on(44)
        Sleep($Triplet)
        off(59)
        off(51)
        off(44)

        on(61)
        on(52)
        on(45)
        Sleep($QuarterNote)
        off(61)
        off(52)
        off(45)

        on(57)
        on(49)
        on(42)
        Sleep($EightNote)
        off(57)
        off(49)
        off(42)

        on(59)
        on(51)
        on(44)
        Sleep($EightNote)
        off(59)
        off(51)
        off(44)
        #EndRegion Measure 25

        #Region Measure 26
        Sleep($EightNote)

        on(40)
        on(47)
        on(56)
        Sleep($QuarterNote)
        off(40)
        off(47)
        off(56)

        On(52)
        On(44)
        On(37)
        Sleep($EightNote)
        Off(52)
        Off(44)
        Off(37)

        On(54)
        On(45)
        On(39)
        Sleep($EightNote)
        Off(54)
        Off(45)
        Off(39)

        On(51)
        On(42)
        On(35)
        Sleep($QuarterNote)
        Off(51)
        Off(42)
        Off(35)

        Sleep($EightNote)
        #EndRegion Measure 26
Next

For $x = 1 To 2
        #Region Measure 27
        on(56)
        on(52)
        on(28)
        Sleep($EightNote)
        off(56)
        off(52)
        on(52)
        on(49)
        Sleep($EightNote)
        off(28)
        Sleep($EightNote)
        off(52)
        off(49)

        on(47)
        on(44)
;~ ;on(33)
        Sleep($EightNote)
        off(47)
        off(44)
;~ ;off(33)

        on(35)
        Sleep($QuarterNote)
        off(35)

        on(48)
        on(44)
        on(40)
        Sleep($QuarterNote)
        off(48)
        off(44)
        off(40)
        #EndRegion Measure 27

        #Region Measure 28
        on(49)
        on(45)
        on(33)
        Sleep($EightNote)
        off(49)
        off(45)
        on(57)
        on(52)
        Sleep($EightNote)
        off(33)
        on(33)
        Sleep($EightNote)
        off(57)
        off(52)
        on(57)
        on(52)
        Sleep($EightNote)
        off(57)
        off(52)
        off(33)

        on(49)
        on(45)
        on(40)
        Sleep($EightNote)
        off(40)
        on(40)
        Sleep($EightNote)
        off(49)
        off(45)
        off(40)

        on(33)
        Sleep($QuarterNote)
        off(33)
        #EndRegion Measure 28

        #Region Measure 29
        on(51)
        on(47)
        on(30)
        Sleep($QuarterNote / 6 * 4)
        off(51)
        off(47)
        on(61)
        on(57)
        Sleep($QuarterNote / 6 * 2)
        off(30)
        Sleep($QuarterNote / 6 * 2)
        off(61)
        off(57)
        on(61)
        on(57)
        Sleep($QuarterNote / 6 * 1)
        on(33)
        Sleep($QuarterNote / 6 * 3)
        off(61)
        off(57)
        off(33)
        on(61)
        on(57)
        on(35)
        Sleep($QuarterNote / 6 * 4)
        off(61)
        off(57)
        on(59)
        on(56)
        Sleep($QuarterNote / 6 * 2)
        off(35)
        on(39)
        Sleep($QuarterNote / 6 * 2)
        off(59)
        off(56)
        on(57)
        on(54)
        Sleep($QuarterNote / 6 * 4)
        off(57)
        off(54)
        off(39)
        #EndRegion Measure 29

        #Region Measure 30
        on(56)
        on(52)
        on(35)
        Sleep($EightNote)
        off(56)
        off(52)
        on(52)
        on(49)
        Sleep($EightNote)
        off(35)
        on(35)
        Sleep($EightNote)
        off(52)
        off(49)
        on(49)
        on(45)
        Sleep($EightNote)
        off(49)
        off(45)
        off(35)

        on(47)
        on(44)
        on(40)
        Sleep($EightNote)
        off(40)
        on(40)
        Sleep($EightNote)
        off(47)
        off(44)

        on(35)
        Sleep($QuarterNote)
        off(35)
        #EndRegion Measure 30

        #Region Measure 31
        on(56)
        on(52)
        on(28)
        Sleep($EightNote)
        off(56)
        off(52)
        on(52)
        on(49)
        Sleep($EightNote)
        off(28)
        Sleep($EightNote)
        off(52)
        off(49)

        on(47)
        on(44)
        ;on(33)
        Sleep($EightNote)
        off(47)
        off(44)
        ;off(33)

        on(35)
        Sleep($QuarterNote)
        off(35)

        on(48)
        on(44)
        on(40)
        Sleep($QuarterNote)
        off(48)
        off(44)
        off(40)
        #EndRegion Measure 31

        #Region Measure 32
        on(49)
        on(45)
        on(33)
        Sleep($EightNote)
        off(49)
        off(45)
        on(57)
        on(52)
        Sleep($EightNote)
        off(33)
        on(33)
        Sleep($EightNote)
        off(57)
        off(52)
        on(57)
        on(52)
        Sleep($EightNote)
        off(57)
        off(52)
        off(33)

        on(49)
        on(45)
        on(40)
        Sleep($EightNote)
        off(40)
        on(40)
        Sleep($EightNote)
        off(49)
        off(45)
        off(40)

        on(33)
        Sleep($QuarterNote)
        off(33)
        #EndRegion Measure 32

        #Region Measure 33
        on(51)
        on(47)
        on(35)
        Sleep($EightNote)
        off(51)
        off(47)
        off(35)

        on(57)
        on(54)
        on(35)
        Sleep($QuarterNote)
        off(57)
        off(54)
        off(35)

        on(57)
        on(54)
        on(35)
        Sleep($EightNote)
        off(57)
        off(54)
        off(35)

        on(57)
        on(54)
        on(35)
        Sleep($Triplet)
        off(57)
        off(54)
        off(35)

        on(56)
        on(52)
        on(37)
        Sleep($Triplet)
        off(56)
        off(52)
        off(37)

        on(54)
        on(51)
        on(39)
        Sleep($Triplet)
        off(54)
        off(51)
        off(39)
        #EndRegion Measure 33

        #Region Measure 34
        on(52)
        on(47)
        on(40)
        Sleep($EightNote)
        off(47)
        on(44)
        Sleep($EightNote)
        off(40)
        on(35)
        Sleep($EightNote)
        off(44)
        on(44)
        Sleep($EightNote)
        off(52)
        off(44)
        off(35)

        on(40)
        on(28)
        Sleep($QuarterNote)
        off(40)
        off(28)

        Sleep($QuarterNote)
        #EndRegion Measure 34
Next

#Region Measure 35
on(52)
on(48)
on(24)
Sleep($EightNote)
off(52)
off(48)
on(52)
on(48)
Sleep($EightNote)
off(52)
off(48)
off(24)

Sleep($EightNote)

on(52)
on(48)
on(31)
Sleep($EightNote)
off(52)
off(48)
off(31)

Sleep($EightNote)

on(52)
on(48)
Sleep($EightNote)
off(52)
off(48)

on(54)
on(50)
on(36)
Sleep($QuarterNote)
off(54)
off(50)
off(36)
#EndRegion Measure 35

#Region Measure 36
on(56)
on(47)
on(35)
Sleep($EightNote)
off(56)
off(47)
on(52)
on(44)
Sleep($EightNote)
off(52)
off(44)
off(35)

Sleep($EightNote)

on(49)
on(44)
on(28)
Sleep($EightNote)
off(49)
off(44)
off(28)

on(47)
on(40)
Sleep($QuarterNote)
on(23)
Sleep($QuarterNote)
off(47)
off(40)
off(23)
#EndRegion Measure 36

#Region Measure 37
on(52)
on(48)
on(24)
Sleep($EightNote)
off(52)
off(48)
on(52)
on(48)
Sleep($EightNote)
off(52)
off(48)
off(24)

Sleep($EightNote)

on(52)
on(48)
on(31)
Sleep($EightNote)
off(52)
off(48)
off(31)

Sleep($EightNote)

on(52)
on(48)
Sleep($EightNote)
off(52)
off(48)

on(54)
on(50)
on(36)
Sleep($EightNote)
off(54)
off(50)
on(56)
on(47)
Sleep($EightNote)
off(56)
off(47)
off(36)
#EndRegion Measure 37

#Region Measure 38
on(35)
Sleep($QuarterNote)
off(35)

on(56)
Sleep($EightNote)
off(56)

on(71)
on(28)
Sleep($EightNote)
off(71)
off(28)

on(80)
Sleep($EightNote)
off(80)

on(76)
Sleep($EightNote)
off(76)

on(78)
on(23)
Sleep($EightNote)
off(78)

on(83)
Sleep($EightNote)
off(83)
off(23)
#EndRegion Measure 38

#Region Measure 39
on(52)
on(48)
on(24)
Sleep($EightNote)
off(52)
off(48)
on(52)
on(48)
Sleep($EightNote)
off(52)
off(48)
off(24)

Sleep($EightNote)

on(52)
on(48)
on(31)
Sleep($EightNote)
off(52)
off(48)
off(31)

Sleep($EightNote)

on(52)
on(48)
Sleep($EightNote)
off(52)
off(48)

on(54)
on(50)
on(36)
Sleep($QuarterNote)
off(54)
off(50)
off(36)
#EndRegion Measure 39

#Region Measure 40
on(56)
on(47)
on(35)
Sleep($EightNote)
off(56)
off(47)
on(52)
on(44)
Sleep($EightNote)
off(52)
off(44)
off(35)

Sleep($EightNote)

on(49)
on(44)
on(28)
Sleep($EightNote)
off(49)
off(44)
off(28)

on(47)
on(40)
Sleep($QuarterNote)
on(23)
Sleep($QuarterNote)
off(47)
off(40)
off(23)
#EndRegion Measure 40

#Region Measure 41
on(56)
on(46)
on(30)
Sleep($EightNote)
off(56)
off(46)
off(30)

on(56)
on(46)
on(30)
Sleep($EightNote)
off(56)
off(46)
off(30)

Sleep($EightNote)

on(56)
on(46)
on(30)
Sleep($EightNote)
off(56)
off(46)
off(30)

Sleep($EightNote)

on(52)
on(46)
on(30)
Sleep($EightNote)
off(52)
off(46)
off(30)

on(56)
on(46)
on(30)
Sleep($QuarterNote)
off(56)
off(46)
off(30)
#EndRegion Measure 41

#Region Measure 42
on(59)
on(51)
on(47)
on(35)
Sleep($QuarterNote)
off(59)
off(51)
off(47)
off(35)

Sleep($QuarterNote)

on(47)
on(23)
Sleep($QuarterNote)
off(47)
off(23)

Sleep($QuarterNote)
#EndRegion Measure 42

For $x = 1 To 2
        #Region Measure 43
        on(56)
        on(52)
        on(28)
        Sleep($EightNote)
        off(56)
        off(52)
        on(52)
        on(49)
        Sleep($EightNote)
        off(28)
        Sleep($EightNote)
        off(52)
        off(49)

        on(47)
        on(44)
;~ on(33)
        Sleep($EightNote)
        off(47)
        off(44)
;~ off(33)

        on(35)
        Sleep($QuarterNote)
        off(35)

        on(48)
        on(44)
        on(40)
        Sleep($QuarterNote)
        off(48)
        off(44)
        off(40)
        #EndRegion Measure 43

        #Region Measure 44
        on(49)
        on(45)
        on(33)
        Sleep($EightNote)
        off(49)
        off(45)
        on(57)
        on(52)
        Sleep($EightNote)
        off(33)
        on(33)
        Sleep($EightNote)
        off(57)
        off(52)
        on(57)
        on(52)
        Sleep($EightNote)
        off(57)
        off(52)
        off(33)

        on(49)
        on(45)
        on(40)
        Sleep($EightNote)
        off(40)
        on(40)
        Sleep($EightNote)
        off(49)
        off(45)
        off(40)

        on(33)
        Sleep($QuarterNote)
        off(33)
        #EndRegion Measure 44

        #Region Measure 45
        on(51)
        on(47)
        on(30)
        Sleep($QuarterNote / 6 * 4)
        off(51)
        off(47)
        on(61)
        on(57)
        Sleep($QuarterNote / 6 * 2)
        off(30)
        Sleep($QuarterNote / 6 * 2)
        off(61)
        off(57)
        on(61)
        on(57)
        Sleep($QuarterNote / 6 * 1)
        on(33)
        Sleep($QuarterNote / 6 * 3)
        off(61)
        off(57)
        off(33)
        on(61)
        on(57)
        on(35)
        Sleep($QuarterNote / 6 * 4)
        off(61)
        off(57)
        on(59)
        on(56)
        Sleep($QuarterNote / 6 * 2)
        off(35)
        on(39)
        Sleep($QuarterNote / 6 * 2)
        off(59)
        off(56)
        on(57)
        on(54)
        Sleep($QuarterNote / 6 * 4)
        off(57)
        off(54)
        off(39)
        #EndRegion Measure 45

        #Region Measure 46
        on(56)
        on(52)
        on(35)
        Sleep($EightNote)
        off(56)
        off(52)
        on(52)
        on(49)
        Sleep($EightNote)
        off(35)
        on(35)
        Sleep($EightNote)
        off(52)
        off(49)
        on(49)
        on(45)
        Sleep($EightNote)
        off(49)
        off(45)
        off(35)

        on(47)
        on(44)
        on(40)
        Sleep($EightNote)
        off(40)
        on(40)
        Sleep($EightNote)
        off(47)
        off(44)

        on(35)
        Sleep($QuarterNote)
        off(35)
        #EndRegion Measure 46

        #Region Measure 47
        on(56)
        on(52)
        on(28)
        Sleep($EightNote)
        off(56)
        off(52)
        on(52)
        on(49)
        Sleep($EightNote)
        off(28)
        Sleep($EightNote)
        off(52)
        off(49)

        on(47)
        on(44)
        ;on(33)
        Sleep($EightNote)
        off(47)
        off(44)
        ;off(33)

        on(35)
        Sleep($QuarterNote)
        off(35)

        on(48)
        on(44)
        on(40)
        Sleep($QuarterNote)
        off(48)
        off(44)
        off(40)
        #EndRegion Measure 47

        #Region Measure 48
        on(49)
        on(45)
        on(33)
        Sleep($EightNote)
        off(49)
        off(45)
        on(57)
        on(52)
        Sleep($EightNote)
        off(33)
        on(33)
        Sleep($EightNote)
        off(57)
        off(52)
        on(57)
        on(52)
        Sleep($EightNote)
        off(57)
        off(52)
        off(33)

        on(49)
        on(45)
        on(40)
        Sleep($EightNote)
        off(40)
        on(40)
        Sleep($EightNote)
        off(49)
        off(45)
        off(40)

        on(33)
        Sleep($QuarterNote)
        off(33)
        #EndRegion Measure 48

        #Region Measure 49
        on(51)
        on(47)
        on(35)
        Sleep($EightNote)
        off(51)
        off(47)
        off(35)

        on(57)
        on(54)
        on(35)
        Sleep($QuarterNote)
        off(57)
        off(54)
        off(35)

        on(57)
        on(54)
        on(35)
        Sleep($EightNote)
        off(57)
        off(54)
        off(35)

        on(57)
        on(54)
        on(35)
        Sleep($Triplet)
        off(57)
        off(54)
        off(35)

        on(56)
        on(52)
        on(37)
        Sleep($Triplet)
        off(56)
        off(52)
        off(37)

        on(54)
        on(51)
        on(39)
        Sleep($Triplet)
        off(54)
        off(51)
        off(39)
        #EndRegion Measure 49

        #Region Measure 50
        on(52)
        on(47)
        on(40)
        Sleep($EightNote)
        off(47)
        on(44)
        Sleep($EightNote)
        off(40)
        on(35)
        Sleep($EightNote)
        off(44)
        on(44)
        Sleep($EightNote)
        off(52)
        off(44)
        off(35)

        on(40)
        on(28)
        Sleep($QuarterNote)
        off(40)
        off(28)

        Sleep($QuarterNote)
        #EndRegion Measure 50
Next

#Region Measure 51
on(52)
on(44)
on(35)
Sleep($QuarterNote)
off(52)
off(44)
off(35)

Sleep($EightNote)

on(47)
on(40)
on(32)
Sleep($QuarterNote)
off(47)
off(40)
off(32)

Sleep($EightNote)

on(44)
on(35)
on(32)
Sleep($QuarterNote)
off(44)
off(35)
off(32)
#EndRegion Measure 51

#Region Measure 52
on(49)
on(45)
on(28)
on(21)
Sleep($Triplet)
off(49)
on(51)
Sleep($Triplet * 1.1)
off(51)
on(49)
Sleep($Triplet * 1.2)
off(49)
off(45)
off(28)
off(21)

on(48)
on(45)
on(36)
on(18)
Sleep($Triplet * 1.3)
off(48)
on(50)
Sleep($Triplet * 1.4)
off(50)
on(48)
Sleep($Triplet * 1.5)
off(48)
off(45)
off(36)
off(18)
#EndRegion Measure 52

#Region Measure 53
on(47)
on(44)
on(23)
on(17)
Sleep($EightNote * 1.6)
off(44)
on(42)
Sleep($EightNote * 1.7)
off(42)
on(44)
Sleep($QuarterNote * 3 * 1.8)
off(47)
off(44)
off(23)
off(17)
#EndRegion Measure 53

_MidiOutClose($handle)

Func SetInstrument($Instrument)
        _MidiOutShortMsg($handle, 256 * $Instrument + 192)
EndFunc   ;==>SetInstrument

Func On($NoteIdx)
        $NoteIdx -= 1
        _MidiOutShortMsg($handle, $Note[$NoteIdx][0])
EndFunc   ;==>On

Func Off($NoteIdx)
        $NoteIdx -= 1
        _MidiOutShortMsg($handle, $Note[$NoteIdx][1])
EndFunc   ;==>Off

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 2009-8-11 14:28:38 | 显示全部楼层
1# lpxx
Midiudf.au3
#include <array.au3>

;======================
;Midi UDFs by Eynstyne
;See Example in Comments
;======================

;Midi Notes
;==========
Const $A0_ON = 0x00401590 ;1
Const $A0SHARP_ON = 0x00401690 ;2
Const $B0_ON = 0x00401790 ;3
Const $C1_ON = 0x00401890 ;4
Const $C1SHARP_ON = 0x00401990 ;5
Const $D1_ON = 0x00401A90 ;6
Const $D1SHARP_ON = 0x00401B90 ;7
Const $E1_ON = 0x00401C90 ;8
Const $F1_ON = 0x00401D90 ;9
Const $F1SHARP_ON = 0x00401E90 ;10
Const $G1_ON = 0x00401F90 ;11
Const $G1SHARP_ON = 0x00402090 ;12
Const $A1_ON = 0x00402190 ;13
Const $A1SHARP_ON = 0x00402290 ;14
Const $B1_ON = 0x00402390 ;15
Const $C2_ON = 0x00402490 ;16
Const $C2SHARP_ON = 0x00402590 ;17
Const $D2_ON = 0x00402690 ;18
Const $D2SHARP_ON = 0x00402790 ;19
Const $E2_ON = 0x00402890 ;20
Const $F2_ON = 0x00402990 ;21
Const $F2SHARP_ON = 0x00402A90 ;22
Const $G2_ON = 0x00402B90 ;23
Const $G2SHARP_ON = 0x00402C90 ;24
Const $A2_ON = 0x00402D90 ;25
Const $A2SHARP_ON = 0x00402E90 ;26
Const $B2_ON = 0x00402F90 ;27
Const $C3_ON = 0x00403090 ;28
Const $C3SHARP_ON = 0x00403190 ;29
Const $D3_ON = 0x00403290 ;30
Const $D3SHARP_ON = 0x00403390 ;31
Const $E3_ON = 0x00403490 ;32
Const $F3_ON = 0x00403590 ;33
Const $F3SHARP_ON = 0x00403690 ;34
Const $G3_ON = 0x00403790 ;35
Const $G3SHARP_ON = 0x00403890 ;36
Const $A3_ON = 0x00403990 ;37
Const $A3SHARP_ON = 0x00403A90 ;38
Const $B3_ON = 0x00403B90 ;39
Const $C4_ON = 0x00403C90 ;40 - Middle C
Const $C4SHARP_ON = 0x00403D90 ;41
Const $D4_ON = 0x00403E90 ;42
Const $D4SHARP_ON = 0x00403F90 ;43
Const $E4_ON = 0x00404090 ;44
Const $F4_ON = 0x00404190 ;45
Const $F4SHARP_ON = 0x00404290 ;46
Const $G4_ON = 0x00404390 ;47
Const $G4SHARP_ON = 0x00404490 ;48
Const $A4_ON = 0x00404590 ;49
Const $A4SHARP_ON = 0x00404690 ;50
Const $B4_ON = 0x00404790 ;51
Const $C5_ON = 0x00404890 ;52
Const $C5SHARP_ON = 0x00404990 ;53
Const $D5_ON = 0x00404A90 ;54
Const $D5SHARP_ON = 0x00404B90 ;55
Const $E5_ON = 0x00404C90 ;56
Const $F5_ON = 0x00404D90 ;57
Const $F5SHARP_ON = 0x00404E90 ;58
Const $G5_ON = 0x00404F90 ;59
Const $G5SHARP_ON = 0x00405090 ;60
Const $A5_ON = 0x00405190 ;61
Const $A5SHARP_ON = 0x00405290 ;62
Const $B5_ON = 0x00405390 ;63
Const $C6_ON = 0x00405490 ;64
Const $C6SHARP_ON = 0x00405590 ;65
Const $D6_ON = 0x00405690 ;66
Const $D6SHARP_ON = 0x00405790 ;67
Const $E6_ON = 0x00405890 ;68
Const $F6_ON = 0x00405990 ;69
Const $F6SHARP_ON = 0x00405A90 ;70
Const $G6_ON = 0x00405B90 ;71
Const $G6SHARP_ON = 0x00405C90 ;72
Const $A6_ON = 0x00405D90 ;73
Const $A6SHARP_ON = 0x00405E90 ;74
Const $B6_ON = 0x00405F90 ;75
Const $C7_ON = 0x00406090 ;76
Const $C7SHARP_ON = 0x00406190 ;77
Const $D7_ON = 0x00406290 ;78
Const $D7SHARP_ON = 0x00406390 ;79
Const $E7_ON = 0x00406490 ;80
Const $F7_ON = 0x00406590 ;81
Const $F7SHARP_ON = 0x00406690 ;82
Const $G7_ON = 0x00406790 ;83
Const $G7SHARP_ON = 0x00406890 ;84
Const $A7_ON = 0x00406990 ;85
Const $A7SHARP_ON = 0x00406A90 ;86
Const $B7_ON = 0x00406B90 ;87
Const $C8_ON = 0x00406C90 ;88

;Turn Off
Const $A0_OFF = 0x00001590 ;1
Const $A0SHARP_OFF = 0x00001690 ;2
Const $B0_OFF = 0x00001790 ;3
Const $C1_OFF = 0x00001890 ;4
Const $C1SHARP_OFF = 0x00001990 ;5
Const $D1_OFF = 0x00001A90 ;6
Const $D1SHARP_OFF = 0x00001B90 ;7
Const $E1_OFF = 0x00001C90 ;8
Const $F1_OFF = 0x00001D90 ;9
Const $F1SHARP_OFF = 0x00001E90 ;10
Const $G1_OFF = 0x00001F90 ;11
Const $G1SHARP_OFF = 0x00002090 ;12
Const $A1_OFF = 0x00002190 ;13
Const $A1SHARP_OFF = 0x00002290 ;14
Const $B1_OFF = 0x00002390 ;15
Const $C2_OFF = 0x00002490 ;16
Const $C2SHARP_OFF = 0x00002590 ;17
Const $D2_OFF = 0x00002690 ;18
Const $D2SHARP_OFF = 0x00002790 ;19
Const $E2_OFF = 0x00002890 ;20
Const $F2_OFF = 0x00002990 ;21
Const $F2SHARP_OFF = 0x00002A90 ;22
Const $G2_OFF = 0x00002B90 ;23
Const $G2SHARP_OFF = 0x00002C90 ;24
Const $A2_OFF = 0x00002D90 ;25
Const $A2SHARP_OFF = 0x00002E90 ;26
Const $B2_OFF = 0x00002F90 ;27
Const $C3_OFF = 0x00003090 ;28
Const $C3SHARP_OFF = 0x00003190 ;29
Const $D3_OFF = 0x00003290 ;30
Const $D3SHARP_OFF = 0x00003390 ;31
Const $E3_OFF = 0x00003490 ;32
Const $F3_OFF = 0x00003590 ;33
Const $F3SHARP_OFF = 0x00003690 ;34
Const $G3_OFF = 0x00003790 ;35
Const $G3SHARP_OFF = 0x00003890 ;36
Const $A3_OFF = 0x00003990 ;37
Const $A3SHARP_OFF = 0x00003A90 ;38
Const $B3_OFF = 0x00003B90 ;39
Const $C4_OFF = 0x00003C90 ;40 - Middle C
Const $C4SHARP_OFF = 0x00003D90 ;41
Const $D4_OFF = 0x00003E90 ;42
Const $D4SHARP_OFF = 0x00003F90 ;43
Const $E4_OFF = 0x00004090 ;44
Const $F4_OFF = 0x00004190 ;45
Const $F4SHARP_OFF = 0x00004290 ;46
Const $G4_OFF = 0x00004390 ;47
Const $G4SHARP_OFF = 0x00004490 ;48
Const $A4_OFF = 0x00004590 ;49
Const $A4SHARP_OFF = 0x00004690 ;50
Const $B4_OFF = 0x00004790 ;51
Const $C5_OFF = 0x00004890 ;52
Const $C5SHARP_OFF = 0x00004990 ;53
Const $D5_OFF = 0x00004A90 ;54
Const $D5SHARP_OFF = 0x00004B90 ;55
Const $E5_OFF = 0x00004C90 ;56
Const $F5_OFF = 0x00004D90 ;57
Const $F5SHARP_OFF = 0x00004E90 ;58
Const $G5_OFF = 0x00004F90 ;59
Const $G5SHARP_OFF = 0x00005090 ;60
Const $A5_OFF = 0x00005190 ;61
Const $A5SHARP_OFF = 0x00005290 ;62
Const $B5_OFF = 0x00005390 ;63
Const $C6_OFF = 0x00005490 ;64
Const $C6SHARP_OFF = 0x00005590 ;65
Const $D6_OFF = 0x00005690 ;66
Const $D6SHARP_OFF = 0x00005790 ;67
Const $E6_OFF = 0x00005890 ;68
Const $F6_OFF = 0x00005990 ;69
Const $F6SHARP_OFF = 0x00005A90 ;70
Const $G6_OFF = 0x00005B90 ;71
Const $G6SHARP_OFF = 0x00005C90 ;72
Const $A6_OFF = 0x00005D90 ;73
Const $A6SHARP_OFF = 0x00005E90 ;74
Const $B6_OFF = 0x00005F90 ;75
Const $C7_OFF = 0x00006090 ;76
Const $C7SHARP_OFF = 0x00006190 ;77
Const $D7_OFF = 0x00006290 ;78
Const $D7SHARP_OFF = 0x00006390 ;79
Const $E7_OFF = 0x00006490 ;80
Const $F7_OFF = 0x00006590 ;81
Const $F7SHARP_OFF = 0x00006690 ;82
Const $G7_OFF = 0x00006790 ;83
Const $G7SHARP_OFF = 0x00006890 ;84
Const $A7_OFF = 0x00006990 ;85
Const $A7SHARP_OFF = 0x00006A90 ;86
Const $B7_OFF = 0x00006B90 ;87
Const $C8_OFF = 0x00006C90 ;88

Const $Callback_NULL = 0
Const $callback_Window = 0x10000
Const $callback_thread = 0x20000
Const $callback_function = 0x30000
Const $callback_event = 0x50000

Const $MMSYSERR_BASE = 0
Const $MMSYSERR_ALLOCATED = ($MMSYSERR_BASE + 4)
Const $MMSYSERR_BADDEVICEID = ($MMSYSERR_BASE + 2)
Const $MMSYSERR_BADERRNUM = ($MMSYSERR_BASE + 9)
Const $MMSYSERR_ERROR = ($MMSYSERR_BASE + 1)
Const $MMSYSERR_HANDLEBUSY = ($MMSYSERR_BASE + 12)
Const $MMSYSERR_INVALFLAG = ($MMSYSERR_BASE + 10)
Const $MMSYSERR_INVALHANDLE = ($MMSYSERR_BASE + 5)
Const $MMSYSERR_INVALIDALIAS = ($MMSYSERR_BASE + 13)
Const $MMSYSERR_INVALPARAM = ($MMSYSERR_BASE + 11)
Const $MMSYSERR_LASTERROR = ($MMSYSERR_BASE + 13)
Const $MMSYSERR_NODRIVER = ($MMSYSERR_BASE + 6)
Const $MMSYSERR_NOERROR = 0
Const $MMSYSERR_NOMEM = ($MMSYSERR_BASE + 7)
Const $MMSYSERR_NOTENABLED = ($MMSYSERR_BASE + 3)
Const $MMSYSERR_NOTSUPPORTED = ($MMSYSERR_BASE + 8)

Const $MIDI_CACHE_ALL = 1
Const $MIDI_CACHE_BESTFIT = 2
Const $MIDI_CACHE_QUERY = 3
Const $MIDI_UNCACHE = 4
Const $MIDI_CACHE_VALID = ($MIDI_CACHE_ALL Or $MIDI_CACHE_BESTFIT Or $MIDI_CACHE_QUERY Or $MIDI_UNCACHE)
Const $MIDI_IO_STATUS = 0x20
Const $MIDICAPS_CACHE = 0x4
Const $MIDICAPS_LRVOLUME = 0x20
Const $MIDICAPS_STREAM = 0x8
Const $MIDICAPS_VOLUME = 0x1
Const $MIDIERR_BASE = 64
Const $MIDIERR_INVALIDSETUP = ($MIDIERR_BASE + 5)
Const $MIDIERR_LASTERROR = ($MIDIERR_BASE + 5)
Const $MIDIERR_NODEVICE = ($MIDIERR_BASE + 4)
Const $MIDIERR_NOMAP = ($MIDIERR_BASE + 2)
Const $MIDIERR_NOTREADY = ($MIDIERR_BASE + 3)
Const $MIDIERR_STILLPLAYING = ($MIDIERR_BASE + 1)
Const $MIDIERR_UNPREPARED = ($MIDIERR_BASE + 0)
Const $MIDIMAPPER = -1
Const $MIDIPROP_GET = 0x40000000
Const $MIDIPROP_SET = 0x80000000
Const $MIDIPROP_TEMPO = 0x2
Const $MIDIPROP_TIMEDIV = 0x1
Const $MIDISTRM_ERROR = -2
Const $MM_MPU401_MIDIOUT = 10
Const $MM_MPU401_MIDIIN = 11
Const $MM_MIDI_MAPPER = 1
Const $MIDIPATCHSIZE = 128

Const $MM_MIM_CLOSE = 0x3c2
Const $MM_MIM_DATA = 0x3c3
Const $MM_MIM_ERROR = 0x3c5
Const $MM_MIM_LONGDATA = 0x3c4
Const $MM_MIM_LONGERROR = 0x3c6
Const $MM_MIM_MOREDATA = 0x3cc
Const $MM_MIM_OPEN = 0x3c1
Const $MM_MOM_CLOSE = 0x3c8
Const $MM_MOM_DONE = 0x3c9
Const $MM_MOM_OPEN = 0x3c7
Const $MM_MOM_POSITIONCB = 0x3ca

Const $MIM_CLOSE = ($MM_MIM_CLOSE)
Const $MIM_DATA = ($MM_MIM_DATA)
Const $MIM_ERROR = ($MM_MIM_ERROR)
Const $MIM_LONGDATA = ($MM_MIM_LONGDATA)
Const $MIM_LONGERROR = ($MM_MIM_LONGERROR)
Const $MIM_MOREDATA = ($MM_MIM_MOREDATA)
Const $MIM_OPEN = ($MM_MIM_OPEN)
Const $MOM_CLOSE = ($MM_MOM_CLOSE)
Const $MOM_DONE = ($MM_MOM_DONE)
Const $MOM_OPEN = ($MM_MOM_OPEN)
Const $MOM_POSITIONCB = ($MM_MOM_POSITIONCB)

;Midi Notes
;==========

Const $ABASS_OCTAVEDOWN16_NOTEON = 0x00401590;1
Const $ASHARPBASS_OCTAVEDOWN16_NOTEON = 0x00401690;2
Const $BBASS_OCTAVEDOWN16_NOTEON = 0x00401790;3
Const $CBASS_OCTAVEDOWN8_NOTEON = 0x00401890;4
Const $CSHARPBASS_OCTAVEDOWN8_NOTEON = 0x00401990;5
Const $DBASS_OCTAVEDOWN8_NOTEON = 0x00401A90;6
Const $DSHARPBASS_OCTAVEDOWN8_NOTEON = 0x00401B90;7
Const $EBASS_OCTAVEDOWN8_NOTEON = 0x00401C90;8
Const $FBASS_OCTAVEDOWN8_NOTEON = 0x00401D90;9
Const $FSHARPBASS_OCTAVEDOWN8_NOTEON = 0x00401E90;10
Const $GBASS_OCTAVEDOWN8_NOTEON = 0x00401F90;11
Const $GSHARPBASS_OCTAVEDOWN8_NOTEON = 0x00402090;12
Const $ABASS_OCTAVEDOWN8_NOTEON = 0x00402190;13
Const $ASHARPBASS_OCTAVEDOWN8_NOTEON = 0x00402290;14
Const $BBASS_OCTAVEDOWN_NOTEON = 0x00402390;15
Const $CBASS_OCTAVEDOWN_NOTEON = 0x00402490;16
Const $CSHARPBASS_OCTAVEDOWN_NOTEON = 0x00402590;17
Const $DBASS_OCTAVEDOWN_NOTEON = 0x00402690;18
Const $DSHARPBASS_OCTAVEDOWN_NOTEON = 0x00402790;19
Const $EBASS_OCTAVEDOWN_NOTEON = 0x00402890;20
Const $FBASS_OCTAVEDOWN_NOTEON = 0x00402990;21
Const $FSHARPBASS_OCTAVEDOWN_NOTEON = 0x00402A90;22
Const $GBASS_OCTAVEDOWN_NOTEON = 0x00402B90;23
Const $GSHARPBASS_OCTAVEDOWN_NOTEON = 0x00402C90;24
Const $ABASS_OCTAVEDOWN_NOTEON = 0x00402D90;25
Const $ASHARPBASS_OCTAVEDOWN_NOTEON = 0x00402E90;26
Const $BBASS_NOTEON = 0x00402F90;27
Const $CBASS_NOTEON = 0x00403090;28
Const $CSHARPBASS_NOTEON = 0x00403190;29
Const $DBASS_NOTEON = 0x00403290;30
Const $DSHARPBASS_NOTEON = 0x00403390;31
Const $EBASS_NOTEON = 0x00403490;32
Const $FBASS_NOTEON = 0x00403590;33
Const $FSHARPBASS_NOTEON = 0x00403690;34
Const $GBASS_NOTEON = 0x00403790;35
Const $GSHARPBASS_NOTEON = 0x00403890;36
Const $ABASS_NOTEON = 0x00403990;37
Const $ASHARPBASS_NOTEON = 0x00403A90;38
Const $B_NOTEON = 0x00403B90;39
Const $C_NOTEON = 0x00403C90;40 - Middle C
Const $CSHARP_NOTEON = 0x00403D90;41
Const $D_NOTEON = 0x00403E90;42
Const $DSHARP_NOTEON = 0x00403F90;43
Const $E_NOTEON = 0x00404090;44
Const $F_NOTEON = 0x00404190;45
Const $FSHARP_NOTEON = 0x00404290;46
Const $G_NOTEON = 0x00404390;47
Const $GSHARP_NOTEON = 0x00404490;48
Const $A_NOTEON = 0x00404590;49
Const $ASHARP_NOTEON = 0x00404690;50
Const $B_OCTAVE_NOTEON = 0x00404790;51
Const $C_OCTAVEUP_NOTEON = 0x00404890;52
Const $CSHARP_OCTAVEUP_NOTEON = 0x00404990;53
Const $D_OCTAVEUP_NOTEON = 0x00404A90;54
Const $DSHARP_OCTAVEUP_NOTEON = 0x00404B90;55
Const $E_OCTAVEUP_NOTEON = 0x00404C90;56
Const $F_OCTAVEUP_NOTEON = 0x00404D90;57
Const $FSHARP_OCTAVEUP_NOTEON = 0x00404E90;58
Const $G_OCTAVEUP_NOTEON = 0x00404F90;59
Const $GSHARP_OCTAVEUP_NOTEON = 0x00405090;60
Const $A_OCTAVEUP_NOTEON = 0x00405190;61
Const $ASHARP_OCTAVEUP_NOTEON = 0x00405290;62
Const $B_OCTAVEUP_NOTEON = 0x00405390;63
Const $C_OCTAVEUP8_NOTEON = 0x00405490;64
Const $CSHARP_OCTAVEUP8_NOTEON = 0x00405590;65
Const $D_OCTAVEUP8_NOTEON = 0x00405690;66
Const $DSHARP_OCTAVEUP8_NOTEON = 0x00405790;67
Const $E_OCTAVEUP8_NOTEON = 0x00405890;68
Const $F_OCTAVEUP8_NOTEON = 0x00405990;69
Const $FSHARP_OCTAVEUP8_NOTEON = 0x00405A90;70
Const $G_OCTAVEUP8_NOTEON = 0x00405B90;71
Const $GSHARP_OCTAVEUP8_NOTEON = 0x00405C90;72
Const $A_OCTAVEUP8_NOTEON = 0x00405D90;73
Const $ASHARP_OCTAVEUP8_NOTEON = 0x00405E90;74
Const $B_OCTAVEUP8_NOTEON = 0x00405F90;75
Const $C_OCTAVEUP16_NOTEON = 0x00406090;76
Const $CSHARP_OCTAVEUP16_NOTEON = 0x00406190;77
Const $D_OCTAVEUP16_NOTEON = 0x00406290;78
Const $DSHARP_OCTAVEUP16_NOTEON = 0x00406390;79
Const $E_OCTAVEUP16_NOTEON = 0x00406490;80
Const $F_OCTAVEUP16_NOTEON = 0x00406590;81
Const $FSHARP_OCTAVEUP16_NOTEON = 0x00406690; 82
Const $G_OCTAVEUP16_NOTEON = 0x00406790; 83
Const $GSHARP_OCTAVEUP16_NOTEON = 0x00406890; 84
Const $A_OCTAVEUP16_NOTEON = 0x00406990 ;85
Const $ASHARP_OCTAVEUP16_NOTEON = 0x00406A90 ;86
Const $B_OCTAVEUP16_NOTEON = 0x00406B90 ;87
Const $C_OCTAVEUP32_NOTEON = 0x00406C90 ;88

;Turn Off the Notes

Const $ABASS_OCTAVEDOWN16_NOTEOFF = 0x00001590;1
Const $ASHARPBASS_OCTAVEDOWN16_NOTEOFF = 0x00001690;2
Const $BBASS_OCTAVEDOWN16_NOTEOFF = 0x00001790;3
Const $CBASS_OCTAVEDOWN8_NOTEOFF = 0x00001890;4
Const $CSHARPBASS_OCTAVEDOWN8_NOTEOFF = 0x00001990;5
Const $DBASS_OCTAVEDOWN8_NOTEOFF = 0x00001A90;6
Const $DSHARPBASS_OCTAVEDOWN8_NOTEOFF = 0x00001B90;7
Const $EBASS_OCTAVEDOWN8_NOTEOFF = 0x00001C90;8
Const $FBASS_OCTAVEDOWN8_NOTEOFF = 0x00001D90;9
Const $FSHARPBASS_OCTAVEDOWN8_NOTEOFF = 0x00001E90;10
Const $GBASS_OCTAVEDOWN8_NOTEOFF = 0x00001F90;11
Const $GSHARPBASS_OCTAVEDOWN8_NOTEOFF = 0x00002090;12
Const $ABASS_OCTAVEDOWN8_NOTEOFF = 0x00002190;13
Const $ASHARPBASS_OCTAVEDOWN8_NOTEOFF = 0x00002290;14
Const $BBASS_OCTAVEDOWN_NOTEOFF = 0x00002390;15
Const $CBASS_OCTAVEDOWN_NOTEOFF = 0x00002490;16
Const $CSHARPBASS_OCTAVEDOWN_NOTEOFF = 0x00002590;17
Const $DBASS_OCTAVEDOWN_NOTEOFF = 0x00002690;18
Const $DSHARPBASS_OCTAVEDOWN_NOTEOFF = 0x00002790;19
Const $EBASS_OCTAVEDOWN_NOTEOFF = 0x00002890;20
Const $FBASS_OCTAVEDOWN_NOTEOFF = 0x00002990;21
Const $FSHARPBASS_OCTAVEDOWN_NOTEOFF = 0x00002A90;22
Const $GBASS_OCTAVEDOWN_NOTEOFF = 0x00002B90;23
Const $GSHARPBASS_OCTAVEDOWN_NOTEOFF = 0x00002C90;24
Const $ABASS_OCTAVEDOWN_NOTEOFF = 0x00002D90;25
Const $ASHARPBASS_OCTAVEDOWN_NOTEOFF = 0x00002E90;26
Const $BBASS_NOTEOFF = 0x00002F90;27
Const $CBASS_NOTEOFF = 0x00003090;28
Const $CSHARPBASS_NOTEOFF = 0x00003190;29
Const $DBASS_NOTEOFF = 0x00003290;30
Const $DSHARPBASS_NOTEOFF = 0x00003390;31
Const $EBASS_NOTEOFF = 0x00003490;32
Const $FBASS_NOTEOFF = 0x00003590;33
Const $FSHARPBASS_NOTEOFF = 0x00003690;34
Const $GBASS_NOTEOFF = 0x00003790;35
Const $GSHARPBASS_NOTEOFF = 0x00003890;36
Const $ABASS_NOTEOFF = 0x00003990;37
Const $ASHARPBASS_NOTEOFF = 0x00003A90;38
Const $B_NOTEOFF = 0x00003B90;39
Const $C_NOTEOFF = 0x00003C90;00 - Middle C
Const $CSHARP_NOTEOFF = 0x00003D90;41
Const $D_NOTEOFF = 0x00003E90;42
Const $DSHARP_NOTEOFF = 0x00003F90;43
Const $E_NOTEOFF = 0x00000090;44
Const $F_NOTEOFF = 0x00004190;45
Const $FSHARP_NOTEOFF = 0x00004290;46
Const $G_NOTEOFF = 0x00004390;47
Const $GSHARP_NOTEOFF = 0x00004490;48
Const $A_NOTEOFF = 0x00004590;49
Const $ASHARP_NOTEOFF = 0x00004690;50
Const $B_OCTAVE_NOTEOFF = 0x00004790;51
Const $C_OCTAVEUP_NOTEOFF = 0x00004890;52
Const $CSHARP_OCTAVEUP_NOTEOFF = 0x00004990;53
Const $D_OCTAVEUP_NOTEOFF = 0x00004A90;54
Const $DSHARP_OCTAVEUP_NOTEOFF = 0x00004B90;55
Const $E_OCTAVEUP_NOTEOFF = 0x00004C90;56
Const $F_OCTAVEUP_NOTEOFF = 0x00004D90;57
Const $FSHARP_OCTAVEUP_NOTEOFF = 0x00004E90;58
Const $G_OCTAVEUP_NOTEOFF = 0x00004F90;59
Const $GSHARP_OCTAVEUP_NOTEOFF = 0x00005090;60
Const $A_OCTAVEUP_NOTEOFF = 0x00005190;61
Const $ASHARP_OCTAVEUP_NOTEOFF = 0x00005290;62
Const $B_OCTAVEUP_NOTEOFF = 0x00005390;63
Const $C_OCTAVEUP8_NOTEOFF = 0x00005490;64
Const $CSHARP_OCTAVEUP8_NOTEOFF = 0x00005590;65
Const $D_OCTAVEUP8_NOTEOFF = 0x00005690;66
Const $DSHARP_OCTAVEUP8_NOTEOFF = 0x00005790;67
Const $E_OCTAVEUP8_NOTEOFF = 0x00005890;68
Const $F_OCTAVEUP8_NOTEOFF = 0x00005990;69
Const $FSHARP_OCTAVEUP8_NOTEOFF = 0x00005A90;70
Const $G_OCTAVEUP8_NOTEOFF = 0x00005B90;71
Const $GSHARP_OCTAVEUP8_NOTEOFF = 0x00005C90;72
Const $A_OCTAVEUP8_NOTEOFF = 0x00005D90;73
Const $ASHARP_OCTAVEUP8_NOTEOFF = 0x00005E90;74
Const $B_OCTAVEUP8_NOTEOFF = 0x00005F90;75
Const $C_OCTAVEUP16_NOTEOFF = 0x00006090;76
Const $CSHARP_OCTAVEUP16_NOTEOFF = 0x00006190;77
Const $D_OCTAVEUP16_NOTEOFF = 0x00006290;78
Const $DSHARP_OCTAVEUP16_NOTEOFF = 0x00006390;79
Const $E_OCTAVEUP16_NOTEOFF = 0x00006490;80
Const $F_OCTAVEUP16_NOTEOFF = 0x00006590;81
Const $FSHARP_OCTAVEUP16_NOTEOFF = 0x00006690; 82
Const $G_OCTAVEUP16_NOTEOFF = 0x00006790; 83
Const $GSHARP_OCTAVEUP16_NOTEOFF = 0x00006890; 84
Const $A_OCTAVEUP16_NOTEOFF = 0x00006990 ;85
Const $ASHARP_OCTAVEUP16_NOTEOFF = 0x00006A90 ;86
Const $B_OCTAVEUP16_NOTEOFF = 0x00006B90 ;87
Const $C_OCTAVEUP32_NOTEOFF = 0x00006C90 ;88

;Instruments
#cs
        Grand Piano;0 ;modorate
        Bright Piano;1 ;piano
        Electric Grand Piano;2 ;forte
        Honky-Tonk Piano;3 ;modorate
        Electric piano 1; 4
        Electric Piano 2; 5
        Harpsichord;         6
        Clavinet;         7
        Celesta;         8
        Glockenspiel;         9
        Music Box;         10
        Vibraphone;         11
        Marimba;         12
        Xylophone;         13
        Tubular bells;         14
        Dulcimer;         15
        Drawbar Organ;         16
        Percussive Organ;        17
        Rock Organ;         18
        Church Organ;         19
        Reed Organ;         20
        Accordion;         21
        Harmonica;         22
        Tango Accordion;         23
        Nylon String Guitar;         24
        Steel String Guitar;         25
        Jazz Guitar;         26
        Clean Electric Guitar;         27
        Muted Electric Guitar;         28
        Overdrive Guitar;         29
        Distortion Guitar;         30
        Guitar Harmonics;         31
        Accoustic Bass;          32
        Fingered Bass;         33
        Picked Bass;         34
        Fretless Bass;         35
        Slap Bass 1;         36
        Slap Bass 2;        37
        Synth Bass 1;        38
        Synth Bass 2;        39
        Violin;         40
        Viola;         41
        Cello;         42
        Contrabass;         43
        Tremolo Strings;         44
        Pizzicato Strings; 45
        Orchestral Harp;         46
        Timpani;         47
        String Ensemble 1;         48
        String Ensemble 2; 49
        Synth Strings 1;         50
        Synth Strings 2;         51
        Choir ahh;         52
        Choir oohh;         53
        Synth Voice;         54
        Orchestral Hit;         55
        Trumpet;         56
        Trombone; 57
        Tuba;        58
        Muted Trumpet;         59
        French Horn;         60
        Brass Section;         61
        Synth Brass 1;         62
        Synth Brass 2;         63
        Soprano Sax;           64
        Alto Sax;         65
        Tenor Sax;         66
        Baritone Sax;         67
        Oboe;         68
        English Horn;         69
        Bassoon;         70
        Clarinet;         71
        Piccolo;         72
        Flute;         73
        Recorder;         74
        Pan flute;         75
        Blown Bottle;         76
        Shakuhachi;         77
        Whistle;         78
        Ocarina;         79
        Square Wave;         80
        Sawtooth Wave;         81
        Caliope;        82
        Chiff;         83
        Charang;         84
        Voice;         85
        Fifths;         86
        Bass & Lead;         87
        New Age;         88
        Warm;         89
        PolySynth;         90
        Choir;         91
        Bowed;         92
        Metallic; 93
        Halo;         94
        Sweep;         95
        FX: Rain;96
        FX: Soundtrack;97
        FX: Crystal;98
        FX: Atmosphere;99
        FX: Brightness;100
        FX: Goblins;101
        FX: Echo Drops;102
        FX: Star Theme;103
        Sitar;104
        Banjo;105
        Shamisen;106
        Koto;107
        Kalimba;108
        Bagpipe;109
        Fiddle;110
        Shanai;111
        Tinkle bell;112
        Agogo;113
        Steel Drums;114
        Woodblock;115
        Taiko Drum;116
        Melodic Tom;117
        Synth Drum;118
        Reverse Cymbal;119
        Guitar Fret Noise;120
        Breath Noise;121
        Seashore;122
        Bird Tweet;123
        Telephone Ring;124
        Helicopter;125
        Applause;126
        Gunshot;127

        Drums
        =====
        Range from 27 - 87
#ce


;THE FOLLOWING IS AN EXAMPLE ON HOW TO USE THE CONSTANTS...
;PIECE - 12 VARIATIONS (K.265,Ah! vous dirai-je maman) THEME
;Composer : Wolfgang Amadeus Mozart
;Resequenced by Eynstyne

;~ $open = _midiOutOpen()

;~ for $i = 27 to 87
;~         _MidiOutShortMsg($open,0x99 + ($i * 256) + (127 * 0x10000)) ; Drums Bitch!
;~         sleep(200)
;~         Next
;~ FOR $I = 1 TO 2
;~ _MidiOutShortMsg($open,256 * 16 + 192)
;~ $msg = _midioutshortmsg($open,$C_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$CBASS_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$C_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$C_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$G_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$E_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$G_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$C_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$A_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$F_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$A_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$C_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$G_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$E_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$G_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$C_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$F_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$D_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$F_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$B_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$E_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$C_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$E_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$A_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$D_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$FBASS_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$D_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$GBASS_NOTEON)
;~ sleep(300)
;~ $msg = _midioutshortmsg($open,$E_OCTAVEUP_NOTEON)
;~ sleep(175)
;~ $msg = _midioutshortmsg($open,$C_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$CBASS_NOTEON)
;~ sleep(1000)
;~ $msg = _midioutshortmsg($open,$CBASS_NOTEOFF)
;~ NEXT

;~ $msg = _midioutshortmsg($open,$G_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$E_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$G_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$GBASS_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$F_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$D_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$F_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$GBASS_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$E_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$C_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$E_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$GBASS_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$D_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$B_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$D_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$G_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$G_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$E_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$G_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$G_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$F_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$D_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$F_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$G_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$E_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$C_NOTEON)
;~ sleep(400)
;~ $msg = _midioutshortmsg($open,$F_OCTAVEUP_NOTEON)

;~ sleep(50)
;~ $msg = _midioutshortmsg($open,$E_OCTAVEUP_NOTEON)
;~ sleep(50)
;~ $msg = _midioutshortmsg($open,$D_OCTAVEUP_NOTEON)
;~ sleep(50)
;~ $msg = _midioutshortmsg($open,$E_OCTAVEUP_NOTEON)
;~ sleep(250)
;~ $msg = _midioutshortmsg($open,$F_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$D_NOTEON)
;~ sleep(150)
;~ $msg = _midioutshortmsg($open,$E_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$C_NOTEON)
;~ $msg = _midioutshortmsg($open,$GBASS_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$D_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$B_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$C_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$CBASS_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$C_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$C_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$G_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$E_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$G_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$C_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$A_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$F_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$A_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$C_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$G_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$E_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$G_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$C_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$F_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$D_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$F_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$B_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$E_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$C_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$E_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$A_NOTEON)
;~ sleep(500)
;~ $msg = _midioutshortmsg($open,$D_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$FBASS_NOTEON)
;~ sleep(400)
;~ $msg = _midioutshortmsg($open,$E_OCTAVEUP_NOTEON)
;~ sleep(50)
;~ $msg = _midioutshortmsg($open,$D_OCTAVEUP_NOTEON)
;~ sleep(50)
;~ $msg = _midioutshortmsg($open,$C_OCTAVEUP_NOTEON)
;~ sleep(50)
;~ $msg = _midioutshortmsg($open,$D_OCTAVEUP_NOTEON)
;~ sleep(250)
;~ $msg = _midioutshortmsg($open,$E_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$GBASS_NOTEON)
;~ sleep(150)
;~ $msg = _midioutshortmsg($open,$C_OCTAVEUP_NOTEON)
;~ $msg = _midioutshortmsg($open,$CBASS_NOTEON)
;~ sleep(1000)
;~ _MidiOutClose($open)

;=======================================================
;Retrieves the number of Midi Output devices which exist
;Parameters - None
;Author : Eynstyne
;Library : Microsoft winmm.dll
;=======================================================

Func _midiOutGetNumDevs()
        $ret = DllCall("winmm.dll", "long", "midiOutGetNumDevs")
        If Not @error Then Return $ret[0]
EndFunc   ;==>_midiOutGetNumDevs

;=======================================================
;Retrieves the number of Midi Input devices which exist
;Parameters - None
;Author : Eynstyne
;Library : Microsoft winmm.dll
;=======================================================

Func _midiInGetNumDevs($ReturnErrorAsString = 0) ;Working
        $ret = DllCall("winmm.dll", "long", "midiInGetNumDevs")
        If Not @error Then Return $ret[0]
EndFunc   ;==>_midiInGetNumDevs

;=======================================================
;Retrieves a MIDI handle and Opens the Device
;Parameters(Optional) - Device ID, Window Callback,
; instance, flags
;Author : Eynstyne
;Library : Microsoft winmm.dll
;=======================================================

Func _midiOutOpen($devid = 0, $callback = 0, $instance = 0, $flags = 0)

        $struct = DllStructCreate("udword")

        $ret = DllCall("winmm.dll", "long", "midiOutOpen", "ptr", DllStructGetPtr($struct), "int", $devid, "long", $callback, "long", $instance, "long", $flags)
        If Not @error Then
                $Get = DllStructGetData($struct, 1)
                Return $Get
        Else
                Return $ret[0]
        EndIf
EndFunc   ;==>_midiOutOpen

;=======================================================
;Retrieves a MIDI handle and Opens the Device
;Parameters(Optional) - Device ID, Window Callback,
; instance, flags
;Author : Eynstyne
;Library : Microsoft winmm.dll
;=======================================================

Func _midiInOpen($devid = 0, $callback = 0, $instance = 0, $flags = 0)

        $struct = DllStructCreate("udword")

        $ret = DllCall("winmm.dll", "long", "midiInOpen", "ptr", DllStructGetPtr($struct), "int", $devid, "long", $callback, "long", $instance, "long", $flags)
        If Not @error Then
                $Get = DllStructGetData($struct, 1)
                Return $Get
        Else
                Return $ret[0]
        EndIf
EndFunc   ;==>_midiInOpen

;=======================================================
;Sets the Mixer Volume for MIDI
;Parameters - Volume (0 - 65535)
;Author : Eynstyne
;Library : Microsoft winmm.dll
;=======================================================

Func _MidiOutSetVolume($volume, $devid = 0)
        $ret = DllCall("winmm.dll", "long", "midiOutSetVolume", "long", $devid, "int", $volume)
        If Not @error Then Return $ret[0]
EndFunc   ;==>_MidiOutSetVolume

;=======================================================
;Gets the Mixer Volume for MIDI
;Parameters - None
;Author : Eynstyne
;Library : Microsoft winmm.dll
;=======================================================

Func _MidiOutGetVolume($devid = 0)
        $struct = DllStructCreate("ushort")
        $ret = DllCall("winmm.dll", "long", "midiOutGetVolume", "long", $devid, "ptr", DllStructGetPtr($struct))
        If Not @error Then
                $Get = DllStructGetData($struct, 1)
                Return $Get
        EndIf
EndFunc   ;==>_MidiOutGetVolume

;=======================================================
;Resets MIDI Output/Input
;Parameters - MidiHandle
;Author : Eynstyne
;Library : Microsoft winmm.dll
;=======================================================

Func _MidiOutReset($hmidiout)
        $ret = DllCall("winmm.dll", "long", "midiOutReset", "long", $hmidiout)
        If Not @error Then Return $ret[0]
EndFunc   ;==>_MidiOutReset

Func _MidiInReset($hmidiin)
        $ret = DllCall("winmm.dll", "long", "midiInReset", "long", $hmidiin)
        If Not @error Then Return $ret[0]
EndFunc   ;==>_MidiInReset
;=======================================================
;Starts Midi Input
;Parameters - MidiHandle
;Author : Eynstyne
;Library : Microsoft winmm.dll
;=======================================================

Func _MidiInStart($hmidiin)
        $ret = DllCall("winmm.dll", "long", "midiInStart", "long", $hmidiin)
        If Not @error Then Return $ret[0]
EndFunc   ;==>_MidiInStart

;=======================================================
;Stops Midi Input
;Parameters - MidiHandle
;Author : Eynstyne
;Library : Microsoft winmm.dll
;=======================================================

Func _MidiInStop($hmidiin)
        $ret = DllCall("winmm.dll", "long", "midiInStop", "long", $hmidiin)
        If Not @error Then Return $ret[0]
EndFunc   ;==>_MidiInStop

;=======================================================
;Closes Midi Output/Input devices
;Parameters - MidiHandle
;Author : Eynstyne
;Library : Microsoft winmm.dll
;=======================================================
Func _MidiOutClose($hmidiout)
        $ret = DllCall("winmm.dll", "long", "midiOutClose", "long", $hmidiout)
        If Not @error Then Return $ret[0]
EndFunc   ;==>_MidiOutClose

Func _MidiInClose($hmidiin)
        $ret = DllCall("winmm.dll", "long", "midiInClose", "long", $hmidiin)
        If Not @error Then Return $ret[0]
EndFunc   ;==>_MidiInClose

;=======================================================
;Cache Drum Patches for Output
;Parameters - MidiHandle,Patch,Keynumber,Flag
;Author : Eynstyne
;Library : Microsoft winmm.dll
;=======================================================

Func _MidiOutCacheDrumPatches($hmidiout, $Patch, $keynumber, $flags = 0)
        $struct = DllStructCreate("short")
        $keyarray = _ArrayCreate($keynumber)
        DllStructSetData($struct, 1, $keynumber)

        $ret = DllCall("winmm.dll", "long", "midiOutCacheDrumPatches", "long", $hmidiout, "int", $Patch, "ptr", DllStructGetPtr($struct), "int", $flags)
        If Not @error Then Return $ret[0]

EndFunc   ;==>_MidiOutCacheDrumPatches

;=======================================================
;Caches MIDI Patches
;Parameters - MidiHandle, Bank, PatchNumber, Flags
;Author : Eynstyne
;Library : Microsoft winmm.dll
;=======================================================

Func _MidiOutCachePatches($hmidiout, $bank, $patchnumber, $flags = 0)
        $struct = DllStructCreate("short")
        $patcharray = _ArrayCreate($patchnumber)
        DllStructSetData($struct, 1, $patchnumber)

        $ret = DllCall("winmm.dll", "long", "midiOutCachePatches", "long", $hmidiout, "int", $bank, "ptr", DllStructGetPtr($struct), "int", $flags)
        If Not @error Then Return $ret[0]
EndFunc   ;==>_MidiOutCachePatches


;=======================================================
;Gets MIDI DeviceID
;Parameters - MidiHandle
;Author : Eynstyne
;Library : Microsoft winmm.dll
;=======================================================

Func _MidiInGetID($hmidiin)
        $struct = DllStructCreate("uint")
        $ret = DllCall("winmm.dll", "long", "midiInGetID", "long", $hmidiin, "ptr", DllStructGetPtr($struct))

        If Not @error Then
                $Get = DllStructGetData($struct, 1)
                Return $Get
        EndIf
EndFunc   ;==>_MidiInGetID


Func _MidiOutGetID($hmidiout)
        $struct = DllStructCreate("uint")
        $ret = DllCall("winmm.dll", "long", "midiInGetID", "long", $hmidiout, "ptr", DllStructGetPtr($struct))

        If Not @error Then
                $Get = DllStructGetData($struct, 1)
                Return $Get
        EndIf
EndFunc   ;==>_MidiOutGetID

;=======================================================
;Translates Error codes into Plaintext
;Parameters - Error number
;Author : Eynstyne
;Library : Microsoft winmm.dll
;=======================================================

Func _MidiInGetErrorText($error)
        $struct = DllStructCreate("char[128]")
        $ret = DllCall("winmm.dll", "long", "midiInGetErrorText", "int", $error, "ptr", DllStructGetPtr($struct), "int", 999)
        $Get = DllStructGetData($struct, 1)
        MsgBox(0, "", $Get)
EndFunc   ;==>_MidiInGetErrorText

Func _MidiOutGetErrorText($error)
        $struct = DllStructCreate("char[128]")
        $ret = DllCall("winmm.dll", "long", "midiOutGetErrorText", "int", $error, "ptr", DllStructGetPtr($struct), "int", 999)
        $Get = DllStructGetData($struct, 1)
        MsgBox(0, "", $Get)
EndFunc   ;==>_MidiOutGetErrorText

;=======================================================
;MIDI Message Send Function
;Parameters - Message as Hexcode or Constant
;Author : Eynstyne
;Library : Microsoft winmm.dll
;=======================================================

Func _MidiOutShortMsg($hmidiout, $msg)
        $ret = DllCall("winmm.dll", "long", "midiOutShortMsg", "long", $hmidiout, "long", $msg)
        If Not @error Then Return $ret[0]
EndFunc   ;==>_MidiOutShortMsg

Func _MidiOutLongMsg($hmidiout, $data, $bufferlength, $bytesrecorded, $user, $flags, $next, $getmmsyserr = 0)
        $struct = DllStructCreate("char[128];udword;udword;udword;udword;ushort;ushort")
        DllStructSetData($struct, 1, $data)
        DllStructSetData($struct, 2, $bufferlength)
        DllStructSetData($struct, 3, $bytesrecorded)
        DllStructSetData($struct, 4, $user)
        DllStructSetData($struct, 5, $flags)
        DllStructSetData($struct, 6, $next)
        DllStructSetData($struct, 7, 0)

        $ret = DllCall("winmm.dll", "long", "midiInPrepareHeader", "long", $hmidiout, "ptr", DllStructGetPtr($struct), "long", 999)
        If Not @error Then
                If $getmmsyserr = 1 Then
                        Return $ret[0]
                ElseIf $getmmsyserr <> 1 Then
                        $array = _ArrayCreate($hmidiout, DllStructGetData($struct, 1), DllStructGetData($struct, 2), DllStructGetData($struct, 3), DllStructGetData($struct, 4), DllStructGetData($struct, 5), DllStructGetData($struct, 6), DllStructGetData($struct, 7))
                        Return $array
                EndIf
        EndIf

EndFunc   ;==>_MidiOutLongMsg

;=======================================================
;Get the Capabilities of the MIDI Device
;Parameters - DeviceID
;Author : Eynstyne
;Library : Microsoft winmm.dll
;First Value - Manufacturer ID
;Second Value - Product ID
;Third Value - Driver Version
;Fourth Value - Driver Name
;Fifth Value - Type of Device
;Sixth Value - Voices
;Seventh Value - Notes
;eighth Value - Channel Mask
;Ninth Value - Capabilities
;=======================================================

Func _MidiOutGetDevCaps($deviceid = 0, $getmmsyserr = 0)
        $struct = DllStructCreate("ushort;ushort;uint;char[128];ushort;ushort;ushort;ushort;uint")
        $ret = DllCall("winmm.dll", "long", "midiOutGetDevCapsA", "long", $deviceid, "ptr", DllStructGetPtr($struct), "int", 999)
        If Not @error Then
                If $getmmsyserr = 1 Then
                        Return $ret[0]
                ElseIf $getmmsyserr <> 1 Then
                        $array = _ArrayCreate(DllStructGetData($struct, 1), DllStructGetData($struct, 2), DllStructGetData($struct, 3), DllStructGetData($struct, 4), DllStructGetData($struct, 5), DllStructGetData($struct, 6), DllStructGetData($struct, 7), DllStructGetData($struct, 8), DllStructGetData($struct, 9))
                        Return $array
                EndIf
        EndIf
EndFunc   ;==>_MidiOutGetDevCaps

;=======================================================
;Get the Capabilities of the MIDI Device Input
;Parameters - DeviceID
;Author : Eynstyne
;Library : Microsoft winmm.dll
;First Value - Manufacturer ID
;Second Value - Product ID
;Third Value - Driver Version
;Fourth Value - Driver Name
;=======================================================

Func _MidiInGetDevCaps($deviceid = 0, $getmmsyserr = 0)
        $struct = DllStructCreate("ushort;ushort;uint;char[128]")
        $ret = DllCall("winmm.dll", "long", "midiInGetDevCapsA", "long", $deviceid, "ptr", DllStructGetPtr($struct), "int", 999)
        If Not @error Then
                If $getmmsyserr = 1 Then
                        Return $ret[0]
                ElseIf $getmmsyserr <> 1 Then
                        $array = _ArrayCreate(DllStructGetData($struct, 1), DllStructGetData($struct, 2), DllStructGetData($struct, 3), DllStructGetData($struct, 4))
                        Return $array
                EndIf
        EndIf
EndFunc   ;==>_MidiInGetDevCaps

;========================================================
;Connect/Disconnect the MIDI Device to Application Source
; / Dest.
;Parameters - MidiHandleIn, MidiHandleOut
;Author: Eynstyne
;Library : Microsoft winmm.dll
;========================================================

Func _MidiConnect($hmidiin, $hmidiout)
        $ret = DllCall("winmm.dll", "long", "midiConnect", "long", $hmidiin, "long", $hmidiout, "int", 0)
        If Not @error Then Return $ret[0]
EndFunc   ;==>_MidiConnect

Func _MidiDisconnect($hmidiin, $hmidiout)
        $ret = DllCall("winmm.dll", "long", "midiDisconnect", "long", $hmidiin, "long", $hmidiout, "int", 0)
        If Not @error Then Return $ret[0]
EndFunc   ;==>_MidiDisconnect

;========================================================
;Prepare/Unprepare the MIDI header
;Parameters - MidiInHandle,Data,Bufferlength,
; BytesRecorded,User,Flags,Next,Getmmsystemerror
;Author:Eynstyne
;Library:Microsoft winmm.dll
;========================================================

Func _MidiInPrepareHeader($hmidiin, $data, $bufferlength, $bytesrecorded, $user, $flags, $next, $getmmsyserr = 0)
        $struct = DllStructCreate("char[128];udword;udword;udword;udword;ushort;ushort")
        DllStructSetData($struct, 1, $data)
        DllStructSetData($struct, 2, $bufferlength)
        DllStructSetData($struct, 3, $bytesrecorded)
        DllStructSetData($struct, 4, $user)
        DllStructSetData($struct, 5, $flags)
        DllStructSetData($struct, 6, $next)
        DllStructSetData($struct, 7, 0)

        $ret = DllCall("winmm.dll", "long", "midiInPrepareHeader", "long", $hmidiin, "ptr", DllStructGetPtr($struct), "long", 999)
        If Not @error Then
                If $getmmsyserr = 1 Then
                        Return $ret[0]
                ElseIf $getmmsyserr <> 1 Then
                        $array = _ArrayCreate($hmidiin, DllStructGetData($struct, 1), DllStructGetData($struct, 2), DllStructGetData($struct, 3), DllStructGetData($struct, 4), DllStructGetData($struct, 5), DllStructGetData($struct, 6), DllStructGetData($struct, 7))
                        Return $array
                EndIf
        EndIf

EndFunc   ;==>_MidiInPrepareHeader

Func _MidiInUnprepareHeader($hmidiin, $data, $bufferlength, $bytesrecorded, $user, $flags, $next, $getmmsyserr = 0)
        $struct = DllStructCreate("char[128];udword;udword;udword;udword;ushort;ushort")
        DllStructSetData($struct, 1, $data)
        DllStructSetData($struct, 2, $bufferlength)
        DllStructSetData($struct, 3, $bytesrecorded)
        DllStructSetData($struct, 4, $user)
        DllStructSetData($struct, 5, $flags)
        DllStructSetData($struct, 6, $next)
        DllStructSetData($struct, 7, 0)
        $ret = DllCall("winmm.dll", "long", "midiInUnprepareHeader", "long", $hmidiin, "ptr", DllStructGetPtr($struct), "long", 999)
        If Not @error Then
                If $getmmsyserr = 1 Then
                        Return $ret[0]
                ElseIf $getmmsyserr <> 1 Then
                        $array = _ArrayCreate($hmidiin, DllStructGetData($struct, 1), DllStructGetData($struct, 2), DllStructGetData($struct, 3), DllStructGetData($struct, 4), DllStructGetData($struct, 5), DllStructGetData($struct, 6), DllStructGetData($struct, 7))
                        Return $array
                EndIf
        EndIf

EndFunc   ;==>_MidiInUnprepareHeader

;========================================================
;Add buffer to Midi Header
;Parameters - MidiInHandle,Data,Bufferlength,
; BytesRecorded,User,Flags,Next,Getmmsystemerror
;Author:Eynstyne
;Library:Microsoft winmm.dll
;========================================================

Func _MidiInAddBuffer($hmidiin, $data, $bufferlength, $bytesrecorded, $user, $flags, $next, $getmmsyserr = 0)
        $struct = DllStructCreate("char[128];udword;udword;udword;udword;ushort;ushort")
        DllStructSetData($struct, 1, $data)
        DllStructSetData($struct, 2, $bufferlength)
        DllStructSetData($struct, 3, $bytesrecorded)
        DllStructSetData($struct, 4, $user)
        DllStructSetData($struct, 5, $flags)
        DllStructSetData($struct, 6, $next)
        DllStructSetData($struct, 7, 0)

        $ret = DllCall("winmm.dll", "long", "midiInAddBuffer", "long", $hmidiin, "ptr", DllStructGetPtr($struct), "long", 999)
        If Not @error Then
                If $getmmsyserr = 1 Then
                        Return $ret[0]
                ElseIf $getmmsyserr <> 1 Then
                        $array = _ArrayCreate($hmidiin, DllStructGetData($struct, 1), DllStructGetData($struct, 2), DllStructGetData($struct, 3), DllStructGetData($struct, 4), DllStructGetData($struct, 5), DllStructGetData($struct, 6), DllStructGetData($struct, 7))
                        Return $array
                EndIf
        EndIf
EndFunc   ;==>_MidiInAddBuffer

;========================================================
;Sends Internal MIDI Info to Input / Output device
;Parameters - MidiInHandle,message, parameter1, parameter2
;Author:Eynstyne
;Library:Microsoft winmm.dll
;========================================================

Func _MidiInMessage($hmidiin, $msg, $dw1 = 0, $dw2 = 0)
        $ret = DllCall("winmm.dll", "long", "midiInMessage", "long", $hmidiin, "long", $msg, "long", $dw1, "long", $dw2)
        If Not @error Then Return $ret[0]
EndFunc   ;==>_MidiInMessage

Func _MidiOutMessage($hmidiout, $msg, $dw1 = 0, $dw2 = 0)
        $ret = DllCall("winmm.dll", "long", "midiOutMessage", "long", $hmidiout, "long", $msg, "long", $dw1, "long", $dw2)
        If Not @error Then Return $ret[0]
EndFunc   ;==>_MidiOutMessage


;====================
;Stream Functions
;====================

Func _midiStreamClose($hmidiStream)
        $ret = DllCall("winmm.dll", "long", "midiStreamClose", "long", $hmidiStream)
        If Not @error Then Return $ret[0]
EndFunc   ;==>_midiStreamClose

Func _midiStreamOpen($cMidi = 0, $callback = 0, $instance = 0, $fdwopen = 0, $getmmsyserr = 0)
        $struct = DllStructCreate("udword;uint")
        $ret = DllCall("winmm.dll", "long", "midiStreamOpen", "ptr", DllStructGetPtr($struct, 1), "ptr", DllStructGetPtr($struct, 2), "long", $cMidi, "long", $callback, "long", $instance, "long", $fdwopen)
        If Not @error Then
                If $getmmsyserr = 1 Then
                        Return $ret[0]
                ElseIf $getmmsyserr <> 1 Then
                        $array = _ArrayCreate(DllStructGetData($struct, 1), DllStructGetData($struct, 2))
                        Return $array
                EndIf
        EndIf
EndFunc   ;==>_midiStreamOpen

Func _midiStreamPause($hmidiStream)
        $ret = DllCall("winmm.dll", "long", "midiStreamPause", "long", $hmidiStream)
        If Not @error Then Return $ret[0]
EndFunc   ;==>_midiStreamPause


Func _midiStreamPos($hmidiStream, $cbmmt = 0, $getmmsyserr = 0)
        $struct = DllStructCreate("ushort;ushort")
        $ret = DllCall("winmm.dll", "long", "midiStreamPause", "long", $hmidiStream, "ptr", DllStructGetPtr($struct), "long", $cbmmt)
        If Not @error Then

                If $getmmsyserr = 1 Then
                        Return $ret[0]
                ElseIf $getmmsyserr <> 1 Then
                        $array = _ArrayCreate(DllStructGetData($struct, 1), DllStructGetData($struct, 2))
                        Return $array
                EndIf
        EndIf
EndFunc   ;==>_midiStreamPos


Func _midiStreamRestart($hmidiStream)
        $ret = DllCall("winmm.dll", "long", "midiStreamRestart", "long", $hmidiStream)
        If Not @error Then Return $ret[0]
EndFunc   ;==>_midiStreamRestart

Func _midiStreamStop($hmidiStream)
        $ret = DllCall("winmm.dll", "long", "midiStreamStop", "long", $hmidiStream)
        If Not @error Then Return $ret[0]
EndFunc   ;==>_midiStreamStop

Func _midiStreamProperty($hmidiStream, $property = 0, $getmmsyserr = 0)
;~                 Local $getmmsyserr
        $struct = DllStructCreate("byte")
        $ret = DllCall("winmm.dll", "long", "midiStreamProperty", "long", $hmidiStream, "ptr", DllStructGetPtr($struct), "long", $property)
        If Not @error Then
                If $getmmsyserr = 1 Then
                        Return $ret[0]
                ElseIf $getmmsyserr <> 1 Then
                        $Get = DllStructGetData($struct, 1)
                        Return $Get
                EndIf
        EndIf
EndFunc   ;==>_midiStreamProperty
发表于 2009-8-11 15:10:10 | 显示全部楼层
果然强悍啊
发表于 2009-10-31 15:40:20 | 显示全部楼层
好长啊~~~~~~~~~
发表于 2009-11-13 21:49:01 | 显示全部楼层
听到这个音乐好怀旧啊
发表于 2022-3-8 22:21:16 | 显示全部楼层
lpxx 发表于 2009-8-11 14:28
1# lpxx
Midiudf.au3

好长的一段代码呀
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-30 06:22 , Processed in 0.082579 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表