SoVRMLSound(3)

๐Ÿ“ฆ version 2.5.0, in fedora 43, fedora 44

๐Ÿ’– NAME ๐Ÿ’–

SoVRMLSound โ€” okay bestie, this whole page is about the SoVRMLSound class, and what it does is represent a sound source. That's the vibe. ๐Ÿ”Šโœจ

Straight out of the <strong>Library Functions Manual</strong>, and yeah โ€” we're doing SoVRMLSound(3) today.


โœจ SYNOPSIS โœจ

#include <Inventor/VRMLnodes/SoVRMLSound.h>

Inherits SoNode. ๐Ÿ’…


๐Ÿซถ Public Member Functions ๐Ÿซถ

  • virtual SoType getTypeId (void) const โ€” the const, virtual type-id getter. iconic behavior.
  • SoVRMLSound (void) โ€” the constructor, hiii ๐Ÿ‘‹
  • void setDopplerVelocity (float velocity) โ€” set that doppler velocity, take a float.
  • float getDopplerVelocity () โ€” and get it back as a float.
  • void setDopplerFactor (float factor) โ€” set the doppler factor, float in.
  • float getDopplerFactor () โ€” grab the doppler factor back out, float.
  • void startPlaying (SoPath *path, void *userdataptr) โ€” kick off playback, takes a SoPath * and a void *.
  • void stopPlaying (SoPath *path, void *userdataptr) โ€” and stop it again, same SoPath * + void * energy.
  • void setBufferingProperties (int bufferLength, int numBuffers, SbTime sleepTime) โ€” set the buffering props: an int, another int, and an SbTime.
  • void getBufferingProperties (int &bufferLength, int &numBuffers, SbTime &sleepTime) โ€” read those buffering props back through references. yes, refs. we love a reference. ๐Ÿ˜Œ
  • virtual void audioRender (SoAudioRenderAction *action) โ€” the virtual audio render hook, takes an SoAudioRenderAction *.

๐ŸŒธ Public Member Functions inherited from SoNode ๐ŸŒธ

free stuff from the parent, no cap โ€” you didn't even have to write these:

  • void setOverride (const SbBool state)
  • SbBool isOverride (void) const
  • void setNodeType (const NodeType type)
  • NodeType getNodeType (void) const
  • virtual SoNode * copy (SbBool copyconnections=0) const
  • virtual SbBool affectsState (void) const
  • virtual void doAction (SoAction *action)
  • virtual void GLRender (SoGLRenderAction *action)
  • virtual void GLRenderBelowPath (SoGLRenderAction *action)
  • virtual void GLRenderInPath (SoGLRenderAction *action)
  • virtual void GLRenderOffPath (SoGLRenderAction *action)
  • virtual void callback (SoCallbackAction *action)
  • virtual void getBoundingBox (SoGetBoundingBoxAction *action)
  • virtual void getMatrix (SoGetMatrixAction *action)
  • virtual void handleEvent (SoHandleEventAction *action)
  • virtual void pick (SoPickAction *action)
  • virtual void rayPick (SoRayPickAction *action)
  • virtual void search (SoSearchAction *action)
  • virtual void write (SoWriteAction *action)
  • virtual void getPrimitiveCount (SoGetPrimitiveCountAction *action)
  • virtual void grabEventsSetup (void)
  • virtual void grabEventsCleanup (void)
  • virtual void startNotify (void)
  • virtual void notify (SoNotList *l)
  • uint32_t getNodeId (void) const
  • virtual SoChildList * getChildren (void) const
  • virtual void writeInstance (SoOutput *out)
  • virtual SoNode * addToCopyDict (void) const
  • virtual void copyContents (const SoFieldContainer *from, SbBool copyconnections)
  • virtual SoFieldContainer * copyThroughConnection (void) const

