[wdmaudiodev] Re: MIDI driver help for Software MIDI controller using Pocket PC

  • From: "Paul Griffiths" <gafferuk@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Wed, 20 Jun 2007 11:54:31 +0100

I can get my minidriver to load but it won't start.
All im trying to achieve is a software midi driver to connect my
application to other music software.


Here what I have done.


1.   copy over miniport.cpp & mpu.cpp from dmusuart example to mpu401 example.


2. Added header to adapter.cpp in mpu401 example:
#include "private.h"


3. added following code to adapter.cpp:

NTSTATUS
CreateMiniportDMusUART
(
   OUT PUNKNOWN *,
   IN  REFCLSID,
   IN  PUNKNOWN,
   IN  POOL_TYPE
);









4. added following code to StartDevice in adapter.cpp:


    // install DMusUART miniport.
     ntStatus = InstallSubdevice(
         pDeviceObject,
         pIrp,
         L"Uart",
         CLSID_PortDMus,
         CLSID_PortDMus,
         CreateMiniportDMusUART,
          NULL,
         ResourceList,
          IID_IPortDMus,
         NULL,
         NULL
    );

5. Removed everything from mpu.cpp to remove everything to do with hardware:

/*****************************************************************************
* MPU.cpp - UART miniport implementation
*****************************************************************************
* Copyright (c) 1998-2000 Microsoft Corporation.  All rights reserved.
*
*      Sept 98    MartinP .
*/

#include "private.h"
#include "ksdebug.h"

#define STR_MODULENAME "DMusUART:MPU: "

#define UartFifoOkForWrite(status)  ((status & MPU401_DRR) == 0)
#define UartFifoOkForRead(status)   ((status & MPU401_DSR) == 0)

typedef struct
{
   CMiniportDMusUART  *Miniport;
   PUCHAR              PortBase;
   PVOID               BufferAddress;
   ULONG               Length;
   PULONG              BytesRead;
}
SYNCWRITECONTEXT, *PSYNCWRITECONTEXT;

BOOLEAN  TryMPU(IN PUCHAR PortBase);
NTSTATUS WriteMPU(IN PUCHAR PortBase,IN BOOLEAN IsCommand,IN UCHAR Value);

#pragma code_seg("PAGE")
//  make sure we're in UART mode
NTSTATUS ResetHardware(PUCHAR portBase)
{
   PAGED_CODE();

   return STATUS_SUCCESS;
}

#pragma code_seg("PAGE")
//
// We initialize the UART with interrupts suppressed so we don't
// try to service the chip prematurely.
//
NTSTATUS CMiniportDMusUART::InitializeHardware(PINTERRUPTSYNC
interruptSync,PUCHAR portBase)
{
   PAGED_CODE();


   return STATUS_SUCCESS;
}

#pragma code_seg()
/*****************************************************************************
* InitMPU()
*****************************************************************************
* Synchronized routine to initialize the MPU401.
*/
NTSTATUS
InitMPU
(
   IN      PINTERRUPTSYNC  InterruptSync,
   IN      PVOID           DynamicContext
)
{

   return STATUS_SUCCESS;
}

#pragma code_seg()
/*****************************************************************************
* CMiniportDMusUARTStream::Write()
*****************************************************************************
* Writes outgoing MIDI data.
*/
STDMETHODIMP_(NTSTATUS)
CMiniportDMusUARTStream::
Write
(
   IN      PVOID       BufferAddress,
   IN      ULONG       Length,
   OUT     PULONG      BytesWritten
)
{

   return STATUS_SUCCESS;
}

#pragma code_seg()
/*****************************************************************************
* SynchronizedDMusMPUWrite()
*****************************************************************************
* Writes outgoing MIDI data.
*/
NTSTATUS
SynchronizedDMusMPUWrite
(
   IN      PINTERRUPTSYNC  InterruptSync,
   IN      PVOID           syncWriteContext
)
{
    return STATUS_SUCCESS;
}

#define kMPUPollTimeout 2

#pragma code_seg()
/*****************************************************************************
* TryMPU()
*****************************************************************************
* See if the MPU401 is free.
*/
BOOLEAN
TryMPU
(
   IN      PUCHAR      PortBase
)
{

   return TRUE;
}

#pragma code_seg()
/*****************************************************************************
* WriteMPU()
*****************************************************************************
* Write a byte out to the MPU401.
*/
NTSTATUS
WriteMPU
(
   IN      PUCHAR      PortBase,
   IN      BOOLEAN     IsCommand,
   IN      UCHAR       Value
)
{

   return STATUS_SUCCESS;
}

#pragma code_seg()
/*****************************************************************************
* SnapTimeStamp()
*****************************************************************************
*
* At synchronized execution to ISR, copy miniport's volatile m_InputTimeStamp
* to stream's m_SnapshotTimeStamp and zero m_InputTimeStamp.
*
*/
STDMETHODIMP_(NTSTATUS)
SnapTimeStamp(PINTERRUPTSYNC InterruptSync,PVOID pStream)
{

   return STATUS_SUCCESS;
}

/*****************************************************************************
* CMiniportDMusUARTStream::SourceEvtsToPort()
*****************************************************************************
*
* Reads incoming MIDI data, feeds into DMus events.
* No need to touch the hardware, just read from our SW FIFO.
*
*/
STDMETHODIMP_(NTSTATUS)
CMiniportDMusUARTStream::SourceEvtsToPort()
{

   return STATUS_SUCCESS;
}

#pragma code_seg()
/*****************************************************************************
* DMusMPUInterruptServiceRoutine()
*****************************************************************************
* ISR.
*/
NTSTATUS
DMusMPUInterruptServiceRoutine
(
   IN      PINTERRUPTSYNC  InterruptSync,
   IN      PVOID           DynamicContext
)
{

   return STATUS_SUCCESS;
}





















And here's my .inf file:

[Version]
CatalogFile=msvad.cat
Signature="$CHICAGO$"
Class=MEDIA
Provider=%MSFT%
ClassGUID={4d36e96c-e325-11ce-bfc1-08002be10318}
DriverVer = 08/01/2000, 1.0.0.0

[SourceDisksNames]
222="MSVAD Driver Disk","",222

[SourceDisksFiles]
msmpu401.sys=222


;;This syntax is only recognized on Windows XP and above- it is needed
to install 64-bit drivers on
;;Windows Server 2003 Service Pack 1 and above.

[Manufacturer]
%MfgName%=MicrosoftDS,NTAMD64,NTIA64

;;  For Windows Server 2003 Service Pack 1 and above, a 64-bit OS will
not install a driver
;;  unless the Manufacturer and Models Sections explicitly show it is
a driver for that platform
;;  But the individual model section decorations (or lack thereof)
work as they always have.
;;  All of the model sections referred to are undecorated or
NT-decorated, hence work on all platforms

[MicrosoftDS]
%MSVAD_Simple.DeviceDesc%=MSVAD_Simple,,*MSVADSimple


;; This section enables installing on x64 systems

[MicrosoftDS.NTAMD64]
%MSVAD_Simple.DeviceDesc%=MSVAD_Simple,,*MSVADSimple


;;  This section enables installing on Itanium systems

[MicrosoftDS.NTIA64]
%MSVAD_Simple.DeviceDesc%=MSVAD_Simple,,*MSVADSimple


[DestinationDirs]
MSVAD_Simple.CopyList=10,system32\drivers

;======================================================
; MSVAD_SIMPLE
;======================================================
[MSVAD_Simple]
AlsoInstall=ks.registration(ks.inf),wdmaudio.registration(wdmaudio.inf)
CopyFiles=MSVAD_Simple.CopyList
AddReg=MSVAD_Simple.AddReg

[MSVAD_Simple.CopyList]
msmpu401.sys

[MSVAD_Simple.Interfaces]
AddInterface=%KSCATEGORY_AUDIO%,%KSNAME_Uart%,MSVAD.I.Uart
AddInterface=%KSCATEGORY_RENDER%,%KSNAME_Uart%,MSVAD.I.Uart
AddInterface=%KSCATEGORY_CAPTURE%,%KSNAME_Uart%,MSVAD.I.Uart



[MSVAD_Simple.AddReg]
HKR,,AssociatedFilters,,"wdmaud,swmidi,redbook"
HKR,,Driver,,msmpu401.sys
HKR,,NTMPDriver,,"msmpu401.sys,sbemul.sys"

