[CLAM] What's wrong with my code
David García Garzón
dgarcia at iua.upf.edu
Sun Dec 14 10:04:50 PST 2008
I am sorry, the jack setup in my box is not working at all and i am not able
to test your program. By reading it, it seems correct (besides a memory
management issue i explain bellow)
> Warning: 2 sinks were not fed, so could not send audio to the callback.
This messages is also painless provided that it is only shown a couple of
times. Normally it means that you have to execute the network a couple of
times to produce the first output. But if the message displays all the time,
then it could be a problem of unfeeded input which seems not likely.
Notice that the connection will fail silently when the file is mono. Check
CanConnectPorts before actually connecting them or use CLAM::ConnectPorts
instead of CLAM::Network::ConnectPorts so you can get a nice exception. Also
the configuration might fail. Whatever the case, the Network has several
methods to do the diagnose when it can be played or not.
If the network is sounding but badly, then please, check whether other jack
applications work and if they do, check whether provided CLAM examples work
with jack (NetworkEditor and the like).
Sorry for not being that helpful.
The memory management issue: notice that the network takes ownership of the
added processings so you cannot make the processings automatic members of your
objects. Anyway that should not cause the problem you were reporting.
On Dimecres 10 Desembre 2008 18:54:07 Stephane THOMAS wrote:
> Hi,
>
> Here is another program I wrote from scratch (the goal is to get a command
> line program which plays a stereo file through JACK)
>
> It produces sound, but once again, I have a repeated error message and the
> sound is awful :
>
> Warning: 2 sinks were not fed, so could not send audio to the callback.
>
> The program is called cjap (for CLAM JACK Audio Player), here is the code :
>
> -----------cjap.h--------------
> #include <QObject>
> #include "CLAM/Network.hxx"
> #include "CLAM/AudioSink.hxx"
> #include "CLAM/MultiChannelAudioFileReader.hxx"
> #include "CLAM/JACKNetworkPlayer.hxx"
>
> using namespace std;
> using namespace CLAM;
>
>
> class JackAudioFilePlayer : QObject
> {
> Q_OBJECT
> Network network;
> AudioSink sinkL;
> AudioSink sinkR;
> MultiChannelAudioFileReader reader;
> MultiChannelAudioFileReaderConfig config;
> JACKNetworkPlayer player;
>
> public:
> JackAudioFilePlayer ();
> void loadfile (string filename);
>
> public slots:
> void play ();
> void stop ();
> };
> ---------------------------------
>
> -------------cjap.cpp------------------
> #include "cjap.h"
>
> JackAudioFilePlayer::JackAudioFilePlayer ()
> {
> network.AddProcessing("left",&sinkL);
> network.AddProcessing("right",&sinkR);
> network.AddProcessing("reader",&reader);
> }
>
> void JackAudioFilePlayer::loadfile (string filename)
> {
> config.SetSourceFile(filename);
> reader.Configure (config);
> network.ConnectPorts("reader.Channel #0","left.AudioIn");
> network.ConnectPorts("reader.Channel #1","right.AudioIn");
> network.SetPlayer (&player);
> }
>
> void JackAudioFilePlayer::play ()
> {
> network.Start();
> }
>
> void JackAudioFilePlayer::stop ()
> {
> network.Stop();
> }
> ------------------------------------------
> ----------main.cpp-----------------------
> #include <iostream>
> #include <QCoreApplication>
> #include "cjap.h"
>
> using namespace std;
>
>
> int main (int argc, char** argv)
> {
> QCoreApplication app (argc,argv);
>
> if (argc != 2)
> {
> cout << "Usage: cjap <filename>" << endl;
> return 0;
> }
> else
> {
> JackAudioFilePlayer* jafp = new JackAudioFilePlayer;
> jafp->loadfile(argv[1]);
> jafp->play();
> }
>
>
> return app.exec();
> }
> ________________________________________
>
> Stef
>
> _______________________________________________
> CLAM mailing list
> CLAM at iua.upf.es
> http://clam.iua.upf.edu
--
David García Garzón
(Work) dgarcia at iua dot upf anotherdot es
http://www.iua.upf.edu/~dgarcia
More information about the clam-users
mailing list