Csound and CsoundAC API  5.17
Public Member Functions | Data Fields | Protected Member Functions | Static Protected Member Functions | Protected Attributes
csound::ImageToScore Class Reference

Translates images in various RGB formats to scores. More...

#include <ImageToScore.hpp>

+ Inheritance diagram for csound::ImageToScore:

Public Member Functions

virtual void addChild (Node *node)
virtual void clear ()
virtual Eigen::MatrixXd createTransform ()
virtual double & element (size_t row, size_t column)
 Returns a reference to the indicated element of the local transformation of coordinate system.
virtual void generate ()
virtual std::string getImageFilename () const
virtual Eigen::MatrixXd getLocalCoordinates () const
 Returns the local transformation of coordinate system.
virtual size_t getMaximumVoiceCount () const
virtual double getMinimumValue () const
virtual ScoregetScore ()
 ImageToScore (void)
virtual void produceOrTransform (Score &collectingScore, size_t beginAt, size_t endAt, const Eigen::MatrixXd &coordinates)
 This function is called by the traverse() function.
virtual void setElement (size_t row, size_t column, double value)
 Sets the indicated element of the local transformation of coordinate system.
virtual void setImageFilename (std::string imageFilename)
virtual void setMaximumVoiceCount (size_t maximumVoiceCount)
virtual void setMinimumValue (double minimumValue)
virtual Eigen::MatrixXd traverse (const Eigen::MatrixXd &globalCoordinates, Score &score)
 The default implementation postconcatenates its own local coordinate system with the global coordinates, then passes the score and the product of coordinate systems to each child, thus performing a depth-first traversal of the music graph.
virtual ~ImageToScore (void)

Data Fields

std::vector< Node * > children
 Child Nodes, if any.
double duration
 If not 0, the score is rescaled to this duration.
std::string importFilename

Protected Member Functions

virtual void getPixel (size_t x, size_t y, double &hue, double &saturation, double &value) const
virtual void translate (double x, double y, double hue, double value, Event &event) const

Static Protected Member Functions

static void rgbToHsv (double r, double g, double b, double &h, double &s, double &v)

Protected Attributes

Fl_Image * image
std::string imageFilename
Eigen::MatrixXd localCoordinates
size_t maximumVoiceCount
double minimumValue
Score score

Detailed Description

Translates images in various RGB formats to scores.

Hue is mapped to instrument, value is mapped to loudness.

Constructor & Destructor Documentation

csound::ImageToScore::ImageToScore ( void  )
virtual csound::ImageToScore::~ImageToScore ( void  )
virtual

Member Function Documentation

virtual void csound::Node::addChild ( Node node)
virtualinherited
virtual void csound::Node::clear ( )
virtualinherited
virtual Eigen::MatrixXd csound::Node::createTransform ( )
virtualinherited
virtual double& csound::Node::element ( size_t  row,
size_t  column 
)
virtualinherited

Returns a reference to the indicated element of the local transformation of coordinate system.

virtual void csound::ImageToScore::generate ( )
virtual
virtual std::string csound::ImageToScore::getImageFilename ( ) const
virtual
virtual Eigen::MatrixXd csound::Node::getLocalCoordinates ( ) const
virtualinherited

Returns the local transformation of coordinate system.

virtual size_t csound::ImageToScore::getMaximumVoiceCount ( ) const
virtual
virtual double csound::ImageToScore::getMinimumValue ( ) const
virtual
virtual void csound::ImageToScore::getPixel ( size_t  x,
size_t  y,
double &  hue,
double &  saturation,
double &  value 
) const
protectedvirtual
virtual Score& csound::ScoreNode::getScore ( )
virtualinherited
virtual void csound::ScoreNode::produceOrTransform ( Score collectingScore,
size_t  beginAt,
size_t  endAt,
const Eigen::MatrixXd &  compositeCordinates 
)
virtualinherited

This function is called by the traverse() function.

The default implementation does nothing. If a derived node produces new Events, then it must transform them by the composite coordinates, then append them to the collecting score. If a derived node transforms Events produced by child Nodes, then it must transform only Events in the collecting score starting at the startAt index and continuing up to, but not including, the endAt index. These bookmarks, in turn, must be set in the Traverse function by all Nodes that produce events.

Reimplemented from csound::Node.

Reimplemented in csound::Cell, csound::MCRM, and csound::Rescale.

static void csound::ImageToScore::rgbToHsv ( double  r,
double  g,
double  b,
double &  h,
double &  s,
double &  v 
)
staticprotected
virtual void csound::Node::setElement ( size_t  row,
size_t  column,
double  value 
)
virtualinherited

Sets the indicated element of the local transformation of coordinate system.

virtual void csound::ImageToScore::setImageFilename ( std::string  imageFilename)
virtual
virtual void csound::ImageToScore::setMaximumVoiceCount ( size_t  maximumVoiceCount)
virtual
virtual void csound::ImageToScore::setMinimumValue ( double  minimumValue)
virtual
virtual void csound::ImageToScore::translate ( double  x,
double  y,
double  hue,
double  value,
Event event 
) const
protectedvirtual
virtual Eigen::MatrixXd csound::Node::traverse ( const Eigen::MatrixXd &  globalCoordinates,
Score score 
)
virtualinherited

The default implementation postconcatenates its own local coordinate system with the global coordinates, then passes the score and the product of coordinate systems to each child, thus performing a depth-first traversal of the music graph.

Reimplemented in csound::Koch, csound::Stack, csound::Intercut, csound::Hocket, and csound::Sequence.

Field Documentation

std::vector<Node *> csound::Node::children
inherited

Child Nodes, if any.

double csound::ScoreNode::duration
inherited

If not 0, the score is rescaled to this duration.

Fl_Image* csound::ImageToScore::image
protected
std::string csound::ImageToScore::imageFilename
protected
std::string csound::ScoreNode::importFilename
inherited
Eigen::MatrixXd csound::Node::localCoordinates
protectedinherited
size_t csound::ImageToScore::maximumVoiceCount
protected
double csound::ImageToScore::minimumValue
protected
Score csound::ScoreNode::score
protectedinherited