H3D API  2.4.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | List of all members
H3D::SimpleAudioClip Class Reference

SimpleAudioClip is a node for playing audio with a simpler interface than the audio clip node. More...

#include <H3D/SimpleAudioClip.h>

Inheritance diagram for H3D::SimpleAudioClip:
Inheritance graph

Public Member Functions

 SimpleAudioClip (Inst< SFString > _description=0, Inst< SFBool > _loop=0, Inst< SFNode > _metadata=0, Inst< SFTime > _pauseTime=0, Inst< SFFloat > _pitch=0, Inst< SFTime > _resumeTime=0, Inst< StartTime > _startTime=0, Inst< StopTime > _stopTime=0, Inst< MFString > _url=0, Inst< SFTime > _duration_changed=0, Inst< SFTime > _elapsedTime=0, Inst< SFBool > _isActive=0, Inst< SFBool > _isPaused=0, Inst< TimeHandler > _time_handler=0, Inst< SFBool > _play=0, Inst< SFBool > _stop=0, Inst< SFBool > _pause=0, Inst< SFString > _audioState=0)
 Constructor.
 
- Public Member Functions inherited from H3D::AudioClip
 AudioClip (Inst< SFString > _description=0, Inst< SFBool > _loop=0, Inst< SFNode > _metadata=0, Inst< SFTime > _pauseTime=0, Inst< SFFloat > _pitch=0, Inst< SFTime > _resumeTime=0, Inst< StartTime > _startTime=0, Inst< StopTime > _stopTime=0, Inst< MFString > _url=0, Inst< SFTime > _duration_changed=0, Inst< SFTime > _elapsedTime=0, Inst< SFBool > _isActive=0, Inst< SFBool > _isPaused=0, Inst< TimeHandler > _time_handler=0)
 Constructor.
 
virtual void ALrender ()
 Perform the OpenAL calls to render the audio clip.
 
- Public Member Functions inherited from H3D::X3DSoundSourceNode
 X3DSoundSourceNode (Inst< SFNode > _metadata=0, Inst< SFString > _description=0, Inst< SFBool > _loop=0, Inst< SFTime > _pauseTime=0, Inst< SFFloat > _pitch=0, Inst< SFTime > _resumeTime=0, Inst< StartTime > _startTime=0, Inst< StopTime > _stopTime=0, Inst< SFTime > _duration_changed=0, Inst< SFTime > _elapsedTime=0, Inst< SFBool > _isActive=0, Inst< SFBool > _isPaused=0, Inst< TimeHandler > _timeHandler=0)
 Constructor.
 
virtual bool initALBuffers (bool stream)
 Reads new data into the OpenAL from the reader and attaches them to the sound sources that use this sound source. More...
 
virtual string defaultXMLContainerField ()
 Returns the default xml containerField attribute value. More...
 
virtual void registerSoundNode (X3DSoundNode *n)
 Register this sound node with the X3DSoundSourceNode. More...
 
virtual void unregisterSoundNode (X3DSoundNode *n)
 Unregister this sound node with the X3DSoundSourceNode.

 
virtual void onPause ()
 On pause, pause the sound.
 
virtual void onResume ()
 On resume, resume paused sound.
 
virtual void onStart ()
 On start, initialize AL buffers and start playing.
 
virtual void onStop ()
 On stop, stop playing the sound.
 
- Public Member Functions inherited from H3D::X3DTimeDependentNode
 X3DTimeDependentNode (Inst< SFNode > _metadata=0, Inst< SFBool > _loop=0, Inst< SFTime > _pauseTime=0, Inst< SFTime > _resumeTime=0, Inst< StartTime > _startTime=0, Inst< StopTime > _stopTime=0, Inst< SFTime > _elapsedTime=0, Inst< SFBool > _isActive=0, Inst< SFBool > _isPaused=0, Inst< TimeHandler > _timeHandler=0)
 Constructor.
 
virtual void initialize ()
 Activates the node if the conditions for a time node to be active from the start are met. More...
 
- Public Member Functions inherited from H3D::X3DChildNode
 X3DChildNode (Inst< SFNode > _metadata=0)
 Constructor.
 
- Public Member Functions inherited from H3D::X3DNode
 X3DNode (Inst< SFNode > _metadata=0)
 Constructor.
 
X3DMetadataObjectgetMetadataByName (const string &_name)
 Given a name, the first X3DMetadataObject in the metadata field that matches that name is returned. More...
 
