forked from PAWPAW-Mirror/lib_xua
Minor tidy
This commit is contained in:
@@ -1,8 +1,11 @@
|
|||||||
// Copyright 2011-2021 XMOS LIMITED.
|
// Copyright 2011-2024 XMOS LIMITED.
|
||||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||||
#ifndef MIDIOUTPARSE_XH
|
#ifndef MIDIOUTPARSE_XH
|
||||||
#define MIDIOUTPARSE_XH
|
#define MIDIOUTPARSE_XH
|
||||||
|
|
||||||
|
#warning MAYBE A SYSEX START AND FINISH IS SAFEST FOR NULL?
|
||||||
|
#define MIDI_OUT_NULL_MESSAGE 0x00000000 // midi_out_parse will return a size of 0 for this invalid message/event
|
||||||
|
|
||||||
{unsigned, unsigned, unsigned, unsigned} midi_out_parse(unsigned event);
|
{unsigned, unsigned, unsigned, unsigned} midi_out_parse(unsigned event);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
#ifndef QUEUE_H_
|
#ifndef QUEUE_H_
|
||||||
#define QUEUE_H_
|
#define QUEUE_H_
|
||||||
|
|
||||||
|
#include "midioutparse.h"
|
||||||
|
|
||||||
#define assert(x) asm("ecallf %0"::"r"(x));
|
#define assert(x) asm("ecallf %0"::"r"(x));
|
||||||
|
|
||||||
#ifndef MIDI_ENABLE_ASSERTS
|
#ifndef MIDI_ENABLE_ASSERTS
|
||||||
@@ -48,10 +50,11 @@ inline void queue_push_word(queue_t &q, unsigned array[], unsigned data)
|
|||||||
assert(0);
|
assert(0);
|
||||||
} else {
|
} else {
|
||||||
// Drop message
|
// Drop message
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
array[q.wrptr++ & q.mask] = data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
array[q.wrptr++ & q.mask] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned queue_pop_word(queue_t &q, unsigned array[]) {
|
inline unsigned queue_pop_word(queue_t &q, unsigned array[]) {
|
||||||
@@ -59,11 +62,11 @@ inline unsigned queue_pop_word(queue_t &q, unsigned array[]) {
|
|||||||
if(MIDI_ENABLE_ASSERTS){
|
if(MIDI_ENABLE_ASSERTS){
|
||||||
assert(0);
|
assert(0);
|
||||||
} else {
|
} else {
|
||||||
return 0x00000000; // midi_out_parse will return a size of 0 for this message/event
|
return MIDI_OUT_NULL_MESSAGE;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return array[q.rdptr++ & q.mask];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return array[q.rdptr++ & q.mask];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2013-2021 XMOS LIMITED.
|
// Copyright 2013-2024 XMOS LIMITED.
|
||||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
|
|
||||||
|
|||||||
@@ -27,11 +27,6 @@ def test_tx(capfd, config, build_midi):
|
|||||||
[0x90, 60, 81], # Note on
|
[0x90, 60, 81], # Note on
|
||||||
[0x80, 60, 81]] # Note off
|
[0x80, 60, 81]] # Note off
|
||||||
|
|
||||||
# midi_commands = [
|
|
||||||
# [0x90, 60, 81], # Note on
|
|
||||||
# [0x80, 60, 81]] # Note off
|
|
||||||
|
|
||||||
|
|
||||||
# midi_command_expected = midi_commands[1:] # should skip invalid first message
|
# midi_command_expected = midi_commands[1:] # should skip invalid first message
|
||||||
# Make a 1D list from the 2D list
|
# Make a 1D list from the 2D list
|
||||||
midi_command_expected = [[item for row in midi_commands for item in row]]
|
midi_command_expected = [[item for row in midi_commands for item in row]]
|
||||||
|
|||||||
Reference in New Issue
Block a user