]> git.sesse.net Git - kdenlive/commitdiff
drawing first audio samples, but mlt does crash a lot
authorMarco Gittler <marco@gitma.de>
Sat, 23 Feb 2008 23:25:15 +0000 (23:25 +0000)
committerMarco Gittler <marco@gitma.de>
Sat, 23 Feb 2008 23:25:15 +0000 (23:25 +0000)
svn path=/branches/KDE4/; revision=1916

src/clipitem.cpp

index 64be9b5ea042f903afd1f2d080b3ca3925d9ef09..1cf8ea44c802e1247539537af54c0e5c0a4f6481 100644 (file)
@@ -221,11 +221,20 @@ int ClipItem::endPos()
                 painter->fillPath(path,QBrush(QColor(200,200,200,127)));
                 //for test 
                 int channels=2;
-                kDebug() << "audio frames=" << baseClip()->audioFrameChache.size() ;
-                for (int channel=0;channel<channels;channel++){
+                kDebug() << "audioframes=" << baseClip()->audioFrameChache.size();
+                for (int frame=0;frame<10 && frame+1< baseClip()->audioFrameChache.size();frame++){
                        QRectF re=path.boundingRect();
-                       int y=re.y()+re.height()*channel/channels+ (re.height()/channels)/2;
-                       painter->drawLine(re.x() , y, re.x() + re.width(), y );
+                        
+                        QMap<int,QByteArray> frame_channel_data=baseClip()->audioFrameChache[frame];
+                        kDebug() << "size=" <<frame_channel_data.size()  << " " << frame_channel_data[0].size();;
+                        int audio_frame_samples=frame_channel_data[0].size();
+                        for (int samples=0;samples<audio_frame_samples/*AUDIO_FRAME_SIZE*/;samples++){
+                               for (int channel=0;channel<channels && frame_channel_data[channel].size()> 0;channel++){
+                                
+                                       int y=re.y()+re.height()*channel/channels+ (re.height()/channels)/2;
+                                       painter->drawLine(re.x() + frame*audio_frame_samples+samples  , y+frame_channel_data[channel][0], re.x() +frame*audio_frame_samples+samples+1 /*+ re.width()*/, y+frame_channel_data[channel][0] );
+                               }
+                        }
                 }
         }
     // draw start / end fades