Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Gdpd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IVMI
Gdpd
Commits
51164ed1
Commit
51164ed1
authored
1 year ago
by
Florent Berthaut
Browse files
Options
Downloads
Patches
Plain Diff
Fix fiddle fsqrt issue
parent
5351f61c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
SConstruct
+3
-4
3 additions, 4 deletions
SConstruct
demo/Main.tscn
+9
-8
9 additions, 8 deletions
demo/Main.tscn
demo/project.godot
+1
-1
1 addition, 1 deletion
demo/project.godot
src/gdpd.hpp
+0
-87
0 additions, 87 deletions
src/gdpd.hpp
src/rtaudio/RtAudio.os
+0
-0
0 additions, 0 deletions
src/rtaudio/RtAudio.os
with
13 additions
and
100 deletions
SConstruct
+
3
−
4
View file @
51164ed1
...
...
@@ -10,10 +10,9 @@ fiddle_lines = fiddle_file.readlines()
fiddle_file
.
close
()
out_lines
=
[]
for
l
in
fiddle_lines
:
if
l
==
"
#define fsqrt sqrt
\n
"
:
out_lines
.
append
(
"
//#define fsqrt sqrt
\n
"
)
else
:
out_lines
.
append
(
l
)
if
l
==
"
#define flog log
\n
"
:
out_lines
.
append
(
"
#include <math.h>
\n
"
)
out_lines
.
append
(
l
)
fiddle_file
=
open
(
"
src/libpd/pure-data/extra/fiddle~/fiddle~.c
"
,
"
w
"
)
fiddle_file
.
writelines
(
out_lines
)
fiddle_file
.
close
()
...
...
This diff is collapsed.
Click to expand it.
demo/Main.tscn
+
9
−
8
View file @
51164ed1
...
...
@@ -9,37 +9,38 @@ func _ready():
pass
func _process(delta):
# Get messages from the patch
while _gdpd.has_message() :
var msg = _gdpd.get_next()
print(\"got message from pd \", msg)
pass
func _load_patch(pd_patch) :
#separate file name from directory
#
separate file name from directory
var patch_name = pd_patch.split(\"/\")[-1]
var patch_dir = pd_patch.trim_suffix(patch_name)
#load patch
#
load patch
_gdpd.openfile(patch_name, patch_dir)
func _on_Start_pressed() :
#retrieve the list of available input and outputs
#
retrieve the list of available input and outputs
var inps = _gdpd.get_available_input_devices()
var outs = _gdpd.get_available_output_devices()
#initialise the first ones
#
initialise the first ones
_gdpd.init_devices(inps[0], outs[0])
#the patch path should be
the
absolute
one
#
the patch path should be absolute
_load_patch(ProjectSettings.globalize_path(\"res://patch1.pd\"))
_load_patch(ProjectSettings.globalize_path(\"res://patch2.pd\"))
#send message to [receive from_godot] with one symbol
#
send message to [receive from_godot] with one symbol
_gdpd.start_message(1)
_gdpd.add_symbol(\"hello\")
_gdpd.finish_list(\"from_godot\")
#listen to messages sent with [send to_godot]
#
listen to messages sent with [send to_godot]
_gdpd.subscribe(\"to_godot\")
func _on_Stop_pressed():
...
...
@@ -48,7 +49,7 @@ func _on_Stop_pressed():
_gdpd.stop()
func _on_HSlider_value_changed(value):
#send message to [receive from_godot] with three elements
#
send message to [receive from_godot] with three elements
_gdpd.start_message(3)
_gdpd.add_symbol(\"patch1\")
_gdpd.add_symbol(\"pitch\")
...
...
This diff is collapsed.
Click to expand it.
demo/project.godot
+
1
−
1
View file @
51164ed1
...
...
@@ -12,7 +12,7 @@ config_version=5
config/name="GdPd"
run/main_scene="res://Main.tscn"
config/features=PackedStringArray("4.
1
")
config/features=PackedStringArray("4.
2
")
run/low_processor_mode=true
config/icon="res://icon.png"
...
...
This diff is collapsed.
Click to expand it.
src/gdpd.hpp
deleted
100644 → 0
+
0
−
87
View file @
5351f61c
#ifndef GDPD_H
#define GDPD_H
#include
<stdio.h>
#include
<stdlib.h>
#include
<string.h>
#include
<map>
#include
<algorithm>
#include
<Godot.hpp>
#include
<AudioStreamPlayer.hpp>
#include
"PdBase.hpp"
#include
"PdReceiver.hpp"
#include
"RtAudio.h"
namespace
godot
{
class
Gdpd
:
public
godot
::
AudioStreamPlayer
,
public
pd
::
PdReceiver
{
GODOT_CLASS
(
Gdpd
,
AudioStreamPlayer
)
private:
float
*
m_inBuf
;
float
*
m_outBuf
;
Array
*
m_messages
;
pd
::
PdBase
m_pd
;
pd
::
Patch
m_patch
;
RtAudio
m_audio
;
unsigned
int
m_bufferFrames
;
float
m_vol
;
int
m_nbInputs
;
int
m_nbOutputs
;
int
m_sampleRate
;
int
m_inputDevice
;
int
m_outputDevice
;
std
::
map
<
std
::
string
,
pd
::
Patch
>
m_patchsMap
;
bool
m_init
;
public:
static
void
_register_methods
();
Gdpd
();
~
Gdpd
();
void
_init
();
//libpd functions
Array
get_available_input_devices
();
Array
get_available_output_devices
();
int
init_devices
(
String
inputDevice
,
String
outputDevice
);
int
init
(
int
nbInputs
,
int
nbOutputs
,
int
sampleRate
,
int
bufferSize
);
int
start
();
void
stop
();
void
openfile
(
String
basename
,
String
dirname
);
void
closefile
(
String
basename
);
bool
has_message
();
Array
get_next
();
int
blocksize
();
void
subscribe
(
String
symbStr
);
int
start_message
(
int
nbValues
);
void
add_symbol
(
String
symbStr
);
void
add_float
(
float
val
);
int
finish_list
(
String
destStr
);
//libpd hooks
virtual
void
print
(
const
std
::
string
&
message
);
void
receiveList
(
const
std
::
string
&
dest
,
const
pd
::
List
&
list
);
//godot functions
void
set_volume
(
float
vol
);
inline
const
float
&
get_volume
(){
return
m_vol
;}
//rtaudio
static
int
audioCallback
(
void
*
outputBuffer
,
void
*
inputBuffer
,
unsigned
int
nBufferFrames
,
double
streamTime
,
RtAudioStreamStatus
status
,
void
*
userData
);
void
processAudio
(
void
*
outputBuffer
,
void
*
inputBuffer
,
unsigned
int
nBufferFrames
,
double
streamTime
,
RtAudioStreamStatus
status
,
void
*
userData
);
};
}
#endif
This diff is collapsed.
Click to expand it.
src/rtaudio/RtAudio.os
+
0
−
0
View file @
51164ed1
No preview for this file type
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment