[CLAM] What's wrong with my code
Stephane THOMAS
sthomas at nerim.net
Mon Dec 15 11:52:31 PST 2008
Hi,
On Sun, 14 Dec 2008 19:04:50 +0100
David García Garzón <dgarcia at iua.upf.edu> wrote:
> > 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.
Yes the message is repeated all the time.
> 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.
Yes. I know that. Currently I'm doing all my test with the same audio (wav) file that I know to be a stereo one.
> 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).
Other audio apps (including NetworkEditor) are running fine with JACK. I wasn't able to build "the like"... (Turnaround, etc...)
> Sorry for not being that helpful.
No problem, I'm happy to get an answer to my newbie questions...
> 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.
I'm not sure to understand. What do you call an "automatic member" ?
Many thanks for your help. I'll try to rewrite my example using the portaudio backend so I can tell if the issue is related to the JACK backend.
Stef
> 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
>
More information about the clam-users
mailing list