[CLAM] Need help
sthomas at nerim.net
Wed Dec 10 08:53:52 PST 2008
I try to modify the example program
I want to use a MultiChannelAudioFileReader instead of the mono one, and use JACKNetworkPlayer instead of the PortAudio player.
works fine with the MonoAudioFileReader.
But I want to use a multi-channel reader (to play a stereo file) so my code becomes :
int error(const std::string & msg)
std::cerr << msg << std::endl;
int main(int argc, char ** argv)
if (argc!=2) return error ("needs a filename.");
std::string reader = network.AddProcessing("MultiChannelAudioFileReader");
// Configure the reader
if (!network.ConfigureProcessing(reader, cfg))
return error("Could not open the file");
int length = ((CLAM::MultiChannelAudioFileReader &) network.GetProcessing(reader)).GetHeader().GetLength()/1000;
// Add an audio sink and connect its input to the reader's output
std::string sinkL = network.AddProcessing("AudioSink");
std::string sinkR = network.AddProcessing("AudioSink");
network.ConnectPorts(reader+".Channel #0", sinkL+".AudioIn");
network.ConnectPorts(reader+".Channel #1", sinkR+".AudioIn");
// Set the audio backend to PortAudio
// What's about JACK ?
I can see a JACK client in qjackctl, if I connect it I have the audio file played crackling...
In the console output I have this error message repeated:
Warning: 2 sinks were not fed, so could not send audio to the callback.
What's wrong ?
PS: I have been able to ouput sound correctly in JACK with another program I made. But I had some strange behaviors, that's why I first want to try to modify this example...
PPS: When using the original example with portaudio, the sound output is pitched up, I guess there is a bitrate problem...(48000 vs 44100)
More information about the clam-users