用PC喇叭发声的方法是?

pino 2000-04-24 06:31:00
清讲详细一点,有例程更好,我才学汇编不久,想在windows下使喇叭奏乐,而不是只发出简单的嘀嘀声
...全文
389 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
sxabu 2010-06-03
  • 打赏
  • 举报
回复
咋没有纯的啊
sdzym 2001-10-07
  • 打赏
  • 举报
回复
// 通过PC喇叭发出声音
UINT Sound(LPVOID pParam)
{
int FreqTable[100];
int DelayTable[100];

for(int i=0;i<10;i+=100)
{
FreqTable[i]=50*i+500;
DelayTable[i]=100;
}

int *nFreqTableLength = (int *)pParam;
int Freq;
for(i=0;i<*nFreqTableLength;i++)
{
Freq=FreqTable[i];
if(Freq<37||Freq>32767)
{
_outp(0x61,_inp(0x61)&0xFC);//NoSound()
continue;
}
Freq=1193181/Freq;
_outp(0x61,_inp(0x61)|3);
_outp(0x43,0xB6);
_outp(0x42,Freq&0x00ff);
_outp(0x42,(Freq&0xff00)>>8);
Sleep(DelayTable[i]);
_outp(0x61,_inp(0x61)&0xFC);//NoSound()
}
_outp(0x61,_inp(0x61)&0xFC);//NoSound()
return TRUE;
}

void NoSound()
{
_outp(0x61,_inp(0x61)&0xFC);
}
猛禽 2000-10-06
  • 打赏
  • 举报
回复
有兴趣的话看看本文:http://go1.163.com/~comanche/progart/bcb_asm.htm
80586 2000-09-10
  • 打赏
  • 举报
回复
我可以用我的工具程序将.WAV文件转换为1Bit数据序列,
然后再用我的ASM子程序播放,即可发出比较简单的声音和音乐,
类似于早期金山影霸的软声卡。
如果要源程序(不超过100行)请EMAIL: w80586@163.net
Pascal 2000-07-20
  • 打赏
  • 举报
回复
--
Areslee 2000-07-12
  • 打赏
  • 举报
回复
找清华的《宏汇编语言程序设计》温冬婵、沈美明著
wu1975 2000-06-01
  • 打赏
  • 举报
回复
please program 8253 3chunnel and 8255. ok,
smile_and_smile 2000-06-01
  • 打赏
  • 举报
回复
找一本书(清华的),上面有1,2,3,4,等的对应的数字,即可控制奏乐!!
pino 2000-04-25
  • 打赏
  • 举报
回复
对不起,你的方案我早就试过,NT下可行,或win9x的机器没装声卡也行.
Windows 95: The Beep function ignores the dwFreq and dwDuration parameters. On computers with a sound card, the function plays the default sound event. On computers without a sound card, the function plays the standard system beep.

-MSDN
guo 2000-04-24
  • 打赏
  • 举报
回复
不需要调用汇编,在windowsAPI中有一个函数Beep(声音频率(赫兹),发音时间(0.001秒为单位).比如让计算机发出特定的声音可以起驱蚁的作用.

21,453

社区成员

发帖
与我相关
我的任务
社区描述
汇编语言(Assembly Language)是任何一种用于电子计算机、微处理器、微控制器或其他可编程器件的低级语言,亦称为符号语言。
社区管理员
  • 汇编语言
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