mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 19:20:16 +02:00
re-enable rendering and fix sampling algorithim
This commit is contained in:
parent
e339155328
commit
560844c138
2 changed files with 10 additions and 5 deletions
|
@ -173,7 +173,6 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
|
||||||
NodeList::getInstance()->addDomainListener(this);
|
NodeList::getInstance()->addDomainListener(this);
|
||||||
NodeList::getInstance()->addDomainListener(&_voxels);
|
NodeList::getInstance()->addDomainListener(&_voxels);
|
||||||
|
|
||||||
|
|
||||||
// network receive thread and voxel parsing thread are both controlled by the --nonblocking command line
|
// network receive thread and voxel parsing thread are both controlled by the --nonblocking command line
|
||||||
_enableProcessVoxelsThread = _enableNetworkThread = !cmdOptionExists(argc, constArgv, "--nonblocking");
|
_enableProcessVoxelsThread = _enableNetworkThread = !cmdOptionExists(argc, constArgv, "--nonblocking");
|
||||||
if (!_enableNetworkThread) {
|
if (!_enableNetworkThread) {
|
||||||
|
|
|
@ -222,8 +222,15 @@ void Audio::handleAudioInput() {
|
||||||
if (!_muted) {
|
if (!_muted) {
|
||||||
// we aren't muted, average each set of four samples together to set up the mono input buffers
|
// we aren't muted, average each set of four samples together to set up the mono input buffers
|
||||||
for (int i = 2; i < BUFFER_LENGTH_SAMPLES_PER_CHANNEL * 2 * SAMPLE_RATE_RATIO; i += 4) {
|
for (int i = 2; i < BUFFER_LENGTH_SAMPLES_PER_CHANNEL * 2 * SAMPLE_RATE_RATIO; i += 4) {
|
||||||
int16_t averagedSample = (stereoInputBuffer[i - 2] / 4) + (stereoInputBuffer[i] / 2)
|
|
||||||
+ (stereoInputBuffer[i + 2] / 4);
|
int16_t averagedSample = 0;
|
||||||
|
if (i + 2 == BUFFER_LENGTH_SAMPLES_PER_CHANNEL * 2 * SAMPLE_RATE_RATIO) {
|
||||||
|
averagedSample = (stereoInputBuffer[i - 2] / 2) + (stereoInputBuffer[i] / 2);
|
||||||
|
} else {
|
||||||
|
averagedSample = (stereoInputBuffer[i - 2] / 4) + (stereoInputBuffer[i] / 2)
|
||||||
|
+ (stereoInputBuffer[i + 2] / 4);
|
||||||
|
}
|
||||||
|
|
||||||
// copy the averaged sample to our array
|
// copy the averaged sample to our array
|
||||||
memcpy(currentPacketPtr + (((i - 2) / 4) * sizeof(int16_t)), &averagedSample, sizeof(int16_t));
|
memcpy(currentPacketPtr + (((i - 2) / 4) * sizeof(int16_t)), &averagedSample, sizeof(int16_t));
|
||||||
}
|
}
|
||||||
|
@ -235,7 +242,6 @@ void Audio::handleAudioInput() {
|
||||||
// Add procedural effects to input samples
|
// Add procedural effects to input samples
|
||||||
addProceduralSounds((int16_t*) currentPacketPtr, stereoOutputBuffer, BUFFER_LENGTH_SAMPLES_PER_CHANNEL);
|
addProceduralSounds((int16_t*) currentPacketPtr, stereoOutputBuffer, BUFFER_LENGTH_SAMPLES_PER_CHANNEL);
|
||||||
|
|
||||||
|
|
||||||
nodeList->getNodeSocket()->send(audioMixer->getActiveSocket(),
|
nodeList->getNodeSocket()->send(audioMixer->getActiveSocket(),
|
||||||
monoAudioDataPacket,
|
monoAudioDataPacket,
|
||||||
BUFFER_LENGTH_BYTES_PER_CHANNEL + leadingBytes);
|
BUFFER_LENGTH_BYTES_PER_CHANNEL + leadingBytes);
|
||||||
|
@ -353,7 +359,7 @@ bool Audio::mousePressEvent(int x, int y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Audio::render(int screenWidth, int screenHeight) {
|
void Audio::render(int screenWidth, int screenHeight) {
|
||||||
if (false) {
|
if (true) {
|
||||||
glLineWidth(2.0);
|
glLineWidth(2.0);
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
glColor3f(1,1,1);
|
glColor3f(1,1,1);
|
||||||
|
|
Loading…
Reference in a new issue