I am a newbie in kernel-streaming topics and the drivers...
All I need is to play a midi-note in windows kernel-mode. Like
MidiOutShortMessage in WinAPI.
Where can I read the manuals or examles? Must I use IMiniport
interfaces or
create complex streams? But how to use this IMiniport interfaces I
don't
understand completely.
All I understand now is to find some PortMidi in system, create a new
stream
in his Mimiport and to write data. But I don't knpw how to find this
Port. I
think, there is no need in creating new port.

Can you give me code-examples or even ready code? It is easier to
understand
topics with examples.
I must implement this in coming days, it is my home task in university.



--
Avtoritet
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Re: How to send a simple MIDI-note on a soundcard? by Maxim

Maxim
Mon May 15 23:39:59 CDT 2006

Use a helper user app (started from the shell's Run key), which is turnable
off :-) there is nothing more annoying then the computer making some sounds
even without a logged on user :-)

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"Avtoritet" <Avtoritet.27vqhq@mail.codecomments.com> wrote in message
news:Avtoritet.27vqhq@mail.codecomments.com...
>
> I am a newbie in kernel-streaming topics and the drivers...
> All I need is to play a midi-note in windows kernel-mode. Like
> MidiOutShortMessage in WinAPI.
> Where can I read the manuals or examles? Must I use IMiniport
> interfaces or
> create complex streams? But how to use this IMiniport interfaces I
> don't
> understand completely.
> All I understand now is to find some PortMidi in system, create a new
> stream
> in his Mimiport and to write data. But I don't knpw how to find this
> Port. I
> think, there is no need in creating new port.
>
> Can you give me code-examples or even ready code? It is easier to
> understand
> topics with examples.
> I must implement this in coming days, it is my home task in university.
>
>
>
> --
> Avtoritet
> ------------------------------------------------------------------------
> Posted via http://www.codecomments.com
> ------------------------------------------------------------------------
>


Re: How to send a simple MIDI-note on a soundcard? by Avtoritet

Avtoritet
Tue May 16 10:48:02 CDT 2006

Ð?а знаÑ? Ñ?, не издевайÑ?Ñ?, Ñ?Ñ?о Ñ?Ñ?о бÑ?ед. Ð?адание на кÑ?Ñ?Ñ?аÑ? Ñ?акое... :)

I thought it would be easy to access sound card via kernel streaming. But
reading DirectKS code, I understand that it is not so. Implementing the same
with kernel-mode functions is not so fast... (а Ñ?Ñ?оки поджимаÑ?Ñ? наÑ?иг).

May I create a Miniport driver like in src\wdm\audio\mpu401 sample with my
custom IOCTL codes such as IOCTL_WRITE_MIDI? In this driver a can use some
MiniportMidiStream:Write methods.
Can I create a symbol link to such a driver like \\Device\\my_miniport_midi
and use it in driver clients?

"Maxim S. Shatskih" wrote:

> Use a helper user app (started from the shell's Run key), which is turnable
> off :-) there is nothing more annoying then the computer making some sounds
> even without a logged on user :-)
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@storagecraft.com
> http://www.storagecraft.com
>
> "Avtoritet" <Avtoritet.27vqhq@mail.codecomments.com> wrote in message
> news:Avtoritet.27vqhq@mail.codecomments.com...
> >
> > I am a newbie in kernel-streaming topics and the drivers...
> > All I need is to play a midi-note in windows kernel-mode. Like
> > MidiOutShortMessage in WinAPI.
> > Where can I read the manuals or examles? Must I use IMiniport
> > interfaces or
> > create complex streams? But how to use this IMiniport interfaces I
> > don't
> > understand completely.
> > All I understand now is to find some PortMidi in system, create a new
> > stream
> > in his Mimiport and to write data. But I don't knpw how to find this
> > Port. I
> > think, there is no need in creating new port.
> >
> > Can you give me code-examples or even ready code? It is easier to
> > understand
> > topics with examples.
> > I must implement this in coming days, it is my home task in university.
> >
> >
> >
> > --
> > Avtoritet
> > ------------------------------------------------------------------------
> > Posted via http://www.codecomments.com
> > ------------------------------------------------------------------------
> >
>
>

Re: How to send a simple MIDI-note on a soundcard? by BobF

BobF
Tue May 16 11:04:44 CDT 2006


see
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_midioutopen.asp>

