2
0
Эх сурвалжийг харах

Switched to mixing audio on demand from the audio interface

Ivan Safrin 10 жил өмнө
parent
commit
788ccb7aa6

+ 1 - 6
include/polycode/core/PolySoundManager.h

@@ -45,12 +45,7 @@ namespace Polycode {
             AudioInterface();
             AudioInterface();
             void addToBuffer(int16_t *data, unsigned int count);
             void addToBuffer(int16_t *data, unsigned int count);
             void setMixer(AudioMixer *mixer);
             void setMixer(AudioMixer *mixer);
-            AudioMixer *getMixer();
-        
-            int16_t bufferData[POLY_NUM_CHANNELS][POLY_FRAMES_PER_BUFFER*POLY_CIRCULAR_BUFFER_SIZE];
-            unsigned int readOffset;
-            unsigned int writeOffset;
-        
+            AudioMixer *getMixer();        
         protected:
         protected:
             AudioMixer *mixer;
             AudioMixer *mixer;
     };
     };

BIN
lib/osx/libPolycore.a


+ 0 - 16
src/core/PolySoundManager.cpp

@@ -123,22 +123,6 @@ void SoundManager::setAudioInterface(AudioInterface *audioInterface) {
 
 
 
 
 AudioInterface::AudioInterface() {
 AudioInterface::AudioInterface() {
-    readOffset = 0;
-    writeOffset = 0;
-    memset(bufferData, 0, sizeof(int16_t) * POLY_FRAMES_PER_BUFFER*POLY_CIRCULAR_BUFFER_SIZE);
-}
-
-void AudioInterface::addToBuffer(int16_t *data, unsigned int count) {
-    for(int i=0; i < count; i++) {
-        for(int b=0; b < POLY_NUM_CHANNELS; b++) {
-            bufferData[b][writeOffset] = data[(i*POLY_NUM_CHANNELS)+b];
-        }
-        writeOffset++;
-        if(writeOffset >= POLY_FRAMES_PER_BUFFER * POLY_CIRCULAR_BUFFER_SIZE) {
-            writeOffset = 0;
-        }
-        
-    }
 }
 }
 
 
 void AudioInterface::setMixer(AudioMixer *mixer) {
 void AudioInterface::setMixer(AudioMixer *mixer) {