Introduce the timer packet - "TI".
This timer will start the clock accounting for latency! Cool, right? Remove useless qDebug() for music looping
This commit is contained in:
parent
febfbeafc1
commit
7e9c5726e0
@ -251,6 +251,10 @@ public:
|
|||||||
|
|
||||||
void check_connection_received();
|
void check_connection_received();
|
||||||
|
|
||||||
|
void start_clock(qint64 msecs);
|
||||||
|
|
||||||
|
void stop_clock();
|
||||||
|
|
||||||
qint64 get_ping() { return ping_timer.elapsed(); }
|
qint64 get_ping() { return ping_timer.elapsed(); }
|
||||||
|
|
||||||
~Courtroom();
|
~Courtroom();
|
||||||
|
@ -145,7 +145,6 @@ void CALLBACK loopProc(HSYNC handle, DWORD channel, DWORD data, void *user)
|
|||||||
|
|
||||||
void AOMusicPlayer::set_looping(bool toggle, int channel)
|
void AOMusicPlayer::set_looping(bool toggle, int channel)
|
||||||
{
|
{
|
||||||
qDebug() << "Setting looping for channel" << channel << "to" << toggle;
|
|
||||||
m_looping = toggle;
|
m_looping = toggle;
|
||||||
if (!m_looping) {
|
if (!m_looping) {
|
||||||
if (BASS_ChannelFlags(m_stream_list[channel], 0, 0) & BASS_SAMPLE_LOOP)
|
if (BASS_ChannelFlags(m_stream_list[channel], 0, 0) & BASS_SAMPLE_LOOP)
|
||||||
|
@ -4715,6 +4715,16 @@ void Courtroom::announce_case(QString title, bool def, bool pro, bool jud,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Courtroom::start_clock(qint64 msecs)
|
||||||
|
{
|
||||||
|
ui_clock->start(static_cast<int>(msecs));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Courtroom::stop_clock()
|
||||||
|
{
|
||||||
|
ui_clock->stop();
|
||||||
|
}
|
||||||
|
|
||||||
Courtroom::~Courtroom()
|
Courtroom::~Courtroom()
|
||||||
{
|
{
|
||||||
delete music_player;
|
delete music_player;
|
||||||
|
@ -728,6 +728,17 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
|||||||
f_contents.at(4) == "1",
|
f_contents.at(4) == "1",
|
||||||
f_contents.at(5) == "1");
|
f_contents.at(5) == "1");
|
||||||
}
|
}
|
||||||
|
else if (header == "TI") { // Timer packet
|
||||||
|
if (courtroom_constructed && f_contents.size() >= 1) {
|
||||||
|
qint64 resolution = f_contents.at(0).toInt();
|
||||||
|
qDebug() << "timer" << resolution << last_ping << resolution - last_ping;
|
||||||
|
resolution = resolution - last_ping;
|
||||||
|
if (resolution > 0)
|
||||||
|
w_courtroom->start_clock(resolution);
|
||||||
|
else
|
||||||
|
w_courtroom->stop_clock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user