mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2026-01-14 08:35:48 +01:00
2021-02-14 Fred Gleason <fredg@paravelsystems.com>
* Removed 'Q3SocketDevice' dependencies from 'RDCae'. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
@@ -21131,3 +21131,5 @@
|
|||||||
* Removed the 'RDListViewItem' class.
|
* Removed the 'RDListViewItem' class.
|
||||||
2021-02-14 Fred Gleason <fredg@paravelsystems.com>
|
2021-02-14 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Removed 'Q3TextStream' dependencies from 'librd'.
|
* Removed 'Q3TextStream' dependencies from 'librd'.
|
||||||
|
2021-02-14 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Removed 'Q3SocketDevice' dependencies from 'RDCae'.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// Connection to the Rivendell Core Audio Engine
|
// Connection to the Rivendell Core Audio Engine
|
||||||
//
|
//
|
||||||
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
|
// (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License version 2 as
|
// it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -48,16 +48,19 @@ RDCae::RDCae(RDStation *station,RDConfig *config,QObject *parent)
|
|||||||
//
|
//
|
||||||
// TCP Connection
|
// TCP Connection
|
||||||
//
|
//
|
||||||
cae_socket=new Q3SocketDevice(Q3SocketDevice::Stream);
|
cae_socket=new QTcpSocket(this);
|
||||||
cae_socket->setBlocking(false);
|
connect(cae_socket,SIGNAL(connected()),this,SLOT(caeSocketConnected()));
|
||||||
|
cae_socket_count=10;
|
||||||
|
cae_socket_timer=new QTimer(this);
|
||||||
|
cae_socket_timer->setSingleShot(true);
|
||||||
|
connect(cae_socket_timer,SIGNAL(timeout()),this,SLOT(caeSocketTimeout()));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Meter Connection
|
// Meter Connection
|
||||||
//
|
//
|
||||||
cae_meter_socket=new Q3SocketDevice(Q3SocketDevice::Datagram);
|
cae_meter_socket=new QUdpSocket(this);
|
||||||
cae_meter_socket->setBlocking(false);
|
|
||||||
for(Q_INT16 i=30000;i<30100;i++) {
|
for(Q_INT16 i=30000;i<30100;i++) {
|
||||||
if(cae_meter_socket->bind(QHostAddress(),i)) {
|
if(cae_meter_socket->bind(i)) {
|
||||||
i=31000;
|
i=31000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -97,35 +100,9 @@ RDCae::~RDCae() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RDCae::connectHost()
|
|
||||||
{
|
|
||||||
int count=10;
|
|
||||||
// QHostAddress addr;
|
|
||||||
QTimer *timer=new QTimer(this,"read_timer");
|
|
||||||
|
|
||||||
connect(timer,SIGNAL(timeout()),this,SLOT(readyData()));
|
|
||||||
timer->start(CAE_POLL_INTERVAL);
|
|
||||||
while((!cae_socket->connect(cae_station->caeAddress(cae_config),
|
|
||||||
CAED_TCP_PORT))&&(--count>0)) {
|
|
||||||
usleep(100000);
|
|
||||||
}
|
|
||||||
usleep(100000);
|
|
||||||
if(count>0) {
|
|
||||||
SendCommand(QString().sprintf("PW %s!",
|
|
||||||
(const char *)cae_config->password()));
|
|
||||||
for(int i=0;i<RD_MAX_CARDS;i++) {
|
|
||||||
SendCommand(QString().sprintf("TS %d!",i));
|
|
||||||
for(int j=0;j<RD_MAX_PORTS;j++) {
|
|
||||||
SendCommand(QString().sprintf("IS %d %d!",i,j));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void RDCae::enableMetering(QList<int> *cards)
|
void RDCae::enableMetering(QList<int> *cards)
|
||||||
{
|
{
|
||||||
QString cmd=QString().sprintf("ME %u",cae_meter_socket->port());
|
QString cmd=QString().sprintf("ME %u",cae_meter_socket->localPort());
|
||||||
for(int i=0;i<cards->size();i++) {
|
for(int i=0;i<cards->size();i++) {
|
||||||
if(cards->at(i)>=0) {
|
if(cards->at(i)>=0) {
|
||||||
bool found=false;
|
bool found=false;
|
||||||
@@ -377,6 +354,42 @@ void RDCae::setPlayPortActive(int card,int port,int stream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RDCae::connectHost()
|
||||||
|
{
|
||||||
|
cae_socket_count=100;
|
||||||
|
cae_socket_timer->start(100000);
|
||||||
|
cae_socket->connectToHost(cae_station->caeAddress(cae_config),CAED_TCP_PORT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RDCae::caeSocketConnected()
|
||||||
|
{
|
||||||
|
cae_socket_timer->stop();
|
||||||
|
SendCommand("PW "+cae_config->password()+"!");
|
||||||
|
for(int i=0;i<RD_MAX_CARDS;i++) {
|
||||||
|
SendCommand(QString().sprintf("TS %d!",i));
|
||||||
|
for(int j=0;j<RD_MAX_PORTS;j++) {
|
||||||
|
SendCommand(QString().sprintf("IS %d %d!",i,j));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RDCae::caeSocketTimeout()
|
||||||
|
{
|
||||||
|
cae_socket->disconnectFromHost();
|
||||||
|
if(--cae_socket_count==0) {
|
||||||
|
emit isConnected(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
delete cae_socket;
|
||||||
|
cae_socket=new QTcpSocket(this);
|
||||||
|
connect(cae_socket,SIGNAL(connected()),this,SLOT(caeSocketConnected()));
|
||||||
|
cae_socket_timer->start(100000);
|
||||||
|
cae_socket->connectToHost(cae_station->caeAddress(cae_config),CAED_TCP_PORT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void RDCae::readyData()
|
void RDCae::readyData()
|
||||||
{
|
{
|
||||||
readyData(0,0,"");
|
readyData(0,0,"");
|
||||||
@@ -642,7 +655,7 @@ void RDCae::UpdateMeters()
|
|||||||
int n;
|
int n;
|
||||||
QStringList args;
|
QStringList args;
|
||||||
|
|
||||||
while((n=cae_meter_socket->readBlock(msg,1500))>0) {
|
while((n=cae_meter_socket->readDatagram(msg,1500))>0) {
|
||||||
msg[n]=0;
|
msg[n]=0;
|
||||||
args=QString(msg).split(" ");
|
args=QString(msg).split(" ");
|
||||||
if(args[0]=="ML") {
|
if(args[0]=="ML") {
|
||||||
|
|||||||
15
lib/rdcae.h
15
lib/rdcae.h
@@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// Connection to the Rivendell Core Audio Engine
|
// Connection to the Rivendell Core Audio Engine
|
||||||
//
|
//
|
||||||
// (C) Copyright 2002-2016 Fred Gleason <fredg@paravelsystems.com>
|
// (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License version 2 as
|
// it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -21,7 +21,8 @@
|
|||||||
#ifndef RDCAE_H
|
#ifndef RDCAE_H
|
||||||
#define RDCAE_H
|
#define RDCAE_H
|
||||||
|
|
||||||
#include <q3socketdevice.h>
|
#include <QUdpSocket>
|
||||||
|
#include <QTcpSocket>
|
||||||
|
|
||||||
#include <qlabel.h>
|
#include <qlabel.h>
|
||||||
#include <qobject.h>
|
#include <qobject.h>
|
||||||
@@ -42,7 +43,6 @@ class RDCae : public QObject
|
|||||||
enum AudioCoding {Pcm16=0,MpegL1=1,MpegL2=2,MpegL3=3,Pcm24=4};
|
enum AudioCoding {Pcm16=0,MpegL1=1,MpegL2=2,MpegL3=3,Pcm24=4};
|
||||||
RDCae(RDStation *station,RDConfig *config,QObject *parent=0);
|
RDCae(RDStation *station,RDConfig *config,QObject *parent=0);
|
||||||
~RDCae();
|
~RDCae();
|
||||||
void connectHost();
|
|
||||||
void enableMetering(QList<int> *cards);
|
void enableMetering(QList<int> *cards);
|
||||||
bool loadPlay(int card,QString name,int *stream,int *handle);
|
bool loadPlay(int card,QString name,int *stream,int *handle);
|
||||||
void unloadPlay(int handle);
|
void unloadPlay(int handle);
|
||||||
@@ -92,6 +92,9 @@ class RDCae : public QObject
|
|||||||
void timescalingSupported(int card,bool state);
|
void timescalingSupported(int card,bool state);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void connectHost();
|
||||||
|
void caeSocketConnected();
|
||||||
|
void caeSocketTimeout();
|
||||||
void readyData();
|
void readyData();
|
||||||
void readyData(int *stream,int *handle,QString name);
|
void readyData(int *stream,int *handle,QString name);
|
||||||
void clockData();
|
void clockData();
|
||||||
@@ -103,7 +106,9 @@ class RDCae : public QObject
|
|||||||
int StreamNumber(const char *arg);
|
int StreamNumber(const char *arg);
|
||||||
int GetHandle(const char *arg);
|
int GetHandle(const char *arg);
|
||||||
void UpdateMeters();
|
void UpdateMeters();
|
||||||
Q3SocketDevice *cae_socket;
|
QTcpSocket *cae_socket;
|
||||||
|
QTimer *cae_socket_timer;
|
||||||
|
int cae_socket_count;
|
||||||
bool debug;
|
bool debug;
|
||||||
char args[CAE_MAX_ARGS][CAE_MAX_LENGTH];
|
char args[CAE_MAX_ARGS][CAE_MAX_LENGTH];
|
||||||
int argnum;
|
int argnum;
|
||||||
@@ -112,7 +117,7 @@ class RDCae : public QObject
|
|||||||
bool input_status[RD_MAX_CARDS][RD_MAX_PORTS];
|
bool input_status[RD_MAX_CARDS][RD_MAX_PORTS];
|
||||||
int cae_handle[RD_MAX_CARDS][RD_MAX_STREAMS];
|
int cae_handle[RD_MAX_CARDS][RD_MAX_STREAMS];
|
||||||
unsigned cae_pos[RD_MAX_CARDS][RD_MAX_STREAMS];
|
unsigned cae_pos[RD_MAX_CARDS][RD_MAX_STREAMS];
|
||||||
Q3SocketDevice *cae_meter_socket;
|
QUdpSocket *cae_meter_socket;
|
||||||
short cae_input_levels[RD_MAX_CARDS][RD_MAX_PORTS][2];
|
short cae_input_levels[RD_MAX_CARDS][RD_MAX_PORTS][2];
|
||||||
short cae_output_levels[RD_MAX_CARDS][RD_MAX_PORTS][2];
|
short cae_output_levels[RD_MAX_CARDS][RD_MAX_PORTS][2];
|
||||||
short cae_stream_output_levels[RD_MAX_CARDS][RD_MAX_PORTS][2];
|
short cae_stream_output_levels[RD_MAX_CARDS][RD_MAX_PORTS][2];
|
||||||
|
|||||||
Reference in New Issue
Block a user