summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-05-23 19:32:16 +0000
committerDavid Robillard <d@drobilla.net>2008-05-23 19:32:16 +0000
commit7ffed4e61c0223dba8fa042f9c436305984275d4 (patch)
treed9785228c606260e654a785e60a948466b9b9a73 /libs
parent4aa9d17ab1bc4b344bfb30aabf9a479e80f2d7e8 (diff)
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
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/midi_buffer.h8
-rw-r--r--libs/ardour/ardour/midi_ring_buffer.h58
-rw-r--r--libs/ardour/ardour/midi_track.h2
-rw-r--r--libs/ardour/ardour/smf_source.h2
-rw-r--r--libs/ardour/ardour/types.h2
-rw-r--r--libs/ardour/midi_buffer.cc14
-rw-r--r--libs/ardour/midi_track.cc12
-rw-r--r--libs/ardour/smf_source.cc12
8 files changed, 54 insertions, 56 deletions
diff --git a/libs/ardour/ardour/midi_buffer.h b/libs/ardour/ardour/midi_buffer.h
index a6cbb49118..699f461b17 100644
--- a/libs/ardour/ardour/midi_buffer.h
+++ b/libs/ardour/ardour/midi_buffer.h
@@ -39,9 +39,9 @@ public:
void copy(const MidiBuffer& copy);
- bool push_back(const MIDI::Event& event);
- bool push_back(const jack_midi_event_t& event);
- Byte* reserve(double time, size_t size);
+ bool push_back(const MIDI::Event& event);
+ bool push_back(const jack_midi_event_t& event);
+ uint8_t* reserve(double time, size_t size);
void resize(size_t);
@@ -93,7 +93,7 @@ private:
/* FIXME: this is utter crap. rewrite as a flat/packed buffer like MidiRingBuffer */
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.
};
diff --git a/libs/ardour/ardour/midi_ring_buffer.h b/libs/ardour/ardour/midi_ring_buffer.h
index 2a1d771792..ff0be5c997 100644
--- a/libs/ardour/ardour/midi_ring_buffer.h
+++ b/libs/ardour/ardour/midi_ring_buffer.h
@@ -243,19 +243,19 @@ MidiRingBufferBase<T>::write(size_t size, const T* src)
*
* [timestamp][size][size bytes of raw MIDI][timestamp][size][etc..]
*/
-class MidiRingBuffer : public MidiRingBufferBase<Byte> {
+class MidiRingBuffer : public MidiRingBufferBase<uint8_t> {
public:
/** @param size Size in bytes.
*/
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);
- bool read(double* time, size_t* size, Byte* buf);
+ size_t write(double time, size_t size, const uint8_t* buf);
+ bool read(double* time, size_t* size, uint8_t* buf);
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);
@@ -279,7 +279,7 @@ public:
}
protected:
- inline bool is_channel_event(Byte event_type_byte) {
+ inline bool is_channel_event(uint8_t event_type_byte) {
// mask out channel information
event_type_byte &= 0xF0;
// midi channel events range from 0x80 to 0xE0
@@ -292,15 +292,15 @@ private:
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) {
- success = MidiRingBufferBase<Byte>::full_read(sizeof(size_t), (Byte*)size);
+ success = MidiRingBufferBase<uint8_t>::full_read(sizeof(size_t), (uint8_t*)size);
}
if (success) {
- success = MidiRingBufferBase<Byte>::full_read(*size, buf);
+ success = MidiRingBufferBase<uint8_t>::full_read(*size, buf);
}
return success;
@@ -313,9 +313,9 @@ MidiRingBuffer::read(double* time, size_t* size, Byte* buf)
inline bool
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) {
- success = MidiRingBufferBase<Byte>::full_read(sizeof(size_t), (Byte*)size);
+ success = MidiRingBufferBase<uint8_t>::full_read(sizeof(size_t), (uint8_t*)size);
}
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).
*/
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
-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);
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
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)) ) {
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)) {
return 0;
} else {
- MidiRingBufferBase<Byte>::write(sizeof(double), (Byte*)&time);
- MidiRingBufferBase<Byte>::write(sizeof(size_t), (Byte*)&size);
+ MidiRingBufferBase<uint8_t>::write(sizeof(double), (uint8_t*)&time);
+ MidiRingBufferBase<uint8_t>::write(sizeof(size_t), (uint8_t*)&size);
if (is_channel_event(buf[0]) && get_channel_mode() == ForceChannel) {
assert(size == 2 || size == 3);
- Byte tmp_buf[3];
+ uint8_t tmp_buf[3];
// Force event to channel
tmp_buf[0] = (buf[0] & 0xF0) | (get_channel_mask() & 0x0F);
tmp_buf[1] = buf[1];
if (size == 3) {
tmp_buf[2] = buf[2];
}
- MidiRingBufferBase<Byte>::write(size, tmp_buf);
+ MidiRingBufferBase<uint8_t>::write(size, tmp_buf);
} else {
- MidiRingBufferBase<Byte>::write(size, buf);
+ MidiRingBufferBase<uint8_t>::write(size, buf);
}
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)) {
- full_peek(sizeof(double), (Byte*)&ev_time);
+ full_peek(sizeof(double), (uint8_t*)&ev_time);
if (ev_time > end) {
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) {
- 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) {
@@ -410,13 +410,13 @@ MidiRingBuffer::read(MidiBuffer& dst, nframes_t start, nframes_t end, nframes_t
continue;
}
- Byte status;
- success = full_peek(sizeof(Byte), &status);
+ uint8_t status;
+ success = full_peek(sizeof(uint8_t), &status);
assert(success); // If this failed, buffer is corrupt, all hope is lost
// Ignore event if it doesn't match channel filter
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)) ) {
skip(ev_size); // Advance read pointer to next event
continue;
@@ -431,13 +431,13 @@ MidiRingBuffer::read(MidiBuffer& dst, nframes_t start, nframes_t end, nframes_t
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) {
std::cerr << "MRB: Unable to reserve space in buffer, event skipped";
continue;
}
- success = MidiRingBufferBase<Byte>::full_read(ev_size, write_loc);
+ success = MidiRingBufferBase<uint8_t>::full_read(ev_size, write_loc);
if (success) {
if (is_channel_event(status) && get_channel_mode() == ForceChannel) {
diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h
index c2c7bed056..500502ac4b 100644
--- a/libs/ardour/ardour/midi_track.h
+++ b/libs/ardour/ardour/midi_track.h
@@ -71,7 +71,7 @@ public:
int set_state(const XMLNode& node);
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 {
MidiControl(MidiTrack* route, boost::shared_ptr<AutomationList> al)
diff --git a/libs/ardour/ardour/smf_source.h b/libs/ardour/ardour/smf_source.h
index 74655e28bc..88bf1e5d13 100644
--- a/libs/ardour/ardour/smf_source.h
+++ b/libs/ardour/ardour/smf_source.h
@@ -128,7 +128,7 @@ class SMFSource : public MidiSource {
void write_chunk(const char id[4], uint32_t length, void* data);
size_t write_var_len(uint32_t val);
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;
diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h
index 55655e9e26..9bfd93cdbf 100644
--- a/libs/ardour/ardour/types.h
+++ b/libs/ardour/ardour/types.h
@@ -59,8 +59,6 @@ namespace ARDOUR {
typedef uint64_t microseconds_t;
typedef uint32_t nframes_t;
- typedef unsigned char Byte;
-
enum IOChange {
NoChange = 0,
ConfigurationChanged = 0x1,
diff --git a/libs/ardour/midi_buffer.cc b/libs/ardour/midi_buffer.cc
index 9c82397142..1530babe34 100644
--- a/libs/ardour/midi_buffer.cc
+++ b/libs/ardour/midi_buffer.cc
@@ -75,10 +75,10 @@ MidiBuffer::resize (size_t size)
#ifdef NO_POSIX_MEMALIGN
_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
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
assert(_data);
assert(_events);
@@ -141,7 +141,7 @@ MidiBuffer::push_back(const MIDI::Event& ev)
if (_size == _capacity)
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());
_events[_size] = ev;
@@ -169,7 +169,7 @@ MidiBuffer::push_back(const jack_midi_event_t& ev)
if (_size == _capacity)
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);
_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
* location, or the buffer will be corrupted and very nasty things will happen.
*/
-Byte*
+uint8_t*
MidiBuffer::reserve(double time, size_t size)
{
if (size > MAX_EVENT_SIZE) {
@@ -202,7 +202,7 @@ MidiBuffer::reserve(double time, size_t size)
if (_size == _capacity)
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].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;
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;
_silent = true;
}
diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc
index 7b95290705..1000e68ba6 100644
--- a/libs/ardour/midi_track.cc
+++ b/libs/ardour/midi_track.cc
@@ -588,7 +588,7 @@ MidiTrack::write_controller_messages(MidiBuffer& output_buf, nframes_t start_fra
MidiBuffer& cc_buf = mix_buffers.get_midi(0);
cc_buf.silence(nframes, offset);
- Byte buf[3]; // CC = 3 bytes
+ uint8_t buf[3]; // CC = 3 bytes
buf[0] = MIDI_CMD_CONTROL;
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);
ev.time() = stamp;
- ev.buffer()[1] = (Byte)list->parameter().id();
- ev.buffer()[2] = (Byte)y;
+ ev.buffer()[1] = (uint8_t)list->parameter().id();
+ ev.buffer()[2] = (uint8_t)y;
cc_buf.push_back(ev);
@@ -702,7 +702,7 @@ void
MidiTrack::midi_panic()
{
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);
ev[1] = MIDI_CTL_ALL_NOTES_OFF;
write_immediate_event(3, ev);
@@ -714,7 +714,7 @@ MidiTrack::midi_panic()
/** \return true on success, false on failure (no buffer space left)
*/
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: ");
for (size_t i=0; i < size; ++i) {
@@ -732,7 +732,7 @@ MidiTrack::MidiControl::set_value(float val)
size_t size = 3;
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()) {
case MidiCCAutomation:
ev[0] += MIDI_CMD_CONTROL;
diff --git a/libs/ardour/smf_source.cc b/libs/ardour/smf_source.cc
index 2f6d55d006..bb43d4791a 100644
--- a/libs/ardour/smf_source.cc
+++ b/libs/ardour/smf_source.cc
@@ -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).
*/
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)) {
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
if (*size < (unsigned)event_size)
- *buf = (Byte*)realloc(*buf, event_size);
+ *buf = (uint8_t*)realloc(*buf, 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)
uint32_t ev_delta_t = 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
@@ -445,7 +445,7 @@ SMFSource::write_unlocked (MidiRingBuffer& src, nframes_t cnt)
size_t size;
size_t buf_capacity = 4;
- Byte* buf = (Byte*)malloc(buf_capacity);
+ uint8_t* buf = (uint8_t*)malloc(buf_capacity);
if (_model && ! _model->writing())
_model->start_write();
@@ -453,7 +453,7 @@ SMFSource::write_unlocked (MidiRingBuffer& src, nframes_t cnt)
MIDI::Event ev(0.0, 4, NULL, 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)
break;
@@ -463,7 +463,7 @@ SMFSource::write_unlocked (MidiRingBuffer& src, nframes_t cnt)
if (size > buf_capacity) {
buf_capacity = size;
- buf = (Byte*)realloc(buf, size);
+ buf = (uint8_t*)realloc(buf, size);
}
ret = src.read_contents(size, buf);