to find the port you want, you can do something similar to:

// get the number of MIDI out devices
m_midiOutCount = midiOutGetNumDevs();

// cycle through the available devices
// adding the names to a listbox for selection
MIDIOUTCAPS outCapStruct;
for (UINT i = 0; i < m_midiOutCount; i++)
{
midiOutGetDevCaps(i, &outCapStruct, sizeof(MIDIOUTCAPS));
m_OutCombo.AddString(outCapStruct.szPname);
}

Based on your stated goal, it doesn't sound to me like you need to create a
driver. If I have this wrong, please disregard :-)



On Tue, 16 May 2006 08:48:02 -0700, Avtoritet wrote:

> ´Ð ×ÝÐî ï, ÝÕ Ø×ÔÕÒÐÙáï, çâÞ íâÞ ÑàÕÔ. ·ÐÔÐÝØÕ ÝÐ ÚãàáÐç âÐÚÞÕ... :)
>
> I thought it would be easy to access sound card via kernel streaming. But
> reading DirectKS code, I understand that it is not so. Implementing the same
> with kernel-mode functions is not so fast... (Ð áàÞÚØ ßÞÔÖØÜÐîâ ÝÐäØÓ).
>
> May I create a Miniport driver like in src\wdm\audio\mpu401 sample with my
> custom IOCTL codes such as IOCTL_WRITE_MIDI? In this driver a can use some
> MiniportMidiStream:Write methods.
> Can I create a symbol link to such a driver like \\Device\\my_miniport_midi
> and use it in driver clients?
>
> "Maxim S. Shatskih" wrote:
>
>> Use a helper user app (started from the shell's Run key), which is turnable
>> off :-) there is nothing more annoying then the computer making some sounds
>> even without a logged on user :-)
>>
>> --
>> Maxim Shatskih, Windows DDK MVP
>> StorageCraft Corporation
>> maxim@storagecraft.com
>> http://www.storagecraft.com
>>
>> "Avtoritet" <Avtoritet.27vqhq@mail.codecomments.com> wrote in message
>> news:Avtoritet.27vqhq@mail.codecomments.com...
>>>
>>> I am a newbie in kernel-streaming topics and the drivers...
>>> All I need is to play a midi-note in windows kernel-mode. Like
>>> MidiOutShortMessage in WinAPI.
>>> Where can I read the manuals or examles? Must I use IMiniport
>>> interfaces or
>>> create complex streams? But how to use this IMiniport interfaces I
>>> don't
>>> understand completely.
>>> All I understand now is to find some PortMidi in system, create a new
>>> stream
>>> in his Mimiport and to write data. But I don't knpw how to find this
>>> Port. I
>>> think, there is no need in creating new port.
>>>
>>> Can you give me code-examples or even ready code? It is easier to
>>> understand
>>> topics with examples.
>>> I must implement this in coming days, it is my home task in university.
>>>
>>>
>>>
>>> --
>>> Avtoritet
>>> ------------------------------------------------------------------------
>>> Posted via http://www.codecomments.com
>>> ------------------------------------------------------------------------
>>>
>>
>>

Re: How to send a simple MIDI-note on a soundcard? by Avtoritet

Avtoritet
Tue May 16 11:48:01 CDT 2006

BobF, I understand what you mean. But you show me easy Win32 example. In
kernel-mode it is much harder to implement. I can do it but I have no enougth
time to do it.
I have an idea to create some easies miniport driver with inherited
functionality of FMSynth or DMusUART built-in miniport drivers. I want to
create a symbolic link to this easy driver and to create an IOCTL_WRITE_MIDI
code with MidiStream->Write function. How to do it?

Re: How to send a simple MIDI-note on a soundcard? by BobF

BobF
Tue May 16 12:01:45 CDT 2006

On Tue, 16 May 2006 09:48:01 -0700, Avtoritet wrote:

> BobF, I understand what you mean. But you show me easy Win32 example. In
> kernel-mode it is much harder to implement. I can do it but I have no enougth
> time to do it.
> I have an idea to create some easies miniport driver with inherited
> functionality of FMSynth or DMusUART built-in miniport drivers. I want to
> create a symbolic link to this easy driver and to create an IOCTL_WRITE_MIDI
> code with MidiStream->Write function. How to do it?

Sorry, I misunderstood what you're after. So your assignment is to create
a driver specifically?

