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
663151f8
Commit
663151f8
authored
1 year ago
by
Florent Berthaut
Browse files
Options
Downloads
Patches
Plain Diff
Added missing files
parent
b65e5dd0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/gdpd.h
+109
-0
109 additions, 0 deletions
src/gdpd.h
src/register_types.cpp
+37
-0
37 additions, 0 deletions
src/register_types.cpp
src/register_types.h
+11
-0
11 additions, 0 deletions
src/register_types.h
with
157 additions
and
0 deletions
src/gdpd.h
0 → 100644
+
109
−
0
View file @
663151f8
/***************************************************************************
* gd4pd.h
* Part of GdPd
* 2023- see README for AUTHORS
****************************************************************************/
/*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 130, Boston, MA 02111-1307, USA.
*/
#ifndef GDPD_CLASS_H
#define GDPD_CLASS_H
#ifdef WIN32
#include
<windows.h>
#endif
#include
<godot_cpp/classes/node3d.hpp>
#include
<godot_cpp/classes/global_constants.hpp>
#include
<godot_cpp/classes/viewport.hpp>
#include
<godot_cpp/core/binder_common.hpp>
#include
<godot_cpp/classes/engine.hpp>
#include
<godot_cpp/classes/audio_stream_player.hpp>
#include
"PdBase.hpp"
#include
"RtAudio.h"
using
namespace
godot
;
class
GdPd
:
public
AudioStreamPlayer
,
public
pd
::
PdReceiver
{
GDCLASS
(
GdPd
,
AudioStreamPlayer
);
protected:
static
void
_bind_methods
();
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:
GdPd
();
virtual
~
GdPd
();
//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/register_types.cpp
0 → 100644
+
37
−
0
View file @
663151f8
#include
"register_types.h"
#include
<gdextension_interface.h>
#include
<godot_cpp/core/class_db.hpp>
#include
<godot_cpp/core/defs.hpp>
#include
<godot_cpp/godot.hpp>
#include
"gdpd.h"
using
namespace
godot
;
void
initialize_gdpd_module
(
ModuleInitializationLevel
p_level
)
{
if
(
p_level
!=
MODULE_INITIALIZATION_LEVEL_SCENE
)
{
return
;
}
ClassDB
::
register_class
<
GdPd
>
();
}
void
uninitialize_gdpd_module
(
ModuleInitializationLevel
p_level
)
{
if
(
p_level
!=
MODULE_INITIALIZATION_LEVEL_SCENE
)
{
return
;
}
}
extern
"C"
{
// Initialization.
GDExtensionBool
GDE_EXPORT
gdpd_library_init
(
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_gdpd_module
);
init_obj
.
register_terminator
(
uninitialize_gdpd_module
);
init_obj
.
set_minimum_library_initialization_level
(
MODULE_INITIALIZATION_LEVEL_SCENE
);
return
init_obj
.
init
();
}
}
This diff is collapsed.
Click to expand it.
src/register_types.h
0 → 100644
+
11
−
0
View file @
663151f8
#ifndef GD4PD_REGISTER_TYPES_H
#define GD4PD_REGISTER_TYPES_H
#include
<godot_cpp/core/class_db.hpp>
using
namespace
godot
;
void
initialize_gdpd_module
(
ModuleInitializationLevel
p_level
);
void
uninitialize_gdpd_module
(
ModuleInitializationLevel
p_level
);
#endif
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