added: connect socket
This commit is contained in:
parent
4d86a7430f
commit
fd0c6044d2
2 changed files with 19 additions and 1 deletions
|
@ -119,6 +119,8 @@ void CBitVis::Process()
|
|||
|
||||
while (!m_stop)
|
||||
{
|
||||
bool didconnect = false;
|
||||
|
||||
if (m_jackclient.ExitStatus())
|
||||
{
|
||||
LogError("Jack client exited with code %i reason: \"%s\"",
|
||||
|
@ -129,13 +131,26 @@ void CBitVis::Process()
|
|||
if (!m_jackclient.IsConnected() && GetTimeUs() - lastconnect > CONNECTINTERVAL)
|
||||
{
|
||||
m_jackclient.Connect();
|
||||
lastconnect = GetTimeUs();
|
||||
didconnect = true;
|
||||
}
|
||||
|
||||
uint8_t msg;
|
||||
while ((msg = m_jackclient.GetMessage()) != MsgNone)
|
||||
LogDebug("got message %s from jack client", MsgToString(msg));
|
||||
|
||||
if (!m_socket.IsOpen() && GetTimeUs() - lastconnect > CONNECTINTERVAL)
|
||||
{
|
||||
if (m_socket.Open("192.168.88.117", 1337) == FAIL)
|
||||
{
|
||||
LogError("Failed to connect: %s", m_socket.GetError().c_str());
|
||||
m_socket.Close();
|
||||
}
|
||||
didconnect = true;
|
||||
}
|
||||
|
||||
if (didconnect)
|
||||
lastconnect = GetTimeUs();
|
||||
|
||||
if (m_jackclient.IsConnected())
|
||||
{
|
||||
ProcessAudio();
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "jackclient.h"
|
||||
#include "fft.h"
|
||||
#include "util/tcpsocket.h"
|
||||
|
||||
class CBitVis
|
||||
{
|
||||
|
@ -44,6 +45,8 @@ class CBitVis
|
|||
int m_samplecounter;
|
||||
int m_nrffts;
|
||||
|
||||
CTcpClientSocket m_socket;
|
||||
|
||||
void SetupSignals();
|
||||
void ProcessSignalfd();
|
||||
void ProcessAudio();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue