Code Search for Developers
 
 
  

dataflow-split.cpp.texinfo from marsyas at Krugle


Show dataflow-split.cpp.texinfo syntax highlighted

@c Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite
@example
@i{// amplifies the left and right channels separately, and writes them}
@i{// to sound files.}

@b{#include} @t{"MarSystemManager.h"}
@b{using} @b{namespace} std;
@b{using} @b{namespace} Marsyas;

void @b{sfplay}(string sfName, float gain1, float gain2)
@{
       MarSystemManager mng;

       MarSystem* playbacknet = mng.@b{create}(@t{"Series"}, @t{"playbacknet"});
       playbacknet->@b{addMarSystem}(mng.@b{create}(@t{"SoundFileSource"}, @t{"src"}));
       playbacknet->@b{updctrl}(@t{"SoundFileSource/src/mrs_string/filename"}, sfName);
@i{// get the sample rate}
       mrs_real sample_rate = playbacknet->@b{getctrl}(@t{"mrs_real/israte"})->to<mrs_real>();

       playbacknet->@b{addMarSystem}(mng.@b{create}(@t{"SoundFileSink"}, @t{"snk"}));
       playbacknet->@b{updctrl}(@t{"SoundFileSink/snk/mrs_string/filename"}, @t{"both.wav"});

       MarSystem* left = mng.@b{create}(@t{"Series"}, @t{"left"});
       left->@b{addMarSystem}(mng.@b{create}(@t{"Gain"}, @t{"gain1"}));
       left->@b{updctrl}(@t{"Gain/gain1/mrs_real/gain"}, gain1);
       left->@b{addMarSystem}(mng.@b{create}(@t{"SoundFileSink"}, @t{"destL"}));
@i{// set the sample rate of this marsystem:}
       left->@b{updctrl}(@t{"mrs_real/israte"},sample_rate);
       left->@b{updctrl}(@t{"SoundFileSink/destL/mrs_string/filename"}, @t{"left.wav"});

       MarSystem* right = mng.@b{create}(@t{"Series"}, @t{"right"});
       right->@b{addMarSystem}(mng.@b{create}(@t{"Gain"}, @t{"gain2"}));
       right->@b{updctrl}(@t{"Gain/gain2/mrs_real/gain"}, gain2);
       right->@b{addMarSystem}(mng.@b{create}(@t{"SoundFileSink"}, @t{"destR"}));
@i{// set the sample rate of this marsystem:}
       right->@b{updctrl}(@t{"mrs_real/israte"},sample_rate);
       right->@b{updctrl}(@t{"SoundFileSink/destR/mrs_string/filename"}, @t{"right.wav"});

       MarSystem* para = mng.@b{create}(@t{"Parallel"}, @t{"para"});
       para->@b{addMarSystem}(left);
       para->@b{addMarSystem}(right);
       playbacknet->@b{addMarSystem}(para);

       @b{while} ( playbacknet->@b{getctrl}(@t{"SoundFileSource/src/mrs_bool/notEmpty"})->to<mrs_bool>() )
       @{
              playbacknet->@b{tick}();
       @}
       @b{delete} playbacknet;
@}

int @b{main}(int argc, @b{const} char **argv)
@{
       string fileName;
       float gain1, gain2;
       @b{if} (argc<2)
       @{
              cout<<@t{"Please enter filename."}<<endl;
              @b{exit}(1);
       @}
       @b{else}
       @{
              fileName = argv[1];
       @}
       @b{if} (argc<3)
       @{
              gain1 = 1;
       @}
       @b{else}
       @{
              gain1 = @b{atof}(argv[2]);
       @}
       @b{if} (argc<4)
       @{
              gain2 = 1;
       @}
       @b{else}
       @{
              gain2 = @b{atof}(argv[3]);
       @}
       cout << @t{"Splitting stereo file "} << fileName <<
       @t{" into separate files at volumes "} <<gain1 << @t{" and "}<<gain2<<endl;

       @b{sfplay}(fileName,gain1,gain2);
       @b{exit}(0);
@}


@end example



See more files for this project here

marsyas

Marsyas (Music Analysis, Retrieval and Synthesis for Audio Signals) is a framework for developing systems for audio processing. It provides an general architecture for connecting audio, soundfiles, signal processing blocks and machine learning.

Project homepage: http://sourceforge.net/projects/marsyas
Programming language(s): C++
License: other

  backend.cpp.html
  backend.cpp.texinfo
  backend.h.html
  backend.h.texinfo
  commandOptions.cpp.html
  commandOptions.cpp.texinfo
  controls.cpp.html
  controls.cpp.texinfo
  dataflow-split.cpp.html
  dataflow-split.cpp.texinfo
  gettingdata.cpp.html
  gettingdata.cpp.texinfo
  helloworld.cpp.html
  helloworld.cpp.texinfo
  main.cpp.html
  main.cpp.texinfo
  mainwindow.cpp.html
  mainwindow.cpp.texinfo
  mainwindow.h.html
  mainwindow.h.texinfo
  tutorial.pro.html
  tutorial.pro.texinfo
  writefile.cpp.html
  writefile.cpp.texinfo