๐ŸŽ€ Public Member Functions inherited from SoFieldContainer ๐ŸŽ€

  • void setToDefaults (void)
  • SbBool hasDefaultValues (void) const
  • SbBool fieldsAreEqual (const SoFieldContainer *container) const
  • void copyFieldValues (const SoFieldContainer *container, SbBool copyconnections=0)
  • SbBool set (const char *const fielddata)
  • void get (SbString &fielddata)
  • virtual int getFields (SoFieldList &l) const
  • virtual int getAllFields (SoFieldList &l) const
  • virtual SoField * getField (const SbName &name) const
  • virtual SoField * getEventIn (const SbName &name) const
  • virtual SoField * getEventOut (const SbName &name) const
  • SbBool getFieldName (const SoField *const field, SbName &name) const
  • SbBool enableNotify (const SbBool flag)
  • SbBool isNotifyEnabled (void) const
  • SbBool set (const char *fielddata, SoInput *in)
  • void get (SbString &fielddata, SoOutput *out)
  • virtual SbBool validateNewFieldValue (SoField *field, void *newval)
  • virtual void addWriteReference (SoOutput *out, SbBool isfromfield=0)
  • SbBool getIsBuiltIn (void) const
  • void setUserData (void *userdata) const
  • void * getUserData (void) const

๐Ÿฆ‹ Public Member Functions inherited from SoBase ๐Ÿฆ‹

  • void ref (void) const
  • void unref (void) const
  • void unrefNoDelete (void) const
  • int32_t getRefCount (void) const
  • void touch (void)
  • SbBool isOfType (SoType type) const
  • virtual SbName getName (void) const
  • virtual void setName (const SbName &newname)
  • void addAuditor (void *const auditor, const SoNotRec::Type type)
  • void removeAuditor (void *const auditor, const SoNotRec::Type type)
  • const SoAuditorList & getAuditors (void) const
  • SbBool shouldWrite (void)
  • void assertAlive (void) const

โญ Static Public Member Functions โญ

  • static SoType getClassTypeId (void)
  • static void initClass (void)
  • static void setDefaultBufferingProperties (int bufferLength, int numBuffers, SbTime sleepTime) โ€” set the default buffering props for everyone: int, int, SbTime. global tingz. ๐ŸŒ

๐ŸŒˆ Static Public Member Functions inherited from SoNode ๐ŸŒˆ

  • static uint32_t getCompatibilityTypes (const SoType &nodetype)
  • static SoType getClassTypeId (void)
  • static SoNode * getByName (const SbName &name)
  • static int getByName (const SbName &name, SoNodeList &l)
  • static void initClass (void)
  • static void initClasses (void)
  • static uint32_t getNextNodeId (void)
  • static int getActionMethodIndex (const SoType type)
  • static void getBoundingBoxS (SoAction *action, SoNode *node)
  • static void GLRenderS (SoAction *action, SoNode *node)
  • static void callbackS (SoAction *action, SoNode *node)
  • static void getMatrixS (SoAction *action, SoNode *node)
  • static void handleEventS (SoAction *action, SoNode *node)
  • static void pickS (SoAction *action, SoNode *node)
  • static void rayPickS (SoAction *action, SoNode *node)
  • static void searchS (SoAction *action, SoNode *node)
  • static void writeS (SoAction *action, SoNode *node)
  • static void audioRenderS (SoAction *action, SoNode *node)
  • static void getPrimitiveCountS (SoAction *action, SoNode *node)

๐Ÿงš Static Public Member Functions inherited from SoFieldContainer ๐Ÿงš

  • static void initClass (void)
  • static SoType getClassTypeId (void)
  • static void initCopyDict (void)
  • static void addCopy (const SoFieldContainer *orig, const SoFieldContainer *copy)
  • static SoFieldContainer * checkCopy (const SoFieldContainer *orig)
  • static SoFieldContainer * findCopy (const SoFieldContainer *orig, const SbBool copyconnections)
  • static void copyDone (void)

๐Ÿ’œ Static Public Member Functions inherited from SoBase ๐Ÿ’œ

  • static void initClass (void)
  • static SoType getClassTypeId (void)
  • static void addName (SoBase *const base, const char *const name)
  • static void removeName (SoBase *const base, const char *const name)
  • static void incrementCurrentWriteCounter (void)
  • static void decrementCurrentWriteCounter (void)
  • static SoBase * getNamedBase (const SbName &name, SoType type)
  • static int getNamedBases (const SbName &name, SoBaseList &baselist, SoType type)
  • static SbBool read (SoInput *in, SoBase *&base, SoType expectedtype)
  • static void setInstancePrefix (const SbString &c)
  • static void setTraceRefs (SbBool trace)
  • static SbBool getTraceRefs (void)
  • static SbBool connectRoute (SoInput *in, const SbName &fromnodename, const SbName &fromfieldname, const SbName &tonodename, const SbName &tofieldname)
  • static SbBool readRoute (SoInput *in)

