[Clam-devel] embedded networks api : ask for proposals
Pau Arumi
parumi at iua.upf.edu
Thu Apr 5 13:30:25 PDT 2007
En/na Pau Arumi ha escrit:
>
> Zach,
> before going into UI and any further or in i'd like to define the
> network API for embedded networks, and have working test cases.
> So to start, if you take a look at this network test (copied below):
> CLAM/test/FunctionalTests/ProcessingTests/TestStreamingSMSAnalysisSynthesis.cxx
>
>
> In order to discuss the API, how would you re-write this test in order
> to have the Analysis in a subnetwork?
>
> I think the first test to implement shouldn't be this one, but
> networks with audioports only.
>
> pau
this is my proposal. Note the use of Network::AddSubNetwork and the way
to create "virtual" in/our ports using sources/sink processings.
void testAnalysisSynthesisInaNetwork()
{
CLAM::Network net;
CLAM::Network anaysisNetwork;
CLAM::FreewheelingNetworkPlayer * player = new
CLAM::FreewheelingNetworkPlayer;
net.SetPlayer( player ); // network owns the player memory
analysisNetwork.AddProcessing( "Source", new CLAM::AudioSource );
analysisNetwork.AddProcessing( "Sink", new CLAM::SinPeaksSink );
analysisNetwork.AddProcessing( "Analysis", new CLAM::SMSAnalysisCore );
analysisNetwork.ConnectPorts( "Source.AudioOut", "Analysis.Input
Audio" );
analysisNetwork.ConnectPorts( "Analysis.Sinusoidal Peaks",
"Sink.Sinusoidal Peaks" );
analysisNetwork.ConfigureProcessing("Analysis",
helperAnalysisConfigInstance() );
net.AddProcessing( "Source", new CLAM::AudioSource );
net.AddProcessing( "Sink", new CLAM::AudioSink );
net.AddProcessing( "Synthesis", new CLAM::SMSSynthesis );
net.AddSubNetwork( "AnalysisNetwork", analysisNetwork );
net.ConnectPorts("Source.AudioOut", "AnalysisNetwork.Source");
//note the use of the source/sink name identifyer.
net.ConnectPorts("AnalysisNetwork.Sink", "Synthesis.InputSinPeaks");
net.ConnectPorts("Analysis.Residual Spectrum",
"Synthesis.InputResSpectrum");
net.ConnectPorts("Synthesis.OutputAudio", "Sink.AudioIn");
net.ConfigureProcessing("Synthesis", helperSynthesisConfigInstance() );
... the rest is the same as the original...
> void testAnalysisSynthesisInaNetwork()
> {
> CLAM::Network net;
> CLAM::FreewheelingNetworkPlayer * player = new
> CLAM::FreewheelingNetworkPlayer;
> net.SetPlayer( player ); // network owns the player memory
>
> net.AddProcessing( "Source", new CLAM::AudioSource );
> net.AddProcessing( "Sink", new CLAM::AudioSink );
> net.AddProcessing( "Analysis", new CLAM::SMSAnalysisCore );
> net.AddProcessing( "Synthesis", new CLAM::SMSSynthesis );
>
> net.ConnectPorts("Source.AudioOut", "Analysis.Input Audio");
> net.ConnectPorts("Analysis.Sinusoidal Peaks",
> "Synthesis.InputSinPeaks");
> net.ConnectPorts("Analysis.Residual Spectrum",
> "Synthesis.InputResSpectrum");
> net.ConnectPorts("Synthesis.OutputAudio", "Sink.AudioIn");
> net.ConfigureProcessing("Analysis", helperAnalysisConfigInstance() );
> net.ConfigureProcessing("Synthesis", helperSynthesisConfigInstance() );
>
> std::string inputFile = GetTestDataDirectory("Elvis.wav");
> std::string baseOutputFile =
> GetTestDataDirectory("SMSTests/out_sms_net_stream");
> player->InputFile(inputFile);
> player->OutputFile(baseOutputFile+"_result.wav");
> net.Start();
> net.Stop();
>
> std::string whyDifferents;
> bool equals=helperCompareTwoAudioFiles(
> baseOutputFile+".wav", baseOutputFile+"_result.wav",
> whyDifferents);
> CPPUNIT_ASSERT_MESSAGE(whyDifferents, equals);
> }
>
> _______________________________________________
> Clam-devel mailing list
> Clam-devel at llistes.projectes.lafarga.org
> https://llistes.projectes.lafarga.org/cgi-bin/mailman/listinfo/clam-devel
More information about the clam-devel
mailing list