Mercurial > hg > svapp
comparison audio/AudioCallbackPlaySource.cpp @ 644:6fd0ebfd2bbe
Merge from branch fix-static-analysis
author | Chris Cannam |
---|---|
date | Wed, 09 Jan 2019 15:25:09 +0000 |
parents | e2715204feaa |
children | a82b9d410393 |
comparison
equal
deleted
inserted
replaced
643:713b9a6b284a | 644:6fd0ebfd2bbe |
---|---|
48 AudioCallbackPlaySource::AudioCallbackPlaySource(ViewManagerBase *manager, | 48 AudioCallbackPlaySource::AudioCallbackPlaySource(ViewManagerBase *manager, |
49 QString clientName) : | 49 QString clientName) : |
50 m_viewManager(manager), | 50 m_viewManager(manager), |
51 m_audioGenerator(new AudioGenerator()), | 51 m_audioGenerator(new AudioGenerator()), |
52 m_clientName(clientName.toUtf8().data()), | 52 m_clientName(clientName.toUtf8().data()), |
53 m_readBuffers(0), | 53 m_readBuffers(nullptr), |
54 m_writeBuffers(0), | 54 m_writeBuffers(nullptr), |
55 m_readBufferFill(0), | 55 m_readBufferFill(0), |
56 m_writeBufferFill(0), | 56 m_writeBufferFill(0), |
57 m_bufferScavenger(1), | 57 m_bufferScavenger(1), |
58 m_sourceChannelCount(0), | 58 m_sourceChannelCount(0), |
59 m_blockSize(1024), | 59 m_blockSize(1024), |
60 m_sourceSampleRate(0), | 60 m_sourceSampleRate(0), |
61 m_deviceSampleRate(0), | 61 m_deviceSampleRate(0), |
62 m_deviceChannelCount(0), | 62 m_deviceChannelCount(0), |
63 m_playLatency(0), | 63 m_playLatency(0), |
64 m_target(0), | 64 m_target(nullptr), |
65 m_lastRetrievalTimestamp(0.0), | 65 m_lastRetrievalTimestamp(0.0), |
66 m_lastRetrievedBlockSize(0), | 66 m_lastRetrievedBlockSize(0), |
67 m_trustworthyTimestamps(true), | 67 m_trustworthyTimestamps(true), |
68 m_lastCurrentFrame(0), | 68 m_lastCurrentFrame(0), |
69 m_playing(false), | 69 m_playing(false), |
71 m_lastModelEndFrame(0), | 71 m_lastModelEndFrame(0), |
72 m_ringBufferSize(DEFAULT_RING_BUFFER_SIZE), | 72 m_ringBufferSize(DEFAULT_RING_BUFFER_SIZE), |
73 m_outputLeft(0.0), | 73 m_outputLeft(0.0), |
74 m_outputRight(0.0), | 74 m_outputRight(0.0), |
75 m_levelsSet(false), | 75 m_levelsSet(false), |
76 m_auditioningPlugin(0), | 76 m_auditioningPlugin(nullptr), |
77 m_auditioningPluginBypassed(false), | 77 m_auditioningPluginBypassed(false), |
78 m_playStartFrame(0), | 78 m_playStartFrame(0), |
79 m_playStartFramePassed(false), | 79 m_playStartFramePassed(false), |
80 m_timeStretcher(0), | 80 m_timeStretcher(nullptr), |
81 m_monoStretcher(0), | 81 m_monoStretcher(nullptr), |
82 m_stretchRatio(1.0), | 82 m_stretchRatio(1.0), |
83 m_stretchMono(false), | 83 m_stretchMono(false), |
84 m_stretcherInputCount(0), | 84 m_stretcherInputCount(0), |
85 m_stretcherInputs(0), | 85 m_stretcherInputs(nullptr), |
86 m_stretcherInputSizes(0), | 86 m_stretcherInputSizes(nullptr), |
87 m_fillThread(0), | 87 m_fillThread(nullptr), |
88 m_resamplerWrapper(0) | 88 m_resamplerWrapper(nullptr) |
89 { | 89 { |
90 m_viewManager->setAudioPlaySource(this); | 90 m_viewManager->setAudioPlaySource(this); |
91 | 91 |
92 connect(m_viewManager, SIGNAL(selectionChanged()), | 92 connect(m_viewManager, SIGNAL(selectionChanged()), |
93 this, SLOT(selectionChanged())); | 93 this, SLOT(selectionChanged())); |
256 m_resamplerWrapper->reset(); | 256 m_resamplerWrapper->reset(); |
257 } | 257 } |
258 | 258 |
259 delete m_timeStretcher; | 259 delete m_timeStretcher; |
260 delete m_monoStretcher; | 260 delete m_monoStretcher; |
261 m_timeStretcher = 0; | 261 m_timeStretcher = nullptr; |
262 m_monoStretcher = 0; | 262 m_monoStretcher = nullptr; |
263 | 263 |
264 if (m_stretchRatio != 1.f) { | 264 if (m_stretchRatio != 1.f) { |
265 setTimeStretch(m_stretchRatio); | 265 setTimeStretch(m_stretchRatio); |
266 } | 266 } |
267 } | 267 } |
610 } | 610 } |
611 | 611 |
612 void | 612 void |
613 AudioCallbackPlaySource::setSystemPlaybackTarget(breakfastquay::SystemPlaybackTarget *target) | 613 AudioCallbackPlaySource::setSystemPlaybackTarget(breakfastquay::SystemPlaybackTarget *target) |
614 { | 614 { |
615 if (target == 0) { | 615 if (target == nullptr) { |
616 // reset target-related facts and figures | 616 // reset target-related facts and figures |
617 m_deviceSampleRate = 0; | 617 m_deviceSampleRate = 0; |
618 m_deviceChannelCount = 0; | 618 m_deviceChannelCount = 0; |
619 } | 619 } |
620 m_target = target; | 620 m_target = target; |
1398 | 1398 |
1399 // Called from fill thread, m_playing true, mutex held | 1399 // Called from fill thread, m_playing true, mutex held |
1400 bool | 1400 bool |
1401 AudioCallbackPlaySource::fillBuffers() | 1401 AudioCallbackPlaySource::fillBuffers() |
1402 { | 1402 { |
1403 static float *tmp = 0; | 1403 static float *tmp = nullptr; |
1404 static sv_frame_t tmpSize = 0; | 1404 static sv_frame_t tmpSize = 0; |
1405 | 1405 |
1406 sv_frame_t space = 0; | 1406 sv_frame_t space = 0; |
1407 for (int c = 0; c < getTargetChannelCount(); ++c) { | 1407 for (int c = 0; c < getTargetChannelCount(); ++c) { |
1408 RingBuffer<float> *wb = getWriteRingBuffer(c); | 1408 RingBuffer<float> *wb = getWriteRingBuffer(c); |
1437 cout << "buffered to " << f << " already" << endl; | 1437 cout << "buffered to " << f << " already" << endl; |
1438 #endif | 1438 #endif |
1439 | 1439 |
1440 int channels = getTargetChannelCount(); | 1440 int channels = getTargetChannelCount(); |
1441 | 1441 |
1442 static float **bufferPtrs = 0; | 1442 static float **bufferPtrs = nullptr; |
1443 static int bufferPtrCount = 0; | 1443 static int bufferPtrCount = 0; |
1444 | 1444 |
1445 if (bufferPtrCount < channels) { | 1445 if (bufferPtrCount < channels) { |
1446 if (bufferPtrs) delete[] bufferPtrs; | 1446 if (bufferPtrs) delete[] bufferPtrs; |
1447 bufferPtrs = new float *[channels]; | 1447 bufferPtrs = new float *[channels]; |
1537 << endl; | 1537 << endl; |
1538 } | 1538 } |
1539 } | 1539 } |
1540 #endif | 1540 #endif |
1541 | 1541 |
1542 static float **chunkBufferPtrs = 0; | 1542 static float **chunkBufferPtrs = nullptr; |
1543 static int chunkBufferPtrCount = 0; | 1543 static int chunkBufferPtrCount = 0; |
1544 | 1544 |
1545 if (chunkBufferPtrCount < channels) { | 1545 if (chunkBufferPtrCount < channels) { |
1546 if (chunkBufferPtrs) delete[] chunkBufferPtrs; | 1546 if (chunkBufferPtrs) delete[] chunkBufferPtrs; |
1547 chunkBufferPtrs = new float *[channels]; | 1547 chunkBufferPtrs = new float *[channels]; |