1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
/***************************************************************************
StreamWriter.h - adapter between writers and sample source
-------------------
begin : Sun Aug 23 2009
copyright : (C) 2009 by Thomas Eschenbacher
email : Thomas Eschenbacher <thomas.eschenbacher@gmx.de>
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef STREAM_WRITER_H
#define STREAM_WRITER_H
#include "config.h"
#include "libkwave_export.h"
#include <QtGlobal>
#include <QObject>
#include "libkwave/Writer.h"
namespace Kwave
{
class SampleArray;
class Track;
/**
* @class StreamWriter
* Input stream for transferring samples into a Track.
*
* @warning THIS CLASS IS NOT THREADSAFE! It is intended to be owned by
* and used from only one thread.
*/
class LIBKWAVE_EXPORT StreamWriter: public Kwave::Writer
{
Q_OBJECT
public:
/**
* Constructor
*/
StreamWriter();
/**
* Destructor.
*/
~StreamWriter() override;
/**
* Flush the content of a buffer. Normally the buffer is the
* internal intermediate buffer used for single-sample writes.
* When using block transfers, the internal buffer is bypassed
* and the written block is passed instead.
* @internal
* @param buffer reference to the buffer to be flushed
* @param count number of samples in the buffer to be flushed,
* will be internally set to zero if successful
* @return true if successful, false if failed (e.g. out of memory)
*/
virtual bool write(const Kwave::SampleArray &buffer,
unsigned int &count) override;
signals:
/** emits a block with sine wave data */
void output(Kwave::SampleArray data);
};
}
#endif /* STREAM_WRITER_H */
//***************************************************************************
//***************************************************************************
|