mirror of
https://github.com/LMMS/lmms.git
synced 2026-05-17 11:18:30 -04:00
Alias-free oscillators (#5826)
Add a band-limited, alias-free wavetable oscillator option to the `Oscillator` class. Use it by default for Triple Oscillator. Savefiles which do not have this feature enabled (e.g. old savefiles) will be loaded without this feature to keep the sound consistent. Original author: @curlymorphic. Fixed: @he29-net.
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "SampleBuffer.h"
|
||||
#include "Oscillator.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -62,6 +63,7 @@
|
||||
|
||||
|
||||
SampleBuffer::SampleBuffer() :
|
||||
m_userAntiAliasWaveTable(nullptr),
|
||||
m_audioFile(""),
|
||||
m_origData(nullptr),
|
||||
m_origFrames(0),
|
||||
@@ -352,6 +354,13 @@ void SampleBuffer::update(bool keepSettings)
|
||||
|
||||
emit sampleUpdated();
|
||||
|
||||
// allocate space for anti-aliased wave table
|
||||
if (m_userAntiAliasWaveTable == nullptr)
|
||||
{
|
||||
m_userAntiAliasWaveTable = std::make_unique<OscillatorConstants::waveform_t>();
|
||||
}
|
||||
Oscillator::generateAntiAliasUserWaveTable(this);
|
||||
|
||||
if (fileLoadError)
|
||||
{
|
||||
QString title = tr("Fail to open file");
|
||||
|
||||
Reference in New Issue
Block a user