Code Search for Developers
 
 
  

backend.cpp.texinfo from marsyas at Krugle


Show backend.cpp.texinfo syntax highlighted

@c Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite
@example
@i{/*}
@i{** Copyright (C) 2007 Graham Percival }@t{<gperciva@@uvic.ca>}
@i{**       }
@i{** This program is free software; you can redistribute it and/or modify}
@i{** it under the terms of the GNU General Public License as published by}
@i{** the Free Software Foundation; either version 2 of the License, or}
@i{** (at your option) any later version.}
@i{** }
@i{** This program is distributed in the hope that it will be useful,}
@i{** but WITHOUT ANY WARRANTY; without even the implied warranty of}
@i{** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the}
@i{** GNU General Public License for more details.}
@i{** }
@i{** You should have received a copy of the GNU General Public License}
@i{** along with this program; if not, write to the Free Software }
@i{** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.}
@i{*/}

@b{#include} @t{"backend.h"}
@i{//using namespace Marsyas;}

MarBackend::@b{MarBackend}()
@{
@i{// make a typical Marsyas network:}
       MarSystemManager mng;
       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{"gain"}));
       playbacknet->@b{addMarSystem}(mng.@b{create}(@t{"AudioSink"}, @t{"dest"}));
       playbacknet->@b{updctrl}(@t{"AudioSink/dest/mrs_bool/initAudio"}, @b{true});

@i{// wrap it up to make it pretend to be a Qt object:}
       mrsWrapper = @b{new} @b{MarSystemQtWrapper}(playbacknet);
       mrsWrapper->@b{start}();

@i{// make these pomrs_naturalers so that we can mrs_naturalerface with the network}
@i{// in a thread-safe manner:}
       filenamePtr = mrsWrapper->@b{getctrl}(@t{"SoundFileSource/src/mrs_string/filename"});
       gainPtr = mrsWrapper->@b{getctrl}(@t{"Gain/gain/mrs_real/gain"});
       positionPtr = mrsWrapper->@b{getctrl}(@t{"SoundFileSource/src/mrs_natural/pos"});

@i{// demonstrates information flow:  Marsyas->Qt.}
       QTimer *timer = @b{new} @b{QTimer}(@b{this});
       @b{connect}(timer, @b{SIGNAL}(@b{timeout}()), @b{this}, @b{SLOT}(@b{getBackendPosition}()));
       timer->@b{start}(1000);
@}

MarBackend::~@b{MarBackend}()
@{
       @b{delete} mrsWrapper;
       @b{delete} playbacknet;
@}

void MarBackend::@b{openBackendSoundfile}(string fileName)
@{
       mrsWrapper->@b{updctrl}(filenamePtr,fileName);
       mrsWrapper->@b{play}();
@}

void MarBackend::@b{setBackendVolume}(mrs_natural vol)
@{
       mrs_real newGain = vol/100.0;
       mrsWrapper->@b{updctrl}(gainPtr, newGain);
@}

void MarBackend::@b{getBackendPosition}()
@{
       mrs_natural newPos = (mrs_natural) positionPtr->to<mrs_natural>();
       emit @b{changedBackendPosition}(newPos);
@}


@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