|
I think you mean atoi but
it´s a way to try but if it works is the other questions.
|
|
|
|
|
No this is not working. The integer will be 0 after using atoi.
|
|
|
|
|
There's 2 issues here. One is the encoding PCM vs uLaw and the other is the file format, headers, footers, record structure etc. It's a few years since I did this but I suggest you code a reader and a writer for each file format and ensure that you can successfully read and write example files of each type, with noise in is fine as long as the noise is the same after you've read it in and written it out again. Then you need to look into the encoding side and work out how to get the audio information translated from one encoding to the other or to an acceptable common encoding for an existing codecs.
The biggest issue with this stuff is likely to be time efficient buffer management. Just remember that calling new and delete is very expensive.
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
That´s all done but the methods for encoding are available and I just want to know how to give the recorded sound to this methods.
How do you mean to look in the encoding side. I´m just a beginner in sampling and encodign sound. Do you have any Code Snippets or a good tutorial?
|
|
|
|
|
CrazyDogg wrote: I just want to know how to give the recorded sound to this methods.
Usually you just pass a buffer of Bytes possibly a whole number of longs i.e. length a multiple of 4 but it's usually best to think of it as just a black box buffer of bytes.
CrazyDogg wrote: Do you have any Code Snippets or a good tutorial?
Sadly no, it was part of my previous job, neary 4 years ago.
All you should need to know is the encoding in which the method expects it input data and the prototype of the function you're calling. What does it look like?
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
The prototype looks like unsigned char* linear2uLaw(int buf);
|
|
|
|
|
I'm gussing that's old style C and the int they expect is the address of the buffer. Assuming your buffer is a char array you probably need something like
<br />
char existingBuffer[ LARGE_SIZE ];<br />
char* pNewBuffer = linear2uLaw( reinterpret_cast< int >( &( existingBuffer[0] ) ) );<br />
That assumes that the call allocates a new buffer with the converted data. If it does it in-place then pNewBuffer will end up == to &existingBuffer;
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
Oh Im Sorry the return parameter is not unsigned char* it is unsigned char
|
|
|
|
|
I'm guessing the conversion is in place then, i.e. the buffer you pass will be modified and the return will either be an error code or something like the number of bytesin the coverted buffer. You really need some docs on what you're calling to be sure.
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
Hi Masters!
--------------
As you probably know, messages sent to a thread using PostThreadMessage() aren't associated with a window, that's
hWnd member of MSG structure is set to NULL.
On the other hand, TranslateMessage() fails in the case of
encountering NULL as hWnd member of message sent to it!
Now, how can I Translate messages recieved by a thread that has
no windows in it?
Thank you masters!
|
|
|
|
|
How many times has it been suggested to you to create a hidden window?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Are you angry Mark?
|
|
|
|
|
Nah....just asking
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I now Mark BTW I didnt see you on the codeproject,I think previously you was more active here,right?
|
|
|
|
|
I'm here every day
Activity on the boards has seemed pretty slow.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have a requirement in MFC where I have a number of controls whose names are stored in the xml file.
I wish to fetch these id names from xml file, convert it to CWnd objects and then take some customization action like apply some backgrnd color and all.
My problem is - how do I retrieve resource Ids when I have resource names ?
Regs
Cage
|
|
|
|
|
Have you seen this[^].
Regards,
Rane
|
|
|
|
|
Wow! that was really helpful. I don't think my issue was that "elongated". Anyways, I had an idea to do it myself but was looking out for a way which can save me from saving un-necessary info in xml apart from ctrl ID names.
Thanks
Cage
|
|
|
|
|
Is your link correct ? Because I'm coming to a post which is a question ("how to filter the packets enter in to our network in VC++?") and has nothing to do with the original question .
|
|
|
|
|
The link I posted earlier was an incorrect link and the correct link is here[^]
Regards,
Rane
|
|
|
|
|
The answer is up to you. We have no way of giving any solid recomendations without lots more information. As Rane implied, you are asking us for a lot of work, which you won't get...
Does the xml file describe control positions and names? You could read in the xml file, and give the first control you find ID=100, second one ID=101, and so on. Store this name->ID mapping in a (gasp) map container. When you want to look up a control by name later, look up the ID in that map.
And that's just one idea.
Iain.
|
|
|
|
|
Sorry if my query was vague. Perhaps, I deserved a "can you give more details" type reply rather than a rude "goto this URL and "
As for your idea which is more constructive than Rane's, let me give some more detail.
Ctrl IDs are autogenerated by compiler and may get over-written so I don't want to store them in the XML. What I was thinking is to store ID Names
IDC_X1 in the xml and then retrieve the ctrl ID corresponding to the string "IDC_X1".
May be it has a very simple solution which didnt click in my mind but is it "asking too much" or "getting my homework done" type question ?
Thanks
Cage
|
|
|
|
|
cagespear wrote: Ctrl IDs are autogenerated by compiler
It is generated by the resource editor, not by the compiler. It means that once your UI is done and you don't touch it anymore, you can recompile your project as many times as you like and the Ids won't be changed. Furthermore, nothing prevents you to open the resource file with a text editor and assign the Ids yourself manually (you have to take care about not assigning an existing value).
So, I think using the control Id in your xml is perfectly fine (and that's the way I would follow).
If you design your UI, adding new controls won't change the Id of existing controls (AFAIK because I never saw something like that happening).
|
|
|
|
|
Cedric Moonen wrote: you can recompile your project as many times as you like and the Ids won't be changed
I was not referring to re-compilation changing the Ids, here's my case -
My resource file has more than 30k records and there are lots of merge operations happening on RC because so many people are working on the same project everyday. A lot of times there is a clash on IDs on which a developer has to change the Ids to make them unique. That is why we were reluctant to use numeric IDs. May be there is no easy way to go about it, but we will/are trying to somehow use ID name itself and not numeric ID.
Regards
Cage
|
|
|
|
|
I'm sorry, I made a mistake: the Ids are defined in the resource.h file, not in the rc file. So, you don't even need to open it with a text editor, you can open the resource.h file directly and check the Ids or assign them yourself.
|
|
|
|