[关于声音]菜鸟提问

xujungood 2004-08-28 09:55:09
我做了一个语音聊天的程序,将声音采样到2K的缓冲区,满了以后用UDP数据包发送出去,用的是API函数,
但是我的程序经常会出错,是一个unhandled exception in ntdll.dll,这是为什么啊?
我的语音程序是在一个非模式对话框里面,MFC的对话框是一个线程,这是不是有影响啊?
...全文
86 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
loveisbug 2004-09-11
  • 打赏
  • 举报
回复
用了Direct Sound了吗?
jlfuhappy 2004-09-10
  • 打赏
  • 举报
回复
ntdll.dll 库是个什么库!?
我想应该和对话框线程没有关系,可能是你的指针没有处理好!!
菜鸟提问基于MATLAB的防盗报警系统的有关问题-sounddetection.m 话不多说,之前有人做出视频防盗系统,详见此贴。 原来的一个版本:视频监控,有东西经过监控区域就报警: 贴子如下: https://www.ilovematlab.cn/thread-133835-1-1.html 后来又有人加上了声音报警系统。声音过大就会报警。 详见此贴 声音监控,有东西发出声音就进行报警 https://www.ilovematlab.cn/thread-133881-1-1.html 。。 然后就是我们有个大作业,我想到的是将两者结合在一起,在视频监控的同时,如果声音过大就进行报警,然后拍照(要是能把照片发到邮箱就好了)。 以下是我的修改,但是一直报错。希望有人能帮忙修改下实现上面的功能。 代码贴出: function intruderdetecting2 % 运动参数阈值 motionThreshold = 200;         %  0 ~ 255 secondsToRecord = 10; % 声音参数阈值 soundThreshold = 0.1;         % 0.0 ~ 1.0 %声音麦克风 ai = analoginput; addchannel; set; set; set; samplesToRecord = ceil; set; set; set; set; %启动摄像头 a = imaqhwinfo; [camera_name, camera_id, format] = getCameraInfo; vid = videoinput; set; set; triggerconfig; start; trigger; try     wait; catch     stop; end %启动函数,时间函数 set; set; set; %创建figure fig = figure('DoubleBuffer','on', ...     'Name', 'Intruder Detection', ...     'NumberTitle', 'off', ...     'WindowStyle', 'docked', ...     'Toolbar', 'none', ...     'MenuBar', 'none', ...     'Color',[.1 .1 .1], ...     'CloseRequestFcn', @figureCloseFcn, ...     'DeleteFcn', @figureDeleteFcn); %对界面初始化 timePrevious = []; start; imagePrevious = []; start; %视频的启动函数     function videoStartFcn             imagePrevious = getsnapshot;     end %声音启动函数     function soundStartFcn             timePrevious = now;     end %视频时间函数         function videoTimerFcn         try             imageCurrent = getsnapshot;             timeCurrent = now;         catch             % getsnapshot can fail if object is deleted while we are waiting.             return;         end samplesRequested = ceil * *... ai.SampleRate); warning; try sound = peekdata; catch sound = zeros); end warning; sound = sound - mean); % Center about the mean. soundMax = max)); % Calculate max deviation from mean. timePrevious = timeCurrent; % Make our figure current. figOld = get; %if fig ~= figOld %set; %end %plot;         imageDifference = abs;         imageMax = max);         imagePrevious = imageCurrent;         figOld = get;         if fig ~= figOld             set;         end         image;         label = datestr;         xlabel;         set;         if imageMax > motionThreshold             motion = true;         else             motion = false;         end         if ~islogging             % 如果有东西闯入,进行响应             if motion                 % 将figure变红                 set;                 % 将闯入者的视频发送到你的邮箱                 str=['SB.jpg'];                 imwrite; %保存拍下来的图像                 customIntruderAction();             else                 set;             end;         end     if ~islogging    % if noise       customIntruderAction();%有人闯入时发进行报警         if fig ~= figOld             set;         end    % end     end    %function customIntruderAction()      % [y,fs]=wavread;      % sound; end     function figureCloseFcn         %关闭视频和声音         try             stop;             stop;         catch         end         closereq;     end     function figureDeleteFcn         delete;         delete;     end end 纯M文件编程。
菜鸟提问基于MATLAB的防盗报警系统的有关问题-voice.m 话不多说,之前有人做出视频防盗系统,详见此贴。 原来的一个版本:视频监控,有东西经过监控区域就报警: 贴子如下: https://www.ilovematlab.cn/thread-133835-1-1.html 后来又有人加上了声音报警系统。声音过大就会报警。 详见此贴 声音监控,有东西发出声音就进行报警 https://www.ilovematlab.cn/thread-133881-1-1.html 。。 然后就是我们有个大作业,我想到的是将两者结合在一起,在视频监控的同时,如果声音过大就进行报警,然后拍照(要是能把照片发到邮箱就好了)。 以下是我的修改,但是一直报错。希望有人能帮忙修改下实现上面的功能。 代码贴出: function intruderdetecting2 % 运动参数阈值 motionThreshold = 200;         %  0 ~ 255 secondsToRecord = 10; % 声音参数阈值 soundThreshold = 0.1;         % 0.0 ~ 1.0 %声音麦克风 ai = analoginput; addchannel; set; set; set; samplesToRecord = ceil; set; set; set; set; %启动摄像头 a = imaqhwinfo; [camera_name, camera_id, format] = getCameraInfo; vid = videoinput; set; set; triggerconfig; start; trigger; try     wait; catch     stop; end %启动函数,时间函数 set; set; set; %创建figure fig = figure('DoubleBuffer','on', ...     'Name', 'Intruder Detection', ...     'NumberTitle', 'off', ...     'WindowStyle', 'docked', ...     'Toolbar', 'none', ...     'MenuBar', 'none', ...     'Color',[.1 .1 .1], ...     'CloseRequestFcn', @figureCloseFcn, ...     'DeleteFcn', @figureDeleteFcn); %对界面初始化 timePrevious = []; start; imagePrevious = []; start; %视频的启动函数     function videoStartFcn             imagePrevious = getsnapshot;     end %声音启动函数     function soundStartFcn             timePrevious = now;     end %视频时间函数         function videoTimerFcn         try             imageCurrent = getsnapshot;             timeCurrent = now;         catch             % getsnapshot can fail if object is deleted while we are waiting.             return;         end samplesRequested = ceil * *... ai.SampleRate); warning; try sound = peekdata; catch sound = zeros); end warning; sound = sound - mean); % Center about the mean. soundMax = max)); % Calculate max deviation from mean. timePrevious = timeCurrent; % Make our figure current. figOld = get; %if fig ~= figOld %set; %end %plot;         imageDifference = abs;         imageMax = max);         imagePrevious = imageCurrent;         figOld = get;         if fig ~= figOld             set;         end         image;         label = datestr;         xlabel;         set;         if imageMax > motionThreshold             motion = true;         else             motion = false;         end         if ~islogging             % 如果有东西闯入,进行响应             if motion                 % 将figure变红                 set;                 % 将闯入者的视频发送到你的邮箱                 str=['SB.jpg'];                 imwrite; %保存拍下来的图像                 customIntruderAction();             else                 set;             end;         end     if ~islogging    % if noise       customIntruderAction();%有人闯入时发进行报警         if fig ~= figOld             set;         end    % end     end    %function customIntruderAction()      % [y,fs]=wavread;      % sound; end     function figureCloseFcn         %关闭视频和声音         try             stop;             stop;         catch         end         closereq;     end     function figureDeleteFcn         delete;         delete;     end end 纯M文件编程。
菜鸟提问基于MATLAB的防盗报警系统的有关问题-intruderdetecting.m 话不多说,之前有人做出视频防盗系统,详见此贴。 原来的一个版本:视频监控,有东西经过监控区域就报警: 贴子如下: https://www.ilovematlab.cn/thread-133835-1-1.html 后来又有人加上了声音报警系统。声音过大就会报警。 详见此贴 声音监控,有东西发出声音就进行报警 https://www.ilovematlab.cn/thread-133881-1-1.html 。。 然后就是我们有个大作业,我想到的是将两者结合在一起,在视频监控的同时,如果声音过大就进行报警,然后拍照(要是能把照片发到邮箱就好了)。 以下是我的修改,但是一直报错。希望有人能帮忙修改下实现上面的功能。 代码贴出: function intruderdetecting2 % 运动参数阈值 motionThreshold = 200;         %  0 ~ 255 secondsToRecord = 10; % 声音参数阈值 soundThreshold = 0.1;         % 0.0 ~ 1.0 %声音麦克风 ai = analoginput; addchannel; set; set; set; samplesToRecord = ceil; set; set; set; set; %启动摄像头 a = imaqhwinfo; [camera_name, camera_id, format] = getCameraInfo; vid = videoinput; set; set; triggerconfig; start; trigger; try     wait; catch     stop; end %启动函数,时间函数 set; set; set; %创建figure fig = figure('DoubleBuffer','on', ...     'Name', 'Intruder Detection', ...     'NumberTitle', 'off', ...     'WindowStyle', 'docked', ...     'Toolbar', 'none', ...     'MenuBar', 'none', ...     'Color',[.1 .1 .1], ...     'CloseRequestFcn', @figureCloseFcn, ...     'DeleteFcn', @figureDeleteFcn); %对界面初始化 timePrevious = []; start; imagePrevious = []; start; %视频的启动函数     function videoStartFcn             imagePrevious = getsnapshot;     end %声音启动函数     function soundStartFcn             timePrevious = now;     end %视频时间函数         function videoTimerFcn         try             imageCurrent = getsnapshot;             timeCurrent = now;         catch             % getsnapshot can fail if object is deleted while we are waiting.             return;         end samplesRequested = ceil * *... ai.SampleRate); warning; try sound = peekdata; catch sound = zeros); end warning; sound = sound - mean); % Center about the mean. soundMax = max)); % Calculate max deviation from mean. timePrevious = timeCurrent; % Make our figure current. figOld = get; %if fig ~= figOld %set; %end %plot;         imageDifference = abs;         imageMax = max);         imagePrevious = imageCurrent;         figOld = get;         if fig ~= figOld             set;         end         image;         label = datestr;         xlabel;         set;         if imageMax > motionThreshold             motion = true;         else             motion = false;         end         if ~islogging             % 如果有东西闯入,进行响应             if motion                 % 将figure变红                 set;                 % 将闯入者的视频发送到你的邮箱                 str=['SB.jpg'];                 imwrite; %保存拍下来的图像                 customIntruderAction();             else                 set;             end;         end     if ~islogging    % if noise       customIntruderAction();%有人闯入时发进行报警         if fig ~= figOld             set;         end    % end     end    %function customIntruderAction()      % [y,fs]=wavread;      % sound; end     function figureCloseFcn         %关闭视频和声音         try             stop;             stop;         catch         end         closereq;     end     function figureDeleteFcn         delete;         delete;     end end 纯M文件编程。
菜鸟提问基于MATLAB的防盗报警系统的有关问题-intruderdetecting2.m 话不多说,之前有人做出视频防盗系统,详见此贴。 原来的一个版本:视频监控,有东西经过监控区域就报警: 贴子如下: https://www.ilovematlab.cn/thread-133835-1-1.html 后来又有人加上了声音报警系统。声音过大就会报警。 详见此贴 声音监控,有东西发出声音就进行报警 https://www.ilovematlab.cn/thread-133881-1-1.html 。。 然后就是我们有个大作业,我想到的是将两者结合在一起,在视频监控的同时,如果声音过大就进行报警,然后拍照(要是能把照片发到邮箱就好了)。 以下是我的修改,但是一直报错。希望有人能帮忙修改下实现上面的功能。 代码贴出: function intruderdetecting2 % 运动参数阈值 motionThreshold = 200;         %  0 ~ 255 secondsToRecord = 10; % 声音参数阈值 soundThreshold = 0.1;         % 0.0 ~ 1.0 %声音麦克风 ai = analoginput; addchannel; set; set; set; samplesToRecord = ceil; set; set; set; set; %启动摄像头 a = imaqhwinfo; [camera_name, camera_id, format] = getCameraInfo; vid = videoinput; set; set; triggerconfig; start; trigger; try     wait; catch     stop; end %启动函数,时间函数 set; set; set; %创建figure fig = figure('DoubleBuffer','on', ...     'Name', 'Intruder Detection', ...     'NumberTitle', 'off', ...     'WindowStyle', 'docked', ...     'Toolbar', 'none', ...     'MenuBar', 'none', ...     'Color',[.1 .1 .1], ...     'CloseRequestFcn', @figureCloseFcn, ...     'DeleteFcn', @figureDeleteFcn); %对界面初始化 timePrevious = []; start; imagePrevious = []; start; %视频的启动函数     function videoStartFcn             imagePrevious = getsnapshot;     end %声音启动函数     function soundStartFcn             timePrevious = now;     end %视频时间函数         function videoTimerFcn         try             imageCurrent = getsnapshot;             timeCurrent = now;         catch             % getsnapshot can fail if object is deleted while we are waiting.             return;         end samplesRequested = ceil * *... ai.SampleRate); warning; try sound = peekdata; catch sound = zeros); end warning; sound = sound - mean); % Center about the mean. soundMax = max)); % Calculate max deviation from mean. timePrevious = timeCurrent; % Make our figure current. figOld = get; %if fig ~= figOld %set; %end %plot;         imageDifference = abs;         imageMax = max);         imagePrevious = imageCurrent;         figOld = get;         if fig ~= figOld             set;         end         image;         label = datestr;         xlabel;         set;         if imageMax > motionThreshold             motion = true;         else             motion = false;         end         if ~islogging             % 如果有东西闯入,进行响应             if motion                 % 将figure变红                 set;                 % 将闯入者的视频发送到你的邮箱                 str=['SB.jpg'];                 imwrite; %保存拍下来的图像                 customIntruderAction();             else                 set;             end;         end     if ~islogging    % if noise       customIntruderAction();%有人闯入时发进行报警         if fig ~= figOld             set;         end    % end     end    %function customIntruderAction()      % [y,fs]=wavread;      % sound; end     function figureCloseFcn         %关闭视频和声音         try             stop;             stop;         catch         end         closereq;     end     function figureDeleteFcn         delete;         delete;     end end 纯M文件编程。

2,543

社区成员

发帖
与我相关
我的任务
社区描述
专题开发/技术/项目 多媒体/流媒体开发
社区管理员
  • 多媒体/流媒体开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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