Skip to content

Commit

Permalink
Audio: remove the soloud lowpass filter
Browse files Browse the repository at this point in the history
  • Loading branch information
floooh committed Apr 3, 2018
1 parent 710e0a9 commit c756622
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 33 deletions.
17 changes: 0 additions & 17 deletions src/yakc_oryol/Audio.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ Audio::Setup(yakc* emu_) {
soloud->init(SoLoud::Soloud::CLIP_ROUNDOFF, SoLoud::Soloud::AUTO, 44100, 1024, 1);
}
soloud_open_count++;
this->filter.setParams(SoLoud::BiquadResonantFilter::LOWPASS, 44100, this->LowPassFreq, this->LowPassResonance);
this->audioSource = Memory::New<AudioSource>();
this->audioSource->emu = emu_;
this->audioSource->setSingleInstance(true);
this->audioSource->setFilter(0, &this->filter);
this->audioSource->cpu_clock_speed = board.freq_hz;
this->audioHandle = soloud->play(*this->audioSource, 1.0f);
}
Expand Down Expand Up @@ -56,20 +54,5 @@ Audio::GetProcessedCycles() const {
return this->audioSource->sample_cycle_count;
}

//------------------------------------------------------------------------------
void
Audio::UpdateFilterSettings() {
soloud->fadeFilterParameter(this->audioHandle, 0, SoLoud::BiquadResonantFilter::FREQUENCY, this->LowPassFreq, 0.1f);
soloud->fadeFilterParameter(this->audioHandle, 0, SoLoud::BiquadResonantFilter::RESONANCE, this->LowPassResonance, 0.1f);
}

//------------------------------------------------------------------------------
void
Audio::ResetFilterSettings() {
this->LowPassFreq = 4000.0f;
this->LowPassResonance = 2.0f;
this->UpdateFilterSettings();
}

} // namespace YAKC

9 changes: 0 additions & 9 deletions src/yakc_oryol/Audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "yakc/yakc.h"
#include "Core/Containers/Queue.h"
#include "AudioSource.h"
#include "soloud_biquadresonantfilter.h"

namespace YAKC {

Expand All @@ -21,18 +20,10 @@ class Audio {
void Update();
/// get the current max processed audio sample count in number of CPU cycles
uint64_t GetProcessedCycles() const;
/// update filter settings
void UpdateFilterSettings();
/// reset filter settings to default
void ResetFilterSettings();

float LowPassFreq = 3200.0f;
float LowPassResonance = 2.0f;

static SoLoud::Soloud* soloud;
static int soloud_open_count;
yakc* emu = nullptr;
SoLoud::BiquadResonantFilter filter;
AudioSource* audioSource = nullptr;
int audioHandle = 0;
};
Expand Down
7 changes: 0 additions & 7 deletions src/yakc_ui/UI.cc
Original file line number Diff line number Diff line change
Expand Up @@ -446,16 +446,9 @@ UI::OnFrame(yakc& emu) {
this->Settings.colorTV = !this->Settings.colorTV;
}
ImGui::SliderFloat("CRT Warp", &this->Settings.crtWarp, 0.0f, 1.0f/16.0f);
if (ImGui::SliderFloat("Lowpass Freq", &this->audio->LowPassFreq, 1000.0, 8000.0f)) {
this->audio->UpdateFilterSettings();
}
if (ImGui::SliderFloat("Lowpass Resonance", &this->audio->LowPassResonance, 1.0f, 8.0f)) {
this->audio->UpdateFilterSettings();
}
ImGui::SliderInt("CPU Speed", &emu.accel, 1, 8, "%.0fx");
if (ImGui::MenuItem("Reset To Defaults")) {
this->Settings = settings();
this->audio->ResetFilterSettings();
}
ImGui::EndMenu();
}
Expand Down

0 comments on commit c756622

Please sign in to comment.