Re: How to send a simple MIDI-note on a soundcard? by Avtoritet

Avtoritet
Tue May 16 12:18:02 CDT 2006

Yes. The whole task is to create the upper keyboard driver-filter which can
play different midi-notes when different key-buttons pressed. All in
kernel-mode. The keyboard-filter is ready. Now I'm looking for the easiest
way to play midi in kernel-mode... )

"BobF" wrote:

> On Tue, 16 May 2006 09:48:01 -0700, Avtoritet wrote:
>
> > BobF, I understand what you mean. But you show me easy Win32 example. In
> > kernel-mode it is much harder to implement. I can do it but I have no enougth
> > time to do it.
> > I have an idea to create some easies miniport driver with inherited
> > functionality of FMSynth or DMusUART built-in miniport drivers. I want to
> > create a symbolic link to this easy driver and to create an IOCTL_WRITE_MIDI
> > code with MidiStream->Write function. How to do it?
>
> Sorry, I misunderstood what you're after. So your assignment is to create
> a driver specifically?
>

Re: How to send a simple MIDI-note on a soundcard? by BobF

BobF
Tue May 16 12:33:55 CDT 2006

On Tue, 16 May 2006 10:18:02 -0700, Avtoritet wrote:

> Yes. The whole task is to create the upper keyboard driver-filter which can
> play different midi-notes when different key-buttons pressed. All in
> kernel-mode. The keyboard-filter is ready. Now I'm looking for the easiest
> way to play midi in kernel-mode... )
>
> "BobF" wrote:
>
>> On Tue, 16 May 2006 09:48:01 -0700, Avtoritet wrote:
>>
>>> BobF, I understand what you mean. But you show me easy Win32 example. In
>>> kernel-mode it is much harder to implement. I can do it but I have no enougth
>>> time to do it.
>>> I have an idea to create some easies miniport driver with inherited
>>> functionality of FMSynth or DMusUART built-in miniport drivers. I want to
>>> create a symbolic link to this easy driver and to create an IOCTL_WRITE_MIDI
>>> code with MidiStream->Write function. How to do it?
>>
>> Sorry, I misunderstood what you're after. So your assignment is to create
>> a driver specifically?
>>

I'll noodle this around and get back ...

Re: How to send a simple MIDI-note on a soundcard? by Maxim

Maxim
Tue May 16 14:57:22 CDT 2006

> create a symbolic link to this easy driver and to create an IOCTL_WRITE_MIDI
> code with MidiStream->Write function. How to do it?

Not documented at all, you will need to do lots of reverse engineering.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com


RE: How to send a simple MIDI-note on a soundcard? by Avtoritet

Avtoritet
Tue May 16 21:27:01 CDT 2006

All I understand is that I must enumerate KSCATEGORY_AUDIO filters with some
RENDER properties, than enumerate SINK pins in this filters. And to find a
pin, which support MIDI format data. After that I must send an
IOCTL_KS_WRITE_STREAM request to this pin.
How to implement it? What functions to use?
Anybody knows it? Are there anybody special articles?

Re: How to send a simple MIDI-note on a soundcard? by Maxim

Maxim
Tue May 16 23:40:43 CDT 2006

> pin, which support MIDI format data. After that I must send an
> IOCTL_KS_WRITE_STREAM request to this pin.

Correct, but this is hardly documented. You must first open some file name,
then do some "set format" IOCTLs on it, and then IOCTL_KS_WRITE_STREAM with
some undocumented structure.

There are only 2 documented user-mode facilities built on top of it -
DirectMusic and ancient (going from 16bit Windows 3.1) midiXxx calls in
WINMM.DLL, both are built on top of this IOCTL_KS_WRITE_STREAM or such.

The IOCTL itself is not documented. You can reverse-engineer some paths in
WINMM and the default driver loaded by it (for wave, it is WDMAUD.DRV, for
MIDI, I don't remember) though.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com


Re: How to send a simple MIDI-note on a soundcard? by Avtoritet

Avtoritet
Wed May 17 00:34:01 CDT 2006

Maxim, thanks. I think I won't try these kernel streaming functions...
Now I want to disassemble the WINMM.DLL and to look for MidiOutXXX functions
code and try to do something. My crazy teacher recomended me this
posibility... :)

Another way is to send requests from driver to some user-mode programm,
which use DirectMusic functionality. I think it is not very right way...

