zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

Reverse.h (2969B)


      1 /*
      2   ZynAddSubFX - a software synthesizer
      3 
      4   Reverse.h - Reverse Delay Effect
      5   Copyright (C) 2023-2024 Michael Kirchner
      6   Author: Michael Kirchner
      7 
      8   This program is free software; you can redistribute it and/or
      9   modify it under the terms of the GNU General Public License
     10   as published by the Free Software Foundation; either version 2
     11   of the License, or (at your option) any later version.
     12 */
     13 
     14 #ifndef REVERSE_H
     15 #define REVERSE_H
     16 
     17 #include "Effect.h"
     18 
     19 namespace zyn {
     20 
     21 class Reverter;
     22 
     23 /**Reverse Effect*/
     24 class Reverse final:public Effect
     25 {
     26     public:
     27         Reverse(EffectParams pars, const AbsTime *time_);
     28         ~Reverse();
     29         void update();
     30         void out(const Stereo<float *> &input);
     31         unsigned char getpresetpar(unsigned char npreset, unsigned int npar);
     32         void setpreset(unsigned char npreset);
     33         /**
     34          * Sets the value of the chosen variable
     35          *
     36          * The possible parameters are:
     37          *   -# Volume
     38          *   -# Panning (member of parent class)
     39          *   -# Delay
     40          *   -# Stereo
     41          *   -# Phase
     42          *   -# Crossfade
     43          *   -# Sync Mode
     44 
     45          * @param npar number of chosen parameter
     46          * @param value the new value
     47          */
     48         void changepar(int npar, unsigned char value);
     49 
     50         /**
     51          * Gets the specified parameter
     52          *
     53          * The possible parameters are:
     54          *   -# Volume
     55          *   -# Panning (member of parent class)
     56          *   -# Delay
     57          *   -# Stereo
     58          *   -# Phase
     59          *   -# Crossfade
     60          *   -# Sync Mode
     61 
     62 
     63          * @param npar number of chosen parameter
     64          * @return value of parameter
     65          */
     66         unsigned char getpar(int npar) const;
     67         int getnumparams(void);
     68         void cleanup(void);
     69 
     70         static rtosc::Ports ports;
     71     private:
     72         //Parameters
     73         unsigned char Pvolume;     /**< #0 Volume or Dry/Wetness */
     74         unsigned char Pdelay;      /**< #2 Length of reversed segment, 127 = 1.5s */
     75         unsigned char Pphase;      /**< #3 Phase offset for delay effect */
     76         unsigned char Pcrossfade;  /**< #4 Crossfade duration between segments */
     77         unsigned char PsyncMode;   /**< #5 Synchronization mode setting */
     78         unsigned char Pstereo;     /**< #6 Stereo mode flag */
     79 
     80         void setvolume(unsigned char _Pvolume);
     81         void setdelay(unsigned char _Pdelay);
     82         void setphase(unsigned char _Pphase);
     83         void setcrossfade(unsigned char value);
     84         void setsyncMode(unsigned char value);
     85 
     86         const AbsTime *time;
     87 
     88         Reverter* reverterL;
     89         Reverter* reverterR;
     90 
     91         float tick;                 // number of ticks passed in the current measure
     92                                     // - used to predict the position of the next beat
     93         unsigned int currentSubbufferIndex = 0;
     94         float tick_hist;
     95         float tick_at_host_buffer_start;
     96         bool playing_hist;
     97 };
     98 
     99 }
    100 
    101 #endif