SmartGuitarAmp

Guitar plugin made with JUCE that uses neural networks to emulate a tube amplifier
Log | Files | Refs | Submodules | README

ConvolutionLayer.h (1323B)


      1 /*
      2   ==============================================================================
      3 
      4     ConvolutionLayer.h
      5     Created: 10 Jan 2019 5:04:39pm
      6     Author:  Damskägg Eero-Pekka
      7 
      8   ==============================================================================
      9 */
     10 
     11 #pragma once
     12 
     13 #include <string>
     14 #include "../JuceLibraryCode/JuceHeader.h"
     15 #include "Convolution.h"
     16 #include "Activations.h"
     17 
     18 class ConvolutionLayer
     19 {
     20 public:
     21     ConvolutionLayer(size_t inputChannels,
     22                      size_t outputChannels,
     23                      int filterWidth,
     24                      int dilation = 1,
     25                      bool residual = false,
     26                      std::string activationName = "linear");
     27     void process(float* data, int numSamples);
     28     void process(float* data, float* skipdata, int numSamples);
     29     void setParams(size_t newInputChannels, size_t newOutputChannels, int newFilterWidth,
     30                    int newDilation, bool newResidual, std::string newActivationName);
     31     void setWeight(std::vector<float> W, std::string name);
     32     
     33 private:
     34     Convolution conv;
     35     Convolution out1x1;
     36     bool residual;
     37     bool usesGating;
     38     typedef void (* activationFunction)(float *x , size_t rows, size_t cols);
     39     activationFunction activation;
     40     void copySkipData(float *data, float *skipData, int numSamples);
     41 };