I've looked into DirectSound with the managed classes. The volume control is
an attenuation. So a sound can only be made quieter than the associated
mixer levels, not louder.
We've done things in the past using the serial port to drive external
devices. In this case we're trying to do something as simple as possible.
We've got a PC with a sound card & speakers - we figured we could get it to
play a horn type sound without much trouble. We've also got a PLC connected
to the system to control some conveyor, so worst case we'll have the PLC
sound a buzzer. But again that's additional hardware and programming on the
PLC side of things.
"Floyd Burger" <floyd@adelphia.not> wrote in message
news:%23NQZ8$aQEHA.4052@TK2MSFTNGP10.phx.gbl...[color=blue]
> Robert,
> I haven't played with this before, but it looks like DirectSound can[/color]
give[color=blue]
> you volume control for a specific buffer (your wav file).
>
http://tinyurl.com/3xsv5 MSDN says there is a managed DirectX9 available.
> It won't help much if the operator has turned the system volume down[/color]
though.[color=blue]
> Have you thought about making a secondary horn that's independent of the
> system audio system? You could use the serial port to drive it, raise[/color]
DTR,[color=blue]
> which causes the DTR pin to be energized with 5v (.5amp). Using a relay or
> transistor you could rig up a car horn or something of that ilk. I use
> something similar here, but it drives a electric motor instead of sounding[/color]
a[color=blue]
> horn when DTR is energized.
>
> --
> Floyd Burger
>
>
> "Robert Gravereaux" <Rob_Gravereaux.no.spam@grsinc.com> wrote in message
> news:u3JB2kaQEHA.3232@TK2MSFTNGP11.phx.gbl...[color=green]
> > That's certainly an option. The downside is that the volume for all wave
> > sounds gets modified, including all windows sounds.
> >
> > I'd rather have a solution that allows me to play a sound at a level[/color]
> totally[color=green]
> > independent of the level of any other audio.
> >
> >
> > "Floyd Burger" <floyd@adelphia.not> wrote in message
> > news:eQaryPaQEHA.132@TK2MSFTNGP09.phx.gbl...[color=darkred]
> > > Robert,
> > > There are ways to control the volume in code, you could increase the
> > > volume to max, play your horn.wav, then return the volume to what it[/color][/color][/color]
was[color=blue][color=green][color=darkred]
> > > before. I don't know what's available in the framework, but look at[/color][/color][/color]
the[color=blue][color=green][color=darkred]
> > > waveoutSetVolume Win32 API.
> > >
> > > --
> > > Floyd Burger
> > >
> > >
> > > "Robert Gravereaux" <Rob_Gravereaux.no.spam@grsinc.com> wrote in[/color][/color][/color]
message[color=blue][color=green][color=darkred]
> > > news:ulWKrCaQEHA.3012@TK2MSFTNGP09.phx.gbl...
> > > > I'm putting together a C# .Net forms project on win2k. The[/color][/color][/color]
application[color=blue][color=green][color=darkred]
> > > > requires some sort of horn sound. I've never implemented any audio[/color][/color][/color]
in[color=blue][color=green][color=darkred]
> > > .Net,
> > > > so I'm not sure how best to accomplish this.
> > > >
> > > > It's an application that works with a wireless barcode scanner, in a
> > > > warehouse environment. The user could be potentially 20 or 30 ft.[/color][/color][/color]
from[color=blue]
>[color=green]
> > the[color=darkred]
> > > > PC. If the user scans something improperly, the app should sound a[/color]
> > 'horn'[color=darkred]
> > > to
> > > > notify the user. I'm trying to accomplish this with the standard[/color][/color][/color]
sound[color=blue][color=green][color=darkred]
> > > card
> > > > and speakers supplied with the PC.
> > > >
> > > > The optimal solution would be to play my horn sound at a volume[/color][/color][/color]
level[color=blue][color=green][color=darkred]
> > > > totally (or at least mostly) independent of any other sounds being[/color]
> > played[color=darkred]
> > > > through the sound card and speakers. But I don't think this can be[/color]
> > done -[color=darkred]
> > > > all wave files, for example, play at the same mixer level in[/color][/color][/color]
windows.[color=blue][color=green]
> > Any[color=darkred]
> > > > ideas?
> > > >
> > > > AFAIK, I could:
> > > > 1) use the PlaySound() api to play a .wav file. The downside of this[/color][/color]
> is[color=green][color=darkred]
> > > that
> > > > the volume of all windows sounds will be approximately the same as[/color][/color][/color]
the[color=blue][color=green][color=darkred]
> > > horn
> > > > sound.
> > > > 2) Use waveOutSetVolume() in combination with PlaySound() to raise[/color][/color][/color]
and[color=blue][color=green][color=darkred]
> > > lower
> > > > the wave volume before and after playing the horn sound. The[/color][/color][/color]
downside[color=blue]
> is[color=green][color=darkred]
> > > > that the app is increasing the volume of all wave audio while the[/color][/color][/color]
horn[color=blue][color=green][color=darkred]
> > > sound
> > > > is being played.
> > > > 3) Create a horn sound that is a MIDI sound and use the MCI APIs to[/color][/color]
> play[color=green][color=darkred]
> > > the
> > > > sound. Then the windows mixer can be used to adjust levels between[/color][/color][/color]
the[color=blue][color=green][color=darkred]
> > > MIDI
> > > > and wave channels.
> > > > 4) Use a second sound card, and use PlaySound() with this device.
> > > >
> > > > I'm curious:
> > > > 1) Is there a way to control the relative level of individual wave[/color]
> > sounds,[color=darkred]
> > > > such that I can play a specific wave file something like 10 times[/color][/color]
> louder[color=green][color=darkred]
> > > > than the rest of the windows sounds?
> > > > 2) Is it possible to create my own mixing device, such that I can[/color][/color][/color]
play[color=blue]
> a[color=green][color=darkred]
> > > > wave sound without regard to the rest of the volumes already defined[/color][/color]
> by[color=green][color=darkred]
> > > the
> > > > windows mixer?
> > > >
> > > > Any thoughts would be appreciated.
> > > >
> > > > __________________________
> > > > Rob Gravereaux
> > > > Principal Developer
> > > > Glen Road Systems, Inc.
> > > >
http://www.grsinc.com
> > > >
> > > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]