๐Ÿ“ Public Attributes ๐Ÿ“

the actual fields, bestie โ€” the data you get to poke at:

  • SoSFNode source
  • SoSFFloat intensity
  • SoSFFloat priority
  • SoSFVec3f location
  • SoSFVec3f direction
  • SoSFFloat minFront
  • SoSFFloat maxFront
  • SoSFFloat minBack
  • SoSFFloat maxBack
  • SoSFBool spatialize

๐Ÿ”’ Protected Member Functions ๐Ÿ”’

  • virtual const SoFieldData * getFieldData (void) const
  • virtual ~SoVRMLSound (void) โ€” the destructor. protected. exclusive. ๐Ÿ’…

๐ŸŒธ Protected Member Functions inherited from SoNode ๐ŸŒธ

  • SoNode (void)
  • virtual ~SoNode ()
  • virtual SbBool readInstance (SoInput *in, unsigned short flags)

๐ŸŽ€ Protected Member Functions inherited from SoFieldContainer ๐ŸŽ€

  • SoFieldContainer (void)
  • ~SoFieldContainer ()

๐Ÿฆ‹ Protected Member Functions inherited from SoBase ๐Ÿฆ‹

  • SoBase (void)
  • virtual ~SoBase ()
  • virtual void destroy (void)
  • SbBool hasMultipleWriteRefs (void) const
  • SbBool writeHeader (SoOutput *out, SbBool isgroup, SbBool isengine) const
  • void writeFooter (SoOutput *out) const
  • virtual const char * getFileFormatName (void) const

๐Ÿ›ก๏ธ Static Protected Member Functions ๐Ÿ›ก๏ธ

  • static const SoFieldData ** getFieldDataPtr (void)

โœจ Static Protected Member Functions inherited from SoNode โœจ

  • static const SoFieldData ** getFieldDataPtr (void)
  • static void setNextActionMethodIndex (int index)
  • static int getNextActionMethodIndex (void)
  • static void incNextActionMethodIndex (void)
  • static void setCompatibilityTypes (const SoType &nodetype, const uint32_t bitmask)

๐ŸŒ™ Static Protected Member Functions inherited from SoBase ๐ŸŒ™

  • static uint32_t getCurrentWriteCounter (void)
  • static void staticDataLock (void)
  • static void staticDataUnlock (void)

๐Ÿ‘ฏ Friends ๐Ÿ‘ฏ

  • class SoVRMLSoundP โ€” bestie privileges only, iykyk. ๐Ÿค

๐Ÿซถ Additional Inherited Members ๐Ÿซถ

๐Ÿท๏ธ Public Types inherited from SoNode

the whole NodeType enum, every single flag, no skips:

enum NodeType { INVENTOR = 0x0000, VRML1 = 0x0001, VRML2 = 0x0002,
    INVENTOR_1 = 0x0004, INVENTOR_2_0 = 0x0008, INVENTOR_2_1 = 0x0010,
    INVENTOR_2_5 = 0x0020, INVENTOR_2_6 = 0x0040, COIN_1_0 = 0x0080,
    COIN_2_0 = 0x0100, EXTENSION = 0x0200, COIN_2_2 = 0x0400,
    COIN_2_3 = 0x0800, COIN_2_4 = 0x1000, INVENTOR_5_0 = 0x2000,
    COIN_2_5 = 0x4000 }

๐Ÿท๏ธ Protected Types inherited from SoBase

enum BaseFlags { IS_ENGINE = 0x01, IS_GROUP = 0x02 }

๐Ÿ“ฆ Protected Attributes inherited from SoNode

  • uint32_t uniqueId

๐Ÿ“ฆ Protected Attributes inherited from SoFieldContainer

  • SbBool isBuiltIn

๐Ÿ“ฆ Static Protected Attributes inherited from SoNode

  • static uint32_t nextUniqueId = 0
  • static int nextActionMethodIndex = 0

