]> git.treefish.org Git - seamulator.git/commitdiff
trying
authorAlexander Schmidt <alex@treefish.org>
Mon, 22 Feb 2021 11:32:05 +0000 (12:32 +0100)
committerAlexander Schmidt <alex@treefish.org>
Mon, 22 Feb 2021 11:32:05 +0000 (12:32 +0100)
src/dot.cpp
src/synthesizer.cpp

index d052a24e749619625889553d50db638b6137022a..5f6ae87a628f31779b0816b993404386571fff92 100644 (file)
@@ -16,7 +16,7 @@ void Dot::advance(double deltaT)
     
     auto posBefore = m_pos;
 
-    m_vel += -std::pow(m_frequency / 440.0, 2.0) * 1.0 * ( m_pos - m_point.getHeight() ) * deltaT;
+    m_vel += -std::pow(m_frequency/440.0, 2.0) * 1.0 * ( m_pos - m_point.getHeight() ) * deltaT;
     m_vel -= m_vel * 0.01 * deltaT;
     m_pos += m_vel * deltaT;
 
@@ -27,7 +27,7 @@ void Dot::advance(double deltaT)
     
     if (posBefore * m_pos < 0.0) {
 // //        std::cout << m_vel / m_maxVel << std::endl;
-        m_noise.noteOn(m_pos >= 0 ? m_frequency : m_frequency*0.5, absVel / m_maxAbsVel);
+        m_noise.noteOn(m_pos >= 0 ? m_frequency : m_frequency, absVel / m_maxAbsVel);
 //         //m_noise.pluck(absVel / m_maxAbsVel);
 //         m_noise.controlChange(4, 1.0 * absVel / m_maxAbsVel);
     }
index b2254c01f8b4bb059639dc4ee91d280a3c365242..a4148ced1431aa8210cf9c4f50ceb23b35749def 100644 (file)
@@ -55,17 +55,17 @@ Synthesizer::Synthesizer(ConstWaterSurfacePtr surface) :
 //        m_dots.emplace_back( std::make_unique<Dot>(m_surface->at(i, 0), 440.0) );
         //}
 
-    m_dots.emplace_back( std::make_unique<Dot>(m_surface->at(0, 0), 939.85) );
-    m_dots.emplace_back( std::make_unique<Dot>(m_surface->at(0, 10), 704.09) );
-    m_dots.emplace_back( std::make_unique<Dot>(m_surface->at(0, 20), 469.92) );
-    m_dots.emplace_back( std::make_unique<Dot>(m_surface->at(0, 30), 352.04) );
-    m_dots.emplace_back( std::make_unique<Dot>(m_surface->at(0, 40), 279.42) );
-
-    m_dots.emplace_back( std::make_unique<Dot>(m_surface->at(10, 10), 1054.94) );
-    m_dots.emplace_back( std::make_unique<Dot>(m_surface->at(20, 10), 704.09) );
-    m_dots.emplace_back( std::make_unique<Dot>(m_surface->at(30, 10), 527.47) );
-    m_dots.emplace_back( std::make_unique<Dot>(m_surface->at(40, 10), 418.65) );
-    m_dots.emplace_back( std::make_unique<Dot>(m_surface->at(50, 10), 313.64) );
+    m_dots.emplace_back( std::make_unique<Dot>(m_surface->at(10, 50), 939.85) );
+    m_dots.emplace_back( std::make_unique<Dot>(m_surface->at(20, 40), 704.09) );
+    m_dots.emplace_back( std::make_unique<Dot>(m_surface->at(30, 30), 469.92) );
+    m_dots.emplace_back( std::make_unique<Dot>(m_surface->at(40, 20), 352.04) );
+    m_dots.emplace_back( std::make_unique<Dot>(m_surface->at(50, 10), 279.42) );
+
+    m_dots.emplace_back( std::make_unique<Dot>(m_surface->at(50, 10), 1054.94) );
+    m_dots.emplace_back( std::make_unique<Dot>(m_surface->at(40, 20), 704.09) );
+    m_dots.emplace_back( std::make_unique<Dot>(m_surface->at(30, 30), 527.47) );
+    m_dots.emplace_back( std::make_unique<Dot>(m_surface->at(20, 40), 418.65) );
+    m_dots.emplace_back( std::make_unique<Dot>(m_surface->at(10, 50), 313.64) );
 
     m_audioThread = std::thread( [this]{audioLoop();} );
 
@@ -172,7 +172,9 @@ void Synthesizer::tick()
 void Synthesizer::audioLoop()
 {
     stk::PRCRev effect0(0.5);
-    stk::Echo effect;
+    stk::Echo echo1;
+    stk::Echo echo2{4000};
+    stk::Echo echo3{7000};
     stk::Chorus chorus{6000};
     stk::StkFrames frames(88200, 2);
     while (!m_stop) {
@@ -185,7 +187,10 @@ void Synthesizer::audioLoop()
             //frames(i,1) = frames(i,0);
         }
         //       frames = effect0.tick(frames);
-//        frames = effect.tick(frames);
+        frames = echo1.tick(frames);
+        // frames = echo2.tick(frames);
+        // frames = echo3.tick(frames);
+
         frames = chorus.tick(frames);
 
         m_dac->tick(frames);