|
Hi,
I want to create an application that plays the sound recorded from the microphone. I succeeded in capturing the sound from the mic using CaptureBuffer....my problem is when using the data from this buffer to play it with SecondaryBuffer.
I'm using a memory stream to get the data from the capture buffer to a stream. When I capture the data from the mic I use the following code.
CaptureData is a byte array.
<br />
memStream.Write(CaptureData, 0, CaptureData.Length);<br />
secBuffer = new SecondaryBuffer(memStream, appDevice);<br />
secBuffer.Play(0, BufferPlayFlags.Default);<br />
When i run my application it gives me System.ArgumentException was unhandled - Value does not fall within the expected range.
Even if I use a different constructor, it always gives me this exception. I think it' because of the device object...This object is instantiated like this:
<br />
appDevice = new Device();<br />
appDevice.SetCooperativeLevel(this, CooperativeLevel.Priority);<br />
If any of you have a suggestion it will be most welcomed because I ran out of ideas.
Thanks.
Do your best to be the best
|
|
|
|
|
Maybe you should use the constructor where you pass in a BufferDescription object to describe the format you're using. This is just a guess, but I think that since you got your stream for a capture buffer that it's not going to have the headers at the beginning that a stream loaded directly from a wave file would have. Thus you need to provide that info with the BufferDescription object.
But don't quote me on that...
|
|
|
|
|
Hi,
I'm developing a web service in which I need to get the sub-directories & files list which reside in the same directory where the Web service is installed.
In other word, in the same directory where I put my Service.asmx, I have a few other files & directories.
Those file & Directories I need to access from within my Web Service Code.
This Web Service will be Deployed in a nother computer, so when I'm building it i have no idea in which directory it will reside.
My question is: How do I gain access to the actual directoy in which my Servive.asmx got installed to, so I could something like: foreach (string directory in Directory.GetDirectories(MyWebServiceDirectory))??
If i use Environment.CurrentDirectory I get the C:\Windows\system32...
If I use Application.StartupPath I get back a reference to an HttpApplicationState object...
Any Help is appreciated.
tnx
Roy Kabiri
|
|
|
|
|
|
Ooops. Probabbly Missed it. tnx.
Roy
|
|
|
|
|
Hello,
I am currently developing a project that has a reference to an outside dll (some utility in another folder). I randomly make changes to this dll and I sometimes forget to update the version. This makes Visual Studio think that there have been no changes to the file since the version number is the same. Is there any way to have visual studio always copy a fresh dll from the source folder even if the version has not changed? I know that I could perform this action in the post-build command box but I am trying to avoid that solution. Thanks for the help!
~Adam
|
|
|
|
|
I have a folder(directory) that I need to add a group to dynamically. I have figured out how to retrieve the group name but now I am trying to figure out how to dynamically add the group to a folders security permissions.
Any suggestions would be helpful as google has proved unfruitful.
Thanks.
_____________________________________________________________________
Our developers never release
code. Rather, it tends to escape, pillaging the countryside all around.
The Enlightenment Project (paraphrased comment)
Visit Me at GISDevCafe
|
|
|
|
|
Hi,
I have to create a C# library that will draw live grayscale images to a specific window handle that was passed by an application (e.g. picturebox1.hwnd in VB6). I don't have any control over the application and the only information given to my library will be the window handle to draw to.
So what C# code would allow me to draw images (from a bit array) very fast to a window handle? Will I have to use Win32 and BitBlt (how?) or is there some managed code that will accomplish this too?
Thanks.
|
|
|
|
|
1) Control c = Control.FromHandle(myHwnd);
using(Graphics g = c.CreateGraphics())
{
g.Draw... what ever you want
}
NOTE: if you are going to many drawing on the control handle which is passed to your function or class which has this drawing function, better to create a Graphics instance "once" and use it over and over again instead of using a "using(Graphics g...)" where a new instance of graphics created and disposed after each drawing.
I would prefer capturing the handle in my Drawer/Painter class's constructor and create a Graphics object there immediately. (This way I suppose the size of the windows whose handle was captured does not change). Otherwise you should use "using(Graphics g = ...)" block
Hope this helps...
|
|
|
|
|
How can I clear out my deletedItem folder in outlook 2003 with c#?
|
|
|
|
|
How can I clear out my "deletedItem" folder when I shut down my outlook 2003 in c#?
|
|
|
|
|
Outlook 2003[^] might be a starting point for you. It has links to various things you can do in C# with Outlook.
|
|
|
|
|
Hi guys
can any body tell me how can i write into app.config file through c# code, when i try to write through configurationmanager so it throws an exception saying that
"configuration is read only" why is that?
how can i do that?
thanks in advance
hello
|
|
|
|
|
The app.config file is just where things start. When you compile your application it becomes Exename.exe.config. You have to use something like this:
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
To access your app config file and make changes to it. If you try to write to it directly you get the readonly error since the application is using it.
Hope that helps.
Ben
|
|
|
|
|
1) You can write only to "yourApplication.exe.config"
OR
2) Create a separate config file and write into it with
a) System.Configuration namespace members,
b) EnterpriseLibrary April 2007 edition (FileConfigurationSource...)
c) Raw XML code ( don't prefer )
3) Create a separate ApplicationSettingsProvider which overrides the current one and uses a file as a storage which implements SettingsProvider abstract class ( for example, LocalFileSettingsProvider )
Hope this helps...
|
|
|
|
|
Hi,
I'm building an app which has panels in both right and left side. For this i'm using splitcontainers.
The document of that app is then opened inside one panel of one of the splitcontainers. I open that form in a maximized form. But if i move the splitters (the one from the left, or the one from the right), the form doesnt get maximized.
What can i do to make it adapt automaticly to the new conditions?
Thx,
Nuno
|
|
|
|
|
Is the control that shows the document (fully) docked in the panel?
|
|
|
|
|
Yes.
In the form that will be the MDI i have the option WindowState = Maximized
Thx,
Nuno
|
|
|
|
|
Yes, but is the control docked in the panel?
|
|
|
|
|
I am writing automated tests for my project. As part of this I bring up a FolderBrowserDialog and need to close it programatically. But since the dialog is not derived from Windows.Forms and it is modal, I cant capture and close it.
Is there a way to do this?
|
|
|
|
|
Try P/Invoking.. FindWindow() and then do SendMessage()..
Cheers,
Suresh
|
|
|
|
|
I used the FindWindow and SendMessage combo and it worked.
Thanks a lot!!
|
|
|
|
|
Launch it from a thread and Abort the thread?
|
|
|
|
|
The following have either returned null or returned the Windows\System32 directory:
System.Windows.Forms.Application.ExecutablePath;
System.Reflection.GetExecutingAssembly();
System.Reflection.GetExecutingAssembly().CodePath;
Environment.CurrentDirectory;
Does anyone know anything that actually works?
|
|
|
|
|
I used AppDomain.CurrentDomain.BaseDirectory
|
|
|
|