嵌入式音频架构 - AudioWeaver模块开发
AudioWeaver的新模块开发需要Matlab,VisualStudio,server,硬件平台,嵌入式开发IDE。
AudioWeaver在PC端主要依靠的就是Matlab来配置和控制,Matlab提供接口可以进行参数计算,可视化,自动化,测试,以及系统的编译。同时负责描述模块,生成代码,生成文档。
每个AW 模块都有一个关联的Matlab M文件,其中包含了模块的描述信息,包括
- I/O pin描述: 数据类型,通道数,block size,采样率
- 结构变量: 数据类型,变量名,array size, memory分配要求
- 文档信息:变量描述,pin描述,模块描述
- 链接到inner c代码:process,set,bypass,get函数
- 用户接口:control信号接口
- AWE designer 描述信息
每个模块都有一个instance data structure来保存变量,包括state 和parameters变量。instance data structure包含在模块头文件中module.h。
这个头文件是有AW自动生成的。
typedef struct _awe_modScalerSmoothedExampleInstance
{ModuleInstanceDescriptor instance;
float gain; // Target gain
float smoothingTime; // Time constant of the ...
float currentGain; // Instantaneous gain applied
...
float smoothingCoeff; // Smoothing coefficient
} awe_modScalerSmoothedExampleInstance;
在开头包含了一个子结构体 ModuleInstanceDescriptor instance,其中指向模块的I/O pin,实时函数(processing,Bypass,Muted,…),类结构。定义在
<AWE>\Include\Framework.h.
里面还有模块instance描述结构:
typedef struct _ModuleInstanceDescriptor
{ModInstanceDescriptor instanceDescriptor;
struct _LayoutInstance *pOwner;
UINT packedFlags;
float profile_time;
WireInstance **pWires;
void (*pProcessFunc)(void *pInstance);
}
ModuleInstanceDescriptor;typedef struct _WireInstance
{/** The basic instance data. */
InstanceDescriptor instanceDescriptor;
/** The pin descriptor describing this wire. */
PinInstanceDescriptor *pPinDescriptor;
/** The wire buffer. */
Sample *buffer;
}
WireInstance;
头文件中还包含了模块配置变量的bit mask宏, 偏移宏 和 类ID。
Server可以通过类ID来新建一个模块在siganlflow中。每个模块的类ID都是唯一的。
#define MASK_ScalerSmoothedExample_gain 0x00000100
#define MASK_ScalerSmoothedExample_smoothingTime 0x00000400
#define MASK_ScalerSmoothedExample_currentGain 0x00000200
#define MASK_ScalerSmoothedExample_smoothingCoeff 0x00000800#define OFFSET_ScalerSmoothedExample_gain 0x00000008
#define OFFSET_ScalerSmoothedExample_smoothingTime 0x0000000A
#define OFFSET_ScalerSmoothedExample_currentGain 0x00000009
#define OFFSET_ScalerSmoothedExample_smoothingCoeff 0x0000000B#define CLASSID_SCALERSMOOTHEDEXAMPLE (CLASS_ID_MODBASE + 32768)
还有模块的构造函数 和 其他的函数
#ifndef AWE_STATIC_CODE
// This points the constructor for this class to the base constructor
#define awe_modScalerSmoothedExampleConstructor(ARG1, ARG2, ARG3, ARG4,
ARG5) ClassModule_Constructor(CLASSID_SCALERSMOOTHEDEXAMPLE, ARG1,
ARG2, ARG3, ARG4, ARG5)
#endif
void awe_modScalerSmoothedExampleProcess(void *pInstance);
UINT awe_modScalerSmoothedExampleSet(void *pInstance, UINT mask);
在模块的C源文件中,至少需要包含以下几类函数:
Constructor() - memory分配,初始化,大多数情况下由matlab自动生成。
Set() – tuning接口,可以用来传输控制信号。
Get() – 上层读取模块内部数据接口
Bypass() – 直通函数。
同时还包含描述模块的类结构以及memory分配函数。
构造函数是在初始化的时候被调用的,用来请求memory和传递参数。
构造函数需要使用模块的类结构体:
/** Class descriptor for audio modules. */
typedef struct _ModClassModule
{/** The basic class data. */
ModClassDescriptor modClassDescriptor;
/** The number of construction module parameters. */
UINT nPackedParameters;
/** Pump function for the module. */
void (*pProcessFunc)(void *pInstance);
/** Bypass function for the module. */
void (*pBypassFunc)(void *pInstance);
/** Set function. */
UINT (*pSet)(void *pInstance, UINT mask);
/** Get function. */
UINT (*pGet)(void *pInstance, UINT mask);
/** Set State function. */
void (*pSetState)(void *pInstance, UINT32 state);
}
ModClassModule;typedef struct _ModClassDescriptor
{/** Unique ID of the class - set at compile time. */
UINT classID;
struct _ModInstanceDescriptor *(*Constructor)(
int * FW_RESTRICT retVal,
UINT nIO,
WireInstance ** FW_RESTRICT pWires,
size_t argCount,
const Sample * FW_RESTRICT args);
}
ModClassDescriptor;
AWE_MOD_SLOW_ANY_CONST
const ModClassModule awe_modScalerSmoothedExampleClass =
{#ifdef AWE_STATIC_CODE
{ CLASSID_SCALERSMOOTHEDEXAMPLE, NULL },
#else
{ CLASSID_SCALERSMOOTHEDEXAMPLE, NULL },
#endif
ClassModule_PackArgCounts(4, 0),//(Public words, private words)
awe_modScalerSmoothedExampleProcess, // Processing function
IOMatchUpModule_Bypass, // Bypass function
#ifndef AWE_NO_SETGET_FUNCTIONS
awe_modScalerSmoothedExampleSet, // Set function
0, // Get function
#else
0, // Set function
0, // Get function
#endif
0, // Set State function
};
处理器中的模块Schema文件提供给Server关于处理器中所有可用的模块的信息。这样Server就可以直接使用模块名而不是ID来控制模块。模块Schema文件是集成在DLL中的。用这个文件,server就可以将类ID和模块名对应起来。
用Matlab M文件生成代码
运行命令,
M=scaler_smoothed_example_module('temp');
awe_generate_module(M);
随后就会生成code在
Include/ModScalerSmoothedExample.h
Source/ModScalerSmoothedExample.c
模块源文件常常是以一个lib包为单位进行生成的,然后会生成一个schema文件。
MM=cell(0,0);
MM{end+1}=downsampler_example_module('temp', 2); % 100%
instantiation
MM{end+1}=fader_example_fract32_module('temp');
MM{end+1}=fader_example_module('temp');
MM{end+1}=lah_limiter_example_module('temp', 5); % 100%
instantiation
MM{end+1}=peak_hold_example_fract32_module('temp');
MM{end+1}=peak_hold_example_module('temp');
MM{end+1}=scaler_example_module('temp');
MM{end+1}=scaler_smoothed_example_module('temp');
[DependMM, DependName]=make_standardmodulepack(0);
USESLIB{1}.MM=DependMM;
USESLIB{1}.str=DependName;
[DependMM, DependName]=make_deprecatedmodulepack(0);
USESLIB{2}.MM=DependMM;
USESLIB{2}.str=DependName;
[DependMM, DependName]=make_advancedmodulepack(0);
USESLIB{3}.MM=DependMM;
USESLIB{3}.str=DependName;
awe_generate_library(MM, DIR, 'Examples', USESLIB, GENDOC);
生成好源文件之后,可以开始使用VisualStudio 编译DLL文件。Server可以使用这个DLL文件。
嵌入式音频架构 - AudioWeaver模块开发相关推荐
- 嵌入式音频架构 - AudioWeaver模块库 Filter 滤波器
Filter ADAPTIVE (LMS) 自适应滤波器: FILTERS WITH CALCULATED COEFFS ALLPASS PAIR: 创建一对allpass filter, 他们输出的 ...
- 嵌入式音频架构 - AudioWeaver 整体概念
AudioWeaver 是DSP Concept公司推出的基于嵌入式平台的音频框架.由AWE Core embedded processing engine 和 Audio Weaver Design ...
- 模块开发卷宗是什么_详论单片机固件模块化架构设计(精华)
[导读] 为什么写本文?做公号两月,遇到一些初学单片机的同学,刚刚入手做单片机开发,还没有涉及到使用RTOS,且刚入手直接上RTOS可能会有些难度,有的使用的相对较老单片机资源还有限,也不适合跑RTO ...
- 嵌入式linux ASoC架构声卡驱动开发
嵌入式linux ASoC架构声卡驱动开发 文章目录 嵌入式linux ASoC架构声卡驱动开发 需求分析 ASoC架构下声卡驱动代码结构 codec驱动 snd_soc_register_codec ...
- 【DSP开发】德州仪器达芬奇五年之路七宗罪,嵌入式处理器架构之争决战2012
芯片是产业链上游重要的一个环节,一颗小小的芯片具有极高的技术含量和价值,半导体行业每年都会有一个各大厂商营业额的排名,除去2009年,常年盘踞在前三名位置的分别是英特尔,三星半导体和德州仪器,英特尔凭 ...
- 嵌入式linux alsa,嵌入式Linux下ALSA音频架构ALSA-lib移植与编译心得
**************************************************************************************************** ...
- [短彩信]C#短彩信模块开发设计(1)——架构
准备从以下几个方面简单的谈谈短彩信模块的实现: [短彩信]C#短彩信模块开发设计(1)--架构(http://www.cnblogs.com/CopyPaster/archive/2012/12/07 ...
- 基于赫优讯COMX嵌入式模块开发EtherCAT从站设备
摘要:随着实时工业以太网技术的发展,在最新版本的IEC61158 Ed.4标准中已经包含了Profinet,EtherCAT,Ethernet/IP,SERCOS III等11种实时以太网行规集.以n ...
- 基于MT7688AN模块开发板WiFi路由方案无线音频传输WiFi音箱测试
无线路由解决方案无损WiFi音频传输测试 基于MT7688AN模块开发板WiFi路由方案无线音频传输WiFi音箱测试 L107物联网路由器模块是基于联发科MT7688或MT7628芯片组.该模块只需要 ...
- 推荐我的新书《深入理解Nginx:模块开发与架构解析》
http://www.china-pub.com/STATIC/zt_mb/zt_huodong_2013_3.asp?filename=2013_jsj_nginx_20130401 目录 < ...
最新文章
- go get 无法下载问题解决方案及下载 aliyun-oss-go-sdk incompatible.info
- java url获取 html body,java模拟浏览器请求抓取页面,无法抓取body里的内容
- 【Qt】Qt中QJsonDocument 类
- Latent Semantic Analysis (LSA) Tutorial
- 【翻译】Keras.NET简介 - 高级神经网络API in C#
- 前端学习(3238):react生命周期4
- 【转】2.2[译]async/await中阻塞死锁
- 正确绑定键盘事件_事件为何重要以及如何正确处理
- C++.Net在Release方式下单步调试时需要修改一些设置,否则变量会有错位或乱码,切记!...
- 五个最佳编程文本编辑器
- android studio更改代码字体,Android Studio怎么改变代码字体大小?
- 【人脸质量评估】SDD-FIQA基于人脸相似度分布距离的无监督质量评估方法
- tplink迷你路由器中继模式_TP-Link无线路由器中继模式设置教程
- PID调节三个参数的作用
- 蹭热搜账号将受处罚?揭秘表层网络环境背后的危机
- 视频号直播信用分总被扣?如何提高信用分?
- 成也苹果败也苹果,曾经女首富身价缩水一半
- 如何批量将 Excel 文档转为 Svg 格式
- AliCoCo:阿里电商知识图谱核心技术揭秘 Alibaba E-commerce Cognitive Concept Net
- Java8新特性----Lambda表达式详细探讨