mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-11-29 16:50:13 +01:00
2018-05-21 Fred Gleason <fredg@paravelsystems.com>
* Added an 'AUDIO_CARDS' table to the database. * Dropped the 'STATIONS.CARD<n>_DRIVER', 'STATIONS.CARD<n>NAME', 'STATIONS.CARD<n>_INPUTS' and 'STATIONS.CARD<n>OUTPUTS' fields from the database. * Incremented the database version to 282. * Added an 'AUDIO_CARDS.CLOCK_SOURCE' field to the database. * Added an 'AUDIO_INPUTS' table to the database. * Added an 'AUDIO_OUTPUTS' table to the database. * Dropped the 'AUDIO_PORTS' table from the database. * Incremented the database version to 283. * Changed the legend on the 'Audio Ports' button to 'ASI Audio Ports' on the 'Edit Host' dialog in rdadmin(1). * Changed the title of the 'Configure Audio Ports' dialog to 'Configure AudioScience Audio Ports' on the 'Edit Host' dialog in rdadmin(1).
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
/*
|
||||
* Current Database Version
|
||||
*/
|
||||
#define RD_VERSION_DATABASE 281
|
||||
#define RD_VERSION_DATABASE 283
|
||||
|
||||
|
||||
#endif // DBVERSION_H
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// Abstract a Rivendell Audio Port.
|
||||
//
|
||||
// (C) Copyright 2002-2003,2016 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2003,2016-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// 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
|
||||
@@ -19,35 +19,15 @@
|
||||
//
|
||||
#include <rddb.h>
|
||||
#include <rdaudio_port.h>
|
||||
|
||||
#include <rdescape_string.h>
|
||||
|
||||
//
|
||||
// Global Classes
|
||||
//
|
||||
RDAudioPort::RDAudioPort(QString station,int card,bool create)
|
||||
RDAudioPort::RDAudioPort(QString station,int card)
|
||||
{
|
||||
RDSqlQuery *q;
|
||||
QString sql;
|
||||
|
||||
port_station=station;
|
||||
port_card=card;
|
||||
|
||||
if(create) {
|
||||
sql=QString().sprintf("select ID from AUDIO_PORTS where \
|
||||
(STATION_NAME=\"%s\")&&(CARD_NUMBER=%d)",(const char *)port_station,port_card);
|
||||
q=new RDSqlQuery(sql);
|
||||
if(q->size()!=1) {
|
||||
delete q;
|
||||
sql=QString().sprintf("INSERT INTO AUDIO_PORTS SET STATION_NAME=\"%s\",\
|
||||
CARD_NUMBER=%d",
|
||||
(const char *)port_station,port_card);
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
}
|
||||
else {
|
||||
delete q;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,23 +45,43 @@ int RDAudioPort::card() const
|
||||
|
||||
RDCae::ClockSource RDAudioPort::clockSource()
|
||||
{
|
||||
return (RDCae::ClockSource)GetIntValue("CLOCK_SOURCE");
|
||||
RDCae::ClockSource ret=RDCae::InternalClock;
|
||||
QString sql=QString("select CLOCK_SOURCE from AUDIO_CARDS where ")+
|
||||
"STATION_NAME=\""+RDEscapeString(port_station)+"\" && "+
|
||||
QString().sprintf("CARD_NUMBER=%d",port_card);
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
if(q->first()) {
|
||||
ret=(RDCae::ClockSource)q->value(0).toInt();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void RDAudioPort::setClockSource(RDCae::ClockSource src)
|
||||
{
|
||||
SetRow("CLOCK_SOURCE",(int)src);
|
||||
QString sql=QString("update AUDIO_CARDS set ")+
|
||||
QString().sprintf("CLOCK_SOURCE=%d where ",src)+
|
||||
"STATION_NAME=\""+RDEscapeString(port_station)+"\" && "+
|
||||
QString().sprintf("CARD_NUMBER=%d",port_card);
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
}
|
||||
|
||||
|
||||
RDAudioPort::PortType RDAudioPort::inputPortType(int port)
|
||||
{
|
||||
if(port<0) {
|
||||
return RDAudioPort::Analog;
|
||||
RDAudioPort::PortType ret=RDAudioPort::Analog;
|
||||
QString sql=QString("select TYPE from AUDIO_INPUTS where ")+
|
||||
"STATION_NAME=\""+RDEscapeString(port_station)+"\" && "+
|
||||
QString().sprintf("CARD_NUMBER=%d && ",port_card)+
|
||||
QString().sprintf("PORT_NUMBER=%d",port);
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
if(q->first()) {
|
||||
ret=(RDAudioPort::PortType)q->value(0).toInt();
|
||||
}
|
||||
return
|
||||
(RDAudioPort::PortType)GetIntValue(QString().sprintf("INPUT_%d_TYPE",port));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -90,17 +90,29 @@ void RDAudioPort::setInputPortType(int port,RDAudioPort::PortType type)
|
||||
if(port<0) {
|
||||
return;
|
||||
}
|
||||
SetRow(QString().sprintf("INPUT_%d_TYPE",port),(int)type);
|
||||
QString sql=QString("update AUDIO_INPUTS set ")+
|
||||
QString().sprintf("TYPE=%d where ",type)+
|
||||
"STATION_NAME=\""+RDEscapeString(port_station)+"\" && "+
|
||||
QString().sprintf("CARD_NUMBER=%d && ",port_card)+
|
||||
QString().sprintf("PORT_NUMBER=%d",port);
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
}
|
||||
|
||||
|
||||
RDCae::ChannelMode RDAudioPort::inputPortMode(int port)
|
||||
{
|
||||
if(port<0) {
|
||||
return RDCae::Normal;
|
||||
RDCae::ChannelMode ret=RDCae::Normal;
|
||||
QString sql=QString("select MODE from AUDIO_INPUTS where ")+
|
||||
"STATION_NAME=\""+RDEscapeString(port_station)+"\" && "+
|
||||
QString().sprintf("CARD_NUMBER=%d && ",port_card)+
|
||||
QString().sprintf("PORT_NUMBER=%d",port);
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
if(q->first()) {
|
||||
ret=(RDCae::ChannelMode)q->value(0).toInt();
|
||||
}
|
||||
return
|
||||
(RDCae::ChannelMode)GetIntValue(QString().sprintf("INPUT_%d_MODE",port));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +121,13 @@ void RDAudioPort::setInputPortMode(int port,RDCae::ChannelMode mode)
|
||||
if(port<0) {
|
||||
return;
|
||||
}
|
||||
SetRow(QString().sprintf("INPUT_%d_MODE",port),(int)mode);
|
||||
QString sql=QString("update AUDIO_INPUTS set ")+
|
||||
QString().sprintf("MODE=%d where ",mode)+
|
||||
"STATION_NAME=\""+RDEscapeString(port_station)+"\" && "+
|
||||
QString().sprintf("CARD_NUMBER=%d && ",port_card)+
|
||||
QString().sprintf("PORT_NUMBER=%d",port);
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +136,17 @@ int RDAudioPort::inputPortLevel(int port)
|
||||
if(port<0) {
|
||||
return 400;
|
||||
}
|
||||
return GetIntValue(QString().sprintf("INPUT_%d_LEVEL",port));
|
||||
int ret=400;
|
||||
QString sql=QString("select LEVEL from AUDIO_INPUTS where ")+
|
||||
"STATION_NAME=\""+RDEscapeString(port_station)+"\" && "+
|
||||
QString().sprintf("CARD_NUMBER=%d && ",port_card)+
|
||||
QString().sprintf("PORT_NUMBER=%d",port);
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
if(q->first()) {
|
||||
ret=q->value(0).toInt();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +155,13 @@ void RDAudioPort::setInputPortLevel(int port,int level)
|
||||
if(port<0) {
|
||||
return;
|
||||
}
|
||||
SetRow(QString().sprintf("INPUT_%d_LEVEL",port),level);
|
||||
QString sql=QString("update AUDIO_INPUTS set ")+
|
||||
QString().sprintf("LEVEL=%d where ",level)+
|
||||
"STATION_NAME=\""+RDEscapeString(port_station)+"\" && "+
|
||||
QString().sprintf("CARD_NUMBER=%d && ",port_card)+
|
||||
QString().sprintf("PORT_NUMBER=%d",port);
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +170,17 @@ int RDAudioPort::outputPortLevel(int port)
|
||||
if(port<0) {
|
||||
return 400;
|
||||
}
|
||||
return GetIntValue(QString().sprintf("OUTPUT_%d_LEVEL",port));
|
||||
int ret=400;
|
||||
QString sql=QString("select LEVEL from AUDIO_OUTPUTS where ")+
|
||||
"STATION_NAME=\""+RDEscapeString(port_station)+"\" && "+
|
||||
QString().sprintf("CARD_NUMBER=%d && ",port_card)+
|
||||
QString().sprintf("PORT_NUMBER=%d",port);
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
if(q->first()) {
|
||||
ret=q->value(0).toInt();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -145,43 +189,11 @@ void RDAudioPort::setOutputPortLevel(int port,int level)
|
||||
if(port<0) {
|
||||
return;
|
||||
}
|
||||
SetRow(QString().sprintf("OUTPUT_%d_LEVEL",port),level);
|
||||
}
|
||||
|
||||
|
||||
int RDAudioPort::GetIntValue(QString field)
|
||||
{
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
int accum;
|
||||
|
||||
sql=QString().sprintf("select %s from AUDIO_PORTS where \
|
||||
(STATION_NAME=\"%s\")&&(CARD_NUMBER=%d)",(const char *)field,
|
||||
(const char *)port_station,port_card);
|
||||
q=new RDSqlQuery(sql);
|
||||
if(q->first()) {
|
||||
accum=q->value(0).toInt();
|
||||
delete q;
|
||||
return accum;
|
||||
}
|
||||
delete q;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void RDAudioPort::SetRow(QString param,int value)
|
||||
{
|
||||
RDSqlQuery *q;
|
||||
QString sql;
|
||||
|
||||
sql=QString().sprintf("UPDATE AUDIO_PORTS SET %s=%d \
|
||||
WHERE (STATION_NAME=\"%s\")&&(CARD_NUMBER=%d)",
|
||||
(const char *)param,
|
||||
value,
|
||||
(const char *)port_station,
|
||||
port_card);
|
||||
q=new RDSqlQuery(sql);
|
||||
QString sql=QString("update AUDIO_OUTPUTS set ")+
|
||||
QString().sprintf("LEVEL=%d where ",level)+
|
||||
"STATION_NAME=\""+RDEscapeString(port_station)+"\" && "+
|
||||
QString().sprintf("CARD_NUMBER=%d && ",port_card)+
|
||||
QString().sprintf("PORT_NUMBER=%d",port);
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// Abstract a Rivendell Audio Port
|
||||
//
|
||||
// (C) Copyright 2002-2003,2016 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2003,2016-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// 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
|
||||
@@ -28,7 +28,7 @@ class RDAudioPort
|
||||
{
|
||||
public:
|
||||
enum PortType {Analog=0,AesEbu=1,SpDiff=2};
|
||||
RDAudioPort(QString station,int card,bool create=false);
|
||||
RDAudioPort(QString station,int card);
|
||||
QString station() const;
|
||||
int card() const;
|
||||
RDCae::ClockSource clockSource();
|
||||
@@ -43,8 +43,6 @@ class RDAudioPort
|
||||
void setOutputPortLevel(int port,int level);
|
||||
|
||||
private:
|
||||
int GetIntValue(QString field);
|
||||
void SetRow(QString param,int value);
|
||||
QString port_station;
|
||||
int port_card;
|
||||
};
|
||||
|
||||
@@ -540,21 +540,12 @@ int RDStation::cards() const
|
||||
{
|
||||
int n=0;
|
||||
|
||||
QString sql=QString().sprintf("select CARD0_DRIVER,CARD1_DRIVER,\
|
||||
CARD2_DRIVER,CARD3_DRIVER,CARD4_DRIVER,\
|
||||
CARD5_DRIVER,CARD6_DRIVER,CARD7_DRIVER\
|
||||
from STATIONS where NAME=\"%s\"",
|
||||
(const char *)station_name);
|
||||
QString sql=QString("select DRIVER from AUDIO_CARDS where ")+
|
||||
"STATION_NAME=\""+RDEscapeString(station_name)+"\"";
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
if(q->first()) {
|
||||
for(int i=0;i<RD_MAX_CARDS;i++) {
|
||||
if((RDStation::AudioDriver)q->value(i).toInt()!=RDStation::None) {
|
||||
n++;
|
||||
}
|
||||
else {
|
||||
delete q;
|
||||
return n;
|
||||
}
|
||||
while(q->next()) {
|
||||
if((RDStation::AudioDriver)q->value(0).toInt()!=RDStation::None) {
|
||||
n++;
|
||||
}
|
||||
}
|
||||
delete q;
|
||||
@@ -565,16 +556,28 @@ int RDStation::cards() const
|
||||
|
||||
RDStation::AudioDriver RDStation::cardDriver(int cardnum) const
|
||||
{
|
||||
return (RDStation::AudioDriver)
|
||||
RDGetSqlValue("STATIONS","NAME",station_name,
|
||||
QString().sprintf("CARD%d_DRIVER",cardnum)).
|
||||
toInt();
|
||||
RDStation::AudioDriver ret=RDStation::None;
|
||||
QString sql=QString("select DRIVER from AUDIO_CARDS where ")+
|
||||
"STATION_NAME=\""+RDEscapeString(station_name)+"\" && "+
|
||||
QString().sprintf("CARD_NUMBER=%d",cardnum);
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
if(q->first()) {
|
||||
ret=(RDStation::AudioDriver)q->value(0).toInt();
|
||||
}
|
||||
delete q;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void RDStation::setCardDriver(int cardnum,AudioDriver driver) const
|
||||
{
|
||||
SetRow(QString().sprintf("CARD%d_DRIVER",cardnum),(int)driver);
|
||||
QString sql=QString("update AUDIO_CARDS set ")+
|
||||
QString().sprintf("DRIVER=%d where ",driver)+
|
||||
"STATION_NAME=\""+RDEscapeString(station_name)+"\" && "+
|
||||
QString().sprintf("CARD_NUMBER=%d",cardnum);
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
}
|
||||
|
||||
|
||||
@@ -623,40 +626,82 @@ void RDStation::setDriverVersion(AudioDriver driver,QString ver) const
|
||||
|
||||
QString RDStation::cardName(int cardnum) const
|
||||
{
|
||||
return RDGetSqlValue("STATIONS","NAME",station_name,
|
||||
QString().sprintf("CARD%d_NAME",cardnum)).toString();
|
||||
QString ret;
|
||||
QString sql=QString("select NAME from AUDIO_CARDS where ")+
|
||||
"STATION_NAME=\""+RDEscapeString(station_name)+"\" && "+
|
||||
QString().sprintf("CARD_NUMBER=%d",cardnum);
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
if(q->first()) {
|
||||
ret=q->value(0).toString();
|
||||
}
|
||||
delete q;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void RDStation::setCardName(int cardnum,QString name) const
|
||||
{
|
||||
SetRow(QString().sprintf("CARD%d_NAME",cardnum),name);
|
||||
QString sql=QString("update AUDIO_CARDS set ")+
|
||||
"NAME=\""+RDEscapeString(name)+"\" where "+
|
||||
"STATION_NAME=\""+RDEscapeString(station_name)+"\" && "+
|
||||
QString().sprintf("CARD_NUMBER=%d",cardnum);
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
}
|
||||
|
||||
|
||||
int RDStation::cardInputs(int cardnum) const
|
||||
{
|
||||
return RDGetSqlValue("STATIONS","NAME",station_name,
|
||||
QString().sprintf("CARD%d_INPUTS",cardnum)).toInt();
|
||||
int ret=-1;
|
||||
QString sql=QString("select INPUTS from AUDIO_CARDS where ")+
|
||||
"STATION_NAME=\""+RDEscapeString(station_name)+"\" && "+
|
||||
QString().sprintf("CARD_NUMBER=%d",cardnum);
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
if(q->first()) {
|
||||
ret=q->value(0).toInt();
|
||||
}
|
||||
delete q;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void RDStation::setCardInputs(int cardnum,int inputs) const
|
||||
{
|
||||
SetRow(QString().sprintf("CARD%d_INPUTS",cardnum),inputs);
|
||||
QString sql=QString("update AUDIO_CARDS set ")+
|
||||
QString().sprintf("INPUTS=%d where ",inputs)+
|
||||
"STATION_NAME=\""+RDEscapeString(station_name)+"\" && "+
|
||||
QString().sprintf("CARD_NUMBER=%d",cardnum);
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
}
|
||||
|
||||
|
||||
int RDStation::cardOutputs(int cardnum) const
|
||||
{
|
||||
return RDGetSqlValue("STATIONS","NAME",station_name,
|
||||
QString().sprintf("CARD%d_OUTPUTS",cardnum)).toInt();
|
||||
int ret=-1;
|
||||
QString sql=QString("select OUTPUTS from AUDIO_CARDS where ")+
|
||||
"STATION_NAME=\""+RDEscapeString(station_name)+"\" && "+
|
||||
QString().sprintf("CARD_NUMBER=%d",cardnum);
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
if(q->first()) {
|
||||
ret=q->value(0).toInt();
|
||||
}
|
||||
delete q;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void RDStation::setCardOutputs(int cardnum,int outputs) const
|
||||
{
|
||||
SetRow(QString().sprintf("CARD%d_OUTPUTS",cardnum),outputs);
|
||||
QString sql=QString("update AUDIO_CARDS set ")+
|
||||
QString().sprintf("OUTPUTS=%d where ",outputs)+
|
||||
"STATION_NAME=\""+RDEscapeString(station_name)+"\" && "+
|
||||
QString().sprintf("CARD_NUMBER=%d",cardnum);
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
}
|
||||
|
||||
|
||||
@@ -672,6 +717,38 @@ bool RDStation::create(const QString &name,QString *err_msg,
|
||||
addr.setAddress("127.0.0.1");
|
||||
}
|
||||
|
||||
//
|
||||
// Add Audio Cards
|
||||
//
|
||||
for(int i=0;i<RD_MAX_CARDS;i++) {
|
||||
sql=QString("insert into AUDIO_CARDS set ")+
|
||||
"STATION_NAME=\""+RDEscapeString(name)+"\","+
|
||||
QString().sprintf("CARD_NUMBER=%d",i);
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
}
|
||||
|
||||
//
|
||||
// Add Audio Inputs / Outputs
|
||||
//
|
||||
for(int i=0;i<RD_MAX_CARDS;i++) {
|
||||
for(int j=0;j<RD_MAX_PORTS;j++) {
|
||||
sql=QString("insert into AUDIO_INPUTS set ")+
|
||||
"STATION_NAME=\""+RDEscapeString(name)+"\","+
|
||||
QString().sprintf("CARD_NUMBER=%d,",i)+
|
||||
QString().sprintf("PORT_NUMBER=%d",i);
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
|
||||
sql=QString("insert into AUDIO_OUTPUTS set ")+
|
||||
"STATION_NAME=\""+RDEscapeString(name)+"\","+
|
||||
QString().sprintf("CARD_NUMBER=%d,",i)+
|
||||
QString().sprintf("PORT_NUMBER=%d",i);
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
}
|
||||
}
|
||||
|
||||
if(exemplar.isEmpty()) { // Create Blank Host Config
|
||||
sql=QString("insert into STATIONS set ")+
|
||||
"NAME=\""+RDEscapeString(name)+"\","+
|
||||
@@ -1253,41 +1330,6 @@ bool RDStation::create(const QString &name,QString *err_msg,
|
||||
}
|
||||
delete q;
|
||||
|
||||
//
|
||||
// Clone Audio Port Settings
|
||||
//
|
||||
sql=QString("select ")+
|
||||
"CARD_NUMBER," // 00
|
||||
"CLOCK_SOURCE,"; // 01
|
||||
for(int i=0;i<RD_MAX_PORTS;i++) {
|
||||
sql+=QString().sprintf("INPUT_%d_LEVEL,",i)+
|
||||
QString().sprintf("INPUT_%d_MODE,",i)+
|
||||
QString().sprintf("INPUT_%d_TYPE,",i)+
|
||||
QString().sprintf("OUTPUT_%d_LEVEL,",i);
|
||||
}
|
||||
sql=sql.left(sql.length()-1);
|
||||
sql+=QString(" from AUDIO_PORTS where ")+
|
||||
"STATION_NAME=\""+RDEscapeString(exemplar)+"\"";
|
||||
q=new RDSqlQuery(sql);
|
||||
while(q->next()) {
|
||||
sql=QString("insert into AUDIO_PORTS set ")+
|
||||
QString().sprintf("CARD_NUMBER=%u,",q->value(0).toUInt())+
|
||||
QString().sprintf("CLOCK_SOURCE=%d,",q->value(1).toInt())+
|
||||
"STATION_NAME=\""+RDEscapeString(name)+"\",";
|
||||
for(int i=0;i<RD_MAX_PORTS;i++) {
|
||||
sql+=QString().sprintf("INPUT_%d_LEVEL=%d,INPUT_%d_MODE=%d,\
|
||||
INPUT_%d_TYPE=%d,OUTPUT_%d_LEVEL=%d,",
|
||||
i,q->value(2+3*i).toInt(),
|
||||
i,q->value(3+3*i).toInt(),
|
||||
i,q->value(4+3*i).toInt(),
|
||||
i,q->value(5+3*i).toInt());
|
||||
}
|
||||
sql=sql.left(sql.length()-1);
|
||||
q1=new RDSqlQuery(sql);
|
||||
delete q1;
|
||||
}
|
||||
delete q;
|
||||
|
||||
//
|
||||
// Clone the Serial Setups
|
||||
//
|
||||
@@ -1760,7 +1802,7 @@ bool RDStation::create(const QString &name,QString *err_msg,
|
||||
"LOG_RML "+ // 13
|
||||
"from LOG_MACHINES where "+
|
||||
"STATION_NAME=\""+RDEscapeString(exemplar)+"\"";
|
||||
q=new RDSqlQuery(sql,false);
|
||||
q=new RDSqlQuery(sql);
|
||||
while(q->next()) {
|
||||
sql=QString("insert into LOG_MACHINES set ")+
|
||||
"STATION_NAME=\""+RDEscapeString(name)+"\","+
|
||||
@@ -1778,10 +1820,72 @@ bool RDStation::create(const QString &name,QString *err_msg,
|
||||
QString().sprintf("UDP_PORT=%u,",q->value(11).toUInt())+
|
||||
"UDP_STRING=\""+RDEscapeString(q->value(12).toString())+"\","+
|
||||
"LOG_RML=\""+RDEscapeString(q->value(13).toString())+"\"";
|
||||
q1=new RDSqlQuery(sql,false);
|
||||
q1=new RDSqlQuery(sql);
|
||||
delete q1;
|
||||
}
|
||||
delete q;
|
||||
|
||||
//
|
||||
// Clone Audio Cards
|
||||
//
|
||||
sql=QString("select CARD_NUMBER,CLOCK_SOURCE from AUDIO_CARDS where ")+
|
||||
"STATION_NAME=\""+RDEscapeString(exemplar)+"\"";
|
||||
q=new RDSqlQuery(sql);
|
||||
while(q->next()) {
|
||||
sql=QString("update AUDIO_CARDS set ")+
|
||||
QString().sprintf("CLOCK_SOURCE=%d where ",q->value(1).toInt())+
|
||||
"STATION_NAME=\""+RDEscapeString(name)+"\" && "+
|
||||
QString().sprintf("CARD_NUMBER=%d",q->value(0).toInt());
|
||||
q1=new RDSqlQuery(sql);
|
||||
delete q1;
|
||||
}
|
||||
delete q;
|
||||
|
||||
//
|
||||
// Clone Audio Inputs
|
||||
//
|
||||
sql=QString("select ")+
|
||||
"CARD_NUMBER,"+ // 00
|
||||
"PORT_NUMBER,"+ // 01
|
||||
"LEVEL,"+ // 02
|
||||
"TYPE,"+ // 03
|
||||
"MODE "+ // 04
|
||||
"from AUDIO_INPUTS where "+
|
||||
"STATION_NAME=\""+RDEscapeString(exemplar)+"\"";
|
||||
q=new RDSqlQuery(sql);
|
||||
while(q->next()) {
|
||||
sql=QString("update AUDIO_INPUTS set ")+
|
||||
QString().sprintf("LEVEL=%d,",q->value(2).toInt())+
|
||||
QString().sprintf("TYPE=%d,",q->value(3).toInt())+
|
||||
QString().sprintf("MODE=%d where ",q->value(4).toInt())+
|
||||
"STATION_NAME=\""+RDEscapeString(name)+"\" && "+
|
||||
QString().sprintf("CARD_NUMBER=%d && ",q->value(0).toInt())+
|
||||
QString().sprintf("PORT_NUMBER=%d",q->value(1).toInt());
|
||||
q1=new RDSqlQuery(sql);
|
||||
delete q1;
|
||||
}
|
||||
delete q;
|
||||
|
||||
//
|
||||
// Clone Audio Outputs
|
||||
//
|
||||
sql=QString("select ")+
|
||||
"CARD_NUMBER,"+ // 00
|
||||
"PORT_NUMBER,"+ // 01
|
||||
"LEVEL "+ // 02
|
||||
"from AUDIO_OUTPUTS where "+
|
||||
"STATION_NAME=\""+RDEscapeString(exemplar)+"\"";
|
||||
q=new RDSqlQuery(sql);
|
||||
while(q->next()) {
|
||||
sql=QString("update AUDIO_OUTPUTS set ")+
|
||||
QString().sprintf("LEVEL=%d where ",q->value(2).toInt())+
|
||||
"STATION_NAME=\""+RDEscapeString(name)+"\" && "+
|
||||
QString().sprintf("CARD_NUMBER=%d && ",q->value(0).toInt())+
|
||||
QString().sprintf("PORT_NUMBER=%d",q->value(1).toInt());
|
||||
q1=new RDSqlQuery(sql);
|
||||
delete q1;
|
||||
}
|
||||
delete q;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1805,10 +1909,7 @@ void RDStation::remove(const QString &name)
|
||||
(const char *)RDEscapeString(name));
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
sql=QString().sprintf("delete from AUDIO_PORTS where STATION_NAME=\"%s\"",
|
||||
(const char *)RDEscapeString(name));
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
|
||||
sql=QString().sprintf("delete from RECORDINGS where STATION_NAME=\"%s\"",
|
||||
(const char *)RDEscapeString(name));
|
||||
q=new RDSqlQuery(sql);
|
||||
@@ -1943,6 +2044,16 @@ void RDStation::remove(const QString &name)
|
||||
"STATION_NAME=\""+RDEscapeString(name)+"\"";
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
|
||||
sql=QString("delete from AUDIO_INPUT where ")+
|
||||
"STATION_NAME=\""+RDEscapeString(name)+"\"";
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
|
||||
sql=QString("delete from AUDIO_OUTPUTS where ")+
|
||||
"STATION_NAME=\""+RDEscapeString(name)+"\"";
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user