|
gurindersm wrote: Any ideas what wrong i am doing or if i am missing any step.
I've never used UriBuilder, however based on the documentation[^] you don't appear to using it correctly. It does not seem that including the protocol "http" in the .Host property is correct.
|
|
|
|
|
Hi,
I have a CLI audio recording program which uses WaveIn and WaveOut to record.
1. I need to prepare buffer and should be able to use for less time i.e., prepare the buffer for 30 mins but should be able to stop at 15 mins and save it to file. I am not able to do this now.
2. I need to get the path of the file. I need to record to a temp file and access it.
The audio's source is Microphone. It can record for custom # of seconds. I mean, when you run VoiceRec.exe and press enter, it would ask you for the # of seconds to record. After I give a number, it prepares the buffer for that time, starts recording and saves it to a file.
But what I want is, I would like to start recording and when the user presses any key, it should stop recording and save it to a WAV file.
http://rapidshare.com/files/240845783/Working_VoiceRecording_2_.rar.html
|
|
|
|
|
Do you really have to ask the user for the # of seconds up front?
Why not just record? Open a FileStream for writing, keep writing data until
the user stops the operation or the harddrive fills up, then close the FileStream.
If you need it buffered in memory as well, use a MemoryStream as well.
Streams....nice and consistent - they are your friends
I bet the FileStream class documentation[^] has all kinds of sample code...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I don't know much C++/CLI, but my previous experience with streams have resulted in poor performance. Specifically, using a generic stream library ignores issues such as asynchronous I/O for better performance, sizing of I/O to match the underlying I/O system (ie. block size considerations based on filesystem I/O size or disk block size), efficient use of a memory cache with a size matched to the application or expected hardware configurations, and the use of threads around a well sized buffer.
Of course, if this is a "toy" application then this is all superfluous. Or perhaps Microsoft has provided more optimization to their streams than they have in the past?
|
|
|
|
|
I was referring to System.IO.Stream and its derived classes here.
I also assumed that since the source is a microphone, there probably isn't
a large audio bandwidth issue here.
IME, FileStream is more than capable of storing audio as it's captured, at least
to modern drives. MemoryStream works fine as well.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
i want to use in my code CTime!!!
any one can help
|
|
|
|
|
how about
1) try some patience & manners
2) use :-
#include <ctime>
[edit] this is asuming you dont mean the MFC CTime class - if you mean that you'll have to add the MFC includes etc if you havnt build an MFC project [/edit]
'g'
|
|
|
|
|
|
#include <atltime.h>
COleDateTime has a better range
#include <ATLComTime.h>
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
i'm using window forms application and i'm facing a problem with a variable date_time that hold
a long value 1243930978
I need to convert this number to datetime
Note : when i declare the variable as "CTime sss" it give error undeclared identifier "sss"
any one can help?
|
|
|
|
|
|
Hi,
this forum is about C++/CLI, that's the managed C++ dialect, part of .NET
it has a very nice DateTime class with some constructors, and useful methods such as Parse() and TryParse().
AFAIK there is no CTime in its universe.
Are you in the right forum? for plain C/C++ and MFC use the appropriate forum!
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
The value, 1243930978, is calculated from the number of seconds from 1/1/1970. To convert to a DateTime , you must account for this offset:
DateTime time_offset(1970, 1, 1);
DateTime time_converted = time_offset.AddSeconds(1243930978);
"We make a living by what we get, we make a life by what we give." --Winston Churchill
modified on Wednesday, June 3, 2009 4:36 PM
|
|
|
|
|
Thank you very much, i want you to know that i spend 2 days on this.
and now you gave me the right answer Thankkkkkkkkk youuuuuuuuuuuuuuuuuu.
i tried it works it gave me 3 hours difference and i handle it by adding 10800 sec
to the number. but why it gave me difference 3 hours?
|
|
|
|
|
If the value was created on computer in local time EST, and it was converted on a computer in local time PST, you will have a 3 hour difference. You should use coordinated universal time (UTC) and adjust the time according to the local time of the computer. .NET has DateTime.UtcNow and DateTime.ToUniversalTime and C/C++ has gmtime .
"We make a living by what we get, we make a life by what we give." --Winston Churchill
modified on Thursday, June 4, 2009 8:02 AM
|
|
|
|
|
Please can you give me exactly how to use this function in the code?
|
|
|
|
|
|
Thanks it works fine. with UtcNow
|
|
|
|
|
Hello,
I am experiencing some link errors and would like to ask your help please.
I have a managed C++ workspace, which contains the main app (.exe) and a DLL project that it links to called Editor.dll.
The DLL contains MFC classes for the doc/view classes (e.g. CEditorDoc, CEditorView, etc).
The DLL builds fine, but the main application .exe (managed C++) produces link errors when these DLL classes are used
within it, as demonstrated below:
Linking...
WindowsApplication.obj : error LNK2028: unresolved token "public: static struct CRuntimeClass
* __stdcall CEditorDoc::GetThisClass(void)" (?GetThisClass@CEditorDoc@@$$FSGPAUCRuntimeClass@@XZ) referenced
in function "int __thiscall CWindowsApplication::InitInstance(void)"
(Please note the header files are included in the main app file where they are used too).
The link errors all seem to be related to a "GetThisClass()" function which i think seems to have trouble being
exported out of the DLL (it is a member of base class MFC). All other functions seem fine. I also have tried
using a .def file but it doesnt seem to help.
Any help would be greatly appreciated. Thanks!
modified on Wednesday, June 3, 2009 8:34 AM
|
|
|
|
|
James1976 wrote: a DLL project that it links to called Editor.dll.
Links to how? Did you link to the impost library (Editor.lib)?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks for your reply.
I couldnt link the .lib (Editor.lib) as the .lib file is only generated if the DLL contains any exports, which it doesnt currently.
I cant export the function that has the link error (the GetThisClass() function) as its not in my code. Its in the MFC base-class and i cant override it in order to place a "declspec(export)" in front of it.
Also i cant export the entire class since it contains managed C++ code and so cannot be exported (only a class that does not contain managed code can be exported it seems).
Any further suggestions would be appreciated? Thanks.
|
|
|
|
|
James1976 wrote: I couldnt link the .lib (Editor.lib) as the .lib file is only generated if the DLL contains any exports, which it doesnt currently.
Then you have nothing to link to.
James1976 wrote: I cant export the function that has the link error (the GetThisClass() function) as its not in my code. Its in the MFC base-class and i cant override it in order to place a "declspec(export)" in front of it.
Then you create your own function that you can export and it calls the MFC function.
James1976 wrote: (only a class that does not contain managed code can be exported it seems).
That is not true. We use a DLL that I authored that is a mixed mode DLL that exports a native C++ class. That class is used in a native Win32 application. The native classes you export cannot use any managed types as parameters because then they would not be a native interface. However they can use managed objects in the implementation.
James1976 wrote: Any further suggestions would be appreciated?
See here[^]
|
|
|
|
|
Gracias!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Tomorrows is FRIDAY!
|
|
|
|
|
Hi Mike, thanks for your reply.
led mike wrote: Then you create your own function that you can export and it calls the MFC function.
Even if i add my own function there will still be a compilation error due to the base-class function. I dont think this will work as the base-class function is still directly called by base-class code (that is, the GetThisClass() function is called by the IMPLEMENT_DYNAMIC macro in MFC). I cannot modify MFC to call my own newly added function.
led mike wrote: That is not true. We use a DLL that I authored that is a mixed mode DLL that exports a native C++ class. That class is used in a native Win32 application. The native classes you export cannot use any managed types as parameters because then they would not be a native interface. However they can use managed objects in the implementation
When i tried to place the "declspec(export)" declaration in front of any class that contains managed C++, it generated a compiler error. I wonder why it worked okay for you, perhaps i dont have something correct in my code? I'll double-check this, thanks.
led mike wrote: See here[^]
Thanks for your link. I have already tried most of these, including using a .def file (which seemed to accept the .def file but still displayed the linkage errors) and using the declspec(export) for the class as mentioned above.
I have a small sample project that i could email to demonstrate, if yourself or anyone else wouldnt mind taking a look? Any help would be greatly appreciated.
Thanks,
James
|
|
|
|