Jelajahi Sumber

Switched to mixing audio on demand from the audio interface

Ivan Safrin 10 tahun lalu
induk
melakukan
788ccb7aa6
3 mengubah file dengan 1 tambahan dan 22 penghapusan
  1. 1 6
      include/polycode/core/PolySoundManager.h
  2. TEMPAT SAMPAH
      lib/osx/libPolycore.a
  3. 0 16
      src/core/PolySoundManager.cpp

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

@@ -45,12 +45,7 @@ namespace Polycode {
             AudioInterface();
             void addToBuffer(int16_t *data, unsigned int count);
             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:
             AudioMixer *mixer;
     };

TEMPAT SAMPAH
lib/osx/libPolycore.a


+ 0 - 16
src/core/PolySoundManager.cpp

@@ -123,22 +123,6 @@ void SoundManager::setAudioInterface(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) {