Skip to content

File reverbsc.h

File List > DaisySP > DaisySP-LGPL > Source > Effects > reverbsc.h

Go to the documentation of this file

Source Code

/*
Copyright (c) 2023 Electrosmith, Corp, Sean Costello, Istvan Varga, Paul Batchelor

Use of this source code is governed by the LGPL V2.1
license that can be found in the LICENSE file or at
https://opensource.org/license/lgpl-2-1/
*/

#pragma once
#ifndef DSYSP_REVERBSC_H
#define DSYSP_REVERBSC_H

#define DSY_REVERBSC_MAX_SIZE 98936

namespace daisysp
{
typedef struct
{
    int    write_pos;         
    int    buffer_size;       
    int    read_pos;          
    int    read_pos_frac;     
    int    read_pos_frac_inc; 
    int    dummy;             
    int    seed_val;          
    int    rand_line_cnt;     
    float  filter_state;      
    float *buf;               
} ReverbScDl;

class ReverbSc
{
  public:
    ReverbSc() {}
    ~ReverbSc() {}
    int Init(float sample_rate);

    int Process(const float &in1, const float &in2, float *out1, float *out2);

    inline void SetFeedback(const float &fb) { feedback_ = fb; }
    inline void SetLpFreq(const float &freq) { lpfreq_ = freq; }

  private:
    void       NextRandomLineseg(ReverbScDl *lp, int n);
    int        InitDelayLine(ReverbScDl *lp, int n);
    float      feedback_, lpfreq_;
    float      i_sample_rate_, i_pitch_mod_, i_skip_init_;
    float      sample_rate_;
    float      damp_fact_;
    float      prv_lpfreq_;
    int        init_done_;
    ReverbScDl delay_lines_[8];
    float      aux_[DSY_REVERBSC_MAX_SIZE];
};


} // namespace daisysp
#endif