|
Good morning.
I'm sorry, I haven't used this functions myself. So I can't tell you weather it's possible to get the contents of the stored sound or not.
But good luck anyway.
kakan
|
|
|
|
|
Hello pakFari,
You can use the standard windows functions to do this:
MMRESULT waveInOpen
(
LPHWAVEIN phwi,
UINT uDeviceID,
LPWAVEFORMATEX pwfx,
DWORD dwCallback,
DWORD dwCallbackInstance,
DWORD fdwOpen
);
MMRESULT waveInPrepareHeader
(
HWAVEIN hwi,
LPWAVEHDR pwh,
UINT cbwh
);
MMRESULT waveInAddBuffer
(
HWAVEIN hwi,
LPWAVEHDR pwh,
UINT cbwh
);
MMRESULT waveInStart
(
HWAVEIN hwi
);
MMRESULT waveInUnprepareHeader
(
HWAVEIN hwi,
LPWAVEHDR pwh,
UINT cbwh
);
MMRESULT waveInClose
(
HWAVEIN hwi
);
Details on these functions can be found in de Win32 Developer's References.
I wrote a little example program to demonstrate these functions. This example records 60 seconds of low quality audio from the wave audio input device. I use a simple event callback mechanisme to signal the thread when recording is done. There are more elegant way's of doing this. But i think it is up to you to discover how...
HANDLE hEvent;
HWAVEIN hWaveIn;
WAVEFORMATEX WaveFormat=
{
1, //wFormatTag
1, //nChannels
8000, //nSamplesPerSec
8000, //nAvgBytesPerSec
1, //nBlockAlign
8, //wBitsPerSample
0 //cbSize
};
WAVEHDR WaveHeader;
hEvent=CreateEvent(NULL,TRUE,FALSE,NULL);
if(hEvent==NULL)
{
//Handle error
return;
}
//Open wave audio input device
if(waveInOpen(&hWaveIn,WAVE_MAPPER,&WaveFormat,(DWORD)hEvent,0,CALLBACK_EVENT)!=MMSYSERR_NOERROR)
{
//Handle Error
return;
}
WaveHeader.lpData=new BYTE[60*WaveFormat.nAvgBytesPerSec];
WaveHeader.dwBufferLength=60*WaveFormat.nAvgBytesPerSec;
WaveHeader.dwFlags=0;
//Prepare a wave header for waveform-audio input
if(waveInPrepareHeader(hWaveIn,&WaveHeader,sizeof(WAVEHDR))!=MMSYSERR_NOERROR)
{
//Handle Error
return;
}
//Send a input buffer to the given waveform-audio input device
if(waveInAddBuffer(hWaveIn,&WaveHeader,sizeof(WAVEHDR))!=MMSYSERR_NOERROR)
{
//Handle Error
return;
}
if(waveInStart(hWaveIn)!=MMSYSERR_NOERROR)
{
//Handle Error
return;
}
ResetEvent(hEvent);
WaitForSingleObject(hEvent,INFINITE);
if(waveInUnprepareHeader(hWaveIn,&WaveHeader,sizeof(WAVEHDR))!=MMSYSERR_NOERROR)
{
//Handle Error
return;
}
if(waveInReset(hWaveIn)!=MMSYSERR_NOERROR)
{
//Handle Error
return;
}
waveInClose(hWaveIn);
//Process data
WaveHeader.lpData[dwIndex]=//etc...
You can also use the Direct sound api.
|
|
|
|
|
Can anyone tell me what CScrollView class can do?
Where and how can i use it.
Thanks
Its not the result, its the effort to achive the result which is valueable.
|
|
|
|
|
|
If you encounter m_nMapMode==MM_NOME error, manually assgined it before that.
Use CScrollView's member func to scroll instead of its CScrollbar child wnd's.
And the class is very convienent to use.
-- modified at 4:39 Thursday 29th September, 2005
|
|
|
|
|
U have got the right question for me ?
I have just done up using the CScrollView
in my MFC project.
A CScrollView class will encapsulate all
the functions for Scrolling (vertical &
horizontal). If u use a CView as normally
done in MFC project then u need to code
everystep for the Scrolling function .But
in CScrollView derived classes u just
need to put up few line of code.
Shorltly comming up with a small application
and will upload on the codeproject .
Hope so this make u r dobut clear
:->
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
I'm moving from VC6 to VC2003 and from multi-byte to Unicode.
After fixing all the errors related to unicode, i ended with an error i
can not resolve.
************
error C2664: 'InterlockedExchangePointer' : cannot convert parameter 1
from 'T ** ' to 'void ** '
with
[
T=MyClass
]
Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast
********************
The code is:
***************
MyClass * mQ_waiting_for_write;
InterlockedExchangePointer(&mQ_waiting_for_write, NULL);
**************
Any ideas what is the problem?
|
|
|
|
|
This is the right way to do it:
void** arg = static_cast<void**>(static_cast<void*>(&mQ_waiting_for_write));
InterlockedExchangePointer(arg, new_Q);
or shorter:
InterlockedExchangePointer((void**)&mQ_waiting_for_write, new_Q);
|
|
|
|
|
I am having a window application in which i am using ShChangeNotifyRegister API to get File system notifications.
It is working fine . but if the explorer is terminated from the task manager and started again I am not getting any notifications . I am able to identify that Explorer has been killed and when new explorer starts I am registering my applcation again with shell .But still I am not able to get any notifications . Any solutions on how to proceed doing it ?
|
|
|
|
|
Hello,
maybe this can be of interest for someone: my multi-threading mfc-app crashed sometimes not reproducable on systems with hyper-threading active. So it would be very nice if i could tell my app to use only one cpu even if hyper-threading is active. After searching msdn and the internet for a method to do this, i found this api-function:
SetProcessAffinityMask(GetCurrentProcess(), 1);
The first parameter is the handle to the current process (my app) and the second parameter is a 32-bit value (mask) where every bit represents a cpu. Calling this function solved the problem of my hardly to reproduce exceptions.
Of course it does not fix the problem at the root because my app isn't HT-compatible at least, but now i have more time to learn about the difference between using HT and not using HT. Maybe someone knows a good starting-point for this.
Best regards,
Tabor25
|
|
|
|
|
Nice to know, thx
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
Good Thank you
if any one has idea
how to do a VPN connection
through a vc++ ??
Some special API's for it
are availabel for VPN connection?
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Situation: I have a windows application – C++ MFC Dialog based – which can be stopped by users from Task Manager. (Normally behavior)
Can you please provide me a piece of code or a web reference that I can include into my project in order to prevent the application stop from the Task Manager?
Thank you.
|
|
|
|
|
|
there are many
demo code availabe just
put a search in codeproject
or Google u get one ,
i have found one code
http://www.codeproject.com/system/Hack_Windows_Task_Manager.asp
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Thank you.
This might work.
Regards,
|
|
|
|
|
Hi all
I am totally confused about a string table entry giving problem !
I have a string table in the name lng049.rc . In that I have an entry IDS_VMUL_TE = "MyName" . This lng049.rc -->cimpiles as a lng049.dll . I changed the value from "MyName" to "YourName" but its still showing "MyName" during runtime !!
I cleaned all , rebuild all , even deleted debug/release folders and rebuild all . Still the same "MyName" is coming .
I dont understand where from the IDS_VMUL_TE value is taken other than the lng049.rc . I searched for the occurance of the string tabel entry BUT found only instance which now corresponds to "YourName" . Totally confused . Anyone to help me ?
redindian
|
|
|
|
|
Is there any problem with the paths?
|
|
|
|
|
How can we connect to a server through ADO and how can v get data.
Ur's
Raman
|
|
|
|
|
Venkata Ramana Raju wrote:
How can we connect to a server through ADO
strConnection = _T("Driver={SQL Server};Server=MyServerName;"
"Trusted_Connection=no;"
"Database=MyDatabaseName;Uid=MyUserName; Pwd=MyPassword;");
Venkata Ramana Raju wrote:
and how can v get data
ADO[^]
ADO at a glance[^]
-------------------------------
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
Hi,
Thank you for u r reply. I connected to a local database through u r help. But i want to connect to oracle server and want to get data from an oracle table. Can u please tell how to do this
Ur's
Raman
|
|
|
|
|
Venkata Ramana Raju wrote:
Thank you for u r reply. I connected to a local database through u r help. But i want to connect to oracle server and want to get data from an oracle table. Can u please tell how to do this
Connecting to the database is half the battle.
This article should get you going. One of the major benefits to ADO is it doesn’t care what db your connecting to they all present the same interface. So what’s said in this article should apply to Oracle as well.
ADO at a glance[^]
If you have trouble connecting to the Oracle DB with the connection string I provided for you, see marcdev's post for more connection strings.
Good luck...
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
Maybe this article [^]will help you.
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
Just like a firewall or a proxy, get all the IP packages from a computer.
Please give me some advice.
Thanks!
|
|
|
|
|
I am trying to make a CDialog appear to be (and act as such) part of a Child Form.
//Here I have am being passed the HWND to the form.
void CMyDLL::MakeNewPanel( HWND hwnd )
{
CWnd * myCwnd = CWnd::FromHandle( hwnd );
pPanel = new CPanel( CPanel::IDD, myCwnd );
BOOL worked = pPanel->Create( CPanel::IDD, myCwnd );
pPanel->ShowWindow( SW_SHOW );
}
// Panel (CDialog class)
CPanel::CPanel( UINT id, CWnd* pParent )
: CDialog( id, pParent )
{
// Do panel initialization
}
I do see the form, and the contents of the CDialog on the screen on top of each other. However, they only give the illusion of being attached... here are the problems:
1. It does not resize to the correct size of the CDialog
2. If I move the form, it moves independently of the CDialog contents, or if I move anything else, it moves in between them.
3. When I close the form, it does not respond to the WM_CLOSE function of my CPanel class.
Here's what I know...
- Obviously the form is not accepting the CDialog as it's new "device contents" per se.. no clue, this is driving me nuts!
- The 3rd problem relates to the need to Subclass the CDialog to the Form, but can I do this without wrapping it in a larger CWnd class? I would pressume so since CDialog is inherited from CWnd, but it causes a really nasty assertion failure!
Would love any and all help you can give, I'm stumped! Thanks!
-- modified at 23:11 Wednesday 28th September, 2005
|
|
|
|