草庐IT

sendmail_from

全部标签

c++ - webRTC : How to apply webRTC's VAD on audio through samples obtained from WAV file

目前,我正在解析wav文件并在std::vectorsample中存储样本.现在,我想对这些数据应用VAD(语音事件检测)以找出语音的“区域”,更具体地说是单词的开始和结束。解析的wav文件是16KHz,16位PCM,单声道。我的代码是用C++编写的。我已经搜索了很多,但找不到关于webRTC的VAD功能的适当文档。根据我的发现,我需要使用的函数是WebRtcVad_Process().它的原型(prototype)如下:intWebRtcVad_Process(VadInst*handle,intfs,constint16_t*audio_frame,size_tframe_leng

C++ 什么是 "instantiated from here"错误?

我是C++编程的新手,我想知道什么是“从此处实例化”错误?structData{Data(inta,intb){x=a;y=b;}intx;inty;};std::mapm;m[1]=Data(1,2);我收到几条错误消息没有匹配函数来调用“Data::Data()”“从这里实例化”错误谢谢。 最佳答案 structData没有默认构造函数。map::operator[]返回其值类型的默认构造实例,在本例中为structData。要么提供默认构造函数:Data():x(0),y(0){}或使用std::map::insert():m

c++ - 返回 NULL 但出现错误 C2440 : 'return' : cannot convert from 'int' to 'const &'

我有一个方法如下classBuildOrderStrategy{public:virtualconstUrgency&getUrgency()=0;...}下面是哪个实现constUrgency&RandomBuildOrderStrategy::getUrgency(){returnNULL;}但是在编译时我得到了这个错误errorC2440:'return':cannotconvertfrom'int'to'constUrgency&'此时我真的很想从getUrgency方法返回一个NULL值。所以..我的代码有什么问题?我该如何解决?我来自Java世界,在那里这是完全可能的..紧

c++ - 'CreateDirectoryW' : cannot convert parameter 1 from 'const char *' to 'LPCWSTR' in OpenCV 2. 4.5 和 VS 2010

我正在尝试从openCV2.4.5到VisualStudio2010(基于VC++)的示例代码bagofwords_classification.cpp。但是我发现了错误代码:errorC2664:'CreateDirectoryW':cannotconvertparameter1from'constchar*'to'LPCWSTR'你能帮我解决那个问题吗?谢谢。:)更新v1:staticvoidmakeDir(conststring&dir){#ifdefinedWIN32||defined_WIN32CreateDirectory(dir.c_str(),0);#elsemkdir

C++ 编译错误 : "cast from ' WCHAR *' to ' WORD' loses precision"

MyGUI库。源码中有一行:mHandle=(size_t)::LoadCursor(NULL,MAKEINTRESOURCE(IDC_ARROW));mHandle是size_tLoadCursor返回HCURSOR。错误:D:\Dev\MyGUI_3.2.0_RC1\Common\Input\Win32\ResourceW32Pointer.cpp:48:error:castfrom'WCHAR*'to'WORD'losesprecision这是完整的来源:www.pastebin.com/gzqLBFh9MinGW编译器。有错误castfrom'CHAR*'to'WORD'los

c++ - 您如何理解错误 : cannot convert from 'int []' to 'int []'

编译以下代码时:voidDoSomething(intNumbers[]){intSomeArray[]=Numbers;}VS2005编译器报错C2440:'initializing':cannotconvertfrom'int[]'to'int[]'我知道它实际上是在尝试将指针转换为一个无法工作的数组。但是,您如何向学习C++的人解释该错误? 最佳答案 说有类型和不完全类型:structA;是一个名为A的结构的不完整类型。虽然structA{};是一个名为A的结构的完整类型。第一个的大小尚不清楚,而第二个的大小已知。有不完整的类

c++ - "static_cast<To>(from)"当且仅当 "To to{from}"时,或者不是?

昨天在回答别人问题的过程中惊讶地发现gcc4.7.2包含特征模板std::is_explicitly_convertible,定义作为std::is_constructible_convertible的倒数:///is_explicitly_convertibletemplatestructis_explicitly_convertible:publicis_constructible{};搜索paper-trail,发现这个trait不应该有到过那里。bug有人提出反对将其包含在该版本的C++11标准库,它在gcc4.8.0中被删除。该错误报告指出std::is_explicitly

c++ - 在同一个对象上创建多个 shared_ptr "families"时 shared_from_this 的意外行为

下面是一些示例代码(在线here):#includestructFoo:publicstd::enable_shared_from_this{};voidexample(){autosharedFoo=std::make_shared();std::shared_ptrnonDeletingSharedFoo(sharedFoo.get(),[](void*){});nonDeletingSharedFoo.reset();sharedFoo->shared_from_this();//throwsstd::bad_weak_ptr}我看到的(在多个编译器下)是当nonDeleting

c++ - 这是什么意思? : note: no known conversion for argument 1 from ‘int’ to ‘const account&’

我试图理解我们通常在C++程序中遇到的错误的含义。在编译程序时我遇到了一个错误(我故意犯了这个错误,请不要告诉我如何更正它)并且存在一个注释:note:noknownconversionforargument1from‘int’to‘constaccount&’我想看懂这张纸条的意思。我的程序是:#includeclassaccount{private:inta_no;public:account(){a_no=0;}voidshowData(){std::cout我知道我还没有定义一个可以接受一个参数的构造函数,这样做会消除我的错误。好的,编译时我得到了:file1.cpp:Infu

C++, Linux : error: conversion from ‘boost::unique_future<void>’ to non-scalar type ‘boost::shared_future<void>’ requested. 如何绕过它?

我尝试使用boostthreadfutures.所以如图here我们可以得到sharedfuture来自packagedtask.所以我在linux上尝试这样的功能:templatevoidpool_item(boost::shared_ptr>pt){boost::shared_futurefi=pt->get_future();//error//...但调用它时出错:../../src/cf-util/thread_pool.h:Inmemberfunction‘voidthread_pool::pool_item(boost::shared_ptr>)[withtask_retu