浏览代码

movies: UserDataAudio.read_samples should take a bytes/vector_uchar

rdb 6 年之前
父节点
当前提交
026c2bf619
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 2 2
      panda/src/movies/userDataAudio.cxx
  2. 1 1
      panda/src/movies/userDataAudio.h

+ 2 - 2
panda/src/movies/userDataAudio.cxx

@@ -107,11 +107,11 @@ append(DatagramIterator *src, int n) {
  * but it may be convenient to deal with samples in python.
  */
 void UserDataAudio::
-append(const std::string &str) {
+append(const vector_uchar &str) {
   nassertv(!_aborted);
   int samples = str.size() / (2 * _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 c2 = ((unsigned char)str[i*2+1]);
     int16_t n = (c1 | (c2 << 8));

+ 1 - 1
panda/src/movies/userDataAudio.h

@@ -37,7 +37,7 @@ class EXPCL_PANDA_MOVIES UserDataAudio : public MovieAudio {
 
   void append(int16_t *data, int n);
   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.
 
  private: