Skip to content
Snippets Groups Projects
Commit 7948570e authored by Florent Berthaut's avatar Florent Berthaut
Browse files

Fix memnew issues in addon

parent dd98a6f4
No related branches found
No related tags found
No related merge requests found
......@@ -80,29 +80,44 @@ For a full working example, open the Godot project in the demo folder.
- Install the following packages :
- scons
- Open a terminal and type the following commands :
- git clone https://gitlab.univ-lille.fr/ivmi/gdpd.git
- cd gdpd
- git submodule update --init --recursive
- scons
```sh
git clone https://gitlab.univ-lille.fr/ivmi/gdpd.git
cd gdpd
git submodule update --init --recursive
scons
```
## Cross-compiling for Windows on GNU/Linux
- Install the following packages :
- mingw-64
- Type the following commands :
- git clone https://gitlab.univ-lille.fr/ivmi/gdpd.git
- cd gdpd
- git submodule update --init --recursive
- scons platform=windows
```sh
git clone https://gitlab.univ-lille.fr/ivmi/gdpd.git
cd gdpd
git submodule update --init --recursive
scons platform=windows
```
## Compiling for Mac OSX
todo
## Compiling for Android (/Quest)
## Compiling for Android (/Quest) on GNU/Linux
- Define the ANDROID_HOME environment variable that contains the android ndk
folder
- Install the following packages :
- scons
- Open a terminal and type :
```sh
git clone https://gitlab.univ-lille.fr/ivmi/gdpd.git
cd gdpd
git submodule update --init --recursive
scons platform=android
```
......
......@@ -16,13 +16,23 @@ func _process(delta):
print(\"got message from pd \", msg)
pass
func _load_patch(pd_patch) :
func _load_patch(pd_patch : String) :
var fullpath = \"\"
if OS.has_feature(\"editor\"):
fullpath = ProjectSettings.globalize_path(pd_patch)
else:
fullpath = OS.get_executable_path().get_base_dir().path_join(pd_patch.lstrip(\"res://\"))
#fullpath = pd_patch
#print(DirAccess.get_files_at(\"res://\"))
print(fullpath)
# separate file name from directory
var patch_name = pd_patch.split(\"/\")[-1]
var patch_dir = pd_patch.trim_suffix(patch_name)
var patch_name = fullpath.split(\"/\")[-1]
var patch_dir = fullpath.trim_suffix(patch_name)
# load patch
_gdpd.openfile(patch_name, patch_dir)
_gdpd.openfile(patch_name, \"./\")
func _on_Start_pressed() :
# retrieve the list of available input and outputs
......@@ -33,8 +43,8 @@ func _on_Start_pressed() :
_gdpd.init_devices(inps[0], outs[0])
# the patch path should be absolute
_load_patch(ProjectSettings.globalize_path(\"res://patch1.pd\"))
_load_patch(ProjectSettings.globalize_path(\"res://patch2.pd\"))
_load_patch(\"res://patch1.pd\")
_load_patch(\"res://patch2.pd\")
# send message to [receive from_godot] with one symbol
_gdpd.start_message(1)
......@@ -50,8 +60,8 @@ func _on_start_non_rt_pressed():
_gdpd.init_nort()
# the patch path should be absolute
_load_patch(ProjectSettings.globalize_path(\"res://patch1.pd\"))
_load_patch(ProjectSettings.globalize_path(\"res://patch2.pd\"))
_load_patch(\"res://patch1.pd\")
_load_patch(\"res://patch2.pd\")
# send message to [receive from_godot] with one symbol
_gdpd.start_message(1)
......@@ -80,8 +90,6 @@ func _on_HSlider2_value_changed(value):
_gdpd.add_symbol(\"pitch\")
_gdpd.add_float(value)
_gdpd.finish_list(\"from_godot\")
"
[node name="Control" type="Control"]
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -12,12 +12,13 @@ config_version=5
config/name="GdPd"
run/main_scene="res://Main.tscn"
config/features=PackedStringArray("4.2")
config/features=PackedStringArray("4.3")
run/low_processor_mode=true
config/icon="res://icon.png"
[rendering]
textures/vram_compression/import_etc2_astc=true
environment/defaults/default_environment="res://default_env.tres"
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
......@@ -158,11 +158,10 @@ int GdPd::init_nort() {
m_init=true;
// Create stream player
AudioStreamPlayer* p = new AudioStreamPlayer();
AudioStreamPlayer* p = memnew(AudioStreamPlayer());
add_child(p);
Ref<GdPdStream> s;
s.instantiate();
Ref<GdPdStream> s = memnew(GdPdStream());
s->setGdPd(this);
p->set_stream(s);
......@@ -360,8 +359,8 @@ GdPdStream::GdPdStream() {
}
Ref<AudioStreamPlayback> GdPdStream::_instantiate_playback() const {
Ref<GdPdStreamPlayback> gdPlayback;
gdPlayback.instantiate();
Ref<GdPdStreamPlayback> gdPlayback = memnew(GdPdStreamPlayback());
//gdPlayback.instantiate();
gdPlayback->m_base = Ref<GdPdStream>(this);
return gdPlayback;
}
......@@ -392,6 +391,6 @@ int32_t GdPdStreamPlayback::_mix_resampled(AudioFrame *buffer,
return nbFrames;
}
double GdPdStreamPlayback::_get_stream_sampling_rate() const {
float GdPdStreamPlayback::_get_stream_sampling_rate() const {
return AudioServer::get_singleton()->get_mix_rate();
}
......@@ -158,7 +158,7 @@ public:
~GdPdStreamPlayback();
int32_t _mix_resampled(AudioFrame *dst_buffer, int32_t frame_count) override;
double _get_stream_sampling_rate() const override;
float _get_stream_sampling_rate() const override;
bool _is_playing() const override {return active;}
void _start(double from_pos) override {active=true;}
......
Subproject commit 98c143a48365f3f3bf5f99d6289a2cb25e6472d1
Subproject commit 1cce4d15abc3afb22724f9bf083ed7769330b43e
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment