大侠 DirectSound 问题请教。(50分)

  • 主题发起人 主题发起人 wxylt555888
  • 开始时间 开始时间
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不行,根本就不支持此方法,请问各位大侠如何处理。
 
delete DirectSoundBuffer1;
可否?
 
TO: lzjnuaa
谢谢你,我找到答案了:DirectSoundBuffer1:=nil;
 
DirectSoundBuffer1:=nil;
 
接受答案了.
 
DirectSoundBuffer1:=nil;
 
后退
顶部