Code Search for Developers
 
 
  

controls.cpp.texinfo from marsyas at Krugle


Show controls.cpp.texinfo syntax highlighted

@c Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite
@example
@b{#include} @t{"MarSystemManager.h"}
@b{using} @b{namespace} std;
@b{using} @b{namespace} Marsyas;

void @b{sfplay}(string sfName, float gain, float start)
@{
       MarSystemManager mng;

       MarSystem* playbacknet = mng.@b{create}(@t{"Series"}, @t{"playbacknet"});

       playbacknet->@b{addMarSystem}(mng.@b{create}(@t{"SoundFileSource"}, @t{"src"}));
       playbacknet->@b{addMarSystem}(mng.@b{create}(@t{"Gain"}, @t{"gt"}));
       playbacknet->@b{addMarSystem}(mng.@b{create}(@t{"AudioSink"}, @t{"dest"}));

@i{// calculate the starting position.}
       mrs_natural nChannels = playbacknet->@b{getctrl}(@t{"SoundFileSource/src/mrs_natural/nChannels"})->to<mrs_natural>();
       mrs_real srate = playbacknet->@b{getctrl}(@t{"SoundFileSource/src/mrs_real/israte"})->to<mrs_real>();
       mrs_natural startPosition = (mrs_natural) (start * srate * nChannels);

       playbacknet->@b{updctrl}(@t{"SoundFileSource/src/mrs_string/filename"}, sfName);
       playbacknet->@b{updctrl}(@t{"Gain/gt/mrs_real/gain"}, gain);
       playbacknet->@b{updctrl}(@t{"AudioSink/dest/mrs_bool/initAudio"}, @b{true});

@i{// set the starting position of the source}
       playbacknet->@b{updctrl}(@t{"SoundFileSource/src/mrs_natural/pos"}, startPosition);

       @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 gain, start;
       @b{if} (argc<2)
       @{
              cout<<@t{"Please enter filename."}<<endl;
              @b{exit}(1);
       @}
       @b{else}
       @{
              fileName = argv[1];
       @}
       @b{if} (argc<3)
       @{
              gain = 1;
       @}
       @b{else}
       @{
              gain = @b{atof}(argv[2]);
       @}
       @b{if} (argc<4)
       @{
              start = 0;
       @}
       @b{else}
       @{
              start = @b{atof}(argv[3]);
       @}
       cout << @t{"Playing file "} << fileName << @t{" at volume "} <<
       gain << @t{" starting at "} << start << @t{" seconds"} << endl;

       @b{sfplay}(fileName,gain,start);
       @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