mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 08:44:19 -04:00
movies: UserDataAudio.read_samples should take a bytes/vector_uchar
This commit is contained in:
parent
d92168cd74
commit
026c2bf619
@ -107,11 +107,11 @@ append(DatagramIterator *src, int n) {
|
|||||||
* but it may be convenient to deal with samples in python.
|
* but it may be convenient to deal with samples in python.
|
||||||
*/
|
*/
|
||||||
void UserDataAudio::
|
void UserDataAudio::
|
||||||
append(const std::string &str) {
|
append(const vector_uchar &str) {
|
||||||
nassertv(!_aborted);
|
nassertv(!_aborted);
|
||||||
int samples = str.size() / (2 * _desired_channels);
|
int samples = str.size() / (2 * _desired_channels);
|
||||||
int words = samples * _desired_channels;
|
int words = samples * _desired_channels;
|
||||||
for (int i=0; i<words; i++) {
|
for (int i = 0; i < words; ++i) {
|
||||||
int c1 = ((unsigned char)str[i*2+0]);
|
int c1 = ((unsigned char)str[i*2+0]);
|
||||||
int c2 = ((unsigned char)str[i*2+1]);
|
int c2 = ((unsigned char)str[i*2+1]);
|
||||||
int16_t n = (c1 | (c2 << 8));
|
int16_t n = (c1 | (c2 << 8));
|
||||||
|
@ -37,7 +37,7 @@ class EXPCL_PANDA_MOVIES UserDataAudio : public MovieAudio {
|
|||||||
|
|
||||||
void append(int16_t *data, int n);
|
void append(int16_t *data, int n);
|
||||||
void append(DatagramIterator *src, int len=0x40000000);
|
void append(DatagramIterator *src, int len=0x40000000);
|
||||||
void append(const std::string &str);
|
void append(const vector_uchar &);
|
||||||
void done(); // A promise not to write any more samples.
|
void done(); // A promise not to write any more samples.
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user