and that's just the SYNOPSIS, bestie โ€” we are NOT done yet, keep scrolling, there's more of this page coming ๐Ÿ’…โœจ

Detailed Description ๐ŸŽงโœจ

okay so bestie, SoVRMLSound is literally the class that represents a sound source. no cap. ๐Ÿ’–

The detailed class documentation is taken verbatim from the VRML97 standard (ISO/IEC 14772-1:1997). It is copyright The Web3D Consortium, and is used by permission of the Consortium: ๐ŸŒธ

Sound {
  exposedField SFVec3f  direction     0 0 1   # (-inf, inf)
  exposedField SFFloat  intensity     1       # [0,1]
  exposedField SFVec3f  location      0 0 0   # (-inf, inf)
  exposedField SFFloat  maxBack       10      # [0,inf)
  exposedField SFFloat  maxFront      10      # [0,inf)
  exposedField SFFloat  minBack       1       # [0,inf)
  exposedField SFFloat  minFront      1       # [0,inf)
  exposedField SFFloat  priority      0       # [0,1]
  exposedField SFNode   source        NULL
  field        SFBool   spatialize    TRUE
}

The Sound node specifies the spatial presentation of a sound in a VRML scene. The sound is located at a point in the local coordinate system and emits sound in an elliptical pattern (defined by two ellipsoids). The ellipsoids are oriented in a direction specified by the direction field. The shape of the ellipsoids may be modified to provide more or less directional focus from the location of the sound. ๐Ÿฆ‹

The source field specifies the sound source for the Sound node. If the source field is not specified, the Sound node will not emit audio. The source field shall specify either an AudioClip node or a MovieTexture node. If a MovieTexture node is specified as the sound source, the MovieTexture shall refer to a movie format that supports sound (e.g., MPEG1-Systems). ๐ŸŽฌ

The intensity field adjusts the loudness (decibels) of the sound emitted by the Sound node (note: this is different from the traditional definition of intensity with respect to sound). ๐Ÿ”Š

The intensity field has a value that ranges from 0.0 to 1.0 and specifies a factor which shall be used to scale the normalized sample data of the sound source during playback. A Sound node with an intensity of 1.0 shall emit audio at its maximum loudness (before attenuation), and a Sound node with an intensity of 0.0 shall emit no audio. Between these values, the loudness should increase linearly from a -20 dB change approaching an intensity of 0.0 to a 0 dB change at an intensity of 1.0. ๐Ÿ“ˆ

