Jump to content

Midi In Example


Recommended Posts

Howdy All

Im wanting to use Cubase SX/Midi (via loopmidi virtual cable) to drive usb 8 channel (FTD2XX.dll_UDF.au3). So far, the FTD udf is working great. Now I simply want to use the midi udf to trap midi in.

ie Any note on/off event will have its channel (0-7) used to add/sub bit operations to address the relay number and note velocity to turn on and off.

Does anyone have a simple example??? Scoured without success

I was thinking of something like (incomplete snippet to give an idea) this to send to the controller board

Func SetRelayState($NoteChan, $NoteVel)
    If ($NoteVel > 0) Then
        $RelayState = BitOR ($RelayState, $NoteChan)
    Else
        ;0 velocity = note off
        $RelayState = BitXOR ($RelayState, $NoteChan)
    Endif

    ;Set inits for serial write to control relay
    DllStructSetData($lpBuffer, 1, Chr($RelState))
    $dwBytesToWrite = StringLen(Chr($RelState))
    ; this uses 8 bits to set each relay eg 00000001 = relay 1 etc
    $Do = _FT_Write($FT_HANDLE, $lpBuffer, $dwBytesToWrite, $lpdwBytesWritten)
EndFunc

So, in abstract I just want to do something like this (snippet from old vbs > midiox I did)

Sub Sink_MidiInput( ts, port, stat, dat1, dat2) 'ts = timestamp, port, stat = status eg note, ctrl etc
    'Divide  notes into appropriate subs 'notenum on #13 
    If Port = FCBIn Then
        'Sort MsgType and Chn here
        Chn = stat AND &h0F
        mMsgType = stat AND &hF0 
        Select Case Stat
            ' ---- notes on chan1
            Case &h90
                            ' Call SetRelayState from here

                End Select
        End If
End Sub

In other words, an example of code showing reading midi input, is it a sink/event driven structure or is it a loop reading the stream etc

Hope that make sense

Many thanks for any input

Edited by Architerion
Link to comment
Share on other sites

  • 2 months later...

So absolutely no help???

All that time spent making beautiful UDFs and no examples on the deeper level stuff...hmm shame but ok...will move on I guess and use something a bit more supported.

Edited by Architerion
Link to comment
Share on other sites

  • Moderators

Architerion,

If no-one has answered it is because no-one knows the solution or no-one is interested enough to work on it - it does look like a very niche request. Remember that what is important to you is not necessarily so to others - and also that you paid nothing to use AutoIt or to post here, so no-one among the volunteer responders here has any obligation to offer you any help at all. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • 2 weeks later...

Architerion,

If no-one has answered it is because no-one knows the solution or no-one is interested enough to work on it - it does look like a very niche request. Remember that what is important to you is not necessarily so to others - and also that you paid nothing to use AutoIt or to post here, so no-one among the volunteer responders here has any obligation to offer you any help at all. ;)

M23

I guess you are right. It just seems a waste of others time when many people have gone to a lot of trouble to do the midi udf work and there doesnt seem to be one example of its use. 

The examples I gave obscure a very simple request, on second look...but the question remains; Is there one example of using midi in? Specifically the use of a callback.

Im happy to pay someone for their example script...

Thanks

Link to comment
Share on other sites

I think part of the problem is that not many people have 'midi out' capable instruments, so testing a 'midi in' example is (perhaps) somewhat problematic. I suggest you look at examples on music coding forums and search MSDN.

Hi czardas,

thanks for your reply. A test input can be easily achieved by using a free prog eg midiox and a virtual midi loop back eg loopbe. Have had a look at the resources but its handling dlls and I want to stay with the simple syntax of autoit rather than spending my time wading through another level. Hence why its better use of resource to simply pay someone for the startup info.

Cheers

mark

Link to comment
Share on other sites

  • 2 years later...
  • 5 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...