- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图在 3D 平面中表示声音的频谱,但我只能播放声音而无法将 dsp 放入结构 FMOD_DSP_PARAMETER_FFT,numchannels 和 length 始终 = 0
我的代码是这样的:
FMOD::System *system;
FMOD::Sound *sound1;
FMOD::Channel *channel = 0;
FMOD::ChannelGroup *mastergroup;
FMOD::DSP *mydsp, *dsphead, *dspchannelmixer;
FMOD::DSPConnection *conection;
FMOD_RESULT result;
unsigned int version;
result = FMOD::System_Create(&system);
result = system->getVersion(&version);
result = system->init(32, FMOD_INIT_NORMAL, NULL);
result = system->createSound("mysong.mp3",FMOD_DEFAULT, 0, &sound1);
result = sound1->setMode(FMOD_LOOP_NORMAL);
result = system->playSound(sound1, 0, true, &channel);
/*
Create the DSP effect.
*/
result = system->createDSPByType(FMOD_DSP_TYPE_FFT, &mydsp);
result = mydsp->setParameterFloat(FMOD_DSP_FFT_SPECTRUMDATA, 300.0f);
result = system->getMasterChannelGroup(&mastergroup);
result = mastergroup->getDSP(FMOD_CHANNELCONTROL_DSP_HEAD, &dsphead);
result = dsphead->getInput(0, &dspchannelmixer, 0);
result = dsphead->disconnectFrom(dspchannelmixer);
result = dsphead->addInput(mydsp, &conection);
result = mydsp->addInput(dspchannelmixer);
result = mydsp->setBypass(true);
result = mydsp->setActive(true);
char s[256];
unsigned int len;
float freq[32];
float fft = 0;
std::vector<float> fftheights;
//program loop
while (1) {
unsigned int ms = 0;
unsigned int lenms = 0;
bool playing = 0;
bool paused = 0;
int channelsplaying = 0;
if (channel)
{
FMOD::Sound *currentsound = 0;
result = channel->setPaused(false);
result = channel->setMute(false);
result = channel->isPlaying(&playing);
result = channel->getPaused(&paused);
result = channel->setVolume(0.5);
result = channel->getPosition(&ms, FMOD_TIMEUNIT_MS);
channel->getCurrentSound(¤tsound);
if (currentsound)
{
result = currentsound->getLength(&lenms, FMOD_TIMEUNIT_MS);
}
}
system->getChannelsPlaying(&channelsplaying);
render_function();
FMOD_DSP_PARAMETER_FFT *fftparameter;
result = mydsp->getParameterData(FMOD_DSP_FFT_SPECTRUMDATA, (void **)&fftparameter, 0, 0, 0);
result = mydsp->getOutput(FMOD_DSP_FFT_SPECTRUMDATA, &mydsp, 0);
for (int channelfft = 0; channelfft < fftparameter->numchannels; channelfft++)
{
for (int bin = 0; bin < fftparameter->length; bin++)
{
float val = fftparameter->spectrum[channelfft][bin];
if (channelfft == 0){
fftheights.push_back(val);
}
else{
fftheights[bin] += val;
}
}
}
result = system->update();
}
由于这个错误,我无法将值推回 fftheights vector 并且始终为空 0,如果你能帮助我,我会同意。
谢谢。
最佳答案
我认为您需要使用以下方法设置这些值:
mydsp->setParameterInt( ... ); // <-- put stuff there
此外,通过查看“结果”检查函数是否返回任何错误
看Here了解更多信息。
关于C++ FMOD Studio 无法为 freq 的 FMOD DSP PARAMETER FFT 赋值。分析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30281412/
我做到了 create table A as select sum(FREQ) from B; 所以我得到了字段名为 sum(FREQ) 的表 A。我试图用这段代码更改列标题: alter table
当我设置freq="W"时,为什么输出变成了freq="W-Sun"? import pandas as pd a=pd.date_range('10/10/2018', periods=10, fr
我正在编写配置单元查询,因为获取记录具有最大频率值。 table name bookfreq, having two column year & freq year freq 1999 2 2000
What is the correct way to multiply and divide ints in C to avoid overflow? I want to determine h
我有一个类似于下表的患者数据集,我想看看哪些疾病会一起发生并最终制作一个热图。我使用 PROC FREQ 来制作这个列表表,但是这样完成太费力了,因为它给了我每一个组合(数千)。 Moya Hy
尝试对频率不规则的时间序列数据应用seasonal_decompose。它看起来像这样: modal_price Period 2014-11-01 1469 2015-0
我是 Pandas 的新手,正在尝试使用 date_range。我遇到了 freq 的各种好东西,例如 BME 和 BMS,我希望能够快速查找正确的字符串得到我想要的。昨天我在文档的某个地方找到了一个
play $file stat -freq 的输出是什么意思是? 我最近运行了命令,这是输出示例: $ play 44100Hz/3660/6517/3660-6517-0024.flac stat
我有一个包含许多变量的数据集——其中许多是字符值。我有以下代码来计算每个变量缺失值的数量: proc format; value $missfmt ' '='Missing' other='Not
我错过了 pandas DatatimeIndex 对象中“freq”属性的要点。它可以在构造时传递或随时设置为属性,但当此属性更改时,我没有看到 DatatimeIndex 对象的行为有任何差异。
我正在使用 summarytools 包中的 freq 函数在 RStudio 中创建频率表。 似乎无法关闭表格中的累积百分比列和总百分比列。例如: library(summarytools) dat
我是 SAS 的初学者,我有以下问题。 我需要从一个数据集中计算多个变量 (A B C) 的计数和百分比,并将结果保存到另一个数据集。 我的代码是: proc freq 数据=我的数据; 表 A B
我真的对此感到困惑。几年前,我问过如何使用类似 playTone(freq, duration) 的 Python 生成音调,并且被复杂的响应以及缺乏任何简单的解决方案所淹没。 winsound 模块
这个问题在这里已经有了答案: Find the most frequent number in a NumPy array (13 个答案) 关闭 9 年前。 假设你有: arr = np.arra
是否可以将“30T”(30 分钟)“2S”(2 秒)等字符串表示的频率转换为可以与 timedelta 进行比较的值? 如果可能的话,我正在寻找 pandas 的内部机制。使用 these 等机制对所
如何去掉红圈内的方框 代码: data mydata; input x y; datalines; 1 2 3 4 1 5 3 2 ; run; proc freq d
我有一个假设性的问题来理解这个概念。 假设我以 8000hz 采样率捕获了一个单声道语音剪辑,即数据中的 4096 字节。 通过大小为 256 的 FFT 提供前 512 字节(16 位编码)将返回
我想在 pandas Grouper 中使用最后一个日期作为引用,而不是像代码那样使用第一个日期。 接下来是想法。 我的df是 date value c1 c2 2019-03-
给定: 您有一个项目列表。 您正在使用持久数据结构。 您将经常更新列表中的持久项(数据结构)。 正在修改的项目可能位于列表中的任何位置。 Lisps 通用的单向链表结构对于这个目的来说似乎不是很有效。
我正在尝试计算两个日期之间的差异,以获得两个日期之间的整数差异(以天为单位)的数字,但出现以下错误:“无法在没有频率的情况下将整数值添加到 Timestmp”。这是代码: from __future_
我是一名优秀的程序员,十分优秀!