@@ -49,7 +49,7 @@ void OSAudio::addBuffer(HulaRingBuffer *rb)
4949 */
5050void OSAudio::startRecord ()
5151{
52- hlDebug () << " Start record called" << std::endl;
52+ hlDebug () << " OSAudio: Start record called. " << std::endl;
5353
5454 // Prevent other state changes
5555 this ->stateSem .wait ();
@@ -61,6 +61,7 @@ void OSAudio::startRecord()
6161 }
6262 else
6363 {
64+ hlDebug () << " OSAudio: Start record fell through." << std::endl;
6465 this ->stateSem .notify ();
6566 }
6667}
@@ -110,7 +111,7 @@ void OSAudio::removeBuffer(HulaRingBuffer *rb)
110111 */
111112void OSAudio::endRecord ()
112113{
113- hlDebug () << " End record called" << std::endl;
114+ hlDebug () << " OSAudio: End record called. " << std::endl;
114115
115116 this ->stateSem .wait ();
116117
@@ -281,6 +282,9 @@ void OSAudio::backgroundPlayback()
281282 */
282283void OSAudio::startPlayback ()
283284{
285+ hlDebug () << " OSAudio: Start playback called." << std::endl;
286+
287+
284288 this ->stateSem .wait ();
285289
286290 if (this ->endPlay .load () && this ->endCapture .load ())
@@ -291,6 +295,7 @@ void OSAudio::startPlayback()
291295 }
292296 else
293297 {
298+ hlDebug () << " OSAudio: Start playback fell through." << std::endl;
294299 this ->stateSem .notify ();
295300 }
296301}
@@ -319,6 +324,8 @@ ring_buffer_size_t OSAudio::playbackCopyToBuffers(const float *samples, ring_buf
319324 */
320325void OSAudio::endPlayback ()
321326{
327+ hlDebug () << " OSAudio: End playback called." << std::endl;
328+
322329 this ->stateSem .wait ();
323330
324331 this ->endPlay .store (true );
@@ -377,9 +384,9 @@ static int paPlayCallback(const void *inputBuffer, void *outputBuffer,
377384 {
378385 hlDebug () << " Playback: Ring buffer underrun. Received " << samplesRead << " of " << elementsToRead << std::endl;
379386 hlDebug () << " Writing " << elementsToRead - samplesRead << " samples of silence." << std::endl;
380- for (int i = 0 ; i < elementsToRead; i++)
387+ for (int i = samplesRead ; i < elementsToRead; i++)
381388 {
382- wptr[i + size1 + size2 ] = 0 ;
389+ wptr[i] = 0 ;
383390 }
384391 }
385392
0 commit comments