Showing preview only (4,010K chars total). Download the full file or copy to clipboard to get everything.
Repository: ZDisket/TensorVox
Branch: master
Commit: 57c27ebf780a
Files: 116
Total size: 3.8 MB
Directory structure:
gitextract_hcblmq9h/
├── .gitignore
├── EnglishPhoneticProcessor.cpp
├── EnglishPhoneticProcessor.h
├── FastSpeech2.cpp
├── FastSpeech2.h
├── LICENSE.md
├── MultiBandMelGAN.cpp
├── MultiBandMelGAN.h
├── ONNXModel.cpp
├── ONNXModel.h
├── ONNXUtil.hpp
├── README.md
├── Supertonic.cpp
├── Supertonic.h
├── SupertonicTextProcessor.cpp
├── SupertonicTextProcessor.h
├── SupertonicVocoder.cpp
├── SupertonicVocoder.h
├── TensorVox.pro
├── TextTokenizer.cpp
├── TextTokenizer.h
├── VITSEvo.cpp
├── VITSEvo.h
├── Voice.cpp
├── Voice.h
├── VoxCommon.cpp
├── VoxCommon.hpp
├── attention.cpp
├── attention.h
├── batchdenoisedlg.cpp
├── batchdenoisedlg.h
├── batchdenoisedlg.ui
├── bert.cpp
├── bert.h
├── berttokenizer.cpp
├── berttokenizer.h
├── devits.cpp
├── devits.h
├── espeakphonemizer.cpp
├── espeakphonemizer.h
├── ext/
│ ├── AudioFile.hpp
│ ├── ByteArr.cpp
│ ├── ByteArr.h
│ ├── CppFlow/
│ │ ├── context.h
│ │ ├── cppflow.h
│ │ ├── datatype.h
│ │ ├── defer.h
│ │ ├── model.h
│ │ ├── ops.h
│ │ ├── raw_ops.h
│ │ └── tensor.h
│ ├── Qt-Frameless-Window-DarkStyle-master/
│ │ ├── .gitignore
│ │ ├── DarkStyle.cpp
│ │ ├── DarkStyle.h
│ │ ├── README.md
│ │ ├── darkstyle/
│ │ │ └── darkstyle.qss
│ │ ├── darkstyle.qrc
│ │ ├── frameless_window_dark.pro
│ │ ├── framelesswindow/
│ │ │ ├── framelesswindow.cpp
│ │ │ ├── framelesswindow.h
│ │ │ ├── framelesswindow.ui
│ │ │ ├── windowdragger.cpp
│ │ │ └── windowdragger.h
│ │ └── framelesswindow.qrc
│ ├── ZCharScanner.cpp
│ ├── ZCharScanner.h
│ ├── ZCharScannerWide.cpp
│ ├── ZCharScannerWide.h
│ ├── ZFile.cpp
│ ├── ZFile.h
│ ├── json.hpp
│ ├── qcustomplot.cpp
│ └── qcustomplot.h
├── g2p_train/
│ ├── README.md
│ ├── config/
│ │ ├── default.yaml
│ │ └── longer.yaml
│ └── train_and_export.py
├── istftnettorch.cpp
├── istftnettorch.h
├── main.cpp
├── mainwindow.cpp
├── mainwindow.h
├── mainwindow.ui
├── melgen.cpp
├── melgen.h
├── modelinfodlg.cpp
├── modelinfodlg.h
├── modelinfodlg.ui
├── phddialog.cpp
├── phddialog.h
├── phddialog.ui
├── phonemizer.cpp
├── phonemizer.h
├── phoneticdict.cpp
├── phoneticdict.h
├── phonetichighlighter.cpp
├── phonetichighlighter.h
├── spectrogram.cpp
├── spectrogram.h
├── stdres.qrc
├── tacotron2.cpp
├── tacotron2.h
├── tacotron2torch.cpp
├── tacotron2torch.h
├── tfg2p.cpp
├── tfg2p.h
├── torchmoji.cpp
├── torchmoji.h
├── track.cpp
├── track.h
├── vits.cpp
├── vits.h
├── voicemanager.cpp
├── voicemanager.h
├── voxer.cpp
└── voxer.h
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------
deps/*
rdeployed/*
brelease/*
bdebug/*
rdeployed2/*
rdepmin/*
*.wav
*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
*.qmake.cache
*.qmake.stash
release/*
# qtcreator generated files
*.pro.user*
# xemacs temporary files
*.flc
# Vim temporary files
.*.swp
# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*
# MinGW generated files
*.Debug
*.Release
# Python byte code
*.pyc
# Binaries
# --------
*.dll
*.exe
deps.zip
README.md.backup
/.qtc_clangd
/build
================================================
FILE: EnglishPhoneticProcessor.cpp
================================================
#include "EnglishPhoneticProcessor.h"
#include "VoxCommon.hpp"
#include <Windows.h>
#include <string>
using namespace std;
const std::string SPECIAL_SPACE = "@\\_";
bool EnglishPhoneticProcessor::Initialize(Phonemizer* InPhn, ESpeakPhonemizer *InENGPh)
{
Phoner = InPhn;
Tokenizer.SetAllowedChars(Phoner->GetGraphemeChars());
ENG_Phonemizer = InENGPh;
return true;
}
std::string EnglishPhoneticProcessor::ProcessTextPhonetic(const std::string& InText, const std::vector<u32string> &InPhonemes, const std::vector<DictEntry>& InDict, ETTSLanguageType::Enum InLanguageType, bool IsTac)
{
if (!Phoner)
return "ERROR";
vector<string> Words = Tokenizer.Tokenize(InText,IsTac);
string Assemble = "";
if (InLanguageType == ETTSLanguageType::Char)
{
for (size_t w = 0; w < Words.size();w++)
{
Assemble.append(Words[w]);
if (w > 0)
Assemble.append(" ");
}
if (Assemble[Assemble.size() - 1] == ' ')
Assemble.pop_back();
return Assemble;
}
// Make a copy of the dict passed.
std::vector<DictEntry> CurrentDict = InDict;
for (size_t w = 0; w < Words.size();w++)
{
const string& Word = Words[w];
bool NextIsPunct = false;
if (w < Words.size() - 1)
NextIsPunct = Words[w + 1].find("@@") != std::string::npos;
if (Word.size() > 22)
continue;
// Double email symbol indicates Tacotron punctuation handling
if (Word.find("@@") != std::string::npos)
{
std::string AddPonct = Word.substr(2); // Remove the @@
Assemble.append(" ");
Assemble.append(AddPonct);
Assemble.append(" ");
if (InLanguageType == ETTSLanguageType::ARPA && w != Words.size() - 1){
Assemble.append(SPECIAL_SPACE);
Assemble.append(" ");
}
continue;
}
if (Word.find("@") != std::string::npos){
std::u32string AddPh = VoxUtil::StrToU32(Word.substr(1)); // Remove the @
size_t OutId = 0;
if (VoxUtil::FindInVec(AddPh,InPhonemes,OutId))
{
Assemble.append(VoxUtil::U32ToStr(InPhonemes[OutId]));
Assemble.append(" ");
}
continue;
}
size_t OverrideIdx = 0;
if (!ENG_Phonemizer && VoxUtil::FindInVec2<std::string,DictEntry>(Word,InDict,OverrideIdx))
{
Assemble.append(InDict[OverrideIdx].PhSpelling);
Assemble.append(" ");
continue;
}
std::string Res = Word;
if (!ENG_Phonemizer){
Res = Phoner->ProcessWord(Word,0.001f);
CurrentDict.push_back({Word,Res,""});
}
// Cache the word in the override dict so next time we don't have to research it
Assemble.append(Res);
Assemble.append(" ");
if (InLanguageType == ETTSLanguageType::ARPA && !NextIsPunct && w != Words.size() - 1)
{
Assemble.append(SPECIAL_SPACE);
Assemble.append(" ");
}
}
// eSpeak phonemizer takes in whole thing
if (ENG_Phonemizer){
Assemble = ENG_Phonemizer->Phonemize(Assemble);
}
// Delete last space if there is
if (Assemble[Assemble.size() - 1] == ' ')
Assemble.pop_back();
return Assemble;
}
EnglishPhoneticProcessor::EnglishPhoneticProcessor()
{
Phoner = nullptr;
ENG_Phonemizer = nullptr;
}
EnglishPhoneticProcessor::EnglishPhoneticProcessor(Phonemizer *InPhn, ESpeakPhonemizer *InENGPh)
{
Initialize(InPhn,InENGPh);
}
EnglishPhoneticProcessor::~EnglishPhoneticProcessor()
{
// Causes annoying crash on exit. It's also irrelevant because the OS frees what little memory this had.
/*
if (Phoner)
delete Phoner;
*/
}
================================================
FILE: EnglishPhoneticProcessor.h
================================================
#pragma once
#include "TextTokenizer.h"
#include "phoneticdict.h"
#include "phonemizer.h"
#include "espeakphonemizer.h"
class EnglishPhoneticProcessor
{
private:
TextTokenizer Tokenizer;
Phonemizer* Phoner;
ESpeakPhonemizer* ENG_Phonemizer;
inline bool FileExists(const std::string& name) {
std::ifstream f(name.c_str());
return f.good();
}
public:
bool Initialize(Phonemizer *InPhn,ESpeakPhonemizer* InENGPh = nullptr);
std::string ProcessTextPhonetic(const std::string& InText, const std::vector<std::u32string> &InPhonemes, const std::vector<DictEntry>& InDict, ETTSLanguageType::Enum InLanguageType, bool IsTac);
EnglishPhoneticProcessor();
EnglishPhoneticProcessor(Phonemizer *InPhn,ESpeakPhonemizer* InENGPh = nullptr);
~EnglishPhoneticProcessor();
inline TextTokenizer& GetTokenizer() {return Tokenizer;}
};
================================================
FILE: FastSpeech2.cpp
================================================
#include "FastSpeech2.h"
FastSpeech2::FastSpeech2()
{
}
TFTensor<float> FastSpeech2::DoInference(const std::vector<int32_t>& InputIDs,const std::vector<float>& ArgsFloat,const std::vector<int32_t> ArgsInt, int32_t SpeakerID , int32_t EmotionID)
{
if (!CurrentMdl)
throw std::exception("Tried to do inference on unloaded or invalid model!");
// Convenience reference so that we don't have to constantly derefer pointers.
cppflow::model& Mdl = *CurrentMdl;
// This is the shape of the input IDs, our equivalent to tf.expand_dims.
std::vector<int64_t> InputIDShape = { 1, (int64_t)InputIDs.size() };
// Define the tensors
cppflow::tensor input_ids{InputIDs, InputIDShape };
cppflow::tensor energy_ratios{ ArgsFloat[1] };
cppflow::tensor f0_ratios{ArgsFloat[2]};
cppflow::tensor speaker_ids{ SpeakerID };
cppflow::tensor speed_ratios{ ArgsFloat[0] };
cppflow::tensor* emotion_ids = nullptr;
// Vector of input tensors
TensorVec Inputs = {{"serving_default_input_ids:0",input_ids},
{"serving_default_speaker_ids:0",speaker_ids},
{"serving_default_energy_ratios:0",energy_ratios},
{"serving_default_f0_ratios:0",f0_ratios},
{"serving_default_speed_ratios:0",speed_ratios}};
// This is a multi-emotion model
if (EmotionID != -1)
{
emotion_ids = new cppflow::tensor{EmotionID};
Inputs.push_back({"serving_default_emotion_ids:0",*emotion_ids});
}
// Do inference
// If we don't extract every single output it crashes.
auto Outputs = Mdl(Inputs,{"StatefulPartitionedCall:0","StatefulPartitionedCall:1","StatefulPartitionedCall:2","StatefulPartitionedCall:3","StatefulPartitionedCall:4"});
// Define output and return it
TFTensor<float> Output = VoxUtil::CopyTensor<float>(Outputs[1]);
// We allocated the emotion_ids cppflow::tensor dynamically, delete it
if (emotion_ids)
delete emotion_ids;
// We could just straight out define it in the return statement, but I like it more this way
return Output;
}
FastSpeech2::~FastSpeech2()
{
}
================================================
FILE: FastSpeech2.h
================================================
#pragma once
#include "melgen.h"
class FastSpeech2 : public MelGen
{
public:
FastSpeech2();
/*
Do inference on a FastSpeech2 model.
-> InputIDs: Input IDs of tokens for inference
-> SpeakerID: ID of the speaker in the model to do inference on. If single speaker, always leave at 0. If multispeaker, refer to your model.
-> (In ArgsFloat)Speed, Energy, F0: Parameters for FS2 inference. Leave at 1.f for defaults
<- Returns: TFTensor<float> with shape {1,<len of mel in frames>,80} containing contents of mel spectrogram.
*/
TFTensor<float> DoInference(const std::vector<int32_t>& InputIDs,const std::vector<float>& ArgsFloat,const std::vector<int32_t> ArgsInt, int32_t SpeakerID = 0, int32_t EmotionID = -1);
~FastSpeech2();
};
================================================
FILE: LICENSE.md
================================================
MIT License
Copyright (c) 2020 ZDisket
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: MultiBandMelGAN.cpp
================================================
#include "MultiBandMelGAN.h"
#define IF_EXCEPT(cond,ex) if (cond){throw std::exception(ex);}
bool MultiBandMelGAN::Initialize(const std::string & VocoderPath)
{
try {
MelGAN = std::make_unique<cppflow::model>(VocoderPath);
}
catch (...) {
return false;
}
return true;
}
TFTensor<float> MultiBandMelGAN::DoInference(const TFTensor<float>& InMel)
{
IF_EXCEPT(!MelGAN, "Tried to infer MB-MelGAN on uninitialized model!!!!")
// Convenience reference so that we don't have to constantly derefer pointers.
cppflow::model& Mdl = *MelGAN;
cppflow::tensor input_mels{ InMel.Data, InMel.Shape};
auto out_audio = Mdl({{"serving_default_mels:0",input_mels}}, {"StatefulPartitionedCall:0"})[0];
TFTensor<float> RetTensor = VoxUtil::CopyTensor<float>(out_audio);
return RetTensor;
}
MultiBandMelGAN::MultiBandMelGAN()
{
MelGAN = nullptr;
}
MultiBandMelGAN::~MultiBandMelGAN()
{
}
================================================
FILE: MultiBandMelGAN.h
================================================
#pragma once
#include "VoxCommon.hpp"
#include <memory>
class MultiBandMelGAN
{
private:
std::unique_ptr<cppflow::model> MelGAN;
public:
virtual bool Initialize(const std::string& VocoderPath);
// Do MultiBand MelGAN inference including PQMF
// -> InMel: Mel spectrogram (shape [1, xx, 80])
// <- Returns: Tensor data [4, xx, 1]
virtual TFTensor<float> DoInference(const TFTensor<float>& InMel);
MultiBandMelGAN();
~MultiBandMelGAN();
};
================================================
FILE: ONNXModel.cpp
================================================
#include "ONNXModel.h"
#include <dml_provider_factory.h>
#include <onnxruntime_c_api.h>
// We can't include this (or embed in the ONNXModel header) because the linker thinks they're already defined in
// subclasses like Crepe (???)
#include "ONNXUtil.hpp"
#include <iostream>
#include <filesystem>
#include <windows.h>
#include <string>
#include <dxgi1_6.h>
#include <wrl/client.h>
bool DoesFileExist(const std::wstring& path) {
DWORD fileAttributes = GetFileAttributesW(path.c_str());
if (fileAttributes == INVALID_FILE_ATTRIBUTES) {
return false; // The file does not exist or there is an error.
}
return true; // The file exists.
}
std::wstring GetDefaultAdapterName()
{
Microsoft::WRL::ComPtr<IDXGIFactory6> factory;
if (FAILED(CreateDXGIFactory1(IID_PPV_ARGS(&factory)))) {
return L"GPU";
}
Microsoft::WRL::ComPtr<IDXGIAdapter1> adapter;
if (FAILED(factory->EnumAdapterByGpuPreference(0, DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE, IID_PPV_ARGS(&adapter)))) {
return L"GPU";
}
DXGI_ADAPTER_DESC1 desc = {};
if (FAILED(adapter->GetDesc1(&desc))) {
return L"GPU";
}
return std::wstring(desc.Description);
}
bool ONNXModel::SetUpDirectML(Ort::SessionOptions& SessionOptions)
{
// This functions tells us it's deprecated but the alternative causes a crash, plus it's not mentioned in documentation (????)
OrtStatusPtr Stat = OrtSessionOptionsAppendExecutionProvider_DML(SessionOptions, 0);
OrtStatus* Status = (Stat);
if (Status)
return false; // Status NOT nullptr indicates failure
// https://onnxruntime.ai/docs/execution-providers/DirectML-ExecutionProvider.html#configuration-options
/*
The DirectML execution provider does not support the use of memory pattern optimizations or parallel execution in onnxruntime
When supplying session options during InferenceSession creation, these options must be disabled or an error will be returned.
*/
SessionOptions.DisableMemPattern();
SessionOptions.SetExecutionMode(ExecutionMode::ORT_SEQUENTIAL);
return true;
}
void ONNXModel::DisableMemReuse(OrtSessionOptions* SessPtr)
{
}
std::pair<std::vector<const char*>, std::vector<const char*>> ONNXModel::GetInputOutputNamesChar(const std::vector<std::string>& InputNames, const std::vector<std::string>& OutputNames)
{
return std::pair< std::vector<const char*>, std::vector<const char*>>{
ONNXUtil::StringVectoCharVec(InputNames),
ONNXUtil::StringVectoCharVec(OutputNames),
};
}
ONNXModel::ONNXModel()
{
ModelLoaded = false;
IsGPU = false;
DeviceName = L"CPU";
}
void ONNXModel::_overrideDevices(bool is_gpu, std::wstring device_name)
{
IsGPU = is_gpu;
DeviceName = device_name;
}
bool ONNXModel::Load(const std::wstring& ModelPath, const std::string& EnvName)
{
if (!DoesFileExist(ModelPath))
return false;
Environment = std::make_unique<Ort::Env>(ORT_LOGGING_LEVEL_WARNING, EnvName.c_str());
// Set up DirectML
Ort::SessionOptions session_options;
bool DML_Succ = SetUpDirectML(session_options);
Sess = std::make_unique<Ort::Session>(*Environment, ModelPath.c_str(), session_options);
Alloc = std::make_unique<Ort::AllocatorWithDefaultOptions>();
if (!Sess || !Alloc)
return false;
IsGPU = DML_Succ;
DeviceName = DML_Succ ? GetDefaultAdapterName() : L"CPU";
ModelLoaded = true;
return true;
}
std::vector<std::string> ONNXModel::GetOutputNames()
{
std::vector<std::string> OutputNames;
for (std::size_t i = 0; i < Sess->GetOutputCount(); i++) {
OutputNames.emplace_back(Sess->GetOutputNameAllocated(i, *Alloc).get());
}
return OutputNames;
}
std::vector<std::string> ONNXModel::GetInputNames()
{
std::vector<std::string> InputNames;
for (std::size_t i = 0; i < Sess->GetInputCount(); i++) {
InputNames.emplace_back(Sess->GetInputNameAllocated(i, *Alloc).get());
}
return InputNames;
}
std::vector<ONNXTensorElementDataType> ONNXModel::GetInputTypes()
{
std::vector<ONNXTensorElementDataType> InputTypes;
for (std::size_t i = 0; i < Sess->GetInputCount(); i++) {
InputTypes.emplace_back(Sess->GetInputTypeInfo(i).GetTensorTypeAndShapeInfo().GetElementType());
}
return InputTypes;
}
std::pair<std::vector<std::vector<int64_t>>, std::vector<std::string>> ONNXModel::GetInputs()
{
std::vector<std::vector<int64_t>> InputShapes;
std::vector<std::string> InputNames;
for (std::size_t i = 0; i < Sess->GetInputCount(); i++) {
InputNames.emplace_back(Sess->GetInputNameAllocated(i, *Alloc).get());
InputShapes.emplace_back(Sess->GetInputTypeInfo(i).GetTensorTypeAndShapeInfo().GetShape());
}
std::pair<std::vector<std::vector<int64_t>>, std::vector<std::string>> Ret(InputShapes, InputNames);
return Ret;
}
================================================
FILE: ONNXModel.h
================================================
#pragma once
#include <iostream>
#include <string>
#include <vector>
#include <onnxruntime_cxx_api.h>
#include <memory>
#include <sstream>
#include <algorithm>
template<typename T>
struct ONXTensor {
std::vector<T> Data;
std::vector<int64_t> Shape;
ONXTensor(Ort::Value& Tens)
{
Shape = Tens.GetTensorTypeAndShapeInfo().GetShape();
int64_t product = 1;
for (int64_t dim : Shape)
product *= dim;
Data = std::vector<T>(Tens.GetTensorData<float>(), Tens.GetTensorData<float>() + product);
}
ONXTensor(const ONXTensor& CpyT)
{
Data = CpyT.Data;
Shape = CpyT.Shape;
}
ONXTensor() {
}
};
/*
ONNXModel: Base class for ONNX models, running on DirectML.
*/
class ONNXModel
{
private:
bool ModelLoaded;
bool IsGPU;
std::wstring DeviceName;
std::unique_ptr<Ort::Env> Environment;
std::unique_ptr<Ort::Session> Sess;
std::unique_ptr<Ort::AllocatorWithDefaultOptions> Alloc;
/*
Sets up DirectML backend
Takes in NON-CONST (direct operation on) reference to session options, and returns success
If succeeds, use the session options to create the session
*/
bool SetUpDirectML(Ort::SessionOptions& SessionOptions);
void DisableMemReuse(OrtSessionOptions* SessPtr);
std::pair<std::vector<const char*>, std::vector<const char*>> GetInputOutputNamesChar(const std::vector<std::string>& InputNames, const std::vector<std::string>& OutputNames);
public:
ONNXModel();
inline ONNXModel(const std::wstring& InitModelPath) { Load(InitModelPath); };
inline bool IsLoaded() const { return ModelLoaded; }
inline bool IsGPUDevice() const { return IsGPU; }
inline const std::wstring& GetDeviceName() const { return DeviceName; }
void _overrideDevices(bool is_gpu, std::wstring device_name);
/*
Load model in DirectML mode.
Inputs:
ModelPath: Path of model
Returns:
Success (true), or failure (false)
*/
virtual bool Load(const std::wstring& ModelPath, const std::string& EnvName = "defaultenv");
/*
Forward pass through the model, for simple calling when all tensors are of one type.
Inputs:
- Inputs: Tensor datas
- InputShapes: Shapes of each tensor
- InputNames: Names of the input tensors. Optional; pass an empty one and they will be auto-fetched
- OutputNames: Names of the output tensors. Optional; pass an empty one and they will be auto-fetched
*/
template<typename D> // NOTE: Inputs should be a const reference, but vec_to_tensor requires a non-const one.
std::vector<Ort::Value> Forward(std::vector<std::vector<D>>& Inputs, const std::vector<std::vector<int64_t>>& InputShapes,
std::vector<std::string> InputNames, std::vector<std::string> OutputNames)
{
// Make input tensors
std::vector<Ort::Value> InputTensors;
Ort::MemoryInfo mem_info = Ort::MemoryInfo::CreateCpu(OrtAllocatorType::OrtArenaAllocator, OrtMemType::OrtMemTypeDefault);
for (size_t i = 0; i < Inputs.size(); i++)
{
// Ort::Value::Value(const Ort::Value &) is deleted, so we have to directly push back the output of the fun instead of using a variable.
InputTensors.emplace_back(Ort::Value::CreateTensor<D>(mem_info, Inputs[i].data(), Inputs[i].size(), InputShapes[i].data(), InputShapes[i].size())
);
}
return Forward(InputTensors, InputNames, OutputNames);
}
/*
Forward pass through the model
Inputs:
- InputTensors: Tensors.
- InputNames: Names of the input tensors. Optional; pass an empty one and they will be auto-fetched
- OutputNames: Names of the output tensors. Optional; pass an empty one and they will be auto-fetched
*/
std::vector<Ort::Value> Forward(std::vector<Ort::Value>& InputTensors,
std::vector<std::string> InputNames = std::vector<std::string>{}, std::vector<std::string> OutputNames = std::vector<std::string>{})
{
// Autogen output names if we don't have them
if (!OutputNames.size())
OutputNames = GetOutputNames();
// Ditto for input names
if (!InputNames.size())
InputNames = GetInputs().second;
// Create input names
auto InputOutNames = GetInputOutputNamesChar(InputNames, OutputNames);
std::vector<const char*> InputNamesChar = InputOutNames.first;
std::vector<const char*> OutputNamesChar = InputOutNames.second;
if (!Sess)
throw std::runtime_error("Session is NULL!");
auto OutputTensors = Sess->Run(Ort::RunOptions{ nullptr }, InputOutNames.first.data(), InputTensors.data(),
InputOutNames.first.size(), InputOutNames.second.data(), InputOutNames.second.size());
return OutputTensors;
}
// Get a reference to the unique ptr of the session.
std::unique_ptr<Ort::Session>& GetSession() { return Sess; }
std::vector<std::string> GetOutputNames();
std::vector<std::string> GetInputNames();
std::vector<ONNXTensorElementDataType> GetInputTypes();
// Returns the input shapes and names
std::pair<std::vector<std::vector<int64_t>>, std::vector<std::string>> GetInputs();
};
================================================
FILE: ONNXUtil.hpp
================================================
#pragma once
#include <iostream>
#include <string>
#include <vector>
#include <onnxruntime_cxx_api.h>
#include <memory>
#include <sstream>
#include <algorithm>
// Util functions for ONNX stuff
namespace ONNXUtil {
// pretty prints a shape dimension vector
std::string print_shape(const std::vector<std::int64_t>& v) {
std::stringstream ss("");
for (std::size_t i = 0; i < v.size() - 1; i++) ss << v[i] << "x";
ss << v[v.size() - 1];
return ss.str();
}
template <typename T>
Ort::Value vec_to_tensor(std::vector<T>& data, const std::vector<std::int64_t>& shape) {
Ort::MemoryInfo mem_info =
Ort::MemoryInfo::CreateCpu(OrtAllocatorType::OrtArenaAllocator, OrtMemType::OrtMemTypeDefault);
auto tensor = Ort::Value::CreateTensor<T>(mem_info, data.data(), data.size(), shape.data(), shape.size());
return tensor;
}
std::vector<const char*> StringVectoCharVec(const std::vector<std::string>& inputStrings) {
std::vector<const char*> outputChars(inputStrings.size(), nullptr);
std::transform(std::begin(inputStrings), std::end(inputStrings), std::begin(outputChars),
[](const std::string& str) { return str.c_str(); });
return outputChars;
}
}
================================================
FILE: README.md
================================================
# TensorVox
TensorVox is an application designed to enable user-friendly and lightweight neural speech synthesis in the desktop, aimed at increasing accessibility to such technology.
Being able to load a variety of AI TTS models, it is written in pure C++/Qt, using the ONNX Runtime, and supporting TensorFlow and LibTorch as legacy backends.

### Try it out
**System requirements:** Windows 10 64-bit and a CPU that supports the AVX instruction set (pretty much anything made after 2010). As for GPU, to use it you need one that supports DirectX 12 (only with ONNX models)
[Detailed guide in Google Docs](https://docs.google.com/document/d/1OS1kfb19bvpPPkF71Vbak_b735mi7epjUanIfPG671M/edit?usp=sharing)
Grab a copy from the releases, extract the .zip and check [the Google Drive folder](https://drive.google.com/drive/folders/1atUyxBbstKZpMqQEZMdNmRF2AKrlahKy?usp=sharing) for models and installation instructions
If you're interested in using your own model, first you need to train then export it.
## Supported architectures
TensorVox supports several models by various authors
### Current-gen models
These are models under active development by their authors and support by me. These use the ONNX backend, with GPU support under DirectML
- **ZDisket/VITS Evolution:** This is my fully upgraded version of VITS
- **Supertone/[Supertonic](https://github.com/supertone-inc/supertonic) 2:** Supertone's small, fast model made for fast on-device inference
More models are to be added soon.
### Legacy models
Compatibility for these models is kept but not maintained, as they're obsolete and have been superseded by newer ones. These run under the LibTorch and Tensorflow backends, supporting only CPU.
- **jaywalnut310/VITS:** VITS, which is a fully E2E model. (Stressed IPA as phonemes) Export notebook: [<img src="https://colab.research.google.com/assets/colab-badge.svg">](https://colab.research.google.com/drive/1BSGE5DQYweXBWrwPOmb6CRPUU8H5mBvb?usp=sharing)
- **TensorFlowTTS**: FastSpeech2, Tacotron2, both char and phoneme based and Multi-Band MelGAN. Here's a Colab notebook demonstrating how to export the LJSpeech pretrained, char-based Tacotron2 model: [<img src="https://colab.research.google.com/assets/colab-badge.svg">](https://colab.research.google.com/drive/1KLqZ1rkD4Enw7zpTgXGL6if7e5s0UeWa?usp=sharing)
- **Coqui-TTS:** Tacotron2 (phoneme-based IPA) and Multi-Band MelGAN, after converting from PyTorch to Tensorflow. Here's a notebook showing how to export the LJSpeech DDC model: [<img src="https://colab.research.google.com/assets/colab-badge.svg">](https://colab.research.google.com/drive/15CdGEAu_-KezV1XxwzVfQiFSm0tveBkC?usp=sharing)
More support of modern TTS models is being actively worked on!
These examples should provide you with enough guidance to understand what is needed. If you're looking to train a model specifically for this purpose, then stay tuned...
*Or if you’d rather skip the training and export work, you can also get a TensorVox-ready model directly from me. (see contact details at the bottom of this)*
As for languages, out-of-the-box support is provided for English, German and Spanish (only TensorFlowTTS); that is, you won't have to do anything. You can add languages without modifying code, as long as the phoneme set are IPA (stressed or nonstressed), ARPA, or GlobalPhone, (open an issue and I'll explain it to you)
## Backends
TensorVox currently supports multiple inference backends.
LibTorch (TorchScript) and TensorFlow backends are maintained for compatibility with older models and projects created before ONNX export was refined enough.
New development and active support are focused on ONNX Runtime, with DirectML used for GPU acceleration on Windows. This backend provides the best portability, long-term stability, and hardware coverage.
## Build instructions
Currently, only Windows 10 x64 (although I've heard reports of it running on 8.1) is supported.
**Requirements:**
1. Qt Creator
2. MSVC 2017 (v141) compiler
**Primed build (with all provided libraries):**
1. Download [precompiled binary dependencies and includes](https://drive.google.com/file/d/1N6IxSpsgemS94z_v82toXhiNs2tLXkz6/view?usp=sharing)
2. Unzip it so that the `deps` folder is in the same place as the .pro and main source files.
3. Open the project with Qt Creator, add your compiler and compile
Note that to try your shiny new executable you'll need to download a release of program as described above and replace the executable in that release with your new one, so you have all the DLLs in place.
TODO: Add instructions for compile from scratch.
## Externals (and thanks)
- **ONNX Runtime** :https://onnxruntime.ai/
- **Tensorflow C API**: [https://www.tensorflow.org/install/lang_c](https://www.tensorflow.org/install/lang_c)
- **CppFlow** (TF C API -> C++ wrapper): [https://github.com/serizba/cppflow](https://github.com/serizba/cppflow)
- **AudioFile** (for WAV export): [https://github.com/adamstark/AudioFile](https://github.com/adamstark/AudioFile)
- **Frameless Dark Style Window**: https://github.com/Jorgen-VikingGod/Qt-Frameless-Window-DarkStyle
- **JSON for modern C++**: https://github.com/nlohmann/json
- **r8brain-free-src** (Resampling): https://github.com/avaneev/r8brain-free-src
- **rnnoise** (CMake version, denoising output): https://github.com/almogh52/rnnoise-cmake
- **Logitech LED Illumination SDK** (Mouse RGB integration): https://www.logitechg.com/en-us/innovation/developer-lab.html
- **QCustomPlot** : https://www.qcustomplot.com/index.php/introduction
- **libnumbertext** : https://github.com/Numbertext/libnumbertext
## Contact
You can open an issue here or join the [Discord server](https://discord.gg/B9fGwXgz) and discuss/ask anything there
Custom model training, fine-tuning, and compatible exports are available on request (not free). Use email or DM me on Xitter
Follow me on X (formerly Twitter): [ZD1908 (@ZDi____) / X](https://x.com/ZDi____)
For any formal inquiries, send to this email: nika109021@gmail.com
## Note about licensing
This program itself is MIT licensed, but for the models you use, their license terms apply. For example, if you're in Vietnam and using TensorFlowTTS models, you'll have to check [here](https://github.com/TensorSpeech/TensorFlowTTS#license) for some details
================================================
FILE: Supertonic.cpp
================================================
#include "Supertonic.h"
#include "ext/json.hpp"
#include <algorithm>
#include <fstream>
#include <random>
#include <filesystem>
using json = nlohmann::json;
namespace {
std::wstring ToWide(const std::string& value)
{
return std::wstring(value.begin(), value.end());
}
template<typename T>
Ort::Value CreateTensor(Ort::MemoryInfo& mem_info, std::vector<T>& data, const std::vector<int64_t>& shape)
{
return Ort::Value::CreateTensor<T>(mem_info, data.data(), data.size(), shape.data(), shape.size());
}
}
bool Supertonic::Initialize(const std::string& onnxDir, ETTSRepo::Enum InTTSRepo)
{
CurrentRepo = InTTSRepo;
config_loaded_ = LoadConfig(onnxDir);
models_loaded_ = LoadModels(onnxDir);
std::filesystem::path p(onnxDir);
BasePath = p.parent_path().generic_string(); // generic_string always returns in forward slash style.
CurrentLoadedVoice = "";
return config_loaded_ && models_loaded_;
}
bool Supertonic::LoadConfig(const std::string& onnxDir)
{
std::ifstream file(onnxDir + "/tts.json");
if (!file.is_open()) {
return false;
}
json cfg;
file >> cfg;
sample_rate_ = cfg["ae"]["sample_rate"].get<int>();
base_chunk_size_ = cfg["ae"]["base_chunk_size"].get<int>();
chunk_compress_factor_ = cfg["ttl"]["chunk_compress_factor"].get<int>();
latent_dim_ = cfg["ttl"]["latent_dim"].get<int>();
return true;
}
bool Supertonic::LoadModels(const std::string& onnxDir)
{
duration_predictor_ = std::make_unique<ONNXModel>();
text_encoder_ = std::make_unique<ONNXModel>();
vector_estimator_ = std::make_unique<ONNXModel>();
const std::wstring dp_path = ToWide(onnxDir + "/duration_predictor.onnx");
const std::wstring text_enc_path = ToWide(onnxDir + "/text_encoder.onnx");
const std::wstring vector_est_path = ToWide(onnxDir + "/vector_estimator.onnx");
const bool dp_loaded = duration_predictor_->Load(dp_path, "supertonic_dp");
const bool text_loaded = text_encoder_->Load(text_enc_path, "supertonic_text_enc");
const bool vector_loaded = vector_estimator_->Load(vector_est_path, "supertonic_vector_est");
_overrideDevices(duration_predictor_->IsGPUDevice(), duration_predictor_->GetDeviceName());
return dp_loaded && text_loaded && vector_loaded;
}
bool Supertonic::LoadStyle(const std::string& stylePath)
{
std::ifstream file(stylePath);
if (!file.is_open()) {
return false;
}
json style_json;
file >> style_json;
style_.ttl_shape = style_json["style_ttl"]["dims"].get<std::vector<int64_t>>();
style_.dp_shape = style_json["style_dp"]["dims"].get<std::vector<int64_t>>();
auto ttl_data_nested = style_json["style_ttl"]["data"].get<std::vector<std::vector<std::vector<float>>>>();
style_.ttl_data.clear();
for (const auto& batch : ttl_data_nested) {
for (const auto& row : batch) {
style_.ttl_data.insert(style_.ttl_data.end(), row.begin(), row.end());
}
}
auto dp_data_nested = style_json["style_dp"]["data"].get<std::vector<std::vector<std::vector<float>>>>();
style_.dp_data.clear();
for (const auto& batch : dp_data_nested) {
for (const auto& row : batch) {
style_.dp_data.insert(style_.dp_data.end(), row.begin(), row.end());
}
}
style_.loaded = true;
return true;
}
TFTensor<float> Supertonic::DoInference(const std::vector<int32_t>& InputIDs, const std::vector<float>& ArgsFloat,
const std::vector<int32_t> ArgsInt, int32_t SpeakerID, int32_t EmotionID)
{
(void)EmotionID;
EnsureSpeaker(SpeakerID);
TFTensor<float> result;
if (InputIDs.empty()) {
return result;
}
if (!models_loaded_ || !config_loaded_ || !style_.loaded) {
throw std::runtime_error("Supertonic not initialized or style not loaded");
}
int total_step = ArgsInt.empty() ? 6 : ArgsInt[0];
float speed = ArgsFloat.empty() ? 1.05f : ArgsFloat[0];
if (total_step < 1) {
total_step = 1;
}
if (speed <= 0.0f) {
speed = 1.0f;
}
std::vector<int64_t> text_ids;
text_ids.reserve(InputIDs.size());
for (auto id : InputIDs) {
text_ids.push_back(static_cast<int64_t>(id));
}
const int64_t batch = 1;
const int64_t seq_len = static_cast<int64_t>(text_ids.size());
std::vector<int64_t> text_shape{batch, seq_len};
std::vector<int64_t> text_mask_shape{batch, 1, seq_len};
std::vector<float> text_mask(seq_len, 1.0f);
Ort::MemoryInfo mem_info = Ort::MemoryInfo::CreateCpu(OrtAllocatorType::OrtArenaAllocator, OrtMemType::OrtMemTypeDefault);
std::vector<Ort::Value> dp_inputs;
dp_inputs.emplace_back(CreateTensor(mem_info, text_ids, text_shape));
dp_inputs.emplace_back(CreateTensor(mem_info, style_.dp_data, style_.dp_shape));
dp_inputs.emplace_back(CreateTensor(mem_info, text_mask, text_mask_shape));
auto dp_outputs = duration_predictor_->Forward(dp_inputs, {"text_ids", "style_dp", "text_mask"}, {"duration"});
if (dp_outputs.empty() || !dp_outputs[0].IsTensor()) {
return result;
}
auto duration_info = dp_outputs[0].GetTensorTypeAndShapeInfo();
const float* duration_ptr = dp_outputs[0].GetTensorData<float>();
float duration = duration_info.GetElementCount() ? duration_ptr[0] : 0.0f;
duration /= speed;
std::vector<Ort::Value> text_inputs;
text_inputs.emplace_back(CreateTensor(mem_info, text_ids, text_shape));
text_inputs.emplace_back(CreateTensor(mem_info, style_.ttl_data, style_.ttl_shape));
text_inputs.emplace_back(CreateTensor(mem_info, text_mask, text_mask_shape));
auto text_outputs = text_encoder_->Forward(text_inputs, {"text_ids", "style_ttl", "text_mask"}, {"text_emb"});
if (text_outputs.empty() || !text_outputs[0].IsTensor()) {
return result;
}
auto text_emb_info = text_outputs[0].GetTensorTypeAndShapeInfo();
std::vector<int64_t> text_emb_shape = text_emb_info.GetShape();
size_t text_emb_count = text_emb_info.GetElementCount();
const float* text_emb_ptr = text_outputs[0].GetTensorData<float>();
std::vector<float> text_emb_vec(text_emb_ptr, text_emb_ptr + text_emb_count);
int64_t wav_len = static_cast<int64_t>(duration * sample_rate_);
wav_len = std::max<int64_t>(wav_len, 1);
int64_t chunk_size = static_cast<int64_t>(base_chunk_size_) * chunk_compress_factor_;
int64_t latent_len = std::max<int64_t>(1, (wav_len + chunk_size - 1) / chunk_size);
int64_t latent_dim = static_cast<int64_t>(latent_dim_) * chunk_compress_factor_;
std::vector<int64_t> latent_shape{batch, latent_dim, latent_len};
std::vector<int64_t> latent_mask_shape{batch, 1, latent_len};
std::vector<float> latent_mask(latent_len, 1.0f);
std::vector<float> xt(static_cast<std::size_t>(latent_dim * latent_len));
std::random_device rd;
std::mt19937 gen(rd());
std::normal_distribution<float> dist(0.0f, 1.0f);
for (int64_t d = 0; d < latent_dim; ++d) {
for (int64_t t = 0; t < latent_len; ++t) {
xt[static_cast<std::size_t>(d * latent_len + t)] = dist(gen) * latent_mask[static_cast<std::size_t>(t)];
}
}
std::vector<int64_t> scalar_shape{batch};
std::vector<float> total_step_vec(batch, static_cast<float>(total_step));
for (int step = 0; step < total_step; ++step) {
std::vector<float> current_step_vec(batch, static_cast<float>(step));
std::vector<Ort::Value> vector_inputs;
vector_inputs.emplace_back(CreateTensor(mem_info, xt, latent_shape));
vector_inputs.emplace_back(CreateTensor(mem_info, text_emb_vec, text_emb_shape));
vector_inputs.emplace_back(CreateTensor(mem_info, style_.ttl_data, style_.ttl_shape));
vector_inputs.emplace_back(CreateTensor(mem_info, text_mask, text_mask_shape));
vector_inputs.emplace_back(CreateTensor(mem_info, latent_mask, latent_mask_shape));
vector_inputs.emplace_back(CreateTensor(mem_info, total_step_vec, scalar_shape));
vector_inputs.emplace_back(CreateTensor(mem_info, current_step_vec, scalar_shape));
auto vector_outputs = vector_estimator_->Forward(
vector_inputs,
{"noisy_latent", "text_emb", "style_ttl", "text_mask", "latent_mask", "total_step", "current_step"},
{"denoised_latent"}
);
if (vector_outputs.empty() || !vector_outputs[0].IsTensor()) {
return result;
}
auto denoised_info = vector_outputs[0].GetTensorTypeAndShapeInfo();
const float* denoised_ptr = vector_outputs[0].GetTensorData<float>();
size_t denoised_count = denoised_info.GetElementCount();
xt.assign(denoised_ptr, denoised_ptr + denoised_count);
}
result.Data = xt;
result.Shape = latent_shape;
result.TotalSize = xt.size();
return result;
}
void Supertonic::EnsureSpeaker(int32_t SpeakerID)
{
std::string RequestedSpeakerJSON = std::to_string(SpeakerID) + ".json";
if (RequestedSpeakerJSON != CurrentLoadedVoice){
LoadStyle(BasePath + "/styles/" + RequestedSpeakerJSON);
CurrentLoadedVoice = RequestedSpeakerJSON;
}
}
================================================
FILE: Supertonic.h
================================================
#pragma once
#include "ONNXModel.h"
#include "melgen.h"
#include <cstdint>
#include <memory>
#include <string>
#include <vector>
class Supertonic : public ONNXModel, public MelGen
{
public:
bool Initialize(const std::string& onnxDir, ETTSRepo::Enum InTTSRepo) override;
bool LoadStyle(const std::string& stylePath);
TFTensor<float> DoInference(const std::vector<int32_t>& InputIDs, const std::vector<float>& ArgsFloat,
const std::vector<int32_t> ArgsInt, int32_t SpeakerID = 0, int32_t EmotionID = -1) override;
int GetSampleRate() const { return sample_rate_; }
private:
struct StyleData {
std::vector<float> ttl_data;
std::vector<int64_t> ttl_shape;
std::vector<float> dp_data;
std::vector<int64_t> dp_shape;
bool loaded = false;
};
std::string BasePath;
std::string CurrentLoadedVoice;
void EnsureSpeaker(int32_t SpeakerID);
bool LoadConfig(const std::string& onnxDir);
bool LoadModels(const std::string& onnxDir);
std::unique_ptr<ONNXModel> duration_predictor_;
std::unique_ptr<ONNXModel> text_encoder_;
std::unique_ptr<ONNXModel> vector_estimator_;
bool models_loaded_ = false;
bool config_loaded_ = false;
int sample_rate_ = 0;
int base_chunk_size_ = 0;
int chunk_compress_factor_ = 0;
int latent_dim_ = 0;
StyleData style_;
};
================================================
FILE: SupertonicTextProcessor.cpp
================================================
#include "SupertonicTextProcessor.h"
#include "ext/json.hpp"
#include <algorithm>
#include <cctype>
#include <fstream>
#include <stdexcept>
#include <unordered_map>
using json = nlohmann::json;
// Available languages for multilingual TTS
const std::vector<std::string> AVAILABLE_LANGS = {"en", "ko", "es", "pt", "fr"};
namespace {
bool IsAsciiSpace(char32_t cp)
{
if (cp > 0x7F) {
return false;
}
return std::isspace(static_cast<unsigned char>(cp)) != 0;
}
bool IsEmoji(char32_t cp)
{
return cp >= 0x1F000 && cp <= 0x1FFFF;
}
bool IsTerminalPunct(char32_t cp)
{
switch (cp) {
case U'.':
case U'!':
case U'?':
case U';':
case U':':
case U',':
case U'\'':
case U'"':
case U')':
case U']':
case U'}':
case U'>':
case U'\u2026': // …
case U'\u3002': // 。
case U'\u300D': // 」
case U'\u300F': // 』
case U'\u3011': // 】
case U'\u3009': // 〉
case U'\u300B': // 》
case U'\u203A': // ›
case U'\u00BB': // »
case U'\u201C': // “
case U'\u201D': // ”
case U'\u2018': // ‘
case U'\u2019': // ’
return true;
default:
return false;
}
}
void ReplaceAll(std::u32string& text, const std::u32string& from, const std::u32string& to)
{
if (from.empty()) {
return;
}
size_t pos = 0;
while ((pos = text.find(from, pos)) != std::u32string::npos) {
text.replace(pos, from.size(), to);
pos += to.size();
}
}
std::u32string TrimSpaces(const std::u32string& text)
{
size_t start = 0;
while (start < text.size() && text[start] == U' ') {
++start;
}
size_t end = text.size();
while (end > start && text[end - 1] == U' ') {
--end;
}
return text.substr(start, end - start);
}
std::u32string NormalizeSpaces(const std::u32string& text)
{
std::u32string result;
result.reserve(text.size());
bool prev_space = false;
for (char32_t cp : text) {
if (IsAsciiSpace(cp)) {
if (!prev_space) {
result.push_back(U' ');
prev_space = true;
}
continue;
}
prev_space = false;
result.push_back(cp);
}
return result;
}
std::u32string AsciiToU32(const std::string& text)
{
std::u32string result;
result.reserve(text.size());
for (unsigned char ch : text) {
result.push_back(static_cast<char32_t>(ch));
}
return result;
}
}
SupertonicTextProcessor::SupertonicTextProcessor(const std::string& unicode_indexer_json_path)
{
std::ifstream file(unicode_indexer_json_path);
if (!file.is_open()) {
throw std::runtime_error("Failed to open file: " + unicode_indexer_json_path);
}
json j;
file >> j;
indexer_ = j.get<std::vector<int64_t>>();
}
SupertonicTextProcessor::Result SupertonicTextProcessor::Process(
const std::vector<std::string>& text_list,
const std::vector<std::string>& lang_list
)
{
std::vector<std::u32string> processed_texts;
processed_texts.reserve(text_list.size());
for (size_t i = 0; i < text_list.size(); ++i) {
processed_texts.push_back(preprocessText(text_list[i], lang_list[i]));
}
return buildResult(processed_texts);
}
SupertonicTextProcessor::Result SupertonicTextProcessor::Process(
const std::vector<std::u32string>& text_list,
const std::vector<std::string>& lang_list
)
{
std::vector<std::u32string> processed_texts;
processed_texts.reserve(text_list.size());
for (size_t i = 0; i < text_list.size(); ++i) {
processed_texts.push_back(preprocessText(text_list[i], lang_list[i]));
}
return buildResult(processed_texts);
}
std::u32string SupertonicTextProcessor::preprocessText(const std::string& text, const std::string& lang)
{
return preprocessText(ansiToU32(text), lang);
}
std::u32string SupertonicTextProcessor::preprocessText(const std::u32string& text, const std::string& lang)
{
std::u32string result = normalizeText(text);
if (!result.empty()) {
char32_t last_char = result.back();
if (!IsTerminalPunct(last_char)) {
result.push_back(U'.');
}
}
bool valid_lang = false;
for (const auto& available_lang : AVAILABLE_LANGS) {
if (lang == available_lang) {
valid_lang = true;
break;
}
}
if (!valid_lang) {
throw std::runtime_error("Invalid language: " + lang + ". Available: en, ko, es, pt, fr");
}
std::u32string tag_lang = AsciiToU32(lang);
std::u32string result_with_tags;
result_with_tags.reserve(result.size() + tag_lang.size() * 2 + 5);
result_with_tags += U"<";
result_with_tags += tag_lang;
result_with_tags += U">";
result_with_tags += result;
result_with_tags += U"</";
result_with_tags += tag_lang;
result_with_tags += U">";
return result_with_tags;
}
std::u32string SupertonicTextProcessor::normalizeText(const std::u32string& text)
{
std::u32string result;
result.reserve(text.size());
for (char32_t cp : text) {
switch (cp) {
case U'\u2013': // –
case U'\u2011': // ‑
case U'\u2014': // —
cp = U'-';
break;
case U'_':
case U'[':
case U']':
case U'|':
case U'/':
case U'#':
case U'\u2192': // →
case U'\u2190': // ←
cp = U' ';
break;
case U'\u201C': // “
case U'\u201D': // ”
cp = U'"';
break;
case U'\u2018': // ‘
case U'\u2019': // ’
case U'\u00B4': // ´
case U'`':
cp = U'\'';
break;
default:
break;
}
result.push_back(cp);
}
std::u32string emoji_filtered;
emoji_filtered.reserve(result.size());
for (char32_t cp : result) {
if (!IsEmoji(cp)) {
emoji_filtered.push_back(cp);
}
}
std::u32string symbol_filtered;
symbol_filtered.reserve(emoji_filtered.size());
for (char32_t cp : emoji_filtered) {
if (cp == U'\u2665' || cp == U'\u2606' || cp == U'\u2661' || cp == U'\u00A9' || cp == U'\\') {
continue;
}
symbol_filtered.push_back(cp);
}
ReplaceAll(symbol_filtered, U"@", U" at ");
ReplaceAll(symbol_filtered, U"e.g.,", U"for example, ");
ReplaceAll(symbol_filtered, U"i.e.,", U"that is, ");
ReplaceAll(symbol_filtered, U" ,", U",");
ReplaceAll(symbol_filtered, U" .", U".");
ReplaceAll(symbol_filtered, U" !", U"!");
ReplaceAll(symbol_filtered, U" ?", U"?");
ReplaceAll(symbol_filtered, U" ;", U";");
ReplaceAll(symbol_filtered, U" :", U":");
ReplaceAll(symbol_filtered, U" '", U"'");
while (symbol_filtered.find(U"\"\"") != std::u32string::npos) {
ReplaceAll(symbol_filtered, U"\"\"", U"\"");
}
while (symbol_filtered.find(U"''") != std::u32string::npos) {
ReplaceAll(symbol_filtered, U"''", U"'");
}
while (symbol_filtered.find(U"``") != std::u32string::npos) {
ReplaceAll(symbol_filtered, U"``", U"`");
}
std::u32string normalized = NormalizeSpaces(symbol_filtered);
normalized = TrimSpaces(normalized);
return normalized;
}
std::u32string SupertonicTextProcessor::ansiToU32(const std::string& text)
{
std::u32string result;
size_t i = 0;
while (i < text.size()) {
uint32_t codepoint = 0;
unsigned char c = static_cast<unsigned char>(text[i]);
codepoint = c;
i += 1;
result.push_back(static_cast<char32_t>(codepoint));
}
return result;
}
// Hangul syllable decomposition constants (Unicode Standard Annex #15)
static const uint32_t HANGUL_SBASE = 0xAC00;
static const uint32_t HANGUL_LBASE = 0x1100;
static const uint32_t HANGUL_VBASE = 0x1161;
static const uint32_t HANGUL_TBASE = 0x11A7;
static const int HANGUL_LCOUNT = 19;
static const int HANGUL_VCOUNT = 21;
static const int HANGUL_TCOUNT = 28;
static const int HANGUL_NCOUNT = HANGUL_VCOUNT * HANGUL_TCOUNT;
static const int HANGUL_SCOUNT = HANGUL_LCOUNT * HANGUL_NCOUNT;
// Latin character NFKD decompositions for Spanish, Portuguese, French
static const std::unordered_map<uint32_t, std::vector<char32_t>> LATIN_DECOMPOSITIONS = {
{0x00C1, {0x0041, 0x0301}},
{0x00C9, {0x0045, 0x0301}},
{0x00CD, {0x0049, 0x0301}},
{0x00D3, {0x004F, 0x0301}},
{0x00DA, {0x0055, 0x0301}},
{0x00E1, {0x0061, 0x0301}},
{0x00E9, {0x0065, 0x0301}},
{0x00ED, {0x0069, 0x0301}},
{0x00F3, {0x006F, 0x0301}},
{0x00FA, {0x0075, 0x0301}},
{0x00C0, {0x0041, 0x0300}},
{0x00C8, {0x0045, 0x0300}},
{0x00CC, {0x0049, 0x0300}},
{0x00D2, {0x004F, 0x0300}},
{0x00D9, {0x0055, 0x0300}},
{0x00E0, {0x0061, 0x0300}},
{0x00E8, {0x0065, 0x0300}},
{0x00EC, {0x0069, 0x0300}},
{0x00F2, {0x006F, 0x0300}},
{0x00F9, {0x0075, 0x0300}},
{0x00C2, {0x0041, 0x0302}},
{0x00CA, {0x0045, 0x0302}},
{0x00CE, {0x0049, 0x0302}},
{0x00D4, {0x004F, 0x0302}},
{0x00DB, {0x0055, 0x0302}},
{0x00E2, {0x0061, 0x0302}},
{0x00EA, {0x0065, 0x0302}},
{0x00EE, {0x0069, 0x0302}},
{0x00F4, {0x006F, 0x0302}},
{0x00FB, {0x0075, 0x0302}},
{0x00C3, {0x0041, 0x0303}},
{0x00D1, {0x004E, 0x0303}},
{0x00D5, {0x004F, 0x0303}},
{0x00E3, {0x0061, 0x0303}},
{0x00F1, {0x006E, 0x0303}},
{0x00F5, {0x006F, 0x0303}},
{0x00C4, {0x0041, 0x0308}},
{0x00CB, {0x0045, 0x0308}},
{0x00CF, {0x0049, 0x0308}},
{0x00D6, {0x004F, 0x0308}},
{0x00DC, {0x0055, 0x0308}},
{0x00E4, {0x0061, 0x0308}},
{0x00EB, {0x0065, 0x0308}},
{0x00EF, {0x0069, 0x0308}},
{0x00F6, {0x006F, 0x0308}},
{0x00FC, {0x0075, 0x0308}},
{0x00C7, {0x0043, 0x0327}},
{0x00E7, {0x0063, 0x0327}},
};
static void DecomposeCharacter(char32_t codepoint, std::u32string& output)
{
if (codepoint >= HANGUL_SBASE && codepoint < HANGUL_SBASE + HANGUL_SCOUNT) {
uint32_t sIndex = static_cast<uint32_t>(codepoint) - HANGUL_SBASE;
uint32_t lIndex = sIndex / HANGUL_NCOUNT;
uint32_t vIndex = (sIndex % HANGUL_NCOUNT) / HANGUL_TCOUNT;
uint32_t tIndex = sIndex % HANGUL_TCOUNT;
output.push_back(static_cast<char32_t>(HANGUL_LBASE + lIndex));
output.push_back(static_cast<char32_t>(HANGUL_VBASE + vIndex));
if (tIndex > 0) {
output.push_back(static_cast<char32_t>(HANGUL_TBASE + tIndex));
}
return;
}
auto it = LATIN_DECOMPOSITIONS.find(static_cast<uint32_t>(codepoint));
if (it != LATIN_DECOMPOSITIONS.end()) {
for (char32_t cp : it->second) {
output.push_back(cp);
}
return;
}
output.push_back(codepoint);
}
std::vector<int64_t> SupertonicTextProcessor::codepointsToIds(const std::u32string& text)
{
std::vector<int64_t> ids;
ids.reserve(text.size());
std::u32string decomposed;
decomposed.reserve(text.size());
for (char32_t cp : text) {
DecomposeCharacter(cp, decomposed);
}
for (char32_t cp : decomposed) {
if (cp < indexer_.size()) {
int64_t id = indexer_[static_cast<size_t>(cp)];
if (id >= 0) {
ids.push_back(id);
}
}
}
return ids;
}
std::vector<std::vector<std::vector<float>>> SupertonicTextProcessor::getTextMask(
const std::vector<int64_t>& text_ids_lengths
)
{
int64_t max_len = 0;
for (auto len : text_ids_lengths) {
if (len > max_len) {
max_len = len;
}
}
std::vector<std::vector<std::vector<float>>> mask;
mask.reserve(text_ids_lengths.size());
for (auto len : text_ids_lengths) {
std::vector<std::vector<float>> batch_mask(1);
batch_mask[0].resize(static_cast<size_t>(max_len));
for (int64_t i = 0; i < max_len; ++i) {
batch_mask[0][static_cast<size_t>(i)] = (i < len) ? 1.0f : 0.0f;
}
mask.push_back(std::move(batch_mask));
}
return mask;
}
SupertonicTextProcessor::Result SupertonicTextProcessor::buildResult(
const std::vector<std::u32string>& text_list
)
{
Result result;
std::vector<std::vector<int64_t>> all_ids;
all_ids.reserve(text_list.size());
result.lengths.reserve(text_list.size());
for (size_t i = 0; i < text_list.size(); ++i) {
std::vector<int64_t> ids = codepointsToIds(text_list[i]);
result.lengths.push_back(static_cast<int64_t>(ids.size()));
all_ids.push_back(std::move(ids));
}
int64_t max_len = 0;
for (auto len : result.lengths) {
if (len > max_len) {
max_len = len;
}
}
result.text_ids.resize(text_list.size());
for (size_t i = 0; i < all_ids.size(); ++i) {
result.text_ids[i].assign(static_cast<size_t>(max_len), 0);
for (size_t j = 0; j < all_ids[i].size(); ++j) {
result.text_ids[i][j] = all_ids[i][j];
}
}
result.text_mask = getTextMask(result.lengths);
return result;
}
================================================
FILE: SupertonicTextProcessor.h
================================================
#pragma once
#include <cstdint>
#include <string>
#include <vector>
// Available languages for multilingual TTS
extern const std::vector<std::string> AVAILABLE_LANGS;
class SupertonicTextProcessor {
public:
explicit SupertonicTextProcessor(const std::string& unicode_indexer_json_path);
struct Result {
std::vector<std::vector<int64_t>> text_ids;
std::vector<std::vector<std::vector<float>>> text_mask;
std::vector<int64_t> lengths;
};
Result Process(
const std::vector<std::string>& text_list,
const std::vector<std::string>& lang_list
);
Result Process(
const std::vector<std::u32string>& text_list,
const std::vector<std::string>& lang_list
);
private:
std::vector<int64_t> indexer_;
std::u32string preprocessText(const std::string& text, const std::string& lang);
std::u32string preprocessText(const std::u32string& text, const std::string& lang);
std::u32string normalizeText(const std::u32string& text);
std::u32string ansiToU32(const std::string& text);
std::vector<int64_t> codepointsToIds(const std::u32string& text);
std::vector<std::vector<std::vector<float>>> getTextMask(
const std::vector<int64_t>& text_ids_lengths
);
Result buildResult(const std::vector<std::u32string>& text_list);
};
================================================
FILE: SupertonicVocoder.cpp
================================================
#include "SupertonicVocoder.h"
#include <cstddef>
#include <string>
#include <vector>
namespace {
std::wstring ToWide(const std::string& value)
{
return std::wstring(value.begin(), value.end());
}
std::size_t CountElements(const std::vector<std::int64_t>& shape)
{
std::size_t total = 1;
for (auto dim : shape) {
total *= static_cast<std::size_t>(dim);
}
return total;
}
}
bool SupertonicVocoder::Initialize(const std::string& vocoderPath)
{
std::string model_path = vocoderPath;
const std::string suffix = ".onnx";
if (model_path.size() < suffix.size() ||
model_path.compare(model_path.size() - suffix.size(), suffix.size(), suffix) != 0) {
if (!model_path.empty() && model_path.back() != '/' && model_path.back() != '\\') {
model_path += '/';
}
model_path += "vocoder.onnx";
}
std::wstring wide_path = ToWide(model_path);
return static_cast<ONNXModel&>(*this).Load(wide_path, "supertonic_vocoder");
}
TFTensor<float> SupertonicVocoder::DoInference(const TFTensor<float>& InMel)
{
TFTensor<float> result;
if (InMel.Data.empty() || InMel.Shape.empty()) {
return result;
}
Ort::MemoryInfo mem_info = Ort::MemoryInfo::CreateCpu(OrtAllocatorType::OrtArenaAllocator, OrtMemType::OrtMemTypeDefault);
std::vector<float> input_data = InMel.Data;
std::vector<int64_t> input_shape = InMel.Shape;
std::vector<Ort::Value> input_tensors;
input_tensors.emplace_back(Ort::Value::CreateTensor<float>(mem_info, input_data.data(), input_data.size(), input_shape.data(), input_shape.size()));
auto output_tensors = Forward(input_tensors);
if (output_tensors.empty() || !output_tensors[0].IsTensor()) {
return result;
}
auto output_shape = output_tensors[0].GetTensorTypeAndShapeInfo().GetShape();
std::size_t output_count = CountElements(output_shape);
const float* output_ptr = output_tensors[0].GetTensorData<float>();
result.Data.assign(output_ptr, output_ptr + output_count);
// Return shape: [1, N]
// Squeeze extra dim
result.Shape = {output_shape[1]};
result.TotalSize = output_count;
return result;
}
================================================
FILE: SupertonicVocoder.h
================================================
#pragma once
#include "ONNXModel.h"
#include "MultiBandMelGAN.h"
#include <string>
class SupertonicVocoder : public ONNXModel, public MultiBandMelGAN
{
public:
bool Initialize(const std::string& vocoderPath);
TFTensor<float> DoInference(const TFTensor<float>& InMel);
};
================================================
FILE: TensorVox.pro
================================================
QT += core gui
QT += multimedia
QT += winextras
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
CONFIG += c++17
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
EnglishPhoneticProcessor.cpp \
FastSpeech2.cpp \
MultiBandMelGAN.cpp \
ONNXModel.cpp \
Supertonic.cpp \
SupertonicTextProcessor.cpp \
SupertonicVocoder.cpp \
TextTokenizer.cpp \
VITSEvo.cpp \
Voice.cpp \
VoxCommon.cpp \
attention.cpp \
batchdenoisedlg.cpp \
bert.cpp \
berttokenizer.cpp \
devits.cpp \
espeakphonemizer.cpp \
ext/ByteArr.cpp \
ext/Qt-Frameless-Window-DarkStyle-master/DarkStyle.cpp \
ext/Qt-Frameless-Window-DarkStyle-master/framelesswindow/framelesswindow.cpp \
ext/Qt-Frameless-Window-DarkStyle-master/framelesswindow/windowdragger.cpp \
ext/ZCharScanner.cpp \
ext/ZCharScannerWide.cpp \
ext/ZFile.cpp \
ext/qcustomplot.cpp \
istftnettorch.cpp \
main.cpp \
mainwindow.cpp \
melgen.cpp \
modelinfodlg.cpp \
phddialog.cpp \
phonemizer.cpp \
phoneticdict.cpp \
phonetichighlighter.cpp \
spectrogram.cpp \
tacotron2.cpp \
tacotron2torch.cpp \
tfg2p.cpp \
torchmoji.cpp \
track.cpp \
vits.cpp \
voicemanager.cpp \
voxer.cpp
HEADERS += \
EnglishPhoneticProcessor.h \
FastSpeech2.h \
MultiBandMelGAN.h \
ONNXModel.h \
ONNXUtil.hpp \
Supertonic.h \
SupertonicTextProcessor.h \
SupertonicVocoder.h \
TextTokenizer.h \
VITSEvo.h \
Voice.h \
VoxCommon.hpp \
attention.h \
batchdenoisedlg.h \
bert.h \
berttokenizer.h \
devits.h \
espeakphonemizer.h \
ext/AudioFile.hpp \
ext/ByteArr.h \
ext/CppFlow/context.h \
ext/CppFlow/cppflow.h \
ext/CppFlow/datatype.h \
ext/CppFlow/defer.h \
ext/CppFlow/model.h \
ext/CppFlow/ops.h \
ext/CppFlow/raw_ops.h \
ext/CppFlow/tensor.h \
ext/Qt-Frameless-Window-DarkStyle-master/DarkStyle.h \
ext/Qt-Frameless-Window-DarkStyle-master/framelesswindow/framelesswindow.h \
ext/Qt-Frameless-Window-DarkStyle-master/framelesswindow/windowdragger.h \
ext/ZCharScanner.h \
ext/ZCharScannerWide.h \
ext/ZFile.h \
ext/json.hpp \
ext/qcustomplot.h \
istftnettorch.h \
mainwindow.h \
melgen.h \
modelinfodlg.h \
phddialog.h \
phonemizer.h \
phoneticdict.h \
phonetichighlighter.h \
spectrogram.h \
tacotron2.h \
tacotron2torch.h \
tfg2p.h \
torchmoji.h \
track.h \
vits.h \
voicemanager.h \
voxer.h
FORMS += \
batchdenoisedlg.ui \
ext/Qt-Frameless-Window-DarkStyle-master/framelesswindow/framelesswindow.ui \
mainwindow.ui \
modelinfodlg.ui \
phddialog.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
DEFINES += _CRT_SECURE_NO_WARNINGS
INCLUDEPATH += $$PWD/deps/include
INCLUDEPATH += $$PWD/deps/include/libtorch
INCLUDEPATH += $$PWD/ext/Qt-Frameless-Window-DarkStyle-master/framelesswindow
win32: LIBS += -L$$PWD/deps/lib/ DirectML.lib onnxruntime.lib tensorflow.lib r8bsrc64.lib rnnoise64.lib LogitechLEDLib.lib LibNumberText64.lib c10.lib torch.lib torch_cpu.lib libespeak-ng.lib Utf8Proc.lib
win32: LIBS += Advapi32.lib User32.lib Psapi.lib dxgi.lib
RESOURCES += \
ext/Qt-Frameless-Window-DarkStyle-master/darkstyle.qrc \
ext/Qt-Frameless-Window-DarkStyle-master/framelesswindow.qrc \
stdres.qrc
win32:RC_ICONS += winicon.ico
VERSION = 1.2.0.0
CONFIG += force_debug_info
QMAKE_CXXFLAGS += /std:c++17 /utf-8 -DPSAPI_VERSION=1
DISTFILES += \
res/defaultim.png
================================================
FILE: TextTokenizer.cpp
================================================
#include "TextTokenizer.h"
#include "ext/ZCharScanner.h"
#include <algorithm>
#include <cassert>
#include <cctype>
#include <iostream>
#include <algorithm>
// Punctuation, this gets auto-converted to SIL
const std::u32string punctuation_f = U",.-;";
// For Tacotron2, including question and other marks
const std::u32string punctuation_tac = U",.;¡!¿?:-";
const std::u32string digits = U"1234567890";
using namespace std;
void TextTokenizer::SetAllowedChars(const std::string &value)
{
AllowedChars = VoxUtil::StrToU32(value);
}
vector<string> TextTokenizer::ExpandNumbers(const std::vector<std::string>& SpaceTokens)
{
vector<string> RetVec;
RetVec.reserve(SpaceTokens.size());
for (auto& Token : SpaceTokens) {
char* p;
strtol(Token.c_str(), &p, 10);
if (*p) {
RetVec.push_back(Token);
}
else {
std::string ModTk = Token;
CuNumber->numbertext(ModTk,NumLang);
std::replace(ModTk.begin(),ModTk.end(),'-',' ');
// If the number has spaces we must sep again and add one by one otherwise all the words are merged together due to the
// nature of it
ZStringDelimiter DelSp(ModTk);
DelSp.AddDelimiter(" ");
if (DelSp.szTokens())
{
for (const auto& Ttk : DelSp.GetTokens())
RetVec.push_back(Ttk);
}else{
RetVec.push_back(ModTk);
}
}
}
return RetVec;
}
string TextTokenizer::SpaceChars(const string &InStr)
{
std::u32string AsmStr = U"";
std::u32string Stry = VoxUtil::StrToU32(InStr);
bool InNumChain = false;
bool InPhn = false;
for (size_t i = 0; i < Stry.size();i++)
{
auto uChar = Stry[i];
if (uChar == U'@')
InPhn = true;
if (uChar == U' ')
InPhn = false;
if (InPhn)
{
AsmStr += uChar;
continue;
}
if (digits.find(uChar) != std::u32string::npos && !InNumChain)
{
AsmStr += U" ";
AsmStr += uChar;
InNumChain = true;
continue;
}
if (digits.find(uChar) == std::u32string::npos && InNumChain )
{
AsmStr += U" ";
AsmStr += uChar;
InNumChain = false;
continue;
}
AsmStr += uChar;
}
return VoxUtil::U32ToStr(AsmStr);
}
TextTokenizer::TextTokenizer()
{
}
TextTokenizer::~TextTokenizer()
{
}
void TextTokenizer::SetNumberText(Numbertext &INum, const string &Lang)
{
CuNumber = &INum;
NumLang = Lang;
}
vector<string> TextTokenizer::Tokenize(const std::string & InTxt,bool IsTacotron, bool IsTorchMoji)
{
vector<string> ProcessedTokens;
std::string TxtPreProc = SpaceChars(InTxt);
ZStringDelimiter Delim(TxtPreProc);
Delim.AddDelimiter(" ");
vector<string> DelimitedTokens = Delim.GetTokens();
// Single word handler
if (!Delim.szTokens())
DelimitedTokens.push_back(TxtPreProc);
DelimitedTokens = ExpandNumbers(DelimitedTokens);
std::u32string punctuation = punctuation_f;
if (IsTacotron)
punctuation = punctuation_tac;
// We know that the new vector is going to be at least this size so we reserve
ProcessedTokens.reserve(DelimitedTokens.size());
/*
In this step we go through the string and only allow qualified character to pass through.
*/
for (size_t TokCtr = 0; TokCtr < DelimitedTokens.size();TokCtr++)
{
// We are now using U32string because it's guaranteed to be 1 character = 1 element
const auto& tok = VoxUtil::StrToU32(DelimitedTokens[TokCtr]);
std::u32string AppTok = U"";
if (tok.find(U"@") != string::npos)
{
ProcessedTokens.push_back(VoxUtil::U32ToStr(tok));
continue;
}
for (size_t s = 0;s < tok.size();s++)
{
if (AllowedChars.find(tok[s]) != std::u32string::npos)
AppTok += tok[s];
// Punctuation handler
// This time we explicitly add a token to the vector
if (punctuation.find(tok[s]) != std::u32string::npos) {
// First, if the assembled string isn't empty, we add it in its current state
// Otherwise, the SIL could end up appearing before the word.
if (!AppTok.empty()) {
ProcessedTokens.push_back(VoxUtil::U32ToStr(AppTok));
AppTok = U"";
}
if (IsTacotron){
// Double at-symbol is handled later
if (!IsTorchMoji)
AppTok += U"@@";
AppTok += tok[s];
}
else{
AppTok = U"@SIL";
}
ProcessedTokens.push_back(VoxUtil::U32ToStr(AppTok));
AppTok = U"";
continue;
}
}
if (!AppTok.empty())
{
ProcessedTokens.push_back(VoxUtil::U32ToStr(AppTok));
AppTok = U"";
}
}
// Prevent out of range error if the user inputs one word
if (ProcessedTokens.size() > 1)
{
if (ProcessedTokens[ProcessedTokens.size() - 1] == "SIL")
ProcessedTokens.pop_back();
}
return ProcessedTokens;
}
================================================
FILE: TextTokenizer.h
================================================
#pragma once
#include <vector>
#include <string>
#include "VoxCommon.hpp"
#include "Numbertext.hxx"
class TextTokenizer
{
private:
std::u32string AllowedChars;
std::vector<std::string> ExpandNumbers(const std::vector<std::string>& SpaceTokens);
Numbertext* CuNumber;
std::string NumLang;
// Go through the string and add spaces before and after punctuation.
// This is because ExpandNumbers won't recognize numbers if they've got punctuation like 500, or .9000
std::string SpaceChars(const std::string& InStr);
public:
TextTokenizer();
~TextTokenizer();
void SetNumberText(Numbertext& INum,const std::string& Lang);
std::vector<std::string> Tokenize(const std::string& InTxt, bool IsTacotron = false, bool IsTorchMoji = false);
void SetAllowedChars(const std::string &value);
};
================================================
FILE: VITSEvo.cpp
================================================
#include "VITSEvo.h"
#include <cstddef>
#include <string>
std::vector<int64_t> ZeroPadVec(const std::vector<int32_t> &InIDs)
{
std::vector<int64_t> NewIDs;
NewIDs.reserve(InIDs.size() * 2);
NewIDs.push_back(0);
for (auto CharID : InIDs)
{
NewIDs.push_back((int64_t)CharID);
NewIDs.push_back(0);
}
return NewIDs;
}
namespace {
std::size_t CountElements(const std::vector<std::int64_t>& shape)
{
std::size_t total = 1;
for (auto dim : shape) {
total *= static_cast<std::size_t>(dim);
}
return total;
}
}
bool VITSEvo::Initialize(const std::string &SavedModelFolder, ETTSRepo::Enum InTTSRepo)
{
std::wstring WidePath( SavedModelFolder.begin(), SavedModelFolder.end() );
CurrentRepo = InTTSRepo;
return Load(WidePath);
}
TFTensor<float> VITSEvo::DoInference(const std::vector<int32_t> &InputIDs, const std::vector<float> &ArgsFloat, const std::vector<int32_t> ArgsInt, int32_t SpeakerID, int32_t EmotionID)
{
// VITS EVO uses zero interspersion
std::vector<int64_t> RealIDs = ZeroPadVec(InputIDs);
// Call the ONNX inference fun
std::vector<float> AudioFrames = Predict(RealIDs, (int64_t)SpeakerID);
const int64_t output_count = (int64_t)AudioFrames.size();
TFTensor<float> RetTensor;
RetTensor.Shape = {output_count};
RetTensor.TotalSize = output_count;
RetTensor.Data = AudioFrames;
return RetTensor;
}
std::vector<float> VITSEvo::Predict(std::vector<std::int64_t>& text_ids, int64_t SpeakerID)
{
if (text_ids.empty()) {
return {};
}
const std::int64_t batch = 1;
const std::int64_t seq_len = static_cast<std::int64_t>(text_ids.size());
std::vector<std::int64_t> text_shape{ batch, seq_len };
std::vector<std::int64_t> text_lengths_shape{ batch };
std::vector<std::int64_t> text_lengths_data{ seq_len };
Ort::MemoryInfo mem_info = Ort::MemoryInfo::CreateCpu(OrtAllocatorType::OrtArenaAllocator, OrtMemType::OrtMemTypeDefault);
std::vector<Ort::Value> input_tensors;
input_tensors.emplace_back(Ort::Value::CreateTensor<std::int64_t>(mem_info,
text_ids.data(), text_ids.size(), text_shape.data(), text_shape.size()));
input_tensors.emplace_back(Ort::Value::CreateTensor<std::int64_t>(mem_info,
text_lengths_data.data(), text_lengths_data.size(), text_lengths_shape.data(), text_lengths_shape.size()));
std::vector<std::string> InputNames = { "text", "text_lengths" };
if (SpeakerID != -1)
{
// This is a multi speaker model.
std::vector<int64_t> speaker_id_data = {SpeakerID};
std::vector<int64_t> speaker_id_shape = {batch};
input_tensors.emplace_back(
Ort::Value::CreateTensor<std::int64_t>(mem_info,
speaker_id_data.data(), speaker_id_data.size(), speaker_id_shape.data(), speaker_id_shape.size())
);
InputNames.push_back("sid");
}
auto output_tensors = Forward(input_tensors, InputNames);
if (output_tensors.empty() || !output_tensors[0].IsTensor()) {
return {};
}
auto output_shape = output_tensors[0].GetTensorTypeAndShapeInfo().GetShape();
std::size_t output_count = CountElements(output_shape);
const float* output_ptr = output_tensors[0].GetTensorData<float>();
return std::vector<float>(output_ptr, output_ptr + output_count);
}
================================================
FILE: VITSEvo.h
================================================
#pragma once
#include "ONNXModel.h"
#include "melgen.h"
#include <cstdint>
#include <vector>
class VITSEvo : public ONNXModel, public MelGen
{
public:
// Since VITS EVO runs on ONNX we override the loader
/*
Initialize and load the model
-> SavedModelFolder: Not a folder, but path to the .onnx file
<- Returns: (bool)Success
*/
virtual bool Initialize(const std::string& SavedModelFolder, ETTSRepo::Enum InTTSRepo);
/*
Do inference on a VITS model.
-> InputIDs: Input IDs of tokens for inference
-> SpeakerID: ID of the speaker in the model to do inference on. If single speaker, always leave at 0. If multispeaker, refer to your model.
-> ArgsFloat[0]: Length scale. (not yet)
<- Returns: TFTensor<float> with shape {frames} of audio data
*/
TFTensor<float> DoInference(const std::vector<int32_t>& InputIDs,const std::vector<float>& ArgsFloat,const std::vector<int32_t> ArgsInt, int32_t SpeakerID = 0, int32_t EmotionID = -1);
std::vector<float> Predict(std::vector<std::int64_t>& text_ids, int64_t SpeakerID);
};
================================================
FILE: Voice.cpp
================================================
#include "Voice.h"
#include "ext/ZCharScanner.h"
std::vector<int32_t> Voice::CharsToID(const std::string & RawInTxt)
{
std::cout << "CharsToID: " << RawInTxt << "\n";
std::vector<int32_t> VecPhones;
std::u32string InTxt = VoxUtil::StrToU32(RawInTxt);
for (const auto& Char : InTxt)
{
size_t ArrID = 0;
std::u32string CharAs;
CharAs += Char;
if (VoxUtil::FindInVec<std::u32string>(CharAs, Phonemes, ArrID))
VecPhones.push_back(PhonemeIDs[ArrID]);
else
std::cout << "Voice::PhonemesToID() WARNING: Unknown phoneme " << Char << std::endl;
}
return VecPhones;
}
std::vector<int32_t> Voice::PhonemesToID(const std::string & RawInTxt)
{
std::cout << "PhonemesToID: " << RawInTxt << "\n";
ZStringDelimiter Delim(RawInTxt);
Delim.AddDelimiter(" ");
std::u32string InTxt = VoxUtil::StrToU32(RawInTxt);
std::vector<int32_t> VecPhones;
VecPhones.reserve(Delim.szTokens());
for (const auto& Pho : Delim.GetTokens())
{
size_t ArrID = 0;
std::u32string PhnU = VoxUtil::StrToU32(Pho);
if (VoxUtil::FindInVec<std::u32string>(PhnU, Phonemes, ArrID))
VecPhones.push_back(PhonemeIDs[ArrID]);
else
std::cout << "Voice::PhonemesToID() WARNING: Unknown phoneme " << Pho << std::endl;
}
return VecPhones;
}
void Voice::ReadPhonemes(const std::string &PhonemePath)
{
std::ifstream Phone(PhonemePath);
std::string Line;
while (std::getline(Phone, Line))
{
if (Line.find("\t") == std::string::npos)
continue;
ZStringDelimiter Deline(Line);
Deline.AddDelimiter("\t");
Phonemes.push_back(VoxUtil::StrToU32(Deline[0]));
PhonemeIDs.push_back(stoi(Deline[1]));
}
}
void Voice::ReadSpeakers(const std::string &SpeakerPath)
{
Speakers = VoxUtil::GetLinedFile(SpeakerPath);
}
void Voice::ReadEmotions(const std::string &EmotionPath)
{
Emotions = VoxUtil::GetLinedFile(EmotionPath);
}
void Voice::ReadModelInfo(const std::string &ModelInfoPath)
{
ModelInfo = "";
std::vector<std::string> MiLines = VoxUtil::GetLinedFile(ModelInfoPath);
for (const std::string& ss : MiLines)
ModelInfo += ss + "\n";
}
Voice::Voice(const std::string & VoxPath, const std::string &inName, Phonemizer *InPhn)
{
MelPredictorIsGPU = false;
MelPredictorDeviceName = L"CPU";
ReadModelInfo(VoxPath + "/info.txt");
VoxInfo = VoxUtil::ReadModelJSON(VoxPath + "/info.json");
const int32_t Tex2MelArch = VoxInfo.Architecture.Text2Mel;
const bool IsVITS = Tex2MelArch == EText2MelModel::VITS || Tex2MelArch == EText2MelModel::DEVITS || Tex2MelArch == EText2MelModel::VITSEvo;
if (Tex2MelArch == EText2MelModel::Tacotron2)
MelPredictor = std::make_unique<Tacotron2>();
else if (Tex2MelArch == EText2MelModel::FastSpeech2)
MelPredictor = std::make_unique<FastSpeech2>();
else if (Tex2MelArch == EText2MelModel::VITS)
MelPredictor = std::make_unique<VITS>();
else if (Tex2MelArch == EText2MelModel::DEVITS)
MelPredictor = std::make_unique<DEVITS>();
else if (Tex2MelArch == EText2MelModel::VITSEvo)
MelPredictor = std::make_unique<VITSEvo>();
else if (Tex2MelArch == EText2MelModel::Supertonic)
MelPredictor = std::make_unique<Supertonic>();
else
MelPredictor = std::make_unique<Tacotron2Torch>();
std::string MelPredInit = VoxPath + "/melgen";
if (IsVITS)
MelPredInit = VoxPath + "/vits.pt";
if (Tex2MelArch == EText2MelModel::Tacotron2Torch)
MelPredInit = VoxPath + "/tacotron2.pt";
else if (Tex2MelArch == EText2MelModel::VITSEvo)
MelPredInit = VoxPath + "/vits.onnx";
else if (Tex2MelArch == EText2MelModel::Supertonic)
MelPredInit = VoxPath + "/onnx";
MelPredictor->Initialize(MelPredInit,(ETTSRepo::Enum)VoxInfo.Architecture.Repo);
if (auto* OnnxMelPredictor = dynamic_cast<ONNXModel*>(MelPredictor.get())) {
MelPredictorIsGPU = OnnxMelPredictor->IsGPUDevice();
MelPredictorDeviceName = OnnxMelPredictor->GetDeviceName();
} else {
MelPredictorIsGPU = false;
MelPredictorDeviceName = L"CPU";
}
if (Tex2MelArch == EText2MelModel::DEVITS){
Moji.Initialize(VoxPath + "/moji.pt", VoxPath + "/tm_dict.txt");
BertFE.Initialize(VoxPath + "/bert.pt", VoxPath + "/bert_vocab.txt");
}
const int32_t VocoderArch = VoxInfo.Architecture.Vocoder;
if (VocoderArch == EVocoderModel::iSTFTNet)
Vocoder = std::make_unique<iSTFTNetTorch>();
else if (VocoderArch == EVocoderModel::NullVocoder)
Vocoder = nullptr;
else if (VocoderArch == EVocoderModel::SupertonicVocoder)
Vocoder = std::make_unique<SupertonicVocoder>();
else
Vocoder = std::make_unique<MultiBandMelGAN>();
if (Vocoder.get())
{
Vocoder.get()->Initialize(VoxPath + "/vocoder");
}
if (InPhn)
Processor.Initialize(InPhn);
if (Tex2MelArch == EText2MelModel::Supertonic){
Supertonic_Processor = std::make_unique<SupertonicTextProcessor>(VoxPath + "/unicode_indexer.json");
}
Name = inName;
ReadPhonemes(VoxPath + "/phonemes.txt");
ReadSpeakers(VoxPath + "/speakers.txt");
ReadEmotions(VoxPath + "/emotions.txt");
}
void Voice::AddPhonemizer(Phonemizer *InPhn,ESpeakPhonemizer* InENGPhn)
{
Processor.Initialize(InPhn,InENGPhn);
Processor.GetTokenizer().SetNumberText(NumTxt,VoxCommon::CommonLangConst);
}
void Voice::LoadNumberText(const std::string &NumTxtPath)
{
NumTxt.load(VoxCommon::CommonLangConst,NumTxtPath);
}
std::string Voice::PhonemizeStr(const std::string &Prompt)
{
return Processor.ProcessTextPhonetic(Prompt,Phonemes,CurrentDict,
(ETTSLanguageType::Enum)VoxInfo.LangType,
true); // default voxistac to true to preserve punctuation.
}
std::vector<int32_t> Voice::GetText(const int32_t &Text2MelN, bool &VoxIsTac,
std::string &PromptToFeed) {
std::vector<int32_t> InputIDs;
std::string PhoneticTxt = Processor.ProcessTextPhonetic(
PromptToFeed, Phonemes, CurrentDict,
(ETTSLanguageType::Enum)VoxInfo.LangType, VoxIsTac);
if (Text2MelN == EText2MelModel::Tacotron2Torch)
PhoneticTxt += VoxInfo.EndPadding;
if (VoxInfo.LangType == ETTSLanguageType::Char) {
InputIDs = CharsToID(PhoneticTxt);
if (VoxInfo.EndPadding.size())
InputIDs.push_back(std::stoi(VoxInfo.EndPadding));
} else {
if (VoxInfo.LangType == ETTSLanguageType::IPA)
InputIDs = CharsToID(PhoneticTxt);
else
InputIDs = PhonemesToID(PhoneticTxt);
}
return InputIDs;
}
VoxResults Voice::Vocalize(const std::string &Prompt, float Speed,
int32_t SpeakerID, float Energy, float F0,
int32_t EmotionID, const std::string &EmotionOvr) {
const int32_t Text2MelN = VoxInfo.Architecture.Text2Mel;
bool VoxIsTac = Text2MelN != EText2MelModel::FastSpeech2;
std::string PromptToFeed = Prompt;
if (VoxInfo.LangType != ETTSLanguageType::Char &&
Text2MelN != EText2MelModel::Tacotron2Torch)
PromptToFeed += VoxInfo.EndPadding;
// if (Text2MelN == EText2MelModel::Supertonic)
// PromptToFeed = "<en>" + PromptToFeed + "</en>";
std::vector<int32_t> InputIDs;
TFTensor<float> Mel;
TFTensor<float> Attention;
if (Text2MelN == EText2MelModel::Supertonic)
{
std::vector<std::u32string> Texts = {VoxUtil::StrToU32(Prompt)};
std::vector<std::string> Langs = {"en"};
auto Process_Result = Supertonic_Processor->Process(Texts, Langs);
std::vector<int64_t>& Ids_Pre = Process_Result.text_ids[0];
InputIDs.reserve(Ids_Pre.size());
for (auto id : Ids_Pre){
InputIDs.push_back((int32_t)id);
}
}
if (!InputIDs.size())
InputIDs = GetText(Text2MelN, VoxIsTac, PromptToFeed);
std::vector<float> FloatArgs;
std::vector<int32_t> IntArgs;
if (Text2MelN == EText2MelModel::Tacotron2)
{
Mel = ((Tacotron2*)MelPredictor.get())->DoInference(InputIDs,FloatArgs,IntArgs,SpeakerID, EmotionID);
Attention = ((Tacotron2*)MelPredictor.get())->Attention;
}
else if (Text2MelN == EText2MelModel::Tacotron2Torch)
{
Mel = MelPredictor.get()->DoInference(InputIDs,FloatArgs,IntArgs,SpeakerID, EmotionID);
Attention = ((Tacotron2Torch*)MelPredictor.get())->Attention;
}
else if (Text2MelN == EText2MelModel::FastSpeech2)
{
FloatArgs = {Speed,Energy,F0};
Mel = ((FastSpeech2*)MelPredictor.get())->DoInference(InputIDs,FloatArgs,IntArgs,SpeakerID, EmotionID);
}else if (Text2MelN == EText2MelModel::VITS)
{
FloatArgs = {Speed};
TFTensor<float> Audio = MelPredictor.get()->DoInference(InputIDs,FloatArgs,IntArgs,SpeakerID,EmotionID);
Attention = ((VITS*)MelPredictor.get())->Attention;
std::vector<float> AudioData = Audio.Data;
Mel.Shape.push_back(-1); // Tell the plotter that we have no mel to plot
// As VITS is fully E2E, we return here
return {AudioData,Attention,Mel};
}else if (Text2MelN == EText2MelModel::VITSEvo)
{
TFTensor<float> Audio = MelPredictor.get()->DoInference(InputIDs,FloatArgs,IntArgs,SpeakerID,EmotionID);
std::vector<float> AudioData = Audio.Data;
Mel.Shape.push_back(-1); // Tell the plotter that we have no mel to plot
// End 2 end. Return here.
return {AudioData,Attention,Mel};
}
else if (Text2MelN == EText2MelModel::Supertonic)
{
Mel = MelPredictor.get()->DoInference(InputIDs,{Speed},IntArgs,SpeakerID, EmotionID);
}
else // DE-VITS
{
FloatArgs = {Speed};
std::vector<std::string> MojiInput = Processor.GetTokenizer().Tokenize(EmotionOvr,true,true);
TFTensor<float> MojiStates = Moji.Infer(MojiInput);
auto BERTOutputs = BertFE.Infer(Prompt);
TFTensor<float> Audio = ((DEVITS*)MelPredictor.get())->DoInferenceDE(InputIDs, MojiStates,
BERTOutputs.first,FloatArgs,
IntArgs,SpeakerID,EmotionID);
Attention = ((VITS*)MelPredictor.get())->Attention;
std::vector<float> AudioData = Audio.Data;
Mel.Shape.push_back(-1); // Tell the plotter that we have no mel to plot
// As VITS is fully E2E, we return here
return {AudioData,Attention,Mel};
}
// Vocoder inference
TFTensor<float> AuData = Vocoder.get()->DoInference(Mel);
std::vector<float> AudioData;
if (AuData.Shape.size() > 1)
{
int64_t Width = AuData.Shape[0];
int64_t Height = AuData.Shape[1];
int64_t Depth = AuData.Shape[2];
//int z = 0;
AudioData.resize(Height);
// Code to access 1D array as if it were 3D
for (int64_t x = 0; x < Width;x++)
{
for (int64_t z = 0;z < Depth;z++)
{
for (int64_t y = 0; y < Height;y++) {
int64_t Index = x * Height * Depth + y * Depth + z;
AudioData[(size_t)y] = AuData.Data[(size_t)Index];
}
}
}
}
else
{
// Pre-flattened vocoder output
AudioData = AuData.Data;
}
if (!AudioData.size())
QMessageBox::critical(nullptr,"f","ss");
if (Text2MelN == EText2MelModel::Supertonic){
/*
* Supertonic doesn't return a mel spectrogram, but a latent
* We were using its return as Mel for convinience's sake so that it is fed right into the vocoder.
* But now we have to reset the Mel tensor, otherwise the rest of the program
* will see a non-empty tensor, think it's a spectrogram, and plot it (bad!)
*
*/
Mel = TFTensor<float>();
Mel.Shape.push_back(-1);
}
return {AudioData,Attention,Mel};
}
void Voice::SetDictEntries(const std::vector<DictEntry> &InEntries)
{
for (const DictEntry& Entr : InEntries)
{
if (Entr.Language != VoxInfo.s_Language_Fullname)
continue;
CurrentDict.push_back(Entr);
}
}
Voice::~Voice()
{
}
================================================
FILE: Voice.h
================================================
#pragma once
#include "FastSpeech2.h"
#include "tacotron2.h"
#include "MultiBandMelGAN.h"
#include "EnglishPhoneticProcessor.h"
#include "vits.h"
#include "Numbertext.hxx"
#include "torchmoji.h"
#include "phoneticdict.h"
#include "tacotron2torch.h"
#include "istftnettorch.h"
#include "devits.h"
#include "bert.h"
#include "VITSEvo.h"
#include "Supertonic.h"
#include "SupertonicVocoder.h"
#include "SupertonicTextProcessor.h"
struct VoxResults{
std::vector<float> Audio;
TFTensor<float> Alignment;
TFTensor<float> Mel;
};
class Voice
{
private:
std::unique_ptr<MelGen> MelPredictor;
std::unique_ptr<MultiBandMelGAN> Vocoder;
std::unique_ptr<SupertonicTextProcessor> Supertonic_Processor;
EnglishPhoneticProcessor Processor;
VoiceInfo VoxInfo;
bool MelPredictorIsGPU;
std::wstring MelPredictorDeviceName;
TorchMoji Moji;
BERT BertFE;
std::vector<std::u32string> Phonemes;
std::vector<int32_t> PhonemeIDs;
std::vector<int32_t> PhonemesToID(const std::string& RawInTxt);
std::vector<std::string> Speakers;
std::vector<std::string> Emotions;
void ReadPhonemes(const std::string& PhonemePath);
void ReadSpeakers(const std::string& SpeakerPath);
void ReadEmotions(const std::string& EmotionPath);
void ReadModelInfo(const std::string& ModelInfoPath);
std::vector<DictEntry> CurrentDict;
std::string ModelInfo;
std::vector<int32_t> CharsToID(const std::string &RawInTxt);
Numbertext NumTxt;
public:
/* Voice constructor, arguments obligatory.
-> VoxPath: Path of folder where models are contained.
-- Must be a folder without an ending slash with UNIX slashes, can be relative or absolute (eg: MyVoices/Karen)
-- The folder must contain the following elements:
--- melgen: Folder generated where a FastSpeech2 model was saved as SavedModel, with .pb, variables, etc
--- vocoder: Folder where a Multi-Band MelGAN model was saved as SavedModel.
--- info.json: Model information
--- phonemes.txt: Tab delimited file containing PHONEME \t ID, for inputting to the FS2 model.
--- If multispeaker, a lined .txt file called speakers.txt
--- If multi-emotion, a lined .txt file called emotions.txt
*/
Voice(const std::string& VoxPath, const std::string& inName,Phonemizer* InPhn);
void AddPhonemizer(Phonemizer* InPhn, ESpeakPhonemizer *InENGPhn);
void LoadNumberText(const std::string& NumTxtPath);
std::string PhonemizeStr(const std::string& Prompt);
std::vector<int32_t> GetText(const int32_t &Text2MelN, bool &VoxIsTac,
std::string &PromptToFeed);
VoxResults Vocalize(const std::string &Prompt, float Speed = 1.f,
int32_t SpeakerID = 0, float Energy = 1.f,
float F0 = 1.f, int32_t EmotionID = -1,
const std::string &EmotionOvr = "");
std::string Name;
inline const VoiceInfo& GetInfo(){return VoxInfo;}
inline bool IsMelPredictorGPU() const { return MelPredictorIsGPU; }
inline const std::wstring& GetMelPredictorDeviceName() const { return MelPredictorDeviceName; }
inline const std::vector<std::string>& GetSpeakers(){return Speakers;}
inline const std::vector<std::string>& GetEmotions(){return Emotions;}
void SetDictEntries(const std::vector<DictEntry>& InEntries);
inline const std::string& GetModelInfo(){return ModelInfo;}
~Voice();
};
================================================
FILE: VoxCommon.cpp
================================================
#include "VoxCommon.hpp"
#include "ext/json.hpp"
using namespace nlohmann;
#include <codecvt>
#include <locale> // std::wstring_convert
const std::vector<std::string> Text2MelNames = {"FastSpeech2","Tacotron2 (TF)","VITS","DE-VITS","Tacotron2 (Torch)", "VITS EVO", "Supertonic"};
const std::vector<std::string> VocoderNames = {"Multi-Band MelGAN","MelGAN-STFT","","iSTFTNet", "Supertonic Vocoder"};
const std::vector<std::string> RepoNames = {"TensorflowTTS","Coqui-TTS","jaywalnut310","keonlee9420", "ZDisket", "Supertone"};
const std::vector<std::string> LanguageNames = {"English","Spanish", "German", "EnglishIPA"};
const std::vector<std::string> LangaugeNamesNumToWords = {"en", "es","de","en"};
#include "ext/ZCharScanner.h"
const std::map<int32_t,std::string> LegacyToV1Lang = {
{-3,"German-Char"},
{0,"English-ARPA"},
{-1,"English-Char"},
{3,"English-IPA"},
{1,"Spanish-GlobalPhone"}
};
const std::map<std::string,int32_t> V1LangTypes ={
{"IPA",ETTSLanguageType::IPA},
{"IPAStressed",ETTSLanguageType::IPA},
{"ARPA",ETTSLanguageType::ARPA},
{"Char",ETTSLanguageType::Char},
{"GlobalPhone",ETTSLanguageType::GlobalPhone}
};
void VoxUtil::ExportWAV(const std::string & Filename, const std::vector<float>& Data, unsigned SampleRate) {
AudioFile<float>::AudioBuffer Buffer;
Buffer.resize(1);
Buffer[0] = Data;
size_t BufSz = Data.size();
AudioFile<float> File;
File.setAudioBuffer(Buffer);
File.setAudioBufferSize(1, (int)BufSz);
File.setNumSamplesPerChannel((int)BufSz);
File.setNumChannels(1);
File.setBitDepth(32);
File.setSampleRate(SampleRate);
File.save(Filename, AudioFileFormat::Wave);
}
// Process language value for vector indexes. Language value must adhere to standard.
uint32_t ProcessLanguageValue(int32_t LangVal)
{
if (LangVal > -1)
return LangVal;
if (LangVal == -1)
return 0;
if (LangVal < 0)
return (LangVal * -1) - 1;
return LangVal;
}
VoiceInfo VoxUtil::ReadModelJSON(const std::string &InfoFilename)
{
const size_t MaxNoteSize = 80;
std::ifstream JFile(InfoFilename);
json JS;
try {
JFile >> JS;
} catch(json::parse_error Err) {
QMessageBox::critical(nullptr,"JSON parse error",QString::fromUtf8(Err.what()));
}
JFile.close();
auto Arch = JS["architecture"];
ArchitectureInfo CuArch;
CuArch.Repo = Arch["repo"].get<int>();
CuArch.Text2Mel = Arch["text2mel"].get<int>();
CuArch.Vocoder = Arch["vocoder"].get<int>();
// Now fill the strings
CuArch.s_Repo = RepoNames[CuArch.Repo];
CuArch.s_Text2Mel = Text2MelNames[CuArch.Text2Mel];
CuArch.s_Vocoder = VocoderNames[CuArch.Vocoder];
// Language value for the info
auto LangVal = JS["language"];
std::string LanguageFullName;
if (LangVal.is_string()){ // V1 Language type standard model; see ETTSLanguageType enum desc on header
LanguageFullName = LangVal.get<std::string>();
}else{
// Convert legacy language to V1
int32_t LegacyLang = JS["language"].get<int32_t>();
LanguageFullName = LegacyToV1Lang.find(LegacyLang)->second;
}
ZStringDelimiter LangDel(LanguageFullName);
LangDel.AddDelimiter("-");
std::string LangName = LangDel[0];
std::string LangTypeStr = LangDel[1];
std::string eSpeakLangStr = "";
if (LangDel.szTokens() > 2)
{
eSpeakLangStr = LangDel[2];
LanguageFullName = LangDel[0] + "-" + LangDel[1];
}
int32_t LangType = V1LangTypes.find(LangTypeStr)->second;
// If the voice is char then the pad value must be a string of the EOS token ID (like "148").
std::string EndToken = JS["pad"].get<std::string>();
// If it's phonetic then it's the token str, like "@EOS"
if (LangType != ETTSLanguageType::Char && EndToken.size() && CuArch.Text2Mel != EText2MelModel::Tacotron2Torch)
EndToken = " " + EndToken; // In this case we add a space for separation since we directly append the value to the prompt
VoiceInfo Inf{JS["name"].get<std::string>(),
JS["author"].get<std::string>(),
JS["version"].get<int>(),
JS["description"].get<std::string>(),
CuArch,
JS["note"].get<std::string>(),
JS["sarate"].get<uint32_t>(),
LangName,
LanguageFullName,
eSpeakLangStr,
EndToken,
LangType
};
if (Inf.Note.size() > MaxNoteSize)
Inf.Note = Inf.Note.substr(0,MaxNoteSize);
return Inf;
}
std::vector<std::string> VoxUtil::GetLinedFile(const std::string &Path)
{
std::vector<std::string> RetLines;
std::ifstream Fi(Path);
if (!Fi.good()) // File not exists, ret empty vec
return RetLines;
std::string Line;
while (std::getline(Fi, Line))
{
if (Line.size() > 1)
RetLines.push_back(Line);
}
return RetLines;
}
std::string VoxUtil::U32ToStr(const std::u32string &InU32)
{
std::wstring_convert<std::codecvt_utf8<char32_t>,char32_t> Converter;
return Converter.to_bytes(InU32);
}
std::u32string VoxUtil::StrToU32(const std::string &InStr)
{
std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> Converter;
return Converter.from_bytes(InStr);
}
================================================
FILE: VoxCommon.hpp
================================================
#pragma once
/*
VoxCommon.hpp : Defines common data structures and constants to be used with TensorVox
*/
#include <iostream>
#undef slots // https://github.com/pytorch/pytorch/issues/19405
#pragma warning(push, 0) // LibTorch spams us with warnings
#include <torch/script.h> // One-stop header.
#pragma warning(pop)
#define slots Q_SLOTS
#include <vector>
#include "ext/AudioFile.hpp"
#include "ext/CppFlow/ops.h"
#include "ext/CppFlow/model.h"
#include <QMessageBox>
#define IF_RETURN(cond,ret) if (cond){return ret;}
const uint32_t CommonSampleRate = 48000;
namespace VoxCommon{
const std::string CommonLangConst = "_std";
const int32_t TorchMojiLen = 120;
const int32_t TorchMojiEmbSize = 2304;
}
// https://github.com/almogh52/rnnoise-cmake/blob/d981adb2e797216f456cfcf158f73761a29981f8/examples/rnnoise_demo.c#L31
const uint32_t RNNoiseFrameSize = 480;
typedef std::vector<std::tuple<std::string,cppflow::tensor>> TensorVec;
template<typename T>
struct TFTensor {
std::vector<T> Data;
std::vector<int64_t> Shape;
size_t TotalSize;
};
namespace ETTSRepo {
enum Enum{
TensorflowTTS = 0,
CoquiTTS,
jaywalnut310, // OG VITS repo
keonlee9420,
ZDisket,
Supertone
};
}
namespace EText2MelModel {
enum Enum{
FastSpeech2 = 0,
Tacotron2,
VITS,
DEVITS,
Tacotron2Torch,
VITSEvo,
Supertonic
};
}
namespace EVocoderModel{
enum Enum{
MultiBandMelGAN = 0,
MelGANSTFT, // there is no architectural changes so we can use mb-melgan class for melgan-stft
NullVocoder, // For fully E2E models
iSTFTNet,
SupertonicVocoder
};
}
// ===========DEPRECATED===============
// Negative numbers denote character-based language, positive for phoneme based. Standard is char-equivalent language idx = negative(phn-based)
// In case of English, since -0 doesn't exist, we use -1.
// For example, German phonetic would be 3, and character based would be -3
// IPA-phn-based are mainly for Coqui
// ===========DEPRECATED===============
namespace ETTSLanguage{
enum Enum{
GermanChar = -3,
SpanishChar,
EnglishChar,
EnglishPhn,
SpanishPhn,
GermanPhn,
EnglishIPA,
};
}
/* Language Spec Standard V1:
- Language is specified with a string from the JSON and the type is saved instead of relying
on ETTSLanguage enum.
-- The string is LanguageName-Method; for example English-StressedIPA, English-ARPA, German-Char
- Both pre-V1 standard and current are supported
- V1 Standard does not require changes in code to add new languages
-- For eSpeak phonemizers, an additional entry is added with the language name: English-StressedIPA-English (America)
*/
namespace ETTSLanguageType{
enum Enum{
ARPA = 0,
Char,
IPA,
GlobalPhone
};
}
struct ArchitectureInfo{
int Repo;
int Text2Mel;
int Vocoder;
// String versions of the info, for displaying.
// We want boilerplate int index to str conversion code to be low.
std::string s_Repo;
std::string s_Text2Mel;
std::string s_Vocoder;
};
struct VoiceInfo{
std::string Name;
std::string Author;
int32_t Version;
std::string Description;
ArchitectureInfo Architecture;
std::string Note;
uint32_t SampleRate;
std::string s_Language; // Language name = English-ARPA -> "English"
std::string s_Language_Fullname; // Full language name = "English-ARPA"
std::string s_eSpeakLang; // eSpeak voice name: "English (America)"
std::string EndPadding;
int32_t LangType;
};
namespace VoxUtil {
std::string U32ToStr(const std::u32string& InU32);
std::u32string StrToU32(const std::string& InStr);
std::vector<std::string> GetLinedFile(const std::string& Path);
VoiceInfo ReadModelJSON(const std::string& InfoFilename);
// Copy PyTorch tensor
template<typename D>
TFTensor<D> CopyTensor(const at::Tensor& InTens){
D* Data = InTens.data<D>();
std::vector<int64_t> Shape = InTens.sizes().vec();
size_t TotalSize = 1;
for (const int64_t& Dim : Shape)
TotalSize *= Dim;
std::vector<D> DataVec = std::vector<D>(Data,Data + TotalSize);
return TFTensor<D>{DataVec,Shape,TotalSize};
}
// Copy CppFlow (TF) tensor
template<typename F>
TFTensor<F> CopyTensor(cppflow::tensor& InTens)
{
std::vector<F> Data = InTens.get_data<F>();
std::vector<int64_t> Shape = InTens.shape().get_data<int64_t>();
size_t TotalSize = 1;
for (const int64_t& Dim : Shape)
TotalSize *= Dim;
return TFTensor<F>{Data, Shape, TotalSize};
}
template<typename VXVec1>
bool FindInVec(VXVec1 In, const std::vector<VXVec1>& Vec, size_t& OutIdx, size_t start = 0) {
for (size_t xx = start;xx < Vec.size();xx++)
{
if (Vec[xx] == In) {
OutIdx = xx;
return true;
}
}
return false;
}
template<typename VXVec1, typename X>
bool FindInVec2(VXVec1 In, const std::vector<X>& Vec, size_t& OutIdx, size_t start = 0) {
for (size_t xx = start;xx < Vec.size();xx++)
{
if (Vec[xx] == In) {
OutIdx = xx;
return true;
}
}
return false;
}
void ExportWAV(const std::string& Filename, const std::vector<float>& Data, unsigned SampleRate);
}
================================================
FILE: attention.cpp
================================================
#include "attention.h"
Attention::Attention(QWidget *parent) : QCustomPlot(parent)
{
QBrush FillBrush(QColor(100,100,100));
this->setBackground(FillBrush);
QColor White(255,255,255);
QPen AxisPen(QColor(150,150,150));
xAxis->setTickLabelColor(White);
yAxis->setTickLabelColor(White);
xAxis->setBasePen(AxisPen);
yAxis->setBasePen(AxisPen);
xAxis->setLabel("Decoder timestep");
yAxis->setLabel("Encoder timestep");
xAxis->setLabelColor(White);
yAxis->setLabelColor(White);
QFont Fnt = QFont(font().family(), 10);
xAxis->setLabelFont(QFont(font().family(), 9));
yAxis->setLabelFont(QFont(font().family(), 9));
yAxis->setTickPen(AxisPen);
xAxis->setTickPen(AxisPen);
yAxis->setSubTickPen(AxisPen);
xAxis->setSubTickPen(AxisPen);
}
void Attention::DoPlot(const TFTensor<float> &Alignment)
{
const auto& Shp = Alignment.Shape;
Map->data()->setSize((int32_t)Shp[2],(int32_t)Shp[1]);
Map->data()->setRange(QCPRange(0.0,(double)Shp[2]),QCPRange(0.0,(double)Shp[1]));
for (int64_t x = 0; x < Shp[2];x++)
{
for (int64_t y = 0;y < Shp[1];y++)
{
size_t i = x + Shp[2]*y;
Map->data()->setCell(x,y,(double)Alignment.Data[i]);
}
}
Map->setDataRange(QCPRange(0.0,1.0));
xAxis->setRange(QCPRange(0.0,(double)Shp[2]));
yAxis->setRange(QCPRange(0.0,(double)Shp[1]));
rescaleAxes();
replot();
}
================================================
FILE: attention.h
================================================
#ifndef ATTENTION_H
#define ATTENTION_H
#include "ext/qcustomplot.h"
#include "VoxCommon.hpp"
class Attention : public QCustomPlot
{
public:
Attention(QWidget *parent = nullptr);
void DoPlot(const TFTensor<float>& Alignment);
QCPColorMap* Map;
};
#endif // ATTENTION_H
================================================
FILE: batchdenoisedlg.cpp
================================================
#include "batchdenoisedlg.h"
#include "ui_batchdenoisedlg.h"
#include <QFileDialog>
#include <QDir>
#include <QDirIterator>
#include "mainwindow.h"
#define ManWi ((MainWindow*)pMainWindow)
BatchDenoiseDlg::BatchDenoiseDlg(QWidget *parent) :
QDialog(parent),
ui(new Ui::BatchDenoiseDlg)
{
ui->setupUi(this);
ProcessedFiles = 0;
CurrentIndex = 0;
Failures = 0;
}
// can't define in header because InferDetails belongs to mainwindow.h and including it in this dlg's .h would case circular dependency error
InferDetails MakeInferDetails(const std::vector<float>& InAudat,const QString& FilePath,unsigned InSampleRate,int32_t OutSampleRate)
{
InferDetails Dets;
Dets.F0 = 0.0f;
Dets.Speed = 0.0f;
Dets.Energy = 0.0f;
Dets.pItem = nullptr; // the mainwindow's function will make an item for us.
Dets.Prompt = "";
Dets.SpeakerID = OutSampleRate; // SpeakerID will double as resample when a denoise only job is requested.
Dets.EmotionID = -1;
Dets.Denoise = true;
Dets.Amplification = 1.f;
Dets.ExportFileName = FilePath;
Dets.VoiceName = "";
Dets.ForcedAudio = InAudat;
Dets.SampleRate = InSampleRate;
return Dets;
}
BatchDenoiseDlg::~BatchDenoiseDlg()
{
delete ui;
}
void BatchDenoiseDlg::IterateDo()
{
if (ProcessedFiles == Files.size() && ManWi->GetCountItems() == 0)
{
// It's done!
delete timIter;
SetControls(true);
return;
}
if (ManWi->GetCountItems() != 0)
return;
ManWi->DenBatchSize = ui->spbBatchSz->value();
ManWi->DenDone = 0;
if (CurrentIndex + ui->spbBatchSz->value() > Files.size())
ManWi->DenBatchSize = Files.size() - CurrentIndex;
for (int32_t i = 0;i < ui->spbBatchSz->value();i++)
{
QString CurrentFn = Files[CurrentIndex];
AudioFile<float> AudFile;
InferDetails CurrentDets;
bool SkipCurrent = false;
try {
AudFile.load(CurrentFn.toStdString());
if ( (ui->chkExcludeAlreadySR->isChecked() && AudFile.getSampleRate() == (uint32_t)ui->spbOutSR->value()) || AudFile.getLengthInSeconds() < 1.0)
SkipCurrent = true;
else
CurrentDets = MakeInferDetails(AudFile.samples[0],CurrentFn,AudFile.getSampleRate(),ui->spbOutSR->value());
} catch (...) {
CurrentIndex += 1; // NOT i !!!!!!!
ProcessedFiles += 1;
++Failures;
if (CurrentIndex > Files.size() - 1)
break;
continue;
}
if (!SkipCurrent)
ManWi->PushToInfers(CurrentDets);
else
ManWi->DenBatchSize -= 1; // Indicate to the auto clear that we will send less files
CurrentIndex += 1; // NOT i !!!!!!!
ProcessedFiles += 1;
if (CurrentIndex > Files.size() - 1)
break;
}
SetLabel();
}
void BatchDenoiseDlg::on_btnFindFolder_clicked()
{
QString Dir = QFileDialog::getExistingDirectory(this, tr("Find base folder of your WAVs"),
"",
QFileDialog::ShowDirsOnly
| QFileDialog::DontResolveSymlinks);
ui->edtFolPath->setText(Dir);
UpdateDirectory();
}
void BatchDenoiseDlg::on_edtFolPath_editingFinished()
{
UpdateDirectory();
}
void BatchDenoiseDlg::SetLabel()
{
ui->lblFiles->setText(QString(QString::number(ProcessedFiles) + " / " + QString::number(Files.size()) + " files, " + QString::number(Failures) + " failures.") );
ui->pgFiles->setValue(ProcessedFiles);
ui->pgFiles->update();
}
void BatchDenoiseDlg::UpdateDirectory()
{
if (ui->edtFolPath->text().isEmpty())
return;
if (Files.size())
Files.clear();
QDirIterator DirIt(ui->edtFolPath->text(),QDirIterator::Subdirectories);
while (DirIt.hasNext())
{
DirIt.next();
if (QFileInfo(DirIt.filePath()).isFile() && QFileInfo(DirIt.filePath()).suffix() == "wav")
Files.push_back(DirIt.filePath());
}
CurrentIndex = 0;
ProcessedFiles = 0;
Failures = 0;
ui->pgFiles->setRange(0,Files.size());
SetLabel();
}
void BatchDenoiseDlg::on_btnStart_clicked()
{
CurrentIndex = 0;
ProcessedFiles = 0;
Failures = 0;
ManWi->DenBatchSize = ui->spbBatchSz->value();
timIter = new QTimer(this);
timIter->setSingleShot(false);
timIter->setInterval(1000);
connect(timIter,&QTimer::timeout,this,&BatchDenoiseDlg::IterateDo);
timIter->start();
SetControls(false);
}
void BatchDenoiseDlg::SetControls(bool En)
{
ui->edtFolPath->setEnabled(En);
ui->spbBatchSz->setEnabled(En);
ui->btnStart->setEnabled(En);
ui->btnFindFolder->setEnabled(En);
}
================================================
FILE: batchdenoisedlg.h
================================================
#ifndef BATCHDENOISEDLG_H
#define BATCHDENOISEDLG_H
#include <QDialog>
#include <QTimer>
namespace Ui {
class BatchDenoiseDlg;
}
class BatchDenoiseDlg : public QDialog
{
Q_OBJECT
public:
explicit BatchDenoiseDlg(QWidget *parent = nullptr);
~BatchDenoiseDlg();
// if we included mainwindow.h in here it would result in circular dependency problem so we include it in the .cpp
// and make it a void* here
void* pMainWindow;
private slots:
void IterateDo();
void on_btnFindFolder_clicked();
void on_edtFolPath_editingFinished();
void on_btnStart_clicked();
private:
void SetControls(bool En);
QStringList Files;
QTimer* timIter;
int32_t ProcessedFiles;
int32_t CurrentIndex;
int32_t Failures;
void SetLabel();
void UpdateDirectory();
Ui::BatchDenoiseDlg *ui;
};
#endif // BATCHDENOISEDLG_H
================================================
FILE: batchdenoisedlg.ui
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>BatchDenoiseDlg</class>
<widget class="QDialog" name="BatchDenoiseDlg">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>737</width>
<height>403</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Folder Path</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="edtFolPath"/>
</item>
<item>
<widget class="QPushButton" name="btnFindFolder">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Batch size:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spbBatchSz">
<property name="maximum">
<number>16384</number>
</property>
<property name="singleStep">
<number>32</number>
</property>
<property name="value">
<number>4096</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Output sampling rate (Hz): </string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spbOutSR">
<property name="maximum">
<number>96000</number>
</property>
<property name="singleStep">
<number>8000</number>
</property>
<property name="value">
<number>48000</number>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkExcludeAlreadySR">
<property name="text">
<string>Exclude already SR matching</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string><html><head/><body><p>Note: Will find all WAVs, recursive (folders and subfolders), and REPLACE FILES. If you don't want it to do that, make a copy first. Treats all files as mono.</p><p>Note 2: Files are resampled on input and output accordingly</p></body></html></string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblFiles">
<property name="text">
<string>Files: 0 / 0</string>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="pgFiles">
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnStart">
<property name="text">
<string>Start</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
================================================
FILE: bert.cpp
================================================
#include "bert.h"
#include <windows.h>
BERT::BERT()
{
}
BERT::BERT(const std::string &Path, const std::string &DictPath)
{
Initialize(Path, DictPath);
}
void BERT::Initialize(const std::string &Path, const std::string &DictPath)
{
Model = torch::jit::load(Path);
Tokenizer = std::make_unique<FullTokenizer>(DictPath,true);
}
std::pair<TFTensor<float>, TFTensor<float> > BERT::Infer(const std::string &InText)
{
torch::NoGradGuard no_grad;
auto Tokens = Tokenizer->tokenize(InText + "\n");
auto Ids = Tokenizer->convertTokensToIds(Tokens);
std::vector<int32_t> InTokens(Ids.begin(),Ids.end());
auto InIDS = torch::tensor(InTokens).unsqueeze(0); // (1, tokens)
std::pair<TFTensor<float>,TFTensor<float>> BERTOutputs;
try{
auto Output = Model({InIDS}).toTuple(); // (hidden states, pooled)
BERTOutputs.first = VoxUtil::CopyTensor<float>(Output.get()->elements()[0].toTensor());
BERTOutputs.second = VoxUtil::CopyTensor<float>(Output.get()->elements()[1].toTensor());
}
catch (const std::exception& e) {
int msgboxID = MessageBox(
NULL,
(LPCWSTR)QString::fromStdString(e.what()).toStdWString().c_str(),
(LPCWSTR)L"Error1!!",
MB_ICONWARNING | MB_CANCELTRYCONTINUE | MB_DEFBUTTON2
);
return BERTOutputs;
}
return BERTOutputs;
}
================================================
FILE: bert.h
================================================
#ifndef BERT_H
#define BERT_H
#include "VoxCommon.hpp"
#include "berttokenizer.h"
// BERT: Class for inference of TorchScript-exported BERT.
class BERT
{
private:
torch::jit::script::Module Model;
std::unique_ptr<FullTokenizer> Tokenizer;
public:
BERT();
BERT(const std::string& Path,const std::string& DictPath);
void Initialize(const std::string& Path,const std::string& DictPath);
// Do inference on BERT model.
// Returns 2 tensors:
// [1, tokens, channels] : Hidden states
// [1, channels] : Pooled embeddings
std::pair<TFTensor<float>,TFTensor<float>> Infer(const std::string& InText);
};
#endif // BERT_H
================================================
FILE: berttokenizer.cpp
================================================
#include "berttokenizer.h"
const std::wstring stripChar = L" \t\n\r\v\f";
#include "utf8proc.h"
#include "ext/ZCharScannerWide.h"
const std::vector<std::wstring> sDelimChar = {L" ",L"\t",L"\n",L"\r",L"\v",L"\f"};
static std::string normalize_nfd(const std::string& s) {
std::string ret;
char *result = (char *) utf8proc_NFD((unsigned char *)s.c_str());
if (result) {
ret = std::string(result);
free(result);
result = NULL;
}
return ret;
}
static bool isStripChar(const wchar_t& ch) {
return stripChar.find(ch) != std::wstring::npos;
}
static std::wstring strip(const std::wstring& text) {
std::wstring ret = text;
if (ret.empty()) return ret;
size_t pos = 0;
while (pos < ret.size() && isStripChar(ret[pos])) pos++;
if (pos != 0) ret = ret.substr(pos, ret.size() - pos);
pos = ret.size() - 1;
while (pos != (size_t)-1 && isStripChar(ret[pos])) pos--;
return ret.substr(0, pos + 1);
}
static std::vector<std::wstring> split(const std::wstring& text) {
std::vector<std::wstring> result;
ZStringDelimiterWide Del(text);
Del.AddDelimiter(L" ");
result = Del.GetTokens();
if (!result.size())
result.push_back(text); //
return result;
}
static std::vector<std::wstring> whitespaceTokenize(const std::wstring& text) {
std::wstring rtext = strip(text);
if (rtext.empty()) return std::vector<std::wstring>();
return split(text);
}
static std::wstring convertToUnicode(const std::string& text) {
size_t i = 0;
std::wstring ret;
while (i < text.size()) {
wchar_t codepoint;
utf8proc_ssize_t forward = utf8proc_iterate((utf8proc_uint8_t *)&text[i], text.size() - i, (utf8proc_int32_t*)&codepoint);
if (forward < 0) return L"";
ret += codepoint;
i += forward;
}
return ret;
}
static std::string convertFromUnicode(const std::wstring& wText) {
char dst[64];
std::string ret;
for (auto ch : wText) {
utf8proc_ssize_t num = utf8proc_encode_char(ch, (utf8proc_uint8_t *)dst);
if (num <= 0) return "";
ret += std::string(dst, dst+num);
}
return ret;
}
static std::wstring tolower(const std::wstring& s) {
std::wstring ret(s.size(), L' ');
for (size_t i = 0; i < s.size(); i++) {
ret[i] = utf8proc_tolower(s[i]);
}
return ret;
}
static std::shared_ptr<Vocab> loadVocab(const std::string& vocabFile) {
std::shared_ptr<Vocab> vocab(new Vocab);
size_t index = 0;
std::ifstream ifs(vocabFile, std::ifstream::in);
std::string line;
while (getline(ifs, line)) {
std::wstring token = convertToUnicode(line);
if (token.empty()) break;
token = strip(token);
(*vocab)[token] = index;
index++;
}
return vocab;
}
BasicTokenizer::BasicTokenizer(bool doLowerCase)
: mDoLowerCase(doLowerCase) {
}
std::wstring BasicTokenizer::cleanText(const std::wstring& text) const {
std::wstring output;
for (const wchar_t& cp : text) {
if (cp == 0 || cp == 0xfffd || isControol(cp)) continue;
if (isWhitespace(cp)) output += L" ";
else output += cp;
}
return output;
}
bool BasicTokenizer::isControol(const wchar_t& ch) const {
if (ch== L'\t' || ch== L'\n' || ch== L'\r') return false;
auto cat = utf8proc_category(ch);
if (cat == UTF8PROC_CATEGORY_CC || cat == UTF8PROC_CATEGORY_CF) return true;
return false;
}
bool BasicTokenizer::isWhitespace(const wchar_t& ch) const {
if (ch== L' ' || ch== L'\t' || ch== L'\n' || ch== L'\r') return true;
auto cat = utf8proc_category(ch);
if (cat == UTF8PROC_CATEGORY_ZS) return true;
return false;
}
bool BasicTokenizer::isPunctuation(const wchar_t& ch) const {
if ((ch >= 33 && ch <= 47) || (ch >= 58 && ch <= 64) ||
(ch >= 91 && ch <= 96) || (ch >= 123 && ch <= 126)) return true;
auto cat = utf8proc_category(ch);
if (cat == UTF8PROC_CATEGORY_PD || cat == UTF8PROC_CATEGORY_PS
|| cat == UTF8PROC_CATEGORY_PE || cat == UTF8PROC_CATEGORY_PC
|| cat == UTF8PROC_CATEGORY_PO //sometimes ¶ belong SO
|| cat == UTF8PROC_CATEGORY_PI
|| cat == UTF8PROC_CATEGORY_PF) return true;
return false;
}
bool BasicTokenizer::isChineseChar(const wchar_t& ch) const {
if ((ch >= 0x4E00 && ch <= 0x9FFF) ||
(ch >= 0x3400 && ch <= 0x4DBF) ||
(ch >= 0x20000 && ch <= 0x2A6DF) ||
(ch >= 0x2A700 && ch <= 0x2B73F) ||
(ch >= 0x2B740 && ch <= 0x2B81F) ||
(ch >= 0x2B820 && ch <= 0x2CEAF) ||
(ch >= 0xF900 && ch <= 0xFAFF) ||
(ch >= 0x2F800 && ch <= 0x2FA1F))
return true;
return false;
}
std::wstring BasicTokenizer::tokenizeChineseChars(const std::wstring& text) const {
std::wstring output;
for (auto& ch : text) {
if (isChineseChar(ch)) {
output += L' ';
output += ch;
output += L' ';
}
else
output += ch;
}
return output;
}
std::wstring BasicTokenizer::runStripAccents(const std::wstring& text) const {
//Strips accents from a piece of text.
std::wstring nText;
try {
nText = convertToUnicode(normalize_nfd(convertFromUnicode(text)));
} catch (std::bad_cast& e) {
std::cerr << "bad_cast" << std::endl;
return L"";
}
std::wstring output;
for (auto& ch : nText) {
auto cat = utf8proc_category(ch);
if (cat == UTF8PROC_CATEGORY_MN) continue;
output += ch;
}
return output;
}
std::vector<std::wstring> BasicTokenizer::runSplitOnPunc(const std::wstring& text) const {
size_t i = 0;
bool startNewWord = true;
std::vector<std::wstring> output;
while (i < text.size()) {
wchar_t ch = text[i];
if (isPunctuation(ch)) {
output.push_back(std::wstring(&ch, 1));
startNewWord = true;
}
else {
if (startNewWord) output.push_back(std::wstring());
startNewWord = false;
output[output.size() - 1] += ch;
}
i++;
}
return output;
}
std::vector<std::wstring> BasicTokenizer::tokenize(const std::string& text) const {
std::wstring nText = convertToUnicode(text);
nText = cleanText(nText);
nText = tokenizeChineseChars(nText);
const std::vector<std::wstring>& origTokens = whitespaceTokenize(nText);
std::vector<std::wstring> splitTokens;
for (std::wstring token : origTokens) {
if (mDoLowerCase) {
token = tolower(token);
token = runStripAccents(token);
}
const auto& tokens = runSplitOnPunc(token);
splitTokens.insert(splitTokens.end(), tokens.begin(), tokens.end());
}
ZStringDelimiterWide DelRs;
std::wstring WSP = DelRs.Reassemble(L" ",splitTokens);
return whitespaceTokenize(WSP);
}
WordpieceTokenizer::WordpieceTokenizer(const std::shared_ptr<Vocab> vocab, const std::wstring& unkToken, size_t maxInputCharsPerWord)
: mVocab(vocab),
mUnkToken(unkToken),
mMaxInputCharsPerWord(maxInputCharsPerWord) {
}
std::vector<std::wstring> WordpieceTokenizer::tokenize(const std::wstring& text) const {
std::vector<std::wstring> outputTokens;
for (auto& token : whitespaceTokenize(text)) {
if (token.size() > mMaxInputCharsPerWord) {
outputTokens.push_back(mUnkToken);
}
bool isBad = false;
size_t start = 0;
std::vector<std::wstring> subTokens;
while (start < token.size()) {
size_t end = token.size();
std::wstring curSubstr;
bool hasCurSubstr = false;
while (start < end) {
std::wstring substr = token.substr(start, end - start);
if (start > 0) substr = L"##" + substr;
if (mVocab->find(substr) != mVocab->end()) {
curSubstr = substr;
hasCurSubstr = true;
break;
}
end--;
}
if (!hasCurSubstr) {
isBad = true;
break;
}
subTokens.push_back(curSubstr);
start = end;
}
if (isBad) outputTokens.push_back(mUnkToken);
else outputTokens.insert(outputTokens.end(), subTokens.begin(), subTokens.end());
}
return outputTokens;
}
FullTokenizer::FullTokenizer(const std::string& vocabFile, bool doLowerCase) :
mVocab(loadVocab(vocabFile)),
mBasicTokenizer(BasicTokenizer(doLowerCase)),
mWordpieceTokenizer(WordpieceTokenizer(mVocab)) {
for (auto& v : *mVocab) mInvVocab[v.second] = v.first;
}
std::vector<std::wstring> FullTokenizer::tokenize(const std::string& text) const {
std::vector<std::wstring> splitTokens;
for (auto& token : mBasicTokenizer.tokenize(text))
for (auto& subToken : mWordpieceTokenizer.tokenize(token))
splitTokens.push_back(subToken);
return splitTokens;
}
std::vector<size_t> FullTokenizer::convertTokensToIds(const std::vector<std::wstring>& text) const {
std::vector<size_t> ret(text.size());
for (size_t i = 0; i < text.size(); i++) {
ret[i] = (*mVocab)[text[i]];
}
return ret;
}
================================================
FILE: berttokenizer.h
================================================
#ifndef BERTTOKENIZER_H
#define BERTTOKENIZER_H
// https://gist.github.com/luistung/ace4888cf5fd1bad07844021cb2c7ecf
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <unordered_map>
using Vocab = std::unordered_map<std::wstring, size_t>;
using InvVocab = std::unordered_map<size_t, std::wstring>;
class BasicTokenizer {
public:
BasicTokenizer(bool doLowerCase);
std::vector<std::wstring> tokenize(const std::string& text) const;
private:
std::wstring cleanText(const std::wstring& text) const;
bool isControol(const wchar_t& ch) const;
bool isWhitespace(const wchar_t& ch) const;
bool isPunctuation(const wchar_t& ch) const;
bool isChineseChar(const wchar_t& ch) const;
std::wstring tokenizeChineseChars(const std::wstring& text) const;
bool isStripChar(const wchar_t& ch) const;
std::wstring strip(const std::wstring& text) const;
std::vector<std::wstring> split(const std::wstring& text) const;
std::wstring runStripAccents(const std::wstring& text) const;
std::vector<std::wstring> runSplitOnPunc(const std::wstring& text) const;
bool mDoLowerCase;
};
class WordpieceTokenizer {
public:
WordpieceTokenizer(std::shared_ptr<Vocab> vocab, const std::wstring& unkToken = L"[UNK]", size_t maxInputCharsPerWord=200);
std::vector<std::wstring> tokenize(const std::wstring& text) const;
private:
std::shared_ptr<Vocab> mVocab;
std::wstring mUnkToken;
size_t mMaxInputCharsPerWord;
};
class FullTokenizer {
public:
FullTokenizer(const std::string& vocabFile, bool doLowerCase = true);
std::vector<std::wstring> tokenize(const std::string& text) const;
std::vector<size_t> convertTokensToIds(const std::vector<std::wstring>& text) const;
private:
std::shared_ptr<Vocab> mVocab;
InvVocab mInvVocab;
std::string mVocabFile;
bool mDoLowerCase;
BasicTokenizer mBasicTokenizer;
WordpieceTokenizer mWordpieceTokenizer;
};
#endif // BERTTOKENIZER_H
================================================
FILE: devits.cpp
================================================
#include "devits.h"
DEVITS::DEVITS()
{
}
#include <windows.h>
#include <string>
#include <vector>
#include <sstream>
void displayVectorInMessageBox(const std::vector<int>& numbers) {
// Convert vector to string
std::stringstream ss;
for (int num : numbers) {
ss << num << " ";
}
std::string strNumbers = ss.str();
// Display in a MessageBox
MessageBoxA(NULL, strNumbers.c_str(), "Vector Elements", MB_OK);
}
TFTensor<float> DEVITS::DoInferenceDE(const std::vector<int32_t> &InputIDs, const TFTensor<float> &MojiIn, const TFTensor<float> &BERTIn, const std::vector<float> &ArgsFloat, const std::vector<int32_t> ArgsInt, int32_t SpeakerID, int32_t EmotionID)
{
// without this memory consumption is 4x
torch::NoGradGuard no_grad;
std::vector<int64_t> PaddedIDs;
PaddedIDs = ZeroPadVec(InputIDs);
// displayVectorInMessageBox(InputIDs);
std::vector<int64_t> inLen = { (int64_t)PaddedIDs.size() };
// ZDisket: Is this really necessary?
torch::TensorOptions Opts = torch::TensorOptions().requires_grad(false);
auto InIDS = torch::tensor(PaddedIDs, Opts).unsqueeze(0);
auto InLens = torch::tensor(inLen, Opts);
auto MojiHidden = torch::tensor(MojiIn.Data).unsqueeze(0);
auto BERTHidden = torch::tensor(BERTIn.Data).reshape(BERTIn.Shape);
std::vector<int64_t> BERTSz = {BERTIn.Shape[1]};
auto BERTLens = torch::tensor(BERTSz);
auto InLenScale = torch::tensor({ ArgsFloat[0]}, Opts);
std::vector<torch::jit::IValue> inputs{ InIDS,InLens, MojiHidden, BERTHidden, BERTLens, InLenScale };
if (SpeakerID != -1){
auto InSpkid = torch::tensor({SpeakerID},Opts);
inputs.push_back(InSpkid);
}
// Infer
c10::IValue Output = Model.get_method("infer_ts")(inputs);
// Output = tuple (audio,att)
auto OutputT = Output.toTuple();
// Grab audio
// [1, frames] -> [frames]
auto AuTens = OutputT.get()->elements()[0].toTensor().squeeze();
// Grab Attention
// [1, 1, x, y] -> [x, y] -> [y,x] -> [1, y, x]
auto AttTens = OutputT.get()->elements()[1].toTensor().squeeze().transpose(0,1).unsqueeze(0);
Attention = VoxUtil::CopyTensor<float>(AttTens);
return VoxUtil::CopyTensor<float>(AuTens);
}
================================================
FILE: devits.h
================================================
#ifndef DEVITS_H
#define DEVITS_H
#include "vits.h"
class DEVITS : public VITS
{
public:
DEVITS();
/*
Do inference on a DE-VITS model.
-> InputIDs: Input IDs of tokens for inference
-> SpeakerID: ID of the speaker in the model to do inference on. If single speaker, always leave at 0. If multispeaker, refer to your model.
-> MojiIn: TorchMoji hidden states size [tm]
-> BERTIn: BERT hidden states size [1, n_tokens, channels]
-> ArgsFloat[0]: Length scale.
<- Returns: TFTensor<float> with shape {frames} of audio data
*/
TFTensor<float> DoInferenceDE(const std::vector<int32_t>& InputIDs, const TFTensor<float>& MojiIn, const TFTensor<float>& BERTIn,const std::vector<float>& ArgsFloat,const std::vector<int32_t> ArgsInt, int32_t SpeakerID = 0, int32_t EmotionID = -1);
};
#endif // DEVITS_H
================================================
FILE: espeakphonemizer.cpp
================================================
#include "espeakphonemizer.h"
#include <espeak/speak_lib.h>
static const std::u32string Punctuation_t = U",.;¡!¿?:-~";
static const std::u32string Punctuation_ns = U"¿-~";
using namespace ESP;
std::string ESpeakPhonemizer::ToPhon(const std::string &InTxt)
{
const char* TextPtr = InTxt.c_str();
const void** OurPtr = (const void**)&TextPtr;
const char* Phon = espeak_TextToPhonemes(OurPtr, espeakCHARS_AUTO, (int)PhonemePars.to_ulong());
return std::string(Phon);
}
void ESpeakPhonemizer::Initialize(const std::string &DataPath, const std::string &VoiceName)
{
// these are irrelevant because we don't play any audio, we just use the phonemizer
espeak_AUDIO_OUTPUT output = AUDIO_OUTPUT_SYNCH_PLAYBACK;
int buflength = 500, options = 0;
auto Err1 = espeak_Initialize(output, buflength, DataPath.c_str(), options);
auto Err = espeak_SetVoiceByName(VoiceName.c_str());
EVoiceName = VoiceName;
PhonemePars[1] = 1; // set IPA
}
std::string ESpeakPhonemizer::Phonemize(const std::string &Input)
{
std::u32string In = VoxUtil::StrToU32(Input);
// ESpeak's phonemize function stops at punctuation, so we split it up into chunks, phonemize, then put them back together
PunctSplitVec SplitVec = IterativePunctuationSplit(In, Punctuation_t);
std::string Assembled = "";
bool Space = false;
for (const auto& Spli : SplitVec)
{
std::string Pibber = VoxUtil::U32ToStr(Spli.second);
if (!Spli.first)
{
Pibber = ToPhon(Pibber);
if (Space)
Assembled += " ";
}else
{
Space = true;
for (const auto& PCh : Punctuation_ns){
if (Spli.second.find(PCh) != std::u32string::npos)
Space = false;
}
}
Assembled += Pibber;
}
return Assembled;
}
ESpeakPhonemizer::ESpeakPhonemizer()
{
}
ESP::PunctSplitVec ESP::IterativePunctuationSplit(const std::u32string &Input, const std::u32string &Punct)
{
PunctSplitVec Ret;
std::u32string CuStr = U"";
for (const auto& Ch : Input) {
if (Punct.find(Ch) != std::u32string::npos) {
if (CuStr.size())
Ret.push_back({ false,CuStr });
std::u32string PunctOnly(1,Ch);
Ret.push_back({ true, PunctOnly });
CuStr = U"";
}
else {
CuStr += Ch;
}
}
Ret.push_back({ false,CuStr });
return Ret;
}
================================================
FILE: espeakphonemizer.h
================================================
#ifndef ESPEAKPHONEMIZER_H
#define ESPEAKPHONEMIZER_H
/*
ESpeakPhonemizer: Tool for IPA Text2Phon using ESpeak NG as backend.
*/
#include <iostream>
#include <string>
#include <bitset>
#include "VoxCommon.hpp"
#include <vector>
namespace ESP{
typedef std::pair<bool, std::u32string> PunctSplit;
typedef std::vector<PunctSplit> PunctSplitVec;
// Returns vector<pair<IS_PUNCTUATION,String>>
PunctSplitVec IterativePunctuationSplit(const std::u32string& Input, const std::u32string& Punct);
}
class ESpeakPhonemizer
{
private:
std::bitset<sizeof(int) * 8> PhonemePars;
std::string ToPhon(const std::string& InTxt);
std::string EVoiceName;
public:
// DataPath: Path to ESpeak NG data dir
// VoiceName: Name of voice to use for phonemizing (like "Spanish (Latin America)")
void Initialize(const std::string& DataPath,const std::string& VoiceName);
// Phonemize text using ESpeak phonemizer
// Unlike regular phonemizer, feed complete texts at once instead of just words.
std::string Phonemize(const std::string& Input);
ESpeakPhonemizer();
const std::string& GetVoiceName() const {return EVoiceName;};
};
#endif // ESPEAKPHONEMIZER_H
================================================
FILE: ext/AudioFile.hpp
================================================
//=======================================================================
/** @file AudioFile.h
* @author Adam Stark
* @copyright Copyright (C) 2017 Adam Stark
*
* This file is part of the 'AudioFile' library
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//=======================================================================
#ifndef _AS_AudioFile_h
#define _AS_AudioFile_h
#include <iostream>
#include <vector>
#include <assert.h>
#include <string>
#include <fstream>
#include <unordered_map>
#include <iterator>
#include <algorithm>
// disable some warnings on Windows
#if defined (_MSC_VER)
__pragma(warning (push))
__pragma(warning (disable : 4244))
__pragma(warning (disable : 4457))
__pragma(warning (disable : 4458))
__pragma(warning (disable : 4389))
__pragma(warning (disable : 4996))
#elif defined (__GNUC__)
_Pragma("GCC diagnostic push")
_Pragma("GCC diagnostic ignored \"-Wconversion\"")
_Pragma("GCC diagnostic ignored \"-Wsign-compare\"")
_Pragma("GCC diagnostic ignored \"-Wshadow\"")
#endif
//=============================================================
/** The different types of audio file, plus some other types to
* indicate a failure to load a file, or that one hasn't been
* loaded yet
*/
enum class AudioFileFormat
{
Error,
NotLoaded,
Wave,
Aiff
};
//=============================================================
template <class T>
class AudioFile
{
public:
//=============================================================
typedef std::vector<std::vector<T> > AudioBuffer;
//=============================================================
/** Constructor */
AudioFile();
//=============================================================
/** Loads an audio file from a given file path.
* @Returns true if the file was successfully loaded
*/
bool load (std::string filePath);
/** Saves an audio file to a given file path.
* @Returns true if the file was successfully saved
*/
bool save (std::string filePath, AudioFileFormat format = AudioFileFormat::Wave);
//=============================================================
/** @Returns the sample rate */
uint32_t getSampleRate() const;
/** @Returns the number of audio channels in the buffer */
int getNumChannels() const;
/** @Returns true if the audio file is mono */
bool isMono() const;
/** @Returns true if the audio file is stereo */
bool isStereo() const;
/** @Returns the bit depth of each sample */
int getBitDepth() const;
/** @Returns the number of samples per channel */
int getNumSamplesPerChannel() const;
/** @Returns the length in seconds of the audio file based on the number of samples and sample rate */
double getLengthInSeconds() const;
/** Prints a summary of the audio file to the console */
void printSummary() const;
//=============================================================
/** Set the audio buffer for this AudioFile by copying samples from another buffer.
* @Returns true if the buffer was copied successfully.
*/
bool setAudioBuffer (AudioBuffer& newBuffer);
/** Sets the audio buffer to a given number of channels and number of samples per channel. This will try to preserve
* the existing audio, adding zeros to any new channels or new samples in a given channel.
*/
void setAudioBufferSize (int numChannels, int numSamples);
/** Sets the number of samples per channel in the audio buffer. This will try to preserve
* the existing audio, adding zeros to new samples in a given channel if the number of samples is increased.
*/
void setNumSamplesPerChannel (int numSamples);
/** Sets the number of channels. New channels will have the correct number of samples and be initialised to zero */
void setNumChannels (int numChannels);
/** Sets the bit depth for the audio file. If you use the save() function, this bit depth rate will be used */
void setBitDepth (int numBitsPerSample);
/** Sets the sample rate for the audio file. If you use the save() function, this sample rate will be used */
void setSampleRate (uint32_t newSampleRate);
//=============================================================
/** Sets whether the library should log error messages to the console. By default this is true */
void shouldLogErrorsToConsole (bool logErrors);
//=============================================================
/** A vector of vectors holding the audio samples for the AudioFile. You can
* access the samples by channel and then by sample index, i.e:
*
* samples[channel][sampleIndex]
*/
AudioBuffer samples;
//=============================================================
/** An optional iXML chunk that can be added to the AudioFile.
*/
std::string iXMLChunk;
private:
//=============================================================
enum class Endianness
{
LittleEndian,
BigEndian
};
//=============================================================
AudioFileFormat determineAudioFileFormat (std::vector<uint8_t>& fileData);
bool decodeWaveFile (std::vector<uint8_t>& fileData);
bool decodeAiffFile (std::vector<uint8_t>& fileData);
//=============================================================
bool saveToWaveFile (std::string filePath);
bool saveToAiffFile (std::string filePath);
//=============================================================
void clearAudioBuffer();
//=============================================================
int32_t fourBytesToInt (std::vector<uint8_t>& source, int startIndex, Endianness endianness = Endianness::LittleEndian);
int16_t twoBytesToInt (std::vector<uint8_t>& source, int startIndex, Endianness endianness = Endianness::LittleEndian);
int getIndexOfString (std::vector<uint8_t>& source, std::string s);
int getIndexOfChunk (std::vector<uint8_t>& source, const std::string& chunkHeaderID, int startIndex, Endianness endianness = Endianness::LittleEndian);
//=============================================================
T sixteenBitIntToSample (int16_t sample);
int16_t sampleToSixteenBitInt (T sample);
//=============================================================
uint8_t sampleToSingleByte (T sample);
T singleByteToSample (uint8_t sample);
uint32_t getAiffSampleRate (std::vector<uint8_t>& fileData, int sampleRateStartIndex);
bool tenByteMatch (std::vector<uint8_t>& v1, int startIndex1, std::vector<uint8_t>& v2, int startIndex2);
void addSampleRateToAiffData (std::vector<uint8_t>& fileData, uint32_t sampleRate);
T clamp (T v1, T minValue, T maxValue);
//=============================================================
void addStringToFileData (std::vector<uint8_t>& fileData, std::string s);
void addInt32ToFileData (std::vector<uint8_t>& fileData, int32_t i, Endianness endianness = Endianness::LittleEndian);
void addInt16ToFileData (std::vector<uint8_t>& fileData, int16_t i, Endianness endianness = Endianness::LittleEndian);
//=============================================================
bool writeDataToFile (std::vector<uint8_t>& fileData, std::string filePath);
//=============================================================
void reportError (std::string errorMessage);
//=============================================================
AudioFileFormat audioFileFormat;
uint32_t sampleRate;
int bitDepth;
bool logErrorsToConsole {true};
};
//=============================================================
// Pre-defined 10-byte representations of common sample rates
static std::unordered_map <uint32_t, std::vector<uint8_t>> aiffSampleRateTable = {
{8000, {64, 11, 250, 0, 0, 0, 0, 0, 0, 0}},
{11025, {64, 12, 172, 68, 0, 0, 0, 0, 0, 0}},
{16000, {64, 12, 250, 0, 0, 0, 0, 0, 0, 0}},
{22050, {64, 13, 172, 68, 0, 0, 0, 0, 0, 0}},
{32000, {64, 13, 250, 0, 0, 0, 0, 0, 0, 0}},
{37800, {64, 14, 147, 168, 0, 0, 0, 0, 0, 0}},
{44056, {64, 14, 172, 24, 0, 0, 0, 0, 0, 0}},
{44100, {64, 14, 172, 68, 0, 0, 0, 0, 0, 0}},
{47250, {64, 14, 184, 146, 0, 0, 0, 0, 0, 0}},
{48000, {64, 14, 187, 128, 0, 0, 0, 0, 0, 0}},
{50000, {64, 14, 195, 80, 0, 0, 0, 0, 0, 0}},
{50400, {64, 14, 196, 224, 0, 0, 0, 0, 0, 0}},
{88200, {64, 15, 172, 68, 0, 0, 0, 0, 0, 0}},
{96000, {64, 15, 187, 128, 0, 0, 0, 0, 0, 0}},
{176400, {64, 16, 172, 68, 0, 0, 0, 0, 0, 0}},
{192000, {64, 16, 187, 128, 0, 0, 0, 0, 0, 0}},
{352800, {64, 17, 172, 68, 0, 0, 0, 0, 0, 0}},
{2822400, {64, 20, 172, 68, 0, 0, 0, 0, 0, 0}},
{5644800, {64, 21, 172, 68, 0, 0, 0, 0, 0, 0}}
};
//=============================================================
enum WavAudioFormat
{
PCM = 0x0001,
IEEEFloat = 0x0003,
ALaw = 0x0006,
MULaw = 0x0007,
Extensible = 0xFFFE
};
//=============================================================
enum AIFFAudioFormat
{
Uncompressed,
Compressed,
Error
};
//=============================================================
/* IMPLEMENTATION */
//=============================================================
//=============================================================
template <class T>
AudioFile<T>::AudioFile()
{
static_assert(std::is_floating_point<T>::value, "ERROR: This version of AudioFile only supports floating point sample formats");
bitDepth = 16;
sampleRate = 44100;
samples.resize (1);
samples[0].resize (0);
audioFileFormat = AudioFileFormat::NotLoaded;
}
//=============================================================
template <class T>
uint32_t AudioFile<T>::getSampleRate() const
{
return sampleRate;
}
//=============================================================
template <class T>
int AudioFile<T>::getNumChannels() const
{
return (int)samples.size();
}
//=============================================================
template <class T>
bool AudioFile<T>::isMono() const
{
return getNumChannels() == 1;
}
//=============================================================
template <class T>
bool AudioFile<T>::isStereo() const
{
return getNumChannels() == 2;
}
//=============================================================
template <class T>
int AudioFile<T>::getBitDepth() const
{
return bitDepth;
}
//=============================================================
template <class T>
int AudioFile<T>::getNumSamplesPerChannel() const
{
if (samples.size() > 0)
return (int) samples[0].size();
else
return 0;
}
//=============================================================
template <class T>
double AudioFile<T>::getLengthInSeconds() const
{
return (double)getNumSamplesPerChannel() / (double)sampleRate;
}
//=============================================================
template <class T>
void AudioFile<T>::printSummary() const
{
std::cout << "|======================================|" << std::endl;
std::cout << "Num Channels: " << getNumChannels() << std::endl;
std::cout << "Num Samples Per Channel: " << getNumSamplesPerChannel() << std::endl;
std::cout << "Sample Rate: " << sampleRate << std::endl;
std::cout << "Bit Depth: " << bitDepth << std::endl;
std::cout << "Length in Seconds: " << getLengthInSeconds() << std::endl;
std::cout << "|======================================|" << std::endl;
}
//=============================================================
template <class T>
bool AudioFile<T>::setAudioBuffer (AudioBuffer& newBuffer)
{
int numChannels = (int)newBuffer.size();
if (numChannels <= 0)
{
assert (false && "The buffer your are trying to use has no channels");
return false;
}
size_t numSamples = newBuffer[0].size();
// set the number of channels
samples.resize (newBuffer.size());
for (int k = 0; k < getNumChannels(); k++)
{
assert (newBuffer[k].size() == numSamples);
samples[k].resize (numSamples);
for (size_t i = 0; i < numSamples; i++)
{
samples[k][i] = newBuffer[k][i];
}
}
return true;
}
//=============================================================
template <class T>
void AudioFile<T>::setAudioBufferSize (int numChannels, int numSamples)
{
samples.resize (numChannels);
setNumSamplesPerChannel (numSamples);
}
//=============================================================
template <class T>
void AudioFile<T>::setNumSamplesPerChannel (int numSamples)
{
int originalSize = getNumSamplesPerChannel();
for (int i = 0; i < getNumChannels();i++)
{
samples[i].resize (numSamples);
// set any new samples to zero
if (numSamples > originalSize)
std::fill (samples[i].begin() + originalSize, samples[i].end(), (T)0.);
}
}
//=============================================================
template <class T>
void AudioFile<T>::setNumChannels (int numChannels)
{
int originalNumChannels = getNumChannels();
int originalNumSamplesPerChannel = getNumSamplesPerChannel();
samples.resize (numChannels);
// make sure any new channels are set to the right size
// and filled with zeros
if (numChannels > originalNumChannels)
{
for (int i = originalNumChannels; i < numChannels; i++)
{
samples[i].resize (originalNumSamplesPerChannel);
std::fill (samples[i].begin(), samples[i].end(), (T)0.);
}
}
}
//=============================================================
template <class T>
void AudioFile<T>::setBitDepth (int numBitsPerSample)
{
bitDepth = numBitsPerSample;
}
//=============================================================
template <class T>
void AudioFile<T>::setSampleRate (uint32_t newSampleRate)
{
sampleRate = newSampleRate;
}
//=============================================================
template <class T>
void AudioFile<T>::shouldLogErrorsToConsole (bool logErrors)
{
logErrorsToConsole = logErrors;
}
//=============================================================
template <class T>
bool AudioFile<T>::load (std::string filePath)
{
std::ifstream file (filePath, std::ios::binary);
// check the file exists
if (! file.good())
{
reportError ("ERROR: File doesn't exist or otherwise can't load file\n" + filePath);
return false;
}
file.unsetf (std::ios::skipws);
std::istream_iterator<uint8_t> begin (file), end;
std::vector<uint8_t> fileData (begin, end);
// get audio file format
audioFileFormat = determineAudioFileFormat (fileData);
if (audioFileFormat == AudioFileFormat::Wave)
{
return decodeWaveFile (fileData);
}
else if (audioFileFormat == AudioFileFormat::Aiff)
{
return decodeAiffFile (fileData);
}
else
{
reportError ("Audio File Type: Error");
return false;
}
}
//=============================================================
template <class T>
bool AudioFile<T>::decodeWaveFile (std::vector<uint8_t>& fileData)
{
// -----------------------------------------------------------
// HEADER CHUNK
std::string headerChunkID (fileData.begin(), fileData.begin() + 4);
//int32_t fileSizeInBytes = fourBytesToInt (fileData, 4) + 8;
std::string format (fileData.begin() + 8, fileData.begin() + 12);
// -----------------------------------------------------------
// try and find the start points of key chunks
int indexOfDataChunk = getIndexOfChunk (fileData, "data", 12);
int indexOfFormatChunk = getIndexOfChunk (fileData, "fmt ", 12);
int indexOfXMLChunk = getIndexOfChunk (fileData, "iXML", 12);
// if we can't find the data or format chunks, or the IDs/formats don't seem to be as expected
// then it is unlikely we'll able to read this file, so abort
if (indexOfDataChunk == -1 || indexOfFormatChunk == -1 || headerChunkID != "RIFF" || format != "WAVE")
{
reportError ("ERROR: this doesn't seem to be a valid .WAV file");
return false;
}
// -----------------------------------------------------------
// FORMAT CHUNK
int f = indexOfFormatChunk;
std::string formatChunkID (fileData.begin() + f, fileData.begin() + f + 4);
//int32_t formatChunkSize = fourBytesToInt (fileData, f + 4);
int16_t audioFormat = twoBytesToInt (fileData, f + 8);
int16_t numChannels = twoBytesToInt (fileData, f + 10);
sampleRate = (uint32_t) fourBytesToInt (fileData, f + 12);
int32_t numBytesPerSecond = fourBytesToInt (fileData, f + 16);
int16_t numBytesPerBlock = twoBytesToInt (fileData, f + 20);
bitDepth = (int) twoBytesToInt (fileData, f + 22);
int numBytesPerSample = bitDepth / 8;
// check that the audio format is PCM or Float
if (audioFormat != WavAudioFormat::PCM && audioFormat != WavAudioFormat::IEEEFloat)
{
reportError ("ERROR: this .WAV file is encoded in a format that this library does not support at present");
return false;
}
// check the number of channels is mono or stereo
if (numChannels < 1 || numChannels > 128)
{
reportError ("ERROR: this WAV file seems to be an invalid number of channels (or corrupted?)");
return false;
}
// check header data is consistent
if ((numBytesPerSecond != (numChannels * sampleRate * bitDepth) / 8) || (numBytesPerBlock != (numChannels * numBytesPerSample)))
{
reportError ("ERROR: the header data in this WAV file seems to be inconsistent");
return false;
}
// check bit depth is either 8, 16, 24 or 32 bit
if (bitDepth != 8 && bitDepth != 16 && bitDepth != 24 && bitDepth != 32)
{
reportError ("ERROR: this file has a bit depth that is not 8, 16, 24 or 32 bits");
return false;
}
// -----------------------------------------------------------
// DATA CHUNK
int d = indexOfDataChunk;
std::string dataChunkID (fileData.begin() + d, fileData.begin() + d + 4);
int32_t dataChunkSize = fourBytesToInt (fileData, d + 4);
int numSamples = dataChunkSize / (numChannels * bitDepth / 8);
int samplesStartIndex = indexOfDataChunk + 8;
clearAudioBuffer();
samples.resize (numChannels);
for (int i = 0; i < numSamples; i++)
{
for (int channel = 0; channel < numChannels; channel++)
{
int sampleIndex = samplesStartIndex + (numBytesPerBlock * i) + channel * numBytesPerSample;
if (bitDepth == 8)
{
T sample = singleByteToSample (fileData[sampleIndex]);
samples[channel].push_back (sample);
}
else if (bitDepth == 16)
{
int16_t sampleAsInt = twoBytesToInt (fileData, sampleIndex);
T sample = sixteenBitIntToSample (sampleAsInt);
samples[channel].push_back (sample);
}
else if (bitDepth == 24)
{
int32_t sampleAsInt = 0;
sampleAsInt = (fileData[sampleIndex + 2] << 16) | (fileData[sampleIndex + 1] << 8) | fileData[sampleIndex];
if (sampleAsInt & 0x800000) // if the 24th bit is set, this is a negative number in 24-bit world
sampleAsInt = sampleAsInt | ~0xFFFFFF; // so make sure sign is extended to the 32 bit float
T sample = (T)sampleAsInt / (T)8388608.;
samples[channel].push_back (sample);
}
else if (bitDepth == 32)
{
int32_t sampleAsInt = fourBytesToInt (fileData, sampleIndex);
T sample;
if (audioFormat == WavAudioFormat::IEEEFloat)
sample = (T)reinterpret_cast<float&> (sampleAsInt);
else // assume PCM
sample = (T) sampleAsInt / static_cast<float> (std::numeric_limits<std::int32_t>::max());
samples[channel].push_back (sample);
}
else
{
assert (false);
}
}
}
// -----------------------------------------------------------
// iXML CHUNK
if (indexOfXMLChunk != -1)
{
int32_t chunkSize = fourBytesToInt (fileData, indexOfXMLChunk + 4);
iXMLChunk = std::string ((const char*) &fileData[indexOfXMLChunk + 8], chunkSize);
}
return true;
}
//=============================================================
template <class T>
bool AudioFile<T>::decodeAiffFile (std::vector<uint8_t>& fileData)
{
// -----------------------------------------------------------
// HEADER CHUNK
std::string headerChunkID (fileData.begin(), fileData.begin() + 4);
//int32_t fileSizeInBytes = fourBytesToInt (fileData, 4, Endianness::BigEndian) + 8;
std::string format (fileData.begin() + 8, fileData.begin() + 12);
int audioFormat = format == "AIFF" ? AIFFAudioFormat::Uncompressed : format == "AIFC" ? AIFFAudioFormat::Compressed : AIFFAudioFormat::Error;
// -----------------------------------------------------------
// try and find the start points of key chunks
int indexOfCommChunk = getIndexOfChunk (fileData, "COMM", 12, Endianness::BigEndian);
int indexOfSoundDataChunk = getIndexOfChunk (fileData, "SSND", 12, Endianness::BigEndian);
int indexOfXMLChunk = getIndexOfChunk (fileData, "iXML", 12, Endianness::BigEndian);
// if we can't find the data or format chunks, or the IDs/formats don't seem to be as expected
// then it is unlikely we'll able to read this file, so abort
if (indexOfSoundDataChunk == -1 || indexOfCommChunk == -1 || headerChunkID != "FORM" || audioFormat == AIFFAudioFormat::Error)
{
reportError ("ERROR: this doesn't seem to be a valid AIFF file");
return false;
}
// -----------------------------------------------------------
// COMM CHUNK
int p = indexOfCommChunk;
std::string commChunkID (fileData.begin() + p, fileData.begin() + p + 4);
//int32_t commChunkSize = fourBytesToInt (fileData, p + 4, Endianness::BigEndian);
int16_t numChannels = twoBytesToInt (fileData, p + 8, Endianness::BigEndian);
int32_t numSamplesPerChannel = fourBytesToInt (fileData, p + 10, Endianness::BigEndian);
bitDepth = (int) twoBytesToInt (fileData, p + 14, Endianness::BigEndian);
sampleRate = getAiffSampleRate (fileData, p + 16);
// check the sample rate was properly decoded
if (sampleRate == 0)
{
reportError ("ERROR: this AIFF file has an unsupported sample rate");
return false;
}
// check the number of channels is mono or stereo
if (numChannels < 1 ||numChannels > 2)
{
reportError ("ERROR: this AIFF file seems to be neither mono nor stereo (perhaps multi-track, or corrupted?)");
return false;
}
// check bit depth is either 8, 16, 24 or 32-bit
if (bitDepth != 8 && bitDepth != 16 && bitDepth != 24 && bitDepth != 32)
{
reportError ("ERROR: this file has a bit depth that is not 8, 16, 24 or 32 bits");
return false;
}
// -----------------------------------------------------------
// SSND CHUNK
int s = indexOfSoundDataChunk;
std::string soundDataChunkID (fileData.begin() + s, fileData.begin() + s + 4);
int32_t soundDataChunkSize = fourBytesToInt (fileData, s + 4, Endianness::BigEndian);
int32_t offset = fourBytesToInt (fileData, s + 8, Endianness::BigEndian);
//int32_t blockSize = fourBytesToInt (fileData, s + 12, Endianness::BigEndian);
int numBytesPerSample = bitDepth / 8;
int numBytesPerFrame = numBytesPerSample * numChannels;
int totalNumAudioSampleBytes = numSamplesPerChannel * numBytesPerFrame;
int samplesStartIndex = s + 16 + (int)offset;
// sanity check the data
if ((soundDataChunkSize - 8) != totalNumAudioSampleBytes || totalNumAudioSampleBytes > static_cast<long>(fileData.size() - samplesStartIndex))
{
reportError ("ERROR: the metadatafor this file doesn't seem right");
return false;
}
clearAudioBuffer();
samples.resize (numChannels);
for (int i = 0; i < numSamplesPerChannel; i++)
{
for (int channel = 0; channel < numChannels; channel++)
{
int sampleIndex = samplesStartIndex + (numBytesPerFrame * i) + channel * numBytesPerSample;
if (bitDepth == 8)
{
int8_t sampleAsSigned8Bit = (int8_t)fileData[sampleIndex];
T sample = (T)sampleAsSigned8Bit / (T)128.;
samples[channel].push_back (sample);
}
else if (bitDepth == 16)
{
int16_t sampleAsInt = twoBytesToInt (fileData, sampleIndex, Endianness::BigEndian);
T sample = sixteenBitIntToSample (sampleAsInt);
samples[channel].push_back (sample);
}
else if (bitDepth == 24)
{
int32_t sampleAsInt = 0;
sampleAsInt = (fileData[sampleIndex] << 16) | (fileData[sampleIndex + 1] << 8) | fileData[sampleIndex + 2];
if (sampleAsInt & 0x800000) // if the 24th bit is set, this is a negative number in 24-bit world
sampleAsInt = sampleAsInt | ~0xFFFFFF; // so make sure sign is extended to the 32 bit float
T sample = (T)sampleAsInt / (T)8388608.;
samples[channel].push_back (sample);
}
else if (bitDepth == 32)
{
int32_t sampleAsInt = fourBytesToInt (fileData, sampleIndex, Endianness::BigEndian);
T sample;
if (audioFormat == AIFFAudioFormat::Compressed)
sample = (T)reinterpret_cast<float&> (sampleAsInt);
else // assume uncompressed
sample = (T) sampleAsInt / static_cast<float> (std::numeric_limits<std::int32_t>::max());
samples[channel].push_back (sample);
}
else
{
assert (false);
}
}
}
// -----------------------------------------------------------
// iXML CHUNK
if (indexOfXMLChunk != -1)
{
int32_t chunkSize = fourBytesToInt (fileData, indexOfXMLChunk + 4);
iXMLChunk = std::string ((const char*) &fileData[indexOfXMLChunk + 8], chunkSize);
}
return true;
}
//=============================================================
template <class T>
uint32_t AudioFile<T>::getAiffSampleRate (std::vector<uint8_t>& fileData, int sampleRateStartIndex)
{
for (auto it : aiffSampleRateTable)
{
if (tenByteMatch (fileData, sampleRateStartIndex, it.second, 0))
return it.first;
}
return 0;
}
//=============================================================
template <class T>
bool AudioFile<T>::tenByteMatch (std::vector<uint8_t>& v1, int startIndex1, std::vector<uint8_t>& v2, int startIndex2)
{
for (int i = 0; i < 10; i++)
{
if (v1[startIndex1 + i] != v2[startIndex2 + i])
return false;
}
return true;
}
//=============================================================
template <class T>
void AudioFile<T>::addSampleRateToAiffData (std::vector<uint8_t>& fileData, uint32_t sampleRate)
{
if (aiffSampleRateTable.count (sampleRate) > 0)
{
for (int i = 0; i < 10; i++)
fileData.push_back (aiffSampleRateTable[sampleRate][i]);
}
}
//=============================================================
template <class T>
bool AudioFile<T>::save (std::string filePath, AudioFileFormat format)
{
if (format == AudioFileFormat::Wave)
{
return saveToWaveFile (filePath);
}
else if (format == AudioFileFormat::Aiff)
{
return saveToAiffFile (filePath);
}
return false;
}
//=============================================================
template <class T>
bool AudioFile<T>::saveToWaveFile (std::string filePath)
{
std::vector<uint8_t> fileData;
int32_t dataChunkSize = getNumSamplesPerChannel() * (getNumChannels() * bitDepth / 8);
int16_t audioFormat = bitDepth == 32 ? WavAudioFormat::IEEEFloat : WavAudioFormat::PCM;
int32_t formatChunkSize = audioFormat == WavAudioFormat::PCM ? 16 : 18;
int32_t iXMLChunkSize = static_cast<int32_t> (iXMLChunk.size());
// -----------------------------------------------------------
// HEADER CHUNK
addStringToFileData (fileData, "RIFF");
// The file size in bytes is the header chunk size (4, not counting RIFF and WAVE) + the format
// chunk size (24) + the metadata part of the data chunk plus the actual data chunk size
int32_t fileSizeInBytes = 4 + formatChunkSize + 8 + 8 + dataChunkSize;
if (iXMLChunkSize > 0)
{
fileSizeInBytes += (8 + iXMLChunkSize);
}
addInt32ToFileData (fileData, fileSizeInBytes);
addStringToFileData (fileData, "WAVE");
// -----------------------------------------------------------
// FORMAT CHUNK
addStringToFileData (fileData, "fmt ");
addInt32ToFileData (fileData, formatChunkSize); // format chunk size (16 for PCM)
addInt16ToFileData (fileData, audioFormat); // audio format
addInt16ToFileData (fileData, (int16_t)getNumChannels()); // num channels
addInt32ToFileData (fileData, (int32_t)sampleRate); // sample rate
int32_t numBytesPerSecond = (int32_t) ((getNumChannels() * sampleRate * bitDepth) / 8);
addInt32ToFileData (fileData, numBytesPerSecond);
int16_t numBytesPerBlock = getNumChannels() * (bitDepth / 8);
addInt16ToFileData (fileData, numBytesPerBlock);
addInt16ToFileData (fileData, (int16_t)bitDepth);
if (audioFormat == WavAudioFormat::IEEEFloat)
addInt16ToFileData (fileData, 0); // extension size
// -----------------------------------------------------------
// DATA CHUNK
addStringToFileData (fileData, "data");
addInt32ToFileData (fileData, dataChunkSize);
for (int i = 0; i < getNumSamplesPerChannel(); i++)
{
for (int channel = 0; channel < getNumChannels(); channel++)
{
if (bitDepth == 8)
{
uint8_t byte = sampleToSingleByte (samples[channel][i]);
fileData.push_back (byte);
}
else if (bitDepth == 16)
{
int16_t sampleAsInt = sampleToSixteenBitInt (samples[channel][i]);
addInt16ToFileData (fileData, sampleAsInt);
}
else if (bitDepth == 24)
{
int32_t sampleAsIntAgain = (int32_t) (samples[channel][i] * (T)8388608.);
uint8_t bytes[3];
bytes[2] = (uint8_t) (sampleAsIntAgain >> 16) & 0xFF;
bytes[1] = (uint8_t) (sampleAsIntAgain >> 8) & 0xFF;
bytes[0] = (uint8_t) sampleAsIntAgain & 0xFF;
fileData.push_back (bytes[0]);
fileData.push_back (bytes[1]);
fileData.push_back (bytes[2]);
}
else if (bitDepth == 32)
{
int32_t sampleAsInt;
if (audioFormat == WavAudioFormat::IEEEFloat)
sampleAsInt = (int32_t) reinterpret_cast<int32_t&> (samples[channel][i]);
else // assume PCM
sampleAsInt = (int32_t) (samples[channel][i] * std::numeric_limits<int32_t>::max());
addInt32ToFileData (fileData, sampleAsInt, Endianness::LittleEndian);
}
else
{
assert (false && "Trying to write a file with unsupported bit depth");
return false;
}
}
}
// -----------------------------------------------------------
// iXML CHUNK
if (iXMLChunkSize > 0)
{
addStringToFileData (fileData, "iXML");
addInt32ToFileData (fileData, iXMLChunkSize);
addStringToFileData (fileData, iXMLChunk);
}
// check that the various sizes we put in the metadata are correct
if (fileSizeInBytes != static_cast<int32_t> (fileData.size() - 8) || dataChunkSize != (getNumSamplesPerChannel() * getNumChannels() * (bitDepth / 8)))
{
reportError ("ERROR: couldn't save file to " + filePath);
return false;
}
// try to write the file
return writeDataToFile (fileData, filePath);
}
//=============================================================
template <class T>
bool AudioFile<T>::saveToAiffFile (std::string filePath)
{
std::vector<uint8_t> fileData;
int32_t numBytesPerSample = bitDepth / 8;
int32_t numBytesPerFrame = numBytesPerSample * getNumChannels();
int32_t totalNumAudioSampleBytes = getNumSamplesPerChannel() * numBytesPerFrame;
int32_t soundDataChunkSize = totalNumAudioSampleBytes + 8;
int32_t iXMLChunkSize = static_cast<int32_t> (iXMLChunk.size());
// -----------------------------------------------------------
// HEADER CHUNK
addStringToFileData (fileData, "FORM");
// The file size in bytes is the header chunk size (4, not counting FORM and AIFF) + the COMM
// chunk size (26) + the metadata part of the SSND chunk plus the actual data chunk size
int32_t fileSizeInBytes = 4 + 26 + 16 + totalNumAudioSampleBytes;
if (iXMLChunkSize > 0)
{
fileSizeInBytes += (8 + iXMLChunkSize);
}
addInt32ToFileData (fileData, fileSizeInBytes, Endianness::BigEndian);
addStringToFileData (fileData, "AIFF");
// -----------------------------------------------------------
// COMM CHUNK
addStringToFileData (fileData, "COMM");
addInt32ToFileData (fileData, 18, Endianness::BigEndian); // commChunkSize
addInt16ToFileData (fileData, getNumChannels(), Endianness::BigEndian); // num channels
addInt32ToFileData (fileData, getNumSamplesPerChannel(), Endianness::BigEndian); // num samples per channel
addInt16ToFileData (fileData, bitDepth, Endianness::BigEndian); // bit depth
addSampleRateToAiffData (fileData, sampleRate);
// -----------------------------------------------------------
// SSND CHUNK
addStringToFileData (fileData, "SSND");
addInt32ToFileData (fileData, soundDataChunkSize, Endianness::BigEndian);
addInt32ToFileData (fileData, 0, Endianness::BigEndian); // offset
addInt32ToFileData (fileData, 0, Endianness::BigEndian); // block size
for (int i = 0; i < getNumSamplesPerChannel(); i++)
{
for (int channel = 0; channel < getNumChannels(); channel++)
{
if (bitDepth == 8)
{
uint8_t byte = sampleToSingleByte (samples[channel][i]);
fileData.push_back (byte);
}
else if (bitDepth == 16)
{
int16_t sampleAsInt = sampleToSixteenBitInt (samples[channel][i]);
addInt16ToFileData (fileData, sampleAsInt, Endianness::BigEndian);
}
else if (bitDepth == 24)
{
int32_t sampleAsIntAgain = (int32_t) (samples[channel][i] * (T)8388608.);
uint8_t bytes[3];
bytes[0] = (uint8_t) (sampleAsIntAgain >> 16) & 0xFF;
bytes[1] = (uint8_t) (sampleAsIntAgain >> 8) & 0xFF;
bytes[2] = (uint8_t) sampleAsIntAgain & 0xFF;
fileData.push_back (bytes[0]);
fileData.push_back (bytes[1]);
fileData.push_back (bytes[2]);
}
else if (bitDepth == 32)
{
// write samples as signed integers (no implementation yet for floating point, but looking at WAV implementation should help)
int32_t sampleAsInt = (int32_t) (samples[channel][i] * std::numeric_limits<int32_t>::max());
addInt32ToFileData (fileData, sampleAsInt, Endianness::BigEndian);
}
else
{
assert (false && "Trying to write a file with unsupported bit depth");
return false;
}
}
}
// -----------------------------------------------------------
// iXML CHUNK
if (iXMLChunkSize > 0)
{
addStringToFileData (fileData, "iXML");
addInt32ToFileData (fileData, iXMLChunkSize);
addStringToFileData (fileData, iXMLChunk);
}
// check that the various sizes we put in the metadata are correct
if (fileSizeInBytes != static_cast<int32_t> (fileData.size() - 8) || soundDataChunkSize != getNumSamplesPerChannel() * numBytesPerFrame + 8)
{
reportError ("ERROR: couldn't save file to " + filePath);
return false;
}
// try to write the file
return writeDataToFile (fileData, filePath);
}
//=============================================================
template <class T>
bool AudioFile<T>::writeDataToFile (std::vector<uint8_t>& fileData, std::string filePath)
{
std::ofstream outputFile (filePath, std::ios::binary);
if (outputFile.is_open())
{
for (size_t i = 0; i < fileData.size(); i++)
{
char value = (char) fileData[i];
outputFile.write (&value, sizeof (char));
}
outputFile.close();
return true;
}
return false;
}
//=============================================================
template <class T>
void AudioFile<T>::addStringToFileData (std::vector<uint8_t>& fileData, std::string s)
{
for (size_t i = 0; i < s.length();i++)
fileData.push_back ((uint8_t) s[i]);
}
//=============================================================
template <class T>
void AudioFile<T>::addInt32ToFileData (std::vector<uint8_t>& fileData, int32_t i, Endianness endianness)
{
uint8_t bytes[4];
if (endianness == Endianness::LittleEndian)
{
bytes[3] = (i >> 24) & 0xFF;
bytes[2] = (i >> 16) & 0xFF;
bytes[1] = (i >> 8) & 0xFF;
bytes[0] = i & 0xFF;
}
else
{
bytes[0] = (i >> 24) & 0xFF;
bytes[1] = (i >> 16) & 0xFF;
bytes[2] = (i >> 8) & 0xFF;
bytes[3] = i & 0xFF;
}
for (int i = 0; i < 4; i++)
fileData.push_back (bytes[i]);
}
//=============================================================
template <class T>
void AudioFile<T>::addInt16ToFileData (std::vector<uint8_t>& fileData, int16_t i, Endianness endianness)
{
uint8_t bytes[2];
if (endianness == Endianness::LittleEndian)
{
bytes[1] = (i >> 8) & 0xFF;
bytes[0] = i & 0xFF;
}
else
{
bytes[0] = (i >> 8) & 0xFF;
bytes[1] = i & 0xFF;
}
fileData.push_back (bytes[0]);
fileData.push_back (bytes[1]);
}
//=============================================================
template <class T>
void AudioFile<T>::clearAudioBuffer()
{
for (size_t i = 0; i < samples.size();i++)
{
samples[i].clear();
}
samples.clear();
}
//=============================================================
template <class T>
AudioFileFormat AudioFile<T>::determineAudioFileFormat (std::vector<uint8_t>& fileData)
{
std::string header (fileData.begin(), fileData.begin() + 4);
if (header == "RIFF")
return AudioFileFormat::Wave;
else if (header == "FORM")
return AudioFileFormat::Aiff;
else
return AudioFileFormat::Error;
}
//=============================================================
template <class T>
int32_t AudioFile<T>::fourBytesToInt (std::vector<uint8_t>& source, int startIndex, Endianness endianness)
{
int32_t result;
if (endianness == Endianness::LittleEndian)
result = (source[startIndex + 3] << 24) | (source[startIndex + 2] << 16) | (source[startIndex + 1] << 8) | source[startIndex];
else
result = (source[startIndex] << 24) | (source[startIndex + 1] << 16) | (source[startIndex + 2] << 8) | source[startIndex + 3];
return result;
}
//=============================================================
template <class T>
int16_t AudioFile<T>::twoBytesToInt (std::vector<uint8_t>& source, int startIndex, Endianness endianness)
{
int16_t result;
if (endianness == Endianness::LittleEndian)
result = (source[startIndex + 1] << 8) | source[startIndex];
else
result = (source[startIndex] << 8) | source[startIndex + 1];
return result;
}
//=============================================================
template <class T>
int AudioFile<T>::getIndexOfString (std::vector<uint8_t>& source, std::string stringToSearchFor)
{
int index = -1;
int stringLength = (int)stringToSearchFor.length();
for (size_t i = 0; i < source.size() - stringLength;i++)
{
std::string section (source.begin() + i, source.begin() + i + stringLength);
if (section == stringToSearchFor)
{
index = static_cast<int> (i);
break;
}
}
return index;
}
//=============================================================
template <class T>
int AudioFile<T>::getIndexOfChunk (std::vector<uint8_t>& source, const std::string& chunkHeaderID, int startIndex, Endianness endianness)
{
constexpr int dataLen = 4;
if (chunkHeaderID.size() != dataLen)
{
assert (false && "Invalid chunk header ID string");
return -1;
}
int i = startIndex;
while (i < source.size() - dataLen)
{
if (memcmp (&source[i], chunkHeaderID.data(), dataLen) == 0)
{
return i;
}
i += dataLen;
auto chunkSize = fourBytesToInt (source, i, endianness);
i += (dataLen + chunkSize);
}
return -1;
}
//=============================================================
template <class T>
T AudioFile<T>::sixteenBitIntToSample (int16_t sample)
{
return static_cast<T> (sample) / static_cast<T> (32768.);
}
//=============================================================
template <class T>
int16_t AudioFile<T>::sampleToSixteenBitInt (T sample)
{
sample = clamp (sample, -1., 1.);
return static_cast<int16_t> (sample * 32767.);
}
//=============================================================
template <class T>
uint8_t AudioFile<T>::sampleToSingleByte (T sample)
{
sample = clamp (sample, -1., 1.);
sample = (sample + 1.) / 2.;
return static_cast<uint8_t> (sample * 255.);
}
//=============================================================
template <class T>
T AudioFile<T>::singleByteToSample (uint8_t sample)
{
return static_cast<T> (sample - 128) / static_cast<T> (128.);
}
//=============================================================
template <class T>
T AudioFile<T>::clamp (T value, T minValue, T maxValue)
{
value = std::min (value, maxValue);
value = std::max (value, minValue);
return value;
}
//=============================================================
template <class T>
void AudioFile<T>::reportError (std::string errorMessage)
{
if (logErrorsToConsole)
std::cout << errorMessage << std::endl;
}
#if defined (_MSC_VER)
__pragma(warning (pop))
#elif defined (__GNUC__)
_Pragma("GCC diagnostic pop")
#endif
#endif /* AudioFile_h */
================================================
FILE: ext/ByteArr.cpp
================================================
#include "ByteArr.h"
using namespace std;
void ByteArr::Realloc(const size_t & newSize)
{
if (newSize < DataSz)
return;
BYTE* NewDat = new BYTE[newSize];
smemcpy(NewDat, newSize, Data, DataSz);
DataSz = newSize;
delete[] Data;
Data = NewDat;
}
void ByteArr::Init()
{
Data = nullptr;
DataSz = 0;
CurrentPos = 0;
DontDestroy = false;
}
ByteArr::ByteArr()
{
Init();
}
void ByteArr::SetDestroy(const bool &set)
{
DontDestroy = !set;
}
ByteArr::ByteArr(const size_t & InitSz)
{
Init();
CAlloc(InitSz);
}
ByteArr::ByteArr(BYTE * CopyArr, const size_t & ArrSz)
{
Init();
Assign(CopyArr, ArrSz);
}
ByteArr::ByteArr(const ByteArr & Cpy)
{
Init();
Assign(Cpy);
CurrentPos = Cpy.Pos();
}
ByteArr::ByteArr(const std::vector<BYTE>& CpyBv)
{
Init();
Assign(CpyBv);
}
#ifdef _QT
ByteArr::ByteArr(const QByteArray &InitBar)
{
Init();
Assign(InitBar);
}
#endif
ByteArr::ByteArr(const std::vector<ByteArr> &BarC)
{
Init();
Assign(BarC);
}
std::vector<ByteArr> ByteArr::Split(const ulong &szportion)
{
vector<ByteArr> Ret;
size_t Pos = 0;
size_t remaining = DataSz;
while (remaining > 0)
{
size_t targetsz = szportion;
if (Pos + szportion > DataSz)
targetsz = DataSz - Pos;
ByteArr Bar(Data + Pos,targetsz);
Pos += targetsz;
Ret.push_back(Bar);
remaining -= targetsz;
}
return Ret;
}
void ByteArr::Request(const size_t &reqSz)
{
const size_t oReq = CurrentPos + reqSz;
if (oReq > DataSz)
IncreaseSize(reqSz);
}
std::vector<BYTE> ByteArr::ToVector()
{
return std::vector<BYTE>(Data, Data + DataSz);
}
const BYTE * ByteArr::CoData() const
{
return Data;
}
BYTE &ByteArr::operator[](const size_t &Pos)
{
return Data[Pos];
}
const BYTE &ByteArr::operator[](const size_t &cPos) const
{
return Data[cPos];
}
void ByteArr::Advance(const size_t &adv)
{
CurrentPos += adv;
}
void ByteArr::Assign(BYTE * cpyArr, const size_t & cpySz)
{
CAlloc(cpySz);
smemcpy(Data, cpySz, cpyArr, cpySz);
DataSz = cpySz;
}
void ByteArr::Assign(const std::vector<BYTE>& CByteVec)
{
CAlloc(CByteVec.size());
smemcpy(Data, DataSz, CByteVec.data(), CByteVec.size());
}
void ByteArr::Assign(const ByteArr & CpyByte)
{
CAlloc(CpyByte.Size());
smemcpy(Data, DataSz, CpyByte.CoData(), CpyByte.Size());
}
void ByteArr::Assign(const std::vector<ByteArr> &BarComb)
{
size_t total = 0;
// Two iterations, one gets the size and the other appends.
auto It = BarComb.begin();
while (It != BarComb.end())
{
total += It->Size();
++It;
}
CAlloc(total);
It = BarComb.begin();
while (It != BarComb.end()){
Add((void*)It->CoData(),It->Size());
++It;
}
}
void ByteArr::Seek(const size_t &To)
{
if (To > DataSz)
throw std::invalid_argument("Tried to seek out of bounds!");
CurrentPos = To;
}
void ByteArr::Add(void * inDat, const size_t & DatSz)
{
const size_t Req = CurrentPos + DatSz;
if (Req > DataSz)
IncreaseSize(DatSz);
smemcpy(Data + CurrentPos, DataSz, inDat, DatSz);
CurrentPos += DatSz;
}
size_t ByteArr::Read(void *OutDat, const size_t &oDatSz)
{
const size_t oReq = CurrentPos + oDatSz;
if (oReq > DataSz)
throw std::invalid_argument("Tried to read out of bounds!");
smemcpy(OutDat,oDatSz,Data + CurrentPos,oDatSz);
CurrentPos = oReq;
return CurrentPos;
}
void ByteArr::CAlloc(const size_t & SetSize)
{
if (Data && DataSz)
delete[] Data;
CurrentPos = 0;
Data = new BYTE[SetSize];
DataSz = SetSize;
}
void ByteArr::operator>>(ByteArr &BaEx)
{
// We explicitly export and import sizes in unsigned 64 bits to make sure
// there are no compatibility problems between 32 and 64 bit architectures
// Get the size
UINT64 tmpSize = 0;
(*this) >> tmpSize;
// Request the size from the other byte array
BaEx.Request((size_t)tmpSize);
// Perform a copy directly onto the other array
smemcpy(BaEx.Data + BaEx.Pos(),BaEx.Size(),Data + CurrentPos,(size_t)tmpSize);
// Advance those positions
BaEx.Advance(tmpSize);
CurrentPos += tmpSize;
}
void ByteArr::operator<<(const ByteArr &BaAdd)
{
// We explicitly export and import sizes in unsigned 64 bits to make sure
// there are no compatibility problems between 32 and 64 bit architectures
(*this) << (UINT64)BaAdd.Size();
Add(BaAdd.Data,BaAdd.Size());
}
// QT Functions ##########################################################
#ifdef _QT
void ByteArr::Assign(const QByteArray &QBar)
{
CAlloc((size_t)QBar.size());
smemcpy(Data,DataSz,QBar.data(),(size_t)QBar.size());
}
QByteArray ByteArr::ToQByteArr()
{
QByteArray QB((const char*)Data,(int)DataSz);
return QB;
}
#endif
#ifdef USE_ZDFS
void ByteArr::operator<<(const SItemW &ItemEx)
{
// Write our attributes
(*this) << ItemEx.Attributes;
// Write basic data
(*this) << ItemEx.FileSzHigh;
(*this) << ItemEx.FileSzLow;
(*this) << ItemEx.IType;
(*this) << ItemEx.LastAccessTime;
(*this) << ItemEx.LastWriteTime;
(*this) << ItemEx.Name;
(*this) << ItemEx.TimeOfCreation;
// Write subentries
(*this) << ItemEx.SubEntries;
}
void ByteArr::operator<<(const SYSTEMTIME &SysTime)
{
// Convert it to file time to export easier;
FILETIME TimeC;
SystemTimeToFileTime(&SysTime, &TimeC);
(*this) << TimeC.dwHighDateTime;
(*this) << TimeC.dwLowDateTime;
}
void ByteArr::operator<<(const FAttrib &Atr)
{
(*this) << Atr.Archive;
(*this) << Atr.Compressed;
(*this) << Atr.Hidden;
(*this) << Atr.Normal;
(*this) << Atr.ReadOnly;
(*this) << Atr.System;
(*this) << Atr.Temporary;
}
void ByteArr::operator>>(SItemW &ItemEx)
{
// Write our attributes
(*this) >> ItemEx.Attributes;
// Write basic data
(*this) >> ItemEx.FileSzHigh;
(*this) >> ItemEx.FileSzLow;
(*this) >> ItemEx.IType;
(*this) >> ItemEx.LastAccessTime;
(*this) >> ItemEx.LastWriteTime;
(*this) >> ItemEx.Name;
(*this) >> ItemEx.TimeOfCreation;
// Write subentries
(*this) >> ItemEx.SubEntries;
}
void ByteArr::operator>>(SYSTEMTIME &SysTime)
{
FILETIME TimeC;
(*this) >> TimeC.dwHighDateTime;
(*this) >> TimeC.dwLowDateTime;
FileTimeToSystemTime(&TimeC, &SysTime);
}
void ByteArr::operator>>(FAttrib &ExAtr)
{
(*this) >> ExAtr.Archive;
(*this) >> ExAtr.Compressed;
(*this) >> ExAtr.Hidden;
(*this) >> ExAtr.Normal;
(*this) >> ExAtr.ReadOnly;
(*this) >> ExAtr.System;
(*this) >> ExAtr.Temporary;
}
#endif
#ifdef _QT
void ByteArr::operator<<(const QByteArray &QBarEx)
{
ByteArr Temp;
Temp.Assign(QBarEx);
(*this) << Temp;
}
void ByteArr::operator>>(QByteArray &QBarry)
{
ByteArr Temp1;
(*this) >> Temp1;
QBarry.append(Temp1.ToQByteArr());
}
#endif
// QT Functions ##########################################################
ByteArr::~ByteArr()
{
try {
if (Data && DataSz && !DontDestroy)
delete[] Data;
}
catch (...) {
// Who the hell gives a shit about exceptions here???
}
}
void smemcpy(void* dest,const size_t& destsz, const void* src,const size_t& count ){
if (count > destsz)
throw std::invalid_argument("memcpy_s, destionation size is lower than the source!!");
memcpy(dest,src,count);
}
================================================
FILE: ext/ByteArr.h
================================================
#ifndef BYTEARR_H
#define BYTEARR_H
/*
###################################################
____ _
| _ \ | | /\
| |_) |_ _| |_ ___ / \ _ __ _ __
| _ <| | | | __/ _ \ / /\ \ | '__| '__|
| |_) | |_| | || __// ____ \| | | |
|____/ \__, |\__\___/_/ \_\_| |_|
__/ |
|___/
###################################################
# Description: An extensible byte array class that can also act as a
buffer to store various types
# Author: ZDisket
# Copyright (C) 2019 YOUR MOM GAY LOLOLOL
####################################################
*/
#ifndef _WIN32
#ifndef __STDC_WANT_LIB_EXT1__
#define __STDC_WANT_LIB_EXT1__ 1
#endif
#endif
#ifdef _QT
#include <QString>
#include <QByteArray>
#endif
#include <string>
#include <vector>
typedef unsigned char BYTE;
typedef long long INT64;
typedef unsigned long long UINT64;
typedef std::vector<BYTE> ByteVec;
typedef unsigned long ulong;
// If not defined, it doesn't exist. We provide our own memcpy_s implementation
#include <iostream>
#include <cstring>
#ifdef USE_ZDFS
#include "ZDFS.h"
#endif
void smemcpy(void* dest,const size_t& destsz, const void* src,const size_t& count );
// Class meant to simplify interactions with dynamic size byte arrays
// And as a buffer for sending stuff.
class ByteArr
{
private:
BYTE* Data;
size_t DataSz;
size_t CurrentPos;
void Realloc(const size_t& newSize);
inline void Init();
bool DontDestroy;
public:
ByteArr();
// Set if this byte array will destroy itself on the constructor.
void SetDestroy(const bool& set);
// Initialize with a certain size.
ByteArr(const size_t& InitSz);
// Create a new byte arr by copying and REPLACING the contents
ByteArr(BYTE* CopyArr, const size_t& ArrSz);
// Create a byte array from another byte array
ByteArr(const ByteArr& Cpy);
// Create a byte array from a vector of bytes
ByteArr(const std::vector<BYTE>& CpyBv);
#ifdef _QT
ByteArr(const QByteArray& InitBar);
#endif
// Create a byte array by combining a vector
ByteArr(const std::vector<ByteArr>& BarC);
// Split the current byte array into portions of a certain size
// Returns vector
std::vector<ByteArr> Split(const ulong& szportion);
// Request a certain amount of bytes to be allocated into the byte array.
// If necessary, will resize.
void Request(const size_t& reqSz);
// Copy the Byte Array into a vector.
std::vector<BYTE> ToVector();
// Get a const reference to the raw array
const BYTE* CoData() const;
BYTE* GetData() { return Data; }
BYTE& operator[](const size_t& Pos);
const BYTE& operator[](const size_t& cPos) const;
void Advance(const size_t& adv);
// Assign a raw BYTE* by copy and REPLACE the contents
void Assign(BYTE* cpyArr, const size_t& cpySz);
// Assign a vector of bytes.
void Assign(const std::vector<BYTE>& CByteVec);
// Assign a byte array and copy contents.
void Assign(const ByteArr& CpyByte);
// Assign a combination of byte arrays.
void Assign(const std::vector<ByteArr>& BarComb);
// Get the size of the array
inline size_t Size() const { return DataSz; }
inline void IncreaseSize(const size_t& Add) { Realloc(DataSz + Add); }
inline size_t Pos() const { return CurrentPos; }
void Seek(const size_t& To);
// Add something raw to the byte array. It's highly recommended
// that you instead use the overloaded operator <<
void Add(void* inDat, const size_t& DatSz);
// Reads the array and returns the current position
size_t Read(void* OutDat,const size_t& oDatSz);
// REPLACE the array and allocate a new one with specified size.
void CAlloc(const size_t& SetSize);
inline void CAlloc(const INT64& SetSz) { CAlloc((size_t)SetSz); }
// Add a simple data type to the bytearr
template<typename Ty>
void operator<<(const Ty& In) {
Add((void*)&In,sizeof(In));
}
template<typename Char>
void operator<<(const std::basic_string<Char>& Str) {
// Add the size
(*this) << Str.size();
Add((void*)Str.data(), Str.size() * sizeof(Char));
}
template<typename Tyo>
void operator>> (Tyo& Out){
Read((void*)&Out,sizeof(Out));
}
template<typename Char>
void operator>>(std::basic_string<Char>& oStr){
size_t rsz = 0;
(*this) >> rsz;
oStr.resize(rsz);
Read((void*)oStr.data(),rsz * sizeof(Char));
}
template<typename V>
void operator>>(std::vector<V>& OutVec){
size_t vsz = 0;
(*this) >> vsz;
OutVec.reserve(vsz);
size_t p = 0;
while (p != vsz){
V temp;
(*this) >> temp;
OutVec.push_back(temp);
++p;
}
}
template<typename V>
void operator<<(const std::vector<V>& InVec){
(*this) << InVec.size();
size_t p = 0;
while (p != InVec.size()){
(*this) << InVec[p];
++p;
}
}
// Append a byte array
void operator<<(const ByteArr& BaAdd);
// Export a previously stored byte array. Note that it appends.
void operator>>(ByteArr& BaEx);
#ifdef _QT
// It's much safer to use u32 string as we guarantee that all platforms will support it
// equally.
void operator<<(const QString& QsEx)
{
std::u32string StrEx = QsEx.toStdU32String();
(*this) << StrEx;
}
void operator>>(QString& QsOut)
{
std::u32string StrOut;
(*this) >> StrOut;
QsOut = QString::fromStdU32String(StrOut);
}
void Assign(const QByteArray& QBar);
QByteArray ToQByteArr();
void operator<<(const QByteArray& QBarEx);
void operator>>(QByteArray& QBarry);
#endif
#ifdef USE_ZDFS
void operator>>(FAttrib& ExAtr);
void operator>>(SYSTEMTIME& SysTime);
void operator>>(SItemW& ItemEx);
void operator<<(const FAttrib& Atr);
void operator<<(const SYSTEMTIME& SysTime);
void operator<<(const SItemW& ItemEx);
#endif
~ByteArr();
};
#endif
================================================
FILE: ext/CppFlow/context.h
================================================
//
// Created by serizba on 27/6/20.
//
#ifndef CPPFLOW2_CONTEXT_H
#define CPPFLOW2_CONTEXT_H
#include <memory>
#include <stdexcept>
#include <utility>
#include <tensorflow/c/c_api.h>
#include <tensorflow/c/eager/c_api.h>
namespace cppflow {
inline bool status_check(TF_Status* status) {
if (TF_GetCode(status) != TF_OK) {
throw std::runtime_error(TF_Message(status));
}
return true;
}
class context {
public:
static TFE_Context* get_context();
static TF_Status* get_status();
private:
TFE_Context* tfe_context{nullptr};
public:
explicit context(TFE_ContextOptions* opts = nullptr);
context(context const&) = delete;
context& operator=(context const&) = delete;
context(context&&) noexcept;
context& operator=(context&&) noexcept;
~context();
};
// TODO: create ContextManager class if needed
// Set new context, thread unsafe, must be called at the beginning.
// TFE_ContextOptions* tfe_opts = ...
// cppflow::get_global_context() = cppflow::context(tfe_opts);
inline context& get_global_context() {
static context global_context;
return global_context;
}
}
namespace cppflow {
inline TFE_Context* context::get_context() {
return get_global_context().tfe_context;
}
inline TF_Status* context::get_status() {
thread_local std::unique_ptr<TF_Status, decltype(&TF_DeleteStatus)> local_tf_status(TF_NewStatus(), &TF_DeleteStatus);
return local_tf_status.get();
}
inline context::context(TFE_ContextOptions* opts) {
auto tf_status = context::get_status();
if(opts == nullptr) {
std::unique_ptr<TFE_ContextOptions, decltype(&TFE_DeleteContextOptions)> new_opts(TFE_NewContextOptions(), &TFE_DeleteContextOptions);
this->tfe_context = TFE_NewContext(new_opts.get(), tf_status);
} else {
this->tfe_context = TFE_NewContext(opts, tf_status);
}
status_check(tf_status);
}
inline context::context(context&& ctx) noexcept :
tfe_context(std::exchange(ctx.tfe_context, nullptr))
{
}
inline context& context::operator=(context&& ctx) noexcept {
tfe_context = std::exchange(ctx.tfe_context, tfe_context);
return *this;
}
inline context::~context() {
TFE_DeleteContext(this->tfe_context);
}
}
#endif //CPPFLOW2_CONTEXT_H
================================================
FILE: ext/CppFlow/cppflow.h
================================================
//
// Created by serizba on 17/9/20.
//
#ifndef EXAMPLE_CPPFLOW_H
#define EXAMPLE_CPPFLOW_H
#include "tensor.h"
#include "model.h"
#include "raw_ops.h"
#include "ops.h"
#include "datatype.h"
#include <tensorflow/c/c_api.h>
namespace cppflow {
/**
* Version of TensorFlow and CppFlow
* @return A string containing the version of TensorFow and CppFlow
*/
std::string version();
}
/******************************
* IMPLEMENTATION DETAILS *
******************************/
namespace cppflow {
inline std::string version() {
return "TensorFlow: " + std::string(TF_Version()) + " CppFlow: 2.0.0";
}
}
#endif //EXAMPLE_CPPFLOW_H
================================================
FILE: ext/CppFlow/datatype.h
================================================
//
// Created by serizba on 12/7/20.
//
#ifndef CPPFLOW2_DATATYPE_H
#define CPPFLOW2_DATATYPE_H
#include <type_traits>
#include <string>
#include <typeinfo>
#include <ostream>
#include <stdexcept>
namespace cppflow {
using datatype = TF_DataType;
/**
* @return A string representing dt
*
*/
inline std::string to_string(datatype dt) {
switch (dt) {
case TF_FLOAT:
return "TF_FLOAT";
case TF_DOUBLE:
return "TF_DOUBLE";
case TF_INT32:
return "TF_INT32";
case TF_UINT8:
return "TF_UINT8";
case TF_INT16:
return "TF_INT16";
case TF_INT8:
return "TF_INT8";
case TF_STRING:
return "TF_STRING";
case TF_COMPLEX64:
return "TF_COMPLEX64";
case TF_INT64:
return "TF_INT64";
case TF_BOOL:
return "TF_BOOL";
case TF_QINT8:
return "TF_QINT8";
case TF_QUINT8:
return "TF_QUINT8";
case TF_QINT32:
return "TF_QINT32";
case TF_BFLOAT16:
return "TF_BFLOAT16";
case TF_QINT16:
return "TF_QINT16";
case TF_QUINT16:
return "TF_QUINT16";
case TF_UINT16:
return "TF_UINT16";
case TF_COMPLEX128:
return "TF_COMPLEX128";
case TF_HALF:
return "TF_HALF";
case TF_RESOURCE:
return "TF_RESOURCE";
case TF_VARIANT:
return "TF_VARIANT";
case TF_UINT32:
return "TF_UINT32";
case TF_UINT64:
return "TF_UINT64";
default:
return "DATATYPE_NOT_KNOWN";
}
}
/**
*
* @tparam T
* @return The TensorFlow type of T
*/
template<typename T>
TF_DataType deduce_tf_type() {
if (std::is_same<T, float>::value)
return TF_FLOAT;
if (std::is_same<T, double>::value)
return TF_DOUBLE;
if (std::is_same<T, int32_t >::value)
return TF_INT32;
if (std::is_same<T, uint8_t>::value)
return TF_UINT8;
if (std::is_same<T, int16_t>::value)
return TF_INT16;
if (std::is_same<T, int8_t>::value)
return TF_INT8;
if (std::is_same<T, int64_t>::value)
return TF_INT64;
if (std::is_same<T, unsigned char>::value)
return TF_BOOL;
if (std::is_same<T, uint16_t>::value)
return TF_UINT16;
if (std::is_same<T, uint32_t>::value)
return TF_UINT32;
if (std::is_same<T, uint64_t>::value)
return TF_UINT64;
// decode with `c++filt --type $output` for gcc
throw std::runtime_error{"Could not deduce type! type_name: " + std::string(typeid(T).name())};
}
/**
* @return The stream os after inserting the string representation of dt
*
*/
inline std::ostream& operator<<(std::ostream& os, datatype dt) {
os << to_string(dt);
return os;
}
}
#endif //CPPFLOW2_DATATYPE_H
================================================
FILE: ext/CppFlow/defer.h
================================================
#pragma once
#include <functional>
namespace cppflow {
class defer {
public:
typedef std::function<void ()> Func;
explicit defer(const Func& func) : _func(func) {}
~defer() {
_func
gitextract_hcblmq9h/ ├── .gitignore ├── EnglishPhoneticProcessor.cpp ├── EnglishPhoneticProcessor.h ├── FastSpeech2.cpp ├── FastSpeech2.h ├── LICENSE.md ├── MultiBandMelGAN.cpp ├── MultiBandMelGAN.h ├── ONNXModel.cpp ├── ONNXModel.h ├── ONNXUtil.hpp ├── README.md ├── Supertonic.cpp ├── Supertonic.h ├── SupertonicTextProcessor.cpp ├── SupertonicTextProcessor.h ├── SupertonicVocoder.cpp ├── SupertonicVocoder.h ├── TensorVox.pro ├── TextTokenizer.cpp ├── TextTokenizer.h ├── VITSEvo.cpp ├── VITSEvo.h ├── Voice.cpp ├── Voice.h ├── VoxCommon.cpp ├── VoxCommon.hpp ├── attention.cpp ├── attention.h ├── batchdenoisedlg.cpp ├── batchdenoisedlg.h ├── batchdenoisedlg.ui ├── bert.cpp ├── bert.h ├── berttokenizer.cpp ├── berttokenizer.h ├── devits.cpp ├── devits.h ├── espeakphonemizer.cpp ├── espeakphonemizer.h ├── ext/ │ ├── AudioFile.hpp │ ├── ByteArr.cpp │ ├── ByteArr.h │ ├── CppFlow/ │ │ ├── context.h │ │ ├── cppflow.h │ │ ├── datatype.h │ │ ├── defer.h │ │ ├── model.h │ │ ├── ops.h │ │ ├── raw_ops.h │ │ └── tensor.h │ ├── Qt-Frameless-Window-DarkStyle-master/ │ │ ├── .gitignore │ │ ├── DarkStyle.cpp │ │ ├── DarkStyle.h │ │ ├── README.md │ │ ├── darkstyle/ │ │ │ └── darkstyle.qss │ │ ├── darkstyle.qrc │ │ ├── frameless_window_dark.pro │ │ ├── framelesswindow/ │ │ │ ├── framelesswindow.cpp │ │ │ ├── framelesswindow.h │ │ │ ├── framelesswindow.ui │ │ │ ├── windowdragger.cpp │ │ │ └── windowdragger.h │ │ └── framelesswindow.qrc │ ├── ZCharScanner.cpp │ ├── ZCharScanner.h │ ├── ZCharScannerWide.cpp │ ├── ZCharScannerWide.h │ ├── ZFile.cpp │ ├── ZFile.h │ ├── json.hpp │ ├── qcustomplot.cpp │ └── qcustomplot.h ├── g2p_train/ │ ├── README.md │ ├── config/ │ │ ├── default.yaml │ │ └── longer.yaml │ └── train_and_export.py ├── istftnettorch.cpp ├── istftnettorch.h ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── mainwindow.ui ├── melgen.cpp ├── melgen.h ├── modelinfodlg.cpp ├── modelinfodlg.h ├── modelinfodlg.ui ├── phddialog.cpp ├── phddialog.h ├── phddialog.ui ├── phonemizer.cpp ├── phonemizer.h ├── phoneticdict.cpp ├── phoneticdict.h ├── phonetichighlighter.cpp ├── phonetichighlighter.h ├── spectrogram.cpp ├── spectrogram.h ├── stdres.qrc ├── tacotron2.cpp ├── tacotron2.h ├── tacotron2torch.cpp ├── tacotron2torch.h ├── tfg2p.cpp ├── tfg2p.h ├── torchmoji.cpp ├── torchmoji.h ├── track.cpp ├── track.h ├── vits.cpp ├── vits.h ├── voicemanager.cpp ├── voicemanager.h ├── voxer.cpp └── voxer.h
Copy disabled (too large)
Download .txt
Showing preview only (46,808K chars total). Download the full file to get everything.
SYMBOL INDEX (1842 symbols across 74 files)
FILE: EnglishPhoneticProcessor.h
function class (line 9) | class EnglishPhoneticProcessor
FILE: FastSpeech2.h
function class (line 6) | class FastSpeech2 : public MelGen
FILE: MultiBandMelGAN.h
function class (line 5) | class MultiBandMelGAN
FILE: ONNXModel.cpp
function DoesFileExist (line 18) | bool DoesFileExist(const std::wstring& path) {
function GetDefaultAdapterName (line 26) | std::wstring GetDefaultAdapterName()
FILE: ONNXUtil.hpp
type ONNXUtil (line 12) | namespace ONNXUtil {
function print_shape (line 14) | std::string print_shape(const std::vector<std::int64_t>& v) {
function vec_to_tensor (line 22) | Ort::Value vec_to_tensor(std::vector<T>& data, const std::vector<std::...
function StringVectoCharVec (line 30) | std::vector<const char*> StringVectoCharVec(const std::vector<std::str...
FILE: Supertonic.cpp
function ToWide (line 12) | std::wstring ToWide(const std::string& value)
function CreateTensor (line 18) | Ort::Value CreateTensor(Ort::MemoryInfo& mem_info, std::vector<T>& data,...
FILE: Supertonic.h
type StyleData (line 21) | struct StyleData {
FILE: SupertonicTextProcessor.cpp
function IsAsciiSpace (line 16) | bool IsAsciiSpace(char32_t cp)
function IsEmoji (line 24) | bool IsEmoji(char32_t cp)
function IsTerminalPunct (line 29) | bool IsTerminalPunct(char32_t cp)
function ReplaceAll (line 63) | void ReplaceAll(std::u32string& text, const std::u32string& from, const ...
function TrimSpaces (line 75) | std::u32string TrimSpaces(const std::u32string& text)
function NormalizeSpaces (line 88) | std::u32string NormalizeSpaces(const std::u32string& text)
function AsciiToU32 (line 107) | std::u32string AsciiToU32(const std::string& text)
function DecomposeCharacter (line 354) | static void DecomposeCharacter(char32_t codepoint, std::u32string& output)
FILE: SupertonicTextProcessor.h
function class (line 10) | class SupertonicTextProcessor {
FILE: SupertonicVocoder.cpp
function ToWide (line 8) | std::wstring ToWide(const std::string& value)
function CountElements (line 13) | std::size_t CountElements(const std::vector<std::int64_t>& shape)
FILE: TextTokenizer.cpp
function string (line 70) | string TextTokenizer::SpaceChars(const string &InStr)
FILE: TextTokenizer.h
function class (line 7) | class TextTokenizer
FILE: VITSEvo.cpp
function ZeroPadVec (line 6) | std::vector<int64_t> ZeroPadVec(const std::vector<int32_t> &InIDs)
function CountElements (line 28) | std::size_t CountElements(const std::vector<std::int64_t>& shape)
FILE: Voice.cpp
function VoxResults (line 281) | VoxResults Voice::Vocalize(const std::string &Prompt, float Speed,
FILE: Voice.h
type VoxResults (line 21) | struct VoxResults{
function class (line 27) | class Voice
FILE: VoxCommon.cpp
function ProcessLanguageValue (line 60) | uint32_t ProcessLanguageValue(int32_t LangVal)
function VoiceInfo (line 75) | VoiceInfo VoxUtil::ReadModelJSON(const std::string &InfoFilename)
FILE: VoxCommon.hpp
type VoxCommon (line 31) | namespace VoxCommon{
type TFTensor (line 44) | struct TFTensor {
type ETTSRepo (line 52) | namespace ETTSRepo {
type Enum (line 53) | enum Enum{
type EText2MelModel (line 63) | namespace EText2MelModel {
type Enum (line 64) | enum Enum{
type EVocoderModel (line 76) | namespace EVocoderModel{
type Enum (line 77) | enum Enum{
type ETTSLanguage (line 92) | namespace ETTSLanguage{
type Enum (line 93) | enum Enum{
type ETTSLanguageType (line 117) | namespace ETTSLanguageType{
type Enum (line 118) | enum Enum{
type ArchitectureInfo (line 127) | struct ArchitectureInfo{
type VoiceInfo (line 139) | struct VoiceInfo{
type VoxUtil (line 160) | namespace VoxUtil {
function CopyTensor (line 175) | TFTensor<D> CopyTensor(const at::Tensor& InTens){
function CopyTensor (line 194) | TFTensor<F> CopyTensor(cppflow::tensor& InTens)
function FindInVec (line 208) | bool FindInVec(VXVec1 In, const std::vector<VXVec1>& Vec, size_t& OutI...
function FindInVec2 (line 224) | bool FindInVec2(VXVec1 In, const std::vector<X>& Vec, size_t& OutIdx, ...
FILE: attention.h
function class (line 7) | class Attention : public QCustomPlot
FILE: batchdenoisedlg.cpp
function InferDetails (line 24) | InferDetails MakeInferDetails(const std::vector<float>& InAudat,const QS...
FILE: batchdenoisedlg.h
function namespace (line 6) | namespace Ui {
function class (line 10) | class BatchDenoiseDlg : public QDialog
FILE: bert.h
function class (line 9) | class BERT
FILE: berttokenizer.cpp
function normalize_nfd (line 8) | static std::string normalize_nfd(const std::string& s) {
function isStripChar (line 19) | static bool isStripChar(const wchar_t& ch) {
function strip (line 23) | static std::wstring strip(const std::wstring& text) {
function split (line 34) | static std::vector<std::wstring> split(const std::wstring& text) {
function whitespaceTokenize (line 52) | static std::vector<std::wstring> whitespaceTokenize(const std::wstring& ...
function convertToUnicode (line 58) | static std::wstring convertToUnicode(const std::string& text) {
function convertFromUnicode (line 71) | static std::string convertFromUnicode(const std::wstring& wText) {
function tolower (line 82) | static std::wstring tolower(const std::wstring& s) {
function loadVocab (line 90) | static std::shared_ptr<Vocab> loadVocab(const std::string& vocabFile) {
FILE: berttokenizer.h
function class (line 14) | class BasicTokenizer {
function class (line 35) | class WordpieceTokenizer {
function class (line 46) | class FullTokenizer {
FILE: devits.cpp
function displayVectorInMessageBox (line 14) | void displayVectorInMessageBox(const std::vector<int>& numbers) {
FILE: devits.h
function class (line 5) | class DEVITS : public VITS
FILE: espeakphonemizer.h
function namespace (line 15) | namespace ESP{
function class (line 25) | class ESpeakPhonemizer
FILE: ext/AudioFile.hpp
type AudioFileFormat (line 55) | enum class AudioFileFormat
class AudioFile (line 65) | class AudioFile
type Endianness (line 158) | enum class Endianness
type WavAudioFormat (line 239) | enum WavAudioFormat
type AIFFAudioFormat (line 249) | enum AIFFAudioFormat
function AudioFileFormat (line 1111) | AudioFileFormat AudioFile<T>::determineAudioFileFormat (std::vector<uint...
function T (line 1201) | T AudioFile<T>::sixteenBitIntToSample (int16_t sample)
function T (line 1225) | T AudioFile<T>::singleByteToSample (uint8_t sample)
function T (line 1232) | T AudioFile<T>::clamp (T value, T minValue, T maxValue)
FILE: ext/ByteArr.cpp
function BYTE (line 126) | const BYTE * ByteArr::CoData() const
function BYTE (line 131) | BYTE &ByteArr::operator[](const size_t &Pos)
function BYTE (line 137) | const BYTE &ByteArr::operator[](const size_t &cPos) const
function QByteArray (line 310) | QByteArray ByteArr::ToQByteArr()
function smemcpy (line 449) | void smemcpy(void* dest,const size_t& destsz, const void* src,const size...
FILE: ext/ByteArr.h
type BYTE (line 38) | typedef unsigned char BYTE;
type INT64 (line 39) | typedef long long INT64;
type UINT64 (line 40) | typedef unsigned long long UINT64;
type std (line 41) | typedef std::vector<BYTE> ByteVec;
type ulong (line 42) | typedef unsigned long ulong;
function class (line 57) | class ByteArr
function operator (line 227) | void operator<<(const QString& QsEx)
function operator (line 233) | void operator>>(QString& QsOut)
FILE: ext/CppFlow/context.h
function namespace (line 15) | namespace cppflow {
function namespace (line 54) | namespace cppflow {
function context (line 86) | inline context::~context() {
FILE: ext/CppFlow/cppflow.h
function namespace (line 16) | namespace cppflow {
function namespace (line 30) | namespace cppflow {
FILE: ext/CppFlow/datatype.h
function namespace (line 14) | namespace cppflow {
FILE: ext/CppFlow/defer.h
function namespace (line 4) | namespace cppflow {
FILE: ext/CppFlow/model.h
function namespace (line 18) | namespace cppflow {
function namespace (line 44) | namespace cppflow {
function std (line 119) | inline std::vector<tensor> model::operator()(std::vector<std::tuple<std:...
function tensor (line 166) | inline tensor model::operator()(const tensor& input) {
FILE: ext/CppFlow/ops.h
function namespace (line 12) | namespace cppflow {
function namespace (line 55) | namespace cppflow {
function std (line 81) | inline std::string to_string(const tensor &t) {
FILE: ext/CppFlow/raw_ops.h
function namespace (line 26) | namespace cppflow {
function tensor (line 245) | inline tensor add_n(const std::vector<tensor>&inputs) {
function tensor (line 304) | inline tensor add_v2(const tensor& x, const tensor& y) {
function tensor (line 332) | inline tensor adjust_contrast(const tensor& images, const tensor& contra...
function tensor (line 368) | inline tensor adjust_contrastv2(const tensor& images, const tensor& cont...
function tensor (line 396) | inline tensor adjust_hue(const tensor& images, const tensor& delta) {
function tensor (line 424) | inline tensor adjust_saturation(const tensor& images, const tensor& scal...
function tensor (line 481) | inline tensor all_to_all(const tensor& input, const tensor& group_assign...
function tensor (line 535) | inline tensor anonymous_iterator(const std::vector<datatype>& output_typ...
function tensor (line 1473) | inline tensor asin(const tensor& x) {
function tensor (line 1497) | inline tensor asinh(const tensor& x) {
function tensor (line 1521) | inline tensor assert_cardinality_dataset(const tensor& input_dataset, co...
function tensor (line 1557) | inline tensor assert_next_dataset(const tensor& input_dataset, const ten...
function tensor (line 1678) | inline tensor atan(const tensor& x) {
function tensor (line 1702) | inline tensor atan2(const tensor& y, const tensor& x) {
function tensor (line 1730) | inline tensor atanh(const tensor& x) {
function tensor (line 2059) | inline tensor barrier_incomplete_size(const tensor& handle) {
function tensor (line 2083) | inline tensor barrier_ready_size(const tensor& handle) {
function tensor (line 2107) | inline tensor batch_cholesky(const tensor& input) {
function tensor (line 2131) | inline tensor batch_cholesky_grad(const tensor& l, const tensor& grad) {
function tensor (line 2159) | inline tensor batch_dataset(const tensor& input_dataset, const tensor& b...
function tensor (line 2236) | inline tensor batch_f_f_t(const tensor& input) {
function tensor (line 2260) | inline tensor batch_f_f_t2_d(const tensor& input) {
function tensor (line 2284) | inline tensor batch_f_f_t3_d(const tensor& input) {
function tensor (line 2308) | inline tensor batch_i_f_f_t(const tensor& input) {
function tensor (line 2332) | inline tensor batch_i_f_f_t2_d(const tensor& input) {
function tensor (line 2356) | inline tensor batch_i_f_f_t3_d(const tensor& input) {
function tensor (line 2438) | inline tensor batch_matrix_band_part(const tensor& input, const tensor& ...
function tensor (line 2470) | inline tensor batch_matrix_determinant(const tensor& input) {
function tensor (line 2494) | inline tensor batch_matrix_diag(const tensor& diagonal) {
function tensor (line 2518) | inline tensor batch_matrix_diag_part(const tensor& input) {
function tensor (line 2566) | inline tensor batch_matrix_set_diag(const tensor& input, const tensor& d...
function tensor (line 2683) | inline tensor batch_norm_with_global_normalization(const tensor& t, cons...
function tensor (line 2724) | inline tensor batch_self_adjoint_eig(const tensor& input) {
function tensor (line 2810) | inline tensor bessel_i0(const tensor& x) {
function tensor (line 2834) | inline tensor bessel_i0e(const tensor& x) {
function tensor (line 2858) | inline tensor bessel_i1(const tensor& x) {
function tensor (line 2882) | inline tensor bessel_i1e(const tensor& x) {
function tensor (line 2906) | inline tensor bessel_j0(const tensor& x) {
function tensor (line 2930) | inline tensor bessel_j1(const tensor& x) {
function tensor (line 2954) | inline tensor bessel_k0(const tensor& x) {
function tensor (line 2978) | inline tensor bessel_k0e(const tensor& x) {
function tensor (line 3002) | inline tensor bessel_k1(const tensor& x) {
function tensor (line 3026) | inline tensor bessel_k1e(const tensor& x) {
function tensor (line 3050) | inline tensor bessel_y0(const tensor& x) {
function tensor (line 3074) | inline tensor bessel_y1(const tensor& x) {
function tensor (line 3098) | inline tensor betainc(const tensor& a, const tensor& b, const tensor& x) {
function tensor (line 3182) | inline tensor bias_add_v1(const tensor& value, const tensor& bias) {
function tensor (line 3210) | inline tensor bincount(const tensor& arr, const tensor& size, const tens...
function tensor (line 3242) | inline tensor bitcast(const tensor& input, datatype type) {
function tensor (line 3266) | inline tensor bitwise_and(const tensor& x, const tensor& y) {
function tensor (line 3294) | inline tensor bitwise_or(const tensor& x, const tensor& y) {
function tensor (line 3322) | inline tensor bitwise_xor(const tensor& x, const tensor& y) {
function tensor (line 3350) | inline tensor boosted_trees_aggregate_stats(const tensor& node_ids, cons...
function tensor (line 3387) | inline tensor boosted_trees_bucketize(const std::vector<tensor>&float_va...
function tensor (line 3419) | inline tensor boosted_trees_center_bias(const tensor& tree_ensemble_hand...
function tensor (line 3481) | inline tensor boosted_trees_example_debug_outputs(const tensor& tree_ens...
function tensor (line 3512) | inline tensor boosted_trees_flush_quantile_summaries(const tensor& quant...
function tensor (line 3536) | inline tensor boosted_trees_make_quantile_summaries(const std::vector<te...
function tensor (line 3570) | inline tensor boosted_trees_make_stats_summary(const tensor& node_ids, c...
function tensor (line 3610) | inline tensor boosted_trees_predict(const tensor& tree_ensemble_handle, ...
function tensor (line 3641) | inline tensor boosted_trees_quantile_stream_resource_get_bucket_boundari...
function tensor (line 3687) | inline tensor broadcast_args(const tensor& s0, const tensor& s1) {
function tensor (line 3743) | inline tensor bucketize(const tensor& input, const std::vector<float>& b...
function tensor (line 3767) | inline tensor bytes_produced_stats_dataset(const tensor& input_dataset, ...
function tensor (line 3803) | inline tensor c_s_r_sparse_matrix_to_dense(const tensor& sparse_input, d...
function tensor (line 3827) | inline tensor c_s_v_dataset(const tensor& filenames, const tensor& compr...
function tensor (line 3893) | inline tensor cache_dataset(const tensor& input_dataset, const tensor& f...
function tensor (line 3929) | inline tensor cache_dataset_v2(const tensor& input_dataset, const tensor...
function tensor (line 3995) | inline tensor ceil(const tensor& x) {
function tensor (line 4019) | inline tensor check_numerics(const tensor& input_tensor, const std::stri...
function tensor (line 4043) | inline tensor check_numerics_v2(const tensor& input_tensor, const std::s...
function tensor (line 4067) | inline tensor cholesky(const tensor& input) {
function tensor (line 4091) | inline tensor cholesky_grad(const tensor& l, const tensor& grad) {
function tensor (line 4119) | inline tensor choose_fastest_dataset(const std::vector<tensor>&input_dat...
function tensor (line 4155) | inline tensor clip_by_value(const tensor& t, const tensor& clip_value_mi...
function tensor (line 4280) | inline tensor collective_permute(const tensor& input, const tensor& sour...
function tensor (line 4340) | inline tensor compare_and_bitpack(const tensor& input, const tensor& thr...
function tensor (line 4420) | inline tensor compress_element(const std::vector<tensor>&components, con...
function tensor (line 4446) | inline tensor concat(const tensor& concat_dim, const std::vector<tensor>...
function tensor (line 4476) | inline tensor concat_offset(const tensor& concat_dim, const std::vector<...
function tensor (line 4537) | inline tensor concatenate_dataset(const tensor& input_dataset, const ten...
function tensor (line 4626) | inline tensor conj(const tensor& input) {
function tensor (line 4678) | inline tensor const_tensor(const tensor& value, datatype dtype) {
function tensor (line 4841) | inline tensor conv3_d_backprop_filter(const tensor& input, const tensor&...
function tensor (line 4910) | inline tensor conv3_d_backprop_input(const tensor& input, const tensor& ...
function tensor (line 5038) | inline tensor cos(const tensor& x) {
function tensor (line 5062) | inline tensor cosh(const tensor& x) {
function tensor (line 5086) | inline tensor count_up_to(const tensor& ref, int64_t limit) {
function tensor (line 5219) | inline tensor cross(const tensor& a, const tensor& b) {
function tensor (line 5247) | inline tensor cross_replica_sum(const tensor& input, const tensor& group...
function tensor (line 5613) | inline tensor dataset_cardinality(const tensor& input_dataset) {
function tensor (line 5637) | inline tensor dataset_from_graph(const tensor& graph_def) {
function tensor (line 5716) | inline tensor dataset_to_single_element(const tensor& dataset, const std...
function tensor (line 5748) | inline tensor dawsn(const tensor& x) {
function tensor (line 5772) | inline tensor debug_gradient_identity(const tensor& input) {
function tensor (line 5796) | inline tensor debug_gradient_ref_identity(const tensor& input) {
function tensor (line 6009) | inline tensor decode_base64(const tensor& input) {
function tensor (line 6115) | inline tensor decode_gif(const tensor& contents) {
function tensor (line 6139) | inline tensor decode_j_s_o_n_example(const tensor& json_examples) {
function tensor (line 6271) | inline tensor deep_copy(const tensor& x) {
function tensor (line 6328) | inline tensor dense_to_c_s_r_sparse_matrix(const tensor& dense_input, co...
function tensor (line 6356) | inline tensor dense_to_sparse_batch_dataset(const tensor& input_dataset,...
function tensor (line 6560) | inline tensor destroy_temporary_variable(const tensor& ref, const std::s...
function tensor (line 6584) | inline tensor device_index(const std::vector< std::string>& device_names) {
function tensor (line 6609) | inline tensor diag(const tensor& diagonal) {
function tensor (line 6633) | inline tensor diag_part(const tensor& input) {
function tensor (line 6657) | inline tensor digamma(const tensor& x) {
function tensor (line 6681) | inline tensor dilation2_d(const tensor& input, const tensor& filter, con...
function tensor (line 6711) | inline tensor dilation2_d_backprop_filter(const tensor& input, const ten...
function tensor (line 6745) | inline tensor dilation2_d_backprop_input(const tensor& input, const tens...
function tensor (line 6779) | inline tensor directed_interleave_dataset(const tensor& selector_input_d...
function tensor (line 6818) | inline tensor div(const tensor& x, const tensor& y) {
function tensor (line 6846) | inline tensor div_no_nan(const tensor& x, const tensor& y) {
function tensor (line 6874) | inline tensor draw_bounding_boxes(const tensor& images, const tensor& bo...
function tensor (line 6902) | inline tensor draw_bounding_boxes_v2(const tensor& images, const tensor&...
function tensor (line 6934) | inline tensor dummy_iteration_counter() {
function tensor (line 6955) | inline tensor dummy_memory_cache() {
function tensor (line 6976) | inline tensor dummy_seed_generator() {
function tensor (line 6997) | inline tensor dynamic_partition(const tensor& data, const tensor& partit...
function tensor (line 7025) | inline tensor dynamic_stitch(const std::vector<tensor>&indices, const st...
function tensor (line 7130) | inline tensor einsum(const std::vector<tensor>&inputs, const std::string...
function tensor (line 7157) | inline tensor elu(const tensor& features) {
function tensor (line 7181) | inline tensor elu_grad(const tensor& gradients, const tensor& outputs) {
function tensor (line 7234) | inline tensor empty_tensor_list(const tensor& element_shape, const tenso...
function tensor (line 7319) | inline tensor encode_jpeg_variable_quality(const tensor& images, const t...
function tensor (line 7408) | inline tensor encode_wav(const tensor& audio, const tensor& sample_rate) {
function tensor (line 7436) | inline tensor ensure_shape(const tensor& input, const std::vector<int64_...
function tensor (line 7517) | inline tensor erf(const tensor& x) {
function tensor (line 7541) | inline tensor erfc(const tensor& x) {
function tensor (line 7565) | inline tensor erfinv(const tensor& x) {
function tensor (line 7618) | inline tensor exit(const tensor& data) {
function tensor (line 7642) | inline tensor exp(const tensor& x) {
function tensor (line 7694) | inline tensor experimental_assert_next_dataset(const tensor& input_datas...
function tensor (line 7771) | inline tensor experimental_bytes_produced_stats_dataset(const tensor& in...
function tensor (line 7807) | inline tensor experimental_c_s_v_dataset(const tensor& filenames, const ...
function tensor (line 7873) | inline tensor experimental_choose_fastest_dataset(const std::vector<tens...
function tensor (line 7909) | inline tensor experimental_dataset_cardinality(const tensor& input_datas...
function tensor (line 7933) | inline tensor experimental_dense_to_sparse_batch_dataset(const tensor& i...
function tensor (line 7973) | inline tensor experimental_directed_interleave_dataset(const tensor& sel...
function tensor (line 8012) | inline tensor experimental_ignore_errors_dataset(const tensor& input_dat...
function tensor (line 8044) | inline tensor experimental_iterator_get_device(const tensor& resource) {
function tensor (line 8068) | inline tensor experimental_l_m_d_b_dataset(const tensor& filenames, cons...
function tensor (line 8100) | inline tensor experimental_latency_stats_dataset(const tensor& input_dat...
function tensor (line 8136) | inline tensor experimental_matching_files_dataset(const tensor& patterns) {
function tensor (line 8160) | inline tensor experimental_max_intra_op_parallelism_dataset(const tensor...
function tensor (line 8196) | inline tensor experimental_non_serializable_dataset(const tensor& input_...
function tensor (line 8291) | inline tensor experimental_private_thread_pool_dataset(const tensor& inp...
function tensor (line 8327) | inline tensor experimental_random_dataset(const tensor& seed, const tens...
function tensor (line 8400) | inline tensor experimental_set_stats_aggregator_dataset(const tensor& in...
function tensor (line 8444) | inline tensor experimental_sleep_dataset(const tensor& input_dataset, co...
function tensor (line 8480) | inline tensor experimental_sliding_window_dataset(const tensor& input_da...
function tensor (line 8524) | inline tensor experimental_sql_dataset(const tensor& driver_name, const ...
function tensor (line 8586) | inline tensor experimental_stats_aggregator_summary(const tensor& iterat...
function tensor (line 8610) | inline tensor experimental_thread_pool_dataset(const tensor& input_datas...
function tensor (line 8671) | inline tensor experimental_unbatch_dataset(const tensor& input_dataset, ...
function tensor (line 8703) | inline tensor experimental_unique_dataset(const tensor& input_dataset, c...
function tensor (line 8735) | inline tensor expint(const tensor& x) {
function tensor (line 8759) | inline tensor expm1(const tensor& x) {
function tensor (line 8853) | inline tensor extract_image_patches(const tensor& images, const std::vec...
function tensor (line 8904) | inline tensor extract_volume_patches(const tensor& input, const std::vec...
function tensor (line 9066) | inline tensor fact() {
function tensor (line 9087) | inline tensor fake_param(datatype dtype, const std::vector<int64_t>& sha...
function tensor (line 9236) | inline tensor fake_queue(const tensor& resource) {
function tensor (line 9288) | inline tensor filter_by_last_component_dataset(const tensor& input_datas...
function tensor (line 9320) | inline tensor fingerprint(const tensor& data, const tensor& method) {
function tensor (line 9348) | inline tensor fixed_length_record_dataset(const tensor& filenames, const...
function tensor (line 9388) | inline tensor fixed_length_record_dataset_v2(const tensor& filenames, co...
function tensor (line 9485) | inline tensor floor(const tensor& x) {
function tensor (line 9509) | inline tensor floor_div(const tensor& x, const tensor& y) {
function tensor (line 9537) | inline tensor floor_mod(const tensor& x, const tensor& y) {
function tensor (line 9641) | inline tensor fresnel_cos(const tensor& x) {
function tensor (line 9665) | inline tensor fresnel_sin(const tensor& x) {
function tensor (line 9689) | inline tensor fused_pad_conv2_d(const tensor& input, const tensor& paddi...
function tensor (line 9792) | inline tensor gather_nd(const tensor& params, const tensor& indices, dat...
function tensor (line 9856) | inline tensor get_session_handle(const tensor& value) {
function tensor (line 9880) | inline tensor get_session_handle_v2(const tensor& value) {
function tensor (line 9904) | inline tensor get_session_tensor(const tensor& handle, datatype dtype) {
function tensor (line 9928) | inline tensor greater(const tensor& x, const tensor& y) {
function tensor (line 9956) | inline tensor greater_equal(const tensor& x, const tensor& y) {
function tensor (line 9984) | inline tensor guarantee_const_tensor(const tensor& input) {
function tensor (line 10008) | inline tensor h_s_v_to_r_g_b(const tensor& images) {
function tensor (line 10114) | inline tensor histogram_summary(const tensor& tag, const tensor& values) {
function tensor (line 10301) | inline tensor identity(const tensor& input) {
function tensor (line 10325) | inline tensor identity_n(const std::vector<tensor>&input) {
function tensor (line 10395) | inline tensor igamma(const tensor& a, const tensor& x) {
function tensor (line 10423) | inline tensor igamma_grad_a(const tensor& a, const tensor& x) {
function tensor (line 10451) | inline tensor igammac(const tensor& a, const tensor& x) {
function tensor (line 10479) | inline tensor ignore_errors_dataset(const tensor& input_dataset, const s...
function tensor (line 10601) | inline tensor immutable_const_tensor(datatype dtype, const std::vector<i...
function tensor (line 10627) | inline tensor in_top_k(const tensor& predictions, const tensor& targets,...
function tensor (line 10655) | inline tensor in_top_k_v2(const tensor& predictions, const tensor& targe...
function tensor (line 10687) | inline tensor infeed_dequeue(datatype dtype, const std::vector<int64_t>&...
function tensor (line 10712) | inline tensor infeed_dequeue_tuple(const std::vector<datatype>& dtypes, ...
function tensor (line 10741) | inline tensor inplace_add(const tensor& x, const tensor& i, const tensor...
function tensor (line 10773) | inline tensor inplace_sub(const tensor& x, const tensor& i, const tensor...
function tensor (line 10805) | inline tensor inplace_update(const tensor& x, const tensor& i, const ten...
function tensor (line 10837) | inline tensor inv(const tensor& x) {
function tensor (line 10861) | inline tensor inv_grad(const tensor& y, const tensor& dy) {
function tensor (line 10889) | inline tensor invert(const tensor& x) {
function tensor (line 10913) | inline tensor invert_permutation(const tensor& x) {
function tensor (line 10937) | inline tensor is_boosted_trees_ensemble_initialized(const tensor& tree_e...
function tensor (line 10961) | inline tensor is_boosted_trees_quantile_stream_resource_initialized(cons...
function tensor (line 10985) | inline tensor is_finite(const tensor& x) {
function tensor (line 11009) | inline tensor is_inf(const tensor& x) {
function tensor (line 11033) | inline tensor is_nan(const tensor& x) {
function tensor (line 11057) | inline tensor is_variable_initialized(const tensor& ref, datatype dtype) {
function tensor (line 11081) | inline tensor iterator(const std::string& shared_name, const std::string...
function tensor (line 11112) | inline tensor iterator_from_string_handle(const tensor& string_handle, c...
function tensor (line 11144) | inline tensor iterator_from_string_handle_v2(const tensor& string_handle...
function tensor (line 11176) | inline tensor iterator_get_device(const tensor& resource) {
function tensor (line 11200) | inline tensor iterator_get_next(const tensor& iterator, const std::vecto...
function tensor (line 11232) | inline tensor iterator_get_next_as_optional(const tensor& iterator, cons...
function tensor (line 11264) | inline tensor iterator_get_next_sync(const tensor& iterator, const std::...
function tensor (line 11296) | inline tensor iterator_to_string_handle(const tensor& resource_handle) {
function tensor (line 11320) | inline tensor iterator_v2(const std::string& shared_name, const std::str...
function tensor (line 11351) | inline tensor l2_loss(const tensor& t) {
function tensor (line 11375) | inline tensor l_m_d_b_dataset(const tensor& filenames, const std::vector...
function tensor (line 11491) | inline tensor latency_stats_dataset(const tensor& input_dataset, const t...
function tensor (line 11579) | inline tensor left_shift(const tensor& x, const tensor& y) {
function tensor (line 11607) | inline tensor less(const tensor& x, const tensor& y) {
function tensor (line 11635) | inline tensor less_equal(const tensor& x, const tensor& y) {
function tensor (line 11663) | inline tensor lgamma(const tensor& x) {
function tensor (line 11761) | inline tensor log(const tensor& x) {
function tensor (line 11785) | inline tensor log1p(const tensor& x) {
function tensor (line 11809) | inline tensor log_softmax(const tensor& logits) {
function tensor (line 11833) | inline tensor logical_and(const tensor& x, const tensor& y) {
function tensor (line 11861) | inline tensor logical_not(const tensor& x) {
function tensor (line 11885) | inline tensor logical_or(const tensor& x, const tensor& y) {
function tensor (line 11913) | inline tensor lookup_table_find(const tensor& table_handle, const tensor...
function tensor (line 11946) | inline tensor lookup_table_find_v2(const tensor& table_handle, const ten...
function tensor (line 11979) | inline tensor lookup_table_size(const tensor& table_handle) {
function tensor (line 12003) | inline tensor lookup_table_size_v2(const tensor& table_handle) {
function tensor (line 12027) | inline tensor loop_cond(const tensor& input) {
function tensor (line 12222) | inline tensor matching_files(const tensor& pattern) {
function tensor (line 12246) | inline tensor matching_files_dataset(const tensor& patterns) {
function tensor (line 12302) | inline tensor matrix_determinant(const tensor& input) {
function tensor (line 12326) | inline tensor matrix_diag(const tensor& diagonal) {
function tensor (line 12350) | inline tensor matrix_diag_part(const tensor& input) {
function tensor (line 12374) | inline tensor matrix_diag_part_v2(const tensor& input, const tensor& k, ...
function tensor (line 12438) | inline tensor matrix_diag_v2(const tensor& diagonal, const tensor& k, co...
function tensor (line 12518) | inline tensor matrix_exponential(const tensor& input) {
function tensor (line 12566) | inline tensor matrix_logarithm(const tensor& input) {
function tensor (line 12590) | inline tensor matrix_set_diag(const tensor& input, const tensor& diagona...
function tensor (line 12618) | inline tensor matrix_set_diag_v2(const tensor& input, const tensor& diag...
function tensor (line 12742) | inline tensor matrix_square_root(const tensor& input) {
function tensor (line 12824) | inline tensor max_intra_op_parallelism_dataset(const tensor& input_datas...
function tensor (line 13242) | inline tensor maximum(const tensor& x, const tensor& y) {
function tensor (line 13299) | inline tensor merge_summary(const std::vector<tensor>&inputs) {
function tensor (line 13385) | inline tensor minimum(const tensor& x, const tensor& y) {
function tensor (line 13471) | inline tensor mod(const tensor& x, const tensor& y) {
function tensor (line 13533) | inline tensor mul(const tensor& x, const tensor& y) {
function tensor (line 13561) | inline tensor mul_no_nan(const tensor& x, const tensor& y) {
function tensor (line 13589) | inline tensor multi_device_iterator(const std::vector< std::string>& dev...
function tensor (line 13625) | inline tensor multi_device_iterator_from_string_handle(const tensor& str...
function tensor (line 13657) | inline tensor multi_device_iterator_get_next_from_shard(const tensor& mu...
function tensor (line 13697) | inline tensor multi_device_iterator_init(const tensor& dataset, const te...
function tensor (line 13729) | inline tensor multi_device_iterator_to_string_handle(const tensor& multi...
function tensor (line 13963) | inline tensor mutex_lock(const tensor& mutex) {
function tensor (line 14009) | inline tensor nccl_all_reduce(const tensor& input, const std::string& re...
function tensor (line 14035) | inline tensor nccl_broadcast(const tensor& input, const std::vector<int6...
function tensor (line 14062) | inline tensor nccl_reduce(const std::vector<tensor>&input, const std::st...
function tensor (line 14089) | inline tensor ndtri(const tensor& x) {
function tensor (line 14113) | inline tensor neg(const tensor& x) {
function tensor (line 14137) | inline tensor next_after(const tensor& x1, const tensor& x2) {
function tensor (line 14165) | inline tensor next_iteration(const tensor& data) {
function tensor (line 14322) | inline tensor non_max_suppression_with_overlaps(const tensor& overlaps, ...
function tensor (line 14362) | inline tensor non_serializable_dataset(const tensor& input_dataset, cons...
function tensor (line 14487) | inline tensor ones_like(const tensor& x) {
function tensor (line 14511) | inline tensor optimize_dataset(const tensor& input_dataset, const tensor...
function tensor (line 14552) | inline tensor optional_from_value(const std::vector<tensor>&components, ...
function tensor (line 14578) | inline tensor optional_get_value(const tensor& optional, const std::vect...
function tensor (line 14610) | inline tensor optional_has_value(const tensor& optional) {
function tensor (line 14634) | inline tensor optional_none() {
function tensor (line 14912) | inline tensor padded_batch_dataset(const tensor& input_dataset, const te...
function tensor (line 15079) | inline tensor parallel_concat(const std::vector<tensor>&values, const st...
function tensor (line 15109) | inline tensor parallel_dynamic_stitch(const std::vector<tensor>&indices,...
function tensor (line 15323) | inline tensor parse_tensor(const tensor& serialized, datatype out_type) {
function tensor (line 15347) | inline tensor placeholder(datatype dtype, const std::vector<int64_t>& sh...
function tensor (line 15372) | inline tensor placeholder_v2(datatype dtype, const std::vector<int64_t>&...
function tensor (line 15397) | inline tensor placeholder_with_default(const tensor& input, datatype dty...
function tensor (line 15425) | inline tensor polygamma(const tensor& a, const tensor& x) {
function tensor (line 15453) | inline tensor population_count(const tensor& x) {
function tensor (line 15477) | inline tensor pow(const tensor& x, const tensor& y) {
function tensor (line 15543) | inline tensor prelinearize(const tensor& input, datatype dtype, const st...
function tensor (line 15572) | inline tensor prelinearize_tuple(const std::vector<tensor>&inputs, const...
function tensor (line 15728) | inline tensor private_thread_pool_dataset(const tensor& input_dataset, c...
function tensor (line 15793) | inline tensor py_func(const std::vector<tensor>&input, const std::string...
function tensor (line 15821) | inline tensor py_func_stateless(const std::vector<tensor>&input, const s...
function tensor (line 16181) | inline tensor queue_is_closed(const tensor& handle) {
function tensor (line 16205) | inline tensor queue_is_closed_v2(const tensor& handle) {
function tensor (line 16229) | inline tensor queue_size(const tensor& handle) {
function tensor (line 16253) | inline tensor queue_size_v2(const tensor& handle) {
function tensor (line 16364) | inline tensor r_g_b_to_h_s_v(const tensor& images) {
function tensor (line 16425) | inline tensor ragged_tensor_to_tensor(const tensor& shape, const tensor&...
function tensor (line 16532) | inline tensor random_dataset(const tensor& seed, const tensor& seed2, co...
function tensor (line 16598) | inline tensor random_gamma_grad(const tensor& alpha, const tensor& sampl...
function tensor (line 16902) | inline tensor range_dataset(const tensor& start, const tensor& stop, con...
function tensor (line 16942) | inline tensor rank(const tensor& input) {
function tensor (line 16966) | inline tensor read_file(const tensor& filename) {
function tensor (line 16990) | inline tensor read_variable_op(const tensor& resource, datatype dtype) {
function tensor (line 17014) | inline tensor reader_num_records_produced(const tensor& reader_handle) {
function tensor (line 17038) | inline tensor reader_num_records_produced_v2(const tensor& reader_handle) {
function tensor (line 17062) | inline tensor reader_num_work_units_completed(const tensor& reader_handl...
function tensor (line 17086) | inline tensor reader_num_work_units_completed_v2(const tensor& reader_ha...
function tensor (line 17110) | inline tensor reader_serialize_state(const tensor& reader_handle) {
function tensor (line 17134) | inline tensor reader_serialize_state_v2(const tensor& reader_handle) {
function tensor (line 17182) | inline tensor real_div(const tensor& x, const tensor& y) {
function tensor (line 17247) | inline tensor reciprocal(const tensor& x) {
function tensor (line 17271) | inline tensor reciprocal_grad(const tensor& y, const tensor& dy) {
function tensor (line 17352) | inline tensor recv_t_p_u_embedding_activations(int64_t num_outputs, cons...
function tensor (line 17429) | inline tensor ref_exit(const tensor& data) {
function tensor (line 17453) | inline tensor ref_identity(const tensor& input) {
function tensor (line 17477) | inline tensor ref_next_iteration(const tensor& data) {
function tensor (line 17501) | inline tensor ref_select(const tensor& index, const std::vector<tensor>&...
function tensor (line 17531) | inline tensor regex_full_match(const tensor& input, const tensor& patter...
function tensor (line 17591) | inline tensor register_dataset(const tensor& dataset, const tensor& addr...
function tensor (line 17623) | inline tensor relu(const tensor& features) {
function tensor (line 17647) | inline tensor relu6(const tensor& features) {
function tensor (line 17671) | inline tensor relu6_grad(const tensor& gradients, const tensor& features) {
function tensor (line 17699) | inline tensor relu_grad(const tensor& gradients, const tensor& features) {
function tensor (line 17727) | inline tensor repeat_dataset(const tensor& input_dataset, const tensor& ...
function tensor (line 17993) | inline tensor resource_accumulator_num_accumulated(const tensor& handle) {
function tensor (line 18017) | inline tensor resource_accumulator_take_gradient(const tensor& handle, c...
function tensor (line 18073) | inline tensor resource_count_up_to(const tensor& resource, int64_t limit) {
function tensor (line 18128) | inline tensor resource_gather_nd(const tensor& resource, const tensor& i...
function tensor (line 18219) | inline tensor restore_v2(const tensor& prefix, const tensor& input_tenso...
function tensor (line 18276) | inline tensor reverse(const tensor& input_tensor, const tensor& dims) {
function tensor (line 18362) | inline tensor right_shift(const tensor& x, const tensor& y) {
function tensor (line 18390) | inline tensor rint(const tensor& x) {
function tensor (line 18414) | inline tensor roll(const tensor& input, const tensor& shift, const tenso...
function tensor (line 18447) | inline tensor round(const tensor& x) {
function tensor (line 18471) | inline tensor rsqrt(const tensor& x) {
function tensor (line 18495) | inline tensor rsqrt_grad(const tensor& y, const tensor& dy) {
function tensor (line 18523) | inline tensor sampling_dataset(const tensor& input_dataset, const tensor...
function tensor (line 18567) | inline tensor scalar_summary(const tensor& tags, const tensor& values) {
function tensor (line 18834) | inline tensor scatter_nd(const tensor& indices, const tensor& updates, c...
function tensor (line 18965) | inline tensor scatter_nd_non_aliasing_add(const tensor& input, const ten...
function tensor (line 19129) | inline tensor sdca_fprint(const tensor& input) {
function tensor (line 19153) | inline tensor segment_max(const tensor& data, const tensor& segment_ids,...
function tensor (line 19181) | inline tensor segment_mean(const tensor& data, const tensor& segment_ids...
function tensor (line 19209) | inline tensor segment_min(const tensor& data, const tensor& segment_ids,...
function tensor (line 19237) | inline tensor segment_prod(const tensor& data, const tensor& segment_ids...
function tensor (line 19265) | inline tensor segment_sum(const tensor& data, const tensor& segment_ids,...
function tensor (line 19293) | inline tensor select(const tensor& condition, const tensor& t, const ten...
function tensor (line 19325) | inline tensor select_v2(const tensor& condition, const tensor& t, const ...
function tensor (line 19357) | inline tensor self_adjoint_eig(const tensor& input) {
function tensor (line 19381) | inline tensor selu(const tensor& features) {
function tensor (line 19405) | inline tensor selu_grad(const tensor& gradients, const tensor& outputs) {
function tensor (line 19521) | inline tensor serialize_tensor(const tensor& input_tensor) {
function tensor (line 19577) | inline tensor set_stats_aggregator_dataset(const tensor& input_dataset, ...
function tensor (line 19713) | inline tensor sharded_filename(const tensor& basename, const tensor& sha...
function tensor (line 19745) | inline tensor sharded_filespec(const tensor& basename, const tensor& num...
function tensor (line 19920) | inline tensor shuffle_dataset_v2(const tensor& input_dataset, const tens...
function tensor (line 20009) | inline tensor sigmoid(const tensor& x) {
function tensor (line 20033) | inline tensor sigmoid_grad(const tensor& y, const tensor& dy) {
function tensor (line 20061) | inline tensor sign(const tensor& x) {
function tensor (line 20085) | inline tensor sin(const tensor& x) {
function tensor (line 20109) | inline tensor sinh(const tensor& x) {
function tensor (line 20157) | inline tensor skip_dataset(const tensor& input_dataset, const tensor& co...
function tensor (line 20193) | inline tensor sleep_dataset(const tensor& input_dataset, const tensor& s...
function tensor (line 20229) | inline tensor slice(const tensor& input, const tensor& begin, const tens...
function tensor (line 20261) | inline tensor sliding_window_dataset(const tensor& input_dataset, const ...
function tensor (line 20305) | inline tensor snapshot(const tensor& input) {
function tensor (line 20411) | inline tensor softmax(const tensor& logits) {
function tensor (line 20435) | inline tensor softplus(const tensor& features) {
function tensor (line 20459) | inline tensor softplus_grad(const tensor& gradients, const tensor& featu...
function tensor (line 20487) | inline tensor softsign(const tensor& features) {
function tensor (line 20511) | inline tensor softsign_grad(const tensor& gradients, const tensor& featu...
function tensor (line 21271) | inline tensor sparse_dense_cwise_add(const tensor& sp_indices, const ten...
function tensor (line 21307) | inline tensor sparse_dense_cwise_div(const tensor& sp_indices, const ten...
function tensor (line 21343) | inline tensor sparse_dense_cwise_mul(const tensor& sp_indices, const ten...
function tensor (line 21412) | inline tensor sparse_matrix_add(const tensor& a, const tensor& b, const ...
function tensor (line 21481) | inline tensor sparse_matrix_mul(const tensor& a, const tensor& b) {
function tensor (line 21509) | inline tensor sparse_matrix_n_n_z(const tensor& sparse_matrix) {
function tensor (line 21533) | inline tensor sparse_matrix_ordering_a_m_d(const tensor& input) {
function tensor (line 21557) | inline tensor sparse_matrix_softmax(const tensor& logits, datatype type) {
function tensor (line 21581) | inline tensor sparse_matrix_softmax_grad(const tensor& softmax, const te...
function tensor (line 21609) | inline tensor sparse_matrix_sparse_cholesky(const tensor& input, const t...
function tensor (line 21694) | inline tensor sparse_matrix_zeros(const tensor& dense_shape, datatype ty...
function tensor (line 22077) | inline tensor sparse_slice_grad(const tensor& backprop_val_grad, const t...
function tensor (line 22113) | inline tensor sparse_softmax(const tensor& sp_indices, const tensor& sp_...
function tensor (line 22145) | inline tensor sparse_tensor_dense_add(const tensor& a_indices, const ten...
function tensor (line 22219) | inline tensor sparse_tensor_slice_dataset(const tensor& indices, const t...
function tensor (line 22251) | inline tensor sparse_tensor_to_c_s_r_sparse_matrix(const tensor& indices...
function tensor (line 22320) | inline tensor spence(const tensor& x) {
function tensor (line 22344) | inline tensor split(const tensor& split_dim, const tensor& value, int64_...
function tensor (line 22405) | inline tensor sql_dataset(const tensor& driver_name, const tensor& data_...
function tensor (line 22445) | inline tensor sqrt(const tensor& x) {
function tensor (line 22469) | inline tensor sqrt_grad(const tensor& y, const tensor& dy) {
function tensor (line 22497) | inline tensor square(const tensor& x) {
function tensor (line 22521) | inline tensor squared_difference(const tensor& x, const tensor& y) {
function tensor (line 22549) | inline tensor squeeze(const tensor& input, const std::vector<int64_t>& s...
function tensor (line 22595) | inline tensor stack_pop(const tensor& handle, datatype elem_type) {
function tensor (line 22619) | inline tensor stack_pop_v2(const tensor& handle, datatype elem_type) {
function tensor (line 23357) | inline tensor static_regex_full_match(const tensor& input, const std::st...
function tensor (line 23451) | inline tensor stats_aggregator_summary(const tensor& iterator) {
function tensor (line 23475) | inline tensor stop_gradient(const tensor& input) {
function tensor (line 23733) | inline tensor string_strip(const tensor& input) {
function tensor (line 23757) | inline tensor string_to_hash_bucket(const tensor& string_input_tensor, i...
function tensor (line 23781) | inline tensor string_to_hash_bucket_fast(const tensor& input, int64_t nu...
function tensor (line 23805) | inline tensor string_to_hash_bucket_strong(const tensor& input, int64_t ...
function tensor (line 23878) | inline tensor sub(const tensor& x, const tensor& y) {
function tensor (line 23989) | inline tensor t_f_record_dataset(const tensor& filenames, const tensor& ...
function tensor (line 24067) | inline tensor t_p_u_compilation_result() {
function tensor (line 24088) | inline tensor t_p_u_embedding_activations(const tensor& embedding_variab...
function tensor (line 24117) | inline tensor t_p_u_ordinal_selector() {
function tensor (line 24167) | inline tensor t_p_u_replicated_output(const tensor& input, int64_t num_r...
function tensor (line 24191) | inline tensor take_dataset(const tensor& input_dataset, const tensor& co...
function tensor (line 24227) | inline tensor tan(const tensor& x) {
function tensor (line 24251) | inline tensor tanh(const tensor& x) {
function tensor (line 24275) | inline tensor tanh_grad(const tensor& y, const tensor& dy) {
function tensor (line 24360) | inline tensor tensor_array_gather(const tensor& handle, const tensor& in...
function tensor (line 24396) | inline tensor tensor_array_gather_v2(const tensor& handle, const tensor&...
function tensor (line 24432) | inline tensor tensor_array_gather_v3(const tensor& handle, const tensor&...
function tensor (line 24468) | inline tensor tensor_array_grad(const tensor& handle, const tensor& flow...
function tensor (line 24496) | inline tensor tensor_array_grad_v2(const tensor& handle, const tensor& f...
function tensor (line 24524) | inline tensor tensor_array_pack(const tensor& handle, const tensor& flow...
function tensor (line 24556) | inline tensor tensor_array_read(const tensor& handle, const tensor& inde...
function tensor (line 24588) | inline tensor tensor_array_read_v2(const tensor& handle, const tensor& i...
function tensor (line 24620) | inline tensor tensor_array_read_v3(const tensor& handle, const tensor& i...
function tensor (line 24652) | inline tensor tensor_array_scatter(const tensor& handle, const tensor& i...
function tensor (line 24688) | inline tensor tensor_array_scatter_v2(const tensor& handle, const tensor...
function tensor (line 24724) | inline tensor tensor_array_scatter_v3(const tensor& handle, const tensor...
function tensor (line 24760) | inline tensor tensor_array_size(const tensor& handle, const tensor& flow...
function tensor (line 24788) | inline tensor tensor_array_size_v2(const tensor& handle, const tensor& f...
function tensor (line 24816) | inline tensor tensor_array_size_v3(const tensor& handle, const tensor& f...
function tensor (line 24844) | inline tensor tensor_array_split(const tensor& handle, const tensor& val...
function tensor (line 24880) | inline tensor tensor_array_split_v2(const tensor& handle, const tensor& ...
function tensor (line 24916) | inline tensor tensor_array_split_v3(const tensor& handle, const tensor& ...
function tensor (line 24952) | inline tensor tensor_array_unpack(const tensor& handle, const tensor& va...
function tensor (line 25015) | inline tensor tensor_array_write(const tensor& handle, const tensor& ind...
function tensor (line 25051) | inline tensor tensor_array_write_v2(const tensor& handle, const tensor& ...
function tensor (line 25087) | inline tensor tensor_array_write_v3(const tensor& handle, const tensor& ...
function tensor (line 25123) | inline tensor tensor_dataset(const std::vector<tensor>&components, const...
function tensor (line 25157) | inline tensor tensor_list_concat_lists(const tensor& input_a, const tens...
function tensor (line 25185) | inline tensor tensor_list_element_shape(const tensor& input_handle, data...
function tensor (line 25209) | inline tensor tensor_list_from_tensor(const tensor& input_tensor, const ...
function tensor (line 25238) | inline tensor tensor_list_gather(const tensor& input_handle, const tenso...
function tensor (line 25270) | inline tensor tensor_list_get_item(const tensor& input_handle, const ten...
function tensor (line 25302) | inline tensor tensor_list_length(const tensor& input_handle) {
function tensor (line 25326) | inline tensor tensor_list_push_back(const tensor& input_handle, const te...
function tensor (line 25354) | inline tensor tensor_list_push_back_batch(const tensor& input_handles, c...
function tensor (line 25382) | inline tensor tensor_list_reserve(const tensor& element_shape, const ten...
function tensor (line 25411) | inline tensor tensor_list_resize(const tensor& input_handle, const tenso...
function tensor (line 25439) | inline tensor tensor_list_scatter(const tensor& input_tensor, const tens...
function tensor (line 25472) | inline tensor tensor_list_scatter_into_existing_list(const tensor& input...
function tensor (line 25504) | inline tensor tensor_list_scatter_v2(const tensor& input_tensor, const t...
function tensor (line 25541) | inline tensor tensor_list_set_item(const tensor& input_handle, const ten...
function tensor (line 25573) | inline tensor tensor_list_split(const tensor& input_tensor, const tensor...
function tensor (line 25635) | inline tensor tensor_scatter_add(const tensor& input_tensor, const tenso...
function tensor (line 25667) | inline tensor tensor_scatter_max(const tensor& input_tensor, const tenso...
function tensor (line 25699) | inline tensor tensor_scatter_min(const tensor& input_tensor, const tenso...
function tensor (line 25731) | inline tensor tensor_scatter_sub(const tensor& input_tensor, const tenso...
function tensor (line 25763) | inline tensor tensor_scatter_update(const tensor& input_tensor, const te...
function tensor (line 25795) | inline tensor tensor_slice_dataset(const std::vector<tensor>&components,...
function tensor (line 25904) | inline tensor tensor_summary_v2(const tensor& tag, const tensor& input_t...
function tensor (line 25936) | inline tensor text_line_dataset(const tensor& filenames, const tensor& c...
function tensor (line 26014) | inline tensor thread_pool_dataset(const tensor& input_dataset, const ten...
function tensor (line 26103) | inline tensor tile_grad(const tensor& input, const tensor& multiples) {
function tensor (line 26131) | inline tensor timestamp() {
function tensor (line 26152) | inline tensor to_bool(const tensor& input) {
function tensor (line 26204) | inline tensor tridiagonal_mat_mul(const tensor& superdiag, const tensor&...
function tensor (line 26268) | inline tensor truncate_div(const tensor& x, const tensor& y) {
function tensor (line 26296) | inline tensor truncate_mod(const tensor& x, const tensor& y) {
function tensor (line 26384) | inline tensor unbatch_dataset(const tensor& input_dataset, const std::ve...
function tensor (line 26453) | inline tensor uncompress_element(const tensor& compressed, const std::ve...
function tensor (line 26516) | inline tensor unicode_script(const tensor& input) {
function tensor (line 26568) | inline tensor unique_dataset(const tensor& input_dataset, const std::vec...
function tensor (line 26844) | inline tensor unwrap_dataset_variant(const tensor& input_handle) {
function tensor (line 26928) | inline tensor var_is_initialized_op(const tensor& resource) {
function tensor (line 27030) | inline tensor where(const tensor& input) {
function tensor (line 27098) | inline tensor window_dataset(const tensor& input_dataset, const tensor& ...
function tensor (line 27146) | inline tensor worker_heartbeat(const tensor& request) {
function tensor (line 27170) | inline tensor wrap_dataset_variant(const tensor& input_handle) {
function tensor (line 27194) | inline tensor xdivy(const tensor& x, const tensor& y) {
function tensor (line 27222) | inline tensor xlog1py(const tensor& x, const tensor& y) {
function tensor (line 27250) | inline tensor xlogy(const tensor& x, const tensor& y) {
function tensor (line 27278) | inline tensor zeros_like(const tensor& x) {
function tensor (line 27302) | inline tensor zeta(const tensor& x, const tensor& q) {
function tensor (line 27330) | inline tensor zip_dataset(const std::vector<tensor>&input_datasets, cons...
FILE: ext/CppFlow/tensor.h
function namespace (line 18) | namespace cppflow {
function namespace (line 130) | namespace cppflow {
FILE: ext/Qt-Frameless-Window-DarkStyle-master/DarkStyle.cpp
function QStyle (line 24) | QStyle *DarkStyle::styleBase(QStyle *style) const {
function QStyle (line 29) | QStyle *DarkStyle::baseStyle() const
FILE: ext/Qt-Frameless-Window-DarkStyle-master/DarkStyle.h
function class (line 23) | class DarkStyle : public QProxyStyle
FILE: ext/Qt-Frameless-Window-DarkStyle-master/framelesswindow/framelesswindow.h
function namespace (line 20) | namespace Ui {
function class (line 24) | class MouseButtonSignaler: public QObject
function class (line 47) | class FramelessWindow: public QWidget
FILE: ext/Qt-Frameless-Window-DarkStyle-master/framelesswindow/windowdragger.h
function class (line 20) | class WindowDragger : public QWidget
FILE: ext/ZCharScanner.cpp
function GString (line 111) | GString ZStringDelimiter::operator[](const size_t & in_index)
function GString (line 119) | GString ZStringDelimiter::Reassemble(const GString& delim, const int& ne...
function GString (line 157) | GString ZStringDelimiter::Reassemble(const GString & delim, const std::v...
FILE: ext/ZCharScanner.h
type std (line 14) | typedef std::vector<GString>::const_iterator TokenIterator;
function class (line 22) | class ZStringDelimiter
function szTokens (line 55) | size_t szTokens() { return m_vTokens.size(); }
function std (line 64) | const std::vector<GString>& GetTokens() { return m_vTokens; }
function TokenIterator (line 66) | TokenIterator itBegin() { return m_vTokens.begin(); }
function TokenIterator (line 67) | TokenIterator itEnd() { return m_vTokens.end(); }
function SetText (line 69) | void SetText(const GString& in_Txt) {
FILE: ext/ZCharScannerWide.h
type std (line 9) | typedef std::vector<std::wstring>::const_iterator TokenIterator;
function class (line 17) | class ZStringDelimiterWide
FILE: ext/ZFile.cpp
function INT64 (line 49) | INT64 ZFile::GetPos()
function INT64 (line 68) | INT64 ZFile::GetFileLength()
function ByteArr (line 96) | ByteArr ZFile::ReadEntireFile()
FILE: ext/ZFile.h
type std (line 33) | typedef std::basic_fstream<BYTE,std::char_traits<BYTE>> ufstream;
function namespace (line 37) | namespace EZFOpenMode {
function namespace (line 46) | namespace EZFEndian {
function namespace (line 55) | namespace ZFUtil {
function class (line 78) | class ZFile
function operator (line 226) | void operator<<(const ByteArr& BarDat) {
FILE: ext/json.hpp
type nlohmann (line 81) | namespace nlohmann
type detail (line 83) | namespace detail
type position_t (line 86) | struct position_t
class exception (line 2352) | class exception : public std::exception
method JSON_HEDLEY_RETURNS_NON_NULL (line 2356) | JSON_HEDLEY_RETURNS_NON_NULL
method JSON_HEDLEY_NON_NULL (line 2366) | JSON_HEDLEY_NON_NULL(3)
method name (line 2369) | static std::string name(const std::string& ename, int id_)
class parse_error (line 2424) | class parse_error : public exception
method parse_error (line 2436) | static parse_error create(int id_, const position_t& pos, const st...
method parse_error (line 2443) | static parse_error create(int id_, std::size_t byte_, const std::s...
method parse_error (line 2463) | parse_error(int id_, std::size_t byte_, const char* what_arg)
method position_string (line 2466) | static std::string position_string(const position_t& pos)
class invalid_iterator (line 2510) | class invalid_iterator : public exception
method invalid_iterator (line 2513) | static invalid_iterator create(int id_, const std::string& what_arg)
method JSON_HEDLEY_NON_NULL (line 2520) | JSON_HEDLEY_NON_NULL(3)
class type_error (line 2564) | class type_error : public exception
method type_error (line 2567) | static type_error create(int id_, const std::string& what_arg)
method JSON_HEDLEY_NON_NULL (line 2574) | JSON_HEDLEY_NON_NULL(3)
class out_of_range (line 2611) | class out_of_range : public exception
method out_of_range (line 2614) | static out_of_range create(int id_, const std::string& what_arg)
method JSON_HEDLEY_NON_NULL (line 2621) | JSON_HEDLEY_NON_NULL(3)
class other_error (line 2649) | class other_error : public exception
method other_error (line 2652) | static other_error create(int id_, const std::string& what_arg)
method JSON_HEDLEY_NON_NULL (line 2659) | JSON_HEDLEY_NON_NULL(3)
type index_sequence (line 2687) | struct index_sequence
method size (line 2691) | static constexpr std::size_t size() noexcept
type merge_and_renumber (line 2698) | struct merge_and_renumber
type make_index_sequence (line 2705) | struct make_index_sequence
type make_index_sequence<0> (line 2709) | struct make_index_sequence<0> : index_sequence<> {}
type make_index_sequence<1> (line 2710) | struct make_index_sequence<1> : index_sequence<0> {}
type priority_tag (line 2716) | struct priority_tag : priority_tag < N - 1 > {}
type priority_tag<0> (line 2717) | struct priority_tag<0> {}
type static_const (line 2721) | struct static_const
type make_void (line 2750) | struct make_void
type iterator_types (line 2766) | struct iterator_types {}
type iterator_types <
It,
void_t<typename It::difference_type, typename It::value_type, typename It::pointer,
typename It::reference, typename It::iterator_category >> (line 2769) | struct iterator_types <
type iterator_traits (line 2784) | struct iterator_traits
type iterator_traits < T, enable_if_t < !std::is_pointer<T>::value >> (line 2789) | struct iterator_traits < T, enable_if_t < !std::is_pointer<T>::value >>
type iterator_traits<T*, enable_if_t<std::is_object<T>::value>> (line 2795) | struct iterator_traits<T*, enable_if_t<std::is_object<T>::value>>
type nonesuch (line 2823) | struct nonesuch
method nonesuch (line 2825) | nonesuch() = delete;
method nonesuch (line 2827) | nonesuch(nonesuch const&) = delete;
method nonesuch (line 2828) | nonesuch(nonesuch const&&) = delete;
type detector (line 2837) | struct detector
type is_basic_json (line 2977) | struct is_basic_json : std::false_type {}
class json_ref (line 2987) | class json_ref
method json_ref (line 12532) | json_ref(value_type&& value)
method json_ref (line 12538) | json_ref(const value_type& value)
method json_ref (line 12543) | json_ref(std::initializer_list<json_ref> init)
method json_ref (line 12552) | json_ref(Args && ... args)
method json_ref (line 12559) | json_ref(json_ref&&) = default;
method json_ref (line 12560) | json_ref(const json_ref&) = delete;
method json_ref (line 12561) | json_ref& operator=(const json_ref&) = delete;
method json_ref (line 12562) | json_ref& operator=(json_ref&&) = delete;
method value_type (line 12565) | value_type moved_or_copied() const
method value_type (line 12574) | value_type const& operator*() const
method value_type (line 12579) | value_type const* operator->() const
type is_json_ref (line 2990) | struct is_json_ref : std::false_type {}
type is_json_ref<json_ref<T>> (line 2993) | struct is_json_ref<json_ref<T>> : std::true_type {}
type has_from_json (line 3034) | struct has_from_json : std::false_type {}
type is_getable (line 3041) | struct is_getable
type has_from_json < BasicJsonType, T,
enable_if_t < !is_basic_json<T>::value >> (line 3047) | struct has_from_json < BasicJsonType, T,
type has_non_default_from_json (line 3060) | struct has_non_default_from_json : std::false_type {}
type has_non_default_from_json < BasicJsonType, T, enable_if_t < !is_basic_json<T>::value >> (line 3063) | struct has_non_default_from_json < BasicJsonType, T, enable_if_t < !...
type has_to_json (line 3075) | struct has_to_json : std::false_type {}
type has_to_json < BasicJsonType, T, enable_if_t < !is_basic_json<T>::value >> (line 3078) | struct has_to_json < BasicJsonType, T, enable_if_t < !is_basic_json<...
type is_iterator_traits (line 3093) | struct is_iterator_traits : std::false_type {}
type is_iterator_traits<iterator_traits<T>> (line 3096) | struct is_iterator_traits<iterator_traits<T>>
type is_complete_type (line 3113) | struct is_complete_type : std::false_type {}
type is_complete_type<T, decltype(void(sizeof(T)))> (line 3116) | struct is_complete_type<T, decltype(void(sizeof(T)))> : std::true_ty...
type is_compatible_object_type_impl (line 3120) | struct is_compatible_object_type_impl : std::false_type {}
type is_compatible_object_type_impl <
BasicJsonType, CompatibleObjectType,
enable_if_t < is_detected<mapped_type_t, CompatibleObjectType>::value&&
is_detected<key_type_t, CompatibleObjectType>::value >> (line 3123) | struct is_compatible_object_type_impl <
type is_compatible_object_type (line 3140) | struct is_compatible_object_type
type is_constructible_object_type_impl (line 3145) | struct is_constructible_object_type_impl : std::false_type {}
type is_constructible_object_type_impl <
BasicJsonType, ConstructibleObjectType,
enable_if_t < is_detected<mapped_type_t, ConstructibleObjectType>::value&&
is_detected<key_type_t, ConstructibleObjectType>::value >> (line 3148) | struct is_constructible_object_type_impl <
type is_constructible_object_type (line 3172) | struct is_constructible_object_type
type is_compatible_string_type_impl (line 3178) | struct is_compatible_string_type_impl : std::false_type {}
type is_compatible_string_type_impl <
BasicJsonType, CompatibleStringType,
enable_if_t<is_detected_exact<typename BasicJsonType::string_t::value_type,
value_type_t, CompatibleStringType>::value >> (line 3181) | struct is_compatible_string_type_impl <
type is_compatible_string_type (line 3191) | struct is_compatible_string_type
type is_constructible_string_type_impl (line 3196) | struct is_constructible_string_type_impl : std::false_type {}
type is_constructible_string_type_impl <
BasicJsonType, ConstructibleStringType,
enable_if_t<is_detected_exact<typename BasicJsonType::string_t::value_type,
value_type_t, ConstructibleStringType>::value >> (line 3199) | struct is_constructible_string_type_impl <
type is_constructible_string_type (line 3210) | struct is_constructible_string_type
type is_compatible_array_type_impl (line 3214) | struct is_compatible_array_type_impl : std::false_type {}
type is_compatible_array_type (line 3233) | struct is_compatible_array_type
type is_constructible_array_type_impl (line 3237) | struct is_constructible_array_type_impl : std::false_type {}
type is_constructible_array_type_impl <
BasicJsonType, ConstructibleArrayType,
enable_if_t<std::is_same<ConstructibleArrayType,
typename BasicJsonType::value_type>::value >> (line 3240) | struct is_constructible_array_type_impl <
type is_constructible_array_type_impl <
BasicJsonType, ConstructibleArrayType,
enable_if_t < !std::is_same<ConstructibleArrayType,
typename BasicJsonType::value_type>::value&&
std::is_default_constructible<ConstructibleArrayType>::value&&
(std::is_move_assignable<ConstructibleArrayType>::value ||
std::is_copy_assignable<ConstructibleArrayType>::value)&&
is_detected<value_type_t, ConstructibleArrayType>::value&&
is_detected<iterator_t, ConstructibleArrayType>::value&&
is_complete_type <
detected_t<value_type_t, ConstructibleArrayType >>::value >> (line 3247) | struct is_constructible_array_type_impl <
type is_constructible_array_type (line 3276) | struct is_constructible_array_type
type is_compatible_integer_type_impl (line 3281) | struct is_compatible_integer_type_impl : std::false_type {}
type is_compatible_integer_type_impl <
RealIntegerType, CompatibleNumberIntegerType,
enable_if_t < std::is_integral<RealIntegerType>::value&&
std::is_integral<CompatibleNumberIntegerType>::value&&
!std::is_same<bool, CompatibleNumberIntegerType>::value >> (line 3284) | struct is_compatible_integer_type_impl <
type is_compatible_integer_type (line 3302) | struct is_compatible_integer_type
type is_compatible_type_impl (line 3307) | struct is_compatible_type_impl: std::false_type {}
type is_compatible_type_impl <
BasicJsonType, CompatibleType,
enable_if_t<is_complete_type<CompatibleType>::value >> (line 3310) | struct is_compatible_type_impl <
type is_compatible_type (line 3319) | struct is_compatible_type
type conjunction (line 3323) | struct conjunction : std::true_type { }
type conjunction<B1> (line 3324) | struct conjunction<B1> : B1 { }
type is_constructible_tuple (line 3330) | struct is_constructible_tuple : std::false_type {}
type value_t (line 3377) | enum class value_t : std::uint8_t
function from_json (line 3426) | void from_json(const BasicJsonType& j, typename std::nullptr_t& n)
function get_arithmetic_value (line 3440) | void get_arithmetic_value(const BasicJsonType& j, ArithmeticType& val)
function from_json (line 3466) | void from_json(const BasicJsonType& j, typename BasicJsonType::boole...
function from_json (line 3476) | void from_json(const BasicJsonType& j, typename BasicJsonType::strin...
function from_json (line 3492) | void from_json(const BasicJsonType& j, ConstructibleStringType& s)
function from_json (line 3503) | void from_json(const BasicJsonType& j, typename BasicJsonType::numbe...
function from_json (line 3509) | void from_json(const BasicJsonType& j, typename BasicJsonType::numbe...
function from_json (line 3515) | void from_json(const BasicJsonType& j, typename BasicJsonType::numbe...
function from_json (line 3522) | void from_json(const BasicJsonType& j, EnumType& e)
function from_json (line 3532) | void from_json(const BasicJsonType& j, std::forward_list<T, Allocato...
function from_json (line 3549) | void from_json(const BasicJsonType& j, std::valarray<T>& l)
function from_json (line 3564) | auto from_json(const BasicJsonType& j, T (&arr)[N])
function from_json_array_impl (line 3574) | void from_json_array_impl(const BasicJsonType& j, typename BasicJson...
function from_json_array_impl (line 3580) | auto from_json_array_impl(const BasicJsonType& j, std::array<T, N>& ...
function from_json_array_impl (line 3591) | auto from_json_array_impl(const BasicJsonType& j, ConstructibleArray...
function from_json_array_impl (line 3612) | void from_json_array_impl(const BasicJsonType& j, ConstructibleArray...
function from_json (line 3637) | auto from_json(const BasicJsonType& j, ConstructibleArrayType& arr)
function from_json (line 3652) | void from_json(const BasicJsonType& j, typename BasicJsonType::binar...
function from_json (line 3664) | void from_json(const BasicJsonType& j, ConstructibleObjectType& obj)
function from_json (line 3696) | void from_json(const BasicJsonType& j, ArithmeticType& val)
function from_json (line 3727) | void from_json(const BasicJsonType& j, std::pair<A1, A2>& p)
function from_json_tuple_impl (line 3733) | void from_json_tuple_impl(const BasicJsonType& j, Tuple& t, index_se...
function from_json (line 3739) | void from_json(const BasicJsonType& j, std::tuple<Args...>& t)
function from_json (line 3747) | void from_json(const BasicJsonType& j, std::map<Key, Value, Compare,...
function from_json (line 3767) | void from_json(const BasicJsonType& j, std::unordered_map<Key, Value...
type from_json_fn (line 3784) | struct from_json_fn
function int_to_string (line 3835) | void int_to_string( string_type& target, std::size_t value )
class iteration_proxy_value (line 3841) | class iteration_proxy_value
method iteration_proxy_value (line 3864) | explicit iteration_proxy_value(IteratorType it) noexcept : anchor(...
method iteration_proxy_value (line 3867) | iteration_proxy_value& operator*()
method iteration_proxy_value (line 3873) | iteration_proxy_value& operator++()
method string_type (line 3894) | const string_type& key() const
method value (line 3922) | typename IteratorType::reference value() const
class iteration_proxy (line 3929) | class iteration_proxy
method iteration_proxy (line 3937) | explicit iteration_proxy(typename IteratorType::reference cont) no...
method begin (line 3941) | iteration_proxy_value<IteratorType> begin() noexcept
method end (line 3947) | iteration_proxy_value<IteratorType> end() noexcept
function get (line 3956) | auto get(const nlohmann::detail::iteration_proxy_value<IteratorType>...
function get (line 3964) | auto get(const nlohmann::detail::iteration_proxy_value<IteratorType>...
type external_constructor (line 4014) | struct external_constructor
type external_constructor<value_t::boolean> (line 4017) | struct external_constructor<value_t::boolean>
method construct (line 4020) | static void construct(BasicJsonType& j, typename BasicJsonType::bo...
type external_constructor<value_t::string> (line 4029) | struct external_constructor<value_t::string>
method construct (line 4032) | static void construct(BasicJsonType& j, const typename BasicJsonTy...
method construct (line 4040) | static void construct(BasicJsonType& j, typename BasicJsonType::st...
method construct (line 4050) | static void construct(BasicJsonType& j, const CompatibleStringType...
type external_constructor<value_t::binary> (line 4059) | struct external_constructor<value_t::binary>
method construct (line 4062) | static void construct(BasicJsonType& j, const typename BasicJsonTy...
method construct (line 4071) | static void construct(BasicJsonType& j, typename BasicJsonType::bi...
type external_constructor<value_t::number_float> (line 4081) | struct external_constructor<value_t::number_float>
method construct (line 4084) | static void construct(BasicJsonType& j, typename BasicJsonType::nu...
type external_constructor<value_t::number_unsigned> (line 4093) | struct external_constructor<value_t::number_unsigned>
method construct (line 4096) | static void construct(BasicJsonType& j, typename BasicJsonType::nu...
type external_constructor<value_t::number_integer> (line 4105) | struct external_constructor<value_t::number_integer>
method construct (line 4108) | static void construct(BasicJsonType& j, typename BasicJsonType::nu...
type external_constructor<value_t::array> (line 4117) | struct external_constructor<value_t::array>
method construct (line 4120) | static void construct(BasicJsonType& j, const typename BasicJsonTy...
method construct (line 4128) | static void construct(BasicJsonType& j, typename BasicJsonType::ar...
method construct (line 4138) | static void construct(BasicJsonType& j, const CompatibleArrayType&...
method construct (line 4148) | static void construct(BasicJsonType& j, const std::vector<bool>& arr)
method construct (line 4162) | static void construct(BasicJsonType& j, const std::valarray<T>& arr)
type external_constructor<value_t::object> (line 4176) | struct external_constructor<value_t::object>
method construct (line 4179) | static void construct(BasicJsonType& j, const typename BasicJsonTy...
method construct (line 4187) | static void construct(BasicJsonType& j, typename BasicJsonType::ob...
method construct (line 4196) | static void construct(BasicJsonType& j, const CompatibleObjectType...
function to_json (line 4213) | void to_json(BasicJsonType& j, T b) noexcept
function to_json (line 4220) | void to_json(BasicJsonType& j, const CompatibleString& s)
function to_json (line 4226) | void to_json(BasicJsonType& j, typename BasicJsonType::string_t&& s)
function to_json (line 4233) | void to_json(BasicJsonType& j, FloatType val) noexcept
function to_json (line 4240) | void to_json(BasicJsonType& j, CompatibleNumberUnsignedType val) noe...
function to_json (line 4247) | void to_json(BasicJsonType& j, CompatibleNumberIntegerType val) noex...
function to_json (line 4254) | void to_json(BasicJsonType& j, EnumType e) noexcept
function to_json (line 4261) | void to_json(BasicJsonType& j, const std::vector<bool>& e)
function to_json (line 4274) | void to_json(BasicJsonType& j, const CompatibleArrayType& arr)
function to_json (line 4280) | void to_json(BasicJsonType& j, const typename BasicJsonType::binary_...
function to_json (line 4287) | void to_json(BasicJsonType& j, const std::valarray<T>& arr)
function to_json (line 4293) | void to_json(BasicJsonType& j, typename BasicJsonType::array_t&& arr)
function to_json (line 4300) | void to_json(BasicJsonType& j, const CompatibleObjectType& obj)
function to_json (line 4306) | void to_json(BasicJsonType& j, typename BasicJsonType::object_t&& obj)
function to_json (line 4316) | void to_json(BasicJsonType& j, const T(&arr)[N])
function to_json (line 4322) | void to_json(BasicJsonType& j, const std::pair<T1, T2>& p)
function to_json (line 4330) | void to_json(BasicJsonType& j, const T& b)
function to_json_tuple_impl (line 4336) | void to_json_tuple_impl(BasicJsonType& j, const Tuple& t, index_sequ...
function to_json (line 4342) | void to_json(BasicJsonType& j, const T& t)
type to_json_fn (line 4347) | struct to_json_fn
function combine (line 4595) | inline std::size_t combine(std::size_t seed, std::size_t h) noexcept
function hash (line 4613) | std::size_t hash(const BasicJsonType& j)
type input_format_t (line 4744) | enum class input_format_t { json, cbor, msgpack, ubjson, bson }
class file_input_adapter (line 4754) | class file_input_adapter
method file_input_adapter (line 4760) | explicit file_input_adapter(std::FILE* f) noexcept
method file_input_adapter (line 4765) | file_input_adapter(const file_input_adapter&) = delete;
method file_input_adapter (line 4766) | file_input_adapter(file_input_adapter&&) = default;
method file_input_adapter (line 4767) | file_input_adapter& operator=(const file_input_adapter&) = delete;
method file_input_adapter (line 4768) | file_input_adapter& operator=(file_input_adapter&&) = delete;
method get_character (line 4770) | std::char_traits<char>::int_type get_character() noexcept
class input_stream_adapter (line 4790) | class input_stream_adapter
method input_stream_adapter (line 4805) | explicit input_stream_adapter(std::istream& i)
method input_stream_adapter (line 4810) | input_stream_adapter(const input_stream_adapter&) = delete;
method input_stream_adapter (line 4811) | input_stream_adapter& operator=(input_stream_adapter&) = delete;
method input_stream_adapter (line 4812) | input_stream_adapter& operator=(input_stream_adapter&& rhs) = delete;
method input_stream_adapter (line 4814) | input_stream_adapter(input_stream_adapter&& rhs) noexcept : is(rhs...
method get_character (line 4823) | std::char_traits<char>::int_type get_character()
class iterator_input_adapter (line 4843) | class iterator_input_adapter
method iterator_input_adapter (line 4848) | iterator_input_adapter(IteratorType first, IteratorType last)
method get_character (line 4851) | typename std::char_traits<char_type>::int_type get_character()
method empty (line 4872) | bool empty() const
type wide_string_input_helper (line 4881) | struct wide_string_input_helper
type wide_string_input_helper<BaseInputAdapter, 4> (line 4884) | struct wide_string_input_helper<BaseInputAdapter, 4>
method fill_buffer (line 4887) | static void fill_buffer(BaseInputAdapter& input,
type wide_string_input_helper<BaseInputAdapter, 2> (line 4942) | struct wide_string_input_helper<BaseInputAdapter, 2>
method fill_buffer (line 4945) | static void fill_buffer(BaseInputAdapter& input,
class wide_string_input_adapter (line 5005) | class wide_string_input_adapter
method wide_string_input_adapter (line 5010) | wide_string_input_adapter(BaseInputAdapter base)
method get_character (line 5013) | typename std::char_traits<char>::int_type get_character() noexcept
method fill_buffer (line 5034) | void fill_buffer()
type iterator_input_adapter_factory (line 5050) | struct iterator_input_adapter_factory
method adapter_type (line 5056) | static adapter_type create(IteratorType first, IteratorType last)
type is_iterator_of_multibyte (line 5063) | struct is_iterator_of_multibyte
type iterator_input_adapter_factory<IteratorType, enable_if_t<is_iterator_of_multibyte<IteratorType>::value>> (line 5073) | struct iterator_input_adapter_factory<IteratorType, enable_if_t<is_i...
method adapter_type (line 5080) | static adapter_type create(IteratorType first, IteratorType last)
function input_adapter (line 5088) | typename iterator_input_adapter_factory<IteratorType>::adapter_type ...
function input_adapter (line 5096) | auto input_adapter(const ContainerType& container) -> decltype(input...
function file_input_adapter (line 5106) | inline file_input_adapter input_adapter(std::FILE* file)
method file_input_adapter (line 4760) | explicit file_input_adapter(std::FILE* f) noexcept
method file_input_adapter (line 4765) | file_input_adapter(const file_input_adapter&) = delete;
method file_input_adapter (line 4766) | file_input_adapter(file_input_adapter&&) = default;
method file_input_adapter (line 4767) | file_input_adapter& operator=(const file_input_adapter&) = delete;
method file_input_adapter (line 4768) | file_input_adapter& operator=(file_input_adapter&&) = delete;
method get_character (line 4770) | std::char_traits<char>::int_type get_character() noexcept
function input_stream_adapter (line 5111) | inline input_stream_adapter input_adapter(std::istream& stream)
method input_stream_adapter (line 4805) | explicit input_stream_adapter(std::istream& i)
method input_stream_adapter (line 4810) | input_stream_adapter(const input_stream_adapter&) = delete;
method input_stream_adapter (line 4811) | input_stream_adapter& operator=(input_stream_adapter&) = delete;
method input_stream_adapter (line 4812) | input_stream_adapter& operator=(input_stream_adapter&& rhs) = delete;
method input_stream_adapter (line 4814) | input_stream_adapter(input_stream_adapter&& rhs) noexcept : is(rhs...
method get_character (line 4823) | std::char_traits<char>::int_type get_character()
function input_stream_adapter (line 5116) | inline input_stream_adapter input_adapter(std::istream&& stream)
method input_stream_adapter (line 4805) | explicit input_stream_adapter(std::istream& i)
method input_stream_adapter (line 4810) | input_stream_adapter(const input_stream_adapter&) = delete;
method input_stream_adapter (line 4811) | input_stream_adapter& operator=(input_stream_adapter&) = delete;
method input_stream_adapter (line 4812) | input_stream_adapter& operator=(input_stream_adapter&& rhs) = delete;
method input_stream_adapter (line 4814) | input_stream_adapter(input_stream_adapter&& rhs) noexcept : is(rhs...
method get_character (line 4823) | std::char_traits<char>::int_type get_character()
function contiguous_bytes_input_adapter (line 5131) | contiguous_bytes_input_adapter input_adapter(CharT b)
function input_adapter (line 5139) | auto input_adapter(T (&array)[N]) -> decltype(input_adapter(array, a...
class span_input_adapter (line 5147) | class span_input_adapter
method span_input_adapter (line 5156) | span_input_adapter(CharT b, std::size_t l)
method span_input_adapter (line 5163) | span_input_adapter(IteratorType first, IteratorType last)
method contiguous_bytes_input_adapter (line 5166) | contiguous_bytes_input_adapter&& get()
class json_sax_dom_parser (line 5328) | class json_sax_dom_parser
method json_sax_dom_parser (line 5342) | explicit json_sax_dom_parser(BasicJsonType& r, const bool allow_ex...
method json_sax_dom_parser (line 5347) | json_sax_dom_parser(const json_sax_dom_parser&) = delete;
method json_sax_dom_parser (line 5348) | json_sax_dom_parser(json_sax_dom_parser&&) = default;
method json_sax_dom_parser (line 5349) | json_sax_dom_parser& operator=(const json_sax_dom_parser&) = delete;
method json_sax_dom_parser (line 5350) | json_sax_dom_parser& operator=(json_sax_dom_parser&&) = default;
method null (line 5353) | bool null()
method boolean (line 5359) | bool boolean(bool val)
method number_integer (line 5365) | bool number_integer(number_integer_t val)
method number_unsigned (line 5371) | bool number_unsigned(number_unsigned_t val)
method number_float (line 5377) | bool number_float(number_float_t val, const string_t& /*unused*/)
method string (line 5383) | bool string(string_t& val)
method binary (line 5389) | bool binary(binary_t& val)
method start_object (line 5395) | bool start_object(std::size_t len)
method key (line 5408) | bool key(string_t& val)
method end_object (line 5415) | bool end_object()
method start_array (line 5421) | bool start_array(std::size_t len)
method end_array (line 5434) | bool end_array()
method parse_error (line 5441) | bool parse_error(std::size_t /*unused*/, const std::string& /*unus...
method is_errored (line 5453) | constexpr bool is_errored() const
method JSON_HEDLEY_RETURNS_NON_NULL (line 5466) | JSON_HEDLEY_RETURNS_NON_NULL
class json_sax_dom_callback_parser (line 5502) | class json_sax_dom_callback_parser
method json_sax_dom_callback_parser (line 5513) | json_sax_dom_callback_parser(BasicJsonType& r,
method json_sax_dom_callback_parser (line 5522) | json_sax_dom_callback_parser(const json_sax_dom_callback_parser&) ...
method json_sax_dom_callback_parser (line 5523) | json_sax_dom_callback_parser(json_sax_dom_callback_parser&&) = def...
method json_sax_dom_callback_parser (line 5524) | json_sax_dom_callback_parser& operator=(const json_sax_dom_callbac...
method json_sax_dom_callback_parser (line 5525) | json_sax_dom_callback_parser& operator=(json_sax_dom_callback_pars...
method null (line 5528) | bool null()
method boolean (line 5534) | bool boolean(bool val)
method number_integer (line 5540) | bool number_integer(number_integer_t val)
method number_unsigned (line 5546) | bool number_unsigned(number_unsigned_t val)
method number_float (line 5552) | bool number_float(number_float_t val, const string_t& /*unused*/)
method string (line 5558) | bool string(string_t& val)
method binary (line 5564) | bool binary(binary_t& val)
method start_object (line 5570) | bool start_object(std::size_t len)
method key (line 5588) | bool key(string_t& val)
method end_object (line 5605) | bool end_object()
method start_array (line 5634) | bool start_array(std::size_t len)
method end_array (line 5651) | bool end_array()
method parse_error (line 5680) | bool parse_error(std::size_t /*unused*/, const std::string& /*unus...
method is_errored (line 5692) | constexpr bool is_errored() const
method handle_value (line 5714) | std::pair<bool, BasicJsonType*> handle_value(Value&& v, const bool...
class json_sax_acceptor (line 5798) | class json_sax_acceptor
method null (line 5807) | bool null()
method boolean (line 5812) | bool boolean(bool /*unused*/)
method number_integer (line 5817) | bool number_integer(number_integer_t /*unused*/)
method number_unsigned (line 5822) | bool number_unsigned(number_unsigned_t /*unused*/)
method number_float (line 5827) | bool number_float(number_float_t /*unused*/, const string_t& /*unu...
method string (line 5832) | bool string(string_t& /*unused*/)
method binary (line 5837) | bool binary(binary_t& /*unused*/)
method start_object (line 5842) | bool start_object(std::size_t /*unused*/ = std::size_t(-1))
method key (line 5847) | bool key(string_t& /*unused*/)
method end_object (line 5852) | bool end_object()
method start_array (line 5857) | bool start_array(std::size_t /*unused*/ = std::size_t(-1))
method end_array (line 5862) | bool end_array()
method parse_error (line 5867) | bool parse_error(std::size_t /*unused*/, const std::string& /*unus...
class lexer_base (line 5905) | class lexer_base
type token_type (line 5909) | enum class token_type
class lexer (line 5982) | class lexer : public lexer_base<BasicJsonType>
method lexer (line 5994) | explicit lexer(InputAdapterType&& adapter, bool ignore_comments_ =...
method lexer (line 6001) | lexer(const lexer&) = delete;
method lexer (line 6002) | lexer(lexer&&) = default;
method lexer (line 6003) | lexer& operator=(lexer&) = delete;
method lexer (line 6004) | lexer& operator=(lexer&&) = default;
method JSON_HEDLEY_PURE (line 6013) | JSON_HEDLEY_PURE
method get_codepoint (line 6040) | int get_codepoint()
method next_byte_in_range (line 6088) | bool next_byte_in_range(std::initializer_list<char_int_type> ranges)
method token_type (line 6125) | token_type scan_string()
method scan_comment (line 6715) | bool scan_comment()
method strtof (line 6783) | static void strtof(float& f, const char* str, char** endptr) noexcept
method strtof (line 6789) | static void strtof(double& f, const char* str, char** endptr) noex...
method strtof (line 6795) | static void strtof(long double& f, const char* str, char** endptr)...
method token_type (line 6840) | token_type scan_number() // lgtm [cpp/use-of-goto]
type is_sax (line 7573) | struct is_sax
type is_sax_static_asserts (line 7604) | struct is_sax_static_asserts
type cbor_tag_handler_t (line 7668) | enum class cbor_tag_handler_t
function little_endianess (line 7681) | static inline bool little_endianess(int num = 1) noexcept
class binary_reader (line 7695) | class binary_reader
method binary_reader (line 7712) | explicit binary_reader(InputAdapterType&& adapter) : ia(std::move(...
method binary_reader (line 7718) | binary_reader(const binary_reader&) = delete;
method binary_reader (line 7719) | binary_reader(binary_reader&&) = default;
method binary_reader (line 7720) | binary_reader& operator=(const binary_reader&) = delete;
method binary_reader (line 7721) | binary_reader& operator=(binary_reader&&) = default;
method JSON_HEDLEY_NON_NULL (line 7732) | JSON_HEDLEY_NON_NULL(3)
method parse_bson_internal (line 7794) | bool parse_bson_internal()
method get_bson_cstr (line 7819) | bool get_bson_cstr(string_t& result)
method get_bson_string (line 7849) | bool get_bson_string(const NumberType len, string_t& result)
method get_bson_binary (line 7870) | bool get_bson_binary(const NumberType len, binary_t& result)
method parse_bson_element_internal (line 7896) | bool parse_bson_element_internal(const char_int_type element_type,
method parse_bson_element_list (line 7974) | bool parse_bson_element_list(const bool is_array)
method parse_bson_array (line 8012) | bool parse_bson_array()
method parse_cbor_internal (line 8042) | bool parse_cbor_internal(const bool get_char,
method get_cbor_string (line 8487) | bool get_cbor_string(string_t& result)
method get_cbor_binary (line 8582) | bool get_cbor_binary(binary_t& result)
method get_cbor_array (line 8676) | bool get_cbor_array(const std::size_t len,
method get_cbor_object (line 8714) | bool get_cbor_object(const std::size_t len,
method parse_msgpack_internal (line 8767) | bool parse_msgpack_internal()
method get_msgpack_string (line 9147) | bool get_msgpack_string(string_t& result)
method get_msgpack_binary (line 9229) | bool get_msgpack_binary(binary_t& result)
method get_msgpack_array (line 9340) | bool get_msgpack_array(const std::size_t len)
method get_msgpack_object (line 9362) | bool get_msgpack_object(const std::size_t len)
method parse_ubjson_internal (line 9399) | bool parse_ubjson_internal(const bool get_char = true)
method get_ubjson_string (line 9418) | bool get_ubjson_string(string_t& result, const bool get_char = true)
method get_ubjson_size_value (line 9472) | bool get_ubjson_size_value(std::size_t& result)
method get_ubjson_size_type (line 9549) | bool get_ubjson_size_type(std::pair<std::size_t, char_int_type>& r...
method get_ubjson_value (line 9590) | bool get_ubjson_value(const char_int_type prefix)
method get_ubjson_array (line 9691) | bool get_ubjson_array()
method get_ubjson_object (line 9753) | bool get_ubjson_object()
method get_ubjson_high_precision_number (line 9828) | bool get_ubjson_high_precision_number()
method char_int_type (line 9890) | char_int_type get()
method char_int_type (line 9899) | char_int_type get_ignore_noop()
method get_number (line 9924) | bool get_number(const input_format_t format, NumberType& result)
method get_string (line 9967) | bool get_string(const input_format_t format,
method get_binary (line 10000) | bool get_binary(const input_format_t format,
method JSON_HEDLEY_NON_NULL (line 10023) | JSON_HEDLEY_NON_NULL(3)
method get_token_string (line 10037) | std::string get_token_string() const
method exception_message (line 10050) | std::string exception_message(const input_format_t format,
type parse_event_t (line 10137) | enum class parse_event_t : uint8_t
class parser (line 10163) | class parser
method parser (line 10174) | explicit parser(InputAdapterType&& adapter,
method parse (line 10196) | void parse(const bool strict, BasicJsonType& result)
method accept (line 10257) | bool accept(const bool strict = true)
method sax_parse (line 10265) | bool sax_parse(SAX* sax, const bool strict = true)
method sax_parse_internal (line 10285) | bool sax_parse_internal(SAX* sax)
method token_type (line 10567) | token_type get_token()
method exception_message (line 10572) | std::string exception_message(const token_type expected, const std...
class primitive_iterator_t (line 10636) | class primitive_iterator_t
method difference_type (line 10647) | constexpr difference_type get_value() const noexcept
method set_begin (line 10653) | void set_begin() noexcept
method set_end (line 10659) | void set_end() noexcept
method is_begin (line 10665) | constexpr bool is_begin() const noexcept
method is_end (line 10671) | constexpr bool is_end() const noexcept
method primitive_iterator_t (line 10686) | primitive_iterator_t operator+(difference_type n) noexcept
method difference_type (line 10693) | constexpr difference_type operator-(primitive_iterator_t lhs, prim...
method primitive_iterator_t (line 10698) | primitive_iterator_t& operator++() noexcept
method primitive_iterator_t (line 10704) | primitive_iterator_t const operator++(int) noexcept
method primitive_iterator_t (line 10711) | primitive_iterator_t& operator--() noexcept
method primitive_iterator_t (line 10717) | primitive_iterator_t const operator--(int) noexcept
method primitive_iterator_t (line 10724) | primitive_iterator_t& operator+=(difference_type n) noexcept
method primitive_iterator_t (line 10730) | primitive_iterator_t& operator-=(difference_type n) noexcept
type internal_iterator (line 10750) | struct internal_iterator
class iteration_proxy (line 10788) | class iteration_proxy
method iteration_proxy (line 3937) | explicit iteration_proxy(typename IteratorType::reference cont) no...
method begin (line 3941) | iteration_proxy_value<IteratorType> begin() noexcept
method end (line 3947) | iteration_proxy_value<IteratorType> end() noexcept
class iteration_proxy_value (line 10789) | class iteration_proxy_value
method iteration_proxy_value (line 3864) | explicit iteration_proxy_value(IteratorType it) noexcept : anchor(...
method iteration_proxy_value (line 3867) | iteration_proxy_value& operator*()
method iteration_proxy_value (line 3873) | iteration_proxy_value& operator++()
method string_type (line 3894) | const string_type& key() const
method value (line 3922) | typename IteratorType::reference value() const
class iter_impl (line 10808) | class iter_impl
method iter_impl (line 10846) | iter_impl() = default;
method iter_impl (line 10854) | explicit iter_impl(pointer object) noexcept : m_object(object)
method iter_impl (line 10896) | iter_impl(const iter_impl<const BasicJsonType>& other) noexcept
method iter_impl (line 10906) | iter_impl& operator=(const iter_impl<const BasicJsonType>& other) ...
method iter_impl (line 10918) | iter_impl(const iter_impl<typename std::remove_const<BasicJsonType...
method iter_impl (line 10928) | iter_impl& operator=(const iter_impl<typename std::remove_const<Ba...
method set_begin (line 10940) | void set_begin() noexcept
method set_end (line 10977) | void set_end() noexcept
method reference (line 11008) | reference operator*() const
method pointer (line 11045) | pointer operator->() const
method iter_impl (line 11079) | iter_impl const operator++(int)
method iter_impl (line 11090) | iter_impl& operator++()
method iter_impl (line 11122) | iter_impl const operator--(int)
method iter_impl (line 11133) | iter_impl& operator--()
method iter_impl (line 11255) | iter_impl& operator+=(difference_type i)
method iter_impl (line 11284) | iter_impl& operator-=(difference_type i)
method iter_impl (line 11293) | iter_impl operator+(difference_type i) const
method iter_impl (line 11304) | iter_impl operator+(difference_type i, const iter_impl& it)
method iter_impl (line 11315) | iter_impl operator-(difference_type i) const
method difference_type (line 11326) | difference_type operator-(const iter_impl& other) const
method reference (line 11347) | reference operator[](difference_type n) const
method reference (line 11394) | reference value() const
class json_reverse_iterator (line 11444) | class json_reverse_iterator : public std::reverse_iterator<Base>
method json_reverse_iterator (line 11454) | explicit json_reverse_iterator(const typename base_iterator::itera...
method json_reverse_iterator (line 11458) | explicit json_reverse_iterator(const base_iterator& it) noexcept :...
method json_reverse_iterator (line 11461) | json_reverse_iterator const operator++(int)
method json_reverse_iterator (line 11467) | json_reverse_iterator& operator++()
method json_reverse_iterator (line 11473) | json_reverse_iterator const operator--(int)
method json_reverse_iterator (line 11479) | json_reverse_iterator& operator--()
method json_reverse_iterator (line 11485) | json_reverse_iterator& operator+=(difference_type i)
method json_reverse_iterator (line 11491) | json_reverse_iterator operator+(difference_type i) const
method json_reverse_iterator (line 11497) | json_reverse_iterator operator-(difference_type i) const
method difference_type (line 11503) | difference_type operator-(const json_reverse_iterator& other) const
method reference (line 11509) | reference operator[](difference_type n) const
method key (line 11515) | auto key() const -> decltype(std::declval<Base>().key())
method reference (line 11522) | reference value() const
class json_ref (line 12527) | class json_ref
method json_ref (line 12532) | json_ref(value_type&& value)
method json_ref (line 12538) | json_ref(const value_type& value)
method json_ref (line 12543) | json_ref(std::initializer_list<json_ref> init)
method json_ref (line 12552) | json_ref(Args && ... args)
method json_ref (line 12559) | json_ref(json_ref&&) = default;
method json_ref (line 12560) | json_ref(const json_ref&) = delete;
method json_ref (line 12561) | json_ref& operator=(const json_ref&) = delete;
method json_ref (line 12562) | json_ref& operator=(json_ref&&) = delete;
method value_type (line 12565) | value_type moved_or_copied() const
method value_type (line 12574) | value_type const& operator*() const
method value_type (line 12579) | value_type const* operator->() const
type output_adapter_protocol (line 12632) | struct output_adapter_protocol
class output_vector_adapter (line 12645) | class output_vector_adapter : public output_adapter_protocol<CharType>
method output_vector_adapter (line 12648) | explicit output_vector_adapter(std::vector<CharType>& vec) noexcept
method write_character (line 12652) | void write_character(CharType c) override
method JSON_HEDLEY_NON_NULL (line 12657) | JSON_HEDLEY_NON_NULL(2)
class output_stream_adapter (line 12669) | class output_stream_adapter : public output_adapter_protocol<CharType>
method output_stream_adapter (line 12672) | explicit output_stream_adapter(std::basic_ostream<CharType>& s) no...
method write_character (line 12676) | void write_character(CharType c) override
method JSON_HEDLEY_NON_NULL (line 12681) | JSON_HEDLEY_NON_NULL(2)
class output_string_adapter (line 12693) | class output_string_adapter : public output_adapter_protocol<CharType>
method output_string_adapter (line 12696) | explicit output_string_adapter(StringType& s) noexcept
method write_character (line 12700) | void write_character(CharType c) override
method JSON_HEDLEY_NON_NULL (line 12705) | JSON_HEDLEY_NON_NULL(2)
class output_adapter (line 12716) | class output_adapter
method output_adapter (line 12719) | output_adapter(std::vector<CharType>& vec)
method output_adapter (line 12722) | output_adapter(std::basic_ostream<CharType>& s)
method output_adapter (line 12725) | output_adapter(StringType& s)
class binary_writer (line 12752) | class binary_writer
method binary_writer (line 12764) | explicit binary_writer(output_adapter_t<CharType> adapter) : oa(ad...
method write_bson (line 12773) | void write_bson(const BasicJsonType& j)
method write_cbor (line 12793) | void write_cbor(const BasicJsonType& j)
method write_msgpack (line 13098) | void write_msgpack(const BasicJsonType& j)
method write_ubjson (line 13422) | void write_ubjson(const BasicJsonType& j, const bool use_count,
method calc_bson_entry_header_size (line 13629) | static std::size_t calc_bson_entry_header_size(const string_t& name)
method write_bson_entry_header (line 13644) | void write_bson_entry_header(const string_t& name,
method write_bson_boolean (line 13656) | void write_bson_boolean(const string_t& name,
method write_bson_double (line 13666) | void write_bson_double(const string_t& name,
method calc_bson_string_size (line 13676) | static std::size_t calc_bson_string_size(const string_t& value)
method write_bson_string (line 13684) | void write_bson_string(const string_t& name,
method write_bson_null (line 13698) | void write_bson_null(const string_t& name)
method calc_bson_integer_size (line 13706) | static std::size_t calc_bson_integer_size(const std::int64_t value)
method write_bson_integer (line 13716) | void write_bson_integer(const string_t& name,
method calc_bson_unsigned_size (line 13734) | static constexpr std::size_t calc_bson_unsigned_size(const std::ui...
method write_bson_unsigned (line 13744) | void write_bson_unsigned(const string_t& name,
method write_bson_object_entry (line 13766) | void write_bson_object_entry(const string_t& name,
method calc_bson_array_size (line 13776) | static std::size_t calc_bson_array_size(const typename BasicJsonTy...
method calc_bson_binary_size (line 13791) | static std::size_t calc_bson_binary_size(const typename BasicJsonT...
method write_bson_array (line 13799) | void write_bson_array(const string_t& name,
method write_bson_binary (line 13818) | void write_bson_binary(const string_t& name,
method calc_bson_element_size (line 13833) | static std::size_t calc_bson_element_size(const string_t& name,
method write_bson_element (line 13881) | void write_bson_element(const string_t& name,
method calc_bson_object_size (line 13927) | static std::size_t calc_bson_object_size(const typename BasicJsonT...
method write_bson_object (line 13942) | void write_bson_object(const typename BasicJsonType::object_t& value)
method CharType (line 13958) | static constexpr CharType get_cbor_float_prefix(float /*unused*/)
method CharType (line 13963) | static constexpr CharType get_cbor_float_prefix(double /*unused*/)
method CharType (line 13972) | static constexpr CharType get_msgpack_float_prefix(float /*unused*/)
method CharType (line 13977) | static constexpr CharType get_msgpack_float_prefix(double /*unused*/)
method write_number_with_ubjson_prefix (line 13989) | void write_number_with_ubjson_prefix(const NumberType n,
method write_number_with_ubjson_prefix (line 14002) | void write_number_with_ubjson_prefix(const NumberType n,
method write_number_with_ubjson_prefix (line 14065) | void write_number_with_ubjson_prefix(const NumberType n,
method CharType (line 14129) | CharType ubjson_prefix(const BasicJsonType& j) const noexcept
method CharType (line 14209) | static constexpr CharType get_ubjson_float_prefix(float /*unused*/)
method CharType (line 14214) | static constexpr CharType get_ubjson_float_prefix(double /*unused*/)
method write_number (line 14235) | void write_number(const NumberType n)
method write_compact_float (line 14251) | void write_compact_float(const number_float_t n, detail::input_for...
method CharType (line 14278) | static constexpr CharType to_char_type(std::uint8_t x) noexcept
method CharType (line 14285) | static CharType to_char_type(std::uint8_t x) noexcept
method CharType (line 14296) | static constexpr CharType to_char_type(std::uint8_t x) noexcept
method CharType (line 14307) | static constexpr CharType to_char_type(InputCharType x) noexcept
type dtoa_impl (line 14376) | namespace dtoa_impl
function Target (line 14380) | Target reinterpret_bits(const Source source)
type diyfp (line 14389) | struct diyfp // f * 2^e
method diyfp (line 14396) | constexpr diyfp(std::uint64_t f_, int e_) noexcept : f(f_), e(e_...
method diyfp (line 14402) | static diyfp sub(const diyfp& x, const diyfp& y) noexcept
method diyfp (line 14414) | static diyfp mul(const diyfp& x, const diyfp& y) noexcept
method diyfp (line 14479) | static diyfp normalize(diyfp x) noexcept
method diyfp (line 14496) | static diyfp normalize_to(const diyfp& x, const int target_expon...
type boundaries (line 14507) | struct boundaries
function boundaries (line 14521) | boundaries compute_boundaries(FloatType value)
type cached_power (line 14646) | struct cached_power // c = f * 2^e ~= 10^k
function cached_power (line 14660) | inline cached_power get_cached_power_for_binary_exponent(int e)
function find_largest_pow10 (line 14824) | inline int find_largest_pow10(const std::uint32_t n, std::uint32_t...
function grisu2_round (line 14880) | inline void grisu2_round(char* buf, int len, std::uint64_t dist, s...
function grisu2_digit_gen (line 14921) | inline void grisu2_digit_gen(char* buffer, int& length, int& decim...
function grisu2 (line 15162) | inline void grisu2(char* buf, int& len, int& decimal_exponent,
function JSON_HEDLEY_NON_NULL (line 15221) | JSON_HEDLEY_NON_NULL(1)
type error_handler_t (line 15469) | enum class error_handler_t
class serializer (line 15477) | class serializer
method serializer (line 15493) | serializer(output_adapter_t<char> s, const char ichar,
method serializer (line 15505) | serializer(const serializer&) = delete;
method serializer (line 15506) | serializer& operator=(const serializer&) = delete;
method serializer (line 15507) | serializer(serializer&&) = delete;
method serializer (line 15508) | serializer& operator=(serializer&&) = delete;
method dump (line 15533) | void dump(const BasicJsonType& val,
method dump_escaped (line 15817) | void dump_escaped(const string_t& s, const bool ensure_ascii)
method count_digits (line 16073) | inline unsigned int count_digits(number_unsigned_t x) noexcept
method dump_integer (line 16113) | void dump_integer(NumberType x)
method dump_float (line 16199) | void dump_float(number_float_t x)
method dump_float (line 16220) | void dump_float(number_float_t x, std::true_type /*is_ieee_single_...
method dump_float (line 16228) | void dump_float(number_float_t x, std::false_type /*is_ieee_single...
method decode (line 16298) | static std::uint8_t decode(std::uint8_t& state, std::uint32_t& cod...
method number_unsigned_t (line 16337) | number_unsigned_t remove_sign(number_unsigned_t x)
method number_unsigned_t (line 16352) | inline number_unsigned_t remove_sign(number_integer_t x) noexcept
type detail (line 2318) | namespace detail
type position_t (line 86) | struct position_t
class exception (line 2352) | class exception : public std::exception
method JSON_HEDLEY_RETURNS_NON_NULL (line 2356) | JSON_HEDLEY_RETURNS_NON_NULL
method JSON_HEDLEY_NON_NULL (line 2366) | JSON_HEDLEY_NON_NULL(3)
method name (line 2369) | static std::string name(const std::string& ename, int id_)
class parse_error (line 2424) | class parse_error : public exception
method parse_error (line 2436) | static parse_error create(int id_, const position_t& pos, const st...
method parse_error (line 2443) | static parse_error create(int id_, std::size_t byte_, const std::s...
method parse_error (line 2463) | parse_error(int id_, std::size_t byte_, const char* what_arg)
method position_string (line 2466) | static std::string position_string(const position_t& pos)
class invalid_iterator (line 2510) | class invalid_iterator : public exception
method invalid_iterator (line 2513) | static invalid_iterator create(int id_, const std::string& what_arg)
method JSON_HEDLEY_NON_NULL (line 2520) | JSON_HEDLEY_NON_NULL(3)
class type_error (line 2564) | class type_error : public exception
method type_error (line 2567) | static type_error create(int id_, const std::string& what_arg)
method JSON_HEDLEY_NON_NULL (line 2574) | JSON_HEDLEY_NON_NULL(3)
class out_of_range (line 2611) | class out_of_range : public exception
method out_of_range (line 2614) | static out_of_range create(int id_, const std::string& what_arg)
method JSON_HEDLEY_NON_NULL (line 2621) | JSON_HEDLEY_NON_NULL(3)
class other_error (line 2649) | class other_error : public exception
method other_error (line 2652) | static other_error create(int id_, const std::string& what_arg)
method JSON_HEDLEY_NON_NULL (line 2659) | JSON_HEDLEY_NON_NULL(3)
type index_sequence (line 2687) | struct index_sequence
method size (line 2691) | static constexpr std::size_t size() noexcept
type merge_and_renumber (line 2698) | struct merge_and_renumber
type make_index_sequence (line 2705) | struct make_index_sequence
type make_index_sequence<0> (line 2709) | struct make_index_sequence<0> : index_sequence<> {}
type make_index_sequence<1> (line 2710) | struct make_index_sequence<1> : index_sequence<0> {}
type priority_tag (line 2716) | struct priority_tag : priority_tag < N - 1 > {}
type priority_tag<0> (line 2717) | struct priority_tag<0> {}
type static_const (line 2721) | struct static_const
type make_void (line 2750) | struct make_void
type iterator_types (line 2766) | struct iterator_types {}
type iterator_types <
It,
void_t<typename It::difference_type, typename It::value_type, typename It::pointer,
typename It::reference, typename It::iterator_category >> (line 2769) | struct iterator_types <
type iterator_traits (line 2784) | struct iterator_traits
type iterator_traits < T, enable_if_t < !std::is_pointer<T>::value >> (line 2789) | struct iterator_traits < T, enable_if_t < !std::is_pointer<T>::value >>
type iterator_traits<T*, enable_if_t<std::is_object<T>::value>> (line 2795) | struct iterator_traits<T*, enable_if_t<std::is_object<T>::value>>
type nonesuch (line 2823) | struct nonesuch
method nonesuch (line 2825) | nonesuch() = delete;
method nonesuch (line 2827) | nonesuch(nonesuch const&) = delete;
method nonesuch (line 2828) | nonesuch(nonesuch const&&) = delete;
type detector (line 2837) | struct detector
type is_basic_json (line 2977) | struct is_basic_json : std::false_type {}
class json_ref (line 2987) | class json_ref
method json_ref (line 12532) | json_ref(value_type&& value)
method json_ref (line 12538) | json_ref(const value_type& value)
method json_ref (line 12543) | json_ref(std::initializer_list<json_ref> init)
method json_ref (line 12552) | json_ref(Args && ... args)
method json_ref (line 12559) | json_ref(json_ref&&) = default;
method json_ref (line 12560) | json_ref(const json_ref&) = delete;
method json_ref (line 12561) | json_ref& operator=(const json_ref&) = delete;
method json_ref (line 12562) | json_ref& operator=(json_ref&&) = delete;
method value_type (line 12565) | value_type moved_or_copied() const
method value_type (line 12574) | value_type const& operator*() const
method value_type (line 12579) | value_type const* operator->() const
type is_json_ref (line 2990) | struct is_json_ref : std::false_type {}
type is_json_ref<json_ref<T>> (line 2993) | struct is_json_ref<json_ref<T>> : std::true_type {}
type has_from_json (line 3034) | struct has_from_json : std::false_type {}
type is_getable (line 3041) | struct is_getable
type has_from_json < BasicJsonType, T,
enable_if_t < !is_basic_json<T>::value >> (line 3047) | struct has_from_json < BasicJsonType, T,
type has_non_default_from_json (line 3060) | struct has_non_default_from_json : std::false_type {}
type has_non_default_from_json < BasicJsonType, T, enable_if_t < !is_basic_json<T>::value >> (line 3063) | struct has_non_default_from_json < BasicJsonType, T, enable_if_t < !...
type has_to_json (line 3075) | struct has_to_json : std::false_type {}
type has_to_json < BasicJsonType, T, enable_if_t < !is_basic_json<T>::value >> (line 3078) | struct has_to_json < BasicJsonType, T, enable_if_t < !is_basic_json<...
type is_iterator_traits (line 3093) | struct is_iterator_traits : std::false_type {}
type is_iterator_traits<iterator_traits<T>> (line 3096) | struct is_iterator_traits<iterator_traits<T>>
type is_complete_type (line 3113) | struct is_complete_type : std::false_type {}
type is_complete_type<T, decltype(void(sizeof(T)))> (line 3116) | struct is_complete_type<T, decltype(void(sizeof(T)))> : std::true_ty...
type is_compatible_object_type_impl (line 3120) | struct is_compatible_object_type_impl : std::false_type {}
type is_compatible_object_type_impl <
BasicJsonType, CompatibleObjectType,
enable_if_t < is_detected<mapped_type_t, CompatibleObjectType>::value&&
is_detected<key_type_t, CompatibleObjectType>::value >> (line 3123) | struct is_compatible_object_type_impl <
type is_compatible_object_type (line 3140) | struct is_compatible_object_type
type is_constructible_object_type_impl (line 3145) | struct is_constructible_object_type_impl : std::false_type {}
type is_constructible_object_type_impl <
BasicJsonType, ConstructibleObjectType,
enable_if_t < is_detected<mapped_type_t, ConstructibleObjectType>::value&&
is_detected<key_type_t, ConstructibleObjectType>::value >> (line 3148) | struct is_constructible_object_type_impl <
type is_constructible_object_type (line 3172) | struct is_constructible_object_type
type is_compatible_string_type_impl (line 3178) | struct is_compatible_string_type_impl : std::false_type {}
type is_compatible_string_type_impl <
BasicJsonType, CompatibleStringType,
enable_if_t<is_detected_exact<typename BasicJsonType::string_t::value_type,
value_type_t, CompatibleStringType>::value >> (line 3181) | struct is_compatible_string_type_impl <
type is_compatible_string_type (line 3191) | struct is_compatible_string_type
type is_constructible_string_type_impl (line 3196) | struct is_constructible_string_type_impl : std::false_type {}
type is_constructible_string_type_impl <
BasicJsonType, ConstructibleStringType,
enable_if_t<is_detected_exact<typename BasicJsonType::string_t::value_type,
value_type_t, ConstructibleStringType>::value >> (line 3199) | struct is_constructible_string_type_impl <
type is_constructible_string_type (line 3210) | struct is_constructible_string_type
type is_compatible_array_type_impl (line 3214) | struct is_compatible_array_type_impl : std::false_type {}
type is_compatible_array_type (line 3233) | struct is_compatible_array_type
type is_constructible_array_type_impl (line 3237) | struct is_constructible_array_type_impl : std::false_type {}
type is_constructible_array_type_impl <
BasicJsonType, ConstructibleArrayType,
enable_if_t<std::is_same<ConstructibleArrayType,
typename BasicJsonType::value_type>::value >> (line 3240) | struct is_constructible_array_type_impl <
type is_constructible_array_type_impl <
BasicJsonType, ConstructibleArrayType,
enable_if_t < !std::is_same<ConstructibleArrayType,
typename BasicJsonType::value_type>::value&&
std::is_default_constructible<ConstructibleArrayType>::value&&
(std::is_move_assignable<ConstructibleArrayType>::value ||
std::is_copy_assignable<ConstructibleArrayType>::value)&&
is_detected<value_type_t, ConstructibleArrayType>::value&&
is_detected<iterator_t, ConstructibleArrayType>::value&&
is_complete_type <
detected_t<value_type_t, ConstructibleArrayType >>::value >> (line 3247) | struct is_constructible_array_type_impl <
type is_constructible_array_type (line 3276) | struct is_constructible_array_type
type is_compatible_integer_type_impl (line 3281) | struct is_compatible_integer_type_impl : std::false_type {}
type is_compatible_integer_type_impl <
RealIntegerType, CompatibleNumberIntegerType,
enable_if_t < std::is_integral<RealIntegerType>::value&&
std::is_integral<CompatibleNumberIntegerType>::value&&
!std::is_same<bool, CompatibleNumberIntegerType>::value >> (line 3284) | struct is_compatible_integer_type_impl <
type is_compatible_integer_type (line 3302) | struct is_compatible_integer_type
type is_compatible_type_impl (line 3307) | struct is_compatible_type_impl: std::false_type {}
type is_compatible_type_impl <
BasicJsonType, CompatibleType,
enable_if_t<is_complete_type<CompatibleType>::value >> (line 3310) | struct is_compatible_type_impl <
type is_compatible_type (line 3319) | struct is_compatible_type
type conjunction (line 3323) | struct conjunction : std::true_type { }
type conjunction<B1> (line 3324) | struct conjunction<B1> : B1 { }
type is_constructible_tuple (line 3330) | struct is_constructible_tuple : std::false_type {}
type value_t (line 3377) | enum class value_t : std::uint8_t
function from_json (line 3426) | void from_json(const BasicJsonType& j, typename std::nullptr_t& n)
function get_arithmetic_value (line 3440) | void get_arithmetic_value(const BasicJsonType& j, ArithmeticType& val)
function from_json (line 3466) | void from_json(const BasicJsonType& j, typename BasicJsonType::boole...
function from_json (line 3476) | void from_json(const BasicJsonType& j, typename BasicJsonType::strin...
function from_json (line 3492) | void from_json(const BasicJsonType& j, ConstructibleStringType& s)
function from_json (line 3503) | void from_json(const BasicJsonType& j, typename BasicJsonType::numbe...
function from_json (line 3509) | void from_json(const BasicJsonType& j, typename BasicJsonType::numbe...
function from_json (line 3515) | void from_json(const BasicJsonType& j, typename BasicJsonType::numbe...
function from_json (line 3522) | void from_json(const BasicJsonType& j, EnumType& e)
function from_json (line 3532) | void from_json(const BasicJsonType& j, std::forward_list<T, Allocato...
function from_json (line 3549) | void from_json(const BasicJsonType& j, std::valarray<T>& l)
function from_json (line 3564) | auto from_json(const BasicJsonType& j, T (&arr)[N])
function from_json_array_impl (line 3574) | void from_json_array_impl(const BasicJsonType& j, typename BasicJson...
function from_json_array_impl (line 3580) | auto from_json_array_impl(const BasicJsonType& j, std::array<T, N>& ...
function from_json_array_impl (line 3591) | auto from_json_array_impl(const BasicJsonType& j, ConstructibleArray...
function from_json_array_impl (line 3612) | void from_json_array_impl(const BasicJsonType& j, ConstructibleArray...
function from_json (line 3637) | auto from_json(const BasicJsonType& j, ConstructibleArrayType& arr)
function from_json (line 3652) | void from_json(const BasicJsonType& j, typename BasicJsonType::binar...
function from_json (line 3664) | void from_json(const BasicJsonType& j, ConstructibleObjectType& obj)
function from_json (line 3696) | void from_json(const BasicJsonType& j, ArithmeticType& val)
function from_json (line 3727) | void from_json(const BasicJsonType& j, std::pair<A1, A2>& p)
function from_json_tuple_impl (line 3733) | void from_json_tuple_impl(const BasicJsonType& j, Tuple& t, index_se...
function from_json (line 3739) | void from_json(const BasicJsonType& j, std::tuple<Args...>& t)
function from_json (line 3747) | void from_json(const BasicJsonType& j, std::map<Key, Value, Compare,...
function from_json (line 3767) | void from_json(const BasicJsonType& j, std::unordered_map<Key, Value...
type from_json_fn (line 3784) | struct from_json_fn
function int_to_string (line 3835) | void int_to_string( string_type& target, std::size_t value )
class iteration_proxy_value (line 3841) | class iteration_proxy_value
method iteration_proxy_value (line 3864) | explicit iteration_proxy_value(IteratorType it) noexcept : anchor(...
method iteration_proxy_value (line 3867) | iteration_proxy_value& operator*()
method iteration_proxy_value (line 3873) | iteration_proxy_value& operator++()
method string_type (line 3894) | const string_type& key() const
method value (line 3922) | typename IteratorType::reference value() const
class iteration_proxy (line 3929) | class iteration_proxy
method iteration_proxy (line 3937) | explicit iteration_proxy(typename IteratorType::reference cont) no...
method begin (line 3941) | iteration_proxy_value<IteratorType> begin() noexcept
method end (line 3947) | iteration_proxy_value<IteratorType> end() noexcept
function get (line 3956) | auto get(const nlohmann::detail::iteration_proxy_value<IteratorType>...
function get (line 3964) | auto get(const nlohmann::detail::iteration_proxy_value<IteratorType>...
type external_constructor (line 4014) | struct external_constructor
type external_constructor<value_t::boolean> (line 4017) | struct external_constructor<value_t::boolean>
method construct (line 4020) | static void construct(BasicJsonType& j, typename BasicJsonType::bo...
type external_constructor<value_t::string> (line 4029) | struct external_constructor<value_t::string>
method construct (line 4032) | static void construct(BasicJsonType& j, const typename BasicJsonTy...
method construct (line 4040) | static void construct(BasicJsonType& j, typename BasicJsonType::st...
method construct (line 4050) | static void construct(BasicJsonType& j, const CompatibleStringType...
type external_constructor<value_t::binary> (line 4059) | struct external_constructor<value_t::binary>
method construct (line 4062) | static void construct(BasicJsonType& j, const typename BasicJsonTy...
method construct (line 4071) | static void construct(BasicJsonType& j, typename BasicJsonType::bi...
type external_constructor<value_t::number_float> (line 4081) | struct external_constructor<value_t::number_float>
method construct (line 4084) | static void construct(BasicJsonType& j, typename BasicJsonType::nu...
type external_constructor<value_t::number_unsigned> (line 4093) | struct external_constructor<value_t::number_unsigned>
method construct (line 4096) | static void construct(BasicJsonType& j, typename BasicJsonType::nu...
type external_constructor<value_t::number_integer> (line 4105) | struct external_constructor<value_t::number_integer>
method construct (line 4108) | static void construct(BasicJsonType& j, typename BasicJsonType::nu...
type external_constructor<value_t::array> (line 4117) | struct external_constructor<value_t::array>
method construct (line 4120) | static void construct(BasicJsonType& j, const typename BasicJsonTy...
method construct (line 4128) | static void construct(BasicJsonType& j, typename BasicJsonType::ar...
method construct (line 4138) | static void construct(BasicJsonType& j, const CompatibleArrayType&...
method construct (line 4148) | static void construct(BasicJsonType& j, const std::vector<bool>& arr)
method construct (line 4162) | static void construct(BasicJsonType& j, const std::valarray<T>& arr)
type external_constructor<value_t::object> (line 4176) | struct external_constructor<value_t::object>
method construct (line 4179) | static void construct(BasicJsonType& j, const typename BasicJsonTy...
method construct (line 4187) | static void construct(BasicJsonType& j, typename BasicJsonType::ob...
method construct (line 4196) | static void construct(BasicJsonType& j, const CompatibleObjectType...
function to_json (line 4213) | void to_json(BasicJsonType& j, T b) noexcept
function to_json (line 4220) | void to_json(BasicJsonType& j, const CompatibleString& s)
function to_json (line 4226) | void to_json(BasicJsonType& j, typename BasicJsonType::string_t&& s)
function to_json (line 4233) | void to_json(BasicJsonType& j, FloatType val) noexcept
function to_json (line 4240) | void to_json(BasicJsonType& j, CompatibleNumberUnsignedType val) noe...
function to_json (line 4247) | void to_json(BasicJsonType& j, CompatibleNumberIntegerType val) noex...
function to_json (line 4254) | void to_json(BasicJsonType& j, EnumType e) noexcept
function to_json (line 4261) | void to_json(BasicJsonType& j, const std::vector<bool>& e)
function to_json (line 4274) | void to_json(BasicJsonType& j, const CompatibleArrayType& arr)
function to_json (line 4280) | void to_json(BasicJsonType& j, const typename BasicJsonType::binary_...
function to_json (line 4287) | void to_json(BasicJsonType& j, const std::valarray<T>& arr)
function to_json (line 4293) | void to_json(BasicJsonType& j, typename BasicJsonType::array_t&& arr)
function to_json (line 4300) | void to_json(BasicJsonType& j, const CompatibleObjectType& obj)
function to_json (line 4306) | void to_json(BasicJsonType& j, typename BasicJsonType::object_t&& obj)
function to_json (line 4316) | void to_json(BasicJsonType& j, const T(&arr)[N])
function to_json (line 4322) | void to_json(BasicJsonType& j, const std::pair<T1, T2>& p)
function to_json (line 4330) | void to_json(BasicJsonType& j, const T& b)
function to_json_tuple_impl (line 4336) | void to_json_tuple_impl(BasicJsonType& j, const Tuple& t, index_sequ...
function to_json (line 4342) | void to_json(BasicJsonType& j, const T& t)
type to_json_fn (line 4347) | struct to_json_fn
function combine (line 4595) | inline std::size_t combine(std::size_t seed, std::size_t h) noexcept
function hash (line 4613) | std::size_t hash(const BasicJsonType& j)
type input_format_t (line 4744) | enum class input_format_t { json, cbor, msgpack, ubjson, bson }
class file_input_adapter (line 4754) | class file_input_adapter
method file_input_adapter (line 4760) | explicit file_input_adapter(std::FILE* f) noexcept
method file_input_adapter (line 4765) | file_input_adapter(const file_input_adapter&) = delete;
method file_input_adapter (line 4766) | file_input_adapter(file_input_adapter&&) = default;
method file_input_adapter (line 4767) | file_input_adapter& operator=(const file_input_adapter&) = delete;
method file_input_adapter (line 4768) | file_input_adapter& operator=(file_input_adapter&&) = delete;
method get_character (line 4770) | std::char_traits<char>::int_type get_character() noexcept
class input_stream_adapter (line 4790) | class input_stream_adapter
method input_stream_adapter (line 4805) | explicit input_stream_adapter(std::istream& i)
method input_stream_adapter (line 4810) | input_stream_adapter(const input_stream_adapter&) = delete;
method input_stream_adapter (line 4811) | input_stream_adapter& operator=(input_stream_adapter&) = delete;
method input_stream_adapter (line 4812) | input_stream_adapter& operator=(input_stream_adapter&& rhs) = delete;
method input_stream_adapter (line 4814) | input_stream_adapter(input_stream_adapter&& rhs) noexcept : is(rhs...
method get_character (line 4823) | std::char_traits<char>::int_type get_character()
class iterator_input_adapter (line 4843) | class iterator_input_adapter
method iterator_input_adapter (line 4848) | iterator_input_adapter(IteratorType first, IteratorType last)
method get_character (line 4851) | typename std::char_traits<char_type>::int_type get_character()
method empty (line 4872) | bool empty() const
type wide_string_input_helper (line 4881) | struct wide_string_input_helper
type wide_string_input_helper<BaseInputAdapter, 4> (line 4884) | struct wide_string_input_helper<BaseInputAdapter, 4>
method fill_buffer (line 4887) | static void fill_buffer(BaseInputAdapter& input,
type wide_string_input_helper<BaseInputAdapter, 2> (line 4942) | struct wide_string_input_helper<BaseInputAdapter, 2>
method fill_buffer (line 4945) | static void fill_buffer(BaseInputAdapter& input,
class wide_string_input_adapter (line 5005) | class wide_string_input_adapter
method wide_string_input_adapter (line 5010) | wide_string_input_adapter(BaseInputAdapter base)
method get_character (line 5013) | typename std::char_traits<char>::int_type get_character() noexcept
method fill_buffer (line 5034) | void fill_buffer()
type iterator_input_adapter_factory (line 5050) | struct iterator_input_adapter_factory
method adapter_type (line 5056) | static adapter_type create(IteratorType first, IteratorType last)
type is_iterator_of_multibyte (line 5063) | struct is_iterator_of_multibyte
type iterator_input_adapter_factory<IteratorType, enable_if_t<is_iterator_of_multibyte<IteratorType>::value>> (line 5073) | struct iterator_input_adapter_factory<IteratorType, enable_if_t<is_i...
method adapter_type (line 5080) | static adapter_type create(IteratorType first, IteratorType last)
function input_adapter (line 5088) | typename iterator_input_adapter_factory<IteratorType>::adapter_type ...
function input_adapter (line 5096) | auto input_adapter(const ContainerType& container) -> decltype(input...
function file_input_adapter (line 5106) | inline file_input_adapter input_adapter(std::FILE* file)
method file_input_adapter (line 4760) | explicit file_input_adapter(std::FILE* f) noexcept
method file_input_adapter (line 4765) | file_input_adapter(const file_input_adapter&) = delete;
method file_input_adapter (line 4766) | file_input_adapter(file_input_adapter&&) = default;
method file_input_adapter (line 4767) | file_input_adapter& operator=(const file_input_adapter&) = delete;
method file_input_adapter (line 4768) | file_input_adapter& operator=(file_input_adapter&&) = delete;
method get_character (line 4770) | std::char_traits<char>::int_type get_character() noexcept
function input_stream_adapter (line 5111) | inline input_stream_adapter input_adapter(std::istream& stream)
method input_stream_adapter (line 4805) | explicit input_stream_adapter(std::istream& i)
method input_stream_adapter (line 4810) | input_stream_adapter(const input_stream_adapter&) = delete;
method input_stream_adapter (line 4811) | input_stream_adapter& operator=(input_stream_adapter&) = delete;
method input_stream_adapter (line 4812) | input_stream_adapter& operator=(input_stream_adapter&& rhs) = delete;
method input_stream_adapter (line 4814) | input_stream_adapter(input_stream_adapter&& rhs) noexcept : is(rhs...
method get_character (line 4823) | std::char_traits<char>::int_type get_character()
function input_stream_adapter (line 5116) | inline input_stream_adapter input_adapter(std::istream&& stream)
method input_stream_adapter (line 4805) | explicit input_stream_adapter(std::istream& i)
method input_stream_adapter (line 4810) | input_stream_adapter(const input_stream_adapter&) = delete;
method input_stream_adapter (line 4811) | input_stream_adapter& operator=(input_stream_adapter&) = delete;
method input_stream_adapter (line 4812) | input_stream_adapter& operator=(input_stream_adapter&& rhs) = delete;
method input_stream_adapter (line 4814) | input_stream_adapter(input_stream_adapter&& rhs) noexcept : is(rhs...
method get_character (line 4823) | std::char_traits<char>::int_type get_character()
function contiguous_bytes_input_adapter (line 5131) | contiguous_bytes_input_adapter input_adapter(CharT b)
function input_adapter (line 5139) | auto input_adapter(T (&array)[N]) -> decltype(input_adapter(array, a...
class span_input_adapter (line 5147) | class span_input_adapter
method span_input_adapter (line 5156) | span_input_adapter(CharT b, std::size_t l)
method span_input_adapter (line 5163) | span_input_adapter(IteratorType first, IteratorType last)
method contiguous_bytes_input_adapter (line 5166) | contiguous_bytes_input_adapter&& get()
class json_sax_dom_parser (line 5328) | class json_sax_dom_parser
method json_sax_dom_parser (line 5342) | explicit json_sax_dom_parser(BasicJsonType& r, const bool allow_ex...
method json_sax_dom_parser (line 5347) | json_sax_dom_parser(const json_sax_dom_parser&) = delete;
method json_sax_dom_parser (line 5348) | json_sax_dom_parser(json_sax_dom_parser&&) = default;
method json_sax_dom_parser (line 5349) | json_sax_dom_parser& operator=(const json_sax_dom_parser&) = delete;
method json_sax_dom_parser (line 5350) | json_sax_dom_parser& operator=(json_sax_dom_parser&&) = default;
method null (line 5353) | bool null()
method boolean (line 5359) | bool boolean(bool val)
method number_integer (line 5365) | bool number_integer(number_integer_t val)
method number_unsigned (line 5371) | bool number_unsigned(number_unsigned_t val)
method number_float (line 5377) | bool number_float(number_float_t val, const string_t& /*unused*/)
method string (line 5383) | bool string(string_t& val)
method binary (line 5389) | bool binary(binary_t& val)
method start_object (line 5395) | bool start_object(std::size_t len)
method key (line 5408) | bool key(string_t& val)
method end_object (line 5415) | bool end_object()
method start_array (line 5421) | bool start_array(std::size_t len)
method end_array (line 5434) | bool end_array()
method parse_error (line 5441) | bool parse_error(std::size_t /*unused*/, const std::string& /*unus...
method is_errored (line 5453) | constexpr bool is_errored() const
method JSON_HEDLEY_RETURNS_NON_NULL (line 5466) | JSON_HEDLEY_RETURNS_NON_NULL
class json_sax_dom_callback_parser (line 5502) | class json_sax_dom_callback_parser
method json_sax_dom_callback_parser (line 5513) | json_sax_dom_callback_parser(BasicJsonType& r,
method json_sax_dom_callback_parser (line 5522) | json_sax_dom_callback_parser(const json_sax_dom_callback_parser&) ...
method json_sax_dom_callback_parser (line 5523) | json_sax_dom_callback_parser(json_sax_dom_callback_parser&&) = def...
method json_sax_dom_callback_parser (line 5524) | json_sax_dom_callback_parser& operator=(const json_sax_dom_callbac...
method json_sax_dom_callback_parser (line 5525) | json_sax_dom_callback_parser& operator=(json_sax_dom_callback_pars...
method null (line 5528) | bool null()
method boolean (line 5534) | bool boolean(bool val)
method number_integer (line 5540) | bool number_integer(number_integer_t val)
method number_unsigned (line 5546) | bool number_unsigned(number_unsigned_t val)
method number_float (line 5552) | bool number_float(number_float_t val, const string_t& /*unused*/)
method string (line 5558) | bool string(string_t& val)
method binary (line 5564) | bool binary(binary_t& val)
method start_object (line 5570) | bool start_object(std::size_t len)
method key (line 5588) | bool key(string_t& val)
method end_object (line 5605) | bool end_object()
method start_array (line 5634) | bool start_array(std::size_t len)
method end_array (line 5651) | bool end_array()
method parse_error (line 5680) | bool parse_error(std::size_t /*unused*/, const std::string& /*unus...
method is_errored (line 5692) | constexpr bool is_errored() const
method handle_value (line 5714) | std::pair<bool, BasicJsonType*> handle_value(Value&& v, const bool...
class json_sax_acceptor (line 5798) | class json_sax_acceptor
method null (line 5807) | bool null()
method boolean (line 5812) | bool boolean(bool /*unused*/)
method number_integer (line 5817) | bool number_integer(number_integer_t /*unused*/)
method number_unsigned (line 5822) | bool number_unsigned(number_unsigned_t /*unused*/)
method number_float (line 5827) | bool number_float(number_float_t /*unused*/, const string_t& /*unu...
method string (line 5832) | bool string(string_t& /*unused*/)
method binary (line 5837) | bool binary(binary_t& /*unused*/)
method start_object (line 5842) | bool start_object(std::size_t /*unused*/ = std::size_t(-1))
method key (line 5847) | bool key(string_t& /*unused*/)
method end_object (line 5852) | bool end_object()
method start_array (line 5857) | bool start_array(std::size_t /*unused*/ = std::size_t(-1))
method end_array (line 5862) | bool end_array()
method parse_error (line 5867) | bool parse_error(std::size_t /*unused*/, const std::string& /*unus...
class lexer_base (line 5905) | class lexer_base
type token_type (line 5909) | enum class token_type
class lexer (line 5982) | class lexer : public lexer_base<BasicJsonType>
method lexer (line 5994) | explicit lexer(InputAdapterType&& adapter, bool ignore_comments_ =...
method lexer (line 6001) | lexer(const lexer&) = delete;
method lexer (line 6002) | lexer(lexer&&) = default;
method lexer (line 6003) | lexer& operator=(lexer&) = delete;
method lexer (line 6004) | lexer& operator=(lexer&&) = default;
method JSON_HEDLEY_PURE (line 6013) | JSON_HEDLEY_PURE
method get_codepoint (line 6040) | int get_codepoint()
method next_byte_in_range (line 6088) | bool next_byte_in_range(std::initializer_list<char_int_type> ranges)
method token_type (line 6125) | token_type scan_string()
method scan_comment (line 6715) | bool scan_comment()
method strtof (line 6783) | static void strtof(float& f, const char* str, char** endptr) noexcept
method strtof (line 6789) | static void strtof(double& f, const char* str, char** endptr) noex...
method strtof (line 6795) | static void strtof(long double& f, const char* str, char** endptr)...
method token_type (line 6840) | token_type scan_number() // lgtm [cpp/use-of-goto]
type is_sax (line 7573) | struct is_sax
type is_sax_static_asserts (line 7604) | struct is_sax_static_asserts
type cbor_tag_handler_t (line 7668) | enum class cbor_tag_handler_t
function little_endianess (line 7681) | static inline bool little_endianess(int num = 1) noexcept
class binary_reader (line 7695) | class binary_reader
method binary_reader (line 7712) | explicit binary_reader(InputAdapterType&& adapter) : ia(std::move(...
method binary_reader (line 7718) | binary_reader(const binary_reader&) = delete;
method binary_reader (line 7719) | binary_reader(binary_reader&&) = default;
method binary_reader (line 7720) | binary_reader& operator=(const binary_reader&) = delete;
method binary_reader (line 7721) | binary_reader& operator=(binary_reader&&) = default;
method JSON_HEDLEY_NON_NULL (line 7732) | JSON_HEDLEY_NON_NULL(3)
method parse_bson_internal (line 7794) | bool parse_bson_internal()
method get_bson_cstr (line 7819) | bool get_bson_cstr(string_t& result)
method get_bson_string (line 7849) | bool get_bson_string(const NumberType len, string_t& result)
method get_bson_binary (line 7870) | bool get_bson_binary(const NumberType len, binary_t& result)
method parse_bson_element_internal (line 7896) | bool parse_bson_element_internal(const char_int_type element_type,
method parse_bson_element_list (line 7974) | bool parse_bson_element_list(const bool is_array)
method parse_bson_array (line 8012) | bool parse_bson_array()
method parse_cbor_internal (line 8042) | bool parse_cbor_internal(const bool get_char,
method get_cbor_string (line 8487) | bool get_cbor_string(string_t& result)
method get_cbor_binary (line 8582) | bool get_cbor_binary(binary_t& result)
method get_cbor_array (line 8676) | bool get_cbor_array(const std::size_t len,
method get_cbor_object (line 8714) | bool get_cbor_object(const std::size_t len,
method parse_msgpack_internal (line 8767) | bool parse_msgpack_internal()
method get_msgpack_string (line 9147) | bool get_msgpack_string(string_t& result)
method get_msgpack_binary (line 9229) | bool get_msgpack_binary(binary_t& result)
method get_msgpack_array (line 9340) | bool get_msgpack_array(const std::size_t len)
method get_msgpack_object (line 9362) | bool get_msgpack_object(const std::size_t len)
method parse_ubjson_internal (line 9399) | bool parse_ubjson_internal(const bool get_char = true)
method get_ubjson_string (line 9418) | bool get_ubjson_string(string_t& result, const bool get_char = true)
method get_ubjson_size_value (line 9472) | bool get_ubjson_size_value(std::size_t& result)
method get_ubjson_size_type (line 9549) | bool get_ubjson_size_type(std::pair<std::size_t, char_int_type>& r...
method get_ubjson_value (line 9590) | bool get_ubjson_value(const char_int_type prefix)
method get_ubjson_array (line 9691) | bool get_ubjson_array()
method get_ubjson_object (line 9753) | bool get_ubjson_object()
method get_ubjson_high_precision_number (line 9828) | bool get_ubjson_high_precision_number()
method char_int_type (line 9890) | char_int_type get()
method char_int_type (line 9899) | char_int_type get_ignore_noop()
method get_number (line 9924) | bool get_number(const input_format_t format, NumberType& result)
method get_string (line 9967) | bool get_string(const input_format_t format,
method get_binary (line 10000) | bool get_binary(const input_format_t format,
method JSON_HEDLEY_NON_NULL (line 10023) | JSON_HEDLEY_NON_NULL(3)
method get_token_string (line 10037) | std::string get_token_string() const
method exception_message (line 10050) | std::string exception_message(const input_format_t format,
type parse_event_t (line 10137) | enum class parse_event_t : uint8_t
class parser (line 10163) | class parser
method parser (line 10174) | explicit parser(InputAdapterType&& adapter,
method parse (line 10196) | void parse(const bool strict, BasicJsonType& result)
method accept (line 10257) | bool accept(const bool strict = true)
method sax_parse (line 10265) | bool sax_parse(SAX* sax, const bool strict = true)
method sax_parse_internal (line 10285) | bool sax_parse_internal(SAX* sax)
method token_type (line 10567) | token_type get_token()
method exception_message (line 10572) | std::string exception_message(const token_type expected, const std...
class primitive_iterator_t (line 10636) | class primitive_iterator_t
method difference_type (line 10647) | constexpr difference_type get_value() const noexcept
method set_begin (line 10653) | void set_begin() noexcept
method set_end (line 10659) | void set_end() noexcept
method is_begin (line 10665) | constexpr bool is_begin() const noexcept
method is_end (line 10671) | constexpr bool is_end() const noexcept
method primitive_iterator_t (line 10686) | primitive_iterator_t operator+(difference_type n) noexcept
method difference_type (line 10693) | constexpr difference_type operator-(primitive_iterator_t lhs, prim...
method primitive_iterator_t (line 10698) | primitive_iterator_t& operator++() noexcept
method primitive_iterator_t (line 10704) | primitive_iterator_t const operator++(int) noexcept
method primitive_iterator_t (line 10711) | primitive_iterator_t& operator--() noexcept
method primitive_iterator_t (line 10717) | primitive_iterator_t const operator--(int) noexcept
method primitive_iterator_t (line 10724) | primitive_iterator_t& operator+=(difference_type n) noexcept
method primitive_iterator_t (line 10730) | primitive_iterator_t& operator-=(difference_type n) noexcept
type internal_iterator (line 10750) | struct internal_iterator
class iteration_proxy (line 10788) | class iteration_proxy
method iteration_proxy (line 3937) | explicit iteration_proxy(typename IteratorType::reference cont) no...
method begin (line 3941) | iteration_proxy_value<IteratorType> begin() noexcept
method end (line 3947) | iteration_proxy_value<IteratorType> end() noexcept
class iteration_proxy_value (line 10789) | class iteration_proxy_value
method iteration_proxy_value (line 3864) | explicit iteration_proxy_value(IteratorType it) noexcept : anchor(...
method iteration_proxy_value (line 3867) | iteration_proxy_value& operator*()
method iteration_proxy_value (line 3873) | iteration_proxy_value& operator++()
method string_type (line 3894) | const string_type& key() const
method value (line 3922) | typename IteratorType::reference value() const
class iter_impl (line 10808) | class iter_impl
method iter_impl (line 10846) | iter_impl() = default;
method iter_impl (line 10854) | explicit iter_impl(pointer object) noexcept : m_object(object)
method iter_impl (line 10896) | iter_impl(const iter_impl<const BasicJsonType>& other) noexcept
method iter_impl (line 10906) | iter_impl& operator=(const iter_impl<const BasicJsonType>& other) ...
method iter_impl (line 10918) | iter_impl(const iter_impl<typename std::remove_const<BasicJsonType...
method iter_impl (line 10928) | iter_impl& operator=(const iter_impl<typename std::remove_const<Ba...
method set_begin (line 10940) | void set_begin() noexcept
method set_end (line 10977) | void set_end() noexcept
method reference (line 11008) | reference operator*() const
method pointer (line 11045) | pointer operator->() const
method iter_impl (line 11079) | iter_impl const operator++(int)
method iter_impl (line 11090) | iter_impl& operator++()
method iter_impl (line 11122) | iter_impl const operator--(int)
method iter_impl (line 11133) | iter_impl& operator--()
method iter_impl (line 11255) | iter_impl& operator+=(difference_type i)
method iter_impl (line 11284) | iter_impl& operator-=(difference_type i)
method iter_impl (line 11293) | iter_impl operator+(difference_type i) const
method iter_impl (line 11304) | iter_impl operator+(difference_type i, const iter_impl& it)
method iter_impl (line 11315) | iter_impl operator-(difference_type i) const
method difference_type (line 11326) | difference_type operator-(const iter_impl& other) const
method reference (line 11347) | reference operator[](difference_type n) const
method reference (line 11394) | reference value() const
class json_reverse_iterator (line 11444) | class json_reverse_iterator : public std::reverse_iterator<Base>
method json_reverse_iterator (line 11454) | explicit json_reverse_iterator(const typename base_iterator::itera...
method json_reverse_iterator (line 11458) | explicit json_reverse_iterator(const base_iterator& it) noexcept :...
method json_reverse_iterator (line 11461) | json_reverse_iterator const operator++(int)
method json_reverse_iterator (line 11467) | json_reverse_iterator& operator++()
method json_reverse_iterator (line 11473) | json_reverse_iterator const operator--(int)
method json_reverse_iterator (line 11479) | json_reverse_iterator& operator--()
method json_reverse_iterator (line 11485) | json_reverse_iterator& operator+=(difference_type i)
method json_reverse_iterator (line 11491) | json_reverse_iterator operator+(difference_type i) const
method json_reverse_iterator (line 11497) | json_reverse_iterator operator-(difference_type i) const
method difference_type (line 11503) | difference_type operator-(const json_reverse_iterator& other) const
method reference (line 11509) | reference operator[](difference_type n) const
method key (line 11515) | auto key() const -> decltype(std::declval<Base>().key())
method reference (line 11522) | reference value() const
class json_ref (line 12527) | class json_ref
method json_ref (line 12532) | json_ref(value_type&& value)
method json_ref (line 12538) | json_ref(const value_type& value)
method json_ref (line 12543) | json_ref(std::initializer_list<json_ref> init)
method json_ref (line 12552) | json_ref(Args && ... args)
method json_ref (line 12559) | json_ref(json_ref&&) = default;
method json_ref (line 12560) | json_ref(const json_ref&) = delete;
method json_ref (line 12561) | json_ref& operator=(const json_ref&) = delete;
method json_ref (line 12562) | json_ref& operator=(json_ref&&) = delete;
method value_type (line 12565) | value_type moved_or_copied() const
method value_type (line 12574) | value_type const& operator*() const
method value_type (line 12579) | value_type const* operator->() const
type output_adapter_protocol (line 12632) | struct output_adapter_protocol
class output_vector_adapter (line 12645) | class output_vector_adapter : public output_adapter_protocol<CharType>
method output_vector_adapter (line 12648) | explicit output_vector_adapter(std::vector<CharType>& vec) noexcept
method write_character (line 12652) | void write_character(CharType c) override
method JSON_HEDLEY_NON_NULL (line 12657) | JSON_HEDLEY_NON_NULL(2)
class output_stream_adapter (line 12669) | class output_stream_adapter : public output_adapter_protocol<CharType>
method output_stream_adapter (line 12672) | explicit output_stream_adapter(std::basic_ostream<CharType>& s) no...
method write_character (line 12676) | void write_character(CharType c) override
method JSON_HEDLEY_NON_NULL (line 12681) | JSON_HEDLEY_NON_NULL(2)
class output_string_adapter (line 12693) | class output_string_adapter : public output_adapter_protocol<CharType>
method output_string_adapter (line 12696) | explicit output_string_adapter(StringType& s) noexcept
method write_character (line 12700) | void write_character(CharType c) override
method JSON_HEDLEY_NON_NULL (line 12705) | JSON_HEDLEY_NON_NULL(2)
class output_adapter (line 12716) | class output_adapter
method output_adapter (line 12719) | output_adapter(std::vector<CharType>& vec)
method output_adapter (line 12722) | output_adapter(std::basic_ostream<CharType>& s)
method output_adapter (line 12725) | output_adapter(StringType& s)
class binary_writer (line 12752) | class binary_writer
method binary_writer (line 12764) | explicit binary_writer(output_adapter_t<CharType> adapter) : oa(ad...
method write_bson (line 12773) | void write_bson(const BasicJsonType& j)
method write_cbor (line 12793) | void write_cbor(const BasicJsonType& j)
method write_msgpack (line 13098) | void write_msgpack(const BasicJsonType& j)
method write_ubjson (line 13422) | void write_ubjson(const BasicJsonType& j, const bool use_count,
method calc_bson_entry_header_size (line 13629) | static std::size_t calc_bson_entry_header_size(const string_t& name)
method write_bson_entry_header (line 13644) | void write_bson_entry_header(const string_t& name,
method write_bson_boolean (line 13656) | void write_bson_boolean(const string_t& name,
method write_bson_double (line 13666) | void write_bson_double(const string_t& name,
method calc_bson_string_size (line 13676) | static std::size_t calc_bson_string_size(const string_t& value)
method write_bson_string (line 13684) | void write_bson_string(const string_t& name,
method write_bson_null (line 13698) | void write_bson_null(const string_t& name)
method calc_bson_integer_size (line 13706) | static std::size_t calc_bson_integer_size(const std::int64_t value)
method write_bson_integer (line 13716) | void write_bson_integer(const string_t& name,
method calc_bson_unsigned_size (line 13734) | static constexpr std::size_t calc_bson_unsigned_size(const std::ui...
method write_bson_unsigned (line 13744) | void write_bson_unsigned(const string_t& name,
method write_bson_object_entry (line 13766) | void write_bson_object_entry(const string_t& name,
method calc_bson_array_size (line 13776) | static std::size_t calc_bson_array_size(const typename BasicJsonTy...
method calc_bson_binary_size (line 13791) | static std::size_t calc_bson_binary_size(const typename BasicJsonT...
method write_bson_array (line 13799) | void write_bson_array(const string_t& name,
method write_bson_binary (line 13818) | void write_bson_binary(const string_t& name,
method calc_bson_element_size (line 13833) | static std::size_t calc_bson_element_size(const string_t& name,
method write_bson_element (line 13881) | void write_bson_element(const string_t& name,
method calc_bson_object_size (line 13927) | static std::size_t calc_bson_object_size(const typename BasicJsonT...
method write_bson_object (line 13942) | void write_bson_object(const typename BasicJsonType::object_t& value)
method CharType (line 13958) | static constexpr CharType get_cbor_float_prefix(float /*unused*/)
method CharType (line 13963) | static constexpr CharType get_cbor_float_prefix(double /*unused*/)
method CharType (line 13972) | static constexpr CharType get_msgpack_float_prefix(float /*unused*/)
method CharType (line 13977) | static constexpr CharType get_msgpack_float_prefix(double /*unused*/)
method write_number_with_ubjson_prefix (line 13989) | void write_number_with_ubjson_prefix(const NumberType n,
method write_number_with_ubjson_prefix (line 14002) | void write_number_with_ubjson_prefix(const NumberType n,
method write_number_with_ubjson_prefix (line 14065) | void write_number_with_ubjson_prefix(const NumberType n,
method CharType (line 14129) | CharType ubjson_prefix(const BasicJsonType& j) const noexcept
method CharType (line 14209) | static constexpr CharType get_ubjson_float_prefix(float /*unused*/)
method CharType (line 14214) | static constexpr CharType get_ubjson_float_prefix(double /*unused*/)
method write_number (line 14235) | void write_number(const NumberType n)
method write_compact_float (line 14251) | void write_compact_float(const number_float_t n, detail::input_for...
method CharType (line 14278) | static constexpr CharType to_char_type(std::uint8_t x) noexcept
method CharType (line 14285) | static CharType to_char_type(std::uint8_t x) noexcept
method CharType (line 14296) | static constexpr CharType to_char_type(std::uint8_t x) noexcept
method CharType (line 14307) | static constexpr CharType to_char_type(InputCharType x) noexcept
type dtoa_impl (line 14376) | namespace dtoa_impl
function Target (line 14380) | Target reinterpret_bits(const Source source)
type diyfp (line 14389) | struct diyfp // f * 2^e
method diyfp (line 14396) | constexpr diyfp(std::uint64_t f_, int e_) noexcept : f(f_), e(e_...
method diyfp (line 14402) | static diyfp sub(const diyfp& x, const diyfp& y) noexcept
method diyfp (line 14414) | static diyfp mul(const diyfp& x, const diyfp& y) noexcept
method diyfp (line 14479) | static diyfp normalize(diyfp x) noexcept
method diyfp (line 14496) | static diyfp normalize_to(const diyfp& x, const int target_expon...
type boundaries (line 14507) | struct boundaries
function boundaries (line 14521) | boundaries compute_boundaries(FloatType value)
type cached_power (line 14646) | struct cached_power // c = f * 2^e ~= 10^k
function cached_power (line 14660) | inline cached_power get_cached_power_for_binary_exponent(int e)
function find_largest_pow10 (line 14824) | inline int find_largest_pow10(const std::uint32_t n, std::uint32_t...
function grisu2_round (line 14880) | inline void grisu2_round(char* buf, int len, std::uint64_t dist, s...
function grisu2_digit_gen (line 14921) | inline void grisu2_digit_gen(char* buffer, int& length, int& decim...
function grisu2 (line 15162) | inline void grisu2(char* buf, int& len, int& decimal_exponent,
function JSON_HEDLEY_NON_NULL (line 15221) | JSON_HEDLEY_NON_NULL(1)
type error_handler_t (line 15469) | enum class error_handler_t
class serializer (line 15477) | class serializer
method serializer (line 15493) | serializer(output_adapter_t<char> s, const char ichar,
method serializer (line 15505) | serializer(const serializer&) = delete;
method serializer (line 15506) | serializer& operator=(const serializer&) = delete;
method serializer (line 15507) | serializer(serializer&&) = delete;
method serializer (line 15508) | serializer& operator=(serializer&&) = delete;
method dump (line 15533) | void dump(const BasicJsonType& val,
method dump_escaped (line 15817) | void dump_escaped(const string_t& s, const bool ensure_ascii)
method count_digits (line 16073) | inline unsigned int count_digits(number_unsigned_t x) noexcept
method dump_integer (line 16113) | void dump_integer(NumberType x)
method dump_float (line 16199) | void dump_float(number_float_t x)
method dump_float (line 16220) | void dump_float(number_float_t x, std::true_type /*is_ieee_single_...
method dump_float (line 16228) | void dump_float(number_float_t x, std::false_type /*is_ieee_single...
method decode (line 16298) | static std::uint8_t decode(std::uint8_t& state, std::uint32_t& cod...
method number_unsigned_t (line 16337) | number_unsigned_t remove_sign(number_unsigned_t x)
method number_unsigned_t (line 16352) | inline number_unsigned_t remove_sign(number_integer_t x) noexcept
type detail (line 2675) | namespace detail
type position_t (line 86) | struct position_t
class exception (line 2352) | class exception : public std::exception
method JSON_HEDLEY_RETURNS_NON_NULL (line 2356) | JSON_HEDLEY_RETURNS_NON_NULL
method JSON_HEDLEY_NON_NULL (line 2366) | JSON_HEDLEY_NON_NULL(3)
method name (line 2369) | static std::string name(const std::string& ename, int id_)
class parse_error (line 2424) | class parse_error : public exception
method parse_error (line 2436) | static parse_error create(int id_, const position_t& pos, const st...
method parse_error (line 2443) | static parse_error create(int id_, std::size_t byte_, const std::s...
method parse_error (line 2463) | parse_error(int id_, std::size_t byte_, const char* what_arg)
method position_string (line 2466) | static std::string position_string(const position_t& pos)
class invalid_iterator (line 2510) | class invalid_iterator : public exception
method invalid_iterator (line 2513) | static invalid_iterator create(int id_, const std::string& what_arg)
method JSON_HEDLEY_NON_NULL (line 2520) | JSON_HEDLEY_NON_NULL(3)
class type_error (line 2564) | class type_error : public exception
method type_error (line 2567) | static type_error create(int id_, const std::string& what_arg)
method JSON_HEDLEY_NON_NULL (line 2574) | JSON_HEDLEY_NON_NULL(3)
class out_of_range (line 2611) | class out_of_range : public exception
method out_of_range (line 2614) | static out_of_range create(int id_, const std::string& what_arg)
method JSON_HEDLEY_NON_NULL (line 2621) | JSON_HEDLEY_NON_NULL(3)
class other_error (line 2649) | class other_error : public exception
method other_error (line 2652) | static other_error create(int id_, const std::string& what_arg)
method JSON_HEDLEY_NON_NULL (line 2659) | JSON_HEDLEY_NON_NULL(3)
type index_sequence (line 2687) | struct index_sequence
method size (line 2691) | static constexpr std::size_t size() noexcept
type merge_and_renumber (line 2698) | struct merge_and_renumber
type make_index_sequence (line 2705) | struct make_index_sequence
type make_index_sequence<0> (line 2709) | struct make_index_sequence<0> : index_sequence<> {}
type make_index_sequence<1> (line 2710) | struct make_index_sequence<1> : index_sequence<0> {}
type priority_tag (line 2716) | struct priority_tag : priority_tag < N - 1 > {}
type priority_tag<0> (line 2717) | struct priority_tag<0> {}
type static_const (line 2721) | struct static_const
type make_void (line 2750) | struct make_void
type iterator_types (line 2766) | struct iterator_types {}
type iterator_types <
It,
void_t<typename It::difference_type, typename It::value_type, typename It::pointer,
typename It::reference, typename It::iterator_category >> (line 2769) | struct iterator_types <
type iterator_traits (line 2784) | struct iterator_traits
type iterator_traits < T, enable_if_t < !std::is_pointer<T>::value >> (line 2789) | struct iterator_traits < T, enable_if_t < !std::is_pointer<T>::value >>
type iterator_traits<T*, enable_if_t<std::is_object<T>::value>> (line 2795) | struct iterator_traits<T*, enable_if_t<std::is_object<T>::value>>
type nonesuch (line 2823) | struct nonesuch
method nonesuch (line 2825) | nonesuch() = delete;
method nonesuch (line 2827) | nonesuch(nonesuch const&) = delete;
method nonesuch (line 2828) | nonesuch(nonesuch const&&) = delete;
type detector (line 2837) | struct detector
type is_basic_json (line 2977) | struct is_basic_json : std::false_type {}
class json_ref (line 2987) | class json_ref
method json_ref (line 12532) | json_ref(value_type&& value)
method json_ref (line 12538) | json_ref(const value_type& value)
method json_ref (line 12543) | json_ref(std::initializer_list<json_ref> init)
method json_ref (line 12552) | json_ref(Args && ... args)
method json_ref (line 12559) | json_ref(json_ref&&) = default;
method json_ref (line 12560) | json_ref(const json_ref&) = delete;
method json_ref (line 12561) | json_ref& operator=(const json_ref&) = delete;
method json_ref (line 12562) | json_ref& operator=(json_ref&&) = delete;
method value_type (line 12565) | value_type moved_or_copied() const
method value_type (line 12574) | value_type const& operator*() const
method value_type (line 12579) | value_type const* operator->() const
type is_json_ref (line 2990) | struct is_json_ref : std::false_type {}
type is_json_ref<json_ref<T>> (line 2993) | struct is_json_ref<json_ref<T>> : std::true_type {}
type has_from_json (line 3034) | struct has_from_json : std::false_type {}
type is_getable (line 3041) | struct is_getable
type has_from_json < BasicJsonType, T,
enable_if_t < !is_basic_json<T>::value >> (line 3047) | struct has_from_json < BasicJsonType, T,
type has_non_default_from_json (line 3060) | struct has_non_default_from_json : std::false_type {}
type has_non_default_from_json < BasicJsonType, T, enable_if_t < !is_basic_json<T>::value >> (line 3063) | struct has_non_default_from_json < BasicJsonType, T, enable_if_t < !...
type has_to_json (line 3075) | struct has_to_json : std::false_type {}
type has_to_json < BasicJsonType, T, enable_if_t < !is_basic_json<T>::value >> (line 3078) | struct has_to_json < BasicJsonType, T, enable_if_t < !is_basic_json<...
type is_iterator_traits (line 3093) | struct is_iterator_traits : std::false_type {}
type is_iterator_traits<iterator_traits<T>> (line 3096) | struct is_iterator_traits<iterator_traits<T>>
type is_complete_type (line 3113) | struct is_complete_type : std::false_type {}
type is_complete_type<T, decltype(void(sizeof(T)))> (line 3116) | struct is_complete_type<T, decltype(void(sizeof(T)))> : std::true_ty...
type is_compatible_object_type_impl (line 3120) | struct is_compatible_object_type_impl : std::false_type {}
type is_compatible_object_type_impl <
BasicJsonType, CompatibleObjectType,
enable_if_t < is_detected<mapped_type_t, CompatibleObjectType>::value&&
is_detected<key_type_t, CompatibleObjectType>::value >> (line 3123) | struct is_compatible_object_type_impl <
type is_compatible_object_type (line 3140) | struct is_compatible_object_type
type is_constructible_object_type_impl (line 3145) | struct is_constructible_object_type_impl : std::false_type {}
type is_constructible_object_type_impl <
BasicJsonType, ConstructibleObjectType,
enable_if_t < is_detected<mapped_type_t, ConstructibleObjectType>::value&&
is_detected<key_type_t, ConstructibleObjectType>::value >> (line 3148) | struct is_constructible_object_type_impl <
type is_constructible_object_type (line 3172) | struct is_constructible_object_type
type is_compatible_string_type_impl (line 3178) | struct is_compatible_string_type_impl : std::false_type {}
type is_compatible_string_type_impl <
BasicJsonType, CompatibleStringType,
enable_if_t<is_detected_exact<typename BasicJsonType::string_t::value_type,
value_type_t, CompatibleStringType>::value >> (line 3181) | struct is_compatible_string_type_impl <
type is_compatible_string_type (line 3191) | struct is_compatible_string_type
type is_constructible_string_type_impl (line 3196) | struct is_constructible_string_type_impl : std::false_type {}
type is_constructible_string_type_impl <
BasicJsonType, ConstructibleStringType,
enable_if_t<is_detected_exact<typename BasicJsonType::string_t::value_type,
value_type_t, ConstructibleStringType>::value >> (line 3199) | struct is_constructible_string_type_impl <
type is_constructible_string_type (line 3210) | struct is_constructible_string_type
type is_compatible_array_type_impl (line 3214) | struct is_compatible_array_type_impl : std::false_type {}
type is_compatible_array_type (line 3233) | struct is_compatible_array_type
type is_constructible_array_type_impl (line 3237) | struct is_constructible_array_type_impl : std::false_type {}
type is_constructible_array_type_impl <
BasicJsonType, ConstructibleArrayType,
enable_if_t<std::is_same<ConstructibleArrayType,
typename BasicJsonType::value_type>::value >> (line 3240) | struct is_constructible_array_type_impl <
type is_constructible_array_type_impl <
BasicJsonType, ConstructibleArrayType,
enable_if_t < !std::is_same<ConstructibleArrayType,
typename BasicJsonType::value_type>::value&&
std::is_default_constructible<ConstructibleArrayType>::value&&
(std::is_move_assignable<ConstructibleArrayType>::value ||
std::is_copy_assignable<ConstructibleArrayType>::value)&&
is_detected<value_type_t, ConstructibleArrayType>::value&&
is_detected<iterator_t, ConstructibleArrayType>::value&&
is_complete_type <
detected_t<value_type_t, ConstructibleArrayType >>::value >> (line 3247) | struct is_constructible_array_type_impl <
type is_constructible_array_type (line 3276) | struct is_constructible_array_type
type is_compatible_integer_type_impl (line 3281) | struct is_compatible_integer_type_impl : std::false_type {}
type is_compatible_integer_type_impl <
RealIntegerType, CompatibleNumberIntegerType,
enable_if_t < std::is_integral<RealIntegerType>::value&&
std::is_integral<CompatibleNumberIntegerType>::value&&
!std::is_same<bool, CompatibleNumberIntegerType>::value >> (line 3284) | struct is_compatible_integer_type_impl <
type is_compatible_integer_type (line 3302) | struct is_compatible_integer_type
type is_compatible_type_impl (line 3307) | struct is_compatible_type_impl: std::false_type {}
type is_compatible_type_impl <
BasicJsonType, CompatibleType,
enable_if_t<is_complete_type<CompatibleType>::value >> (line 3310) | struct is_compatible_type_impl <
type is_compatible_type (line 3319) | struct is_compatible_type
type conjunction (line 3323) | struct conjunction : std::true_type { }
type conjunction<B1> (line 3324) | struct conjunction<B1> : B1 { }
type is_constructible_tuple (line 3330) | struct is_constructible_tuple : std::false_type {}
type value_t (line 3377) | enum class value_t : std::uint8_t
function from_json (line 3426) | void from_json(const BasicJsonType& j, typename std::nullptr_t& n)
function get_arithmetic_value (line 3440) | void get_arithmetic_value(const BasicJsonType& j, ArithmeticType& val)
function from_json (line 3466) | void from_json(const BasicJsonType& j, typename BasicJsonType::boole...
function from_json (line 3476) | void from_json(const BasicJsonType& j, typename BasicJsonType::strin...
function from_json (line 3492) | void from_json(const BasicJsonType& j, ConstructibleStringType& s)
function from_json (line 3503) | void from_json(const BasicJsonType& j, typename BasicJsonType::numbe...
function from_json (line 3509) | void from_json(const BasicJsonType& j, typename BasicJsonType::numbe...
function from_json (line 3515) | void from_json(const BasicJsonType& j, typename BasicJsonType::numbe...
function from_json (line 3522) | void from_json(const BasicJsonType& j, EnumType& e)
function from_json (line 3532) | void from_json(const BasicJsonType& j, std::forward_list<T, Allocato...
function from_json (line 3549) | void from_json(const BasicJsonType& j, std::valarray<T>& l)
function from_json (line 3564) | auto from_json(const BasicJsonType& j, T (&arr)[N])
function from_json_array_impl (line 3574) | void from_json_array_impl(const BasicJsonType& j, typename BasicJson...
function from_json_array_impl (line 3580) | auto from_json_array_impl(const BasicJsonType& j, std::array<T, N>& ...
function from_json_array_impl (line 3591) | auto from_json_array_impl(const BasicJsonType& j, ConstructibleArray...
function from_json_array_impl (line 3612) | void from_json_array_impl(const BasicJsonType& j, ConstructibleArray...
function from_json (line 3637) | auto from_json(const BasicJsonType& j, ConstructibleArrayType& arr)
function from_json (line 3652) | void from_json(const BasicJsonType& j, typename BasicJsonType::binar...
function from_json (line 3664) | void from_json(const BasicJsonType& j, ConstructibleObjectType& obj)
function from_json (line 3696) | void from_json(const BasicJsonType& j, ArithmeticType& val)
function from_json (line 3727) | void from_json(const BasicJsonType& j, std::pair<A1, A2>& p)
function from_json_tuple_impl (line 3733) | void from_json_tuple_impl(const BasicJsonType& j, Tuple& t, index_se...
function from_json (line 3739) | void from_json(const BasicJsonType& j, std::tuple<Args...>& t)
function from_json (line 3747) | void from_json(const BasicJsonType& j, std::map<Key, Value, Compare,...
function from_json (line 3767) | void from_json(const BasicJsonType& j, std::unordered_map<Key, Value...
type from_json_fn (line 3784) | struct from_json_fn
function int_to_string (line 3835) | void int_to_string( string_type& target, std::size_t value )
class iteration_proxy_value (line 3841) | class iteration_proxy_value
method iteration_proxy_value (line 3864) | explicit iteration_proxy_value(IteratorType it) noexcept : anchor(...
method iteration_proxy_value (line 3867) | iteration_proxy_value& operator*()
method iteration_proxy_value (line 3873) | iteration_proxy_value& operator++()
method string_type (line 3894) | const string_type& key() const
method value (line 3922) | typename IteratorType::reference value() const
class iteration_proxy (line 3929) | class iteration_proxy
method iteration_proxy (line 3937) | explicit iteration_proxy(typename IteratorType::reference cont) no...
method begin (line 3941) | iteration_proxy_value<IteratorType> begin() noexcept
method end (line 3947) | iteration_proxy_value<IteratorType> end() noexcept
function get (line 3956) | auto get(const nlohmann::detail::iteration_proxy_value<IteratorType>...
function get (line 3964) | auto get(const nlohmann::detail::iteration_proxy_value<IteratorType>...
type external_constructor (line 4014) | struct external_constructor
type external_constructor<value_t::boolean> (line 4017) | struct external_constructor<value_t::boolean>
method construct (line 4020) | static void construct(BasicJsonType& j, typename BasicJsonType::bo...
type external_constructor<value_t::string> (line 4029) | struct external_constructor<value_t::string>
method construct (line 4032) | static void construct(BasicJsonType& j, const typename BasicJsonTy...
method construct (line 4040) | static void construct(BasicJsonType& j, typename BasicJsonType::st...
method construct (line 4050) | static void construct(BasicJsonType& j, const CompatibleStringType...
type external_constructor<value_t::binary> (line 4059) | struct external_constructor<value_t::binary>
method construct (line 4062) | static void construct(BasicJsonType& j, const typename BasicJsonTy...
method construct (line 4071) | static void construct(BasicJsonType& j, typename BasicJsonType::bi...
type external_constructor<value_t::number_float> (line 4081) | struct external_constructor<value_t::number_float>
method construct (line 4084) | static void construct(BasicJsonType& j, typename BasicJsonType::nu...
type external_constructor<value_t::number_unsigned> (line 4093) | struct external_constructor<value_t::number_unsigned>
method construct (line 4096) | static void construct(BasicJsonType& j, typename BasicJsonType::nu...
type external_constructor<value_t::number_integer> (line 4105) | struct external_constructor<value_t::number_integer>
method construct (line 4108) | static void construct(BasicJsonType& j, typename BasicJsonType::nu...
type external_constructor<value_t::array> (line 4117) | struct external_constructor<value_t::array>
method construct (line 4120) | static void construct(BasicJsonType& j, const typename BasicJsonTy...
method construct (line 4128) | static void construct(BasicJsonType& j, typename BasicJsonType::ar...
method construct (line 4138) | static void construct(BasicJsonType& j, const CompatibleArrayType&...
method construct (line 4148) | static void construct(BasicJsonType& j, const std::vector<bool>& arr)
method construct (line 4162) | static void construct(BasicJsonType& j, const std::valarray<T>& arr)
type external_constructor<value_t::object> (line 4176) | struct external_constructor<value_t::object>
method construct (line 4179) | static void construct(BasicJsonType& j, const typename BasicJsonTy...
method construct (line 4187) | static void construct(BasicJsonType& j, typename BasicJsonType::ob...
method construct (line 4196) | static void construct(BasicJsonType& j, const CompatibleObjectType...
function to_json (line 4213) | void to_json(BasicJsonType& j, T b) noexcept
function to_json (line 4220) | void to_json(BasicJsonType& j, const CompatibleString& s)
function to_json (line 4226) | void to_json(BasicJsonType& j, typename BasicJsonType::string_t&& s)
function to_json (line 4233) | void to_json(BasicJsonType& j, FloatType val) noexcept
function to_json (line 4240) | void to_json(BasicJsonType& j, CompatibleNumberUnsignedType val) noe...
function to_json (line 4247) | void to_json(BasicJsonType& j, CompatibleNumberIntegerType val) noex...
function to_json (line 4254) | void to_json(BasicJsonType& j, EnumType e) noexcept
function to_json (line 4261) | void to_json(BasicJsonType& j, const std::vector<bool>& e)
function to_json (line 4274) | void to_json(BasicJsonType& j, const CompatibleArrayType& arr)
function to_json (line 4280) | void to_json(BasicJsonType& j, const typename BasicJsonType::binary_...
function to_json (line 4287) | void to_json(BasicJsonType& j, const std::valarray<T>& arr)
function to_json (line 4293) | void to_json(BasicJsonType& j, typename BasicJsonType::array_t&& arr)
function to_json (line 4300) | void to_json(BasicJsonType& j, const CompatibleObjectType& obj)
function to_json (line 4306) | void to_json(BasicJsonType& j, typename BasicJsonType::object_t&& obj)
function to_json (line 4316) | void to_json(BasicJsonType& j, const T(&arr)[N])
function to_json (line 4322) | void to_json(BasicJsonType& j, const std::pair<T1, T2>& p)
function to_json (line 4330) | void to_json(BasicJsonType& j, const T& b)
function to_json_tuple_impl (line 4336) | void to_json_tuple_impl(BasicJsonType& j, const Tuple& t, index_sequ...
function to_json (line 4342) | void to_json(BasicJsonType& j, const T& t)
type to_json_fn (line 4347) | struct to_json_fn
function combine (line 4595) | inline std::size_t combine(std::size_t seed, std::size_t h) noexcept
function hash (line 4613) | std::size_t hash(const BasicJsonType& j)
type input_format_t (line 4744) | enum class input_format_t { json, cbor, msgpack, ubjson, bson }
class file_input_adapter (line 4754) | class file_input_adapter
method file_input_adapter (line 4760) | explicit file_input_adapter(std::FILE* f) noexcept
method file_input_adapter (line 4765) | file_input_adapter(const file_input_adapter&) = delete;
method file_input_adapter (line 4766) | file_input_adapter(file_input_adapter&&) = default;
method file_input_adapter (line 4767) | file_input_adapter& operator=(const file_input_adapter&) = delete;
method file_input_adapter (line 4768) | file_input_adapter& operator=(file_input_adapter&&) = delete;
method get_character (line 4770) | std::char_traits<char>::int_type get_character() noexcept
class input_stream_adapter (line 4790) | class input_stream_adapter
method input_stream_adapter (line 4805) | explicit input_stream_adapter(std::istream& i)
method input_stream_adapter (line 4810) | input_stream_adapter(const input_stream_adapter&) = delete;
method input_stream_adapter (line 4811) | input_stream_adapter& operator=(input_stream_adapter&) = delete;
method input_stream_adapter (line 4812) | input_stream_adapter& operator=(input_stream_adapter&& rhs) = delete;
method input_stream_adapter (line 4814) | input_stream_adapter(input_stream_adapter&& rhs) noexcept : is(rhs...
method get_character (line 4823) | std::char_traits<char>::int_type get_character()
class iterator_input_adapter (line 4843) | class iterator_input_adapter
method iterator_input_adapter (line 4848) | iterator_input_adapter(IteratorType first, IteratorType last)
method get_character (line 4851) | typename std::char_traits<char_type>::int_type get_character()
method empty (line 4872) | bool empty() const
type wide_string_input_helper (line 4881) | struct wide_string_input_helper
type wide_string_input_helper<BaseInputAdapter, 4> (line 4884) | struct wide_string_input_helper<BaseInputAdapter, 4>
method fill_buffer (line 4887) | static void fill_buffer(BaseInputAdapter& input,
type wide_string_input_helper<BaseInputAdapter, 2> (line 4942) | struct wide_string_input_helper<BaseInputAdapter, 2>
method fill_buffer (line 4945) | static void fill_buffer(BaseInputAdapter& input,
class wide_string_input_adapter (line 5005) | class wide_string_input_adapter
method wide_string_input_adapter (line 5010) | wide_string_input_adapter(BaseInputAdapter base)
method get_character (line 5013) | typename std::char_traits<char>::int_type get_character() noexcept
method fill_buffer (line 5034) | void fill_buffer()
type iterator_input_adapter_factory (line 5050) | struct iterator_input_adapter_factory
method adapter_type (line 5056) | static adapter_type create(IteratorType first, IteratorType last)
type is_iterator_of_multibyte (line 5063) | struct is_iterator_of_multibyte
type iterator_input_adapter_factory<IteratorType, enable_if_t<is_iterator_of_multibyte<IteratorType>::value>> (line 5073) | struct iterator_input_adapter_factory<IteratorType, enable_if_t<is_i...
method adapter_type (line 5080) | static adapter_type create(IteratorType first, IteratorType last)
function input_adapter (line 5088) | typename iterator_input_adapter_factory<IteratorType>::adapter_type ...
function input_adapter (line 5096) | auto input_adapter(const ContainerType& container) -> decltype(input...
function file_input_adapter (line 5106) | inline file_input_adapter input_adapter(std::FILE* file)
method file_input_adapter (line 4760) | explicit file_input_adapter(std::FILE* f) noexcept
method file_input_adapter (line 4765) | file_input_adapter(const file_input_adapter&) = delete;
method file_input_adapter (line 4766) | file_input_adapter(file_input_adapter&&) = default;
method file_input_adapter (line 4767) | file_input_adapter& operator=(const file_input_adapter&) = delete;
method file_input_adapter (line 4768) | file_input_adapter& operator=(file_input_adapter&&) = delete;
method get_character (line 4770) | std::char_traits<char>::int_type get_character() noexcept
function input_stream_adapter (line 5111) | inline input_stream_adapter input_adapter(std::istream& stream)
method input_stream_adapter (line 4805) | explicit input_stream_adapter(std::istream& i)
method input_stream_adapter (line 4810) | input_stream_adapter(const input_stream_adapter&) = delete;
method input_stream_adapter (line 4811) | input_stream_adapter& operator=(input_stream_adapter&) = delete;
method input_stream_adapter (line 4812) | input_stream_adapter& operator=(input_stream_adapter&& rhs) = delete;
method input_stream_adapter (line 4814) | input_stream_adapter(input_stream_adapter&& rhs) noexcept : is(rhs...
method get_character (line 4823) | std::char_traits<char>::int_type get_character()
function input_stream_adapter (line 5116) | inline input_stream_adapter input_adapter(std::istream&& stream)
method input_stream_adapter (line 4805) | explicit input_stream_adapter(std::istream& i)
method input_stream_adapter (line 4810) | input_stream_adapter(const input_stream_adapter&) = delete;
method input_stream_adapter (line 4811) | input_stream_adapter& operator=(input_stream_adapter&) = delete;
method input_stream_adapter (line 4812) | input_stream_adapter& operator=(input_stream_adapter&& rhs) = delete;
method input_stream_adapter (line 4814) | input_stream_adapter(input_stream_adapter&& rhs) noexcept : is(rhs...
method get_character (line 4823) | std::char_traits<char>::int_type get_character()
function contiguous_bytes_input_adapter (line 5131) | contiguous_bytes_input_adapter input_adapter(CharT b)
function input_adapter (line 5139) | auto input_adapter(T (&array)[N]) -> decltype(input_adapter(array, a...
class span_input_adapter (line 5147) | class span_input_adapter
method span_input_adapter (line 5156) | span_input_adapter(CharT b, std::size_t l)
method span_input_adapter (line 5163) | span_input_adapter(IteratorType first, IteratorType last)
method contiguous_bytes_input_adapter (line 5166) | contiguous_bytes_input_adapter&& get()
class json_sax_dom_parser (line 5328) | class json_sax_dom_parser
method json_sax_dom_parser (line 5342) | explicit json_sax_dom_parser(BasicJsonType& r, const bool allow_ex...
method json_sax_dom_parser (line 5347) | json_sax_dom_parser(const json_sax_dom_parser&) = delete;
method json_sax_dom_parser (line 5348) | json_sax_dom_parser(json_sax_dom_parser&&) = default;
method json_sax_dom_parser (line 5349) | json_sax_dom_parser& operator=(const json_sax_dom_parser&) = delete;
method json_sax_dom_parser (line 5350) | json_sax_dom_parser& operator=(json_sax_dom_parser&&) = default;
method null (line 5353) | bool null()
method boolean (line 5359) | bool boolean(bool val)
method number_integer (line 5365) | bool number_integer(number_integer_t val)
method number_unsigned (line 5371) | bool number_unsigned(number_unsigned_t val)
method number_float (line 5377) | bool number_float(number_float_t val, const string_t& /*unused*/)
method string (line 5383) | bool string(string_t& val)
method binary (line 5389) | bool binary(binary_t& val)
method start_object (line 5395) | bool start_object(std::size_t len)
method key (line 5408) | bool key(string_t& val)
method end_object (line 5415) | bool end_object()
method start_array (line 5421) | bool start_array(std::size_t len)
method end_array (line 5434) | bool end_array()
method parse_error (line 5441) | bool parse_error(std::size_t /*unused*/, const std::string& /*unus...
method is_errored (line 5453) | constexpr bool is_errored() const
method JSON_HEDLEY_RETURNS_NON_NULL (line 5466) | JSON_HEDLEY_RETURNS_NON_NULL
class json_sax_dom_callback_parser (line 5502) | class json_sax_dom_callback_parser
method json_sax_dom_callback_parser (line 5513) | json_sax_dom_callback_parser(BasicJsonType& r,
method json_sax_dom_callback_parser (line 5522) | json_sax_dom_callback_parser(const json_sax_dom_callback_parser&) ...
method json_sax_dom_callback_parser (line 5523) | json_sax_dom_callback_parser(json_sax_dom_callback_parser&&) = def...
method json_sax_dom_callback_parser (line 5524) | json_sax_dom_callback_parser& operator=(const json_sax_dom_callbac...
method json_sax_dom_callback_parser (line 5525) | json_sax_dom_callback_parser& operator=(json_sax_dom_callback_pars...
method null (line 5528) | bool null()
method boolean (line 5534) | bool boolean(bool val)
method number_integer (line 5540) | bool number_integer(number_integer_t val)
method number_unsigned (line 5546) | bool number_unsigned(number_unsigned_t val)
method number_float (line 5552) | bool number_float(number_float_t val, const string_t& /*unused*/)
method string (line 5558) | bool string(string_t& val)
method binary (line 5564) | bool binary(binary_t& val)
method start_object (line 5570) | bool start_object(std::size_t len)
method key (line 5588) | bool key(string_t& val)
method end_object (line 5605) | bool end_object()
method start_array (line 5634) | bool start_array(std::size_t len)
method end_array (line 5651) | bool end_array()
method parse_error (line 5680) | bool parse_error(std::size_t /*unused*/, const std::string& /*unus...
method is_errored (line 5692) | constexpr bool is_errored() const
method handle_value (line 5714) | std::pair<bool, BasicJsonType*> handle_value(Value&& v, const bool...
class json_sax_acceptor (line 5798) | class json_sax_acceptor
method null (line 5807) | bool null()
method boolean (line 5812) | bool boolean(bool /*unused*/)
method number_integer (line 5817) | bool number_integer(number_integer_t /*unused*/)
method number_unsigned (line 5822) | bool number_unsigned(number_unsigned_t /*unused*/)
method number_float (line 5827) | bool number_float(number_float_t /*unused*/, const string_t& /*unu...
method string (line 5832) | bool string(string_t& /*unused*/)
method binary (line 5837) | bool binary(binary_t& /*unused*/)
method start_object (line 5842) | bool start_object(std::size_t /*unused*/ = std::size_t(-1))
method key (line 5847) | bool key(string_t& /*unused*/)
method end_object (line 5852) | bool end_object()
method start_array (line 5857) | bool start_array(std::size_t /*unused*/ = std::size_t(-1))
method end_array (line 5862) | bool end_array()
method parse_error (line 5867) | bool parse_error(std::size_t /*unused*/, const std::string& /*unus...
class lexer_base (line 5905) | class lexer_base
type token_type (line 5909) | enum class token_type
class lexer (line 5982) | class lexer : public lexer_base<BasicJsonType>
method lexer (line 5994) | explicit lexer(InputAdapterType&& adapter, bool ignore_comments_ =...
method lexer (line 6001) | lexer(const lexer&) = delete;
method lexer (line 6002) | lexer(lexer&&) = default;
method lexer (line 6003) | lexer& operator=(lexer&) = delete;
method lexer (line 6004) | lexer& operator=(lexer&&) = default;
method JSON_HEDLEY_PURE (line 6013) | JSON_HEDLEY_PURE
method get_codepoint (line 6040) | int get_codepoint()
method next_byte_in_range (line 6088) | bool next_byte_in_range(std::initializer_list<char_int_type> ranges)
method token_type (line 6125) | token_type scan_string()
method scan_comment (line 6715) | bool scan_comment()
method strtof (line 6783) | static void strtof(float& f, const char* str, char** endptr) noexcept
method strtof (line 6789) | static void strtof(double& f, const char* str, char** endptr) noex...
method strtof (line 6795) | static void strtof(long double& f, const char* str, char** endptr)...
method token_type (line 6840) | token_type scan_number() // lgtm [cpp/use-of-goto]
type is_sax (line 7573) | struct is_sax
type is_sax_static_asserts (line 7604) | struct is_sax_static_asserts
type cbor_tag_handler_t (line 7668) | enum class cbor_tag_handler_t
function little_endianess (line 7681) | static inline bool little_endianess(int num = 1) noexcept
class binary_reader (line 7695) | class binary_reader
method binary_reader (line 7712) | explicit binary_reader(InputAdapterType&& adapter) : ia(std::move(...
method binary_reader (line 7718) | binary_reader(const binary_reader&) = delete;
method binary_reader (line 7719) | binary_reader(binary_reader&&) = default;
method binary_reader (line 7720) | binary_reader& operator=(const binary_reader&) = delete;
method binary_reader (line 7721) | binary_reader& operator=(binary_reader&&) = default;
method JSON_HEDLEY_NON_NULL (line 7732) | JSON_HEDLEY_NON_NULL(3)
method parse_bson_internal (line 7794) | bool parse_bson_internal()
method get_bson_cstr (line 7819) | bool get_bson_cstr(string_t& result)
method get_bson_string (line 7849) | bool get_bson_string(const NumberType len, string_t& result)
method get_bson_binary (line 7870) | bool get_bson_binary(const NumberType len, binary_t& result)
method parse_bson_element_internal (line 7896) | bool parse_bson_element_internal(const char_int_type element_type,
method parse_bson_element_list (line 7974) | bool parse_bson_element_list(const bool is_array)
method parse_bson_array (line 8012) | bool parse_bson_array()
method parse_cbor_internal (line 8042) | bool parse_cbor_internal(const bool get_char,
method get_cbor_string (line 8487) | bool get_cbor_string(string_t& result)
method get_cbor_binary (line 8582) | bool get_cbor_binary(binary_t& result)
method get_cbor_array (line 8676) | bool get_cbor_array(const std::size_t len,
method get_cbor_object (line 8714) | bool get_cbor_object(const std::size_t len,
method parse_msgpack_internal (line 8767) | bool parse_msgpack_internal()
method get_msgpack_string (line 9147) | bool get_msgpack_string(string_t& result)
method get_msgpack_binary (line 9229) | bool get_msgpack_binary(binary_t& result)
method get_msgpack_array (line 9340) | bool get_msgpack_array(const std::size_t len)
method get_msgpack_object (line 9362) | bool get_msgpack_object(const std::size_t len)
method parse_ubjson_internal (line 9399) | bool parse_ubjson_internal(const bool get_char = true)
method get_ubjson_string (line 9418) | bool get_ubjson_string(string_t& result, const bool get_char = true)
method get_ubjson_size_value (line 9472) | bool get_ubjson_size_value(std::size_t& result)
method get_ubjson_size_type (line 9549) | bool get_ubjson_size_type(std::pair<std::size_t, char_int_type>& r...
method get_ubjson_value (line 9590) | bool get_ubjson_value(const char_int_type prefix)
method get_ubjson_array (line 9691) | bool get_ubjson_array()
method get_ubjson_object (line 9753) | bool get_ubjson_object()
method get_ubjson_high_precision_number (line 9828) | bool get_ubjson_high_precision_number()
method char_int_type (line 9890) | char_int_type get()
method char_int_type (line 9899) | char_int_type get_ignore_noop()
method get_number (line 9924) | bool get_number(const input_format_t format, NumberType& result)
method get_string (line 9967) | bool get_string(const input_format_t format,
method get_binary (line 10000) | bool get_binary(const input_format_t format,
method JSON_HEDLEY_NON_NULL (line 10023) | JSON_HEDLEY_NON_NULL(3)
method get_token_string (line 10037) | std::string get_token_string() const
method exception_message (line 10050) | std::string exception_message(const input_format_t format,
type parse_event_t (line 10137) | enum class parse_event_t : uint8_t
class parser (line 10163) | class parser
method parser (line 10174) | explicit parser(InputAdapterType&& adapter,
method parse (line 10196) | void parse(const bool strict, BasicJsonType& result)
method accept (line 10257) | bool accept(const bool strict = true)
method sax_parse (line 10265) | bool sax_parse(SAX* sax, const bool strict = true)
method sax_parse_internal (line 10285) | bool sax_parse_internal(SAX* sax)
method token_type (line 10567) | token_type get_token()
method exception_message (line 10572) | std::string exception_message(const token_type expected, const std...
class primitive_iterator_t (line 10636) | class primitive_iterator_t
method difference_type (line 10647) | constexpr difference_type get_value() const noexcept
method set_begin (line 10653) | void set_begin() noexcept
method set_end (line 10659) | void set_end() noexcept
method is_begin (line 10665) | constexpr bool is_begin() const noexcept
method is_end (line 10671) | constexpr bool is_end() const noexcept
method primitive_iterator_t (line 10686) | primitive_iterator_t operator+(difference_type n) noexcept
method difference_type (line 10693) | constexpr difference_type operator-(primitive_iterator_t lhs, prim...
method primitive_iterator_t (line 10698) | primitive_iterator_t& operator++() noexcept
method primitive_iterator_t (line 10704) | primitive_iterator_t const operator++(int) noexcept
method primitive_iterator_t (line 10711) | primitive_iterator_t& operator--() noexcept
method primitive_iterator_t (line 10717) | primitive_iterator_t const operator--(int) noexcept
method p
Condensed preview — 116 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (4,130K chars).
[
{
"path": ".gitignore",
"chars": 865,
"preview": "# This file is used to ignore files which are generated\n# --------------------------------------------------------------"
},
{
"path": "EnglishPhoneticProcessor.cpp",
"chars": 3916,
"preview": "#include \"EnglishPhoneticProcessor.h\"\n#include \"VoxCommon.hpp\"\n#include <Windows.h>\n#include <string>\n\n\nusing namespace "
},
{
"path": "EnglishPhoneticProcessor.h",
"chars": 862,
"preview": "#pragma once\n#include \"TextTokenizer.h\"\n\n\n#include \"phoneticdict.h\"\n#include \"phonemizer.h\"\n#include \"espeakphonemizer.h"
},
{
"path": "FastSpeech2.cpp",
"chars": 2190,
"preview": "#include \"FastSpeech2.h\"\n\n\n\nFastSpeech2::FastSpeech2()\n{\n}\n\n\nTFTensor<float> FastSpeech2::DoInference(const std::vector<"
},
{
"path": "FastSpeech2.h",
"chars": 758,
"preview": "#pragma once\n\n#include \"melgen.h\"\n\n\nclass FastSpeech2 : public MelGen\n{\n\npublic:\n\tFastSpeech2();\n\n\n\n\t/*\n\tDo inference on"
},
{
"path": "LICENSE.md",
"chars": 1064,
"preview": "MIT License\n\nCopyright (c) 2020 ZDisket\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "MultiBandMelGAN.cpp",
"chars": 933,
"preview": "#include \"MultiBandMelGAN.h\"\n#define IF_EXCEPT(cond,ex) if (cond){throw std::exception(ex);}\n\n\n\nbool MultiBandMelGAN::In"
},
{
"path": "MultiBandMelGAN.h",
"chars": 463,
"preview": "#pragma once\n\n#include \"VoxCommon.hpp\"\n#include <memory>\nclass MultiBandMelGAN\n{\nprivate:\n std::unique_ptr<cppflow::m"
},
{
"path": "ONNXModel.cpp",
"chars": 4916,
"preview": "#include \"ONNXModel.h\"\n#include <dml_provider_factory.h>\n#include <onnxruntime_c_api.h>\n// We can't include this (or emb"
},
{
"path": "ONNXModel.h",
"chars": 4878,
"preview": "#pragma once\n\n#include <iostream>\n#include <string>\n#include <vector>\n#include <onnxruntime_cxx_api.h>\n#include <memory>"
},
{
"path": "ONNXUtil.hpp",
"chars": 1178,
"preview": "#pragma once\n#include <iostream>\n#include <string>\n#include <vector>\n#include <onnxruntime_cxx_api.h>\n#include <memory>\n"
},
{
"path": "README.md",
"chars": 6403,
"preview": "# TensorVox\n\n\nTensorVox is an application designed to enable user-friendly and lightweight neural speech synthesis in th"
},
{
"path": "Supertonic.cpp",
"chars": 9210,
"preview": "#include \"Supertonic.h\"\n#include \"ext/json.hpp\"\n\n#include <algorithm>\n#include <fstream>\n#include <random>\n#include <fil"
},
{
"path": "Supertonic.h",
"chars": 1400,
"preview": "#pragma once\n\n#include \"ONNXModel.h\"\n#include \"melgen.h\"\n#include <cstdint>\n#include <memory>\n#include <string>\n#include"
},
{
"path": "SupertonicTextProcessor.cpp",
"chars": 13118,
"preview": "#include \"SupertonicTextProcessor.h\"\n#include \"ext/json.hpp\"\n\n#include <algorithm>\n#include <cctype>\n#include <fstream>\n"
},
{
"path": "SupertonicTextProcessor.h",
"chars": 1351,
"preview": "#pragma once\n\n#include <cstdint>\n#include <string>\n#include <vector>\n\n// Available languages for multilingual TTS\nextern"
},
{
"path": "SupertonicVocoder.cpp",
"chars": 2199,
"preview": "#include \"SupertonicVocoder.h\"\n\n#include <cstddef>\n#include <string>\n#include <vector>\n\nnamespace {\nstd::wstring ToWide("
},
{
"path": "SupertonicVocoder.h",
"chars": 281,
"preview": "#pragma once\n\n#include \"ONNXModel.h\"\n#include \"MultiBandMelGAN.h\"\n#include <string>\n\nclass SupertonicVocoder : public ON"
},
{
"path": "TensorVox.pro",
"chars": 4360,
"preview": "QT += core gui\nQT += multimedia\nQT += winextras\ngreaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport\n\nCONFIG += "
},
{
"path": "TextTokenizer.cpp",
"chars": 5310,
"preview": "#include \"TextTokenizer.h\"\n#include \"ext/ZCharScanner.h\"\n#include <algorithm>\n#include <cassert>\n#include <cctype>\n#incl"
},
{
"path": "TextTokenizer.h",
"chars": 830,
"preview": "#pragma once\n#include <vector>\n#include <string>\n#include \"VoxCommon.hpp\"\n#include \"Numbertext.hxx\"\n\nclass TextTokenizer"
},
{
"path": "VITSEvo.cpp",
"chars": 3560,
"preview": "#include \"VITSEvo.h\"\n#include <cstddef>\n#include <string>\n\n\nstd::vector<int64_t> ZeroPadVec(const std::vector<int32_t> &"
},
{
"path": "VITSEvo.h",
"chars": 1088,
"preview": "#pragma once\n\n#include \"ONNXModel.h\"\n#include \"melgen.h\"\n#include <cstdint>\n#include <vector>\n\nclass VITSEvo : public ON"
},
{
"path": "Voice.cpp",
"chars": 12622,
"preview": "#include \"Voice.h\"\n#include \"ext/ZCharScanner.h\"\n\n\nstd::vector<int32_t> Voice::CharsToID(const std::string & RawInTxt)\n{"
},
{
"path": "Voice.h",
"chars": 3449,
"preview": "#pragma once\n\n#include \"FastSpeech2.h\"\n#include \"tacotron2.h\"\n#include \"MultiBandMelGAN.h\"\n#include \"EnglishPhoneticProc"
},
{
"path": "VoxCommon.cpp",
"chars": 5456,
"preview": "#include \"VoxCommon.hpp\"\n#include \"ext/json.hpp\"\nusing namespace nlohmann;\n#include <codecvt>\n#include <locale> "
},
{
"path": "VoxCommon.hpp",
"chars": 5256,
"preview": "#pragma once\n/*\n VoxCommon.hpp : Defines common data structures and constants to be used with TensorVox \n*/\n#include <io"
},
{
"path": "attention.cpp",
"chars": 1470,
"preview": "#include \"attention.h\"\n\n\nAttention::Attention(QWidget *parent) : QCustomPlot(parent)\n{\n\n QBrush FillBrush(QColor(100,"
},
{
"path": "attention.h",
"chars": 287,
"preview": "#ifndef ATTENTION_H\n#define ATTENTION_H\n\n#include \"ext/qcustomplot.h\"\n#include \"VoxCommon.hpp\"\n\nclass Attention : public"
},
{
"path": "batchdenoisedlg.cpp",
"chars": 4862,
"preview": "#include \"batchdenoisedlg.h\"\n#include \"ui_batchdenoisedlg.h\"\n\n#include <QFileDialog>\n#include <QDir>\n#include <QDirItera"
},
{
"path": "batchdenoisedlg.h",
"chars": 881,
"preview": "#ifndef BATCHDENOISEDLG_H\n#define BATCHDENOISEDLG_H\n\n#include <QDialog>\n#include <QTimer>\nnamespace Ui {\nclass BatchDeno"
},
{
"path": "batchdenoisedlg.ui",
"chars": 3645,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>BatchDenoiseDlg</class>\n <widget class=\"QDialog\" name="
},
{
"path": "bert.cpp",
"chars": 1447,
"preview": "#include \"bert.h\"\n#include <windows.h>\n\nBERT::BERT()\n{\n\n}\n\nBERT::BERT(const std::string &Path, const std::string &DictPa"
},
{
"path": "bert.h",
"chars": 659,
"preview": "#ifndef BERT_H\n#define BERT_H\n\n#include \"VoxCommon.hpp\"\n\n#include \"berttokenizer.h\"\n\n// BERT: Class for inference of Tor"
},
{
"path": "berttokenizer.cpp",
"chars": 9293,
"preview": "#include \"berttokenizer.h\"\nconst std::wstring stripChar = L\" \\t\\n\\r\\v\\f\";\n#include \"utf8proc.h\"\n#include \"ext/ZCharScann"
},
{
"path": "berttokenizer.h",
"chars": 1995,
"preview": "#ifndef BERTTOKENIZER_H\n#define BERTTOKENIZER_H\n// https://gist.github.com/luistung/ace4888cf5fd1bad07844021cb2c7ecf\n\n#i"
},
{
"path": "devits.cpp",
"chars": 2276,
"preview": "#include \"devits.h\"\n\n\nDEVITS::DEVITS()\n{\n\n}\n\n#include <windows.h>\n#include <string>\n#include <vector>\n#include <sstream>"
},
{
"path": "devits.h",
"chars": 843,
"preview": "#ifndef DEVITS_H\n#define DEVITS_H\n#include \"vits.h\"\n\nclass DEVITS : public VITS\n{\npublic:\n DEVITS();\n\n /*\n Do i"
},
{
"path": "espeakphonemizer.cpp",
"chars": 2517,
"preview": "#include \"espeakphonemizer.h\"\n#include <espeak/speak_lib.h>\n\n\nstatic const std::u32string Punctuation_t = U\",.;¡!¿?:-~\";"
},
{
"path": "espeakphonemizer.h",
"chars": 1189,
"preview": "#ifndef ESPEAKPHONEMIZER_H\n#define ESPEAKPHONEMIZER_H\n\n/*\n\n ESpeakPhonemizer: Tool for IPA Text2Phon using ESpeak NG as"
},
{
"path": "ext/AudioFile.hpp",
"chars": 44631,
"preview": "//=======================================================================\n/** @file AudioFile.h\n * @author Adam Stark\n "
},
{
"path": "ext/ByteArr.cpp",
"chars": 7586,
"preview": "#include \"ByteArr.h\"\nusing namespace std;\n\nvoid ByteArr::Realloc(const size_t & newSize)\n{\n\tif (newSize < DataSz)\n\t\tretu"
},
{
"path": "ext/ByteArr.h",
"chars": 6013,
"preview": "#ifndef BYTEARR_H\n#define BYTEARR_H\n/*\n###################################################\n\n ____ _\n | _ \\ "
},
{
"path": "ext/CppFlow/context.h",
"chars": 2536,
"preview": "//\n// Created by serizba on 27/6/20.\n//\n\n#ifndef CPPFLOW2_CONTEXT_H\n#define CPPFLOW2_CONTEXT_H\n\n#include <memory>\n#inclu"
},
{
"path": "ext/CppFlow/cppflow.h",
"chars": 676,
"preview": "//\n// Created by serizba on 17/9/20.\n//\n\n#ifndef EXAMPLE_CPPFLOW_H\n#define EXAMPLE_CPPFLOW_H\n\n#include \"tensor.h\"\n#inclu"
},
{
"path": "ext/CppFlow/datatype.h",
"chars": 3332,
"preview": "//\n// Created by serizba on 12/7/20.\n//\n\n#ifndef CPPFLOW2_DATATYPE_H\n#define CPPFLOW2_DATATYPE_H\n\n#include <type_traits>"
},
{
"path": "ext/CppFlow/defer.h",
"chars": 460,
"preview": "#pragma once\n#include <functional>\n\nnamespace cppflow {\n\nclass defer {\npublic:\n typedef std::function<void ()> Func;\n"
},
{
"path": "ext/CppFlow/model.h",
"chars": 5798,
"preview": "//\n// Created by serizba on 29/6/20.\n//\n\n#ifndef CPPFLOW2_MODEL_H\n#define CPPFLOW2_MODEL_H\n\n#include <tensorflow/c/c_api"
},
{
"path": "ext/CppFlow/ops.h",
"chars": 2518,
"preview": "//\n// Created by serizba on 31/7/20.\n//\n\n#ifndef CPPFLOW2_OPS_H\n#define CPPFLOW2_OPS_H\n\n\n#include \"tensor.h\"\n#include \"r"
},
{
"path": "ext/CppFlow/raw_ops.h",
"chars": 1014285,
"preview": "\n/**\n * @file ops.h\n * TensorFlow raw_ops mappings\n */\n\n#ifndef CPPFLOW2_RAW_OPS_H\n#define CPPFLOW2_RAW_OPS_H\n\n#include "
},
{
"path": "ext/CppFlow/tensor.h",
"chars": 9341,
"preview": "//\n// Created by serizba on 27/6/20.\n//\n\n#ifndef CPPFLOW2_TENSOR_H\n#define CPPFLOW2_TENSOR_H\n\n#include <memory>\n#include"
},
{
"path": "ext/Qt-Frameless-Window-DarkStyle-master/.gitignore",
"chars": 342,
"preview": "# C++ objects and libs\n\n*.slo\n*.lo\n*.o\n*.a\n*.la\n*.lai\n*.so\n*.dll\n*.dylib\n\n# Qt-es\n\n/.qmake.cache\n/.qmake.stash\n*.pro.use"
},
{
"path": "ext/Qt-Frameless-Window-DarkStyle-master/DarkStyle.cpp",
"chars": 3143,
"preview": "/*\n###############################################################################\n# "
},
{
"path": "ext/Qt-Frameless-Window-DarkStyle-master/DarkStyle.h",
"chars": 1283,
"preview": "/*\n###############################################################################\n# "
},
{
"path": "ext/Qt-Frameless-Window-DarkStyle-master/README.md",
"chars": 4380,
"preview": "# Qt Frameless Window with DarkStyle\nsimple MainWindow class implementation with frameless window and custom dark style."
},
{
"path": "ext/Qt-Frameless-Window-DarkStyle-master/darkstyle/darkstyle.qss",
"chars": 11102,
"preview": "QToolTip{\n color:#ffffff;\n background-color:palette(base);\n border:1px solid palette(highlight);\n border-radius:4px;"
},
{
"path": "ext/Qt-Frameless-Window-DarkStyle-master/darkstyle.qrc",
"chars": 1637,
"preview": "<RCC>\n <qresource prefix=\"/\">\n <file>darkstyle/darkstyle.qss</file>\n <file>darkstyle/icon_close.png</fi"
},
{
"path": "ext/Qt-Frameless-Window-DarkStyle-master/frameless_window_dark.pro",
"chars": 1466,
"preview": "###############################################################################\n# "
},
{
"path": "ext/Qt-Frameless-Window-DarkStyle-master/framelesswindow/framelesswindow.cpp",
"chars": 8393,
"preview": "/*\n###############################################################################\n# "
},
{
"path": "ext/Qt-Frameless-Window-DarkStyle-master/framelesswindow/framelesswindow.h",
"chars": 2711,
"preview": "/*\n###############################################################################\n# "
},
{
"path": "ext/Qt-Frameless-Window-DarkStyle-master/framelesswindow/framelesswindow.ui",
"chars": 8825,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>FramelessWindow</class>\n <widget class=\"QWidget\" name="
},
{
"path": "ext/Qt-Frameless-Window-DarkStyle-master/framelesswindow/windowdragger.cpp",
"chars": 1907,
"preview": "/*\n###############################################################################\n# "
},
{
"path": "ext/Qt-Frameless-Window-DarkStyle-master/framelesswindow/windowdragger.h",
"chars": 1374,
"preview": "/*\n###############################################################################\n# "
},
{
"path": "ext/Qt-Frameless-Window-DarkStyle-master/framelesswindow.qrc",
"chars": 265,
"preview": "<RCC>\n <qresource prefix=\"/\">\n <file>images/icon_window_minimize.png</file>\n <file>images/icon_window_r"
},
{
"path": "ext/ZCharScanner.cpp",
"chars": 3360,
"preview": "#include \"ZCharScanner.h\"\nusing namespace std;\n#include <stdexcept>\n\nint ZStringDelimiter::key_search(const GString& s, "
},
{
"path": "ext/ZCharScanner.h",
"chars": 1910,
"preview": "#pragma once\n\n#define GBasicCharScanner ZStringDelimiter\n\n#include <vector>\n#include <string>\n\n#ifndef ZSDEL_USE_WSTRING"
},
{
"path": "ext/ZCharScannerWide.cpp",
"chars": 3561,
"preview": "#include \"ZCharScannerWide.h\"\nusing namespace std;\n#include <stdexcept>\n\nint ZStringDelimiterWide::key_search(const std:"
},
{
"path": "ext/ZCharScannerWide.h",
"chars": 2049,
"preview": "#pragma once\n\n#define GBasicCharScanner ZStringDelimiter\n\n#include <vector>\n#include <string>\n\n// We need ZCharScanner b"
},
{
"path": "ext/ZFile.cpp",
"chars": 2880,
"preview": "#include \"ZFile.h\"\n\nusing namespace std;\nint ZFile::EZFOpenModeToIos(const EZFOpenMode::Enum & input)\n{\n\t/*\n\thehe wall o"
},
{
"path": "ext/ZFile.h",
"chars": 5323,
"preview": "#pragma once\n\n/*\n######################################\n#\n#\n ____________ _ _ \n |___ / ____(_) | \n / /| |"
},
{
"path": "ext/json.hpp",
"chars": 926234,
"preview": "/*\n __ _____ _____ _____\n __| | __| | | | JSON for Modern C++\n| | |__ | | | | | | version 3.9.1\n|___"
},
{
"path": "ext/qcustomplot.cpp",
"chars": 1306237,
"preview": "/***************************************************************************\n** "
},
{
"path": "ext/qcustomplot.h",
"chars": 308965,
"preview": "/***************************************************************************\n** "
},
{
"path": "g2p_train/README.md",
"chars": 2558,
"preview": "# G2P for TensorVox\nTensorVox utilizes an RNN-based G2P model implemented in Tensorflow to convert text to phonemes be"
},
{
"path": "g2p_train/config/default.yaml",
"chars": 342,
"preview": "# Config file for G2P-English model. This one does 15 epochs and trains very quickly on GPU.\n\ngru_dims: 128 # Size of GR"
},
{
"path": "g2p_train/config/longer.yaml",
"chars": 335,
"preview": "# Config file for G2P model that trains for longer with softer learning, recommended\n\ngru_dims: 128 # Size of GRU (and e"
},
{
"path": "g2p_train/train_and_export.py",
"chars": 5559,
"preview": "from tqdm import tqdm\nimport os\nimport argparse\nimport tensorflow as tf\nimport yaml\nimport shutil\nglobal_max = 0\ncumodel"
},
{
"path": "istftnettorch.cpp",
"chars": 1730,
"preview": "#include \"istftnettorch.h\"\n#include <windows.h>\nbool iSTFTNetTorch::Initialize(const std::string &VocoderPath)\n{\n tor"
},
{
"path": "istftnettorch.h",
"chars": 562,
"preview": "#ifndef ISTFTNETTORCH_H\n#define ISTFTNETTORCH_H\n#include \"MultiBandMelGAN.h\"\n\nclass iSTFTNetTorch : public MultiBandMelG"
},
{
"path": "main.cpp",
"chars": 624,
"preview": "#include \"mainwindow.h\"\n\n#include \"ext/Qt-Frameless-Window-DarkStyle-master/DarkStyle.h\"\n#include \"framelesswindow.h\"\n\n#"
},
{
"path": "mainwindow.cpp",
"chars": 46235,
"preview": "#include \"mainwindow.h\"\n#include \"ui_mainwindow.h\"\n#include <QDir>\n#include <QDirIterator>\n#include <QSplitter>\n\n#includ"
},
{
"path": "mainwindow.h",
"chars": 5422,
"preview": "#ifndef MAINWINDOW_H\n#define MAINWINDOW_H\n\n#include <QMainWindow>\n#include \"Voice.h\"\n#include <QStringList>\n#include <QA"
},
{
"path": "mainwindow.ui",
"chars": 33484,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>MainWindow</class>\n <widget class=\"QMainWindow\" name=\""
},
{
"path": "melgen.cpp",
"chars": 446,
"preview": "#include \"melgen.h\"\n\nMelGen::MelGen()\n{\n\n}\n\nMelGen::MelGen(const std::string &SavedModelFolder, ETTSRepo::Enum InTTSRepo"
},
{
"path": "melgen.h",
"chars": 1085,
"preview": "#ifndef MELGEN_H\n#define MELGEN_H\n\n\n\n#include \"ext/CppFlow/ops.h\"\n#include \"ext/CppFlow/model.h\"\n#include \"VoxCommon.hpp"
},
{
"path": "modelinfodlg.cpp",
"chars": 1181,
"preview": "#include \"modelinfodlg.h\"\n#include \"ui_modelinfodlg.h\"\n#include <QFile>\n\nModelInfoDlg::ModelInfoDlg(QWidget *parent) :\n "
},
{
"path": "modelinfodlg.h",
"chars": 495,
"preview": "#ifndef MODELINFODLG_H\n#define MODELINFODLG_H\n\n#include <QDialog>\n\nnamespace Ui {\nclass ModelInfoDlg;\n}\n\nclass ModelInfo"
},
{
"path": "modelinfodlg.ui",
"chars": 4745,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>ModelInfoDlg</class>\n <widget class=\"QDialog\" name=\"Mo"
},
{
"path": "phddialog.cpp",
"chars": 3493,
"preview": "#include \"phddialog.h\"\n#include \"ui_phddialog.h\"\n#include <QTableWidget>\n#include <QTableWidgetItem>\n#include <QFileDial"
},
{
"path": "phddialog.h",
"chars": 625,
"preview": "#ifndef PHDDIALOG_H\n#define PHDDIALOG_H\n\n#include <QDialog>\n#include \"phoneticdict.h\"\nnamespace Ui {\nclass PhdDialog;\n}\n"
},
{
"path": "phddialog.ui",
"chars": 2896,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>PhdDialog</class>\n <widget class=\"QDialog\" name=\"PhdDi"
},
{
"path": "phonemizer.cpp",
"chars": 4385,
"preview": "#include \"phonemizer.h\"\n#include <fstream>\n#include \"ext/ZCharScanner.h\"\n\n#include <QString>\nint32_t GetID(const std::ve"
},
{
"path": "phonemizer.h",
"chars": 2070,
"preview": "#ifndef PHONEMIZER_H\n#define PHONEMIZER_H\n#include \"tfg2p.h\"\n#include <tuple>\n#include <set>\n#include <algorithm>\n\nstruc"
},
{
"path": "phoneticdict.cpp",
"chars": 1231,
"preview": "#include \"phoneticdict.h\"\n#include \"ext/ZFile.h\"\n#include <map>\n\nconst std::map<std::string,std::string> LegToV1{\n {\"En"
},
{
"path": "phoneticdict.h",
"chars": 583,
"preview": "#ifndef PHONETICDICT_H\n#define PHONETICDICT_H\n#include \"ext/ZFile.h\"\n#include <string>\n#include <QString>\nstruct DictEnt"
},
{
"path": "phonetichighlighter.cpp",
"chars": 1233,
"preview": "#include \"phonetichighlighter.h\"\n\n\nPhoneticHighlighter::PhoneticHighlighter(QTextDocument *parent) : QSyntaxHighlighter("
},
{
"path": "phonetichighlighter.h",
"chars": 690,
"preview": "#ifndef PHONETICHIGHLIGHTER_H\n#define PHONETICHIGHLIGHTER_H\n#include <QSyntaxHighlighter>\n#include <QRegularExpression>\n"
},
{
"path": "spectrogram.cpp",
"chars": 3134,
"preview": "#include \"spectrogram.h\"\n\n\n\nvoid Spectrogram::TimerTick()\n{\n if (!DoSlide)\n return;\n\n float RemSecs = ((flo"
},
{
"path": "spectrogram.h",
"chars": 561,
"preview": "#ifndef SPECTROGRAM_H\n#define SPECTROGRAM_H\n\n#include \"ext/qcustomplot.h\"\n#include \"VoxCommon.hpp\"\n\nclass Spectrogram : "
},
{
"path": "stdres.qrc",
"chars": 425,
"preview": "<RCC>\n <qresource prefix=\"/\">\n <file>res/stdico.png</file>\n <file>res/phoneticdico.png</file>\n <"
},
{
"path": "tacotron2.cpp",
"chars": 3740,
"preview": "#include \"tacotron2.h\"\n\n\n\nTFTensor<float> Tacotron2::DoInferenceTFTTS(const std::vector<int32_t> &InputIDs, int32_t Spea"
},
{
"path": "tacotron2.h",
"chars": 944,
"preview": "#ifndef TACOTRON2_H\n#define TACOTRON2_H\n\n#include \"melgen.h\"\n\nclass Tacotron2 : public MelGen\n{\nprivate:\n\n TFTensor<f"
},
{
"path": "tacotron2torch.cpp",
"chars": 1701,
"preview": "#include \"tacotron2torch.h\"\n\nTacotron2Torch::Tacotron2Torch()\n{\n\n}\n\nbool Tacotron2Torch::Initialize(const std::string &S"
},
{
"path": "tacotron2torch.h",
"chars": 1045,
"preview": "#ifndef TACOTRON2TORCH_H\n#define TACOTRON2TORCH_H\n#include \"melgen.h\"\n\nclass Tacotron2Torch : public MelGen\n{\nprivate:\n "
},
{
"path": "tfg2p.cpp",
"chars": 1349,
"preview": "#include \"tfg2p.h\"\nTFG2P::TFG2P()\n{\n G2P = nullptr;\n\n}\n\nTFG2P::TFG2P(const std::string &SavedModelFolder)\n{\n G2P ="
},
{
"path": "tfg2p.h",
"chars": 815,
"preview": "#ifndef TFG2P_H\n#define TFG2P_H\n\n#include \"VoxCommon.hpp\"\n\n\nclass TFG2P\n{\nprivate:\n cppflow::model* G2P;\n\npublic:\n "
},
{
"path": "torchmoji.cpp",
"chars": 1665,
"preview": "#include \"torchmoji.h\"\n#include \"ext/ZCharScanner.h\"\n\nvoid TorchMoji::LoadDict(const std::string& Path)\n{\n if (Diction"
},
{
"path": "torchmoji.h",
"chars": 963,
"preview": "#ifndef TORCHMOJI_H\n#define TORCHMOJI_H\n#include \"VoxCommon.hpp\"\n\n\n// TorchMoji: Emotion contextualizer model (Cookie de"
},
{
"path": "track.cpp",
"chars": 4871,
"preview": "#include \"track.h\"\n\n#include <QAudioDecoder>\n\nTrack::Track(QWidget *parent)\n : QCustomPlot(parent)\n , decoder(new "
},
{
"path": "track.h",
"chars": 921,
"preview": "#ifndef TRACK_H\n#define TRACK_H\n#include \"ext/qcustomplot.h\"\n#include <QAudioBuffer>\n\n\n// Copied from https://stackoverf"
},
{
"path": "vits.cpp",
"chars": 2860,
"preview": "#include \"vits.h\"\n\nstd::vector<int64_t> VITS::ZeroPadVec(const std::vector<int32_t> &InIDs)\n{\n std::vector<int64_t> N"
},
{
"path": "vits.h",
"chars": 1241,
"preview": "#ifndef VITS_H\n#define VITS_H\n\n\n#include \"melgen.h\"\n\n\n\n\n\n// VITS is a fully E2E model; no separate vocoder needed\nclass "
},
{
"path": "voicemanager.cpp",
"chars": 2975,
"preview": "#include \"voicemanager.h\"\n#define SAFE_DELETE(pdel)if (pdel){delete pdel;}\n#include <QCoreApplication>\n\nPhonemizer* Voic"
},
{
"path": "voicemanager.h",
"chars": 962,
"preview": "#ifndef VOICEMANAGER_H\n#define VOICEMANAGER_H\n#include \"Voice.h\"\n#include <QString>\n#include \"phoneticdict.h\"\n#include \""
},
{
"path": "voxer.cpp",
"chars": 4617,
"preview": "#include \"voxer.h\"\nusing namespace std::chrono;\n#include \"r8b/r8bsrc.h\"\n\nfloat remap(float OldValue, float OldMin, float"
},
{
"path": "voxer.h",
"chars": 1066,
"preview": "#ifndef VOXER_H\n#define VOXER_H\n\n#include \"Voice.h\"\n#include <QThread>\n\n#include <QListWidgetItem>\n#include <chrono>\n#in"
}
]
About this extraction
This page contains the full source code of the ZDisket/TensorVox GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 116 files (3.8 MB), approximately 1.0M tokens, and a symbol index with 1842 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.