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
addab6e9
Commit
addab6e9
authored
5 years ago
by
BERTHAUT Florent
Browse files
Options
Downloads
Patches
Plain Diff
Fixed volume control
parent
32fd85b9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/gdpd.cpp
+17
-7
17 additions, 7 deletions
src/gdpd.cpp
src/gdpd.hpp
+8
-1
8 additions, 1 deletion
src/gdpd.hpp
with
25 additions
and
8 deletions
src/gdpd.cpp
+
17
−
7
View file @
addab6e9
...
@@ -17,11 +17,8 @@ void Gdpd::_register_methods() {
...
@@ -17,11 +17,8 @@ void Gdpd::_register_methods() {
int
Gdpd
::
audioCallback
(
void
*
outputBuffer
,
void
*
inputBuffer
,
unsigned
int
nBufferFrames
,
double
streamTime
,
RtAudioStreamStatus
status
,
void
*
userData
){
int
Gdpd
::
audioCallback
(
void
*
outputBuffer
,
void
*
inputBuffer
,
unsigned
int
nBufferFrames
,
double
streamTime
,
RtAudioStreamStatus
status
,
void
*
userData
){
Gdpd
*
gdpd
=
static_cast
<
Gdpd
*>
(
userData
);
Gdpd
*
gdpd
=
static_cast
<
Gdpd
*>
(
userData
);
int
ticks
=
nBufferFrames
/
64
;
gdpd
->
processAudio
(
outputBuffer
,
inputBuffer
,
nBufferFrames
,
streamTime
,
gdpd
->
m_pd
.
processFloat
(
ticks
,
(
float
*
)
inputBuffer
,
(
float
*
)
outputBuffer
);
status
,
userData
);
for
(
int
b
=
0
;
b
<
nBufferFrames
;
++
b
)
{
((
float
*
)
outputBuffer
)[
b
]
*=
gdpd
->
get_volume
();
}
return
0
;
return
0
;
}
}
...
@@ -63,8 +60,8 @@ int Gdpd::init(int nbInputs, int nbOutputs, int sampleRate) {
...
@@ -63,8 +60,8 @@ int Gdpd::init(int nbInputs, int nbOutputs, int sampleRate) {
unsigned
int
sr
=
m_audio
.
getDeviceInfo
(
outParams
.
deviceId
).
preferredSampleRate
;
unsigned
int
sr
=
m_audio
.
getDeviceInfo
(
outParams
.
deviceId
).
preferredSampleRate
;
outParams
.
deviceId
=
m_audio
.
getDefaultOutputDevice
();
outParams
.
deviceId
=
m_audio
.
getDefaultOutputDevice
();
inParams
.
deviceId
=
m_audio
.
getDefaultOutputDevice
();
inParams
.
deviceId
=
m_audio
.
getDefaultOutputDevice
();
outParams
.
nChannels
=
nbInputs
;
outParams
.
nChannels
=
m_nbInputs
=
nbInputs
;
inParams
.
nChannels
=
nbOutputs
;
inParams
.
nChannels
=
m_nbOutputs
=
nbOutputs
;
m_bufferFrames
=
128
;
m_bufferFrames
=
128
;
RtAudio
::
StreamOptions
options
;
RtAudio
::
StreamOptions
options
;
...
@@ -89,6 +86,19 @@ int Gdpd::init(int nbInputs, int nbOutputs, int sampleRate) {
...
@@ -89,6 +86,19 @@ int Gdpd::init(int nbInputs, int nbOutputs, int sampleRate) {
return
0
;
return
0
;
}
}
void
Gdpd
::
processAudio
(
void
*
outputBuffer
,
void
*
inputBuffer
,
unsigned
int
nBufferFrames
,
double
streamTime
,
RtAudioStreamStatus
status
,
void
*
userData
)
{
int
ticks
=
nBufferFrames
/
libpd_blocksize
();
m_pd
.
processFloat
(
ticks
,
(
float
*
)
inputBuffer
,
(
float
*
)
outputBuffer
);
//volume control on the output
for
(
int
b
=
0
;
b
<
nBufferFrames
*
m_nbOutputs
;
++
b
)
{
((
float
*
)
outputBuffer
)[
b
]
*=
m_vol
;
}
}
void
Gdpd
::
openfile
(
godot
::
String
baseStr
,
godot
::
String
dirStr
)
{
void
Gdpd
::
openfile
(
godot
::
String
baseStr
,
godot
::
String
dirStr
)
{
std
::
wstring
baseWs
=
baseStr
.
unicode_str
();
std
::
wstring
baseWs
=
baseStr
.
unicode_str
();
std
::
string
baseS
(
baseWs
.
begin
(),
baseWs
.
end
());
std
::
string
baseS
(
baseWs
.
begin
(),
baseWs
.
end
());
...
...
This diff is collapsed.
Click to expand it.
src/gdpd.hpp
+
8
−
1
View file @
addab6e9
...
@@ -26,6 +26,8 @@ private:
...
@@ -26,6 +26,8 @@ private:
RtAudio
m_audio
;
RtAudio
m_audio
;
unsigned
int
m_bufferFrames
;
unsigned
int
m_bufferFrames
;
float
m_vol
;
float
m_vol
;
int
m_nbInputs
;
int
m_nbOutputs
;
public:
public:
static
void
_register_methods
();
static
void
_register_methods
();
...
@@ -57,7 +59,12 @@ public:
...
@@ -57,7 +59,12 @@ public:
//rtaudio
//rtaudio
static
int
audioCallback
(
void
*
outputBuffer
,
void
*
inputBuffer
,
unsigned
int
nBufferFrames
,
double
streamTime
,
RtAudioStreamStatus
status
,
void
*
userData
);
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
);
};
};
...
...
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