mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-03 06:03:13 +02:00
1) When the program detects this, insert zeroes into the recording to keep the other good parts synchronized. 2) When recording stops, a message box alerts the user, and a label track is added showing the lost parts, labelled with consecutive numbers. 3) A menu item visible in alpha builds only is added to Tools, to simulate recording errors at random times and test the reporting feature.
48 lines
978 B
C++
48 lines
978 B
C++
/**********************************************************************
|
|
|
|
Audacity: A Digital Audio Editor
|
|
|
|
RingBuffer.h
|
|
|
|
Dominic Mazzoni
|
|
|
|
*******************************************************************/
|
|
|
|
#ifndef __AUDACITY_RING_BUFFER__
|
|
#define __AUDACITY_RING_BUFFER__
|
|
|
|
#include "SampleFormat.h"
|
|
|
|
class RingBuffer {
|
|
public:
|
|
RingBuffer(sampleFormat format, size_t size);
|
|
~RingBuffer();
|
|
|
|
//
|
|
// For the writer only:
|
|
//
|
|
|
|
size_t AvailForPut();
|
|
size_t Put(samplePtr buffer, sampleFormat format, size_t samples);
|
|
size_t Clear(sampleFormat format, size_t samples);
|
|
|
|
//
|
|
// For the reader only:
|
|
//
|
|
|
|
size_t AvailForGet();
|
|
size_t Get(samplePtr buffer, sampleFormat format, size_t samples);
|
|
size_t Discard(size_t samples);
|
|
|
|
private:
|
|
size_t Len();
|
|
|
|
sampleFormat mFormat;
|
|
size_t mStart { 0 };
|
|
size_t mEnd { 0 };
|
|
size_t mBufferSize;
|
|
SampleBuffer mBuffer;
|
|
};
|
|
|
|
#endif /* __AUDACITY_RING_BUFFER__ */
|