Mercurial > hg > svapp
comparison audioio/AudioPulseAudioTarget.cpp @ 192:2b1869fccec1
* Avoid setting zero latency on source
author | Chris Cannam |
---|---|
date | Tue, 22 Jun 2010 09:45:19 +0000 |
parents | 3bd87e04f060 |
children | 0b3aa9b702bb |
comparison
equal
deleted
inserted
replaced
191:3bd87e04f060 | 192:2b1869fccec1 |
---|---|
161 if (m_source->getTargetPlayLatency() == 0) { //!!! need better test | 161 if (m_source->getTargetPlayLatency() == 0) { //!!! need better test |
162 //!!! | 162 //!!! |
163 pa_usec_t latency = 0; | 163 pa_usec_t latency = 0; |
164 int negative = 0; | 164 int negative = 0; |
165 if (pa_stream_get_latency(m_stream, &latency, &negative)) { | 165 if (pa_stream_get_latency(m_stream, &latency, &negative)) { |
166 std::cerr << "AudioPulseAudioTarget::contextStateChanged: Failed to query latency" << std::endl; | 166 std::cerr << "AudioPulseAudioTarget::streamWrite: Failed to query latency" << std::endl; |
167 } | 167 } |
168 // std::cerr << "Latency = " << latency << " usec" << std::endl; | 168 // std::cerr << "Latency = " << latency << " usec" << std::endl; |
169 int latframes = (latency / 1000000.f) * float(m_sampleRate); | 169 int latframes = (latency / 1000000.f) * float(m_sampleRate); |
170 // std::cerr << "that's " << latframes << " frames" << std::endl; | 170 // std::cerr << "that's " << latframes << " frames" << std::endl; |
171 m_source->setTargetPlayLatency(latframes); //!!! buh | 171 if (latframes > 0) { |
172 m_source->setTargetPlayLatency(latframes); //!!! buh | |
173 } | |
172 } | 174 } |
173 | 175 |
174 static float *output = 0; | 176 static float *output = 0; |
175 static float **tmpbuf = 0; | 177 static float **tmpbuf = 0; |
176 static size_t tmpbufch = 0; | 178 static size_t tmpbufch = 0; |