15 #include "movieAudioCursor.h"
67 int desired = n * _audio_channels;
68 for (
int i=0; i<desired; i++) {
88 int blocksize = (4096 / _audio_channels);
89 if (blocksize > n) blocksize = n;
90 int words = blocksize * _audio_channels;
92 for (
int i=0; i<words; i++) {
115 int blocksize = (4096 / _audio_channels);
116 if (blocksize > n) blocksize = n;
117 int words = blocksize * _audio_channels;
119 for (
int i=0; i<words; i++) {
120 PN_int16 word = tmp[i];
121 result.put((
char)(word & 255));
122 result.put((
char)((word>>8) & 255));
void read_samples(int n, Datagram *dg)
Read audio samples from the stream into a Datagram.
void add_int16(PN_int16 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...
TypeHandle is the identifier used to differentiate C++ class types.
A MovieAudio is actually any source that provides a sequence of audio samples.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
virtual void seek(double offset)
Skips to the specified offset within the file.
virtual int ready() const
Returns the number of audio samples that are ready to read.