Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Heisch, Benjamin
APAL
Commits
14bb05c6
Commit
14bb05c6
authored
Aug 04, 2020
by
Benjamin Heisch
Browse files
Added a copy constructor to Port, so buffers are copied successfull.
parent
a6303429
Changes
2
Hide whitespace changes
Inline
Side-by-side
test/XValidate/formats/lv2/LV2Module.hpp
View file @
14bb05c6
...
...
@@ -75,6 +75,7 @@ struct MidiEventBuffer {
struct
Port
{
private:
const
LV2Features
*
features
;
size_t
size_of_data
=
0
;
public:
const
LilvPort
*
lilvPort
=
nullptr
;
void
*
data
=
nullptr
;
...
...
@@ -84,16 +85,23 @@ public:
this
->
lilvPort
=
lilvPort
;
this
->
type
=
type
;
this
->
features
=
features
;
}
Port
(
const
Port
&
other
)
{
features
=
other
.
features
;
this
->
dir
=
other
.
dir
;
this
->
type
=
other
.
type
;
this
->
size_of_data
=
other
.
size_of_data
;
this
->
lilvPort
=
other
.
lilvPort
;
this
->
data
=
malloc
(
size_of_data
);
memcpy
(
this
->
data
,
other
.
data
,
this
->
size_of_data
);
}
inline
void
allocate
(
size_t
sample_count
)
{
if
(
this
->
data
!=
nullptr
)
this
->
free
();
switch
(
this
->
type
)
{
case
Midi
:
this
->
size_of_data
=
sizeof
(
MidiEventBuffer
);
this
->
data
=
new
MidiEventBuffer
;
memset
(
data
,
0
,
sizeof
(
MidiEventBuffer
));
((
MidiEventBuffer
*
)
this
->
data
)
->
seq
.
atom
.
type
=
features
->
uridmap
.
map
(
features
->
uridmap
.
handle
,
LV2_ATOM__Sequence
);
...
...
@@ -101,6 +109,7 @@ public:
// lv2_atom_sequence_clear(&((MidiEventBuffer*)this->data)->seq);
return
;
case
Audio
:
this
->
size_of_data
=
sizeof
(
float
)
*
sample_count
;
data
=
new
float
[
sample_count
];
return
;
}
...
...
test/XValidate/formats/lv2/LV2TestSuite.cpp
View file @
14bb05c6
...
...
@@ -152,7 +152,7 @@ public:
plug
.
instantiate
(
sampleRate
);
plug
.
allocateAndConnectPorts
(
512
);
plug
.
activate
();
for
(
auto
p
:
plug
.
ports
)
{
for
(
auto
&
p
:
plug
.
ports
)
{
if
(
p
.
type
==
PortType
::
Midi
&&
p
.
dir
==
Direction
::
Input
)
{
// uint8_t* x= { 0x1,0x2,0x3 };
p
.
addMidiMsg
(
0x1
,
0x2
,
0x3
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment