changeset 338:8a2166088b94 livemode

Initialise pitch and shift vectors to 1.0 instead of randomly -- seems to produce at least no worse results, and has the advantage of producing deterministic output
author Chris Cannam
date Mon, 29 Jun 2015 16:22:32 +0100
parents d25e4aee73d7
children bcfdaa708992
files src/EM.cpp
diffstat 1 files changed, 3 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/EM.cpp	Fri Jun 26 10:23:54 2015 +0100
+++ b/src/EM.cpp	Mon Jun 29 16:22:32 2015 +0100
@@ -44,17 +44,13 @@
 {
     m_pitches = allocate<float>(m_noteCount);
     m_updatePitches = allocate<float>(m_noteCount);
-    for (int n = 0; n < m_noteCount; ++n) {
-        m_pitches[n] = float(rand()) / RAND_MAX;
-    }
+    v_set(m_pitches, 1.f, m_noteCount);
 
     if (useShifts) {
         m_shifts = allocate_channels<float>(m_shiftCount, m_noteCount);
         m_updateShifts = allocate_channels<float>(m_shiftCount, m_noteCount);
         for (int f = 0; f < m_shiftCount; ++f) {
-            for (int n = 0; n < m_noteCount; ++n) {
-                m_shifts[f][n] = float(rand()) / RAND_MAX;
-            }
+            v_set(m_shifts[f], 1.f, m_noteCount);
         }
     } else {
         m_shifts = 0;
@@ -65,7 +61,7 @@
     m_updateSources = allocate_channels<float>(m_sourceCount, m_noteCount);
     for (int i = 0; i < m_sourceCount; ++i) {
         for (int n = 0; n < m_noteCount; ++n) {
-            m_sources[i][n] = (inRange(i, n) ? 1.0 : 0.0);
+            m_sources[i][n] = (inRange(i, n) ? 1.f : 0.f);
         }
     }