Re: playing wave files

From: Michael (Michael_at_discussions.microsoft.com)
Date: 12/20/04


Date: Mon, 20 Dec 2004 10:49:19 -0800

An unhandled exception of type
'Microsoft.DirectX.DirectSound.PriorityLevelNeededException' occurred in
microsoft.directx.directsound.dll
That's what it says:(((

Additional information: Error in the application.

"Phil Taylor" wrote:

> what does the debug runtime output say?
>
> all INVALIDCALLS generate debug output.
>
> "Michael" <Michael@discussions.microsoft.com> wrote in message
> news:EF43485B-2677-44AD-A308-60B64606F237@microsoft.com...
> > But in this piece of code I don't even create a BufferDescription...so I
> > let
> > the API decide and still it fails:
> >
> >
> > ApplicationDevice = new Device();
> > ApplicationDevice.SetCooperativeLevel(this, CooperativeLevel.Priority);
> > OpenFileDialog ofd = new OpenFileDialog();
> > ofd.Filter= "Wave files(*.wav)|*.wav";
> > ofd.ShowDialog();
> > string name=Path.GetFullPath(ofd.FileName);
> > ApplicationBuffer = new SecondaryBuffer(name, ApplicationDevice);
> > if(null != ApplicationBuffer)
> > ApplicationBuffer.Play(0,BufferPlayFlags.Default);
> >
> > "Phil Taylor" wrote:
> >
> >> its the buffer creation thats failing right?
> >>
> >> iirc you cant have both "locate in software" and "defer location" set at
> >> the
> >> same time. either you decide, or let the API decide. but not both.
> >>
> >> the debug runtime output should confirm this. which should be checked as
> >> a
> >> standard debugging practice when programs fail.
> >>
> >> "Michael" <Michael@discussions.microsoft.com> wrote in message
> >> news:F04D6428-78B6-4A59-8B07-360F9F7E30CB@microsoft.com...
> >> >I created a simple program that should play a file chosen in the
> >> > OpenFileDialog:
> >> > For some reason the program fails to play any wav file I choose
> >> >
> >> > It says :An unhandled
> >> > exception of type 'System.ArgumentException' occurred in
> >> > microsoft.directx.directsound.dll
> >> >
> >> > Additional information: Value does not fall within the expected range.
> >> >
> >> > here is the code:
> >> > private Device dsDevice = null;
> >> > private SecondaryBuffer buffer=null;
> >> > private BufferDescription info=null;
> >> > private OpenFileDialog o;
> >> > public Form1()
> >> > {
> >> > InitializeComponent();
> >> > o=new OpenFileDialog();
> >> > dsDevice = new Device();
> >> > dsDevice.SetCooperativeLevel(this,CooperativeLevel.Normal);
> >> > info=new BufferDescription();
> >> > info.ControlFrequency=true;
> >> > info.ControlVolume=true;
> >> > info.StaticBuffer=true;
> >> > info.LocateInSoftware=true;
> >> > info.DeferLocation=true;
> >> > o.Filter= "Wave Files(*.wav)|*wav";
> >> > o.ShowDialog();
> >> > buffer=new SecondaryBuffer(Path.(o.FileName),info,dsDevice);
> >> > if(dsDevice!=null)
> >> > buffer.Play(0,BufferPlayFlags.Looping);
> >> > }
> >> > I don't know what can be the problem.
> >> > Thanks for your help
> >> >
> >> >
> >>
> >>
> >>
>
>
>