Updates for 1.5.0

This commit is contained in:
WolverinDEV
2020-12-02 18:08:49 +01:00
parent 53367bafa5
commit 467d228e23
80 changed files with 3615 additions and 1938 deletions
@@ -5,7 +5,7 @@ using namespace std;
using namespace tc::audio::codec;
OpusConverter::OpusConverter(size_t c, size_t s, size_t f) : Converter(c, s, f) { }
OpusConverter::~OpusConverter() {}
OpusConverter::~OpusConverter() = default;
bool OpusConverter::valid() {
return this->encoder && this->decoder;
@@ -457,7 +457,7 @@ NAN_METHOD(AudioConsumerWrapper::_set_filter_mode) {
return;
}
auto value = info[0].As<v8::Number>()->ToInteger()->Value();
auto value = info[0].As<v8::Number>()->Int32Value(info.GetIsolate()->GetCurrentContext()).FromMaybe(0);
handle->filter_mode_ = (FilterMode) value;
}
@@ -474,5 +474,5 @@ NAN_METHOD(AudioConsumerWrapper::toggle_rnnoise) {
return;
}
handle->rnnoise = info[0]->BooleanValue();
handle->rnnoise = info[0]->BooleanValue(info.GetIsolate());
}
@@ -276,7 +276,7 @@ NAN_METHOD(tc::audio::sounds::playback_sound_js) {
PlaybackSettings settings{};
settings.file = *Nan::Utf8String(file);
settings.volume = volume->Value();
settings.volume = (float) volume->Value();
if(!callback.IsEmpty()) {
if(!callback->IsFunction()) {
Nan::ThrowError("invalid callback function");
+4 -1
View File
@@ -70,7 +70,10 @@ tc::audio::AudioOutput* global_audio_output;
Nan::Set(object, (uint32_t) value, Nan::New<v8::String>(key).ToLocalChecked());
NAN_MODULE_INIT(init) {
logger::initialize_node();
/* FIXME: Reenable */
//logger::initialize_node();
logger::initialize_raw();
#ifndef WIN32
logger::info(category::general, tr("Hello World from C. PPID: {}, PID: {}"), getppid(), getpid());
#else
@@ -631,10 +631,12 @@ void ServerConnection::close_connection() {
}
this->event_loop_execute_connection_close = false;
if(this->socket)
this->socket->finalize();
if(this->protocol_handler)
this->protocol_handler->do_close_connection();
if(this->socket) {
this->protocol_handler->do_close_connection();
}
if(this->protocol_handler) {
this->protocol_handler->do_close_connection();
}
this->socket = nullptr;
this->call_disconnect_result.call(0, true);
@@ -368,10 +368,11 @@ void VoiceConnection::process_packet(const std::shared_ptr<ts::protocol::ServerP
return;
}
if(packet->data().length() > 5)
client->process_packet(packet_id, packet->data().range(5), (codec::value) codec_id, flag_head);
else
client->process_packet(packet_id, pipes::buffer_view{nullptr, 0}, (codec::value) codec_id, flag_head);
if(packet->data().length() > 5) {
client->process_packet(packet_id, packet->data().range(5), (codec::value) codec_id, flag_head);
} else {
client->process_packet(packet_id, pipes::buffer_view{nullptr, 0}, (codec::value) codec_id, flag_head);
}
} else {
//TODO implement whisper
}