Hello All,

I'm developing a waveform audio driver for PocketPc / WinCE for a removable
audio device (compactflash) and have some trouble with WaveAPI when my driver
is unloaded by the system.

When I add my hardware to the system: everything goes as expected. The PnP
identifier is determined, devicemanager loads my driver, and i receive calls
from WaveAPI:

WAV_Open
WAV_IOControl - WIDM_GETNUMDEVS
WAV_IOControl - WIDM_GETDEVCAPS
WAV_IOControl - WODM_GETNUMDEVS
WAV_IOControl - WODM_GETDEVCAPS
WAV_IOControl - WODM_GETEXTDEVCAPS
WAV_IOControl - WODM_OPEN

By now there are two WAV devices in the system (WAV1: default internal
device WAV2: newly added compactflash device). From an application i can use
both succesfully.

The trouble starts when I remove the device from the system. After the
CE_CARD_REMOVAL event, the devicemanager calls WAV_DeInit and my DLL is
detached, without WaveAPI ever calling WAV_Close. This is the point where it
goes wrong. The remaining audio device in the system (WAV1:) stops working.
WaveAPI does not seem to respond anymore.

The stupid thing is when I remove the WAV1: from the system(just for
testing), with a call to DeactivateDevice() in an application, the same thing
happens.
This test exclude my driver as being part of the problem.

Does anybody know what can cause this strange behaviour?

Thanks in anticipation,

Best Regards,
Antoin Janssen

RE: WaveAPI & Device removal by AntoinJanssen

AntoinJanssen
Thu Oct 28 01:33:05 CDT 2004

Anybody?

"Antoin Janssen" wrote:

> Hello All,
>
> I'm developing a waveform audio driver for PocketPc / WinCE for a removable
> audio device (compactflash) and have some trouble with WaveAPI when my driver
> is unloaded by the system.
>
> When I add my hardware to the system: everything goes as expected. The PnP
> identifier is determined, devicemanager loads my driver, and i receive calls
> from WaveAPI:
>
> WAV_Open
> WAV_IOControl - WIDM_GETNUMDEVS
> WAV_IOControl - WIDM_GETDEVCAPS
> WAV_IOControl - WODM_GETNUMDEVS
> WAV_IOControl - WODM_GETDEVCAPS
> WAV_IOControl - WODM_GETEXTDEVCAPS
> WAV_IOControl - WODM_OPEN
>
> By now there are two WAV devices in the system (WAV1: default internal
> device WAV2: newly added compactflash device). From an application i can use
> both succesfully.
>
> The trouble starts when I remove the device from the system. After the
> CE_CARD_REMOVAL event, the devicemanager calls WAV_DeInit and my DLL is
> detached, without WaveAPI ever calling WAV_Close. This is the point where it
> goes wrong. The remaining audio device in the system (WAV1:) stops working.
> WaveAPI does not seem to respond anymore.
>
> The stupid thing is when I remove the WAV1: from the system(just for
> testing), with a call to DeactivateDevice() in an application, the same thing
> happens.
> This test exclude my driver as being part of the problem.
>
> Does anybody know what can cause this strange behaviour?
>
> Thanks in anticipation,
>
> Best Regards,
> Antoin Janssen
>

Re: WaveAPI & Device removal by Sajid

Sajid
Thu Oct 28 03:47:46 CDT 2004

Hi Antoin,

You may know this, but as a reminder:
The wince os maintains only one copy of dll whenever there is multiple
instances of the same dll. This is done by the device manager.

my guess in your case is that:
your application is not using deivce manager always for loading and
unloading wave instances[WAV1, WAV2, ...].

As per my understanding the device manager never unloads any dlls when it
has atleast one instance of it.

regards
sajid

"Antoin Janssen" <AntoinJanssen@discussions.microsoft.com> wrote in message
news:340BC8A5-B95D-48F2-97E2-7C23E21E1F8B@microsoft.com...
> Anybody?
>
> "Antoin Janssen" wrote:
>
> > Hello All,
> >
> > I'm developing a waveform audio driver for PocketPc / WinCE for a
removable
> > audio device (compactflash) and have some trouble with WaveAPI when my
driver
> > is unloaded by the system.
> >
> > When I add my hardware to the system: everything goes as expected. The
PnP
> > identifier is determined, devicemanager loads my driver, and i receive
calls
> > from WaveAPI:
> >
> > WAV_Open
> > WAV_IOControl - WIDM_GETNUMDEVS
> > WAV_IOControl - WIDM_GETDEVCAPS
> > WAV_IOControl - WODM_GETNUMDEVS
> > WAV_IOControl - WODM_GETDEVCAPS
> > WAV_IOControl - WODM_GETEXTDEVCAPS
> > WAV_IOControl - WODM_OPEN
> >
> > By now there are two WAV devices in the system (WAV1: default internal
> > device WAV2: newly added compactflash device). From an application i can
use
> > both succesfully.
> >
> > The trouble starts when I remove the device from the system. After the
> > CE_CARD_REMOVAL event, the devicemanager calls WAV_DeInit and my DLL is
> > detached, without WaveAPI ever calling WAV_Close. This is the point
where it
> > goes wrong. The remaining audio device in the system (WAV1:) stops
working.
> > WaveAPI does not seem to respond anymore.
> >
> > The stupid thing is when I remove the WAV1: from the system(just for
> > testing), with a call to DeactivateDevice() in an application, the same
thing
> > happens.
> > This test exclude my driver as being part of the problem.
> >
> > Does anybody know what can cause this strange behaviour?
> >
> > Thanks in anticipation,
> >
> > Best Regards,
> > Antoin Janssen
> >



