]> git.quilime.com - iosynth.git/commitdiff
Added Audio Callback master
authorGabriel Dunne <gdunne@quilime.com>
Mon, 9 Dec 2013 23:47:24 +0000 (15:47 -0800)
committerGabriel Dunne <gdunne@quilime.com>
Mon, 9 Dec 2013 23:47:24 +0000 (15:47 -0800)
src/iosynthApp.cpp
src/iosynthApp.h

index 8184e775fa69672a32e804ac8d852c8538e81c2a..140082f9572a10afc025678269f69f272048b8be 100644 (file)
@@ -10,6 +10,12 @@ void iosynthApp::setup()
         voices.at(i)->setGain(1);
         voices.at(i)->keyOff(0);
     }
         voices.at(i)->setGain(1);
         voices.at(i)->keyOff(0);
     }
+    
+    reverb.setT60(2);
+    reverb.setEffectMix(0.35);
+    mMasterGain = 0.85;
+    
+    audio::Output::play(audio::createCallback(this, &iosynthApp::processAudio));
 }
 
 void iosynthApp::update()
 }
 
 void iosynthApp::update()
@@ -39,6 +45,39 @@ void iosynthApp::draw()
     }
 }
 
     }
 }
 
+void iosynthApp::processAudio( uint64_t inSampleOffset, uint32_t ioSampleCount, audio::Buffer32f *ioBuffer ) {
+    
+    for( int i = 0; i < ioSampleCount; i++ ) {
+        
+        float sample = 0;
+        
+        // render each voice
+        for (auto v : voices) {
+            sample += v->tick();
+        }
+        
+        // delay line
+        sample += maxiDelay.dl(sample, 2048 * 8, .6); // * 0.9125;
+        
+        // filter
+        // sample += maxiFilter.cutoff
+        
+        // master reverb
+        sample = reverb.tick(sample);
+        
+        // gate
+        // sample = fmin(sample, 1);
+        
+        // master gain
+        sample = sample * mMasterGain;
+        
+        
+        ioBuffer->mData[i * ioBuffer->mNumberChannels]     = mAudioSamples[0][i] = sample;
+        ioBuffer->mData[i * ioBuffer->mNumberChannels + 1] = mAudioSamples[1][i] = sample;
+    }
+}
+
+
 void iosynthApp::mouseDown( MouseEvent event )
 {
 }
 void iosynthApp::mouseDown( MouseEvent event )
 {
 }
index 69cd467bcb482e869c1a8e1f38b699a818c08abe..d3588622a32fa574848aea5425e228cd14490f88 100644 (file)
@@ -46,8 +46,7 @@ public:
        void update();
        void draw();
     
        void update();
        void draw();
     
-    void processAudio( uint64_t inSampleOffset, uint32_t ioSampleCount,
-                      audio::Buffer32f *ioBuffer );
+    void processAudio( uint64_t inSampleOffset, uint32_t ioSampleCount, audio::Buffer32f *ioBuffer );
     void touchesBegan( TouchEvent event );
     void touchesMoved( TouchEvent event );
     void touchesEnded( TouchEvent event );
     void touchesBegan( TouchEvent event );
     void touchesMoved( TouchEvent event );
     void touchesEnded( TouchEvent event );