syncing old out of data stuff
parent
334fafe354
commit
0390f473ac
|
@ -19,6 +19,12 @@ using namespace Xybrid::Data;
|
|||
#include <QTimer>
|
||||
#include <QProcess>
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#define FFMPEG "/usr/local/bin/ffmpeg"
|
||||
#else
|
||||
#define FFMPEG "ffmpeg"
|
||||
#endif
|
||||
|
||||
// zero-initialize
|
||||
AudioEngine* Xybrid::Audio::audioEngine = nullptr;
|
||||
|
||||
|
@ -239,7 +245,7 @@ void AudioEngine::render(std::shared_ptr<Project> p, QString filename) {
|
|||
param << "-f" << "mp3" << "-codec:a" << "libmp3lame"<< "-q:a" << "0"; // specify mp3, vbr v0
|
||||
param << filename;
|
||||
|
||||
enc.start("ffmpeg", param);
|
||||
enc.start(FFMPEG, param);
|
||||
enc.waitForStarted();
|
||||
|
||||
std::vector<char> dat;
|
||||
|
|
|
@ -17,6 +17,22 @@ namespace Xybrid::Data {
|
|||
l += o.l;
|
||||
r += o.r;
|
||||
}
|
||||
inline AudioFrame operator+(double m) const { return {l+m, r+m}; }
|
||||
inline void operator+=(double m) {
|
||||
l += m;
|
||||
r += m;
|
||||
}
|
||||
|
||||
inline AudioFrame operator-(AudioFrame o) const { return {l-o.l, r-o.r}; }
|
||||
inline void operator-=(AudioFrame o) {
|
||||
l -= o.l;
|
||||
r -= o.r;
|
||||
}
|
||||
inline AudioFrame operator-(double m) const { return {l-m, r-m}; }
|
||||
inline void operator-=(double m) {
|
||||
l -= m;
|
||||
r -= m;
|
||||
}
|
||||
|
||||
inline AudioFrame operator*(AudioFrame o) const { return {l*o.l, r*o.r}; }
|
||||
inline void operator*=(AudioFrame o) {
|
||||
|
|
|
@ -22,8 +22,15 @@ using namespace Xybrid::Data;
|
|||
#include <QDataStream>
|
||||
|
||||
#include <QEventLoop>
|
||||
#include<QDebug>
|
||||
|
||||
#define qs QStringLiteral
|
||||
#ifdef Q_OS_MAC
|
||||
#define FFMPEG "/usr/local/bin/ffmpeg"
|
||||
#else
|
||||
#define FFMPEG "ffmpeg"
|
||||
#endif
|
||||
|
||||
|
||||
std::array<float, 2> Sample::plotBetween(size_t ch, size_t start, size_t end) const {
|
||||
if (end < start) end = start;
|
||||
|
@ -171,10 +178,18 @@ std::shared_ptr<Sample> Sample::fromFile(QString fileName) {
|
|||
QStringList param;
|
||||
param << "-v" << "quiet" << "-show_streams" << "-select_streams" << "a" << "-of" << "json";
|
||||
param << fileName;
|
||||
probe.start("ffprobe", param);
|
||||
probe.waitForFinished();
|
||||
|
||||
auto doc = QJsonDocument::fromJson(probe.readAllStandardOutput());
|
||||
#ifdef Q_OS_MAC
|
||||
#define FFPROBE "/usr/local/bin/ffprobe"
|
||||
#else
|
||||
#define FFPROBE "ffprobe"
|
||||
#endif
|
||||
probe.start(FFPROBE, param);
|
||||
if (!probe.waitForFinished()) {
|
||||
qCritical() << (probe.errorString());
|
||||
}
|
||||
auto mystdout = probe.readAllStandardOutput();
|
||||
auto mystderr = probe.readAllStandardError();
|
||||
auto doc = QJsonDocument::fromJson(mystdout);
|
||||
info = doc.object()["streams"].toArray().first().toObject();
|
||||
}
|
||||
if (!info.contains("sample_rate") || !info.contains("channels")) return nullptr; // no/invalid audio streams
|
||||
|
@ -190,8 +205,9 @@ std::shared_ptr<Sample> Sample::fromFile(QString fileName) {
|
|||
{
|
||||
QProcess dec;
|
||||
QStringList param;
|
||||
|
||||
param << "-i" << fileName << "-f" << "f32le" << "-acodec" << "pcm_f32le" << "-";
|
||||
dec.start("ffmpeg", param);
|
||||
dec.start(FFMPEG, param);
|
||||
dec.waitForFinished();
|
||||
raw = dec.readAllStandardOutput();
|
||||
}
|
||||
|
|
|
@ -58,7 +58,8 @@ SVF::SVF() { }
|
|||
void SVF::init() {
|
||||
auto sr = audioEngine->curSampleRate();
|
||||
this->max_freq = ((float)sr / 4.0);
|
||||
|
||||
this->frequency = 12000;
|
||||
this->resonance = 65;
|
||||
addPort(Port::Input, Port::Audio, 0);
|
||||
addPort(Port::Output, Port::Audio, 0);
|
||||
}
|
||||
|
@ -69,8 +70,7 @@ void SVF::reset() {
|
|||
}
|
||||
|
||||
void SVF::release() {
|
||||
buf.clear();
|
||||
buf.setCapacity(0);
|
||||
|
||||
}
|
||||
|
||||
void SVF::process() {
|
||||
|
@ -81,7 +81,8 @@ void SVF::process() {
|
|||
auto out = std::static_pointer_cast<AudioPort>(port(Port::Output, Port::Audio, 0));
|
||||
in->pull();
|
||||
out->pull();
|
||||
|
||||
if (this->fm != _off)
|
||||
if (this->frequency > 0) { this->frequency-=0.1; }
|
||||
size_t ts = audioEngine->curTickSize();
|
||||
for (size_t f = 0; f < ts; f++) {
|
||||
AudioFrame fCurrent = (*in)[f];
|
||||
|
@ -157,20 +158,21 @@ void SVF::process() {
|
|||
}
|
||||
|
||||
void SVF::saveData(QCborMap& m) const {
|
||||
m[qs("frequency")] = QCborValue(frequency);
|
||||
m[qs("resonance")] = QCborValue(resonance);
|
||||
//m[qs("frequency")] = QCborValue(frequency);
|
||||
//m[qs("resonance")] = QCborValue(resonance);
|
||||
}
|
||||
|
||||
void SVF::loadData(const QCborMap& m) {
|
||||
frequency = m.value("frequency").toDouble(frequency);
|
||||
resonance = m.value("resonance").toDouble(resonance);
|
||||
//frequency = m.value("frequency").toDouble(frequency);
|
||||
//resonance = m.value("resonance").toDouble(resonance);
|
||||
}
|
||||
|
||||
void SVF::onGadgetCreated() {
|
||||
if (!obj) return;
|
||||
auto l = new LayoutGadget(obj);
|
||||
|
||||
(new KnobGadget(l))->bind(frequency)->setLabel(qs("Frequency"))->setRange(0.0, this->max_freq, 1.0)->setDefault(6440.0);
|
||||
//(new KnobGadget(l))->bind(freq)->setLabel(qs("Frequency Step"))->setRange(0.0, 10, 0.5)->setDefault(1.0);
|
||||
(new KnobGadget(l))->bind(frequency)->setLabel(qs("Frequency"))->setRange(0.0, this->max_freq, 10.0)->setDefault(6440.0);
|
||||
l->addSpacer();
|
||||
(new KnobGadget(l))->bind(resonance)->setLabel(qs("Resonance"))->setRange(0.0, 100.0, 0.1)->setDefault(0.0);
|
||||
l->addSpacer();
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
namespace Xybrid::Effects {
|
||||
class SVF : public Data::Node {
|
||||
QContiguousCache<Data::AudioFrame> buf;
|
||||
enum FilterMode {_off, _low, _band, _high, _notch };
|
||||
double frequency= 0.5;
|
||||
double resonance = 0.0;
|
||||
|
|
|
@ -22,7 +22,6 @@ using namespace Xybrid::Editing;
|
|||
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include "util/macos_urlhelper.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
|
||||
|
@ -236,14 +235,6 @@ bool SampleListModel::dropMimeData(const QMimeData *data, Qt::DropAction action,
|
|||
|
||||
|
||||
QList<QUrl> urls = data->urls();
|
||||
#ifdef Q_OS_MAC
|
||||
QList<QUrl> localUrls;
|
||||
foreach (const QUrl &url, urls) {
|
||||
QUrl localUrl = fromNSUrl(url);
|
||||
localUrls.append(localUrl);
|
||||
urls = localUrls;
|
||||
}
|
||||
#endif
|
||||
bool success = false;
|
||||
for (auto u : urls) {
|
||||
if (!u.isLocalFile()) continue;
|
||||
|
|
|
@ -50,9 +50,9 @@ macx: {
|
|||
LIBS += -L/usr/local/Cellar/boost/1.70.0/lib/ -lboost_math_tr1
|
||||
LIBS += -framework OpenGL
|
||||
LIBS += -framework Foundation
|
||||
SOURCES += util/macos_urlhelper.mm
|
||||
HEADERS += util/macos_urlhelper.h
|
||||
QMAKE_CXXFLAGS += -I/usr/local/Cellar/boost/1.70.0/include/
|
||||
SOURCES +=
|
||||
HEADERS +=
|
||||
QMAKE_CXXFLAGS += -g -I/usr/local/Cellar/boost/1.70.0/include/
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue