Mercurial > hg > svapp
changeset 311:86fb9160d122 tonioni
Fix some foolish mistakes. We have arbitrary frequency note playback now (though with rough edges)
author | Chris Cannam |
---|---|
date | Wed, 08 Jan 2014 09:58:48 +0000 |
parents | 8c59cc68eabd |
children | faee60602049 |
files | audioio/ClipMixer.cpp |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/audioio/ClipMixer.cpp Tue Jan 07 17:11:14 2014 +0000 +++ b/audioio/ClipMixer.cpp Wed Jan 08 09:58:48 2014 +0000 @@ -104,7 +104,7 @@ ClipMixer::getResampleRatioFor(float frequency) { if (!m_clipData) return 1.0; - float pitchRatio = frequency / m_clipF0; + float pitchRatio = m_clipF0 / frequency; float resampleRatio = m_sampleRate / m_clipRate; return pitchRatio * resampleRatio; } @@ -159,7 +159,7 @@ int clipDuration = getResampledClipDuration(note.frequency); if (start + clipDuration > 0) { if (start < 0 && start + clipDuration < durationHere) { - durationHere = clipDuration - start; + durationHere = start + clipDuration; } if (durationHere > 0) { mixNote(toBuffers, @@ -214,7 +214,7 @@ } for (int c = 0; c < m_channels; ++c) { - toBuffers[c][targetOffset + i] = levels[c] * value; + toBuffers[c][targetOffset + i] += levels[c] * value; } } }