Here is the modified code to compile in SVN version of CLAM, using
SendFloatToInControl(), plus a SConstruct...
Best regards,
Natanael.
El 10/13/2009 12:02 PM, Pau Arumí escribió:
El dt 13 de 10 de 2009 a les 10:52 +0200, en/na Eugenio Rustico va
escriure:
Please note I'm using verison 1.2 (on Hardy). However, I had
occasionally the same problem on my laptop, where 1.3 is installed
(on
Jaunty)
I see that your code uses GetInControl("...").DoControl(...) which means
that you use a clam version prior to the TypedControls refactoring (I
don't remember if that made into 1.3 or not).
Since we are trying to fix a bug I recommend you to use the last
subversion revision (we keep try to keep it stable)
Just use this helper function in Processing.hxx
/**
* Tries to send a float to an inaccessible InControl, this is kept for
compatibility
* This function uses the InControl's name to identify it.
* @pre The type of the control is Float
*/
void SendFloatToInControl(Processing & receiver, const std::string &
inControlName, float value);
We have just reproduced your results here! and i'm very surprised of
that, because NE only adds a user interface to the jack process, nothing
else. We'll investigate further and get back to you.
Thanks for your feedback
P
ps: Yes the clam ml is down, to be fixed (and moved to another hosting).
However clam-devel is the relevant list.
_______________________________________________
Clam-devel mailing list
[email protected]
https://llistes.projectes.lafarga.org/cgi-bin/mailman/listinfo/clam-devel
#include <CLAM/Network.hxx>
#include <CLAM/JACKNetworkPlayer.hxx>
#include <CLAM/MultiChannelAudioFileReader.hxx>
#include <CLAM/RunTimeLadspaLibraryLoader.hxx>
int error(const std::string & msg)
{
std::cerr << msg << std::endl;
return -1;
}
int main(int argc, char ** argv)
{
if (argc!=2) return error (" Please specify a filename.");
// Load LADSPA plugins library (we need it for the dj_eq module)
RunTimeLadspaLibraryLoader ladspaLoader;
ladspaLoader.Load();
CLAM::Network network;
std::string reader = network.AddProcessing("MultiChannelAudioFileReader"); // Stereo file reader
std::string sink1 = network.AddProcessing("AudioSink"); // Left channel sink
std::string sink2 = network.AddProcessing("AudioSink"); // Right channel sink
std::string djeq = network.AddProcessing("dj_eq1"); // Stereo equalizer
// Configure the reader
CLAM::MultiChannelAudioFileReaderConfig cfg;
cfg.SetSourceFile(argv[1]);
//cfg.SetSourceFile("../my_file.wav");
if (!network.ConfigureProcessing(reader, cfg))
return error("Could not open the file");
// Compute audio file length in seconds
int length = ((CLAM::MultiChannelAudioFileReader &) network.GetProcessing(reader)).GetHeader().GetLength()/1000;
// Print length, just to inform user
printf(" File samples: %g\n", ((CLAM::MultiChannelAudioFileReader &) network.GetProcessing(reader)).GetHeader().GetLength());
printf(" Length (secs): %d\n", length);
// Connect ports
network.ConnectPorts(reader+".Channel #0", djeq+".Input L");
network.ConnectPorts(reader+".Channel #1", djeq+".Input R");
network.ConnectPorts(djeq+".Output L", sink1+".1");
network.ConnectPorts(djeq+".Output R", sink2+".1");
// Set the audio backend to Jack. Assuming Jack audio server is running
CLAM::JACKNetworkPlayer *Jnp = new CLAM::JACKNetworkPlayer();
network.SetPlayer(Jnp);
printf(" Press [Enter] to start network and autoconnect\n");
getchar();
network.Start();
// Make Jack autoconnect sinks to default playback channels
Jnp->AutoConnectPorts();
printf(" Press [Enter] to set first preset (low cutoff)\n");
getchar();
// Change DJEQ controls
CLAM::SendFloatToInControl(network.GetProcessing(djeq),"Lo gain (dB)",-70.0F);
CLAM::SendFloatToInControl(network.GetProcessing(djeq),"Mid gain (dB)",0.0F);
CLAM::SendFloatToInControl(network.GetProcessing(djeq),"Hi gain (dB)",6.0F);
printf(" Press [Enter] to set second preset (med boost)\n");
getchar();
// Let's play a bit
CLAM::SendFloatToInControl(network.GetProcessing(djeq),"Lo gain (dB)",-14.0F);
CLAM::SendFloatToInControl(network.GetProcessing(djeq),"Mid gain (dB)",6.0F);
CLAM::SendFloatToInControl(network.GetProcessing(djeq),"Hi gain (dB)",-14.0F);
printf(" Press [Enter] to set third preset (low boost, high cutoff)\n");
getchar();
CLAM::SendFloatToInControl(network.GetProcessing(djeq),"Lo gain (dB)",6.0F);
CLAM::SendFloatToInControl(network.GetProcessing(djeq),"Mid gain (dB)",-10.0F);
CLAM::SendFloatToInControl(network.GetProcessing(djeq),"Hi gain (dB)",-70.0F);
printf(" Press [Enter] to stop network and exit\n");
getchar();
network.Stop();
printf(" ...done. Bye!\n");
}
import os, glob, sys
options = Options('options.cache', ARGUMENTS)
options.Add(PathOption('clam_prefix', 'The prefix where CLAM was installed',
''))
env = Environment(ENV=os.environ, options=options)
options.Save('options.cache', env)
Help(options.GenerateHelpText(env))
env.SConsignFile() # Single signature file
CLAMInstallDir = env['clam_prefix']
clam_sconstoolspath = os.path.join(CLAMInstallDir,'share','clam','sconstools')
env.Tool('clam', toolpath=[clam_sconstoolspath])
env.EnableClamModules([
'clam_core',
'clam_audioio',
'clam_processing',
] , CLAMInstallDir)
mainSources = {
'MyProgram' :'./main.cxx',
}
if sys.platform=='win32' :
env.Append(CPPFLAGS=['-D_USE_MATH_DEFINES']) # to have M_PI defined
if sys.platform=='linux2' :
env.Append( CCFLAGS=['-g','-O3','-Wall'] )
programs = [ env.Program(target=program, source = [main] )
for program, main in mainSources.items()]
env.Default(programs)
_______________________________________________
Clam-devel mailing list
[email protected]
https://llistes.projectes.lafarga.org/cgi-bin/mailman/listinfo/clam-devel