Commit 2f2bd13a by lenz su

传输和播放声音

parent a4eb142c
rjb/debug/VideoDecode.exe
......@@ -3,9 +3,8 @@
# Project created by QtCreator 2019-10-17T14:42:56
#
#-------------------------------------------------
QT += core gui
QT += core gui multimedia axcontainer
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = VideoDecode
......@@ -19,7 +18,7 @@ OBJECTS_DIR = obj/Obj
#将输出文件直接放到源码目录下的bin目录下,将dll都放在了次目录中,用以解决运行后找不到dll的问
#DESTDIR=$$PWD/bin/
DESTDIR=$$PWD/bin/
contains(QT_ARCH, i386) {
message("32-bit")
DESTDIR = $${PWD}/bin32
......@@ -53,7 +52,17 @@ FORMS += \
src/Video/ShowVideoWidget.ui \
src/mainwindow.ui
INCLUDEPATH += $$PWD/src
LIBS += -L$$PWD/lib/ -lOle32 \
-lksuser
win32: LIBS += -L$$PWD/fftreal/ -lfftreal
INCLUDEPATH += $$PWD/src
INCLUDEPATH += $$PWD/fftreal
DEPENDPATH += $$PWD/fftreal
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.10.2, 2020-01-04T19:56:44. -->
<!-- Written by QtCreator 4.10.2, 2020-01-05T19:03:06. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
......
......@@ -5,7 +5,11 @@
#include "NALUParsing.h"
#include "usb/hidapi.h"
#include "iostream"
#include "audio/PlayThread.h"
#include <mmdeviceapi.h>
#include <Audioclient.h>
#include <windows.h>
#include <stdio.h>
#include <string.h>
using namespace std;
typedef std::function<void(int s)> Func;
......@@ -16,22 +20,23 @@ public:
bool isPlay=false;
hid_device *hid_fd;
NALUParsing *pNaluParsing;
PlayThread *playThread;
void setCallback(Func cb);
hid_thread(){
}
hid_thread(NALUParsing *p,hid_device *hid,PlayThread *play ){
playThread=play;
hid_thread(NALUParsing *p,hid_device *hid){
pNaluParsing=p;
hid_fd=hid;
hid_thread();
}
// void setAudioPlayer(PlayThread *thread);
protected:
Func mcb;
void run() override;
void run() override;
};
#endif // HID_THREAD_H
No preview for this file type
wFormatTag is fffe
nChannels is 2
nSamplesPerSec is 48000
nAvgBytesPerSec is 192000
wBitsPerSample is 16
\ No newline at end of file
width,height,pix_fmt,fps
1280,720,AV_PIX_FMT_YUV420P,60
/*****************************************************************************
Array.h
Copyright (c) 2005 Laurent de Soras
--- Legal stuff ---
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*Tab=3***********************************************************************/
#if ! defined (Array_HEADER_INCLUDED)
#define Array_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma once
#pragma warning (4 : 4250) // "Inherits via dominance."
#endif
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
template <class T, long LEN>
class Array
{
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
public:
typedef T DataType;
Array ();
inline const DataType &
operator [] (long pos) const;
inline DataType &
operator [] (long pos);
static inline long
size ();
/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
protected:
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
DataType _data_arr [LEN];
/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
Array (const Array &other);
Array & operator = (const Array &other);
bool operator == (const Array &other);
bool operator != (const Array &other);
}; // class Array
#include "Array.hpp"
#endif // Array_HEADER_INCLUDED
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*****************************************************************************
DynArray.h
Copyright (c) 2005 Laurent de Soras
--- Legal stuff ---
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*Tab=3***********************************************************************/
#if ! defined (DynArray_HEADER_INCLUDED)
#define DynArray_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma once
#pragma warning (4 : 4250) // "Inherits via dominance."
#endif
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
template <class T>
class DynArray
{
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
public:
typedef T DataType;
DynArray ();
explicit DynArray (long size);
~DynArray ();
inline long size () const;
inline void resize (long size);
inline const DataType &
operator [] (long pos) const;
inline DataType &
operator [] (long pos);
/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
protected:
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
DataType * _data_ptr;
long _len;
/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
DynArray (const DynArray &other);
DynArray & operator = (const DynArray &other);
bool operator == (const DynArray &other);
bool operator != (const DynArray &other);
}; // class DynArray
#include "DynArray.hpp"
#endif // DynArray_HEADER_INCLUDED
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*****************************************************************************
FFTReal.h
Copyright (c) 2005 Laurent de Soras
--- Legal stuff ---
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*Tab=3***********************************************************************/
#if ! defined (FFTReal_HEADER_INCLUDED)
#define FFTReal_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma once
#pragma warning (4 : 4250) // "Inherits via dominance."
#endif
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
#include "def.h"
#include "DynArray.h"
#include "OscSinCos.h"
template <class DT>
class FFTReal
{
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
public:
enum { MAX_BIT_DEPTH = 30 }; // So length can be represented as long int
typedef DT DataType;
explicit FFTReal (long length);
virtual ~FFTReal () {}
long get_length () const;
void do_fft (DataType f [], const DataType x []) const;
void do_ifft (const DataType f [], DataType x []) const;
void rescale (DataType x []) const;
DataType * use_buffer () const;
/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
protected:
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
// Over this bit depth, we use direct calculation for sin/cos
enum { TRIGO_BD_LIMIT = 12 };
typedef OscSinCos <DataType> OscType;
void init_br_lut ();
void init_trigo_lut ();
void init_trigo_osc ();
FORCEINLINE const long *
get_br_ptr () const;
FORCEINLINE const DataType *
get_trigo_ptr (int level) const;
FORCEINLINE long
get_trigo_level_index (int level) const;
inline void compute_fft_general (DataType f [], const DataType x []) const;
inline void compute_direct_pass_1_2 (DataType df [], const DataType x []) const;
inline void compute_direct_pass_3 (DataType df [], const DataType sf []) const;
inline void compute_direct_pass_n (DataType df [], const DataType sf [], int pass) const;
inline void compute_direct_pass_n_lut (DataType df [], const DataType sf [], int pass) const;
inline void compute_direct_pass_n_osc (DataType df [], const DataType sf [], int pass) const;
inline void compute_ifft_general (const DataType f [], DataType x []) const;
inline void compute_inverse_pass_n (DataType df [], const DataType sf [], int pass) const;
inline void compute_inverse_pass_n_osc (DataType df [], const DataType sf [], int pass) const;
inline void compute_inverse_pass_n_lut (DataType df [], const DataType sf [], int pass) const;
inline void compute_inverse_pass_3 (DataType df [], const DataType sf []) const;
inline void compute_inverse_pass_1_2 (DataType x [], const DataType sf []) const;
const long _length;
const int _nbr_bits;
DynArray <long>
_br_lut;
DynArray <DataType>
_trigo_lut;
mutable DynArray <DataType>
_buffer;
mutable DynArray <OscType>
_trigo_osc;
/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
FFTReal ();
FFTReal (const FFTReal &other);
FFTReal & operator = (const FFTReal &other);
bool operator == (const FFTReal &other);
bool operator != (const FFTReal &other);
}; // class FFTReal
#include "FFTReal.hpp"
#endif // FFTReal_HEADER_INCLUDED
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*****************************************************************************
FFTRealFixLen.h
Copyright (c) 2005 Laurent de Soras
--- Legal stuff ---
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*Tab=3***********************************************************************/
#if ! defined (FFTRealFixLen_HEADER_INCLUDED)
#define FFTRealFixLen_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma once
#pragma warning (4 : 4250) // "Inherits via dominance."
#endif
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
#include "Array.h"
#include "DynArray.h"
#include "FFTRealFixLenParam.h"
#include "OscSinCos.h"
template <int LL2>
class FFTRealFixLen
{
typedef int CompileTimeCheck1 [(LL2 >= 0) ? 1 : -1];
typedef int CompileTimeCheck2 [(LL2 <= 30) ? 1 : -1];
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
public:
typedef FFTRealFixLenParam::DataType DataType;
typedef OscSinCos <DataType> OscType;
enum { FFT_LEN_L2 = LL2 };
enum { FFT_LEN = 1 << FFT_LEN_L2 };
FFTRealFixLen ();
inline long get_length () const;
void do_fft (DataType f [], const DataType x []);
void do_ifft (const DataType f [], DataType x []);
void rescale (DataType x []) const;
/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
protected:
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
enum { TRIGO_BD_LIMIT = FFTRealFixLenParam::TRIGO_BD_LIMIT };
enum { BR_ARR_SIZE_L2 = ((FFT_LEN_L2 - 3) < 0) ? 0 : (FFT_LEN_L2 - 2) };
enum { BR_ARR_SIZE = 1 << BR_ARR_SIZE_L2 };
enum { TRIGO_BD = ((FFT_LEN_L2 - TRIGO_BD_LIMIT) < 0)
? (int)FFT_LEN_L2
: (int)TRIGO_BD_LIMIT };
enum { TRIGO_TABLE_ARR_SIZE_L2 = (LL2 < 4) ? 0 : (TRIGO_BD - 2) };
enum { TRIGO_TABLE_ARR_SIZE = 1 << TRIGO_TABLE_ARR_SIZE_L2 };
enum { NBR_TRIGO_OSC = FFT_LEN_L2 - TRIGO_BD };
enum { TRIGO_OSC_ARR_SIZE = (NBR_TRIGO_OSC > 0) ? NBR_TRIGO_OSC : 1 };
void build_br_lut ();
void build_trigo_lut ();
void build_trigo_osc ();
DynArray <DataType>
_buffer;
DynArray <long>
_br_data;
DynArray <DataType>
_trigo_data;
Array <OscType, TRIGO_OSC_ARR_SIZE>
_trigo_osc;
/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
FFTRealFixLen (const FFTRealFixLen &other);
FFTRealFixLen& operator = (const FFTRealFixLen &other);
bool operator == (const FFTRealFixLen &other);
bool operator != (const FFTRealFixLen &other);
}; // class FFTRealFixLen
#include "FFTRealFixLen.hpp"
#endif // FFTRealFixLen_HEADER_INCLUDED
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*****************************************************************************
FFTRealFixLenParam.h
Copyright (c) 2005 Laurent de Soras
--- Legal stuff ---
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*Tab=3***********************************************************************/
#if ! defined (FFTRealFixLenParam_HEADER_INCLUDED)
#define FFTRealFixLenParam_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma once
#pragma warning (4 : 4250) // "Inherits via dominance."
#endif
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
class FFTRealFixLenParam
{
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
public:
// Over this bit depth, we use direct calculation for sin/cos
enum { TRIGO_BD_LIMIT = 12 };
typedef float DataType;
/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
protected:
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
#if 0 // To avoid GCC warning:
// All member functions in class 'FFTRealFixLenParam' are private
FFTRealFixLenParam ();
~FFTRealFixLenParam ();
FFTRealFixLenParam (const FFTRealFixLenParam &other);
FFTRealFixLenParam &
operator = (const FFTRealFixLenParam &other);
bool operator == (const FFTRealFixLenParam &other);
bool operator != (const FFTRealFixLenParam &other);
#endif
}; // class FFTRealFixLenParam
//#include "FFTRealFixLenParam.hpp"
#endif // FFTRealFixLenParam_HEADER_INCLUDED
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*****************************************************************************
FFTRealPassDirect.h
Copyright (c) 2005 Laurent de Soras
--- Legal stuff ---
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*Tab=3***********************************************************************/
#if ! defined (FFTRealPassDirect_HEADER_INCLUDED)
#define FFTRealPassDirect_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma once
#pragma warning (4 : 4250) // "Inherits via dominance."
#endif
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
#include "def.h"
#include "FFTRealFixLenParam.h"
#include "OscSinCos.h"
template <int PASS>
class FFTRealPassDirect
{
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
public:
typedef FFTRealFixLenParam::DataType DataType;
typedef OscSinCos <DataType> OscType;
FORCEINLINE static void
process (long len, DataType dest_ptr [], DataType src_ptr [], const DataType x_ptr [], const DataType cos_ptr [], long cos_len, const long br_ptr [], OscType osc_list []);
/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
protected:
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
FFTRealPassDirect ();
~FFTRealPassDirect ();
FFTRealPassDirect (const FFTRealPassDirect &other);
FFTRealPassDirect &
operator = (const FFTRealPassDirect &other);
bool operator == (const FFTRealPassDirect &other);
bool operator != (const FFTRealPassDirect &other);
}; // class FFTRealPassDirect
#include "FFTRealPassDirect.hpp"
#endif // FFTRealPassDirect_HEADER_INCLUDED
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*****************************************************************************
FFTRealPassInverse.h
Copyright (c) 2005 Laurent de Soras
--- Legal stuff ---
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*Tab=3***********************************************************************/
#if ! defined (FFTRealPassInverse_HEADER_INCLUDED)
#define FFTRealPassInverse_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma once
#pragma warning (4 : 4250) // "Inherits via dominance."
#endif
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
#include "def.h"
#include "FFTRealFixLenParam.h"
#include "OscSinCos.h"
template <int PASS>
class FFTRealPassInverse
{
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
public:
typedef FFTRealFixLenParam::DataType DataType;
typedef OscSinCos <DataType> OscType;
FORCEINLINE static void
process (long len, DataType dest_ptr [], DataType src_ptr [], const DataType f_ptr [], const DataType cos_ptr [], long cos_len, const long br_ptr [], OscType osc_list []);
FORCEINLINE static void
process_rec (long len, DataType dest_ptr [], DataType src_ptr [], const DataType cos_ptr [], long cos_len, const long br_ptr [], OscType osc_list []);
FORCEINLINE static void
process_internal (long len, DataType dest_ptr [], const DataType src_ptr [], const DataType cos_ptr [], long cos_len, const long br_ptr [], OscType osc_list []);
/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
protected:
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
FFTRealPassInverse ();
~FFTRealPassInverse ();
FFTRealPassInverse (const FFTRealPassInverse &other);
FFTRealPassInverse &
operator = (const FFTRealPassInverse &other);
bool operator == (const FFTRealPassInverse &other);
bool operator != (const FFTRealPassInverse &other);
}; // class FFTRealPassInverse
#include "FFTRealPassInverse.hpp"
#endif // FFTRealPassInverse_HEADER_INCLUDED
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*****************************************************************************
FFTRealSelect.h
Copyright (c) 2005 Laurent de Soras
--- Legal stuff ---
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*Tab=3***********************************************************************/
#if ! defined (FFTRealSelect_HEADER_INCLUDED)
#define FFTRealSelect_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma once
#endif
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
#include "def.h"
template <int P>
class FFTRealSelect
{
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
public:
FORCEINLINE static float *
sel_bin (float *e_ptr, float *o_ptr);
/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
FFTRealSelect ();
~FFTRealSelect ();
FFTRealSelect (const FFTRealSelect &other);
FFTRealSelect& operator = (const FFTRealSelect &other);
bool operator == (const FFTRealSelect &other);
bool operator != (const FFTRealSelect &other);
}; // class FFTRealSelect
#include "FFTRealSelect.hpp"
#endif // FFTRealSelect_HEADER_INCLUDED
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*****************************************************************************
FFTRealUseTrigo.h
Copyright (c) 2005 Laurent de Soras
Template parameters:
- ALGO: algorithm choice. 0 = table, other = oscillator
--- Legal stuff ---
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*Tab=3***********************************************************************/
#if ! defined (FFTRealUseTrigo_HEADER_INCLUDED)
#define FFTRealUseTrigo_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma once
#pragma warning (4 : 4250) // "Inherits via dominance."
#endif
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
#include "def.h"
#include "FFTRealFixLenParam.h"
#include "OscSinCos.h"
template <int ALGO>
class FFTRealUseTrigo
{
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
public:
typedef FFTRealFixLenParam::DataType DataType;
typedef OscSinCos <DataType> OscType;
FORCEINLINE static void
prepare (OscType &osc);
FORCEINLINE static void
iterate (OscType &osc, DataType &c, DataType &s, const DataType cos_ptr [], long index_c, long index_s);
/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
protected:
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
FFTRealUseTrigo ();
~FFTRealUseTrigo ();
FFTRealUseTrigo (const FFTRealUseTrigo &other);
FFTRealUseTrigo &
operator = (const FFTRealUseTrigo &other);
bool operator == (const FFTRealUseTrigo &other);
bool operator != (const FFTRealUseTrigo &other);
}; // class FFTRealUseTrigo
#include "FFTRealUseTrigo.hpp"
#endif // FFTRealUseTrigo_HEADER_INCLUDED
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*****************************************************************************
OscSinCos.h
Copyright (c) 2005 Laurent de Soras
--- Legal stuff ---
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*Tab=3***********************************************************************/
#if ! defined (OscSinCos_HEADER_INCLUDED)
#define OscSinCos_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma once
#pragma warning (4 : 4250) // "Inherits via dominance."
#endif
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
#include "def.h"
template <class T>
class OscSinCos
{
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
public:
typedef T DataType;
OscSinCos ();
FORCEINLINE void
set_step (double angle_rad);
FORCEINLINE DataType
get_cos () const;
FORCEINLINE DataType
get_sin () const;
FORCEINLINE void
step ();
FORCEINLINE void
clear_buffers ();
/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
protected:
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
DataType _pos_cos; // Current phase expressed with sin and cos. [-1 ; 1]
DataType _pos_sin; // -
DataType _step_cos; // Phase increment per step, [-1 ; 1]
DataType _step_sin; // -
/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
OscSinCos (const OscSinCos &other);
OscSinCos & operator = (const OscSinCos &other);
bool operator == (const OscSinCos &other);
bool operator != (const OscSinCos &other);
}; // class OscSinCos
#include "OscSinCos.hpp"
#endif // OscSinCos_HEADER_INCLUDED
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*****************************************************************************
TestAccuracy.h
Copyright (c) 2005 Laurent de Soras
--- Legal stuff ---
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*Tab=3***********************************************************************/
#if ! defined (TestAccuracy_HEADER_INCLUDED)
#define TestAccuracy_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma once
#pragma warning (4 : 4250) // "Inherits via dominance."
#endif
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
template <class FO>
class TestAccuracy
{
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
public:
typedef typename FO::DataType DataType;
typedef long double BigFloat; // To get maximum accuracy during intermediate calculations
static int perform_test_single_object (FO &fft);
static int perform_test_d (FO &fft, const char *class_name_0);
static int perform_test_i (FO &fft, const char *class_name_0);
static int perform_test_di (FO &fft, const char *class_name_0);
/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
protected:
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
enum { NBR_ACC_TESTS = 10 * 1000 * 1000 };
enum { MAX_NBR_TESTS = 10000 };
static void compute_tf (DataType s [], const DataType x [], long length);
static void compute_itf (DataType x [], const DataType s [], long length);
static int compare_vect_display (const DataType x_ptr [], const DataType y_ptr [], long len, BigFloat &max_err_rel);
static BigFloat
compute_power (const DataType x_ptr [], long len);
static BigFloat
compute_power (const DataType x_ptr [], const DataType y_ptr [], long len);
static void compare_vect (const DataType x_ptr [], const DataType y_ptr [], BigFloat &power, long &max_err_pos, long len);
/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
TestAccuracy ();
~TestAccuracy ();
TestAccuracy (const TestAccuracy &other);
TestAccuracy & operator = (const TestAccuracy &other);
bool operator == (const TestAccuracy &other);
bool operator != (const TestAccuracy &other);
}; // class TestAccuracy
#include "TestAccuracy.hpp"
#endif // TestAccuracy_HEADER_INCLUDED
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*****************************************************************************
TestHelperFixLen.h
Copyright (c) 2005 Laurent de Soras
--- Legal stuff ---
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*Tab=3***********************************************************************/
#if ! defined (TestHelperFixLen_HEADER_INCLUDED)
#define TestHelperFixLen_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma once
#pragma warning (4 : 4250) // "Inherits via dominance."
#endif
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
#include "FFTRealFixLen.h"
template <int L>
class TestHelperFixLen
{
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
public:
typedef FFTRealFixLen <L> FftType;
static void perform_test_accuracy (int &ret_val);
static void perform_test_speed (int &ret_val);
/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
protected:
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
TestHelperFixLen ();
~TestHelperFixLen ();
TestHelperFixLen (const TestHelperFixLen &other);
TestHelperFixLen &
operator = (const TestHelperFixLen &other);
bool operator == (const TestHelperFixLen &other);
bool operator != (const TestHelperFixLen &other);
}; // class TestHelperFixLen
#include "TestHelperFixLen.hpp"
#endif // TestHelperFixLen_HEADER_INCLUDED
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*****************************************************************************
TestHelperNormal.h
Copyright (c) 2005 Laurent de Soras
--- Legal stuff ---
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*Tab=3***********************************************************************/
#if ! defined (TestHelperNormal_HEADER_INCLUDED)
#define TestHelperNormal_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma once
#pragma warning (4 : 4250) // "Inherits via dominance."
#endif
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
#include "FFTReal.h"
template <class DT>
class TestHelperNormal
{
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
public:
typedef DT DataType;
typedef FFTReal <DataType> FftType;
static void perform_test_accuracy (int &ret_val);
static void perform_test_speed (int &ret_val);
/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
protected:
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
TestHelperNormal ();
~TestHelperNormal ();
TestHelperNormal (const TestHelperNormal &other);
TestHelperNormal &
operator = (const TestHelperNormal &other);
bool operator == (const TestHelperNormal &other);
bool operator != (const TestHelperNormal &other);
}; // class TestHelperNormal
#include "TestHelperNormal.hpp"
#endif // TestHelperNormal_HEADER_INCLUDED
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*****************************************************************************
TestSpeed.h
Copyright (c) 2005 Laurent de Soras
--- Legal stuff ---
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*Tab=3***********************************************************************/
#if ! defined (TestSpeed_HEADER_INCLUDED)
#define TestSpeed_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma once
#pragma warning (4 : 4250) // "Inherits via dominance."
#endif
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
template <class FO>
class TestSpeed
{
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
public:
typedef typename FO::DataType DataType;
static int perform_test_single_object (FO &fft);
static int perform_test_d (FO &fft, const char *class_name_0);
static int perform_test_i (FO &fft, const char *class_name_0);
static int perform_test_di (FO &fft, const char *class_name_0);
/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
protected:
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
enum { NBR_SPD_TESTS = 10 * 1000 * 1000 };
enum { MAX_NBR_TESTS = 10000 };
/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
TestSpeed ();
~TestSpeed ();
TestSpeed (const TestSpeed &other);
TestSpeed & operator = (const TestSpeed &other);
bool operator == (const TestSpeed &other);
bool operator != (const TestSpeed &other);
}; // class TestSpeed
#include "TestSpeed.hpp"
#endif // TestSpeed_HEADER_INCLUDED
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*****************************************************************************
TestWhiteNoiseGen.h
Copyright (c) 2005 Laurent de Soras
--- Legal stuff ---
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*Tab=3***********************************************************************/
#if ! defined (TestWhiteNoiseGen_HEADER_INCLUDED)
#define TestWhiteNoiseGen_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma once
#pragma warning (4 : 4250) // "Inherits via dominance."
#endif
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
template <class DT>
class TestWhiteNoiseGen
{
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
public:
typedef DT DataType;
TestWhiteNoiseGen ();
virtual ~TestWhiteNoiseGen () {}
void generate (DataType data_ptr [], long len);
/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
protected:
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
typedef unsigned long StateType;
StateType _rand_state;
/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
TestWhiteNoiseGen (const TestWhiteNoiseGen &other);
TestWhiteNoiseGen &
operator = (const TestWhiteNoiseGen &other);
bool operator == (const TestWhiteNoiseGen &other);
bool operator != (const TestWhiteNoiseGen &other);
}; // class TestWhiteNoiseGen
#include "TestWhiteNoiseGen.hpp"
#endif // TestWhiteNoiseGen_HEADER_INCLUDED
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
EXPORTS
??0FFTRealWrapper@@QAE@XZ @ 1 NONAME ; FFTRealWrapper::FFTRealWrapper(void)
??1FFTRealWrapper@@QAE@XZ @ 2 NONAME ; FFTRealWrapper::~FFTRealWrapper(void)
?calculateFFT@FFTRealWrapper@@QAEXQAMQBM@Z @ 3 NONAME ; void FFTRealWrapper::calculateFFT(float * const, float const * const)
/*****************************************************************************
def.h
Copyright (c) 2005 Laurent de Soras
--- Legal stuff ---
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*Tab=3***********************************************************************/
#if ! defined (def_HEADER_INCLUDED)
#define def_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma once
#pragma warning (4 : 4250) // "Inherits via dominance."
#endif
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
const double PI = 3.1415926535897932384626433832795;
const double SQRT2 = 1.41421356237309514547462185873883;
#if defined (_MSC_VER)
#define FORCEINLINE __forceinline
#else
#define FORCEINLINE inline
#endif
#endif // def_HEADER_INCLUDED
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
EXPORTS
_ZN14FFTRealWrapper12calculateFFTEPfPKf @ 1 NONAME
_ZN14FFTRealWrapperC1Ev @ 2 NONAME
_ZN14FFTRealWrapperC2Ev @ 3 NONAME
_ZN14FFTRealWrapperD1Ev @ 4 NONAME
_ZN14FFTRealWrapperD2Ev @ 5 NONAME
File added
/***************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as
** published by the Free Software Foundation, either version 2.1. This
** program is distributed in the hope that it will be useful, but WITHOUT
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
** for more details. You should have received a copy of the GNU General
** Public License along with this program. If not, see
** <http://www.gnu.org/licenses/>.
**
***************************************************************************/
#ifndef FFTREAL_WRAPPER_H
#define FFTREAL_WRAPPER_H
#include <QtCore/QtGlobal>
#if defined(FFTREAL_LIBRARY)
# define FFTREAL_EXPORT Q_DECL_EXPORT
#else
# define FFTREAL_EXPORT Q_DECL_IMPORT
#endif
class FFTRealWrapperPrivate;
// Each pass of the FFT processes 2^X samples, where X is the
// number below.
static const int FFTLengthPowerOfTwo = 12;
/**
* Wrapper around the FFTRealFixLen template provided by the FFTReal
* library
*
* This class instantiates a single instance of FFTRealFixLen, using
* FFTLengthPowerOfTwo as the template parameter. It then exposes
* FFTRealFixLen<FFTLengthPowerOfTwo>::do_fft via the calculateFFT
* function, thereby allowing an application to dynamically link
* against the FFTReal implementation.
*
* See http://ldesoras.free.fr/prod.html
*/
class FFTREAL_EXPORT FFTRealWrapper
{
public:
FFTRealWrapper();
~FFTRealWrapper();
typedef float DataType;
void calculateFFT(DataType in[], const DataType out[]);
private:
FFTRealWrapperPrivate* m_private;
};
#endif // FFTREAL_WRAPPER_H
File added
/*****************************************************************************
ClockCycleCounter.h
Copyright (c) 2003 Laurent de Soras
Instrumentation class, for accurate time interval measurement. You may have
to modify the implementation to adapt it to your system and/or compiler.
--- Legal stuff ---
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*Tab=3***********************************************************************/
#if ! defined (stopwatch_ClockCycleCounter_HEADER_INCLUDED)
#define stopwatch_ClockCycleCounter_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma once
#pragma warning (4 : 4250) // "Inherits via dominance."
#endif
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
#include "def.h"
#include "Int64.h"
namespace stopwatch
{
class ClockCycleCounter
{
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
public:
ClockCycleCounter ();
stopwatch_FORCEINLINE void
start ();
stopwatch_FORCEINLINE void
stop_lap ();
Int64 get_time_total () const;
Int64 get_time_best_lap () const;
/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
protected:
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
void compute_clk_mul ();
void compute_measure_time_total ();
void compute_measure_time_lap ();
static void spend_time ();
static stopwatch_FORCEINLINE Int64
read_clock_counter ();
Int64 _start_time;
Int64 _state;
Int64 _best_score;
static Int64 _measure_time_total;
static Int64 _measure_time_lap;
static int _clk_mul;
static bool _init_flag;
/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
ClockCycleCounter (const ClockCycleCounter &other);
ClockCycleCounter &
operator = (const ClockCycleCounter &other);
bool operator == (const ClockCycleCounter &other);
bool operator != (const ClockCycleCounter &other);
}; // class ClockCycleCounter
} // namespace stopwatch
#include "ClockCycleCounter.hpp"
#endif // stopwatch_ClockCycleCounter_HEADER_INCLUDED
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*****************************************************************************
Int64.h
Copyright (c) 2003 Laurent de Soras
--- Legal stuff ---
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*Tab=3***********************************************************************/
#if ! defined (stopwatch_Int64_HEADER_INCLUDED)
#define stopwatch_Int64_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma once
#pragma warning (4 : 4250) // "Inherits via dominance."
#endif
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
namespace stopwatch
{
#if defined (_MSC_VER)
typedef __int64 Int64;
#elif defined (__MWERKS__) || defined (__GNUC__)
typedef long long Int64;
#elif defined (__BEOS__)
typedef int64 Int64;
#else
#error No 64-bit integer type defined for this compiler !
#endif
} // namespace stopwatch
#endif // stopwatch_Int64_HEADER_INCLUDED
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*****************************************************************************
StopWatch.h
Copyright (c) 2005 Laurent de Soras
Utility class based on ClockCycleCounter to measure the unit time of a
repeated operation.
--- Legal stuff ---
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*Tab=3***********************************************************************/
#if ! defined (stopwatch_StopWatch_HEADER_INCLUDED)
#define stopwatch_StopWatch_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma once
#pragma warning (4 : 4250) // "Inherits via dominance."
#endif
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
#include "ClockCycleCounter.h"
namespace stopwatch
{
class StopWatch
{
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
public:
StopWatch ();
stopwatch_FORCEINLINE void
start ();
stopwatch_FORCEINLINE void
stop_lap ();
double get_time_total (Int64 nbr_op) const;
double get_time_best_lap (Int64 nbr_op) const;
/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
protected:
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
ClockCycleCounter
_ccc;
Int64 _nbr_laps;
/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
StopWatch (const StopWatch &other);
StopWatch & operator = (const StopWatch &other);
bool operator == (const StopWatch &other);
bool operator != (const StopWatch &other);
}; // class StopWatch
} // namespace stopwatch
#include "StopWatch.hpp"
#endif // stopwatch_StopWatch_HEADER_INCLUDED
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*****************************************************************************
def.h
Copyright (c) 2003 Laurent de Soras
--- Legal stuff ---
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*Tab=3***********************************************************************/
#if ! defined (stopwatch_def_HEADER_INCLUDED)
#define stopwatch_def_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma once
#pragma warning (4 : 4250) // "Inherits via dominance."
#endif
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
namespace stopwatch
{
#if defined (_MSC_VER)
#define stopwatch_FORCEINLINE __forceinline
#else
#define stopwatch_FORCEINLINE inline
#endif
} // namespace stopwatch
#endif // stopwatch_def_HEADER_INCLUDED
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*****************************************************************************
fnc.h
Copyright (c) 2003 Laurent de Soras
--- Legal stuff ---
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*Tab=3***********************************************************************/
#if ! defined (stopwatch_fnc_HEADER_INCLUDED)
#define stopwatch_fnc_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma once
#pragma warning (4 : 4250) // "Inherits via dominance."
#endif
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
namespace stopwatch
{
template <typename T>
inline T min (T a, T b);
template <typename T>
inline T max (T a, T b);
inline int round_int (double x);
} // namespace rsp
#include "fnc.hpp"
#endif // stopwatch_fnc_HEADER_INCLUDED
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*****************************************************************************
test_fnc.h
Copyright (c) 2005 Laurent de Soras
--- Legal stuff ---
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*Tab=3***********************************************************************/
#if ! defined (test_fnc_HEADER_INCLUDED)
#define test_fnc_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma once
#pragma warning (4 : 4250) // "Inherits via dominance."
#endif
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
template <class T>
inline T limit (const T &x, const T &inf, const T &sup);
#include "test_fnc.hpp"
#endif // test_fnc_HEADER_INCLUDED
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*****************************************************************************
test_settings.h
Copyright (c) 2005 Laurent de Soras
--- Legal stuff ---
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*Tab=3***********************************************************************/
#if ! defined (test_settings_HEADER_INCLUDED)
#define test_settings_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma once
#pragma warning (4 : 4250) // "Inherits via dominance."
#endif
// #undef this label to avoid speed test compilation.
#define test_settings_SPEED_TEST_ENABLED
#endif // test_settings_HEADER_INCLUDED
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
......@@ -240,6 +240,7 @@ Makefile: ../VideoDecode.pro C:/Qt/5.12.6/mingw73_32/mkspecs/win32-g++/qmake.con
C:/Qt/5.12.6/mingw73_32/mkspecs/features/moc.prf \
C:/Qt/5.12.6/mingw73_32/mkspecs/features/win32/opengl.prf \
C:/Qt/5.12.6/mingw73_32/mkspecs/features/uic.prf \
C:/Qt/5.12.6/mingw73_32/mkspecs/features/win32/dumpcpp.prf \
C:/Qt/5.12.6/mingw73_32/mkspecs/features/qmake_use.prf \
C:/Qt/5.12.6/mingw73_32/mkspecs/features/file_copies.prf \
C:/Qt/5.12.6/mingw73_32/mkspecs/features/win32/windows.prf \
......@@ -248,8 +249,12 @@ Makefile: ../VideoDecode.pro C:/Qt/5.12.6/mingw73_32/mkspecs/win32-g++/qmake.con
C:/Qt/5.12.6/mingw73_32/mkspecs/features/yacc.prf \
C:/Qt/5.12.6/mingw73_32/mkspecs/features/lex.prf \
../VideoDecode.pro \
C:/Qt/5.12.6/mingw73_32/lib/Qt5Multimedia.prl \
C:/Qt/5.12.6/mingw73_32/lib/Qt5AxContainer.prl \
C:/Qt/5.12.6/mingw73_32/lib/Qt5AxBase.prl \
C:/Qt/5.12.6/mingw73_32/lib/Qt5Widgets.prl \
C:/Qt/5.12.6/mingw73_32/lib/Qt5Gui.prl \
C:/Qt/5.12.6/mingw73_32/lib/Qt5Network.prl \
C:/Qt/5.12.6/mingw73_32/lib/Qt5Core.prl \
C:/Qt/5.12.6/mingw73_32/lib/qtmain.prl
$(QMAKE) -o Makefile ..\VideoDecode.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
......@@ -430,6 +435,7 @@ C:/Qt/5.12.6/mingw73_32/mkspecs/features/resources.prf:
C:/Qt/5.12.6/mingw73_32/mkspecs/features/moc.prf:
C:/Qt/5.12.6/mingw73_32/mkspecs/features/win32/opengl.prf:
C:/Qt/5.12.6/mingw73_32/mkspecs/features/uic.prf:
C:/Qt/5.12.6/mingw73_32/mkspecs/features/win32/dumpcpp.prf:
C:/Qt/5.12.6/mingw73_32/mkspecs/features/qmake_use.prf:
C:/Qt/5.12.6/mingw73_32/mkspecs/features/file_copies.prf:
C:/Qt/5.12.6/mingw73_32/mkspecs/features/win32/windows.prf:
......@@ -438,8 +444,12 @@ C:/Qt/5.12.6/mingw73_32/mkspecs/features/exceptions.prf:
C:/Qt/5.12.6/mingw73_32/mkspecs/features/yacc.prf:
C:/Qt/5.12.6/mingw73_32/mkspecs/features/lex.prf:
../VideoDecode.pro:
C:/Qt/5.12.6/mingw73_32/lib/Qt5Multimedia.prl:
C:/Qt/5.12.6/mingw73_32/lib/Qt5AxContainer.prl:
C:/Qt/5.12.6/mingw73_32/lib/Qt5AxBase.prl:
C:/Qt/5.12.6/mingw73_32/lib/Qt5Widgets.prl:
C:/Qt/5.12.6/mingw73_32/lib/Qt5Gui.prl:
C:/Qt/5.12.6/mingw73_32/lib/Qt5Network.prl:
C:/Qt/5.12.6/mingw73_32/lib/Qt5Core.prl:
C:/Qt/5.12.6/mingw73_32/lib/qtmain.prl:
qmake: FORCE
......
File added
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
#include "MyPlay.h"
#include "iostream"
using namespace std;
#define REFTIMES_PER_SEC 10000000
#define REFTIMES_PER_MILLISEC 10000
#define EXIT_ON_ERROR(hres) \
if (FAILED(hres)) { goto Exit; }
#define SAFE_RELEASE(punk) \
if ((punk) != NULL) { (punk)->Release(); (punk) = NULL; }
BOOL bDone = FALSE;
BOOL goOn =TRUE;
BOOL pause=FALSE;
FILE *fp = NULL;
MyPlay::MyPlay(){
}
class AudioSource {
public:
int SetFormat(WAVEFORMATEX *pwfx);
int LoadData(UINT32 numFramesAvailable, char *pData, DWORD *pbDone);
};
int AudioSource::SetFormat(WAVEFORMATEX *pwfx)
{
FILE *fp = fopen("render_format.txt", "w");
char str[128];
sprintf(str, "wFormatTag \t\tis %x\nnChannels \t\tis %d\nnSamplesPerSec \tis %ld\nnAvgBytesPerSec is %ld\nwBitsPerSample \tis %d",
pwfx->wFormatTag, pwfx->nChannels, pwfx->nSamplesPerSec, pwfx->nAvgBytesPerSec, pwfx->wBitsPerSample);
fwrite(str, 1, strlen(str), fp);
fclose(fp);
return 0;
}
int AudioSource::LoadData(UINT32 numFramesAvailable, char *pData, DWORD *pbDone)
{
int ret = fread(pData, 1, numFramesAvailable, fp);
printf("fread returns %d\n", ret);
if(0 == ret)
*pbDone = AUDCLNT_BUFFERFLAGS_SILENT;
return 0;
}
BOOL AdjustFormatTo16Bits(WAVEFORMATEX *pwfx)
{
BOOL bRet(FALSE);
if(pwfx->wFormatTag == WAVE_FORMAT_IEEE_FLOAT)
pwfx->wFormatTag = WAVE_FORMAT_PCM;
else if(pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
{
PWAVEFORMATEXTENSIBLE pEx = reinterpret_cast<PWAVEFORMATEXTENSIBLE>(pwfx);
if (IsEqualGUID(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, pEx->SubFormat))
{
pEx->SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
pEx->Samples.wValidBitsPerSample = 16;
}
}
else
return bRet;
pwfx->wBitsPerSample = 16;
pwfx->nBlockAlign = pwfx->nChannels * pwfx->wBitsPerSample / 8;
pwfx->nAvgBytesPerSec = pwfx->nBlockAlign * pwfx->nSamplesPerSec;
bRet = TRUE;
return bRet;
}
HRESULT PlayAudioStream(AudioSource *pMySource)
{
HRESULT hr;
REFERENCE_TIME hnsRequestedDuration = REFTIMES_PER_SEC;
REFERENCE_TIME hnsActualDuration;
IMMDeviceEnumerator *pEnumerator = NULL;
IMMDevice *pDevice = NULL;
IAudioClient *pAudioClient = NULL;
IAudioRenderClient *pRenderClient = NULL;
WAVEFORMATEX *pwfx = NULL;
UINT32 bufferFrameCount;
UINT32 numFramesAvailable;
UINT32 numFramesPadding;
BYTE *pData;
DWORD flags = 0;
hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, IID_IMMDeviceEnumerator, (void**)&pEnumerator);
hr = pEnumerator->GetDefaultAudioEndpoint(eRender, eConsole, &pDevice);
hr = pDevice->Activate(IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&pAudioClient);
hr = pAudioClient->GetMixFormat(&pwfx);
AdjustFormatTo16Bits(pwfx);
hr = pAudioClient->Initialize(AUDCLNT_SHAREMODE_SHARED, 0, hnsRequestedDuration, 0, pwfx, NULL);
// Tell the audio source which format to use.
hr = pMySource->SetFormat(pwfx);
// Get the actual size of the allocated buffer.
hr = pAudioClient->GetBufferSize(&bufferFrameCount);
hr = pAudioClient->GetService(IID_IAudioRenderClient, (void**)&pRenderClient);
// Grab the entire buffer for the initial fill operation.
// hr = pRenderClient->GetBuffer(bufferFrameCount, &pData);
// Load the initial data into the shared buffer.
// hr = pMySource->LoadData(bufferFrameCount * pwfx->nBlockAlign, (char *)pData, &flags);
// hr = pRenderClient->ReleaseBuffer(bufferFrameCount, flags);
// Calculate the actual duration of the allocated buffer.
hnsActualDuration = (double)REFTIMES_PER_SEC * bufferFrameCount / pwfx->nSamplesPerSec;
hr = pAudioClient->Start(); // Start playing.
// Each loop fills about half of the shared buffer.
while (flags != AUDCLNT_BUFFERFLAGS_SILENT&&goOn)
{
// Sleep for half the buffer duration.
Sleep((DWORD)(hnsActualDuration / REFTIMES_PER_MILLISEC / 2));
// See how much buffer space is available.
hr = pAudioClient->GetCurrentPadding(&numFramesPadding);
numFramesAvailable = bufferFrameCount - numFramesPadding;
cout<<"numFramesAvailable:"<<numFramesAvailable<<endl;
// Grab all the available space in the shared buffer.
hr = pRenderClient->GetBuffer(numFramesAvailable, &pData);
// Get next 1/2-second of data from the audio source.
hr = pMySource->LoadData(numFramesAvailable * pwfx->nBlockAlign, (char *)pData, &flags);
cout<<"numFramesAvailable * pwfx->nBlockAlign:"<<numFramesAvailable * pwfx->nBlockAlign<<endl;
hr = pRenderClient->ReleaseBuffer(numFramesAvailable, flags);
}
// Wait for last data in buffer to play before stopping.
Sleep((DWORD)(hnsActualDuration / REFTIMES_PER_MILLISEC / 2));
hr = pAudioClient->Stop(); // Stop playing.
Exit:
CoTaskMemFree(pwfx);
SAFE_RELEASE(pEnumerator)
SAFE_RELEASE(pDevice)
SAFE_RELEASE(pAudioClient)
SAFE_RELEASE(pRenderClient)
return hr;
}
void MyPlay::run(){
goOn=true;
fp = fopen("D://record.pcm","rb");
AudioSource audioSource;
// CoInitialize(NULL);
PlayAudioStream(&audioSource);
// CoUninitialize();
}
void MyPlay::stop(){
goOn=false;
fclose(fp);
}
void MyPlay::setPause(){
if(pause){
pause=false;
}else{
pause=true;
}
}
#ifndef MYPLAY_H
#define MYPLAY_H
#endif // MYPLAY_H
#include <mmdeviceapi.h>
#include <Audioclient.h>
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <QThread>
using namespace std;
class MyPlay:public QThread{
public:
MyPlay();
void stop();
void setPause();
private:
void run() override;
};
......@@ -2,8 +2,7 @@
#include "iostream"
using namespace std;
#define REFTIMES_PER_SEC 10000000
#define REFTIMES_PER_MILLISEC 10000
#define EXIT_ON_ERROR(hres) \
if (FAILED(hres)) { goto Exit; }
......@@ -11,18 +10,21 @@ using namespace std;
#define SAFE_RELEASE(punk) \
if ((punk) != NULL) { (punk)->Release(); (punk) = NULL; }
BOOL bDone = FALSE;
BOOL goOn =TRUE;
BOOL pause=FALSE;
const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator);
const IID IID_IAudioClient = __uuidof(IAudioClient);
const IID IID_IAudioCaptureClient = __uuidof(IAudioCaptureClient);
const IID IID_IAudioRenderClient = __uuidof(IAudioRenderClient);
BYTE *audioBuffer= (uint8_t*)malloc(1920);
FILE *fp = NULL;
int blockAlign=4;
int bufferlength=0;
static HRESULT hr;
static int bufferlength=0;
static uchar pData[1920]={0};
static BYTE *playData;
PlayThread::PlayThread(){
}
......@@ -53,105 +55,134 @@ BOOL PlayThread::AdjustFormatTo16Bits(WAVEFORMATEX *pwfx)
}
void PlayThread::initPlay()
{
HRESULT hr;
REFERENCE_TIME hnsRequestedDuration = REFTIMES_PER_SEC;
REFERENCE_TIME hnsActualDuration;
IMMDeviceEnumerator *pEnumerator = NULL;
IMMDevice *pDevice = NULL;
IAudioClient *pAudioClient = NULL;
IAudioRenderClient *pRenderClient = NULL;
WAVEFORMATEX *pwfx = NULL;
UINT32 bufferFrameCount;
UINT32 numFramesAvailable;
UINT32 numFramesPadding;
BYTE *pData;
DWORD flags = 0;
hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, IID_IMMDeviceEnumerator, (void**)&pEnumerator);
cout<<"CoCreateInstance"<<hr<<endl;
EXIT_ON_ERROR(hr);
hr = pEnumerator->GetDefaultAudioEndpoint(eRender, eConsole, &pDevice);
EXIT_ON_ERROR(hr);
hr = pDevice->Activate(IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&pAudioClient);
EXIT_ON_ERROR(hr);
hr = pAudioClient->GetMixFormat(&pwfx);
EXIT_ON_ERROR(hr);
AdjustFormatTo16Bits(pwfx);
hr = pAudioClient->Initialize(AUDCLNT_SHAREMODE_SHARED, 0, hnsRequestedDuration, 0, pwfx, NULL);
EXIT_ON_ERROR(hr);
// Get the actual size of the allocated buffer.
hr = pAudioClient->GetBufferSize(&bufferFrameCount);
EXIT_ON_ERROR(hr);
// Tell the audio source which format to use.
hr = pAudioClient->GetService(IID_IAudioRenderClient, (void**)&pRenderClient);
EXIT_ON_ERROR(hr);
cout<<"hahahaha"<<"pRenderClient "<<pRenderClient<<endl;
// Calculate the actual duration of the allocated buffer.
hnsActualDuration = (double)REFTIMES_PER_SEC * bufferFrameCount / pwfx->nSamplesPerSec;
hr = pAudioClient->Start(); // Start playing.
EXIT_ON_ERROR(hr);
// Get the actual size of the allocated buffer.
hr = pAudioClient->GetBufferSize(&bufferFrameCount);
while(1){
msleep(10000);
}
Exit:
CoTaskMemFree(pwfx);
SAFE_RELEASE(pEnumerator)
SAFE_RELEASE(pDevice)
SAFE_RELEASE(pAudioClient)
SAFE_RELEASE(pRenderClient)
/* // Each loop fills about half of the shared buffer.
while (flags != AUDCLNT_BUFFERFLAGS_SILENT&&goOn)
{
// Sleep for half the buffer duration.
Sleep((DWORD)(hnsActualDuration / REFTIMES_PER_MILLISEC / 2));
hr = pAudioClient->GetService(IID_IAudioRenderClient, (void**)&pRenderClient);
// See how much buffer space is available.
hr = pAudioClient->GetCurrentPadding(&numFramesPadding);
// Grab the entire buffer for the initial fill operation.
hr = pRenderClient->GetBuffer(bufferFrameCount, &pData);
numFramesAvailable = bufferFrameCount - numFramesPadding;
// Grab all the available space in the shared buffer.
hr = pRenderClient->GetBuffer(numFramesAvailable, &pData);
// Load the initial data into the shared buffer.
// Get next 1/2-second of data from the audio source.
hr = pMySource->LoadData(numFramesAvailable * pwfx->nBlockAlign, (char *)pData, &flags);
hr = pRenderClient->ReleaseBuffer(bufferFrameCount, flags);
hr = pRenderClient->ReleaseBuffer(numFramesAvailable, flags);
}
// Calculate the actual duration of the allocated buffer.
hnsActualDuration = (double)REFTIMES_PER_SEC * bufferFrameCount / pwfx->nSamplesPerSec;
// Wait for last data in buffer to play before stopping.
// Sleep((DWORD)(hnsActualDuration / REFTIMES_PER_MILLISEC / 2));
hr = pAudioClient->Start(); // Start playing.
// hr = pAudioClient->Stop(); // Stop playing.
return hr;*/
}
void PlayThread::play(BYTE *pData,int length){
void PlayThread::play(BYTE *data,int length){
/* if(length==384){
pRenderClient->GetBuffer(length/4, &pData);
/*if(length==384){
pRenderClient->GetBuffer(length/4, &data);
pRenderClient->ReleaseBuffer(length/4, flags);
cout<<"play384"<<endl;
}
}*/
if(length==1012){
if(bufferlength>0){
bufferlength=0;
memset(audioBuffer,0,1920);
}
memcpy(audioBuffer ,pData, length);
memcpy(pData ,data, 1012);
bufferlength+=length;
cout<<"play add 1012"<<endl;
}
if(length==(1920-1012)){
if(length==908){
if(bufferlength==1012){
memcpy(audioBuffer+1012 ,pData, length);
bufferlength+=length;
cout<<"play 1920-1012"<<endl;
pRenderClient->GetBuffer(length/4, &audioBuffer);
pRenderClient->ReleaseBuffer(length/4, flags);
memcpy(pData+1012 ,data, length);
if(pRenderClient==0){
cout<<"null pRenderClient"<<endl;
return;
}
cout<<"hahahaha"<<"pRenderClient2 "<<pRenderClient<<endl;
hr=pRenderClient->GetBuffer(480, &playData);
EXIT_ON_ERROR(hr);
memcpy(playData ,pData, 1920);
hr= pRenderClient->ReleaseBuffer(480, flags);
EXIT_ON_ERROR(hr);
cout<<"play wanle"<<endl;
Exit:
CoTaskMemFree(pwfx);
SAFE_RELEASE(pEnumerator)
SAFE_RELEASE(pDevice)
SAFE_RELEASE(pAudioClient)
SAFE_RELEASE(pRenderClient)
}
memset(audioBuffer,0,1920);
bufferlength=0;
}*/
}
}
void PlayThread::run(){
CoInitialize(NULL);
initPlay();
CoUninitialize();
}
......
......@@ -8,20 +8,28 @@
#include <stdio.h>
#include <string.h>
#include <QThread>
#define REFTIMES_PER_SEC 10000000
#define REFTIMES_PER_MILLISEC 10000
using namespace std;
class PlayThread:public QThread{
public:
REFERENCE_TIME hnsRequestedDuration = REFTIMES_PER_SEC;
REFERENCE_TIME hnsActualDuration;
IMMDeviceEnumerator *pEnumerator = NULL;
IMMDevice *pDevice = NULL;
IAudioClient *pAudioClient = NULL;
IAudioRenderClient *pRenderClient = NULL;
WAVEFORMATEX *pwfx = NULL;
UINT32 bufferFrameCount;
DWORD flags = 0;
PlayThread();
void initPlay();
BOOL AdjustFormatTo16Bits(WAVEFORMATEX *pwfx);
void play(BYTE *ppData,int length);
private:
IAudioRenderClient *pRenderClient = NULL;
DWORD flags = 0;
void run() override;
};
......@@ -14,11 +14,12 @@
USBOperator *usb;
ReadVideoFileThread *mReadVideoFileThread;
hid_thread *hidThread;
bool isStart=false;
Ui::MainWindow *ui;
MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent)
{
ui=new Ui::MainWindow;
ui=new Ui::MainWindow;
ui->setupUi(this);
FunctionTransfer::init(QThread::currentThreadId());
......@@ -30,17 +31,16 @@ ui=new Ui::MainWindow;
mNaluParsing->setVideoType(T_NALU_H264);
usb=new USBOperator;
// usb->setCallback(onRole);
// usb->start();
PlayThread *playThread=new PlayThread;
// playThread->start();
hidThread=new hid_thread(mNaluParsing,usb->getHidDevice(),playThread);
hidThread->setCallback(onRole);
hidThread->start();
mReadVideoFileThread = new ReadVideoFileThread(mNaluParsing);
mReadVideoFileThread->setVideoCallBack(this);
mReadVideoFileThread->start();
// MyPlay *myplay=new MyPlay;
// myplay->start();
// usb->setCallback(onRole);
// usb->start();
// mReadH264FileThread->startRead((char*)"../data/test.h264");
......@@ -60,7 +60,7 @@ void MainWindow::onRole(int s){
break;
case SCREEN_SHOT_STOP:
ui->widget_videoPlayer->clear();
// ui->widget_videoPlayer->clear();
break;
}
}
......@@ -88,11 +88,20 @@ void MainWindow::slotBtnClick(bool isChecked)
}
else if (QObject::sender() == ui->pushButton_play)
{
if (isChecked) {
hidThread=new hid_thread(mNaluParsing,usb->getHidDevice());
hidThread->setCallback(onRole);
hidThread->start();
mReadVideoFileThread = new ReadVideoFileThread(mNaluParsing);
mReadVideoFileThread->setVideoCallBack(this);
mReadVideoFileThread->start();
hidThread->isPlay=true;
/*if (isChecked) {
qDebug("start decode!");
mReadVideoFileThread->start();
hidThread->start();
}
}*/
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment