-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_audio_processing.cpp
More file actions
53 lines (44 loc) · 1.65 KB
/
test_audio_processing.cpp
File metadata and controls
53 lines (44 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "Source/VBAPEngine.h"
#include <iostream>
#include <juce_audio_basics/juce_audio_basics.h>
int main() {
VBAPEngine engine;
// Set source at 90 degrees (hard left, between FL and BL)
engine.setSourcePosition(90.0f, 0.0f);
// Create a test buffer with a simple sine wave
const int numSamples = 128;
juce::AudioBuffer<float> buffer(2, numSamples); // stereo input
// Fill with a test signal (simple constant for easy checking)
for (int i = 0; i < numSamples; ++i) {
buffer.setSample(0, i, 0.5f); // Left channel
buffer.setSample(1, i, 0.5f); // Right channel
}
// Process the buffer
engine.processBlock(buffer);
// Check the gains and output
const auto& gains = engine.getSpeakerGains();
std::cout << "Speaker gains after processing:\n";
const char* labels[] = {"F", "FR", "BR", "B", "BL", "FL"};
for (int i = 0; i < 6; ++i) {
std::cout << " " << labels[i] << ": " << gains[i] << "\n";
}
std::cout << "\nOutput channel levels (first sample):\n";
for (int ch = 0; ch < buffer.getNumChannels(); ++ch) {
std::cout << " Channel " << ch << ": " << buffer.getSample(ch, 0) << "\n";
}
// Check if we have any non-zero output
bool hasOutput = false;
for (int ch = 0; ch < buffer.getNumChannels(); ++ch) {
if (buffer.getSample(ch, 0) != 0.0f) {
hasOutput = true;
break;
}
}
if (hasOutput) {
std::cout << "\n✓ SUCCESS: Audio output detected!\n";
return 0;
} else {
std::cout << "\n✗ FAILURE: No audio output!\n";
return 1;
}
}