-
August 6th, 2005, 05:44 PM
#1
C# Basics
Hello, I have a few concerns.
One is that I was programming using C++ .NET and I added a double buffer to a Panel Box on my Form application. When I tried to do the same thing in C#, I was unable to? Why is that?
Another is that the On_Paint Event for the Form in C# seems to update slower than the one for the Panel Box in C++. In the On_Paint method, I call Invalidate and move an image around. In C++ it is smooth and sharp, but in C#, even with the double buffer added to the Form (instead of a Panel Box) it is choppy. Is there a reason for that?
Another is that I found a sample app online written in MFC that uses DirectSound to play multiple sounds at once. I need the ability to do that however adding the classes that play these sounds (from the MFC app) causes my project to have a lot of compile errors. How would I play two sounds at once either in C# or C++???
If you can't tell, I am a novice and any clear, descriptive and concise reading material and/or instructions would be extremely appreciated.
-
August 8th, 2005, 09:59 AM
#2
Re: C# Basics
Firstly, you shouldn't be calling Invalidate in the Paint handler. This'll cause the display to repeatedly redraw. That's probably your problem with the double buffering : you're just covering up a more basic issue in C++ by enabling double buffering.
Secondly, you'll need to turn the MFC code into a native dll to be called using platform invoke from C#. You could inject the MFC code directly into VC++.NET : but I'd turn it into a native dll if I were you.
Darwen.
-
August 8th, 2005, 01:48 PM
#3
Re: C# Basics
Greetings.
In response to your query about the audio issue, I suggest that you have a look at the FMOD Ex Library (www.fmod.org). It is extremely capable and now directly supports C#. I'm sorry I cannot offer you guidance on using Directsound because I cannot recommend it because it is a) slow b) not cross flatform.
Regards.
-
August 10th, 2005, 10:34 AM
#4
Re: C# Basics
I downloaded the FMOD Ex Library, however I do not see any support for C#, and also, it is unmanaged. How would I use this code (I noticed that DirectSound is extrememly slow) or find the documentation for C#?
-
August 10th, 2005, 11:40 AM
#5
Re: C# Basics
If it's unmanaged, you won't find any C# documentation for it.
Personally I'd wrap up the library in a native static C++ dll and then use P/Invoke to call it.
Either that or write an ole-compatible (i.e. dual interfaced) COM object which provides an interface with the library.
Darwen.
-
August 10th, 2005, 12:42 PM
#6
Re: C# Basics
What I meant to say is that the Library Code for the FMOD is unmanaged. I found main.cpp files that contained code for unmanaged projects, however C# is managed and that is what I am using. Is there a way to use FMOD with C#? And if so, how would I do that? Also, I do not know how to make a dll, I am new to this.
-
August 10th, 2005, 02:36 PM
#7
Re: C# Basics
You can find the .cs files in /api/csharp in the fmod directory. The documentation is, unfortunately, targeted at c/c++ users.
I take the route of wrapping it in my own c++ library and then importing that because I can batch the calls and add my own mem buffer implementation (FMOD can use a fixed mem buffer internally).
Since you aren't familiar with how to make a native dll, I would stick to using the provided wrapper classes provided with the api for c#.
Regards.
-
August 12th, 2005, 07:02 PM
#8
Re: C# Basics
I found the documentation and examples, but is there a way to play sound directly from a Stream object. Also, I know C/C++ and switched to C# because I heard it was easier to play sound/videos with.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|