Home Hierarchy Members Alphabetical Related Pages

AudioClip Class Reference
[Standard Node Types]

#include <audioclip.h>

Inherits Node.

List of all members.

Public Member Functions

 AudioClip (const char *name="")
virtual ~AudioClip ()
virtual unsigned int nbFields () const
virtual FieldHandle field (const std::string &n)
virtual FieldHandle field (unsigned int i)
virtual bool isSetToDefaultValue (unsigned int i) const
virtual unsigned int nbEventsIn () const
virtual EventInHandle eventIn (const std::string &n)
virtual EventInHandle eventIn (unsigned int i)
virtual unsigned int nbEventsOut () const
virtual EventOutHandle eventOut (const std::string &n)
virtual EventOutHandle eventOut (unsigned int i)
const char * typeName () const
virtual Nodeduplicate () const
virtual Nodeduplicate (std::map< const Node *, Node * > &) const

Public Attributes

Exposed Fields
A field that is capable of receiving events via an eventIn to change its value(s), and generating events via an eventOut when its value(s) change.

SFString description
SFBool loop
SFFloat pitch
SFTime startTime
SFTime stopTime
MFString url
Events In
EventIn< SFStringset_description
EventIn< SFBoolset_loop
EventIn< SFFloatset_pitch
EventIn< SFTimeset_startTime
EventIn< SFTimeset_stopTime
EventIn< MFStringset_url
Events Out
EventOut< SFTimeduration_changed
EventOut< SFBoolisActive
EventOut< SFStringdescription_changed
EventOut< SFBoolloop_changed
EventOut< SFFloatpitch_changed
EventOut< SFTimestartTime_changed
EventOut< SFTimestopTime_changed
EventOut< MFStringurl_changed


Detailed Description

Here is the documentation for this node type, from the ISO standard.

+6.4 AudioClip

An AudioClip node specifies audio data that can be referenced by Sound nodes.

The description field specifies a textual description of the audio source. A browser is not required to display the description field but may choose to do so in addition to playing the sound.

The url field specifies the URL from which the sound is loaded. Browsers shall support at least the wavefile format in uncompressed PCM format (see E.[WAV]). It is recommended that browsers also support the MIDI file type 1 sound format (see 2.[MIDI]); MIDI files are presumed to use the General MIDI patch set. Subclause 4.5, VRML and the World Wide Web, contains details on the url field. The results are undefined when no URLs refer to supported data types

The loop, startTime, and stopTime exposedFields and the isActive eventOut, and their effects on the AudioClip node, are discussed in detail in 4.6.9, Time-dependent nodes. The "cycle" of an AudioClip is the length of time in seconds for one playing of the audio at the specified pitch.

The pitch field specifies a multiplier for the rate at which sampled sound is played. Values for the pitch field shall be greater than zero. Changing the pitch field affects both the pitch and playback speed of a sound. A set_pitch event to an active AudioClip is ignored and no pitch_changed eventOut is generated. If pitch is set to 2.0, the sound shall be played one octave higher than normal and played twice as fast. For a sampled sound, the pitch field alters the sampling rate at which the sound is played. The proper implementation of pitch control for MIDI (or other note sequence sound clips) is to multiply the tempo of the playback by the pitch value and adjust the MIDI Coarse Tune and Fine Tune controls to achieve the proper pitch change.

A duration_changed event is sent whenever there is a new value for the "normal" duration of the clip. Typically, this will only occur when the current url in use changes and the sound data has been loaded, indicating that the clip is playing a different sound source. The duration is the length of time in seconds for one cycle of the audio for a pitch set to 1.0. Changing the pitch field will not trigger a duration_changed event. A duration value of "-1" implies that the sound data has not yet loaded or the value is unavailable for some reason. A duration_changed event shall be generated if the AudioClip node is loaded when the VRML file is read or the AudioClip node is added to the scene graph.

