58 int desired = n * _audio_channels;
59 for (
int i=0; i<desired; i++) {
76 int blocksize = (4096 / _audio_channels);
77 if (blocksize > n) blocksize = n;
78 int words = blocksize * _audio_channels;
80 for (
int i=0; i<words; i++) {
97 std::ostringstream result;
100 int blocksize = (4096 / _audio_channels);
101 if (blocksize > n) blocksize = n;
102 int words = blocksize * _audio_channels;
104 for (
int i=0; i<words; i++) {
105 int16_t word = tmp[i];
106 result.put((
char)(word & 255));
107 result.put((
char)((word>>8) & 255));
133 seek(
double offset) {
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
void add_int16(int16_t value)
Adds a signed 16-bit integer to the datagram.
MovieAudioCursor(MovieAudio *src)
This constructor returns a null audio stream — a stream of total silence, at 8000 samples per second.
virtual int ready() const
Returns the number of audio samples that are ready to read.
virtual void seek(double offset)
Skips to the specified offset within the file.
void read_samples(int n, Datagram *dg)
Read audio samples from the stream into a Datagram.
A MovieAudio is actually any source that provides a sequence of audio samples.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.