mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 19:56:31 +01:00
Remove pointless Byte typedef that didn't really match any other typedef in ardour anyway.
git-svn-id: svn://localhost/ardour2/branches/3.0@3409 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
4aa9d17ab1
commit
7ffed4e61c
8 changed files with 54 additions and 56 deletions
|
|
@ -39,9 +39,9 @@ public:
|
||||||
|
|
||||||
void copy(const MidiBuffer& copy);
|
void copy(const MidiBuffer& copy);
|
||||||
|
|
||||||
bool push_back(const MIDI::Event& event);
|
bool push_back(const MIDI::Event& event);
|
||||||
bool push_back(const jack_midi_event_t& event);
|
bool push_back(const jack_midi_event_t& event);
|
||||||
Byte* reserve(double time, size_t size);
|
uint8_t* reserve(double time, size_t size);
|
||||||
|
|
||||||
void resize(size_t);
|
void resize(size_t);
|
||||||
|
|
||||||
|
|
@ -93,7 +93,7 @@ private:
|
||||||
/* FIXME: this is utter crap. rewrite as a flat/packed buffer like MidiRingBuffer */
|
/* FIXME: this is utter crap. rewrite as a flat/packed buffer like MidiRingBuffer */
|
||||||
|
|
||||||
MIDI::Event* _events; ///< Event structs that point to offsets in _data
|
MIDI::Event* _events; ///< Event structs that point to offsets in _data
|
||||||
Byte* _data; ///< MIDI, straight up. No time stamps.
|
uint8_t* _data; ///< MIDI, straight up. No time stamps.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -243,19 +243,19 @@ MidiRingBufferBase<T>::write(size_t size, const T* src)
|
||||||
*
|
*
|
||||||
* [timestamp][size][size bytes of raw MIDI][timestamp][size][etc..]
|
* [timestamp][size][size bytes of raw MIDI][timestamp][size][etc..]
|
||||||
*/
|
*/
|
||||||
class MidiRingBuffer : public MidiRingBufferBase<Byte> {
|
class MidiRingBuffer : public MidiRingBufferBase<uint8_t> {
|
||||||
public:
|
public:
|
||||||
/** @param size Size in bytes.
|
/** @param size Size in bytes.
|
||||||
*/
|
*/
|
||||||
MidiRingBuffer(size_t size)
|
MidiRingBuffer(size_t size)
|
||||||
: MidiRingBufferBase<Byte>(size), _channel_mask(0x0000FFFF)
|
: MidiRingBufferBase<uint8_t>(size), _channel_mask(0x0000FFFF)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
size_t write(double time, size_t size, const Byte* buf);
|
size_t write(double time, size_t size, const uint8_t* buf);
|
||||||
bool read(double* time, size_t* size, Byte* buf);
|
bool read(double* time, size_t* size, uint8_t* buf);
|
||||||
|
|
||||||
bool read_prefix(double* time, size_t* size);
|
bool read_prefix(double* time, size_t* size);
|
||||||
bool read_contents(size_t size, Byte* buf);
|
bool read_contents(size_t size, uint8_t* buf);
|
||||||
|
|
||||||
size_t read(MidiBuffer& dst, nframes_t start, nframes_t end, nframes_t offset=0);
|
size_t read(MidiBuffer& dst, nframes_t start, nframes_t end, nframes_t offset=0);
|
||||||
|
|
||||||
|
|
@ -279,7 +279,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
inline bool is_channel_event(Byte event_type_byte) {
|
inline bool is_channel_event(uint8_t event_type_byte) {
|
||||||
// mask out channel information
|
// mask out channel information
|
||||||
event_type_byte &= 0xF0;
|
event_type_byte &= 0xF0;
|
||||||
// midi channel events range from 0x80 to 0xE0
|
// midi channel events range from 0x80 to 0xE0
|
||||||
|
|
@ -292,15 +292,15 @@ private:
|
||||||
|
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
MidiRingBuffer::read(double* time, size_t* size, Byte* buf)
|
MidiRingBuffer::read(double* time, size_t* size, uint8_t* buf)
|
||||||
{
|
{
|
||||||
bool success = MidiRingBufferBase<Byte>::full_read(sizeof(double), (Byte*)time);
|
bool success = MidiRingBufferBase<uint8_t>::full_read(sizeof(double), (uint8_t*)time);
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
success = MidiRingBufferBase<Byte>::full_read(sizeof(size_t), (Byte*)size);
|
success = MidiRingBufferBase<uint8_t>::full_read(sizeof(size_t), (uint8_t*)size);
|
||||||
}
|
}
|
||||||
if (success) {
|
if (success) {
|
||||||
success = MidiRingBufferBase<Byte>::full_read(*size, buf);
|
success = MidiRingBufferBase<uint8_t>::full_read(*size, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
|
|
@ -313,9 +313,9 @@ MidiRingBuffer::read(double* time, size_t* size, Byte* buf)
|
||||||
inline bool
|
inline bool
|
||||||
MidiRingBuffer::read_prefix(double* time, size_t* size)
|
MidiRingBuffer::read_prefix(double* time, size_t* size)
|
||||||
{
|
{
|
||||||
bool success = MidiRingBufferBase<Byte>::full_read(sizeof(double), (Byte*)time);
|
bool success = MidiRingBufferBase<uint8_t>::full_read(sizeof(double), (uint8_t*)time);
|
||||||
if (success) {
|
if (success) {
|
||||||
success = MidiRingBufferBase<Byte>::full_read(sizeof(size_t), (Byte*)size);
|
success = MidiRingBufferBase<uint8_t>::full_read(sizeof(size_t), (uint8_t*)size);
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
|
|
@ -326,14 +326,14 @@ MidiRingBuffer::read_prefix(double* time, size_t* size)
|
||||||
* by a call to read_prefix (or the returned even will be garabage).
|
* by a call to read_prefix (or the returned even will be garabage).
|
||||||
*/
|
*/
|
||||||
inline bool
|
inline bool
|
||||||
MidiRingBuffer::read_contents(size_t size, Byte* buf)
|
MidiRingBuffer::read_contents(size_t size, uint8_t* buf)
|
||||||
{
|
{
|
||||||
return MidiRingBufferBase<Byte>::full_read(size, buf);
|
return MidiRingBufferBase<uint8_t>::full_read(size, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline size_t
|
inline size_t
|
||||||
MidiRingBuffer::write(double time, size_t size, const Byte* buf)
|
MidiRingBuffer::write(double time, size_t size, const uint8_t* buf)
|
||||||
{
|
{
|
||||||
/*fprintf(stderr, "MRB %p write (t = %f) ", this, time);
|
/*fprintf(stderr, "MRB %p write (t = %f) ", this, time);
|
||||||
for (size_t i = 0; i < size; ++i)
|
for (size_t i = 0; i < size; ++i)
|
||||||
|
|
@ -344,7 +344,7 @@ MidiRingBuffer::write(double time, size_t size, const Byte* buf)
|
||||||
|
|
||||||
// Don't write event if it doesn't match channel filter
|
// Don't write event if it doesn't match channel filter
|
||||||
if (is_channel_event(buf[0]) && get_channel_mode() == FilterChannels) {
|
if (is_channel_event(buf[0]) && get_channel_mode() == FilterChannels) {
|
||||||
Byte channel = buf[0] & 0x0F;
|
uint8_t channel = buf[0] & 0x0F;
|
||||||
if ( !(get_channel_mask() & (1L << channel)) ) {
|
if ( !(get_channel_mask() & (1L << channel)) ) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -353,20 +353,20 @@ MidiRingBuffer::write(double time, size_t size, const Byte* buf)
|
||||||
if (write_space() < (sizeof(double) + sizeof(size_t) + size)) {
|
if (write_space() < (sizeof(double) + sizeof(size_t) + size)) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
MidiRingBufferBase<Byte>::write(sizeof(double), (Byte*)&time);
|
MidiRingBufferBase<uint8_t>::write(sizeof(double), (uint8_t*)&time);
|
||||||
MidiRingBufferBase<Byte>::write(sizeof(size_t), (Byte*)&size);
|
MidiRingBufferBase<uint8_t>::write(sizeof(size_t), (uint8_t*)&size);
|
||||||
if (is_channel_event(buf[0]) && get_channel_mode() == ForceChannel) {
|
if (is_channel_event(buf[0]) && get_channel_mode() == ForceChannel) {
|
||||||
assert(size == 2 || size == 3);
|
assert(size == 2 || size == 3);
|
||||||
Byte tmp_buf[3];
|
uint8_t tmp_buf[3];
|
||||||
// Force event to channel
|
// Force event to channel
|
||||||
tmp_buf[0] = (buf[0] & 0xF0) | (get_channel_mask() & 0x0F);
|
tmp_buf[0] = (buf[0] & 0xF0) | (get_channel_mask() & 0x0F);
|
||||||
tmp_buf[1] = buf[1];
|
tmp_buf[1] = buf[1];
|
||||||
if (size == 3) {
|
if (size == 3) {
|
||||||
tmp_buf[2] = buf[2];
|
tmp_buf[2] = buf[2];
|
||||||
}
|
}
|
||||||
MidiRingBufferBase<Byte>::write(size, tmp_buf);
|
MidiRingBufferBase<uint8_t>::write(size, tmp_buf);
|
||||||
} else {
|
} else {
|
||||||
MidiRingBufferBase<Byte>::write(size, buf);
|
MidiRingBufferBase<uint8_t>::write(size, buf);
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
@ -394,15 +394,15 @@ MidiRingBuffer::read(MidiBuffer& dst, nframes_t start, nframes_t end, nframes_t
|
||||||
|
|
||||||
while (read_space() > sizeof(double) + sizeof(size_t)) {
|
while (read_space() > sizeof(double) + sizeof(size_t)) {
|
||||||
|
|
||||||
full_peek(sizeof(double), (Byte*)&ev_time);
|
full_peek(sizeof(double), (uint8_t*)&ev_time);
|
||||||
|
|
||||||
if (ev_time > end) {
|
if (ev_time > end) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool success = MidiRingBufferBase<Byte>::full_read(sizeof(double), (Byte*)&ev_time);
|
bool success = MidiRingBufferBase<uint8_t>::full_read(sizeof(double), (uint8_t*)&ev_time);
|
||||||
if (success) {
|
if (success) {
|
||||||
success = MidiRingBufferBase<Byte>::full_read(sizeof(size_t), (Byte*)&ev_size);
|
success = MidiRingBufferBase<uint8_t>::full_read(sizeof(size_t), (uint8_t*)&ev_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
|
|
@ -410,13 +410,13 @@ MidiRingBuffer::read(MidiBuffer& dst, nframes_t start, nframes_t end, nframes_t
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Byte status;
|
uint8_t status;
|
||||||
success = full_peek(sizeof(Byte), &status);
|
success = full_peek(sizeof(uint8_t), &status);
|
||||||
assert(success); // If this failed, buffer is corrupt, all hope is lost
|
assert(success); // If this failed, buffer is corrupt, all hope is lost
|
||||||
|
|
||||||
// Ignore event if it doesn't match channel filter
|
// Ignore event if it doesn't match channel filter
|
||||||
if (is_channel_event(status) && get_channel_mode() == FilterChannels) {
|
if (is_channel_event(status) && get_channel_mode() == FilterChannels) {
|
||||||
const Byte channel = status & 0x0F;
|
const uint8_t channel = status & 0x0F;
|
||||||
if ( !(get_channel_mask() & (1L << channel)) ) {
|
if ( !(get_channel_mask() & (1L << channel)) ) {
|
||||||
skip(ev_size); // Advance read pointer to next event
|
skip(ev_size); // Advance read pointer to next event
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -431,13 +431,13 @@ MidiRingBuffer::read(MidiBuffer& dst, nframes_t start, nframes_t end, nframes_t
|
||||||
|
|
||||||
ev_time -= start;
|
ev_time -= start;
|
||||||
|
|
||||||
Byte* write_loc = dst.reserve(ev_time, ev_size);
|
uint8_t* write_loc = dst.reserve(ev_time, ev_size);
|
||||||
if (write_loc == NULL) {
|
if (write_loc == NULL) {
|
||||||
std::cerr << "MRB: Unable to reserve space in buffer, event skipped";
|
std::cerr << "MRB: Unable to reserve space in buffer, event skipped";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
success = MidiRingBufferBase<Byte>::full_read(ev_size, write_loc);
|
success = MidiRingBufferBase<uint8_t>::full_read(ev_size, write_loc);
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
if (is_channel_event(status) && get_channel_mode() == ForceChannel) {
|
if (is_channel_event(status) && get_channel_mode() == ForceChannel) {
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ public:
|
||||||
int set_state(const XMLNode& node);
|
int set_state(const XMLNode& node);
|
||||||
|
|
||||||
void midi_panic(void);
|
void midi_panic(void);
|
||||||
bool write_immediate_event(size_t size, const Byte* buf);
|
bool write_immediate_event(size_t size, const uint8_t* buf);
|
||||||
|
|
||||||
struct MidiControl : public AutomationControl {
|
struct MidiControl : public AutomationControl {
|
||||||
MidiControl(MidiTrack* route, boost::shared_ptr<AutomationList> al)
|
MidiControl(MidiTrack* route, boost::shared_ptr<AutomationList> al)
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ class SMFSource : public MidiSource {
|
||||||
void write_chunk(const char id[4], uint32_t length, void* data);
|
void write_chunk(const char id[4], uint32_t length, void* data);
|
||||||
size_t write_var_len(uint32_t val);
|
size_t write_var_len(uint32_t val);
|
||||||
uint32_t read_var_len() const;
|
uint32_t read_var_len() const;
|
||||||
int read_event(uint32_t* delta_t, uint32_t* size, Byte** buf) const;
|
int read_event(uint32_t* delta_t, uint32_t* size, uint8_t** buf) const;
|
||||||
|
|
||||||
static const uint16_t _ppqn = 19200;
|
static const uint16_t _ppqn = 19200;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,6 @@ namespace ARDOUR {
|
||||||
typedef uint64_t microseconds_t;
|
typedef uint64_t microseconds_t;
|
||||||
typedef uint32_t nframes_t;
|
typedef uint32_t nframes_t;
|
||||||
|
|
||||||
typedef unsigned char Byte;
|
|
||||||
|
|
||||||
enum IOChange {
|
enum IOChange {
|
||||||
NoChange = 0,
|
NoChange = 0,
|
||||||
ConfigurationChanged = 0x1,
|
ConfigurationChanged = 0x1,
|
||||||
|
|
|
||||||
|
|
@ -75,10 +75,10 @@ MidiBuffer::resize (size_t size)
|
||||||
|
|
||||||
#ifdef NO_POSIX_MEMALIGN
|
#ifdef NO_POSIX_MEMALIGN
|
||||||
_events = (MIDI::Event *) malloc(sizeof(MIDI::Event) * _capacity);
|
_events = (MIDI::Event *) malloc(sizeof(MIDI::Event) * _capacity);
|
||||||
_data = (Byte *) malloc(sizeof(Byte) * _capacity * MAX_EVENT_SIZE);
|
_data = (uint8_t *) malloc(sizeof(uint8_t) * _capacity * MAX_EVENT_SIZE);
|
||||||
#else
|
#else
|
||||||
posix_memalign((void**)&_events, CPU_CACHE_ALIGN, sizeof(MIDI::Event) * _capacity);
|
posix_memalign((void**)&_events, CPU_CACHE_ALIGN, sizeof(MIDI::Event) * _capacity);
|
||||||
posix_memalign((void**)&_data, CPU_CACHE_ALIGN, sizeof(Byte) * _capacity * MAX_EVENT_SIZE);
|
posix_memalign((void**)&_data, CPU_CACHE_ALIGN, sizeof(uint8_t) * _capacity * MAX_EVENT_SIZE);
|
||||||
#endif
|
#endif
|
||||||
assert(_data);
|
assert(_data);
|
||||||
assert(_events);
|
assert(_events);
|
||||||
|
|
@ -141,7 +141,7 @@ MidiBuffer::push_back(const MIDI::Event& ev)
|
||||||
if (_size == _capacity)
|
if (_size == _capacity)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Byte* const write_loc = _data + (_size * MAX_EVENT_SIZE);
|
uint8_t* const write_loc = _data + (_size * MAX_EVENT_SIZE);
|
||||||
|
|
||||||
memcpy(write_loc, ev.buffer(), ev.size());
|
memcpy(write_loc, ev.buffer(), ev.size());
|
||||||
_events[_size] = ev;
|
_events[_size] = ev;
|
||||||
|
|
@ -169,7 +169,7 @@ MidiBuffer::push_back(const jack_midi_event_t& ev)
|
||||||
if (_size == _capacity)
|
if (_size == _capacity)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Byte* const write_loc = _data + (_size * MAX_EVENT_SIZE);
|
uint8_t* const write_loc = _data + (_size * MAX_EVENT_SIZE);
|
||||||
|
|
||||||
memcpy(write_loc, ev.buffer, ev.size);
|
memcpy(write_loc, ev.buffer, ev.size);
|
||||||
_events[_size].time() = (double)ev.time;
|
_events[_size].time() = (double)ev.time;
|
||||||
|
|
@ -191,7 +191,7 @@ MidiBuffer::push_back(const jack_midi_event_t& ev)
|
||||||
* This call MUST be immediately followed by a write to the returned data
|
* This call MUST be immediately followed by a write to the returned data
|
||||||
* location, or the buffer will be corrupted and very nasty things will happen.
|
* location, or the buffer will be corrupted and very nasty things will happen.
|
||||||
*/
|
*/
|
||||||
Byte*
|
uint8_t*
|
||||||
MidiBuffer::reserve(double time, size_t size)
|
MidiBuffer::reserve(double time, size_t size)
|
||||||
{
|
{
|
||||||
if (size > MAX_EVENT_SIZE) {
|
if (size > MAX_EVENT_SIZE) {
|
||||||
|
|
@ -202,7 +202,7 @@ MidiBuffer::reserve(double time, size_t size)
|
||||||
if (_size == _capacity)
|
if (_size == _capacity)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
Byte* const write_loc = _data + (_size * MAX_EVENT_SIZE);
|
uint8_t* const write_loc = _data + (_size * MAX_EVENT_SIZE);
|
||||||
|
|
||||||
_events[_size].time() = time;
|
_events[_size].time() = time;
|
||||||
_events[_size].set_buffer(size, write_loc, false);
|
_events[_size].set_buffer(size, write_loc, false);
|
||||||
|
|
@ -224,7 +224,7 @@ MidiBuffer::silence(nframes_t dur, nframes_t offset)
|
||||||
cerr << "WARNING: MidiBuffer::silence w/ offset != 0 (not implemented)" << endl;
|
cerr << "WARNING: MidiBuffer::silence w/ offset != 0 (not implemented)" << endl;
|
||||||
|
|
||||||
memset(_events, 0, sizeof(MIDI::Event) * _capacity);
|
memset(_events, 0, sizeof(MIDI::Event) * _capacity);
|
||||||
memset(_data, 0, sizeof(Byte) * _capacity * MAX_EVENT_SIZE);
|
memset(_data, 0, sizeof(uint8_t) * _capacity * MAX_EVENT_SIZE);
|
||||||
_size = 0;
|
_size = 0;
|
||||||
_silent = true;
|
_silent = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -588,7 +588,7 @@ MidiTrack::write_controller_messages(MidiBuffer& output_buf, nframes_t start_fra
|
||||||
MidiBuffer& cc_buf = mix_buffers.get_midi(0);
|
MidiBuffer& cc_buf = mix_buffers.get_midi(0);
|
||||||
cc_buf.silence(nframes, offset);
|
cc_buf.silence(nframes, offset);
|
||||||
|
|
||||||
Byte buf[3]; // CC = 3 bytes
|
uint8_t buf[3]; // CC = 3 bytes
|
||||||
buf[0] = MIDI_CMD_CONTROL;
|
buf[0] = MIDI_CMD_CONTROL;
|
||||||
MIDI::Event ev(0, 3, buf, false);
|
MIDI::Event ev(0, 3, buf, false);
|
||||||
|
|
||||||
|
|
@ -616,8 +616,8 @@ MidiTrack::write_controller_messages(MidiBuffer& output_buf, nframes_t start_fra
|
||||||
assert(y <= 127.0);
|
assert(y <= 127.0);
|
||||||
|
|
||||||
ev.time() = stamp;
|
ev.time() = stamp;
|
||||||
ev.buffer()[1] = (Byte)list->parameter().id();
|
ev.buffer()[1] = (uint8_t)list->parameter().id();
|
||||||
ev.buffer()[2] = (Byte)y;
|
ev.buffer()[2] = (uint8_t)y;
|
||||||
|
|
||||||
cc_buf.push_back(ev);
|
cc_buf.push_back(ev);
|
||||||
|
|
||||||
|
|
@ -702,7 +702,7 @@ void
|
||||||
MidiTrack::midi_panic()
|
MidiTrack::midi_panic()
|
||||||
{
|
{
|
||||||
for (uint8_t channel = 0; channel <= 0xF; channel++) {
|
for (uint8_t channel = 0; channel <= 0xF; channel++) {
|
||||||
Byte ev[3] = { MIDI_CMD_CONTROL | channel, MIDI_CTL_SUSTAIN, 0 };
|
uint8_t ev[3] = { MIDI_CMD_CONTROL | channel, MIDI_CTL_SUSTAIN, 0 };
|
||||||
write_immediate_event(3, ev);
|
write_immediate_event(3, ev);
|
||||||
ev[1] = MIDI_CTL_ALL_NOTES_OFF;
|
ev[1] = MIDI_CTL_ALL_NOTES_OFF;
|
||||||
write_immediate_event(3, ev);
|
write_immediate_event(3, ev);
|
||||||
|
|
@ -714,7 +714,7 @@ MidiTrack::midi_panic()
|
||||||
/** \return true on success, false on failure (no buffer space left)
|
/** \return true on success, false on failure (no buffer space left)
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
MidiTrack::write_immediate_event(size_t size, const Byte* buf)
|
MidiTrack::write_immediate_event(size_t size, const uint8_t* buf)
|
||||||
{
|
{
|
||||||
printf("Write immediate event: ");
|
printf("Write immediate event: ");
|
||||||
for (size_t i=0; i < size; ++i) {
|
for (size_t i=0; i < size; ++i) {
|
||||||
|
|
@ -732,7 +732,7 @@ MidiTrack::MidiControl::set_value(float val)
|
||||||
size_t size = 3;
|
size_t size = 3;
|
||||||
|
|
||||||
if ( ! _list->automation_playback()) {
|
if ( ! _list->automation_playback()) {
|
||||||
Byte ev[3] = { _list->parameter().channel(), int(val), 0.0 };
|
uint8_t ev[3] = { _list->parameter().channel(), int(val), 0.0 };
|
||||||
switch(_list->parameter().type()) {
|
switch(_list->parameter().type()) {
|
||||||
case MidiCCAutomation:
|
case MidiCCAutomation:
|
||||||
ev[0] += MIDI_CMD_CONTROL;
|
ev[0] += MIDI_CMD_CONTROL;
|
||||||
|
|
|
||||||
|
|
@ -306,7 +306,7 @@ SMFSource::find_first_event_after(nframes_t start)
|
||||||
* skipped (eg a meta event), or -1 on EOF (or end of track).
|
* skipped (eg a meta event), or -1 on EOF (or end of track).
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
SMFSource::read_event(uint32_t* delta_t, uint32_t* size, Byte** buf) const
|
SMFSource::read_event(uint32_t* delta_t, uint32_t* size, uint8_t** buf) const
|
||||||
{
|
{
|
||||||
if (feof(_fd)) {
|
if (feof(_fd)) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -355,7 +355,7 @@ SMFSource::read_event(uint32_t* delta_t, uint32_t* size, Byte** buf) const
|
||||||
|
|
||||||
// Make sure we have enough scratch buffer
|
// Make sure we have enough scratch buffer
|
||||||
if (*size < (unsigned)event_size)
|
if (*size < (unsigned)event_size)
|
||||||
*buf = (Byte*)realloc(*buf, event_size);
|
*buf = (uint8_t*)realloc(*buf, event_size);
|
||||||
|
|
||||||
*size = event_size;
|
*size = event_size;
|
||||||
|
|
||||||
|
|
@ -386,7 +386,7 @@ SMFSource::read_unlocked (MidiRingBuffer& dst, nframes_t start, nframes_t cnt, n
|
||||||
// Output parameters for read_event (which will allocate scratch in buffer as needed)
|
// Output parameters for read_event (which will allocate scratch in buffer as needed)
|
||||||
uint32_t ev_delta_t = 0;
|
uint32_t ev_delta_t = 0;
|
||||||
uint32_t ev_size = 0;
|
uint32_t ev_size = 0;
|
||||||
Byte* ev_buffer = 0;
|
uint8_t* ev_buffer = 0;
|
||||||
|
|
||||||
size_t scratch_size = 0; // keep track of scratch to minimize reallocs
|
size_t scratch_size = 0; // keep track of scratch to minimize reallocs
|
||||||
|
|
||||||
|
|
@ -445,7 +445,7 @@ SMFSource::write_unlocked (MidiRingBuffer& src, nframes_t cnt)
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
size_t buf_capacity = 4;
|
size_t buf_capacity = 4;
|
||||||
Byte* buf = (Byte*)malloc(buf_capacity);
|
uint8_t* buf = (uint8_t*)malloc(buf_capacity);
|
||||||
|
|
||||||
if (_model && ! _model->writing())
|
if (_model && ! _model->writing())
|
||||||
_model->start_write();
|
_model->start_write();
|
||||||
|
|
@ -453,7 +453,7 @@ SMFSource::write_unlocked (MidiRingBuffer& src, nframes_t cnt)
|
||||||
MIDI::Event ev(0.0, 4, NULL, true);
|
MIDI::Event ev(0.0, 4, NULL, true);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
bool ret = src.full_peek(sizeof(double), (Byte*)&time);
|
bool ret = src.full_peek(sizeof(double), (uint8_t*)&time);
|
||||||
if (!ret || time - _timeline_position > _length + cnt)
|
if (!ret || time - _timeline_position > _length + cnt)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -463,7 +463,7 @@ SMFSource::write_unlocked (MidiRingBuffer& src, nframes_t cnt)
|
||||||
|
|
||||||
if (size > buf_capacity) {
|
if (size > buf_capacity) {
|
||||||
buf_capacity = size;
|
buf_capacity = size;
|
||||||
buf = (Byte*)realloc(buf, size);
|
buf = (uint8_t*)realloc(buf, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = src.read_contents(size, buf);
|
ret = src.read_contents(size, buf);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue