SSObject:
Filter:
3Dj/Classes (extension) | Libraries > 3Dj

SSObject
ExtensionExtension

A Sound Scene Object

Description

A sound object that lives inside a SSWorld

SSObjects have a set of spatial and dynamic properties, such as position, velocity, shape, etc., and they are also related to a specific sound source (a "mono track"). Currently, the sound is only managed through SpatialRender and Jack.

Interaction with the dynamic behavior of a SSObject can be handled in two ways: top-down, by assigning the object motion to a Motion instance, or bottom-up physical model, by applying forces.

This class is based on RedObject.

Class Methods

.new

Arguments:

world

Reference to the SSWorld instance in which the object is going to exist

loc

Initial position in m. Array or Cartesian in the format [x,y,z].

Default to [0,0,0]

vel

Initial velocity in m/s. Array or Cartesian in the format [x,y,z].

Default to [0,0,0]

accel

Initial acceleration in m/^2. Array or Cartesian in the format [x,y,z].

Default to [0,0,0]

mass

Mass of the object. Default to 1.

NOTE: At the moment, the mass parameter has any effect in the physical model
size

Object size. Default to 1.

NOTE: At the moment, the size parameter has any effect in the physical model
shape

Symbol with the shape type. Currently, there are 4 possibilities:

  • \point classical punctual source. Default
  • \ring arbitrary width ring-type surface around a virtual sphere's surface
  • \extended arbitrary squared surface around a virtual sphere's surface
  • \meridian a half meridian shape
gravity

Boolean indicating whether the object is subject to gravity. Default to false

friction

Boolean indicating whether the object is subject to friction. Default to false

name

Symbol containing the object name.

If nil, the reference world will assign one automatically, based on the object channel

channel

Jack channel number from where the object gets its sound.

If nil, the reference world will assign one automatically

Instance Methods

Object Properties

.channel

Get the Jack channel associated with the object.

.setChannel

Set the Jack channel associated with the object.

Arguments:

newChannel

Channel number

.name

Get/set the object's name, as a Symbol

.loc

Get/set the object location in Cartesian coordinates

Arguments:

newLoc

Array in the form [x,y,z], or instance of Cartesian

x

if newLoc is nil, set only x, holding other values

y

if newLoc is nil, set only y, holding other values

z

if newLoc is nil, set only z, holding other values

.locSph

Get/set the object location in Spherical coordinates

Arguments:

newLocSph

Array in the form [rho,azimuth,elevation], or instance of Spherical

rho

if newLocSph is nil, set only rho, holding other values

azi

if newLocSph is nil, set only azimuth, holding other values

ele

if newLocSph is nil, set only elevation, holding other values

.shape

Get/set the object's shape

Arguments:

newShape

One of these symbols:

  • \point classical punctual source. Default
  • \ring arbitrary width ring-type surface around a virtual sphere's surface
  • \extended arbitrary squared surface around a virtual sphere's surface
  • \meridian a meridian-type shape

.preserveArea

Get/set wether the object preserves its area when moving, for non-punctual shapes.

Arguments:

bool

.dAzimuth

Get/set the azimuth difference angle, for extended sources

.dElevation

Get/set the elevation difference angle, for extended sources

.present

Get/set if the object is present (active) in the reference world

.remove

Remove this object from the reference world. Called internally by the SSWorld: -remove

Physical Model

.gravity

Get/set whether the object is subject to gravity, as a Boolean

.friction

Get/set whether the object is subject to friction, as a Boolean

.vel

Get/set the object's velocity, as an Array or Cartesian

.addVel

Add velocity to the existing one

Arguments:

newVel

Array with the added velocity

.velSph

Get/set the object's velocity, as a instance of Array or Spherical

.accel

Get/set the object's acceleration, as an Array or Cartesian

.accelSph

Get/set the object's acceleration, as a instance of Array or Spherical

Motion

.motion

Get the current object's motion

.setMotion

Assign one of the predefined motions to the object

Arguments:

type

One of the following symbols:

  • \static
  • \rect
  • \random
  • \brown
  • \shm
  • \orbit
 ... args

Required parameters for each of the motion types. See Motion for more information.

.stop

Set object's velocity and acceleration vectors to 0.