/*
 * Copyright (C) 2006-2026 Metallizer, Solarus - http://www.solarus-games.org
 *
 * Solarus 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.
 *
 * Solarus 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 "solarus/audio/ALWrapper.h"
#include "solarus/audio/filters/LowPassAudioFilter.h"

namespace Solarus {

LowPassAudioFilter::LowPassAudioFilter(float gain, float gainhf)
  : AudioFilter(AudioEffectId::LOW_PASS) {
  ALWrapper::generate_filter(1, &filter, "create_low_pass_filter");
  ALWrapper::set_filter_int(filter, AL_FILTER_TYPE, AL_FILTER_LOWPASS, "create_low_pass_filter");
  set_params(gain, gainhf);
}

void LowPassAudioFilter::set_params(float gain, float gainhf) {
  ALWrapper::set_filter_float(filter, AL_LOWPASS_GAIN,   gain,   "set_low_pass_params");
  ALWrapper::set_filter_float(filter, AL_LOWPASS_GAINHF, gainhf, "set_low_pass_params");
}

} // namespace Solarus