Re: How to send a simple MIDI-note on a soundcard? by Maxim

Maxim
Wed May 17 07:04:26 CDT 2006

> Now I want to disassemble the WINMM.DLL and to look for MidiOutXXX
>functions
> code and try to do something. My crazy teacher recomended me this
> posibility... :)

No, WINMM will just call some default driver DLL. For wave, it is WDMAUD.DRV,
for MIDI, I don't remember - maybe this is described in MSDN, maybe use "tlist"
on your process.

Disassemble this driver DLL, and not WINMM. Possibly you will see the open of
some pathname belonging to something like SYSAUDIO.SYS (or such) and then
DeviceIoControls to it.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com


Re: How to send a simple MIDI-note on a soundcard? by BobF

BobF
Wed May 17 08:13:29 CDT 2006

On Tue, 16 May 2006 22:34:01 -0700, Avtoritet wrote:

> Maxim, thanks. I think I won't try these kernel streaming functions...
> Now I want to disassemble the WINMM.DLL and to look for MidiOutXXX functions
> code and try to do something. My crazy teacher recomended me this
> posibility... :)
>
> Another way is to send requests from driver to some user-mode programm,
> which use DirectMusic functionality. I think it is not very right way...

<$.02US>
I think you'll want a user-mode app as part of this.

*Assuming* you want to actually generate sound when you send MIDI notes,
you'll need some mechanism to select which MIDI port to send to.

You *could* do this with a driver property page I suppose, but this will
further complicate things for you.

Think about a user-mode app that registers a call-back with your filter.
The user-mode app could then deal with *ALL* of the MIDI functions. This
would also give you the ability to have On/Off and per user selections.

Disassembling and going behind the abstraction provided the OS may not be
avoidable in all situations, but this is a situation that *I* would avoid
it for if at all possible.
</$.02US>

Re: How to send a simple MIDI-note on a soundcard? by Avtoritet

Avtoritet
Wed May 17 17:25:01 CDT 2006

Max, thanks! I'll try it...

"Maxim S. Shatskih" wrote:

> > Now I want to disassemble the WINMM.DLL and to look for MidiOutXXX
> >functions
> > code and try to do something. My crazy teacher recomended me this
> > posibility... :)
>
> No, WINMM will just call some default driver DLL. For wave, it is WDMAUD.DRV,
> for MIDI, I don't remember - maybe this is described in MSDN, maybe use "tlist"
> on your process.
>
> Disassemble this driver DLL, and not WINMM. Possibly you will see the open of
> some pathname belonging to something like SYSAUDIO.SYS (or such) and then
> DeviceIoControls to it.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@storagecraft.com
> http://www.storagecraft.com
>
>

Re: How to send a simple MIDI-note on a soundcard? by Avtoritet

Avtoritet
Wed May 17 17:33:02 CDT 2006

Ok, thanks for advises! I will try.
I only don't undrestand about a callback function for my driver. What do you
mean?

I have another idea. I think it would be easy to find a pin, I am looking
for, in a user-mode during the driver installation and then to pass it to the
driver. And to use this ready pin in my driver for fun.

"BobF" wrote:

> On Tue, 16 May 2006 22:34:01 -0700, Avtoritet wrote:
>
> > Maxim, thanks. I think I won't try these kernel streaming functions...
> > Now I want to disassemble the WINMM.DLL and to look for MidiOutXXX functions
> > code and try to do something. My crazy teacher recomended me this
> > posibility... :)
> >
> > Another way is to send requests from driver to some user-mode programm,
> > which use DirectMusic functionality. I think it is not very right way...
>
> <$.02US>
> I think you'll want a user-mode app as part of this.
>
> *Assuming* you want to actually generate sound when you send MIDI notes,
> you'll need some mechanism to select which MIDI port to send to.
>
> You *could* do this with a driver property page I suppose, but this will
> further complicate things for you.
>
> Think about a user-mode app that registers a call-back with your filter.
> The user-mode app could then deal with *ALL* of the MIDI functions. This
> would also give you the ability to have On/Off and per user selections.
>
> Disassembling and going behind the abstraction provided the OS may not be
> avoidable in all situations, but this is a situation that *I* would avoid
> it for if at all possible.
> </$.02US>
>

Re: How to send a simple MIDI-note on a soundcard? by dewdman42

dewdman42
Thu Jun 08 18:10:52 CDT 2006

This is a fascinating topic.