- Public Member Functions inherited from H3D::Node
 Node ()
 Constructor.
 
virtual Nodeclone (bool deepCopy=true, DeepCopyMap *deepCopyMap=NULL)
 Returns a new instance of this node type with the same state as this one. More...
 
virtual ~Node ()
 Destructor.
 
X3DPrototypeInstancegetProtoInstanceParent ()
 If this node is the root node in the proto body of a X3DPrototypeInstance then this will return that node. More...
 
void setProtoInstanceParent (X3DPrototypeInstance *p)
 Set the X3DPrototypeInstance this node is the the root node if applicaple.
 
virtual void render ()
 the render() function is used for the depth-first rendering traversal of the scene-graph. More...
 
virtual void traverseSG (TraverseInfo &ti)
 traverseSG is called once per scenegraph loop on the scene in order to traverse the scenegraph. More...
 
virtual bool lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result)
 Detect intersection between a line segment and the Node. More...
 
virtual void closestPoint (const Vec3f &p, NodeIntersectResult &result)
 Find closest point on Node to p. More...
 
virtual bool movingSphereIntersect (H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result)
 Detect collision between a moving sphere and the Node. More...
 
virtual FieldgetField (const string &_name) const
 return a pointer to the field specified by name within this instance
 
int addDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 
int removeDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 
- Public Member Functions inherited from H3D::X3DUrlObject
 X3DUrlObject (Inst< MFString > _url=0)
 Constructor.
 
virtual LoadStatus loadStatus ()
 The loadStatus function returns the status of the loading of the current urls in order to be used with the LoadSensor node.
 
virtual H3DFloat loadProgress ()
 The loadProgress() functions returns a value between 0 and 1 indicating how much of the current url has been loaded. More...
 
void setURLUsed (const string &_url_used)
 Set the url that is currently loaded.
 
const string & getURLUsed ()
 Get the url that is currently loaded.
 
void setURLBase (const string &_url_base)
 Set the url base address.
 
const string & getURLBase ()
 Get the current url base address.
 
string resolveURLAsFile (const string &url, bool *is_tmp_file=NULL)
 Get the url as a local file.
 
string resolveURLAsString (const string &url)
 Get the content of the URL as a string.
 
bool removeTmpFile (const string &file)
 Remove a tmpfile with the given name. More...
 

Public Attributes

H3DUniquePtr< SFBoolplay
 If a true event is received by the "play" field the audio will start playing, if it paused or stopped. More...
 
H3DUniquePtr< SFBoolstop
 If a true event is received by the "stop" field the audio will stop playing. More...
 
H3DUniquePtr< SFBoolpause
 If a true event is received by the "pause" field the audio will be paused. More...
 
H3DUniquePtr< SFStringaudioState
 audioState describe if the audio is being playing, paused or stopped Access type: outputOnly
Default value: "STOPPED" Valid values: "STOPPED", "PLAYING", "PAUSED" More...
 
- Public Attributes inherited from H3D::X3DSoundSourceNode
H3DUniquePtr< SFStringdescription
 The description field specifies a textual description of the audio source. More...
 
H3DUniquePtr< SFFloatpitch
 The pitch field specifies a multiplier for the rate at which sampled sound is played. More...
 
H3DUniquePtr< SFTimeduration_changed
 The duration field is the length of time in seconds for one cycle of the audio for a pitch set to 1.0. More...
 
- Public Attributes inherited from H3D::X3DTimeDependentNode
H3DUniquePtr< SFBoolloop
 If loop is TRUE at the end of a cycle, execution continues into the next cycle, otherwise it stops. More...
 
H3DUniquePtr< SFTimepauseTime
 A time at which to pause and stop generating events. More...
 
H3DUniquePtr< SFTimeresumeTime
 A time at which to start generating events again after being paused. More...
 
H3DUniquePtr< StartTimestartTime
 A time-dependent node is inactive until its startTime is reached. More...
 
H3DUniquePtr< StopTimestopTime
 An active time-dependent node will become inactive when stopTime is reached if stopTime > startTime. More...
 
H3DUniquePtr< SFTimeelapsedTime
 The elapsedTime outputOnly field delivers the current elapsed time since the X3DTimeDependentNode was activated and running, cumulative in seconds and not counting any time while in a paused state. More...
 
