游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1138|回复: 0

DirectSound处理音频流的问题

[复制链接]

20

主题

84

帖子

84

积分

注册会员

Rank: 2

积分
84
发表于 2010-1-12 13:47:00 | 显示全部楼层 |阅读模式
IDirectSoundBuffer8:ock
HRESULT Lock(
  DWORD dwOffset,
  DWORD dwBytes,  
  LPVOID * ppvAudioPtr1,
  LPDWORD pdwAudioBytes1,
  LPVOID * ppvAudioPtr2,
  LPDWORD pdwAudioBytes2,
  DWORD dwFlags
);


dwOffset

Offset, in bytes, from the start of the buffer to the point where the lock begins. This parameter is ignored if DSBLOCK_FROMWRITECURSOR is specified in the dwFlags parameter.

dwBytes

Size, in bytes, of the portion of the buffer to lock. The buffer is conceptually circular, so this number can exceed the number of bytes between dwOffset and the end of the buffer.


   1      2      3      4
|。。。|。。。|。。。|。。。|
假设上面是将一个整的buffer分成四个小buffer块,每播放完一个buffer块,就读入一个新的音频数据块填入这个buffer块中。

若某时刻,在播放完2这个buffer块后,进行buffer 2的数据更新。这时:
//IDirectSound8 *g_pDS;             // DirectSound component
//IDirectSoundBuffer8 *g_pDSBuffer; // Sound Buffer object
//IDirectSoundNotify8 *g_pDSNotify; // Notification object
//DWORD  subBuffer=....//小buffer块的字节数
//DWORD  Size=...//整个大buffer的字节数

pDSBuffer->Lock(subBuffer*1, Size,
(void**)&amptr1, &Size1,
(void**)&Ptr2, &Size2, 0);
Ptr1,Ptr2,Size1,Size1将分别返还什么?
Ptr1,Ptr2分别指向什么位置?
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-6-16 13:00

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表