mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Add some const in preparation
parent
c74df8581d
commit
9d8a83bf8d
|
@ -539,19 +539,19 @@ static void TransmitChannelMsg(IDirectMusicBuffer *buffer, REFERENCE_TIME rt, by
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void TransmitSysex(IDirectMusicBuffer *buffer, REFERENCE_TIME rt, byte *&msg_start, size_t &remaining)
|
static void TransmitSysex(IDirectMusicBuffer *buffer, REFERENCE_TIME rt, const byte *&msg_start, size_t &remaining)
|
||||||
{
|
{
|
||||||
/* Find end of message. */
|
/* Find end of message. */
|
||||||
byte *msg_end = msg_start;
|
const byte *msg_end = msg_start;
|
||||||
while (*msg_end != MIDIST_ENDSYSEX) msg_end++;
|
while (*msg_end != MIDIST_ENDSYSEX) msg_end++;
|
||||||
msg_end++; // Also include SysEx end byte.
|
msg_end++; // Also include SysEx end byte.
|
||||||
|
|
||||||
if (buffer->PackUnstructured(rt, 0, msg_end - msg_start, msg_start) == E_OUTOFMEMORY) {
|
if (buffer->PackUnstructured(rt, 0, msg_end - msg_start, const_cast<LPBYTE>(msg_start)) == E_OUTOFMEMORY) {
|
||||||
/* Buffer is full, clear it and try again. */
|
/* Buffer is full, clear it and try again. */
|
||||||
_port->PlayBuffer(buffer);
|
_port->PlayBuffer(buffer);
|
||||||
buffer->Flush();
|
buffer->Flush();
|
||||||
|
|
||||||
buffer->PackUnstructured(rt, 0, msg_end - msg_start, msg_start);
|
buffer->PackUnstructured(rt, 0, msg_end - msg_start, const_cast<LPBYTE>(msg_start));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update position in buffer. */
|
/* Update position in buffer. */
|
||||||
|
@ -559,7 +559,7 @@ static void TransmitSysex(IDirectMusicBuffer *buffer, REFERENCE_TIME rt, byte *&
|
||||||
msg_start = msg_end;
|
msg_start = msg_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void TransmitSysexConst(IDirectMusicBuffer *buffer, REFERENCE_TIME rt, byte *msg_start, size_t length)
|
static void TransmitSysexConst(IDirectMusicBuffer *buffer, REFERENCE_TIME rt, const byte *msg_start, size_t length)
|
||||||
{
|
{
|
||||||
TransmitSysex(buffer, rt, msg_start, length);
|
TransmitSysex(buffer, rt, msg_start, length);
|
||||||
}
|
}
|
||||||
|
@ -752,7 +752,7 @@ static void MidiThreadProc()
|
||||||
block_time = playback_start_time + block.realtime * MIDITIME_TO_REFTIME;
|
block_time = playback_start_time + block.realtime * MIDITIME_TO_REFTIME;
|
||||||
DEBUG(driver, 9, "DMusic thread: Streaming block " PRINTF_SIZE " (cur=" OTTD_PRINTF64 ", block=" OTTD_PRINTF64 ")", current_block, (long long)(current_time / MS_TO_REFTIME), (long long)(block_time / MS_TO_REFTIME));
|
DEBUG(driver, 9, "DMusic thread: Streaming block " PRINTF_SIZE " (cur=" OTTD_PRINTF64 ", block=" OTTD_PRINTF64 ")", current_block, (long long)(current_time / MS_TO_REFTIME), (long long)(block_time / MS_TO_REFTIME));
|
||||||
|
|
||||||
byte *data = block.data.data();
|
const byte *data = block.data.data();
|
||||||
size_t remaining = block.data.size();
|
size_t remaining = block.data.size();
|
||||||
byte last_status = 0;
|
byte last_status = 0;
|
||||||
while (remaining > 0) {
|
while (remaining > 0) {
|
||||||
|
|
|
@ -74,10 +74,10 @@ static void TransmitChannelMsg(byte status, byte p1, byte p2 = 0)
|
||||||
midiOutShortMsg(_midi.midi_out, status | (p1 << 8) | (p2 << 16));
|
midiOutShortMsg(_midi.midi_out, status | (p1 << 8) | (p2 << 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void TransmitSysex(byte *&msg_start, size_t &remaining)
|
static void TransmitSysex(const byte *&msg_start, size_t &remaining)
|
||||||
{
|
{
|
||||||
/* find end of message */
|
/* find end of message */
|
||||||
byte *msg_end = msg_start;
|
const byte *msg_end = msg_start;
|
||||||
while (*msg_end != MIDIST_ENDSYSEX) msg_end++;
|
while (*msg_end != MIDIST_ENDSYSEX) msg_end++;
|
||||||
msg_end++; /* also include sysex end byte */
|
msg_end++; /* also include sysex end byte */
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ static void TransmitSysex(byte *&msg_start, size_t &remaining)
|
||||||
msg_start = msg_end;
|
msg_start = msg_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void TransmitSysexConst(byte *msg_start, size_t length)
|
static void TransmitSysexConst(const byte *msg_start, size_t length)
|
||||||
{
|
{
|
||||||
TransmitSysex(msg_start, length);
|
TransmitSysex(msg_start, length);
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ void CALLBACK TimerCallback(UINT uTimerID, UINT, DWORD_PTR dwUser, DWORD_PTR, DW
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte *data = block.data.data();
|
const byte *data = block.data.data();
|
||||||
size_t remaining = block.data.size();
|
size_t remaining = block.data.size();
|
||||||
byte last_status = 0;
|
byte last_status = 0;
|
||||||
while (remaining > 0) {
|
while (remaining > 0) {
|
||||||
|
|
Loading…
Reference in New Issue