Skip to content

Commit

Permalink
small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ughuuu committed Nov 19, 2023
1 parent ab0f577 commit ef1e7a7
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 139 deletions.
27 changes: 26 additions & 1 deletion SCsub → SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
Import("env")
#!/usr/bin/env python
import os
import sys

env = SConscript("thirdparty/godot-cpp/SConstruct")

module_env = env.Clone()

Expand Down Expand Up @@ -51,3 +55,24 @@ env_thirdparty.add_source_files(env.modules_sources, Glob("thirdparty/whisper.cp
env_thirdparty.Append(CPPPATH=['thirdparty/whisper.cpp'])
env_thirdparty.Append(CPPDEFINES=['WHISPER_SHARED', 'GGML_SHARED'])
module_env.add_source_files(env.modules_sources, "*.cpp")

# For the reference:
# - CCFLAGS are compilation flags shared between C and C++
# tweak this if you want to use different folders, or more folders, to store your source code in.
env.Append(CPPPATH=["src/"])
sources = [Glob("src/*.cpp")]
sources.extend([box2d_folder + 'src/' + box2d_src_file for box2d_src_file in box2d_src])

if env["platform"] == "macos":
library = env.SharedLibrary(
"bin/addons/godot-box2d/bin/libgodot-box2d.{}.{}.framework/libgodot-box2d.{}.{}".format(
env["platform"], env["target"], env["platform"], env["target"]
),
source=sources,
)
else:
library = env.SharedLibrary(
"bin/addons/godot-box2d/bin/libgodot-box2d{}{}".format(env["suffix"], env["SHLIBSUFFIX"]),
source=sources,
)
Default(library)
Empty file.
1 change: 1 addition & 0 deletions bin/addons/v-sekai.whisper/v-sekai.whisper.gdextension
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

entry_symbol = "TODO"
compatibility_minimum = 4.1
reloadable = true

[libraries]

Expand Down
36 changes: 0 additions & 36 deletions register_types.h

This file was deleted.

16 changes: 15 additions & 1 deletion register_types.cpp → src/register_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

#include "register_types.h"

#include "core/object/class_db.h"
#include "speech.h"

#include "speech_processor.h"
Expand All @@ -49,3 +48,18 @@ void uninitialize_whisper_module(ModuleInitializationLevel p_level) {
return;
}
}

extern "C" {

// Initialization.

GDExtensionBool GDE_EXPORT vsekai_whisper_library_init(const GDExtensionInterfaceGetProcAddress p_get_proc_address, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) {
godot::GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization);

init_obj.register_initializer(initialize_whisper_module);
init_obj.register_terminator(uninitialize_whisper_module);
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE);

return init_obj.init();
}
}
12 changes: 12 additions & 0 deletions src/register_types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef REGISTER_TYPES_H
#define REGISTER_TYPES_H

#include <godot_cpp/core/class_db.hpp>

using namespace godot;


void initialize_whisper_module(ModuleInitializationLevel p_level);
void uninitialize_whisper_module(ModuleInitializationLevel p_level);

#endif // REGISTER_TYPES_H
30 changes: 0 additions & 30 deletions speech.cpp → src/speech.cpp
Original file line number Diff line number Diff line change
@@ -1,33 +1,3 @@
/**************************************************************************/
/* speech.cpp */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* 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. */
/**************************************************************************/

#include "core/error/error_macros.h"
#include "core/string/print_string.h"
#include "core/variant/variant.h"
Expand Down
30 changes: 0 additions & 30 deletions speech.h → src/speech.h
Original file line number Diff line number Diff line change
@@ -1,33 +1,3 @@
/**************************************************************************/
/* speech.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* 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. */
/**************************************************************************/

#ifndef SPEECH_H
#define SPEECH_H

Expand Down
File renamed without changes.
52 changes: 11 additions & 41 deletions speech_processor.h → src/speech_processor.h
Original file line number Diff line number Diff line change
@@ -1,47 +1,17 @@
/**************************************************************************/
/* speech_processor.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* 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. */
/**************************************************************************/

#ifndef SPEECH_PROCESSOR_H
#define SPEECH_PROCESSOR_H

#include "scene/main/node.h"

#include "core/config/engine.h"
#include "core/config/project_settings.h"
#include "core/object/class_db.h"
#include "core/object/ref_counted.h"
#include "core/os/mutex.h"
#include "scene/audio/audio_stream_player.h"
#include "servers/audio/audio_stream.h"
#include "servers/audio/effects/audio_effect_capture.h"
#include "servers/audio_server.h"
#include <godot_cpp/classes/node.hpp>

#include <godot_cpp/classes/engine.hpp>
#include <godot_cpp/classes/project_settings.hpp>
#include <godot_cpp/core/class_db.hpp>
#include <godot_cpp/classes/ref_counted.hpp>
#include <godot_cpp/classes/mutex.hpp>
#include <godot_cpp/classes/audio_stream_player.hpp>
#include <godot_cpp/classes/audio_stream.hpp>
#include <godot_cpp/classes/audio_effect_capture.hpp>
#include <godot_cpp/classes/audio_server.hpp>

#include <stdlib.h>
#include <functional>
Expand Down

0 comments on commit ef1e7a7

Please sign in to comment.