W
wxylt555888
Unregistered / Unconfirmed
GUEST, unregistred user!
各位大侠。请看下面代码:
procedure TForm1.Button1Click(Sender: TObject);
begin
m_Format.wBitsPerSample:= 16;
m_Format.wFormatTag:= WAVE_FORMAT_PCM;
m_Format.nChannels:= 1;
m_Format.nSamplesPerSec:= 22050;
m_Format.nBlockAlign:= 2;
m_Format.nAvgBytesPerSec:=m_Format.nSamplesPerSec*m_Format.nBlockAlign;
m_Format.cbSize:= 0;
g_dwOutputBufferSize:=38192;
DSBufferDesc1.dwSize:=sizeof(DSBUFFERDESC1);
DSBufferDesc1.dwFlags:=DSBCAPS_GLOBALFOCUS;
DSBufferDesc1.dwBufferBytes:=g_dwOutputBufferSize;
DSBufferDesc1.lpwfxFormat:=@M_Format;
DirectSoundCreate(nil,DirectSound,nil);
//建立默认设备接口
IF DirectSound.SetCooperativeLevel(application.Handle,DSSCL_PRIORITY) <>DS_OK then
//DSSCL_WRITEPRIMARY,
showmessage('Unable to set Coopeative Level');
IF DirectSound.CreateSoundBuffer(DSBufferDesc1,DirectSoundBuffer1, nil) <> DS_OK then
showmessage('Create Sound Buffer failed');
end;
我在前面Uses中引用的是Directx,我创建了一个DirectSoundBrffer1,请问我如何将它释放掉。用DirectsoundBuffer1.Release不行,根本就不支持此方法,请问各位大侠如何处理。
procedure TForm1.Button1Click(Sender: TObject);
begin
m_Format.wBitsPerSample:= 16;
m_Format.wFormatTag:= WAVE_FORMAT_PCM;
m_Format.nChannels:= 1;
m_Format.nSamplesPerSec:= 22050;
m_Format.nBlockAlign:= 2;
m_Format.nAvgBytesPerSec:=m_Format.nSamplesPerSec*m_Format.nBlockAlign;
m_Format.cbSize:= 0;
g_dwOutputBufferSize:=38192;
DSBufferDesc1.dwSize:=sizeof(DSBUFFERDESC1);
DSBufferDesc1.dwFlags:=DSBCAPS_GLOBALFOCUS;
DSBufferDesc1.dwBufferBytes:=g_dwOutputBufferSize;
DSBufferDesc1.lpwfxFormat:=@M_Format;
DirectSoundCreate(nil,DirectSound,nil);
//建立默认设备接口
IF DirectSound.SetCooperativeLevel(application.Handle,DSSCL_PRIORITY) <>DS_OK then
//DSSCL_WRITEPRIMARY,
showmessage('Unable to set Coopeative Level');
IF DirectSound.CreateSoundBuffer(DSBufferDesc1,DirectSoundBuffer1, nil) <> DS_OK then
showmessage('Create Sound Buffer failed');
end;
我在前面Uses中引用的是Directx,我创建了一个DirectSoundBrffer1,请问我如何将它释放掉。用DirectsoundBuffer1.Release不行,根本就不支持此方法,请问各位大侠如何处理。