MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / process

Method process

src/audio_effects/STFT.cpp:21–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19}
20
21void STFT::process(juce::AudioBuffer<float> &block)
22{
23 num_samples = block.getNumSamples();
24
25 for (int channel = 0; channel < num_channels; ++channel) {
26 float *channel_data = block.getWritePointer(channel);
27
28 current_input_buffer_write_position = input_buffer_write_position;
29 current_output_buffer_write_position = output_buffer_write_position;
30 current_output_buffer_read_position = output_buffer_read_position;
31 current_samples_since_last_FFT = samples_since_last_FFT;
32
33 for (int sample = 0; sample < num_samples; ++sample) {
34 const float input_sample = channel_data[sample];
35
36 input_buffer.setSample(channel, current_input_buffer_write_position, input_sample);
37 if (++current_input_buffer_write_position >= input_buffer_length)
38 current_input_buffer_write_position = 0;
39 // diff
40 channel_data[sample] = output_buffer.getSample(channel, current_output_buffer_read_position);
41
42 output_buffer.setSample(channel, current_output_buffer_read_position, 0.0f);
43 if (++current_output_buffer_read_position >= output_buffer_length)
44 current_output_buffer_read_position = 0;
45
46 if (++current_samples_since_last_FFT >= hop_size) {
47 current_samples_since_last_FFT = 0;
48 analysis(channel);
49 modification(channel);
50 synthesis(channel);
51 }
52 }
53 }
54
55 input_buffer_write_position = current_input_buffer_write_position;
56 output_buffer_write_position = current_output_buffer_write_position;
57 output_buffer_read_position = current_output_buffer_read_position;
58 samples_since_last_FFT = current_samples_since_last_FFT;
59}
60
61
62void STFT::updateFftSize(const int new_fft_size)

Callers 2

GetFrameMethod · 0.80
GetFrameMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected