Files
oak-editor/app/audio/sampleformat.cpp
T
itsmattkc 59d32f60ad core: use SAMPLE_FMT_FLT only
There's no real reason not to use float for audio. It's light on system
resources (compared to everything else we're doing at least) and the code
becomes simpler when we can assume all audio will be -1 to 1 rather than 0 to
255 or -32768 to 32767.

The only thing we might want to do one day is move up to SAMPLE_FMT_DBL, but
this should only take some mild refactoring and all our assumptions (i.e. -1 to
1 range, etc.) can remain the same.
2020-03-31 18:07:25 +11:00

38 lines
988 B
C++

#include "sampleformat.h"
#include "core.h"
QString SampleFormat::GetSampleFormatName(const SampleFormat::Format &f)
{
switch (f) {
case SAMPLE_FMT_U8:
return tr("Unsigned 8-bit");
case SAMPLE_FMT_S16:
return tr("Signed 16-bit");
case SAMPLE_FMT_S32:
return tr("Signed 32-bit");
case SAMPLE_FMT_S64:
return tr("Signed 64-bit");
case SAMPLE_FMT_FLT:
return tr("32-bit Float");
case SAMPLE_FMT_DBL:
return tr("64-bit Float");
case SAMPLE_FMT_COUNT:
case SAMPLE_FMT_INVALID:
break;
}
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);
}