2015-04-10 23:00:13 +02:00
|
|
|
/** @file
|
|
|
|
* @author Edouard DUPIN
|
|
|
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
2017-01-05 21:28:23 +01:00
|
|
|
* @license MPL v2.0 (see license file)
|
2015-04-10 23:00:13 +02:00
|
|
|
*/
|
2016-02-02 21:18:54 +01:00
|
|
|
#pragma once
|
2015-04-10 23:00:13 +02:00
|
|
|
|
2016-10-02 21:41:55 +02:00
|
|
|
#include <audio/drain/EndPoint.hpp>
|
2017-09-14 00:59:21 +02:00
|
|
|
#include <etk/Function.hpp>
|
2015-04-10 23:00:13 +02:00
|
|
|
|
|
|
|
namespace audio {
|
|
|
|
namespace drain {
|
2017-09-07 23:38:26 +02:00
|
|
|
typedef etk::Function<void (void* _data,
|
2015-04-13 21:49:48 +02:00
|
|
|
const audio::Time& _playTime,
|
2015-04-10 23:00:13 +02:00
|
|
|
size_t _nbChunk,
|
|
|
|
enum audio::format _format,
|
|
|
|
uint32_t _frequency,
|
2017-08-28 00:08:17 +02:00
|
|
|
const etk::Vector<audio::channel>& _map)> playbackFunction;
|
2017-09-07 23:38:26 +02:00
|
|
|
typedef etk::Function<void (const void* _data,
|
2015-04-13 21:49:48 +02:00
|
|
|
const audio::Time& _readTime,
|
2015-04-10 23:00:13 +02:00
|
|
|
size_t _nbChunk,
|
|
|
|
enum audio::format _format,
|
|
|
|
uint32_t _frequency,
|
2017-08-28 00:08:17 +02:00
|
|
|
const etk::Vector<audio::channel>& _map)> recordFunction;
|
2015-04-10 23:00:13 +02:00
|
|
|
class EndPointCallback : public EndPoint {
|
|
|
|
private:
|
|
|
|
playbackFunction m_outputFunction;
|
|
|
|
recordFunction m_inputFunction;
|
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* @brief Constructor
|
|
|
|
*/
|
|
|
|
EndPointCallback();
|
|
|
|
void init(playbackFunction _callback);
|
|
|
|
void init(recordFunction _callback);
|
|
|
|
public:
|
2016-07-19 21:43:58 +02:00
|
|
|
static ememory::SharedPtr<EndPointCallback> create(playbackFunction _callback);
|
|
|
|
static ememory::SharedPtr<EndPointCallback> create(recordFunction _callback);
|
2015-04-10 23:00:13 +02:00
|
|
|
/**
|
|
|
|
* @brief Destructor
|
|
|
|
*/
|
|
|
|
virtual ~EndPointCallback() {};
|
|
|
|
virtual void configurationChange();
|
2015-04-13 21:49:48 +02:00
|
|
|
virtual bool process(audio::Time& _time,
|
2015-04-10 23:00:13 +02:00
|
|
|
void* _input,
|
|
|
|
size_t _inputNbChunk,
|
|
|
|
void*& _output,
|
|
|
|
size_t& _outputNbChunk);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|