Thread overview
Midi in D
Jan 24, 2006
Adma
Jan 24, 2006
clayasaurus
Jan 24, 2006
James Dunne
January 24, 2006
Just wondering if D has Midi capabilities, Currently I work with C++ and use MidiOutShortMsg... etc, functions like that, does D have any midi functions or another sound library that can output variable frequencies or notes?


January 24, 2006
It looks like those are C functions, all of which can be accessed by D.

My suggestion is to load winmm.dll functions at runtime and then use them in D like you would in C++.

This takes a little bit of work as you have to declare the functions and then load them through winmm.dll in your code. The Derelict project is a good example of how to do this ( http://svn.dsource.org/projects/derelict/trunk/DerelictSDLMixer/derelict/sdl/mixer.d for how you can declare C functions that you can load and use) and ( http://svn.dsource.org/projects/derelict/trunk/DerelictUtil/derelict/util/  for how you can load these functions).

Or you could find a Midi library in C or C++ and create D headers and wrappers for them.

Adma wrote:
> Just wondering if D has Midi capabilities, Currently I work with C++ and use
> MidiOutShortMsg... etc, functions like that, does D have any midi functions or
> another sound library that can output variable frequencies or notes?
> 

January 24, 2006
clayasaurus wrote:
> It looks like those are C functions, all of which can be accessed by D.
> 
> My suggestion is to load winmm.dll functions at runtime and then use them in D like you would in C++.
> 
> This takes a little bit of work as you have to declare the functions and then load them through winmm.dll in your code. The Derelict project is a good example of how to do this ( http://svn.dsource.org/projects/derelict/trunk/DerelictSDLMixer/derelict/sdl/mixer.d for how you can declare C functions that you can load and use) and ( http://svn.dsource.org/projects/derelict/trunk/DerelictUtil/derelict/util/  for how you can load these functions).
> 
> Or you could find a Midi library in C or C++ and create D headers and wrappers for them.
> 
> Adma wrote:
> 
>> Just wondering if D has Midi capabilities, Currently I work with C++ and use
>> MidiOutShortMsg... etc, functions like that, does D have any midi functions or
>> another sound library that can output variable frequencies or notes?
>>
> 

Don't forget about ALSA's sequencer API, or possibly OSS's sequencer support.

Now, if you're wondering about loading Standard MIDI File formats, I think I can help you there.  Or, gut some code out from the free timidity++ project (straight C code - easy to extract), which is what I did.