GithubHelp home page GithubHelp logo

tebjan / sanford.multimedia.midi Goto Github PK

View Code? Open in Web Editor NEW
167.0 167.0 63.0 1.98 MB

Full sources of the famous C# MIDI toolkit on CodeProject by Leslie Sanford

Home Page: http://www.codeproject.com/Articles/6228/C-MIDI-Toolkit

License: MIT License

C# 100.00%
c-sharp codeproject leslie-sanford midi midi-toolkit

sanford.multimedia.midi's Introduction

sanford.multimedia.midi's People

Contributors

afdeprado avatar iainmnorman avatar jhnnslmk avatar kavinski avatar lvmcastro avatar sidiandi avatar soundgoddess avatar tebjan avatar thekingeagle avatar victorkoehler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sanford.multimedia.midi's Issues

Winmm Issue

In the README as well as on Nuget it states that this project "works on Mono" which is not the case for other non-Windows platforms since winmm.dll is required for this library to work (unless I've missed something).

.Net v4.5 Version

Hi,
I'm trying to compile this for .Net v4.5/4.6, but there is an interop issue that causes an exception on the following line in the InputDeviceMessaging.cs file (line 152):

MidiHeader header = (MidiHeader)Marshal.PtrToStructure(headerPtr, typeof(MidiHeader));

The exception is:
Additional information: The runtime has encountered a fatal error. The address of the error was at 0x24e7cfa4, on thread 0x108c. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.

I'm obviously not an interop expert, so I was wondering if you knew of a workaround for this exception?

Thanks.

Error when starting midi file in debug mode

When starting the SequencerDemo in debug mode, I get an error as soon as I try to play a loaded midi file:
at MidiFileProperties.AssertValid() ... (248)

It's in this code, the last line "Debug.Assert(Division >= PpqnClock.PpqnMinValue);":

    [Conditional("DEBUG")]
    private void AssertValid()
    {
        if(trackCount > 1)
        {
            Debug.Assert(Format == 1 || Format == 2);
        }

        if(IsSmpte(Division))
        {
            Debug.Assert(SequenceType == SequenceType.Smpte);
        }
        else
        {
            Debug.Assert(SequenceType == SequenceType.Ppqn);
            Debug.Assert(Division >= PpqnClock.PpqnMinValue);
        }
    }

Commenting out this line solves the problem for me. I don't really understand what's going on on this part of the code. I just wanted to give some feedback.

Just a side note. I have seen, that the demo code still comes with a target of .Net framework 2. Is there a reason for v2? Could I also go with v4.5?

Close a disconnected MIDI device?

What is the best way to close a disconnected MIDI device? because if I call _inDevice?.StopRecording(); when the device has already been disconnected an exception is raised.

FatalExecutionEngineError 0xc0000005

Hi,

When I try to close an inputDevice I get this error:

FatalExecutionEngineError
Adress = 0x4aabcfa4
FaultCode = 0xc0000005

I don't know what this means. Or what I am doing wrong? This is the way how I do it at the moment:

        public void StopListeningMidi()
        {
            _inDevice?.StopRecording();
            _inDevice?.Close();
        }

also this way doesn't work

        public void StopListeningMidi()
        {
            _inDevice?.StopRecording();
            _inDevice?.Reset();
            _inDevice?.Close();
        }

Can someone help me how I close an inputDevice correctly?

Changing the tempo

I would like to be able to speed up and slow down a song as it's playing. I've seen a number of posts requesting help with Tempo, but never saw any solutions to this problem.

I have found a get/set method in the class:
Sanford.Multimedia.Midi.MidiInternalClock
for the MidiInternalClock values, but I am unable to access both the Tempo and MidiInternalClock from my code.

How would one go about implementing changing the tempo of a playing sequence?

Win 7

I have been using your library with VS2015 to port a Mac App over to Windows. You mention it supports Win 8 /10 specifically but my friend is requiring Win 7 as lots if not most music professionals still use this alas. When I look at the properties of your sample Apps I see a requirement for .NET 2.0. Win 7 uses .NET 3.5 so I figure I'm OK here in that .NET 2.0 would be compatible with .NET 3.5.

I did a test build of MidiMontor using VS2013 and .NET3.5 on Win 10 and it crashes on Win 7, so my question is should this all work ok, using .NET 3.5 for Win7.

'FatalExecutionEngineError receiving a sysex message "F0 00 01 00 03 01 01 00 05 F7"

I get this exception when running C# VS2015, .NET 4.0 (Win 7 support). I downloaded and built the lib and also just tried NuGet, both have the same problem.

If I run the App outside VS using either Release or Debug builds everything is working?

InpuDevice.Messaging.cs - PtrToStrucure line:

 private void HandleSysExMessage(object state)
        {
            lock(lockObject)
            {
                IntPtr headerPtr = (IntPtr)state;

                MidiHeader header = (MidiHeader)Marshal.PtrToStructure(headerPtr, typeof(MidiHeader));

Install-Package Sanford.Multimedia.Midi

PM> Install-Package Sanford.Multimedia.Midi
Attempting to gather dependency information for package 'Sanford.Multimedia.Midi.6.1.1' with respect to project 'MKConnectUI', targeting '.NETFramework,Version=v4.0'
Attempting to resolve dependencies for package 'Sanford.Multimedia.Midi.6.1.1' with DependencyBehavior 'Lowest'
Resolving actions to install package 'Sanford.Multimedia.Midi.6.1.1'
Resolved actions to install package 'Sanford.Multimedia.Midi.6.1.1'
Adding package 'Sanford.Multimedia.Midi.6.1.1' to folder '\vmware-host\Shared Folders\Desktop\MKConnect2 - Copy\packages'
Added package 'Sanford.Multimedia.Midi.6.1.1' to folder '\vmware-host\Shared Folders\Desktop\MKConnect2 - Copy\packages'
Added package 'Sanford.Multimedia.Midi.6.1.1' to 'packages.config'
Successfully installed 'Sanford.Multimedia.Midi 6.1.1' to MKConnectUI
PM>

Play one Note/Beat forwards or back

Is it possible to control the execution of a MIDI track for both note and beat( in C#(going back and forth)?

My problem is create an function that allows me to go back and forth a MIDI track both by note and by beats.

Thanks in advice!

Format 3 (invalid) is not prevented

In MidiFileProperties.Format:

        public int Format
        {
            get
            {
                return format;
            }
            set
            {
                #region Require

                if(value < 0 || value > 3)
                {
                    throw new ArgumentOutOfRangeException("Format", value,
                        "MIDI file format out of range.");
                }
                else if(value == 0 && trackCount > 1)
                {
                    throw new ArgumentException(
                        "MIDI file format invalid for this track count.");
                }

                #endregion

                format = value;

                #region Invariant

                AssertValid();

                #endregion
            }
        }

value > 3 would not throw for format 3, which is an invalid format.

Doesn't work when upgrading to beyond .NET 3.5

Hello,

I tried to run the midi watcher application in .NET 4.6.1. This causes the midi watcher app to fail when clicking the start button.

If I force the app to run 32-bit then it works flawlessly, so I assume it's a 64-bit issue.

I can see that you are working with CKKING on some fixes to the header structs. Any chance either of those will fix this issue?

Big delay

I am experiencing a big delay when changing values from my midicontroller traktor kontrol f1 (mostly with faders and potentiometers). Is this normal or should the changes be instantly?

Do I need to handle my code in another thread? Or is the callback already in another thread? Maybe I am doing to much work in the callback? What do you think may cause this issue?

Device ID out of range (wine)

Using this library indirectly via MontyLeGueux/Lutebot-2, using wine-4.17 on Fedora 30, I always get this error:

Sanford.Multimedia.Midi.OutputDeviceException: A device ID has been used that is out of range for your system.
  at Sanford.Multimedia.Midi.OutputDevice..ctor (System.Int32 deviceID) [0x00056] in <b6d7dddb68bd429491388919abe6639c>:0 

I understand that this is likely a problem with the other software, butโ€”what does this error mean?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.