mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-19 22:48:01 +02:00
Fixed conflict in 'ChangeLog'
Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
commit
6ce6b3ad2b
1
.gitignore
vendored
1
.gitignore
vendored
@ -149,6 +149,7 @@ tests/download_test
|
||||
tests/feed_image_test
|
||||
tests/getpids_test
|
||||
tests/gpio_fuzz_test
|
||||
tests/hpiplayout_test
|
||||
tests/log_unlink_test
|
||||
tests/mcast_recv_test
|
||||
tests/metadata_wildcard_test
|
||||
|
@ -24922,5 +24922,6 @@
|
||||
2024-10-23 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Fixed a bug in 'CopyAudio' Web API service that failed to log the
|
||||
correct error message when the operation failed.
|
||||
2024-10-23 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Incremented the package version to 4.3.0int6.
|
||||
2024-10-23 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added an 'hpiplayout_test' command in 'tests/'.
|
||||
|
@ -58,7 +58,8 @@ volatile static int stream_mutex[HPI_MAX_ADAPTERS][HPI_MAX_STREAMS]=
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
|
||||
#endif
|
||||
|
||||
RDHPIPlayStream::RDHPIPlayStream(RDHPISoundCard *card,QWidget *parent)
|
||||
//RDHPIPlayStream::RDHPIPlayStream(RDHPISoundCard *card,QWidget *parent)
|
||||
RDHPIPlayStream::RDHPIPlayStream(RDHPISoundCard *card,QObject *parent)
|
||||
:QObject(parent),RDWaveFile()
|
||||
{
|
||||
int quan;
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <qobject.h>
|
||||
#include <qwidget.h>
|
||||
//#include <qwidget.h>
|
||||
#include <qstring.h>
|
||||
#include <qdatetime.h>
|
||||
#include <qtimer.h>
|
||||
@ -51,7 +51,8 @@ class RDHPIPlayStream : public QObject,public RDWaveFile
|
||||
public:
|
||||
enum State {Stopped=0,Playing=1,Paused=2};
|
||||
enum Error {Ok=0,NoFile=1,NoStream=2,AlreadyOpen=3};
|
||||
RDHPIPlayStream(RDHPISoundCard *card,QWidget *parent=0);
|
||||
// RDHPIPlayStream(RDHPISoundCard *card,QWidget *parent=0);
|
||||
RDHPIPlayStream(RDHPISoundCard *card,QObject *parent=0);
|
||||
~RDHPIPlayStream();
|
||||
QString errorString(RDHPIPlayStream::Error err);
|
||||
bool formatSupported(RDWaveFile::Format format);
|
||||
|
@ -1,6 +1,6 @@
|
||||
## Makefile.am
|
||||
##
|
||||
## (C) Copyright 2002-2023 Fred Gleason <fredg@paravelsystems.com>
|
||||
## (C) Copyright 2002-2024 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
|
||||
@ -18,8 +18,8 @@
|
||||
##
|
||||
## Use automake to process this into a Makefile.in
|
||||
|
||||
AM_CPPFLAGS = -Wall -I$(top_srcdir)/lib -Wno-strict-aliasing -std=c++11 -fPIC @QT5_CFLAGS@ @MUSICBRAINZ_CFLAGS@ @IMAGEMAGICK_CFLAGS@
|
||||
LIBS = -L$(top_srcdir)/lib
|
||||
AM_CPPFLAGS = -Wall -I$(top_srcdir)/lib -I$(top_srcdir)/rdhpi -Wno-strict-aliasing -std=c++11 -fPIC @QT5_CFLAGS@ @MUSICBRAINZ_CFLAGS@ @IMAGEMAGICK_CFLAGS@
|
||||
LIBS = -L$(top_srcdir)/lib -L$(top_srcdir)/rdhpi
|
||||
MOC = @QT_MOC@
|
||||
|
||||
# The dependency for qt's Meta Object Compiler (moc)
|
||||
@ -40,6 +40,7 @@ noinst_PROGRAMS = audio_convert_test\
|
||||
feed_image_test\
|
||||
getpids_test\
|
||||
gpio_fuzz_test\
|
||||
hpiplayout_test\
|
||||
log_unlink_test\
|
||||
mcast_recv_test\
|
||||
metadata_wildcard_test\
|
||||
@ -105,6 +106,10 @@ getpids_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT5_LIBS@ @MUSICBRAINZ_LIBS@ @IMA
|
||||
dist_gpio_fuzz_test_SOURCES = gpio_fuzz_test.cpp gpio_fuzz_test.h
|
||||
gpio_fuzz_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT5_LIBS@ @MUSICBRAINZ_LIBS@ @IMAGEMAGICK_LIBS@
|
||||
|
||||
dist_hpiplayout_test_SOURCES = hpiplayout_test.cpp hpiplayout_test.h
|
||||
nodist_hpiplayout_test_SOURCES = moc_hpiplayout_test.cpp
|
||||
hpiplayout_test_LDADD = @LIB_RDLIBS@ @LIBHPI@ @LIBVORBIS@ @QT5_LIBS@ @MUSICBRAINZ_LIBS@ @IMAGEMAGICK_LIBS@
|
||||
|
||||
dist_log_unlink_test_SOURCES = log_unlink_test.cpp log_unlink_test.h
|
||||
nodist_log_unlink_test_SOURCES = moc_log_unlink_test.cpp
|
||||
log_unlink_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT5_LIBS@ @MUSICBRAINZ_LIBS@ @IMAGEMAGICK_LIBS@
|
||||
|
142
tests/hpiplayout_test.cpp
Normal file
142
tests/hpiplayout_test.cpp
Normal file
@ -0,0 +1,142 @@
|
||||
// hpiplayout_test.cpp
|
||||
//
|
||||
// Test the Rivendell multicast receiver routines
|
||||
//
|
||||
// (C) Copyright 2018-2021 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
|
||||
// published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public
|
||||
// License along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#include <QApplication>
|
||||
#include <QStringList>
|
||||
|
||||
#include <rdcmd_switch.h>
|
||||
|
||||
#include "hpiplayout_test.h"
|
||||
|
||||
MainObject::MainObject(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
QHostAddress from_addr;
|
||||
int card=0;
|
||||
int port=0;
|
||||
bool ok=false;
|
||||
|
||||
RDCmdSwitch *cmd=new RDCmdSwitch("hpiplayout_test",HPIPLAYOUT_TEST_USAGE);
|
||||
for(unsigned i=0;i<cmd->keys();i++) {
|
||||
if(cmd->key(i)=="--card") {
|
||||
card=cmd->value(i).toInt(&ok);
|
||||
if((!ok)||(card<0)||(card>=HPI_MAX_ADAPTERS)) {
|
||||
fprintf(stderr,"hpiplayout_test: invalid --card\n");
|
||||
exit(1);
|
||||
}
|
||||
cmd->setProcessed(i,true);
|
||||
}
|
||||
if(cmd->key(i)=="--filename") {
|
||||
d_filename=cmd->value(i);
|
||||
cmd->setProcessed(i,true);
|
||||
}
|
||||
if(cmd->key(i)=="--port") {
|
||||
port=cmd->value(i).toInt(&ok);
|
||||
if((!ok)||(port<0)||(port>=HPI_MAX_NODES)) {
|
||||
fprintf(stderr,"hpiplayout_test: invalid --port\n");
|
||||
exit(1);
|
||||
}
|
||||
cmd->setProcessed(i,true);
|
||||
}
|
||||
if(!cmd->processed(i)) {
|
||||
fprintf(stderr,"hpiplayout_test: unknown option \"%s\"\n",
|
||||
cmd->key(i).toUtf8().constData());
|
||||
exit(256);
|
||||
}
|
||||
}
|
||||
if(d_filename.isEmpty()) {
|
||||
fprintf(stderr,"hpiplayout_test: you must provide a \"--filename\"\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
d_rdconfig=new RDConfig();
|
||||
d_rdconfig->load();
|
||||
|
||||
d_soundcard=new RDHPISoundCard(d_rdconfig,this);
|
||||
d_wavedata=new RDWaveData();
|
||||
d_playstream=new RDHPIPlayStream(d_soundcard,this);
|
||||
connect(d_playstream,SIGNAL(isStopped(bool)),this,SLOT(isStoppedData(bool)));
|
||||
connect(d_playstream,SIGNAL(played()),this,SLOT(playedData()));
|
||||
connect(d_playstream,SIGNAL(stopped()),this,SLOT(stoppedData()));
|
||||
connect(d_playstream,SIGNAL(paused()),this,SLOT(pausedData()));
|
||||
connect(d_playstream,SIGNAL(position(int)),this,SLOT(positionData(int)));
|
||||
connect(d_playstream,SIGNAL(stateChanged(int,int,int)),
|
||||
this,SLOT(stateChangedData(int,int,int)));
|
||||
|
||||
d_playstream->setCard(card);
|
||||
if(d_playstream->openWave(d_filename)!=RDHPIPlayStream::Ok) {
|
||||
fprintf(stderr,"hpiplayout_test: failed to open \"%s\"\n",
|
||||
d_filename.toUtf8().constData());
|
||||
exit(1);
|
||||
}
|
||||
printf("card: %d stream: %d\n",d_playstream->getCard(),
|
||||
d_playstream->getStream());
|
||||
d_soundcard->setOutputVolume(card,d_playstream->getStream(),port,0);
|
||||
d_playstream->play();
|
||||
}
|
||||
|
||||
|
||||
void MainObject::isStoppedData(bool state)
|
||||
{
|
||||
printf("isStopped(%u)\n",state);
|
||||
if(state) {
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainObject::playedData()
|
||||
{
|
||||
printf("played()\n");
|
||||
}
|
||||
|
||||
|
||||
void MainObject::pausedData()
|
||||
{
|
||||
printf("isPaused()\n");
|
||||
}
|
||||
|
||||
|
||||
void MainObject::stoppedData()
|
||||
{
|
||||
printf("stopped()\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
void MainObject::positionData(int samples)
|
||||
{
|
||||
printf("position(%d)\n",samples);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MainObject::stateChangedData(int card,int stream,int state)
|
||||
{
|
||||
printf("stateChanged(%d,%d,%d)\n",card,stream,state);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
QApplication a(argc,argv,false);
|
||||
new MainObject();
|
||||
return a.exec();
|
||||
}
|
60
tests/hpiplayout_test.h
Normal file
60
tests/hpiplayout_test.h
Normal file
@ -0,0 +1,60 @@
|
||||
// hpiplayout_test.h
|
||||
//
|
||||
// Test the Rivendell HPI playout routines
|
||||
//
|
||||
// (C) Copyright 2024 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
|
||||
// published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public
|
||||
// License along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#ifndef HPIPLAYOUT_TEST_H
|
||||
#define HPIPLAYOUT_TEST_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "rdconfig.h"
|
||||
#include "rdwavefile.h"
|
||||
|
||||
#include "rdhpiplaystream.h"
|
||||
#include "rdhpisoundcard.h"
|
||||
|
||||
#define HPIPLAYOUT_TEST_USAGE "[options]\n\nTest the Rivendell HPI play-out routines\n\nOptions are:\n--filename=<filename>\n WAV file to play\n\n--card=<card-num>\n Card number [0-15]\n\n--port=<port-num>\n Port number [0-16]\n\n"
|
||||
|
||||
class MainObject : public QObject
|
||||
{
|
||||
Q_OBJECT;
|
||||
public:
|
||||
MainObject(QObject *parent=0);
|
||||
|
||||
private slots:
|
||||
void isStoppedData(bool state);
|
||||
void playedData();
|
||||
void pausedData();
|
||||
void stoppedData();
|
||||
void positionData(int samples);
|
||||
void stateChangedData(int card,int stream,int state);
|
||||
|
||||
private:
|
||||
QString d_filename;
|
||||
int d_card;
|
||||
int d_stream;
|
||||
int d_port;
|
||||
RDHPISoundCard *d_soundcard;
|
||||
RDHPIPlayStream *d_playstream;
|
||||
RDWaveData *d_wavedata;
|
||||
RDConfig *d_rdconfig;
|
||||
};
|
||||
|
||||
|
||||
#endif // HPIPLAYOUT_TEST_H
|
Loading…
x
Reference in New Issue
Block a user