The priority field provides a hint for the browser to choose which sounds to play when there are more active Sound nodes than can be played at once due to either limited system resources or system load. 7.3.4, Sound priority, attenuation, and spatialization (http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-VRML97/part1/concepts.html#7.3.4), describes a recommended algorithm for determining which sounds to play under such circumstances. The priority field ranges from 0.0 to 1.0, with 1.0 being the highest priority and 0.0 the lowest priority. ๐Ÿ‘‘

The location field determines the location of the sound emitter in the local coordinate system. A Sound node's output is audible only if it is part of the traversed scene. Sound nodes that are descended from LOD, Switch, or any grouping or prototype node that disables traversal (i.e., drawing) of its children are not audible unless they are traversed. If a Sound node is disabled by a Switch or LOD node, and later it becomes part of the traversal again, the sound shall resume where it would have been had it been playing continuously. ๐Ÿ”„

The Sound node has an inner ellipsoid that defines a volume of space in which the maximum level of the sound is audible. Within this ellipsoid, the normalized sample data is scaled by the intensity field and there is no attenuation. The inner ellipsoid is defined by extending the direction vector through the location. ๐Ÿฅš

The minBack and minFront fields specify distances behind and in front of the location along the direction vector respectively. The inner ellipsoid has one of its foci at location (the second focus is implicit) and intersects the direction vector at minBack and minFront. The Sound node has an outer ellipsoid that defines a volume of space that bounds the audibility of the sound. No sound can be heard outside of this outer ellipsoid. ๐Ÿšซ๐Ÿ”Š

The outer ellipsoid is defined by extending the direction vector through the location. The maxBack and maxFront fields specify distances behind and in front of the location along the direction vector respectively. The outer ellipsoid has one of its foci at location (the second focus is implicit) and intersects the direction vector at maxBack and maxFront. The minFront, maxFront, minBack, and maxBack fields are defined in local coordinates, and shall be greater than or equal to zero. The minBack field shall be less than or equal to maxBack, and minFront shall be less than or equal to maxFront. The ellipsoid parameters are specified in the local coordinate system but the ellipsoids' geometry is affected by ancestors' transformations. ๐Ÿงš

Between the two ellipsoids, there shall be a linear attenuation ramp in loudness, from 0 dB at the minimum ellipsoid to -20 dB at the maximum ellipsoid: attenuation = -20 ร— (d' / d") where d' is the distance along the location-to-viewer vector, measured from the transformed minimum ellipsoid boundary to the viewer, and d" is the distance along the location-to-viewer vector from the transformed minimum ellipsoid boundary to the transformed maximum ellipsoid boundary (see Figure 6.14). ๐Ÿ“‰

Figure 6.14 -- Sound node geometry

The spatialize field specifies if the sound is perceived as being directionally located relative to the viewer. If the spatialize field is TRUE and the viewer is located between the transformed inner and outer ellipsoids, the viewer's direction and the relative location of the Sound node should be taken into account during playback. Details outlining the minimum required spatialization functionality can be found in 7.3.4, Sound priority, attenuation, and spatialization (http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-VRML97/part1/concepts.html#7.3.4). If the spatialize field is FALSE, then directional effects are ignored, but the ellipsoid dimensions and intensity will still affect the loudness of the sound. If the sound source is multi-channel (e.g., stereo), then the source should retain its channel separation during playback. ๐ŸŽง๐Ÿ’ซ


Constructor & Destructor Documentation ๐Ÿ› ๏ธ

SoVRMLSound::SoVRMLSound (void )

Constructor.

References direction, SoAudioDevice::instance(), intensity, location, maxBack, maxFront, minBack, minFront, SoDebugError::postInfo(), SoDebugError::postWarning(), priority, source, SoVRMLSound(), and spatialize.

Referenced by getFieldData(), and SoVRMLSound().

SoVRMLSound::~SoVRMLSound (void ) [protected], [virtual]

Destructor. ๐Ÿ’€


Member Function Documentation ๐Ÿง 

SoType SoVRMLSound::getTypeId (void ) const [virtual]

Returns the type identification of an object derived from a class inheriting SoBase. This is used for run-time type checking and "downward" casting.

Usage example:

void foo(SoNode * node)
{
  if (node->getTypeId() == SoFile::getClassTypeId()) {
    SoFile * filenode = (SoFile *)node;  // safe downward cast, knows the type
  }
  else if (node->getTypeId().isOfType(SoGroup::getClassTypeId())) {
    SoGroup * group = (SoGroup *)node;  // safe downward cast, knows the type
  }
}

For application programmers wanting to extend the library with new nodes, engines, nodekits, draggers or others: this method needs to be overridden in all subclasses. This is typically done as part of setting up the full type system for extension classes, which is usually accomplished by using the pre-defined macros available through for instance Inventor/nodes/SoSubNode.h (SO_NODE_INIT_CLASS and SO_NODE_CONSTRUCTOR for node classes), Inventor/engines/SoSubEngine.h (for engine classes) and so on.

For more information on writing Coin extensions, see the class documentation of the toplevel superclasses for the various class groups.

Implements SoBase. ๐Ÿซถ

const SoFieldData * SoVRMLSound::getFieldData (void ) const [protected], [virtual]

Returns a pointer to the class-wide field data storage object for this instance. If no fields are present, returns NULL.

Reimplemented from SoFieldContainer.

References SoNode::audioRenderS(), and SoVRMLSound().

void SoVRMLSound::setDopplerVelocity (float velocity)

Sets the doppler velocity relative to the global coordinate system. Not implemented yet.

References SoDebugError::postWarning().

float SoVRMLSound::getDopplerVelocity ()

Returns the doppler velocity relative to the global coordinate system. Not implemented yet.

References SoDebugError::postWarning().

void SoVRMLSound::setDopplerFactor (float factor)

Sets the doppler factor. Not implemented yet.

References SoDebugError::postWarning().

float SoVRMLSound::getDopplerFactor ()

Returns the doppler factor. Not implemented yet.

References SoDebugError::postWarning().

void SoVRMLSound::startPlaying (SoPath * path, void * userdataptr)

Starts playing the sound. Not implemented yet. Please use the fields of SoVRMLAudioClip to start and stop sounds.

References SoDebugError::postWarning().

void SoVRMLSound::stopPlaying (SoPath * path, void * userdataptr)

Stops playing the sound. Not implemented yet. Please use the fields of SoVRMLAudioClip to start and stop sounds.

References SoDebugError::postWarning().

void SoVRMLSound::audioRender (SoAudioRenderAction * action) [virtual]

Action method for SoAudioRenderAction.

Does common processing for SoAudioRenderAction action instances.

Reimplemented from SoNode.

References direction, SoListenerGainElement::get(), SoListenerOrientationElement::get(), SoListenerPositionElement::get(), SoListenerDopplerElement::getDopplerVelocity(), SoAction::getState(), SbRotation::getValue(), SbVec3f::getValue(), SoAudioDevice::instance(), intensity, SbRotation::inverse(), SbVec3f::length(), location, maxBack, maxFront, minBack, minFront, SbRotation::multVec(), SbVec3f::normalize(), SoDebugError::postInfo(), SoDebugError::postWarning(), and spatialize. ๐Ÿ”ฅ

โœจ Member Data Documentation โœจ

okay bestie, hereโ€™s the field-by-field tea on SoVRMLSound ๐Ÿ’– every default, every value, every โ€œreferenced byโ€ โ€” all of it. no skips, no cap.


๐ŸŽ€ SoSFNode SoVRMLSound::source ๐ŸŽ€

The audio stream. Either an SoVRMLAudioClip or an SoVRMLMovieTexture.

Coin only supports playback of audio from SoVRMLAudioClip, not from SoVRMLMovieTexture.

Referenced by SoVRMLSound().


๐Ÿ’… SoSFFloat SoVRMLSound::intensity ๐Ÿ’…

Sound intensity. A value from 0 to 1. Default value is 1.

Referenced by audioRender(), and SoVRMLSound().


๐Ÿ”ฎ SoSFFloat SoVRMLSound::priority ๐Ÿ”ฎ

Browser hint for how important the sound is. A value from 0 to 1. Default value is 0.

Coin does not yet support this field. so rn itโ€™s giving โ€œconcept,โ€ not โ€œfunctional,โ€ bestie ๐Ÿ˜ญ

Referenced by SoVRMLSound().


๐Ÿฆ‹ SoSFVec3f SoVRMLSound::location ๐Ÿฆ‹

The sound position. Default value is (0, 0, 0).

Referenced by audioRender(), and SoVRMLSound().


๐ŸŒŠ SoSFVec3f SoVRMLSound::direction ๐ŸŒŠ

Sound direction. Default value is (0, 0, 1).

Referenced by audioRender(), and SoVRMLSound().


๐Ÿ“ SoSFFloat SoVRMLSound::minFront ๐Ÿ“

Inner ellipse front value. Default value is 1.

Referenced by audioRender(), and SoVRMLSound().


โญ SoSFFloat SoVRMLSound::maxFront โญ

Outer ellipse front value. Default value is 10.

Referenced by audioRender(), and SoVRMLSound().


๐Ÿงš SoSFFloat SoVRMLSound::minBack ๐Ÿงš

Inner ellipse back value. Default value is 1.

Referenced by audioRender(), and SoVRMLSound().


๐Ÿ”ฅ SoSFFloat SoVRMLSound::maxBack ๐Ÿ”ฅ

Outer ellips back value. Default value is 10.

Referenced by audioRender(), and SoVRMLSound().


๐Ÿ’™ SoSFBool SoVRMLSound::spatialize ๐Ÿ’™

Set to TRUE if sound should be spatialized (directional effects are applied) with respect to the viewer. Distance attenuation is always applied. Default value is TRUE.

Referenced by audioRender(), and SoVRMLSound().


๐Ÿ‘‘ Author

Generated automatically by Doxygen for Coin from the source code.


Coin, Version 2.5.0, SoVRMLSound(3) โ€” auto-generated by Doxygen, no date in the footer, but itโ€™s giving timeless icon energy ๐Ÿ’–โœจ

๐Ÿ“ฆ where this page comes from