|
Go to File/New/Project. You have to create a project to be able to compile it. Create a C++/Win32 project.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi all
I would like to write a little C# bit of code that is able to trigger the playing of short audio files from a trigger generated from say a microphone. Heres the setup - a Snare Drum has a microphone on it. You hit the snare, which pumps that sound into the mic input on a laptop. The software needs to read the mic input audio, and generate a "trigger" to play an MP3 or Wav file each time. It would be nice, but not mandatory, if the the strength of the snare hit could affect the volume of the triggered sound. Sort of a poor-mans sampler. Can anyone suggest how this could be done ? Any help appreciated...
|
|
|
|
|
Set up an wave input device using the managed[^] version of DirectSound. Record the input and perform a root mean square[^] on the buffers. When the intensity of the RMS reaches a certain point, trigger your sample. Use the RMS intensity to affect the loudness of the sample.
|
|
|
|
|
Thanks Leslie for the pointer
I dont suppose you could point me to some sample code as well ?
I'm finding it difficult to locate...
Regards
David Every
|
|
|
|
|
|
Thanks Heaps Leslie, will try those
will let you know how I go or if any questions arise
|
|
|
|
|
I’m using a Visio drawing control in a C# application.
After adding few shapes in to the drawing , how can I select a particular shape form the drawing. can I use (shape) name for the selection.
Thanks in advance …
Asit.
|
|
|
|
|
i get
System.DllNotFoundException: Unable to load DLL 'touchlib.dll': The specified mo
dule could not be found. (Exception from HRESULT: 0x8007007E)
--at TouchlibInterop.Interop.init()
--at TouchlibInterop.Interop.initialize() in C:\Documents and Settings\donovan\
My Documents\Visual Studio 2005\Projects\TouchlibInterop\TouchlibInterop\TouchlibInt
erop.cs:line 54
even though the dll (touchlib.dll) is in the bin directory of the application i'm trying to run, and in the bin of the dll that's calling it. i've added a reference to the dll(touchlib.dll) in the dll that calls it(touchlibinterop.dll) and in the program that calls the dll. (consoleapptest)
am i missing something? i'm using DLLImport to call a unmanaged c++ method from a C# DLL, and then from the console app i'm calling a method in the C# dll that calls the unmanaged Dll.
thanks, donovan
rather have something you don't need, than need something you don't have
|
|
|
|
|
It's not a COM dll ? If it is, it still needs to be registered.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
no not the touchlib.dll , that's a unmanaged dll that a COM dll is trying to access. when i type 'regasm touchlib.dll' it tells me that touchlib.dll or one of it's dependencies couldn't be found, could it be a dependency? or am i missing something when i compile? maybe you can tell me what compile options MUST be set to get DLLImport to work with it?
could i not be exporting symbols?
rather have something you don't need, than need something you don't have
|
|
|
|
|
donsolms wrote: maybe you can tell me what compile options MUST be set to get DLLImport to work with it?
None.
It sounds like your dll is missing a dependancy, if the dll is there. It's unmanaged, does it need MSVCRT, or the MFC dll ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
IIRC the unmanaged dll's that you refer to with [DllImport] must be in the Windows path
(e.g. in C:\Windows\system32); the app's bin directory is only searched for managed code.
Of course you could add your app's bin directory to the Windows path and put everything
in there.
|
|
|
|
|
i quickly tried that, but it doesn't seem to work, maybe i'm not compiling the unmanaged DLL correctly?
i will write a different dll and try it with that one
rather have something you don't need, than need something you don't have
|
|
|
|
|
Hi,
I reread your original post, and I am getting the impression you did it again:
using DllImport on a dll for which you were able to add a reference.
AFAIK it is one or the other:
- unmanaged code dll's need DllImport and can not be added as a reference;
- for managed code a reference must be added, and DllImport wont work.
I am not sure how it works for a COM dll, I expect you need to add a reference
and dont need DllImport...
|
|
|
|
|
Luc Pattyn wrote: I am not sure how it works for a COM dll, I expect you need to add a reference
and dont need DllImport...
That is correct.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello.
I am changing a property on OnComponentChanged using the ff code:
pd = TypeDescriptor.GetProperties(instance)["Size"];
pd.SetValue(instance, sz);
I dont get compiled error, but when I drop the component on the form
at runtime I got this error:
An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll
Im a newbie in c# so I appreciate any help
thanks.
|
|
|
|
|
A stack overflow error means that the code being run by the event, is firing the event again, and so it just keeping calling itself until the stack overflows.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thanks Christian
I know what the error means what I dont understand is why its getting that error.
The code is not recursive nor it have infinite loop or something.
It just change the value of the property specified which is the size.
Any other idears?
|
|
|
|
|
sanicra wrote: pd.SetValue(instance, sz);
doesnt this cause another (nested) ComponentChanged event ?
|
|
|
|
|
Thanks Luc,
I suppose it does, so what do you suggest, how do I change a propert value when a component has changed.
What I would like to do is when you try to resize a component it will force this value (sz)
The component is a picturebox. When you resize a picturebox you can make it a square or a rectangle.
What I would like is to force the size into some value (sz) which is a computation base on some aspect ratio.
My problem is where do I change the value. I tried to put it on OnComponentChanged but it gives me that error.
Hope my problem is clear to all of you so you can help me more. Thanks
|
|
|
|
|
Hi,
in my experience the methods OnXxxChanged() only get fired when there actually is a
change, not when the same value gets set. To restrict a new size somehow, I use
OnResize, and that one never kept firing on me. I havent used OnComponentChanged() yet.
I see basically three solutions:
1. try using OnResize()
2. prevent an infinite call chain by having a class variable that notes whether you
are already resizing, something like:
private bool IamResizing=false;
void OnComponentChanged() {
if (!IamResizing) {
IamResizing=true;
... your stuff
IamResizing=false;
}
}
3. prevent an infinite call chain by temporarily removing your handler from its
delegate.
ComponentChanged-=OnComponentChanged;
... your stuff
ComponentChanged+=OnComponentChanged;
Hope this helps.
|
|
|
|
|
thanks. i got it sorted out with OnReSize.
I created a class and just override the OnResize and
put my code in there.
Thank you for your ideas and help.
God bless.
|
|
|
|
|
hi im new to c# but i do have some experience with other languages
here the problem ive wrote a PSP Game that will allow users to make their own quizes (in pretty much plain text) but i would like to make an app to make it even easier (Console or whatever) this is what i have so far
using System;<br />
<br />
using System.Collections.Generic;<br />
using System.Text;<br />
<br />
namespace ConsoleApplication1<br />
{<br />
class Program<br />
{<br />
<br />
static void Main(string[] args)<br />
{<br />
<br />
Console.Write("How Many Questions Do You Want In This Quiz : ");<br />
string NOQuestions = Console.ReadLine();<br />
<br />
Console.Write("Enter A Question : ");<br />
string Question = Console.ReadLine();<br />
<br />
Console.Write("How Many Answers Do You Want For This Question : ");<br />
string NOAnswers = Console.ReadLine();<br />
<br />
Console.Write("Enter An Answer : ");<br />
string Answer1 = Console.ReadLine();<br />
<br />
<br />
Console.Write("Enter A Score : ");<br />
string Score1 = Console.ReadLine();<br />
<br />
Console.Write("Enter An Answer Or type No to exit the answer section : ");<br />
string Answer2 = Console.ReadLine();<br />
<br />
<br />
Console.Write("Enter A Score : ");<br />
string Score2 = Console.ReadLine();<br />
<br />
Console.Write("Enter An Answer Or type No to exit the answer section : ");<br />
string Answer3 = Console.ReadLine();<br />
<br />
<br />
if (Answer3 == "No")<br />
{<br />
Console.Write("Enter A Time : ");<br />
string Time = Console.ReadLine();<br />
Console.Write(Time + " ");<br />
Console.Write(Question + " ");<br />
Console.Write(Answer1 + " ");<br />
Console.Write(Answer2 + " ");<br />
Console.Write(Score1 + " ");<br />
Console.Write(Score2 + " ");<br />
}<br />
else<br />
{<br />
Console.Write("Enter A Score : ");<br />
string Score3 = Console.ReadLine();<br />
}<br />
<br />
<br />
}<br />
<br />
}<br />
<br />
<br />
}<br />
<br />
<br />
ok now what i need to do is to make it do either of these 2 things
1.when it asks you how many answer/question you want
i want so when the correct amount of answers has been made for it to move on to the timer
and when it done the timer create a new question and when it get to the correct amount of questions make it end
2.You type No to make it stop asking you for question or answers
here the template of a quiz i made for my app
Quiz = {<br />
{ "Question", { "Answer1", "Answer2", "Answer3"}, { Score1, Score2, Score3}, Time}<br />
}<br />
<br />
Creator = "Your Name"<br />
the brackets and speech marks must remain the same and each line is one question all the question except the last one need to have a , after it
SO COULD YOU POINT ME IN THE DIRECTION THAT I NEED TO GO THANKS
|
|
|
|
|
Hi
OK, first of all you need to make sure that the user has entered a number for the number of questions. int.TryParse can be used to turn a string into a number, or tell you if it can't be done. Then you want to create a loop, as in
for (int i=0;i<numquestions;++i) where="" numquestions="" is="" the="" int="" you="" created="" as="" per="" int.tryparse
{
="" any="" code="" put="" in="" here="" will="" be="" run="" numquesions="" times.
}
so,="" then="" your="" to="" get="" a="" question="" goes="" inside="" loop="" and="" runs="" number="" of="" times="" hoped.="" i'd="" create="" struct="" represent="" answer,="" list="" them="" add="" within="" loop.
=""
<div="" class="ForumSig">Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello,
I have a xml document like this:
< ? xml version = " 1.0 " ? >
< Accounts >
< Account ID = " 123456 " >
< FirstName > Latheesan < / FirstName >
< SecondName > Kanes < / SecondName >
< Balance > 0 < / Balance >
< OverDraftLimit > 50 < / OverDraftLimit >
< FullAddress > My Address Here < / FullAddress >
< / Account >
< / Accounts >
What i am trying to do is select one matching document node based on my XPath expression and then when found, assign each element node's value to set of strings.
So far, this is what i was able to do:
private void searchBtn1_Click(object sender, EventArgs e)<br />
{<br />
try<br />
{<br />
string fileName = "Account_Data.xml";<br />
XPathDocument doc = new XPathDocument(fileName);<br />
XPathNavigator nav = doc.CreateNavigator();<br />
<br />
XPathExpression expr;<br />
expr = nav.Compile("//Account[@ID='" + accountIDInput.Text + "']");<br />
XPathNodeIterator iterator = nav.Select(expr);<br />
<br />
nav.MoveToFirstChild();<br />
MessageBox.Show(nav.Value);<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show("Error : " + ex.Message);<br />
}<br />
}
I printed the XPath Expression result using MessageBox.Show to see what the results would be like. On the message box, i saw the entire document node and it's element nodes and their values.
How do you obtain the results after running XPath expression and assign element node's value like this:
string AccountID = nav.value;
string FirstName = nav.value;
string SecondName = nav.value;
string Balance = nav.value;
string OverDraftLimit = nav.value;
string FullAddress = nav.value;
|
|
|
|