]> git.sesse.net Git - casparcg/commitdiff
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches...
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 19 Mar 2012 00:44:18 +0000 (00:44 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 19 Mar 2012 00:44:18 +0000 (00:44 +0000)
modules/oal/consumer/oal_consumer.cpp

index 59774f3f673e4ee2445b43c39b58427a51359113..393c02b320c91176dfba68aebe8bc008466f6ae5 100644 (file)
@@ -78,6 +78,7 @@ public:
 \r
                graph_->set_color("tick-time", diagnostics::color(0.0f, 0.6f, 0.9f));   \r
                graph_->set_color("dropped-frame", diagnostics::color(0.3f, 0.6f, 0.3f));\r
+               graph_->set_color("late-frame", diagnostics::color(0.6f, 0.3f, 0.3f));\r
                diagnostics::register_graph(graph_);\r
                \r
                executor_.invoke([=]\r
@@ -144,6 +145,8 @@ public:
                        }\r
                        \r
                        alSourcei(source_, AL_LOOPING, AL_FALSE);\r
+\r
+                       alSourcePlay(source_);  \r
                });\r
        }\r
        \r
@@ -154,7 +157,21 @@ public:
                        ALenum state; \r
                        alGetSourcei(source_, AL_SOURCE_STATE,&state);\r
                        if(state != AL_PLAYING)\r
-                               alSourcePlay(source_);                  \r
+                       {\r
+                               for(int n = 0; n < buffers_.size()-1; ++n)\r
+                               {                                       \r
+                                       ALuint buffer = 0;  \r
+                                       alSourceUnqueueBuffers(source_, 1, &buffer);\r
+                                       if(buffer)\r
+                                       {\r
+                                               std::vector<int16_t> audio(format_desc_.audio_cadence[n % format_desc_.audio_cadence.size()], 0);\r
+                                               alBufferData(buffer, AL_FORMAT_STEREO16, audio.data(), static_cast<ALsizei>(audio.size()*sizeof(int16_t)), format_desc_.audio_sample_rate);\r
+                                               alSourceQueueBuffers(source_, 1, &buffer);\r
+                                       }\r
+                               }\r
+                               alSourcePlay(source_);          \r
+                               graph_->set_tag("late-frame");  \r
+                       }\r
 \r
                        auto audio = core::audio_32_to_16(frame.audio_data());\r
                        \r