Skip to content

File bitcrush.h

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

Go to the documentation of this file

Source Code

/*
Copyright (c) 2023 Electrosmith, Corp, 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 DSY_BITCRUSH_H
#define DSY_BITCRUSH_H

#include <stdint.h>
#ifdef __cplusplus

namespace daisysp
{
class Bitcrush
{
  public:
    Bitcrush() {}
    ~Bitcrush() {}
    void Init(float sample_rate);


    float Process(float in);


    inline void SetBitDepth(int bitdepth) { bit_depth_ = bitdepth; }
    inline void SetCrushRate(float crushrate) { crush_rate_ = crushrate; }

  private:
    float sample_rate_, crush_rate_;
    int   bit_depth_;
};
} // namespace daisysp
#endif
#endif