28 #ifndef AUDIO_DEBUGGER_INCLUDED
29 #define AUDIO_DEBUGGER_INCLUDED
126 : name(
"AudioDebugger"), sample_count(0)
128 gettimeofday(&start_time, 0);
134 src->unregisterSink();
150 void setName(std::string debug_name) { name = debug_name; }
168 struct timeval time, diff;
169 gettimeofday(&time, 0);
171 timersub(&time, &start_time, &diff);
172 uint64_t diff_ms = diff.tv_sec * 1000 + diff.tv_usec / 1000;
174 std::cout << name <<
"::writeSamples: count=" << count
175 <<
" ret=" << ret <<
" sample_rate=";
178 std::cout << sample_count * 1000 / diff_ms << std::endl;
182 std::cout <<
"inf\n";
197 std::cout << name <<
"::flushSamples\n";
210 std::cout << name <<
"::resumeOutput\n";
223 std::cout << name <<
"::allSamplesFlushed\n";
231 struct timeval start_time;
232 uint64_t sample_count;
AudioSink * sink(void) const
Get the registered audio sink.
void sinkFlushSamples(void)
void setName(std::string debug_name)
Set the name that is displayed before debug messages.
virtual void flushSamples(void)
Tell the sink to flush the previously written samples.
This file contains the base class for an audio source.
virtual int writeSamples(const float *samples, int count)
Write samples into this audio sink.
bool registerSink(AudioSink *sink, bool managed=false)
Register an audio sink to provide samples to.
This file contains the base class for an audio sink.
int sinkWriteSamples(const float *samples, int len)
The base class for an audio sink.
bool registerSource(AudioSource *source)
Register an audio source to provide samples to this sink.
void sourceResumeOutput(void)
Tell the source that we are ready to accept more samples.
void sourceAllSamplesFlushed(void)
Tell the source that all samples have been flushed.
The base class for an audio source.
AudioDebugger(Async::AudioSource *src=0)
Default constuctor.
virtual void resumeOutput(void)
Resume audio output to the sink.
virtual void allSamplesFlushed(void)
The registered sink has flushed all samples.
This class is used to debug an audio stream.
virtual ~AudioDebugger(void)
Destructor.