Re: WaveAPI & Device removal by AntoinJanssen

AntoinJanssen
Mon Nov 01 02:59:08 CST 2004

Hello,
Thanks Sajid for your post.

I do not load or unload WAVEAPI from my driver.
The devicemanager is responsible for adding and removing a reference to
WAVEAPI whenever a WAV device is added or removed from the system.

I far as I know a receive the WAV_DeInit call from the devicemanager. This
should decrease the reference to WAVAPI with one, and leave the existing
reference WAV1 as it was before adding my device.
But when I remove my device, and call "waveOutGetNumDevs" from an
application, it replies 0. So it looks like WAVEAPI gets unloaded.

Can it be that WAVEAPI is not multi instance capable?

Regards,
Antoin Janssen

"Sajid" wrote:

> Hi Antoin,
>
> You may know this, but as a reminder:
> The wince os maintains only one copy of dll whenever there is multiple
> instances of the same dll. This is done by the device manager.
>
> my guess in your case is that:
> your application is not using deivce manager always for loading and
> unloading wave instances[WAV1, WAV2, ...].
>
> As per my understanding the device manager never unloads any dlls when it
> has atleast one instance of it.
>
> regards
> sajid
>
> "Antoin Janssen" <AntoinJanssen@discussions.microsoft.com> wrote in message
> news:340BC8A5-B95D-48F2-97E2-7C23E21E1F8B@microsoft.com...
> > Anybody?
> >
> > "Antoin Janssen" wrote:
> >
> > > Hello All,
> > >
> > > I'm developing a waveform audio driver for PocketPc / WinCE for a
> removable
> > > audio device (compactflash) and have some trouble with WaveAPI when my
> driver
> > > is unloaded by the system.
> > >
> > > When I add my hardware to the system: everything goes as expected. The
> PnP
> > > identifier is determined, devicemanager loads my driver, and i receive
> calls
> > > from WaveAPI:
> > >
> > > WAV_Open
> > > WAV_IOControl - WIDM_GETNUMDEVS
> > > WAV_IOControl - WIDM_GETDEVCAPS
> > > WAV_IOControl - WODM_GETNUMDEVS
> > > WAV_IOControl - WODM_GETDEVCAPS
> > > WAV_IOControl - WODM_GETEXTDEVCAPS
> > > WAV_IOControl - WODM_OPEN
> > >
> > > By now there are two WAV devices in the system (WAV1: default internal
> > > device WAV2: newly added compactflash device). From an application i can
> use
> > > both succesfully.
> > >
> > > The trouble starts when I remove the device from the system. After the
> > > CE_CARD_REMOVAL event, the devicemanager calls WAV_DeInit and my DLL is
> > > detached, without WaveAPI ever calling WAV_Close. This is the point
> where it
> > > goes wrong. The remaining audio device in the system (WAV1:) stops
> working.
> > > WaveAPI does not seem to respond anymore.
> > >
> > > The stupid thing is when I remove the WAV1: from the system(just for
> > > testing), with a call to DeactivateDevice() in an application, the same
> thing
> > > happens.
> > > This test exclude my driver as being part of the problem.
> > >
> > > Does anybody know what can cause this strange behaviour?
> > >
> > > Thanks in anticipation,
> > >
> > > Best Regards,
> > > Antoin Janssen
> > >
>
>
>

Re: WaveAPI & Device removal by Sajid

Sajid
Mon Nov 01 20:41:56 CST 2004

Hi Antoin,

Thats right.
You cannnot load/unload waveapi manager directly.
When I started developing the audio driver, I had come across a problem,
where in my audio driver used to get loaded but not the middle layer
[waveapi.dll and audevman.dll].
Later I came to know that I have to associate my driver with the core os
component[i.e., middle layer] using a .cec file.

