13
0

Make a couple of bits of debug conditional to avoid mallocs when they are turned off.

git-svn-id: svn://localhost/ardour2/branches/3.0@8492 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-01-10 17:31:43 +00:00
parent 65c97361a9
commit bc84cb7479
2 changed files with 13 additions and 9 deletions

View File

@ -158,6 +158,7 @@ MidiBuffer::push_back(TimeType time, size_t size, const uint8_t* data)
const size_t stamp_size = sizeof(TimeType); const size_t stamp_size = sizeof(TimeType);
#ifndef NDEBUG #ifndef NDEBUG
if (DEBUG::MidiIO & PBD::debug_bits) {
DEBUG_STR_DECL(a); DEBUG_STR_DECL(a);
DEBUG_STR_APPEND(a, string_compose ("midibuffer %1 push event @ %2 sz %3 ", this, time, size)); DEBUG_STR_APPEND(a, string_compose ("midibuffer %1 push event @ %2 sz %3 ", this, time, size));
for (size_t i=0; i < size; ++i) { for (size_t i=0; i < size; ++i) {
@ -168,6 +169,7 @@ MidiBuffer::push_back(TimeType time, size_t size, const uint8_t* data)
} }
DEBUG_STR_APPEND(a,'\n'); DEBUG_STR_APPEND(a,'\n');
DEBUG_TRACE (DEBUG::MidiIO, DEBUG_STR(a).str()); DEBUG_TRACE (DEBUG::MidiIO, DEBUG_STR(a).str());
}
#endif #endif
if (_size + stamp_size + size >= _capacity) { if (_size + stamp_size + size >= _capacity) {

View File

@ -137,16 +137,18 @@ MidiRingBuffer<T>::read(MidiBuffer& dst, framepos_t start, framepos_t end, frame
success = read_contents (ev_size, write_loc); success = read_contents (ev_size, write_loc);
#ifndef NDEBUG #ifndef NDEBUG
DEBUG_STR_DECL(a); if (DEBUG::MidiDiskstreamIO && PBD::debug_bits) {
DEBUG_STR_APPEND(a, string_compose ("wrote MidiEvent to Buffer (time=%1, start=%2 offset=%3)", ev_time, start, offset)); DEBUG_STR_DECL(a);
for (size_t i=0; i < ev_size; ++i) { DEBUG_STR_APPEND(a, string_compose ("wrote MidiEvent to Buffer (time=%1, start=%2 offset=%3)", ev_time, start, offset));
DEBUG_STR_APPEND(a,hex); for (size_t i=0; i < ev_size; ++i) {
DEBUG_STR_APPEND(a,"0x"); DEBUG_STR_APPEND(a,hex);
DEBUG_STR_APPEND(a,(int)write_loc[i]); DEBUG_STR_APPEND(a,"0x");
DEBUG_STR_APPEND(a,' '); DEBUG_STR_APPEND(a,(int)write_loc[i]);
DEBUG_STR_APPEND(a,' ');
}
DEBUG_STR_APPEND(a,'\n');
DEBUG_TRACE (DEBUG::MidiDiskstreamIO, DEBUG_STR(a).str());
} }
DEBUG_STR_APPEND(a,'\n');
DEBUG_TRACE (DEBUG::MidiDiskstreamIO, DEBUG_STR(a).str());
#endif #endif
if (success) { if (success) {