Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
plugin-GUI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
yehaojie
plugin-GUI
Commits
14a86cde
Commit
14a86cde
authored
10 years ago
by
jsiegle
Browse files
Options
Downloads
Patches
Plain Diff
Fix problem with MidiBuffer code
parent
5390df8c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
JuceLibraryCode/modules/juce_audio_basics/midi/juce_MidiBuffer.cpp
+7
-27
7 additions, 27 deletions
...ryCode/modules/juce_audio_basics/midi/juce_MidiBuffer.cpp
with
7 additions
and
27 deletions
JuceLibraryCode/modules/juce_audio_basics/midi/juce_MidiBuffer.cpp
+
7
−
27
View file @
14a86cde
...
...
@@ -119,37 +119,17 @@ void MidiBuffer::addEvent (const void* const newData, const int maxBytes, const
if
(
numBytes
>
0
)
{
int
spaceNeeded
=
bytesUsed
+
numBytes
+
sizeof
(
int
)
+
sizeof
(
uint16
);
// factor in timestamp and size indicator
data
.
ensureSize
((
spaceNeeded
+
spaceNeeded
/
2
+
8
)
&
~
7
);
// make sure there's enough size in the MemoryBlock
uint8
*
d
=
getData
()
+
bytesUsed
;
const
size_t
newItemSize
=
(
size_t
)
numBytes
+
sizeof
(
int32
)
+
sizeof
(
uint16
);
// factor in timestamp and size indicator
const
int
offset
=
(
int
)
(
MidiBufferHelpers
::
findEventAfter
(
data
.
begin
(),
data
.
end
(),
sampleNumber
)
-
data
.
begin
());
*
reinterpret_cast
<
int
*>
(
d
)
=
sampleNumber
;
d
+=
sizeof
(
int
);
*
reinterpret_cast
<
uint16
*>
(
d
)
=
(
uint16
)
numBytes
;
d
+=
sizeof
(
uint16
);
data
.
insertMultiple
(
offset
,
0
,
(
int
)
newItemSize
);
memcpy
(
d
,
newData
,
numBytes
);
bytesUsed
+=
numBytes
+
sizeof
(
int
)
+
sizeof
(
uint16
);
uint8
*
const
d
=
data
.
begin
()
+
offset
;
*
reinterpret_cast
<
int32
*>
(
d
)
=
sampleNumber
;
*
reinterpret_cast
<
uint16
*>
(
d
+
4
)
=
(
uint16
)
numBytes
;
memcpy
(
d
+
6
,
newData
,
(
size_t
)
numBytes
);
}
// Original JUCE library code:
//
// const int numBytes = MidiBufferHelpers::findActualEventLength (static_cast<const uint8*> (newData), maxBytes);
// if (numBytes > 0)
// {
// const size_t newItemSize = (size_t) numBytes + sizeof (int32) + sizeof (uint16);
// const int offset = (int) (MidiBufferHelpers::findEventAfter (data.begin(), data.end(), sampleNumber) - data.begin());
// data.insertMultiple (offset, 0, (int) newItemSize);
// uint8* const d = data.begin() + offset;
// *reinterpret_cast<int32*> (d) = sampleNumber;
// *reinterpret_cast<uint16*> (d + 4) = (uint16) numBytes;
// memcpy (d + 6, newData, (size_t) numBytes);
// }
}
void
MidiBuffer
::
addEvents
(
const
MidiBuffer
&
otherBuffer
,
...
...
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