Once I did this, the waveapi.dll and audevman.dll used to get loaded
automatically. And moreover my audio driver didn't had any loading/unloading
code for middle layer. Thats how it goes.

Here are few points that 'may' help you:
1. The audio driver is "builtin type driver", i.e., it is load at boot time
and stays active till shutdown.
2. I have hardcoded waveOutGetNumDevs return value to '1' in my audio driver
[as seen in ensoniq unified code]. So, there is no way I see '0' value
returned by waveOutGetNumDevs message any time.
In case you are changing the 'number of deives' runtime then I would suggest
you to look into this code once again. I guess once WAV2 is up, it has not
incremented this reference and hence when WAV2 is unloaded, it decrements
the reference and it happens to be zero!!

Your question:
Can it be that WAVEAPI is not multi instance capable?
I do not see any thing stoping waveapi being capable of handling multiple
instances.
Usually multi instance scenario comes in to picture when we have
applications more than one run simultaneously.
My understanding says that software mixer does the job of playing multiple
wave files simultaneoulsy without creating any more instances other than the
first one to run the applications. So at any given time the audio driver
gets only one destination audio line to play.

Hope, I have not confused you!

regards
sajid

"Antoin Janssen" <AntoinJanssen@discussions.microsoft.com> wrote in message
news:830AC604-C255-4B9B-93AE-E480BC552DA7@microsoft.com...
> Hello,
> Thanks Sajid for your post.
>
> I do not load or unload WAVEAPI from my driver.
> The devicemanager is responsible for adding and removing a reference to
> WAVEAPI whenever a WAV device is added or removed from the system.
>
> I far as I know a receive the WAV_DeInit call from the devicemanager. This
> should decrease the reference to WAVAPI with one, and leave the existing
> reference WAV1 as it was before adding my device.
> But when I remove my device, and call "waveOutGetNumDevs" from an
> application, it replies 0. So it looks like WAVEAPI gets unloaded.
>
> Can it be that WAVEAPI is not multi instance capable?
>
> Regards,
> Antoin Janssen
>
> "Sajid" wrote:
>
> > Hi Antoin,
> >
> > You may know this, but as a reminder:
> > The wince os maintains only one copy of dll whenever there is multiple
> > instances of the same dll. This is done by the device manager.
> >
> > my guess in your case is that:
> > your application is not using deivce manager always for loading and
> > unloading wave instances[WAV1, WAV2, ...].
> >
> > As per my understanding the device manager never unloads any dlls when
it
> > has atleast one instance of it.
> >
> > regards
> > sajid
> >
> > "Antoin Janssen" <AntoinJanssen@discussions.microsoft.com> wrote in
message
> > news:340BC8A5-B95D-48F2-97E2-7C23E21E1F8B@microsoft.com...
> > > Anybody?
> > >
> > > "Antoin Janssen" wrote:
> > >
> > > > Hello All,
> > > >
> > > > I'm developing a waveform audio driver for PocketPc / WinCE for a
> > removable
> > > > audio device (compactflash) and have some trouble with WaveAPI when
my
> > driver
> > > > is unloaded by the system.
> > > >
> > > > When I add my hardware to the system: everything goes as expected.
The
> > PnP
> > > > identifier is determined, devicemanager loads my driver, and i
receive
> > calls
> > > > from WaveAPI:
> > > >
> > > > WAV_Open
> > > > WAV_IOControl - WIDM_GETNUMDEVS
> > > > WAV_IOControl - WIDM_GETDEVCAPS
> > > > WAV_IOControl - WODM_GETNUMDEVS
> > > > WAV_IOControl - WODM_GETDEVCAPS
> > > > WAV_IOControl - WODM_GETEXTDEVCAPS
> > > > WAV_IOControl - WODM_OPEN
> > > >
> > > > By now there are two WAV devices in the system (WAV1: default
internal
> > > > device WAV2: newly added compactflash device). From an application i
can
> > use
> > > > both succesfully.
> > > >
> > > > The trouble starts when I remove the device from the system. After
the
> > > > CE_CARD_REMOVAL event, the devicemanager calls WAV_DeInit and my DLL
is
> > > > detached, without WaveAPI ever calling WAV_Close. This is the point
> > where it
> > > > goes wrong. The remaining audio device in the system (WAV1:) stops
> > working.
> > > > WaveAPI does not seem to respond anymore.
> > > >
> > > > The stupid thing is when I remove the WAV1: from the system(just for
> > > > testing), with a call to DeactivateDevice() in an application, the
same
> > thing
> > > > happens.
> > > > This test exclude my driver as being part of the problem.
> > > >
> > > > Does anybody know what can cause this strange behaviour?
> > > >
> > > > Thanks in anticipation,
> > > >
> > > > Best Regards,
> > > > Antoin Janssen
> > > >
> >
> >
> >