Showing posts with label Directsound. Show all posts
Showing posts with label Directsound. Show all posts

Saturday, November 24, 2007

How to change the audio capture buffer size in DirectSound's CaptureSound application ?...

How to change the audio capture buffer size in DirectSound's CaptureSound application ?...


m_dwNotifySize = 3528;
Set this Value in CreateCaptureBuffer() fn,
before this line:

m_dwNotifySize = 3528;//AudioBufferSize
m_dwCaptureBufferSize = m_dwNotifySize * NUM_REC_NOTIFICATIONS;


Notification buffer size is passed to retrieve the data from the Circular buffer.
So we can set any buffer size , this will cause the change in buffer size.

Friday, November 23, 2007

Sound card capturer in Vista

Today we tested the Directsound Audio capturer in vista ...
It is not working and we checked the waveIn Multimedia APis in vista..
That is also not working.

Capturing Data from Soundcard doesn't works

Previously I got an error in capturing data from Soundcard...

Solution :
1.Right click the speaker icon appeared in the right side of the Task bar
2.The "Master Volume" titled dialog box appear.
3.Select the menu properties-> Options
4.Look at the Mixer Device...

5.There Audio and video devices are appeared...
6.Select the Audio Input device.

7.Ensure the "Checked" state of RecordingControl, MiC Volume, LineVolume and Stereo Mix of an input Device

CWaveFile Usage

void MyFunc()
{
CWaveFile* g_pWaveFile = NULL;


g_pWaveFile = new CWaveFile;
HRESULT hr = S_OK;
hr = g_pWaveFile->Open(strFileName, &wfxCaptureWaveFormat, WAVEFILE_WRITE ) ;
if(FAILED(hr)
{
OutputDebugString("Error in writing WaveFileHeader");
return;
}

DWORD dwCaptureLength;
UINT dwDataWrote;
VOID* pbCaptureData = NULL;


// Write the data into the wav file
if( FAILED( hr = g_pWaveFile->Write( dwCaptureLength,
(BYTE*)pbCaptureData,
&dwDataWrote ) ) )

return DXTRACE_ERR_MSGBOX( TEXT("Write data to wavFile"), hr );


SAFE_DELETE(g_pWaveFile);

}

CWaveFile error in Directsound

I got this error while using CWaveFile class :


SoundTest.obj : error LNK2001: unresolved external symbol "public: __thiscall CWaveFile::CWaveFile(void)" (??0CWaveFile@@$$FQAE@XZ)
SoundTest.obj : error LNK2001: unresolved external symbol "public: __thiscall CWaveFile::~CWaveFile(void)" (??1CWaveFile@@$$FQAE@XZ)


Solution :
I added the dsutil.h and dsutil.cpp in my application.
I included the library files dxerr9.lib and winmm.lib



Next I got an error like this :

Creating library QuarticsAudioCaptureDLL___Win32_Debug_unicode/AAPIPC2TV.lib and object QuarticsAudioCaptureDLL___Win32_Debug_unicode/AAPIPC2TV.exp
dsutil.obj : error LNK2001: unresolved external symbol _IID_IDirectSound3DListener
dsutil.obj : error LNK2001: unresolved external symbol _IID_IDirectSoundNotify
dsutil.obj : error LNK2001: unresolved external symbol _IID_IDirectSound3DBuffer
QuarticsAudioCaptureDLL___Win32_Debug_unicode/AAPIPC2TV.dll : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.

Solution :

include the library dxguid.lib in ur application