您现在的位置: 中国教师站 >> 教师关注 >> 电脑技术 >> 编程技术 >> Visual C >> 正文

Google
Windows环境下的麦克风录音系统
作者:Siny 文章来源:中国教师站cn-teacher 点击数: 更新时间:2007-4-22 11:37:42
sp;                 g.当开始录音后当buffer已满时,将收到MM_WIM_DATA消息,处理该
                        消息可以保存已录好数据.

      2.根据用户的声音强弱动态显示声音波形;
            这主要通过GDI函数来实现.
  
      3.将用户通过麦克风发出的声音录制成wav文件保存.
            这将利用到Multimedia file I/O APIs.
                 a.调用mminoOpen函数来打开WAVE文件,获取HMMIO类型的文件句柄;
             b.根据WAVE文件的结构,调用mmioRead、mmioWrite和mmioSeek函数实现文件的读、写和定位操作;
             c.调用mmioClose函数来关闭WAVE文件.

7.麦克录音系统的实现(MicDemo)  

下面是该系统的界面:
 

对于录音来说最重要的就是CSoundIn类,下面就是该类的定义:

namespace perdubug {  // prevent the name-space pollution

class CSoundIn 
{
public: 
 BOOL     __initMic(); // get the best wave format supported by your sound card
                                     // and then i will use the format to capture sound.

 void     __closeMic();


 BOOL     __openMic(); // open device and begin to capture with the best format(when
                                        // invoke __initMic function then you will get the best format
                                        // supported by host's sound card
 
 //
 // if your want to capture sound and export into a wav file please invoke this function
 // to tell me the full path then i will create the wav file.
 //
 void     __createOutputWaveFile(const TCHAR * lpszFileName);
 
 // if you invoke any member function return error/false please
 // use this function to get the result...
 DWORD    __getLastError();

 //
 // when the capture buffer is filled please invoke this function to 'add buffer'(Actually
 // you should create two-circular buffers,when 1st buffer is filled then switch to 2st,1st
 // buffer will be wrote into wav file.
 //
 void AddBuffer();
 
 virtual ~CSoundIn();
 
 friend CSoundIn & theSoundCapture();
private:

 BOOL  GetBestWaveFormat(WAVEFORMATEX & waveFormatEx);
 
 // because sound card is one and only so i must limit the number of CSoundIn object,
 // but how to limit the class object nums?maybe put constructor into private scope is
 

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 下一页

相关专题:
 
 网友评论:(评论内容只代表网友观点,与本站立场无关!)
GOOGLE广告

阅读排行

| 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 |
中国教师站

中国教师站 版权所有 Copyright © 2006-2020 All Rights Reserved 站长:Sina & Siny
[备用域名:www.JXZYW.Com] 有事请留言有事请留言
【实力成就精品 诚信呵护品牌】

信息产业部备案
苏ICP备06018635号