HKR,Drivers,SubClasses,,"wave,midi,mixer"


HKR,Drivers\midi\wdmaud.drv,Driver,,wdmaud.drv



HKR,Drivers\midi\wdmaud.drv,Description,,%MSVAD_Simple.DeviceDesc%


HKLM,%MediaCategories%\%Simple.NameGuid%,Name,,%Simple.Name%

;======================================================
; COMMON
;======================================================


[MSVAD.I.Uart]
AddReg=MSVAD.I.Uart.AddReg
[MSVAD.I.Uart.AddReg]
HKR,,CLSID,,%Proxy.CLSID%
HKR,,FriendlyName,,%MSVAD.Uart.szPname%
;======================================================
; MSVAD_SIMPLE
;======================================================
[MSVAD_Simple.NT]
Include=ks.inf,wdmaudio.inf
Needs=KS.Registration, WDMAUDIO.Registration
CopyFiles=MSVAD_Simple.CopyList
AddReg=MSVAD_Simple.AddReg

[MSVAD_Simple.NT.Interfaces]
AddInterface=%KSCATEGORY_AUDIO%,%KSNAME_Uart%,MSVAD.I.Uart
AddInterface=%KSCATEGORY_RENDER%,%KSNAME_Uart%,MSVAD.I.Uart
AddInterface=%KSCATEGORY_CAPTURE%,%KSNAME_Uart%,MSVAD.I.Uart

[MSVAD_Simple.NT.Services]
AddService=msvad_simple,0x00000002,msvad_Simple_Service_Inst

[msvad_Simple_Service_Inst]
DisplayName=%msvad_simple.SvcDesc%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%10%\system32\drivers\msmpu401.sys

;======================================================
; COMMON
;======================================================
[Strings]
MSFT="Microsoft"
MfgName="Microsoft Audio DDK"
MSVAD_Simple.DeviceDesc="Microsoft Virtual Audio Device (Simple) (WDM)"

MSVAD.Uart.szPname="MSVAD Uart"


Proxy.CLSID="{17CCA71B-ECD7-11D0-B908-00A0C9223196}"
KSCATEGORY_AUDIO="{6994AD04-93EF-11D0-A3CC-00A0C9223196}"
KSCATEGORY_RENDER="{65E8773E-8F56-11D0-A3B9-00A0C9223196}"
KSCATEGORY_CAPTURE="{65E8773D-8F56-11D0-A3B9-00A0C9223196}"

KSNAME_Uart="Uart"
msvad_simple.SvcDesc="Microsoft Virtual Audio Device (Simple) (WDM)"

MediaCategories="SYSTEM\CurrentControlSet\Control\MediaCategories"

Simple.NameGuid="{946A7B1A-EBBC-422a-A81F-F07C8D40D3B4}"
Simple.Name="MSVAD (Simple)"







Anyways it won't start. All im trying to achieve is a software only midi driver.
If I search google for 'dmusuart' theres no links to software midi
drivers so im stuck.
Also the only other software/hardware that I can think of that
requires a software driver is the lemur, this info is so hard to find.

So do you have knowledge of software midi drivers? Any info appreciated!! :)



Thanks for your time.
Paul.













From: "Paul Griffiths" <gafferuk@xxxxxxxxx>
To: wdmaudiodev@xxxxxxxxxxxxx
Date: Mon, 18 Jun 2007 13:08:18 +0100
Hi, im creating a MIDI controller using a pocket PC. Link
here:http://www.ableton.com/forum/viewtopic.php?t=50295

At the moment im using virtual midi cables to connect my receiving
application to my music software.
Now I wish to construct a virtual midi driver so my application looks
like a hardware device.

Ive looked at the ddk samples, dmusuart ect but don't know where to start.
I know dmusuart creates a lib file, but how do i link it to a audio
driver? Also i cant can't get the sb16 example to work(it doesnt
start) but the virtual audio drivers examples do.

Ive written my app in c# so im thinking about creating a dll in c++ to
connect to the driver?


Any help/links appeciated. Paul.
******************
******************

WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.com/

Other related posts: