|
from microphone without using directshow/directsound and all those complex things
DirectX is a layer provided by Microsoft to access hardware using a standard uniform API, without it, you will have to write each API for each of the hardware installed. Like, when you need to use Creative Sound Card, you will need separate API and so is other sound card. You will need a lot of version of your program to get it compatible.
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
Anthony - That's not entirely correct. Another option is to use the Windows MME API - for example the WaveIn* functions will do the trick too, and you won't really care about the hardware.
Shoonya - start with the WaveInOpen function and go from there. I don't really know what you are looking for, but this is a viable alternative to DirectX. You might find, though, that this is has different 'complex things', and DirectX might still be the way to go. The choice is yours.
Marcus Spitzmiller
"Why must life be so hard? Why must I fail at every attempt at masonry?" - Homer
|
|
|
|
|
Sorry, but decided to delete my previous posting. I don't want to deal with any questions. If you use email notification, you'll have a copy.
Here's an article that covers some of the same things (except, he apparently uses callbacks, which I don't normally recommend, but if it works....) http://www.codeproject.com/audio/wave_class_for_playing_and_recording.asp#xx648264xx[^]
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Hi and thanks in advance:
I am trying to create an application that first offers the user to open a file. I am using the function GETOPENFILE, then I my purpose is to check in the same folder, if there is another file (no user interaction there). For that, I was using the variable ofn (OPENFILENAME type) from the previous task, so it should have the information of the path and file name.
I tried, but had troubles to do that.
Here is a part of the code:
<br />
<br />
void CMainFrame::OnButton32794() <br />
{<br />
<br />
OPENFILENAME ofn;<br />
memset(&ofn, 0, sizeof(ofn));<br />
ofn.lStructSize = sizeof(ofn);<br />
ofn.lpstrFilter = "Tec Files (*.tec)\0*.tec\0All Files (*.*)\0*.*\0\0";<br />
int nResult = ::GetOpenFileName(&ofn);<br />
<br />
CString str;<br />
LPCTSTR azcv;<br />
TCHAR szPath[MAX_PATH];<br />
LPCTSTR lpszFileName;<br />
LPTSTR lpszFilePart; <br />
WCHAR wszTemp[MAX_PATH];<br />
<br />
lpszFileName = ofn.lpstrFile;<br />
<br />
str = GetFullPathName(lpszFileName, <br />
sizeof(szPath) / sizeof(TCHAR), <br />
szPath, &lpszFilePart);<br />
<br />
MessageBox(str);<br />
}<br />
<br />
|
|
|
|
|
Why call GetFullPathName() at all? If you are interested in the filename that was selected, just reference ofn.lpstrFile .
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
ok, I just want to check if in the same folder, the one that the user select by selecting the file there is another specific file... without the interaction of the user. that's all.
Thaks, Ruben.
|
|
|
|
|
Use _splitpath() to split ofn.lpstrFile into its individual components. Then merge the components back together using " another specific file" instead of the file that was selected via GetOpenFileName() .
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Thanks, could give and example on how to use this function?
Thanks, Ruben.
|
|
|
|
|
I presume you are referring to _splitpath() . If so, the MSDN docs have a good example.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
How would you merge the other file with the path?
Thanks, Ruben.
|
|
|
|
|
Use a CString object and its concatenation operator. Smething like:
CString str = drive + dir + file_you_want_to_check;
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
MS documentation states: "The GetFullPathName function retrieves the full path and file name of a specified file". So you still have the file name there.
I'd use PathRemoveFileSpec this "Removes the trailing file name and backslash from a path, if it has them."
Info on PathRemoveFileSpec:
Minimum DLL Version shlwapi.dll version 4.71 or later
Header shlwapi.h
Import library shlwapi.lib
Minimum operating systems Windows 2000, Windows NT 4.0 with Internet Explorer 4.0, Windows 98, Windows 95 with Internet Explorer 4.0
|
|
|
|
|
Thanks, I am able to use that function ..
I call it with the ofn.lpstrFile (path and file name).
Then I should have the ofn.lpstrFile ready to merge with the other file name ... how can I do this?
Thanks, Ruben.
|
|
|
|
|
If you've got the Windows SDK then you'll find details about the Shell Lightweight Utility Path Funtions in the documentation under:
User Interface Services > Windows Shell > Shell Reference > Shell Lightweight Utility Funtions > Path Functions.
(If you've not got the SDK then I recommend you get it. It's a free download from msdn)
There are lots of useful routines for manipulating paths. The one you need to merge the path with the name of the 2nd file is PathAppend.
Cheers, Chris
|
|
|
|
|
|
Hi.
How could I convert an hecadecimal value that is in a CString variable to integer hexadecimal
for example I have:
CString strHexa="C9"
but I need this value in an integer variable:
int n=0xc9;
Thank you.
|
|
|
|
|
char *end;
int n = strtol(strHexa, &end, 16);
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
<font style="color:blue;">#include</font> <stdio.h> <font style="color:green;">
<font style="color:blue;">#include</font> <CString> <font style="color:green;">
<font style="color:blue;">int</font> my_integer = 0;
Cstring string = "C9";
<font style="color:blue;">char </font>str[] = (LPCTSTR)string;
sscanf(str, "%x", my_integer);
printf("%d %x\n", my_integer, my_integer);
this outputs : 201 C9
TOXCCT >>> GEII power
|
|
|
|
|
Anyone knows how to set up Windows XP theme for the controls.
Thanx very much...;)
|
|
|
|
|
Do you mean for your application, or so you can draw controls using themes?
If the latter, look up OpenThemeData()[^] in MSDN for a starting point.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
You need to use manifest, there are number of articles that shows how to use them here in CP.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
The usual technique of traversing a folder and all it's sub-folders is pretty commonplace, but it suffers from the fact that the stack just might run out (sure, we can specify the stack size in vc, but we dont want to hog a lot of memory for the stack!).
What is a good way to use a non-recursive loop to traverse folders? Is there no solution apart from using "goto" statements?
Bikram
|
|
|
|
|
Bikram Singh wrote:
What is a good way to use a non-recursive loop to traverse folders? Is there no solution apart from using "goto" statements?
Sure there is. Just call SetCurrentDirectory() with each directory encountered.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Do you have some source code for the entire problem?
Bikram
|
|
|
|
|
No. I've personally not ever used the function. It's a hold-over from the Unix world and its single-threaded environment. For Windows and multi-threaded applications, if another thread is running, the "current directory" is constantly changing for all of the threads. For anything that requires folder traversal, I always use recursion. Can you explain in more detail your hesitation in using this methodology?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|