Mercurial > hg > svcore
comparison plugin/plugins/SamplePlayer.cpp @ 742:c10cb8782576 coreaudio_tests
Merge from branch "default"
author | Chris Cannam |
---|---|
date | Sun, 01 Jul 2012 11:53:00 +0100 |
parents | 1424aa29ae95 |
children | 2fa49f5caac5 e802e550a1f2 |
comparison
equal
deleted
inserted
replaced
666:4efa7429cd85 | 742:c10cb8782576 |
---|---|
18 */ | 18 */ |
19 | 19 |
20 #include "SamplePlayer.h" | 20 #include "SamplePlayer.h" |
21 #include "system/System.h" | 21 #include "system/System.h" |
22 | 22 |
23 #include <dssi.h> | 23 #include "../api/dssi.h" |
24 | |
24 #include <cmath> | 25 #include <cmath> |
25 #include <cstdlib> | 26 #include <cstdlib> |
26 | 27 |
27 #include <QMutexLocker> | 28 #include <QMutexLocker> |
28 #include <QDir> | 29 #include <QDir> |
149 | 150 |
150 LADSPA_Handle | 151 LADSPA_Handle |
151 SamplePlayer::instantiate(const LADSPA_Descriptor *, unsigned long rate) | 152 SamplePlayer::instantiate(const LADSPA_Descriptor *, unsigned long rate) |
152 { | 153 { |
153 if (!hostDescriptor || !hostDescriptor->request_non_rt_thread) { | 154 if (!hostDescriptor || !hostDescriptor->request_non_rt_thread) { |
154 std::cerr << "SamplePlayer::instantiate: Host does not provide request_non_rt_thread, not instantiating" << std::endl; | 155 SVDEBUG << "SamplePlayer::instantiate: Host does not provide request_non_rt_thread, not instantiating" << endl; |
155 return 0; | 156 return 0; |
156 } | 157 } |
157 | 158 |
158 SamplePlayer *player = new SamplePlayer(rate); | 159 SamplePlayer *player = new SamplePlayer(rate); |
159 | 160 |
160 if (hostDescriptor->request_non_rt_thread(player, workThreadCallback)) { | 161 if (hostDescriptor->request_non_rt_thread(player, workThreadCallback)) { |
161 std::cerr << "SamplePlayer::instantiate: Host rejected request_non_rt_thread call, not instantiating" << std::endl; | 162 SVDEBUG << "SamplePlayer::instantiate: Host rejected request_non_rt_thread call, not instantiating" << endl; |
162 delete player; | 163 delete player; |
163 return 0; | 164 return 0; |
164 } | 165 } |
165 | 166 |
166 return player; | 167 return player; |
318 SamplePlayer *player = (SamplePlayer *)handle; | 319 SamplePlayer *player = (SamplePlayer *)handle; |
319 | 320 |
320 if (player->m_pendingProgramChange >= 0) { | 321 if (player->m_pendingProgramChange >= 0) { |
321 | 322 |
322 #ifdef DEBUG_SAMPLE_PLAYER | 323 #ifdef DEBUG_SAMPLE_PLAYER |
323 std::cerr << "SamplePlayer::workThreadCallback: pending program change " << player->m_pendingProgramChange << std::endl; | 324 SVDEBUG << "SamplePlayer::workThreadCallback: pending program change " << player->m_pendingProgramChange << endl; |
324 #endif | 325 #endif |
325 | 326 |
326 player->m_mutex.lock(); | 327 player->m_mutex.lock(); |
327 | 328 |
328 int program = player->m_pendingProgramChange; | 329 int program = player->m_pendingProgramChange; |
361 if (m_sampleSearchComplete) return; | 362 if (m_sampleSearchComplete) return; |
362 | 363 |
363 m_samples.clear(); | 364 m_samples.clear(); |
364 | 365 |
365 #ifdef DEBUG_SAMPLE_PLAYER | 366 #ifdef DEBUG_SAMPLE_PLAYER |
366 std::cerr << "SamplePlayer::searchSamples: Directory is \"" | 367 SVDEBUG << "SamplePlayer::searchSamples: Directory is \"" |
367 << m_sampleDir.toLocal8Bit().data() << "\"" << std::endl; | 368 << m_sampleDir.toLocal8Bit().data() << "\"" << endl; |
368 #endif | 369 #endif |
369 | 370 |
370 QDir dir(m_sampleDir, "*.wav"); | 371 QDir dir(m_sampleDir, "*.wav"); |
371 | 372 |
372 for (unsigned int i = 0; i < dir.count(); ++i) { | 373 for (unsigned int i = 0; i < dir.count(); ++i) { |