00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef USERDATAAUDIO_H
00016 #define USERDATAAUDIO_H
00017
00018 #include "movieAudio.h"
00019 #include "datagramIterator.h"
00020 #include "pdeque.h"
00021
00022 class MovieAudioCursor;
00023 class UserDataAudioCursor;
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 class EXPCL_PANDA_MOVIES UserDataAudio : public MovieAudio {
00036
00037 PUBLISHED:
00038 UserDataAudio(int rate, int channels, bool remove_after_read=true);
00039 virtual ~UserDataAudio();
00040 virtual PT(MovieAudioCursor) open();
00041
00042 void append(PN_int16 *data, int n);
00043 void append(DatagramIterator *src, int len=0x40000000);
00044 void append(const string &str);
00045 void done();
00046
00047 private:
00048 void read_samples(int n, PN_int16 *data);
00049 void update_cursor();
00050 int _desired_rate;
00051 int _desired_channels;
00052 UserDataAudioCursor *_cursor;
00053 pdeque<PN_int16> _data;
00054 bool _aborted;
00055 bool _remove_after_read;
00056 friend class UserDataAudioCursor;
00057
00058 public:
00059 static TypeHandle get_class_type() {
00060 return _type_handle;
00061 }
00062 static void init_type() {
00063 MovieAudio::init_type();
00064 register_type(_type_handle, "UserDataAudio",
00065 MovieAudio::get_class_type());
00066 }
00067 virtual TypeHandle get_type() const {
00068 return get_class_type();
00069 }
00070 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00071
00072 private:
00073 static TypeHandle _type_handle;
00074 };
00075
00076 #include "userDataAudio.I"
00077
00078 #endif