mirror of
https://github.com/jambonz/freeswitch-modules.git
synced 2026-01-25 02:08:27 +00:00
Feat/mod dub v2 (#22)
* support tts elevenlabs to mod_dub Signed-off-by: Quan HL <quan.luuhoang8@gmail.com> * wip Signed-off-by: Quan HL <quan.luuhoang8@gmail.com> * wip * wip * fix aws race condition when 2 start transcribes are sent at the same instant * wip * wip * wip * allow queue play on track * wip Signed-off-by: Quan HL <quan.luuhoang8@gmail.com> * revert change for aws transcribe Signed-off-by: Quan HL <quan.luuhoang8@gmail.com> * fix type * wip * wip * rename parameters * rename paramters * wip * wip * wip * wip * wip * bug: there exists scenarios where callback is not defined * wip * wip * revert unintended changes to mod_google_transcribe * fix bugs w/ streaming tts simplified arg parsing to use freeswitch conventions --------- Signed-off-by: Quan HL <quan.luuhoang8@gmail.com> Co-authored-by: Quan HL <quan.luuhoang8@gmail.com>
This commit is contained in:
1 parent
4e57f73c7e
commit
9cdc5fdfca
23 files changed
+1907
-1612
No files matched your search
@@ -0,0 +1,41 @@
|
||||
#ifndef __AP_H__
|
||||
#define __AP_H__
|
||||
|
||||
#include <mutex>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
class AudioProducer {
|
||||
public:
|
||||
AudioProducer(
|
||||
std::mutex& mutex,
|
||||
CircularBuffer_t& circularBuffer,
|
||||
int sampleRate
|
||||
) : _mutex(mutex), _buffer(circularBuffer), _sampleRate(sampleRate), _notified(false), _loop(false), _gain(0) {}
|
||||
virtual ~AudioProducer() {}
|
||||
|
||||
virtual void notifyDone(bool error, const std::string& errorMsg) {
|
||||
if (!_notified) {
|
||||
_notified = true;
|
||||
if (_callback) _callback(error, errorMsg);
|
||||
}
|
||||
}
|
||||
virtual void start(std::function<void(bool, const std::string&)> callback) = 0;
|
||||
virtual void stop() = 0;
|
||||
|
||||
bool isLoopedAudio() const { return _loop; }
|
||||
|
||||
protected:
|
||||
std::mutex& _mutex;
|
||||
CircularBuffer_t& _buffer;
|
||||
int _sampleRate;
|
||||
int _gain;
|
||||
bool _loop;
|
||||
std::function<void(bool, const std::string&)> _callback;
|
||||
bool _notified;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user