473,382 Members | 1,447 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Directsound

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
the debugger breaks on the line: buffer=new
SecondaryBuffer(Path.(o.FileName),info,dsDevice); and 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
Nov 16 '05 #1
0 4439

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Kalpesh Modha | last post by:
Hello I am writing a program that makes and window popup and plays a sound repeatedly until the user does soemthing. however directsound for some reason does not play the sound if is does not...
25
by: Will Pittenger | last post by:
I have a C# application that I would like to notify the user of events with sound. Is there a way to playback at least the standard sounds? ---------- Will Pittenger E-Mail:...
0
by: Johann Blake | last post by:
Hi, I want to capture a signal from the sound card (via microphone or line input) using the DirectX.Sound.CaptureBuffer class. One of the properties that can be setup prior to capturing is...
2
by: Ian | last post by:
Does anyone know of a way where you can bind one of the Audio objects from DirectX.AudioVidoPlayback to a DirectX.DirectSound object? I need to do this because I need to be able to play several video...
0
by: Szafranr | last post by:
Hi I have litle problem with DirectSound I set DirectSound.Device CooperativeLevel on main form (Me) and when the sound is playing and main form lost focus then the sound is mutting :-( How...
3
by: Scott H | last post by:
I'm just starting to learn directaudio, and want to start off not with playing a WAV, thats all too easy, I want to generate the waveform, so to start off I'm trying to generate white noise, using...
1
by: Maciek | last post by:
I use DirectSound to record sound and voice. I would like compress this data in realtime, but I cannot found any solution. Thanks, Maciek
1
by: Jovo Mirkovic | last post by:
Hi, We are working on some application in DirectX, and we are using DirectSound, like this Public Sub playSound(ByVal isloop As Boolean, ByVal fileName As String) Try stopSound() sound =...
2
by: vipergt023 | last post by:
Hello all, Is there a way to monitor the output of the soundcard? I'm trying to have a VU meter for the output of the sound card - including all sounds from all programs running. I've found ways...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.