# UserDataAudioCursor

from pandac.PandaModules import UserDataAudioCursor

Class : UserDataAudioCursor
Description : A UserDataAudioCursor is a means to manually supply a sequence of raw audio samples.

## Inheritance:

UserDataAudioCursor: MovieAudioCursor
MovieAudioCursor: TypedWritableReferenceCount
TypedWritableReferenceCount: TypedWritable ReferenceCount
TypedWritable: TypedObject
TypedObject: MemoryBase
MemoryBase:
ReferenceCount: MemoryBase

## Methods of UserDataAudioCursor:

getClassType

## Methods of MovieAudioCursor:

aborted
audioChannels
audioRate
canSeek
canSeekFast
getClassType
getSource
length
readSamples
ready
seek
skipSamples
tell

## Methods of TypedWritableReferenceCount:

getClassType

## Methods of TypedWritable:

getClassType

## Methods of TypedObject:

getClassType
getType
getTypeIndex
isExactType
isOfType

## Methods of ReferenceCount:

getClassType
getRefCount
ref
testRefCountIntegrity
testRefCountNonzero
unref

getClassType static TypeHandle UserDataAudioCursor::get_class_type(void); Undocumented function.

aborted bool MovieAudioCursor::aborted(void) const; Description: If aborted is true, it means that the "ready" samples are not being replenished. See the method "ready" for an explanation.

audioChannels int MovieAudioCursor::audio_channels(void) const; Description: Returns the number of audio channels (ie, two for stereo, one for mono).

audioRate int MovieAudioCursor::audio_rate(void) const; Description: Returns the audio sample rate.

canSeek bool MovieAudioCursor::can_seek(void) const; Description: Returns true if the movie can seek. If this is true, seeking is still not guaranteed to be fast: for some movies, seeking is implemented by rewinding to the beginning and then fast-forwarding to the desired location. Even if the movie cannot seek, the seek method can still advance to an arbitrary location by reading samples and discarding them. However, to move backward, can_seek must return true.

canSeekFast bool MovieAudioCursor::can_seek_fast(void) const; Description: Returns true if seek operations are constant time.

getClassType static TypeHandle MovieAudioCursor::get_class_type(void); Undocumented function.

getSource PointerTo< MovieAudio > MovieAudioCursor::get_source(void) const; Filename: movieAudioCursor.I Created by: jyelon (02Jul07) PANDA 3D SOFTWARE Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved All use of this software is subject to the terms of the Panda 3d Software license. You should have received a copy of this license along with this source code; you will also find a current copy of the license at http://etc.cmu.edu/panda3d/docs/license/ . To contact the maintainers of this program write to panda3d-general@lists.sourceforge.net . Description: Returns the MovieAudio which this cursor references.

length double MovieAudioCursor::length(void) const; Description: Returns the length of the movie. Attempting to read audio samples beyond the specified length will produce silent samples. Some kinds of Movie, such as internet TV station, might not have a predictable length. In that case, the length will be set to a very large number: 1.0E10. Some AVI files have incorrect length values encoded into them - they may be a second or two long or short. When playing such an AVI using the Movie class, you may see a slightly truncated video, or a slightly elongated video (padded with black frames). There are utilities out there to fix the length values in AVI files. An audio consumer needs to check the length, the ready status, and the aborted flag.

readSamples void MovieAudioCursor::read_samples(int n, Datagram *dg); Description: Read audio samples from the stream. N is the number of samples you wish to read. Your buffer must be equal in size to N * channels. Multiple-channel audio will be interleaved. Description: Read audio samples from the stream into a Datagram. N is the number of samples you wish to read. Multiple-channel audio will be interleaved. This is not particularly efficient, but it may be a convenient way to manipulate samples in python. Description: Read audio samples from the stream and returns them as a string. The samples are stored little-endian in the string. N is the number of samples you wish to read. Multiple-channel audio will be interleaved.

ready virtual int MovieAudioCursor::ready(void) const; Description: Returns the number of audio samples that are ready to read. This is primarily relevant for sources like microphones which produce samples at a fixed rate. If you try to read more samples than are ready, the result will be silent samples. Some audio streams do not have a limit on how fast they can produce samples. Such streams will always return 0x40000000 as the ready-count. This may well exceed the length of the audio stream. You therefore need to check length separately. If the aborted flag is set, that means the ready count is no longer being replenished. For example, a MovieAudioCursor might be reading from an internet radio station, and it might buffer data to avoid underruns. If it loses connection to the radio station, it will set the aborted flag to indicate that the buffer is no longer being replenished. But it is still ok to read the samples that are in the buffer, at least until they run out. Once those are gone, there will be no more. An audio consumer needs to check the length, the ready status, and the aborted flag.

seek virtual void MovieAudioCursor::seek(double offset); Description: Skips to the specified offset within the file. If the movie reports that it cannot seek, then this method can still advance by reading samples and discarding them. However, to move backward, can_seek must be true. If the movie reports that it can_seek, it doesn't mean that it can do so quickly. It may have to rewind the movie and then fast forward to the desired location. Only if can_seek_fast returns true can seek operations be done in constant time. Seeking may not be precise, because AVI files often have inaccurate indices. After seeking, tell will indicate that the cursor is at the target location. However, in truth, the data you read may come from a slightly offset location.

skipSamples void MovieAudioCursor::skip_samples(int n); Description: Skip audio samples from the stream. This is mostly for debugging purposes.

tell double MovieAudioCursor::tell(void) const; Description: Returns the current offset within the file.

getClassType static TypeHandle TypedWritableReferenceCount::get_class_type(void); Undocumented function.

getClassType static TypeHandle TypedWritable::get_class_type(void); Undocumented function.

getClassType static TypeHandle TypedObject::get_class_type(void); Undocumented function.

getType virtual TypeHandle TypedObject::get_type(void) const = 0; Derived classes should override this function to return get_class_type().

getTypeIndex int TypedObject::get_type_index(void) const; Description: 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().

isExactType bool TypedObject::is_exact_type(TypeHandle handle) const; Description: Returns true if the current object is the indicated type exactly.

isOfType bool TypedObject::is_of_type(TypeHandle handle) const; Description: Returns true if the current object is or derives from the indicated type.

getClassType static TypeHandle ReferenceCount::get_class_type(void); Undocumented function.

getRefCount int ReferenceCount::get_ref_count(void) const; Description: Returns the current reference count.

ref void ReferenceCount::ref(void) const; Description: 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. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

testRefCountIntegrity bool ReferenceCount::test_ref_count_integrity(void) const; Description: Does some easy checks to make sure that the reference count isn't completely bogus. Returns true if ok, false otherwise.

testRefCountNonzero bool ReferenceCount::test_ref_count_nonzero(void) const; Description: Does some easy checks to make sure that the reference count isn't zero, or completely bogus. Returns true if ok, false otherwise.

unref bool ReferenceCount::unref(void) const; Description: 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; plus, we don't have a virtual destructor anyway.) However, see the helper function unref_delete(). 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. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it. The return value is true if the new reference count is nonzero, false if it is zero.