The isActive eventOut may be used by other nodes to determine if the clip is currently active. If an AudioClip is active, it shall be playing the sound corresponding to the sound time (i.e., in the sound's local time system with sample 0 at time 0):

    t = (now - startTime) modulo (duration / pitch)

--- VRML separator bar ---


Constructor & Destructor Documentation

AudioClip ( const char *  name = ""  ) 

Construct a node with all its fields set to default value, which is equivalent to the code below:

  description = string("");
  loop = false;
  pitch = 1.0f;
  startTime.setNbSeconds(0);
  stopTime.setNbSeconds(0);

~AudioClip (  )  [virtual]

Virtual destructor, does nothing


Member Function Documentation

unsigned int nbFields (  )  const [inline, virtual]

Returns the number of fields (exposed or not) for this node type.

Implements Node.

wrl::Node::FieldHandle field ( const std::string &  n  )  [virtual]

Return a handle on the field named n of the node or a "unknown" typed handle if there is no such field. Valid names are:

Implements Node.

wrl::Node::FieldHandle field ( unsigned int  n  )  [virtual]

Return a handle on the i th field of the node or a "unknown" typed handle if there is no such node. Here is how i is related to fields:

Implements Node.

bool isSetToDefaultValue ( unsigned int  i  )  const [virtual]

Implements Node.

unsigned int nbEventsIn (  )  const [inline, virtual]

Returns the number of events in for this node type.

Implements Node.

wrl::Node::EventInHandle eventIn ( const std::string &  n  )  [virtual]

Return a handle on the event in named n of the node or a "unknown" typed handle if there is no such event. Valid names are:

Implements Node.

wrl::Node::EventInHandle eventIn ( unsigned int  n  )  [virtual]

Return a handle on the i th event in of the node or a "unknown" typed handle if there is no such node. emarks This class has no eventIn. This function is useful, with nbEventsIn() if you want to traverse all events in of a Node.

Implements Node.

unsigned int nbEventsOut (  )  const [inline, virtual]

Returns the number of events out for this node type.

Implements Node.

wrl::Node::EventOutHandle eventOut ( const std::string &  n  )  [virtual]

Return a handle on the event out named n of the node or a "unknown" typed handle if there is no such event. Valid names are:

Implements Node.

wrl::Node::EventOutHandle eventOut ( unsigned int  n  )  [virtual]

Return a handle on the i th event out of the node or a "unknown" typed handle if there is no such node. Here is how i is related to fields:

Implements Node.

const char * typeName (  )  const [inline, virtual]

Returns "AudioClip". Useful for printing.

Implements Node.

wrl::Node * duplicate (  )  const [virtual]

Returns a deep copy of this node, that is a fully independant node with all children (if any) also copied. This is mainly useful for instanciating protos.

Implements Node.

virtual Node* duplicate ( std::map< const Node *, Node * > &   )  const [virtual]

Implements Node.


Member Data Documentation

SFString description

See Detailed Description for meaning of this field. Default value is set to

       description = string("");

SFBool loop

See Detailed Description for meaning of this field. Default value is set to

       loop = false;

SFFloat pitch

See Detailed Description for meaning of this field. Default value is set to

       pitch = 1.0f;

SFTime startTime

See Detailed Description for meaning of this field. Default value is set to

       startTime.setNbSeconds(0);

SFTime stopTime

See Detailed Description for meaning of this field. Default value is set to

       stopTime.setNbSeconds(0);

MFString url

See Detailed Description for meaning of this field. Default value is set to MFString default value

EventIn<SFString> set_description

Set event associated to exposedField description

EventIn<SFBool> set_loop

Set event associated to exposedField loop

EventIn<SFFloat> set_pitch

Set event associated to exposedField pitch

EventIn<SFTime> set_startTime

Set event associated to exposedField startTime

EventIn<SFTime> set_stopTime

Set event associated to exposedField stopTime

EventIn<MFString> set_url

Set event associated to exposedField url

EventOut<SFTime> duration_changed

See Detailed Description for meaning of this event.

EventOut<SFBool> isActive

See Detailed Description for meaning of this event.

EventOut<SFString> description_changed

Changed event associated to exposedField description

EventOut<SFBool> loop_changed

Changed event associated to exposedField loop

EventOut<SFFloat> pitch_changed

Changed event associated to exposedField pitch

EventOut<SFTime> startTime_changed

Changed event associated to exposedField startTime

EventOut<SFTime> stopTime_changed

Changed event associated to exposedField stopTime

EventOut<MFString> url_changed

Changed event associated to exposedField url


Generated on 5 Jan 2007 with doxygen version 1.5.1. Valid HTML 4.0! Valid CSS!