colormanager: implement default config

This commit is contained in:
itsmattkc
2020-04-22 05:08:33 +10:00
parent 141ac8b12f
commit ccb02d30aa
45 changed files with 721897 additions and 196 deletions
-2
View File
@@ -18,8 +18,6 @@ set(OLIVE_SOURCES
${OLIVE_SOURCES}
audio/audiomanager.h
audio/audiomanager.cpp
audio/bufferaverage.h
audio/bufferaverage.cpp
audio/outputdeviceproxy.h
audio/outputdeviceproxy.cpp
audio/outputmanager.h
-43
View File
@@ -1,43 +0,0 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
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/>.
***/
#include "bufferaverage.h"
OLIVE_NAMESPACE_ENTER
QVector<double> AudioBufferAverage::ProcessAverages(const char *data, int length, int channel_count)
{
// FIXME: Assumes float and stereo
const float* samples = reinterpret_cast<const float*>(data);
int sample_count = static_cast<int>(length / static_cast<int>(sizeof(float)));
// Create array of samples to send
QVector<double> averages(channel_count);
averages.fill(0);
// Add all samples together
for (int i=0;i<sample_count;i++) {
averages[i%channel_count] = qMax(averages[i%channel_count], static_cast<double>(qAbs(samples[i])));
}
return averages;
}
OLIVE_NAMESPACE_EXIT
-40
View File
@@ -1,40 +0,0 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
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 AUDIOBUFFERAVERAGE_H
#define AUDIOBUFFERAVERAGE_H
#include <QVector>
#include "common/define.h"
OLIVE_NAMESPACE_ENTER
class AudioBufferAverage
{
public:
AudioBufferAverage() = default;
static QVector<double> ProcessAverages(const char* data, int length, int channel_count);
};
OLIVE_NAMESPACE_EXIT
#endif // AUDIOBUFFERAVERAGE_H
-1
View File
@@ -21,7 +21,6 @@
#include "outputdeviceproxy.h"
#include "audiomanager.h"
#include "bufferaverage.h"
OLIVE_NAMESPACE_ENTER
-2
View File
@@ -25,8 +25,6 @@
#include <QFile>
#include "bufferaverage.h"
OLIVE_NAMESPACE_ENTER
AudioOutputManager::AudioOutputManager(QObject *parent) :
+2 -11
View File
@@ -24,6 +24,8 @@
OLIVE_NAMESPACE_ENTER
const SampleFormat::Format SampleFormat::kInternalFormat = SAMPLE_FMT_S32;
QString SampleFormat::GetSampleFormatName(const SampleFormat::Format &f)
{
switch (f) {
@@ -47,15 +49,4 @@ QString SampleFormat::GetSampleFormatName(const SampleFormat::Format &f)
return tr("Invalid");
}
SampleFormat::Format SampleFormat::GetConfiguredFormatForMode(RenderMode::Mode /*mode*/)
{
//return static_cast<SampleFormat::Format>(Core::GetPreferenceForRenderMode(mode, QStringLiteral("SampleFormat")).toInt());
return SAMPLE_FMT_FLT;
}
void SampleFormat::SetConfiguredFormatForMode(RenderMode::Mode mode, SampleFormat::Format format)
{
Core::SetPreferenceForRenderMode(mode, QStringLiteral("SampleFormat"), format);
}
OLIVE_NAMESPACE_EXIT
+2 -3
View File
@@ -47,10 +47,9 @@ public:
SAMPLE_FMT_COUNT
};
static QString GetSampleFormatName(const Format& f);
static const Format kInternalFormat;
static Format GetConfiguredFormatForMode(RenderMode::Mode mode);
static void SetConfiguredFormatForMode(RenderMode::Mode mode, Format format);
static QString GetSampleFormatName(const Format& f);
};