12 gpu_frame(size_t width, size_t height);
\r
14 virtual void write_lock();
\r
15 virtual bool write_unlock();
\r
16 virtual void read_lock(GLenum mode);
\r
17 virtual bool read_unlock();
\r
18 virtual void draw();
\r
20 virtual unsigned char* data();
\r
21 virtual size_t size() const;
\r
22 virtual size_t width() const;
\r
23 virtual size_t height() const;
\r
25 virtual void reset();
\r
27 virtual const std::vector<short>& audio_data() const;
\r
28 virtual std::vector<short>& audio_data();
\r
30 virtual float alpha() const;
\r
31 virtual void alpha(float value);
\r
33 virtual float x() const;
\r
34 virtual float y() const;
\r
35 virtual void translate(float x, float y);
\r
37 static std::shared_ptr<gpu_frame> null()
\r
39 static auto my_null_frame = std::make_shared<gpu_frame>(0,0);
\r
40 return my_null_frame;
\r
44 struct implementation;
\r
45 std::shared_ptr<implementation> impl_;
\r
47 typedef std::shared_ptr<gpu_frame> gpu_frame_ptr;
\r
49 inline void mix_audio_safe(std::vector<short>& frame1, const std::vector<short>& frame2)
\r
52 frame1 = std::move(frame2);
\r
53 else if(!frame2.empty())
\r
55 for(size_t n = 0; n < frame1.size(); ++n)
\r
56 frame1[n] = static_cast<short>(static_cast<int>(frame1[n]) + static_cast<int>(frame2[n]) & 0xFFFF);
\r
60 template<typename frame_ptr_type>
\r
61 frame_ptr_type& mix_audio_safe(frame_ptr_type& frame1, const gpu_frame_ptr& frame2)
\r
63 mix_audio_safe(frame1->audio_data(), frame2->audio_data());
\r