Mercurial > hg > svapp
comparison audioio/AudioCallbackPlaySource.cpp @ 250:0136555495ae integration_library
Merge from the default branch
author | Chris Cannam |
---|---|
date | Tue, 11 Oct 2011 11:16:38 +0100 |
parents | a99de38af73f f853dfb200de |
children |
comparison
equal
deleted
inserted
replaced
249:7f08a7e35b3c | 250:0136555495ae |
---|---|
900 } | 900 } |
901 | 901 |
902 void | 902 void |
903 AudioCallbackPlaySource::setTargetSampleRate(size_t sr) | 903 AudioCallbackPlaySource::setTargetSampleRate(size_t sr) |
904 { | 904 { |
905 bool first = (m_targetSampleRate == 0); | |
906 | |
905 m_targetSampleRate = sr; | 907 m_targetSampleRate = sr; |
906 initialiseConverter(); | 908 initialiseConverter(); |
909 | |
910 if (first && (m_stretchRatio != 1.f)) { | |
911 // couldn't create a stretcher before because we had no sample | |
912 // rate: make one now | |
913 setTimeStretch(m_stretchRatio); | |
914 } | |
907 } | 915 } |
908 | 916 |
909 void | 917 void |
910 AudioCallbackPlaySource::initialiseConverter() | 918 AudioCallbackPlaySource::initialiseConverter() |
911 { | 919 { |
1070 | 1078 |
1071 void | 1079 void |
1072 AudioCallbackPlaySource::setTimeStretch(float factor) | 1080 AudioCallbackPlaySource::setTimeStretch(float factor) |
1073 { | 1081 { |
1074 m_stretchRatio = factor; | 1082 m_stretchRatio = factor; |
1083 | |
1084 if (!getTargetSampleRate()) return; // have to make our stretcher later | |
1075 | 1085 |
1076 if (m_timeStretcher || (factor == 1.f)) { | 1086 if (m_timeStretcher || (factor == 1.f)) { |
1077 // stretch ratio will be set in next process call if appropriate | 1087 // stretch ratio will be set in next process call if appropriate |
1078 } else { | 1088 } else { |
1079 m_stretcherInputCount = getTargetChannelCount(); | 1089 m_stretcherInputCount = getTargetChannelCount(); |