From c5970f769fd5f614851db0d1fca73173419db497 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 6 Mar 2014 01:37:50 +0100 Subject: [PATCH] [DEV] first think on a basic audio player --- eaudiofx/base/GeneratorFile.cpp | 11 +++ eaudiofx/base/GeneratorFile.h | 24 +++++++ eaudiofx/base/GeneratorRtAudio.cpp | 11 +++ eaudiofx/base/GeneratorRtAudio.h | 24 +++++++ eaudiofx/base/ReceiverFile.cpp | 11 +++ eaudiofx/base/ReceiverFile.h | 24 +++++++ eaudiofx/base/ReceiverRtAudio.cpp | 11 +++ eaudiofx/base/ReceiverRtAudio.h | 25 +++++++ eaudiofx/core/Block.cpp | 11 +++ eaudiofx/core/Block.h | 63 ++++++++++++++++ eaudiofx/core/BlockDecoder.cpp | 11 +++ eaudiofx/core/BlockDecoder.h | 24 +++++++ eaudiofx/core/BlockEncoder.cpp | 11 +++ eaudiofx/core/BlockEncoder.h | 25 +++++++ eaudiofx/core/BlockFilter.cpp | 11 +++ eaudiofx/core/BlockFilter.h | 24 +++++++ eaudiofx/core/BlockGenerator.cpp | 11 +++ eaudiofx/core/BlockGenerator.h | 24 +++++++ eaudiofx/core/BlockReceiver.cpp | 11 +++ eaudiofx/core/BlockReceiver.h | 24 +++++++ eaudiofx/core/Buffer.cpp | 11 +++ eaudiofx/core/Buffer.h | 27 +++++++ eaudiofx/core/BufferAudio.cpp | 36 ++++++++++ eaudiofx/core/BufferAudio.h | 36 ++++++++++ eaudiofx/core/BufferAudioFreq.cpp | 11 +++ eaudiofx/core/BufferAudioFreq.h | 24 +++++++ eaudiofx/core/BufferAudioRaw.cpp | 11 +++ eaudiofx/core/BufferAudioRaw.h | 111 +++++++++++++++++++++++++++++ eaudiofx/core/BufferMessage.cpp | 11 +++ eaudiofx/core/BufferMessage.h | 86 ++++++++++++++++++++++ eaudiofx/core/BufferStream.cpp | 16 +++++ eaudiofx/core/BufferStream.h | 31 ++++++++ eaudiofx/core/Processing.cpp | 11 +++ eaudiofx/core/Processing.h | 25 +++++++ eaudiofx/core/audio.h | 99 +++++++++++++++++++++++++ eaudiofx/debug.cpp | 12 ++++ eaudiofx/debug.h | 28 ++++++++ lutin_eaudiofx.py | 52 ++++++++++++++ 38 files changed, 1029 insertions(+) create mode 100644 eaudiofx/base/GeneratorFile.cpp create mode 100644 eaudiofx/base/GeneratorFile.h create mode 100644 eaudiofx/base/GeneratorRtAudio.cpp create mode 100644 eaudiofx/base/GeneratorRtAudio.h create mode 100644 eaudiofx/base/ReceiverFile.cpp create mode 100644 eaudiofx/base/ReceiverFile.h create mode 100644 eaudiofx/base/ReceiverRtAudio.cpp create mode 100644 eaudiofx/base/ReceiverRtAudio.h create mode 100644 eaudiofx/core/Block.cpp create mode 100644 eaudiofx/core/Block.h create mode 100644 eaudiofx/core/BlockDecoder.cpp create mode 100644 eaudiofx/core/BlockDecoder.h create mode 100644 eaudiofx/core/BlockEncoder.cpp create mode 100644 eaudiofx/core/BlockEncoder.h create mode 100644 eaudiofx/core/BlockFilter.cpp create mode 100644 eaudiofx/core/BlockFilter.h create mode 100644 eaudiofx/core/BlockGenerator.cpp create mode 100644 eaudiofx/core/BlockGenerator.h create mode 100644 eaudiofx/core/BlockReceiver.cpp create mode 100644 eaudiofx/core/BlockReceiver.h create mode 100644 eaudiofx/core/Buffer.cpp create mode 100644 eaudiofx/core/Buffer.h create mode 100644 eaudiofx/core/BufferAudio.cpp create mode 100644 eaudiofx/core/BufferAudio.h create mode 100644 eaudiofx/core/BufferAudioFreq.cpp create mode 100644 eaudiofx/core/BufferAudioFreq.h create mode 100644 eaudiofx/core/BufferAudioRaw.cpp create mode 100644 eaudiofx/core/BufferAudioRaw.h create mode 100644 eaudiofx/core/BufferMessage.cpp create mode 100644 eaudiofx/core/BufferMessage.h create mode 100644 eaudiofx/core/BufferStream.cpp create mode 100644 eaudiofx/core/BufferStream.h create mode 100644 eaudiofx/core/Processing.cpp create mode 100644 eaudiofx/core/Processing.h create mode 100644 eaudiofx/core/audio.h create mode 100644 eaudiofx/debug.cpp create mode 100644 eaudiofx/debug.h create mode 100644 lutin_eaudiofx.py diff --git a/eaudiofx/base/GeneratorFile.cpp b/eaudiofx/base/GeneratorFile.cpp new file mode 100644 index 0000000..9cad170 --- /dev/null +++ b/eaudiofx/base/GeneratorFile.cpp @@ -0,0 +1,11 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include + + diff --git a/eaudiofx/base/GeneratorFile.h b/eaudiofx/base/GeneratorFile.h new file mode 100644 index 0000000..0d298e0 --- /dev/null +++ b/eaudiofx/base/GeneratorFile.h @@ -0,0 +1,24 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EAUDIOFX_GENERATOR_FILE_H__ +#define __EAUDIOFX_GENERATOR_FILE_H__ + +#include + +namespace eaudiofx { + class GeneratorFile : public eaudiofx::BlockGenerator { + public: + GeneratorFile(void) {}; + ~GeneratorFile(void) {}; + }; +}; + +#endif + + diff --git a/eaudiofx/base/GeneratorRtAudio.cpp b/eaudiofx/base/GeneratorRtAudio.cpp new file mode 100644 index 0000000..e9fcf91 --- /dev/null +++ b/eaudiofx/base/GeneratorRtAudio.cpp @@ -0,0 +1,11 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include + + diff --git a/eaudiofx/base/GeneratorRtAudio.h b/eaudiofx/base/GeneratorRtAudio.h new file mode 100644 index 0000000..1f5008f --- /dev/null +++ b/eaudiofx/base/GeneratorRtAudio.h @@ -0,0 +1,24 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EAUDIOFX_GENERATOR_RTAUDIO_H__ +#define __EAUDIOFX_GENERATOR_RTAUDIO_H__ + +#include + +namespace eaudiofx { + class GeneratorRtAudio : public eaudiofx::BlockGenerator { + public: + GeneratorRtAudio(void) {}; + ~GeneratorRtAudio(void) {}; + }; +}; + +#endif + + diff --git a/eaudiofx/base/ReceiverFile.cpp b/eaudiofx/base/ReceiverFile.cpp new file mode 100644 index 0000000..a7d07f5 --- /dev/null +++ b/eaudiofx/base/ReceiverFile.cpp @@ -0,0 +1,11 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include + + diff --git a/eaudiofx/base/ReceiverFile.h b/eaudiofx/base/ReceiverFile.h new file mode 100644 index 0000000..258e4c1 --- /dev/null +++ b/eaudiofx/base/ReceiverFile.h @@ -0,0 +1,24 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EAUDIOFX_RECEIVER_FILE_H__ +#define __EAUDIOFX_RECEIVER_FILE_H__ + +#include + +namespace eaudiofx { + class ReceiverFile : public eaudiofx::BlockReceiver { + public: + ReceiverFile(void) {}; + ~ReceiverFile(void) {}; + }; +}; + +#endif + + diff --git a/eaudiofx/base/ReceiverRtAudio.cpp b/eaudiofx/base/ReceiverRtAudio.cpp new file mode 100644 index 0000000..6a6df79 --- /dev/null +++ b/eaudiofx/base/ReceiverRtAudio.cpp @@ -0,0 +1,11 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include + + diff --git a/eaudiofx/base/ReceiverRtAudio.h b/eaudiofx/base/ReceiverRtAudio.h new file mode 100644 index 0000000..d6f4839 --- /dev/null +++ b/eaudiofx/base/ReceiverRtAudio.h @@ -0,0 +1,25 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EAUDIOFX_RECEIVER_RTAUDIO_H__ +#define __EAUDIOFX_RECEIVER_RTAUDIO_H__ + +#include + +namespace eaudiofx { + class ReceiverRtAudio : public eaudiofx::BlockReceiver { + public: + ReceiverRtAudio(void) {}; + ~ReceiverRtAudio(void) {}; + }; + +}; + +#endif + + diff --git a/eaudiofx/core/Block.cpp b/eaudiofx/core/Block.cpp new file mode 100644 index 0000000..f134fd1 --- /dev/null +++ b/eaudiofx/core/Block.cpp @@ -0,0 +1,11 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include + + diff --git a/eaudiofx/core/Block.h b/eaudiofx/core/Block.h new file mode 100644 index 0000000..e9e4b1c --- /dev/null +++ b/eaudiofx/core/Block.h @@ -0,0 +1,63 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EAUDIOFX_BLOCK_H__ +#define __EAUDIOFX_BLOCK_H__ + +#include +#include +#include + +namespace eaudiofx { + class Block { + public: + Block(void) {}; + ~Block(void) {}; + private: + std::string m_name; //!< name of the block + public: + /** + * @brief Set the block name + */ + void setName(const std::string& _name) { + m_name = _name; + } + /** + * @brief Set the block name + */ + const std::string& setName(void) { + return m_name; + } + protected: + // TODO : set properties ... + public: + /** + * @brief Set a property + */ + virtual void setProperty(const std::string& _name, const std::string& _property) {}; + /** + * @brief Get a property + */ + virtual std::string setProperty(const std::string& _name) { + return ""; + }; + public: + /** + * + */ + virtual int32_t push(int32_t _interface, eaudiofx::Buffer& _buffer, float _timeout) { }; + /** + * + */ + virtual int32_t pull(int32_t _interface, eaudiofx::Buffer& _buffer, float _timeout) { }; + }; +}; + +#endif + + diff --git a/eaudiofx/core/BlockDecoder.cpp b/eaudiofx/core/BlockDecoder.cpp new file mode 100644 index 0000000..189ba09 --- /dev/null +++ b/eaudiofx/core/BlockDecoder.cpp @@ -0,0 +1,11 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include + + diff --git a/eaudiofx/core/BlockDecoder.h b/eaudiofx/core/BlockDecoder.h new file mode 100644 index 0000000..5dd89dd --- /dev/null +++ b/eaudiofx/core/BlockDecoder.h @@ -0,0 +1,24 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EAUDIOFX_BLOCK_DECODER_H__ +#define __EAUDIOFX_BLOCK_DECODER_H__ + +#include + +namespace eaudiofx { + class BlockDecoder : public eaudiofx::Block { + public: + BlockDecoder(void) {}; + ~BlockDecoder(void) {}; + }; +}; + +#endif + + diff --git a/eaudiofx/core/BlockEncoder.cpp b/eaudiofx/core/BlockEncoder.cpp new file mode 100644 index 0000000..53c231b --- /dev/null +++ b/eaudiofx/core/BlockEncoder.cpp @@ -0,0 +1,11 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include + + diff --git a/eaudiofx/core/BlockEncoder.h b/eaudiofx/core/BlockEncoder.h new file mode 100644 index 0000000..b58d1e2 --- /dev/null +++ b/eaudiofx/core/BlockEncoder.h @@ -0,0 +1,25 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EAUDIOFX_BLOCK_ENCODER_H__ +#define __EAUDIOFX_BLOCK_ENCODER_H__ + +#include + +namespace eaudiofx { + class BlockEncoder : public eaudiofx::Block { + public: + BlockEncoder(void) {}; + ~BlockEncoder(void) {}; + }; + +}; + +#endif + + diff --git a/eaudiofx/core/BlockFilter.cpp b/eaudiofx/core/BlockFilter.cpp new file mode 100644 index 0000000..a70cc33 --- /dev/null +++ b/eaudiofx/core/BlockFilter.cpp @@ -0,0 +1,11 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include + + diff --git a/eaudiofx/core/BlockFilter.h b/eaudiofx/core/BlockFilter.h new file mode 100644 index 0000000..3e29cfc --- /dev/null +++ b/eaudiofx/core/BlockFilter.h @@ -0,0 +1,24 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EAUDIOFX_BLOCK_FILTER_H__ +#define __EAUDIOFX_BLOCK_FILTER_H__ + +#include + +namespace eaudiofx { + class BlockFilter : public eaudiofx::Block { + public: + BlockFilter(void) {}; + ~BlockFilter(void) {}; + }; +}; + +#endif + + diff --git a/eaudiofx/core/BlockGenerator.cpp b/eaudiofx/core/BlockGenerator.cpp new file mode 100644 index 0000000..534972d --- /dev/null +++ b/eaudiofx/core/BlockGenerator.cpp @@ -0,0 +1,11 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include + + diff --git a/eaudiofx/core/BlockGenerator.h b/eaudiofx/core/BlockGenerator.h new file mode 100644 index 0000000..e370264 --- /dev/null +++ b/eaudiofx/core/BlockGenerator.h @@ -0,0 +1,24 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EAUDIOFX_BLOCK_GENERATOR_H__ +#define __EAUDIOFX_BLOCK_GENERATOR_H__ + +#include + +namespace eaudiofx { + class BlockGenerator : public eaudiofx::Block { + public: + BlockGenerator(void) {}; + ~BlockGenerator(void) {}; + }; +}; + +#endif + + diff --git a/eaudiofx/core/BlockReceiver.cpp b/eaudiofx/core/BlockReceiver.cpp new file mode 100644 index 0000000..8c7c796 --- /dev/null +++ b/eaudiofx/core/BlockReceiver.cpp @@ -0,0 +1,11 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include + + diff --git a/eaudiofx/core/BlockReceiver.h b/eaudiofx/core/BlockReceiver.h new file mode 100644 index 0000000..7bcd373 --- /dev/null +++ b/eaudiofx/core/BlockReceiver.h @@ -0,0 +1,24 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EAUDIOFX_BLOCK_RECEIVER_H__ +#define __EAUDIOFX_BLOCK_RECEIVER_H__ + +#include + +namespace eaudiofx { + class BlockReceiver : public eaudiofx::Block { + public: + BlockReceiver(void) {}; + ~BlockReceiver(void) {}; + }; +}; + +#endif + + diff --git a/eaudiofx/core/Buffer.cpp b/eaudiofx/core/Buffer.cpp new file mode 100644 index 0000000..2e3d86f --- /dev/null +++ b/eaudiofx/core/Buffer.cpp @@ -0,0 +1,11 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include + + diff --git a/eaudiofx/core/Buffer.h b/eaudiofx/core/Buffer.h new file mode 100644 index 0000000..fc9e4a7 --- /dev/null +++ b/eaudiofx/core/Buffer.h @@ -0,0 +1,27 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EAUDIOFX_BUFFER_H__ +#define __EAUDIOFX_BUFFER_H__ + +#include + +namespace eaudiofx { + class Buffer { + public: + Buffer(void) {}; + ~Buffer(void) {}; + protected: + double m_timestamp; //!< current buffer time; + double m_time; //!< current buffer data time size; + }; +}; + +#endif + + diff --git a/eaudiofx/core/BufferAudio.cpp b/eaudiofx/core/BufferAudio.cpp new file mode 100644 index 0000000..f7b567f --- /dev/null +++ b/eaudiofx/core/BufferAudio.cpp @@ -0,0 +1,36 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include +#include + +eaudiofx::BufferAudio::BufferAudio(void) : + m_frequency(0), + m_nbChannel(0), + m_data(0), + m_allocated(0) { + memset(m_channelType, 0, sizeof(m_channelType)); +} + +eaudiofx::BufferAudio::~BufferAudio(void) { + if (m_data != NULL) { + delete[] m_data; + m_data = NULL; + } +} + +void eaudiofx::BufferAudio::resize(size_t _newSizeByte) { + if (m_data != NULL) { + delete[] m_data; + m_data = NULL; + } + m_data = new uint8_t[_newSizeByte]; + if (m_data == NULL) { + EAUDIOFX_ERROR("Can not allocate Buffer Audio"); + } +} \ No newline at end of file diff --git a/eaudiofx/core/BufferAudio.h b/eaudiofx/core/BufferAudio.h new file mode 100644 index 0000000..11220b2 --- /dev/null +++ b/eaudiofx/core/BufferAudio.h @@ -0,0 +1,36 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EAUDIOFX_BUFFER_AUDIO_H__ +#define __EAUDIOFX_BUFFER_AUDIO_H__ + +#include + +namespace eaudiofx { + class BufferAudio : public eaudiofx::Buffer { + public: + BufferAudio(void); + ~BufferAudio(void); + protected: + int32_t m_frequency; + int32_t m_nbChannel; + enum channelPosition m_channelType[MAX_NUMBER_OF_SIMULTANEOUS_CHANNEL]; + protected: + uint8_t* m_data; //!< pointer on the data. + size_t m_allocated; //!< number of byte allocated + protected: + /** + * @brief Reallocate the Buffer data. + */ + virtual void resize(size_t _newSizeByte); + }; +}; + +#endif + + diff --git a/eaudiofx/core/BufferAudioFreq.cpp b/eaudiofx/core/BufferAudioFreq.cpp new file mode 100644 index 0000000..c2d0842 --- /dev/null +++ b/eaudiofx/core/BufferAudioFreq.cpp @@ -0,0 +1,11 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include + + diff --git a/eaudiofx/core/BufferAudioFreq.h b/eaudiofx/core/BufferAudioFreq.h new file mode 100644 index 0000000..c4e9e63 --- /dev/null +++ b/eaudiofx/core/BufferAudioFreq.h @@ -0,0 +1,24 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EAUDIOFX_BUFFER_AUDIO_FREQ_H__ +#define __EAUDIOFX_BUFFER_AUDIO_FREQ_H__ + +#include + +namespace eaudiofx { + class BufferAudioFreq : public eaudiofx::BufferAudio { + public: + BufferAudioFreq(void) {}; + ~BufferAudioFreq(void) {}; + }; +}; + +#endif + + diff --git a/eaudiofx/core/BufferAudioRaw.cpp b/eaudiofx/core/BufferAudioRaw.cpp new file mode 100644 index 0000000..ae06593 --- /dev/null +++ b/eaudiofx/core/BufferAudioRaw.cpp @@ -0,0 +1,11 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include + + diff --git a/eaudiofx/core/BufferAudioRaw.h b/eaudiofx/core/BufferAudioRaw.h new file mode 100644 index 0000000..09a09bc --- /dev/null +++ b/eaudiofx/core/BufferAudioRaw.h @@ -0,0 +1,111 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EAUDIOFX_BUFFER_AUDIO_RAW_H__ +#define __EAUDIOFX_BUFFER_AUDIO_RAW_H__ + +#include + +namespace eaudiofx { + class BufferAudioRaw : public eaudiofx::BufferAudio { + public: + BufferAudioRaw(void) {}; + ~BufferAudioRaw(void) {}; + protected: + size_t m_allocatedSample; //!< generate with m_allocatedBytes/sizeof(**m_audioFormat**) / m_nbChannel; + protected: + size_t m_size; //!< number of sample for each channels provided in this buffer ... (write by the upstream (can be 0)) + protected: + size_t m_sizeRequested; //!< in pull mode, number of sample for each channels requested by the next Filter + protected: + enum audioRawFormat m_audioFormat; + public: + /** + * @brief Get the buffer casted in void* + * @return Pointer on the buffer with correct cast. + */ + void* getDataVoid(void) { + return (void*)m_data; + } + /** + * @brief Get the buffer casted in int8_t* + * @return Pointer on the buffer with correct cast. + */ + int8_t* getDataI8(void) { + return (int8_t*)m_data; + } + /** + * @brief Get the buffer casted in int16_t* + * @return Pointer on the buffer with correct cast. + */ + int16_t* getDataI16(void) { + return (int16_t*)m_data; + } + /** + * @brief Get the buffer casted in int32_t* + * @return Pointer on the buffer with correct cast. + */ + int32_t* getDataI32(void) { + return (int32_t*)m_data; + } + /** + * @brief Get the buffer casted in int64_t* + * @return Pointer on the buffer with correct cast. + */ + int64_t* getDataI64(void) { + return (int64_t*)m_data; + } + /** + * @brief Get the buffer casted in uint8_t* + * @return Pointer on the buffer with correct cast. + */ + uint8_t* getDataU8(void) { + return (uint8_t*)m_data; + } + /** + * @brief Get the buffer casted in uint16_t* + * @return Pointer on the buffer with correct cast. + */ + uint16_t* getDataU16(void) { + return (uint16_t*)m_data; + } + /** + * @brief Get the buffer casted in uint32_t* + * @return Pointer on the buffer with correct cast. + */ + uint32_t* getDataU32(void) { + return (uint32_t*)m_data; + } + /** + * @brief Get the buffer casted in uint64_t* + * @return Pointer on the buffer with correct cast. + */ + uint64_t* getDataU64(void) { + return (uint64_t*)m_data; + } + + /** + * @brief Get the buffer casted in float* + * @return Pointer on the buffer with correct cast. + */ + float* getDataF(void) { + return (float*)m_data; + } + /** + * @brief Get the buffer casted in double* + * @return Pointer on the buffer with correct cast. + */ + double* getDataD(void) { + return (double*)m_data; + } + }; +}; + +#endif + + diff --git a/eaudiofx/core/BufferMessage.cpp b/eaudiofx/core/BufferMessage.cpp new file mode 100644 index 0000000..e07a8fa --- /dev/null +++ b/eaudiofx/core/BufferMessage.cpp @@ -0,0 +1,11 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include + + diff --git a/eaudiofx/core/BufferMessage.h b/eaudiofx/core/BufferMessage.h new file mode 100644 index 0000000..4a4e2ab --- /dev/null +++ b/eaudiofx/core/BufferMessage.h @@ -0,0 +1,86 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EAUDIOFX_BUFFER_MESSAGE_H__ +#define __EAUDIOFX_BUFFER_MESSAGE_H__ + +#include + +namespace eaudiofx { + enum { + bufferMessageEndOfStream = 0x00000001, + bufferMessageFlush = 0x00000002, + bufferMessageReset = 0x00000004, + bufferMessageQuery = 0x00000008, + bufferMessageQualityOfService = 0x00000010 + }; + class BufferMessage : public eaudiofx::Buffer { + public: + BufferMessage(int32_t _message = bufferMessageEndOfStream) {}; + ~BufferMessage(void) {}; + protected: + int32_t m_messageId; //!< message ID + public: + /** + * @brief Get the message. + * @return The ID of the message (if value is < 0 : custom message ...) + */ + int32_t getMessage(void) { + return m_messageId; + } + /** + * @brief Set the message. + * @param[in] _message The ID of the message (if value is < 0 : custom message ...) + */ + int32_t getMessage(int32_t _messageId) { + m_messageId = _messageId; + } + private: + std::string m_query; + public: + /** + * @brief get the query complete message + * @return The requested data + */ + const std::string& getQuery(void) { + return m_query; + } + /** + * @brief get the query complete message + * @return The requested data + */ + void setQuery(const std::string& _answer) { + m_query = _answer; + // reset query: + if (m_answer.size() != 0) { + m_answer = ""; + } + } + private: + std::string m_answer; + public: + /** + * @brief get the answer of the query + * @return The requested data + */ + const std::string& getAnswer(void) { + return m_answer; + } + /** + * @brief get the answer of the query + * @return The requested data + */ + void setAnswer(const std::string& _answer) { + m_answer = _answer; + } + }; +}; + +#endif + + diff --git a/eaudiofx/core/BufferStream.cpp b/eaudiofx/core/BufferStream.cpp new file mode 100644 index 0000000..3ee38e7 --- /dev/null +++ b/eaudiofx/core/BufferStream.cpp @@ -0,0 +1,16 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include + +eaudiofx::BufferStream::BufferStream(void) { + +} +eaudiofx::BufferStream::~BufferStream(void) { + +} \ No newline at end of file diff --git a/eaudiofx/core/BufferStream.h b/eaudiofx/core/BufferStream.h new file mode 100644 index 0000000..d5cf3ff --- /dev/null +++ b/eaudiofx/core/BufferStream.h @@ -0,0 +1,31 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EAUDIOFX_BUFFER_STREAM_H__ +#define __EAUDIOFX_BUFFER_STREAM_H__ + +#include + +namespace eaudiofx { + class BufferStream : public eaudiofx::Buffer { + public: + BufferStream(void); + ~BufferStream(void); + protected: + void* m_data; //!< buffer data + size_t m_allocated; //!< number of byte allocated + protected: + size_t m_size; //!< number of byte provided in this buffer ... (write by the upstream (can be 0)) + protected: + size_t m_sizeRequested; //!< in pull mode, number of byte requested by the next Filter + }; +}; + +#endif + + diff --git a/eaudiofx/core/Processing.cpp b/eaudiofx/core/Processing.cpp new file mode 100644 index 0000000..4cfa46c --- /dev/null +++ b/eaudiofx/core/Processing.cpp @@ -0,0 +1,11 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include + + diff --git a/eaudiofx/core/Processing.h b/eaudiofx/core/Processing.h new file mode 100644 index 0000000..bfa11a5 --- /dev/null +++ b/eaudiofx/core/Processing.h @@ -0,0 +1,25 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EAUDIOFX_PROCESSING_H__ +#define __EAUDIOFX_PROCESSING_H__ + +#include +#include + +namespace eaudiofx { + class Processing { + public: + Processing(void) {}; + ~Processing(void) {}; + }; +}; + +#endif + + diff --git a/eaudiofx/core/audio.h b/eaudiofx/core/audio.h new file mode 100644 index 0000000..5c5a04e --- /dev/null +++ b/eaudiofx/core/audio.h @@ -0,0 +1,99 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2014, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EAUDIOFX_AUDIO_H__ +#define __EAUDIOFX_AUDIO_H__ + + +#include + +#include +#include +#include +#include +#include + +// defien type : uintXX_t and intXX_t +#ifndef __STDC_LIMIT_MACROS + #define __STDC_LIMIT_MACROS +#endif +// note in android include the macro of min max are overwitten +#include + +namespace eaudiofx { + enum channelPosition { + // From channels + channelPositionFrontCenter = 0x10, + channelPositionFrontLeft = 0x11, + channelPositionFrontRight = 0x12, + channelPositionFrontTopCenter = 0x14, + channelPositionFrontTopLeft = 0x15, + channelPositionFrontTopRight = 0x16, + channelPositionFrontBottomCenter = 0x18, + channelPositionFrontBottomLeft = 0x19, + channelPositionFrontBottomRight = 0x1A, + // Side channels + channelPositionSideLeft = 0x21, + channelPositionSideRight = 0x22, + channelPositionSideTopLeft = 0x25, + channelPositionSideTopRight = 0x26, + channelPositionSideBottomLeft = 0x29, + channelPositionSideBottomRight = 0x2A, + // Back/rear channels + channelPositionRearCenter = 0x40, + channelPositionRearLeft = 0x41, + channelPositionRearRight = 0x42, + channelPositionRearTopCenter = 0x44, + channelPositionRearTopLeft = 0x45, + channelPositionRearTopRight = 0x56, + channelPositionRearBottomCenter = 0x48, + channelPositionRearBottomLeft = 0x49, + channelPositionRearBottomRight = 0x4A, + // Other special channels + channelPositionSubwoofer = 0x80 + }; + #define MAX_NUMBER_OF_SIMULTANEOUS_CHANNEL (8) + #define CHANNEL_3D_MASK 0xF0 + #define CHANNEL_3D_FRONT 0x10 + #define CHANNEL_3D_SIDE 0x20 + #define CHANNEL_3D_REAR 0x40 + #define CHANNEL_3D_OTHER 0x80 + + #define CHANNEL_POS_MASK 0x03 + #define CHANNEL_POS_CENTER 0x00 + #define CHANNEL_POS_LEFT 0x01 + #define CHANNEL_POS_RIGHT 0x02 + + #define CHANNEL_HEIGHT_MASK 0x0B + #define CHANNEL_HEIGHT_MEDIUM 0x00 + #define CHANNEL_HEIGHT_TOP 0x04 + #define CHANNEL_HEIGHT_BOTTOM 0x08 + + enum audioRawFormat { + // fix-point mode + audioRawFormatS8, + audioRawFormatS16, + audioRawFormatS32, + audioRawFormatS64, + audioRawFormatU8, + audioRawFormatU16, + audioRawFormatU32, + audioRawFormatU64, + // float mode + audioRawFormatFloat, + audioRawFormatDouble + }; + + + + + + +}; + +#endif diff --git a/eaudiofx/debug.cpp b/eaudiofx/debug.cpp new file mode 100644 index 0000000..124a4c2 --- /dev/null +++ b/eaudiofx/debug.cpp @@ -0,0 +1,12 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include + +const char * eaudiofxLibName = "eaudiofx "; + diff --git a/eaudiofx/debug.h b/eaudiofx/debug.h new file mode 100644 index 0000000..66d40d1 --- /dev/null +++ b/eaudiofx/debug.h @@ -0,0 +1,28 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EAUDIOFX_DEBUG_H__ +#define __EAUDIOFX_DEBUG_H__ + +#include +#include + +extern const char * eaudiofxLibName; + +#define EAUDIOFX_CRITICAL(data) ETK_CRITICAL(eaudiofxLibName, data) +#define EAUDIOFX_WARNING(data) ETK_WARNING(eaudiofxLibName, data) +#define EAUDIOFX_ERROR(data) ETK_ERROR(eaudiofxLibName, data) +#define EAUDIOFX_INFO(data) ETK_INFO(eaudiofxLibName, data) +#define EAUDIOFX_DEBUG(data) ETK_DEBUG(eaudiofxLibName, data) +#define EAUDIOFX_VERBOSE(data) ETK_VERBOSE(eaudiofxLibName, data) +#define EAUDIOFX_ASSERT(cond,data) ETK_ASSERT(eaudiofxLibName, cond, data) +#define EAUDIOFX_CHECK_INOUT(cond) ETK_CHECK_INOUT(eaudiofxLibName, cond) +#define EAUDIOFX_TODO(cond) ETK_TODO(eaudiofxLibName, cond) + +#endif + diff --git a/lutin_eaudiofx.py b/lutin_eaudiofx.py new file mode 100644 index 0000000..f438d7a --- /dev/null +++ b/lutin_eaudiofx.py @@ -0,0 +1,52 @@ +#!/usr/bin/python +import lutinModule as module +import lutinTools as tools +import lutinDebug as debug + +def get_desc(): + return "eaudiofx : Audio interface FX system" + + +def create(target): + myModule = module.Module(__file__, 'eaudiofx', 'LIBRARY') + # System core + myModule.add_src_file([ + 'eaudiofx/debug.cpp', + 'eaudiofx/core/Processing.cpp', + 'eaudiofx/core/Block.cpp', + 'eaudiofx/core/BlockGenerator.cpp', + 'eaudiofx/core/BlockReceiver.cpp', + 'eaudiofx/core/BlockFilter.cpp', + 'eaudiofx/core/BlockEncoder.cpp', + 'eaudiofx/core/BlockDecoder.cpp', + 'eaudiofx/core/Buffer.cpp', + 'eaudiofx/core/BufferMessage.cpp', + 'eaudiofx/core/BufferStream.cpp', + 'eaudiofx/core/BufferAudio.cpp', + 'eaudiofx/core/BufferAudioFreq.cpp', + 'eaudiofx/core/BufferAudioRaw.cpp' + ]) + # basic nodes: + myModule.add_src_file([ + 'eaudiofx/base/GeneratorFile.cpp', + 'eaudiofx/base/ReceiverFile.cpp', + 'eaudiofx/base/GeneratorRtAudio.cpp', + 'eaudiofx/base/ReceiverRtAudio.cpp' + ]) + + # name of the dependency + myModule.add_module_depend(['etk', 'rtaudio']) + + myModule.add_export_path(tools.get_current_path(__file__)) + + # add the currrent module at the + return myModule + + + + + + + + +