"Fossies" - the Fresh Open Source Software Archive

Member "audacious-plugins-3.10.1/src/console/Effects_Buffer.h" (26 Dec 2018, 2297 Bytes) of package /linux/misc/audacious-plugins-3.10.1.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "Effects_Buffer.h" see the Fossies "Dox" file reference documentation.

    1 // Multi-channel effects buffer with panning, echo and reverb
    2 
    3 // Game_Music_Emu 0.5.5
    4 #ifndef EFFECTS_BUFFER_H
    5 #define EFFECTS_BUFFER_H
    6 
    7 #include "Multi_Buffer.h"
    8 
    9 // Effects_Buffer uses several buffers and outputs stereo sample pairs.
   10 class Effects_Buffer : public Multi_Buffer {
   11 public:
   12     // If center_only is true, only center buffers are created and
   13     // less memory is used.
   14     Effects_Buffer( bool center_only = false );
   15 
   16     // Channel  Effect    Center Pan
   17     // ---------------------------------
   18     //    0,5    reverb       pan_1
   19     //    1,6    reverb       pan_2
   20     //    2,7    echo         -
   21     //    3      echo         -
   22     //    4      echo         -
   23 
   24     // Channel configuration
   25     struct config_t {
   26         double pan_1;           // -1.0 = left, 0.0 = center, 1.0 = right
   27         double pan_2;
   28         double echo_delay;      // msec
   29         double echo_level;      // 0.0 to 1.0
   30         double reverb_delay;    // msec
   31         double delay_variance;  // difference between left/right delays (msec)
   32         double reverb_level;    // 0.0 to 1.0
   33         bool effects_enabled;   // if false, use optimized simple mixer
   34         config_t();
   35     };
   36 
   37     // Set configuration of buffer
   38     virtual void config( const config_t& );
   39     void set_depth( double );
   40 
   41 public:
   42     ~Effects_Buffer();
   43     blargg_err_t set_sample_rate( long samples_per_sec, int msec = blip_default_length );
   44     void clock_rate( long );
   45     void bass_freq( int );
   46     void clear();
   47     channel_t channel( int, int );
   48     void end_frame( blip_time_t );
   49     long read_samples( blip_sample_t*, long );
   50     long samples_avail() const;
   51 private:
   52     typedef long fixed_t;
   53 
   54     enum { max_buf_count = 7 };
   55     Blip_Buffer bufs [max_buf_count];
   56     enum { chan_types_count = 3 };
   57     channel_t chan_types [3];
   58     config_t config_;
   59     long stereo_remain;
   60     long effect_remain;
   61     int buf_count;
   62     bool effects_enabled;
   63 
   64     blargg_vector<blip_sample_t> reverb_buf;
   65     blargg_vector<blip_sample_t> echo_buf;
   66     int reverb_pos;
   67     int echo_pos;
   68 
   69     struct {
   70         fixed_t pan_1_levels [2];
   71         fixed_t pan_2_levels [2];
   72         int echo_delay_l;
   73         int echo_delay_r;
   74         fixed_t echo_level;
   75         int reverb_delay_l;
   76         int reverb_delay_r;
   77         fixed_t reverb_level;
   78     } chans;
   79 
   80     void mix_mono( blip_sample_t*, blargg_long );
   81     void mix_stereo( blip_sample_t*, blargg_long );
   82     void mix_enhanced( blip_sample_t*, blargg_long );
   83     void mix_mono_enhanced( blip_sample_t*, blargg_long );
   84 };
   85 
   86 #endif