midisurface: add a vector constructor for MidByteArry
plus a few minor code tweaks
This commit is contained in:
parent
7e0315bc5e
commit
599998bd1f
@ -26,11 +26,15 @@
|
|||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
|
MidiByteArray::MidiByteArray (std::vector<MIDI::byte> const & v)
|
||||||
|
{
|
||||||
|
insert (end(), v.begin(), v.end());
|
||||||
|
}
|
||||||
|
|
||||||
MidiByteArray::MidiByteArray (size_t size, MIDI::byte array[])
|
MidiByteArray::MidiByteArray (size_t size, MIDI::byte array[])
|
||||||
: std::vector<MIDI::byte>()
|
: std::vector<MIDI::byte>()
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < size; ++i)
|
for (size_t i = 0; i < size; ++i) {
|
||||||
{
|
|
||||||
push_back (array[i]);
|
push_back (array[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -41,8 +45,7 @@ MidiByteArray::MidiByteArray (size_t count, MIDI::byte first, ...)
|
|||||||
push_back (first);
|
push_back (first);
|
||||||
va_list var_args;
|
va_list var_args;
|
||||||
va_start (var_args, first);
|
va_start (var_args, first);
|
||||||
for (size_t i = 1; i < count; ++i)
|
for (size_t i = 1; i < count; ++i) {
|
||||||
{
|
|
||||||
MIDI::byte b = va_arg (var_args, int);
|
MIDI::byte b = va_arg (var_args, int);
|
||||||
push_back (b);
|
push_back (b);
|
||||||
}
|
}
|
||||||
@ -110,4 +113,3 @@ MidiByteArray::compare_n (const MidiByteArray& other, MidiByteArray::size_type n
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,9 +48,11 @@ namespace MIDI {
|
|||||||
class MidiByteArray : public std::vector<MIDI::byte>
|
class MidiByteArray : public std::vector<MIDI::byte>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MidiByteArray() : std::vector<MIDI::byte>() {}
|
MidiByteArray () : std::vector<MIDI::byte>() {};
|
||||||
|
|
||||||
MidiByteArray( size_t count, MIDI::byte array[] );
|
MidiByteArray (std::vector<MIDI::byte> const & vec);
|
||||||
|
|
||||||
|
MidiByteArray (size_t count, MIDI::byte array[]);
|
||||||
|
|
||||||
bool compare_n (const MidiByteArray& other, MidiByteArray::size_type len) const;
|
bool compare_n (const MidiByteArray& other, MidiByteArray::size_type len) const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user