//////////////////////////////////////////////////////
//一个模拟振铃的程序: bell.cpp 2001.04.13 by woodmen
//////////////////////////////////////////////////////
#include<fstream.h>
#include<math.h>
enum ios::seek_dir {beg=0,end=2};
void main(){
//Open the a file to write into
ofstream fout;fout.open ("c:\\1.wav",ios::out|ios::binary);
//set the head of wave file
short h[22];{
h[0]=18770; h[1]=17990; h[2]=20992; h[3]=3;
h[4]=16727; h[5]=17750; h[6]=28006; h[7]=8308;
h[8]=16; h[9]=0; h[10]=1; h[11]=1;
h[12]=11025;h[13]=0; h[14]=11025;h[15]=0;
h[16]=1; h[17]=8; h[18]=24932;h[19]=24948;
}char*head=(char*)h;
fout.seekp (0,beg);
fout.write (head,44);
//make the wave data like a bell
unsigned char data[30000];
for(int i=0;i<30000;i++)data[i]=unsigned int(sin(i)*tan(i)*tan(i));
//write the wave data and set the length
fout.write (data,30000);
long int length=30000;char *ptr;ptr=(char*)&length;
fout.seekp (40,beg);fout.write (ptr,sizeof(length));
//close file
fout.close();
}
震铃.rar_Vc_c++中的震铃_vc 播放器
版权申诉
29 浏览量
2022-09-14
14:17:28
上传
评论
收藏 5KB RAR 举报
寒泊
- 粉丝: 75
- 资源: 1万+
最新资源
- Pytorch-pytorch深度学习教程之深度残差网络.zip
- Pytorch-pytorch深度学习教程之循环神经网络.zip
- Pytorch-pytorch深度学习教程之逻辑回归.zip
- Pytorch-pytorch深度学习教程之双向循环网络.zip
- Pytorch-pytorch深度学习教程之卷积神经网络.zip
- Pytorch-pytorch深度学习教程之前馈神经网络.zip
- Pytorch-pytorch深度学习教程之线性回归.zip
- Pytorch-pytorch深度学习教程之基本操作.zip
- 基于QT的地图可视化桌面系统后台数据库为MySQL5.7源码.zip
- 基于simulink的PLL锁相环系统仿真【包括模型,文档,参考文献,操作步骤】
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