Skip to content

Commit

Permalink
Merge branch 'LMMS:master' into sample-thumbnail
Browse files Browse the repository at this point in the history
  • Loading branch information
khoidauminh authored Nov 22, 2024
2 parents 38cd04d + 26d5241 commit 5414e34
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 17 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,12 @@ jobs:
with:
fetch-depth: 0
submodules: recursive
- name: Update vcpkg (TEMPORARY)
run: |
cd $env:VCPKG_INSTALLATION_ROOT
git pull
.\bootstrap-vcpkg.bat
shell: pwsh
- name: Cache vcpkg dependencies
id: cache-deps
uses: actions/cache@v3
Expand Down
2 changes: 1 addition & 1 deletion include/Oscillator.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class LMMS_EXPORT Oscillator

static inline float freqFromWaveTableBand(int band)
{
return 440.0f * std::pow(2.0f, (band * OscillatorConstants::SEMITONES_PER_TABLE - 69.0f) / 12.0f);
return 440.0f * std::exp2((band * OscillatorConstants::SEMITONES_PER_TABLE - 69.0f) / 12.0f);
}

private:
Expand Down
4 changes: 2 additions & 2 deletions plugins/FreeBoy/FreeBoy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,14 +352,14 @@ void FreeBoyInstrument::playNote(NotePlayHandle* nph, SampleFrame* workingBuffer
// a unique frequency, we can start by guessing s = r = 0 here and then skip r = 0 in the loop.
char clock_freq = 0;
char div_ratio = 0;
float closest_freq = 524288.0 / (0.5 * std::pow(2.0, clock_freq + 1.0));
float closest_freq = 524288.0 / (0.5 * std::exp2(clock_freq + 1.0));
// This nested for loop iterates over all possible combinations of clock frequency and dividing
// ratio and chooses the combination whose resulting frequency is closest to the note frequency
for (char s = 0; s < 16; ++s)
{
for (char r = 1; r < 8; ++r)
{
float f = 524288.0 / (r * std::pow(2.0, s + 1.0));
float f = 524288.0 / (r * std::exp2(s + 1.0));
if (std::fabs(freq - closest_freq) > std::fabs(freq - f))
{
closest_freq = f;
Expand Down
4 changes: 2 additions & 2 deletions plugins/Monstro/Monstro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1462,14 +1462,14 @@ void MonstroInstrument::updateSamplerate()
void MonstroInstrument::updateSlope1()
{
const float slope = m_env1Slope.value();
m_slope[0] = std::pow(10.f, slope * -1.0f );
m_slope[0] = fastPow10f(-slope);
}


void MonstroInstrument::updateSlope2()
{
const float slope = m_env2Slope.value();
m_slope[1] = std::pow(10.f, slope * -1.0f );
m_slope[1] = fastPow10f(-slope);
}


Expand Down
2 changes: 1 addition & 1 deletion plugins/MultitapEcho/MultitapEchoControls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void MultitapEchoControls::lpSamplesChanged( int begin, int end )
const float * samples = m_lpGraph.samples();
for( int i = begin; i <= end; ++i )
{
m_effect->m_lpFreq[i] = 20.0f * std::pow(10.f, samples[i] );
m_effect->m_lpFreq[i] = 20.0f * fastPow10f(samples[i]);
}
m_effect->updateFilters( begin, end );
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/SlicerT/SlicerT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ void SlicerT::findSlices()
float magnitude = std::sqrt(real * real + imag * imag);

// using L2-norm (euclidean distance)
float diff = std::sqrt(std::pow(magnitude - prevMags[j], 2));
float diff = std::abs(magnitude - prevMags[j]);
spectralFlux += diff;

prevMags[j] = magnitude;
Expand Down
21 changes: 11 additions & 10 deletions src/core/DrumSynth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include <cstring>
#include <sstream>

#include "lmms_math.h"

#ifdef _MSC_VER
// not #if LMMS_BUILD_WIN32 because we have strncasecmp in mingw
#define strcasecmp _stricmp
Expand Down Expand Up @@ -403,13 +405,13 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t*& wave, int channels, sa
timestretch *= Fs / 44100.f;

DGain = 1.0f; // leave this here!
DGain = static_cast<float>(std::pow(10.0, 0.05 * GetPrivateProfileFloat(sec, "Level", 0, dsfile)));
DGain = fastPow10f(0.05 * GetPrivateProfileFloat(sec, "Level", 0, dsfile));

MasterTune = GetPrivateProfileFloat(sec, "Tuning", 0.0, dsfile);
MasterTune = static_cast<float>(std::pow(1.0594631f, MasterTune + mem_tune));
MasterTune = std::pow(1.0594631f, MasterTune + mem_tune);
MainFilter = 2 * GetPrivateProfileInt(sec, "Filter", 0, dsfile);
MFres = 0.0101f * GetPrivateProfileFloat(sec, "Resonance", 0.0, dsfile);
MFres = static_cast<float>(std::pow(MFres, 0.5f));
MFres = std::sqrt(MFres);

HighPass = GetPrivateProfileInt(sec, "HighPass", 0, dsfile);
GetEnv(7, sec, "FilterEnv", dsfile);
Expand Down Expand Up @@ -455,7 +457,7 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t*& wave, int channels, sa
TDroopRate = GetPrivateProfileFloat(sec, "Droop", 0.f, dsfile);
if (TDroopRate > 0.f)
{
TDroopRate = static_cast<float>(std::pow(10.0f, (TDroopRate - 20.0f) / 30.0f));
TDroopRate = fastPow10f((TDroopRate - 20.0f) / 30.0f);
TDroopRate = TDroopRate * -4.f / envData[1][MAX];
TDroop = 1;
F2 = F1 + ((F2 - F1) / (1.f - static_cast<float>(exp(TDroopRate * envData[1][MAX]))));
Expand All @@ -482,7 +484,7 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t*& wave, int channels, sa
OW1 = GetPrivateProfileInt(sec, "Wave1", 0, dsfile);
OW2 = GetPrivateProfileInt(sec, "Wave2", 0, dsfile);
OBal2 = static_cast<float>(GetPrivateProfileInt(sec, "Param", 50, dsfile));
ODrive = static_cast<float>(std::pow(OBal2, 3.0f)) / std::pow(50.0f, 3.0f);
ODrive = (OBal2 * OBal2 * OBal2) / 125000.0f;
OBal2 *= 0.01f;
OBal1 = 1.f - OBal2;
Ophi1 = Tphi;
Expand Down Expand Up @@ -556,9 +558,8 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t*& wave, int channels, sa
{
DAtten = DGain * static_cast<short>(LoudestEnv());
clippoint = DAtten > 32700 ? 32700 : static_cast<short>(DAtten);
DAtten = static_cast<float>(std::pow(2.0, 2.0 * GetPrivateProfileInt(sec, "Bits", 0, dsfile)));
DGain = DAtten * DGain
* static_cast<float>(std::pow(10.0, 0.05 * GetPrivateProfileInt(sec, "Clipping", 0, dsfile)));
DAtten = std::exp2(2.0 * GetPrivateProfileInt(sec, "Bits", 0, dsfile));
DGain = DAtten * DGain * fastPow10f(0.05 * GetPrivateProfileInt(sec, "Clipping", 0, dsfile));
}

// prepare envelopes
Expand Down Expand Up @@ -856,7 +857,7 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t*& wave, int channels, sa
MFtmp = envData[7][ENV];
if (MFtmp > 0.2f)
{
MFfb = 1.001f - static_cast<float>(std::pow(10.0f, MFtmp - 1));
MFfb = 1.001f - fastPow10f(MFtmp - 1);
}
else
{
Expand All @@ -883,7 +884,7 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t*& wave, int channels, sa
MFtmp = envData[7][ENV];
if (MFtmp > 0.2f)
{
MFfb = 1.001f - static_cast<float>(std::pow(10.0f, MFtmp - 1));
MFfb = 1.001f - fastPow10f(MFtmp - 1);
}
else
{
Expand Down
1 change: 1 addition & 0 deletions src/gui/GuiApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ GuiApplication::GuiApplication()

// Show splash screen
QSplashScreen splashScreen( embed::getIconPixmap( "splash" ) );
splashScreen.setFixedSize(splashScreen.pixmap().size());
splashScreen.show();

QHBoxLayout layout;
Expand Down

0 comments on commit 5414e34

Please sign in to comment.