Panda3D
Public Types | Public Member Functions | Static Public Member Functions | List of all members
AudioSound Class Reference
Inheritance diagram for AudioSound:
TypedReferenceCount TypedObject ReferenceCount MemoryBase MemoryBase

Public Types

enum  SoundStatus { BAD = 0, READY = 1, PLAYING = 2 }
 

Public Member Functions

bool configureFilters (FilterProperties config)
 
float get3dMaxDistance ()
 
float get3dMinDistance ()
 
bool getActive ()
 
float getBalance ()
 
str getFinishedEvent ()
 
bool getLoop ()
 
unsigned long int getLoopCount ()
 
str getName ()
 There is no set_name(), this is intentional. More...
 
float getPlayRate ()
 
int getPriority ()
 
float getSpeakerLevel (int index)
 
float getSpeakerMix (int speaker)
 *_speaker_mix and *_speaker_level(s) serve the same purpose. *_speaker_mix is for use with FMOD. *_speaker_level(s) is for use with Miles. Both interfaces exist because of a significant difference in the two APIs. Hopefully the difference can be reconciled into a single interface at some point. More...
 
float getTime ()
 
float getVolume ()
 
float length ()
 return: playing time in seconds. More...
 
 output (Ostream out)
 
 play ()
 For best compatibility, set the loop_count, volume, and balance, prior to calling play(). You may set them while they're playing, but it's implementation specific whether you get the results. More...
 
 set3dAttributes (float px, float py, float pz, float vx, float vy, float vz)
 Controls the position of this sound's emitter. px, py and pz are the emitter's position. vx, vy and vz are the emitter's velocity in UNITS PER SECOND (default: meters). More...
 
 set3dMaxDistance (float dist)
 Controls the maximum distance (in units) that this sound stops falling off. The sound does not stop at that point, it just doesn't get any quieter. You should rarely need to adjust this. Default is 1000000000.0. More...
 
 set3dMinDistance (float dist)
 Controls the distance (in units) that this sound begins to fall off. Also affects the rate it falls off. Default is 1.0 Closer/Faster, <1.0 Farther/Slower, >1.0. More...
 
 setActive (bool flag)
 inits to manager's state. More...
 
 setBalance (float balance_right)
 -1.0 is hard left 0.0 is centered 1.0 is hard right inits to 0.0. More...
 
 setFinishedEvent (str event)
 Set (or clear) the event that will be thrown when the sound finishes playing. To clear the event, pass an empty string. More...
 
 setLoop (bool loop)
 loop: false = play once; true = play forever. inits to false. More...
 
 setLoopCount (unsigned long int loop_count)
 loop_count: 0 = forever; 1 = play once; n = play n times. inits to 1. More...
 
 setPlayRate (float play_rate)
 play_rate is any positive PN_stdfloat value. inits to 1.0. More...
 
 setPriority (int priority)
 
 setSpeakerLevels (float level1, float level2, float level3, float level4, float level5, float level6, float level7, float level8, float level9)
 
 setSpeakerMix (float frontleft, float frontright, float center, float sub, float backleft, float backright, float sideleft, float sideright)
 
 setTime (float start_time)
 Control time position within the sound. This is similar (in concept) to the seek position within a file. time in seconds: 0 = beginning; length() = end. inits to 0.0. More...
 
 setVolume (float volume)
 0 = minimum; 1.0 = maximum. inits to 1.0. More...
 
AudioSound::SoundStatus status ()
 
 stop ()
 
 write (Ostream out)
 
- Public Member Functions inherited from TypedObject
TypeHandle getType ()
 Derived classes should override this function to return get_class_type(). More...
 
int getTypeIndex ()
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. This is equivalent to get_type().get_index(). More...
 
bool isExactType (TypeHandle handle)
 Returns true if the current object is the indicated type exactly. More...
 
bool isOfType (TypeHandle handle)
 Returns true if the current object is or derives from the indicated type. More...
 
- Public Member Functions inherited from ReferenceCount
int getRefCount ()
 Returns the current reference count. More...
 
 ref ()
 Explicitly increments the reference count. User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. More...
 
bool testRefCountIntegrity ()
 Does some easy checks to make sure that the reference count isn't completely bogus. Returns true if ok, false otherwise. More...
 
bool testRefCountNonzero ()
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. Returns true if ok, false otherwise. More...
 
bool unref ()
 Explicitly decrements the reference count. Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic.) However, see the helper function unref_delete(). More...
 

Static Public Member Functions

static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedReferenceCount
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle getClassType ()
 

Member Enumeration Documentation

◆ SoundStatus

Enumerator
BAD 
READY 
PLAYING 

Member Function Documentation

◆ configureFilters()

bool configureFilters ( FilterProperties  config)

◆ get3dMaxDistance()

float get3dMaxDistance ( )

◆ get3dMinDistance()

float get3dMinDistance ( )

◆ getActive()

bool getActive ( )

◆ getBalance()

float getBalance ( )

◆ getClassType()

static TypeHandle getClassType ( )
static

◆ getFinishedEvent()

str getFinishedEvent ( )

◆ getLoop()

bool getLoop ( )

◆ getLoopCount()

unsigned long int getLoopCount ( )

◆ getName()

str getName ( )

There is no set_name(), this is intentional.

◆ getPlayRate()

float getPlayRate ( )

◆ getPriority()

int getPriority ( )

◆ getSpeakerLevel()

float getSpeakerLevel ( int  index)

◆ getSpeakerMix()

float getSpeakerMix ( int  speaker)

*_speaker_mix and *_speaker_level(s) serve the same purpose. *_speaker_mix is for use with FMOD. *_speaker_level(s) is for use with Miles. Both interfaces exist because of a significant difference in the two APIs. Hopefully the difference can be reconciled into a single interface at some point.

◆ getTime()

float getTime ( )

◆ getVolume()

float getVolume ( )

◆ length()

float length ( )

return: playing time in seconds.

◆ output()

output ( Ostream  out)

◆ play()

play ( )

For best compatibility, set the loop_count, volume, and balance, prior to calling play(). You may set them while they're playing, but it's implementation specific whether you get the results.

  • Calling play() a second time on the same sound before it is finished will start the sound again (creating a skipping or stuttering effect).

◆ set3dAttributes()

set3dAttributes ( float  px,
float  py,
float  pz,
float  vx,
float  vy,
float  vz 
)

Controls the position of this sound's emitter. px, py and pz are the emitter's position. vx, vy and vz are the emitter's velocity in UNITS PER SECOND (default: meters).

◆ set3dMaxDistance()

set3dMaxDistance ( float  dist)

Controls the maximum distance (in units) that this sound stops falling off. The sound does not stop at that point, it just doesn't get any quieter. You should rarely need to adjust this. Default is 1000000000.0.

◆ set3dMinDistance()

set3dMinDistance ( float  dist)

Controls the distance (in units) that this sound begins to fall off. Also affects the rate it falls off. Default is 1.0 Closer/Faster, <1.0 Farther/Slower, >1.0.

◆ setActive()

setActive ( bool  flag)

inits to manager's state.

◆ setBalance()

setBalance ( float  balance_right)

-1.0 is hard left 0.0 is centered 1.0 is hard right inits to 0.0.

◆ setFinishedEvent()

setFinishedEvent ( str  event)

Set (or clear) the event that will be thrown when the sound finishes playing. To clear the event, pass an empty string.

◆ setLoop()

setLoop ( bool  loop)

loop: false = play once; true = play forever. inits to false.

◆ setLoopCount()

setLoopCount ( unsigned long int  loop_count)

loop_count: 0 = forever; 1 = play once; n = play n times. inits to 1.

◆ setPlayRate()

setPlayRate ( float  play_rate)

play_rate is any positive PN_stdfloat value. inits to 1.0.

◆ setPriority()

setPriority ( int  priority)

◆ setSpeakerLevels()

setSpeakerLevels ( float  level1,
float  level2,
float  level3,
float  level4,
float  level5,
float  level6,
float  level7,
float  level8,
float  level9 
)

◆ setSpeakerMix()

setSpeakerMix ( float  frontleft,
float  frontright,
float  center,
float  sub,
float  backleft,
float  backright,
float  sideleft,
float  sideright 
)

◆ setTime()

setTime ( float  start_time)

Control time position within the sound. This is similar (in concept) to the seek position within a file. time in seconds: 0 = beginning; length() = end. inits to 0.0.

  • The current time position will not change while the sound is playing; you must call play() again to effect the change. To play the same sound from a time offset a second time, explicitly set the time position again. When looping, the second and later loops will start from the beginning of the sound.
  • If a sound is playing, calling get_time() repeatedly will return different results over time. e.g.: PN_stdfloat percent_complete = s.get_time() / s.length();

◆ setVolume()

setVolume ( float  volume)

0 = minimum; 1.0 = maximum. inits to 1.0.

◆ status()

◆ stop()

stop ( )

◆ write()

write ( Ostream  out)