示例#1
0
void Ambix_directional_loudnessAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages)
{
    _Sh_transf = Sh_transf; // buffer old values
    
    calcParams(); // calc new transformation matrix
    
    int NumSamples = buffer.getNumSamples();
    
    output_buffer.setSize(buffer.getNumChannels(), NumSamples);
    output_buffer.clear();
    
    
    for (int out = 0; out < std::min(AMBI_CHANNELS,getNumOutputChannels()); out++)
    {
        for (int in = 0; in < std::min(AMBI_CHANNELS,getNumInputChannels()); in++)
        {
            if (_Sh_transf(in, out) != 0.f || Sh_transf(in, out) != 0.f)
            {
                if (_Sh_transf(in, out) == Sh_transf(in, out))
                {
                    output_buffer.addFrom(out, 0, buffer, in, 0, NumSamples, (float)Sh_transf(in, out));
                } else {
                    output_buffer.addFromWithRamp(out, 0, buffer.getReadPointer(in), NumSamples, (float)_Sh_transf(in, out), (float)Sh_transf(in, out));
                }
                
            }
        }
    }
    
    
    buffer = output_buffer;
}
示例#2
0
void Ambix_rotatorAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages)
{
    if (_new_params)
    {
        _Sh_transf = Sh_transf; // buffer old values
        calcParams(); // calc new transformation matrix
    }
  
    int NumSamples = buffer.getNumSamples();
    
    output_buffer.setSize(buffer.getNumChannels(), NumSamples);
    output_buffer.clear();
    
    int num_out_ch = jmin(AMBI_CHANNELS,getTotalNumOutputChannels());
    int num_in_ch = jmin(AMBI_CHANNELS,getTotalNumInputChannels());
  
    // 0th channel is invariant!
    output_buffer.addFrom(0, 0, buffer, 0, 0, NumSamples);
  
    for (int out = 1; out < num_out_ch; out++)
    {
        int n = (int)sqrtf(out);// order
        int in_start = n*n;
        int in_end = jmin((n+1)*(n+1), num_in_ch);
        for (int in = in_start; in < in_end; in++)
        {
            if (!_new_params)
            {
                if (Sh_transf(in, out) != 0.f)
                    output_buffer.addFrom(out, 0, buffer, in, 0, NumSamples, (float)Sh_transf(in, out));
            } else {
                if (_Sh_transf(in, out) != 0.f || Sh_transf(in, out) != 0.f)
                    output_buffer.addFromWithRamp(out, 0, buffer.getReadPointer(in), NumSamples, (float)_Sh_transf(in, out), (float)Sh_transf(in, out));
            }
        }
    }
  
    if (_new_params)
        _new_params = false;
    
    buffer = output_buffer;
    
}