H3DUniquePtr< SFBoolisActive
 An isActive TRUE event is generated when the node becomes active and an isActive FALSE event is generated when it becomes inactive. More...
 
H3DUniquePtr< SFBoolisPaused
 An isPaused TRUE event is generated when the node becomes paused and an isPaused FALSE event is generated when it is resumed. More...
 
- Public Attributes inherited from H3D::X3DNode
H3DUniquePtr< SFNodemetadata
 Meta data about the node. More...
 
- Public Attributes inherited from H3D::X3DUrlObject
H3DUniquePtr< MFStringurl
 The urls in decreasing order of preference.
 

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::AudioClip
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::X3DSoundSourceNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::X3DTimeDependentNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::X3DNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 

Protected Attributes

H3DUniquePtr< UpdateAudioPlay > updateAudioPlay
 update the playing of audio
 
- Protected Attributes inherited from H3D::X3DSoundSourceNode
list< X3DSoundNode * > parent_sound_nodes
 The X3DSoundNodes that use this node as sound source.
 
ALuint al_buffers [NR_STREAM_BUFFERS]
 OpenAL buffer ids used for playing sound.
 
ALenum al_format
 The OpenAL format of the current sound source.
 
AutoRef< H3DSoundStreamNodereader
 The H3DSoundStreamNode used to read sound data.
 
bool sound_as_stream
 Indicates if the current sounds source is being streamed or not.
 
H3DUniquePtr< ALSoundBuffersoundBuffer
 Field that calls ALrender() when a field routed to it has generated an event.
 
- Protected Attributes inherited from H3D::X3DUrlObject
string url_used
 If loadStatus() returns LOADED this string should contain the url that is loaded. More...
 
string url_base
 The base URL for urls in this url object. More...
 
list< string > supported_inline_prefixes
 A list of inline prefixes that are supported by this url object. More...
 

Additional Inherited Members

- Public Types inherited from H3D::Node
typedef std::map< Node *, Node * > DeepCopyMap
 A map type used during a deep copy clone() to map from original nodes to cloned nodes.
 
- Public Types inherited from H3D::X3DUrlObject
enum  LoadStatus { INIT , LOADED , LOADING , FAILED }
 The load status of the given url. More...
 
- Static Public Member Functions inherited from H3D::Node
static unsigned int nrNodesAlive ()
 Returns the nr of nodes currently alive, i.e. nodes created but not destructed.
 
static int nrNodesCreated ()
 Returns the number of nodes created in total since the start of the program.
 
- Protected Member Functions inherited from H3D::Node
void cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for the clone() method. More...
 
- Protected Member Functions inherited from H3D::X3DUrlObject
string resolveURL (const string &_url, bool return_contents, bool *is_tmp_file=NULL)
 Helper function for resolveURLAs*() functions.
 
void addInlinePrefix (const string &s)
 Add a inline prefix that this node supports.
 
int getInlinedContentOffset (const std::string &url)
 If the URL contains any inline prefix, return the index of the start of the inlined content. More...
 
- Static Protected Member Functions inherited from H3D::Node
static NodegetClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for nodes that implement clone() More...
 

Detailed Description

SimpleAudioClip is a node for playing audio with a simpler interface than the audio clip node.

Examples:

Internal routes:

Member Data Documentation

◆ audioState

H3DUniquePtr< SFString > H3D::SimpleAudioClip::audioState

audioState describe if the audio is being playing, paused or stopped Access type: outputOnly
Default value: "STOPPED" Valid values: "STOPPED", "PLAYING", "PAUSED"

Referenced by SimpleAudioClip().

◆ pause

H3DUniquePtr< SFBool > H3D::SimpleAudioClip::pause

If a true event is received by the "pause" field the audio will be paused.

It can be resumed again by sending a start event to the "play" field.

Access type: inputOutput

Referenced by SimpleAudioClip().

◆ play

H3DUniquePtr< SFBool > H3D::SimpleAudioClip::play

If a true event is received by the "play" field the audio will start playing, if it paused or stopped.

If it is currently running nothing will happen.

Access type: inputOutput

Referenced by SimpleAudioClip().

◆ stop

H3DUniquePtr< SFBool > H3D::SimpleAudioClip::stop

If a true event is received by the "stop" field the audio will stop playing.

Access type: inputOutput

Referenced by SimpleAudioClip().


The documentation for this class was generated from the following files: