• R/O
  • SSH
  • HTTPS

cadencii: コミット


コミットメタ情報

リビジョン1983 (tree)
日時2012-02-10 09:53:08
作者haruneko24

ログメッセージ

[StandConverter] Transcriberがキャンセルすると落ちるのを修正

変更サマリ

差分

--- vConnect/trunk/stand2.0/StandConverter/gui/WorldWidget.h (revision 1982)
+++ vConnect/trunk/stand2.0/StandConverter/gui/WorldWidget.h (nonexistent)
@@ -1,45 +0,0 @@
1-#ifndef WORLDWIDGET_H
2-#define WORLDWIDGET_H
3-
4-#include <QWidget>
5-
6-namespace stand
7-{
8-namespace math
9-{
10-namespace world
11-{
12-class World;
13-}
14-}
15-
16-namespace gui
17-{
18-
19-class WorldWidget : public QWidget
20-{
21- Q_OBJECT
22-signals:
23-
24-public slots:
25-
26-
27-public:
28- explicit WorldWidget(const QString &filename, QWidget *parent = 0);
29- virtual ~WorldWidget();
30-
31- bool read(const QString &filename);
32-
33-protected:
34- void paintEvent(QPaintEvent *e);
35-
36-private:
37- void _destroy();
38- double *vol;
39- stand::math::world::World *w;
40-};
41-
42-}
43-}
44-
45-#endif // WORLDWIDGET_H
--- vConnect/trunk/stand2.0/StandConverter/gui/WorldWidget.cpp (revision 1982)
+++ vConnect/trunk/stand2.0/StandConverter/gui/WorldWidget.cpp (nonexistent)
@@ -1,44 +0,0 @@
1-#include "WorldWidget.h"
2-
3-#include "../math/World.h"
4-#include "../io/WaveFile.h"
5-
6-#include <QDir>
7-
8-using namespace stand::gui;
9-
10-WorldWidget::WorldWidget(const QString &filename, QWidget *parent) :
11- QWidget(parent)
12-{
13- w = NULL;
14- vol = NULL;
15- read(filename);
16-}
17-
18-WorldWidget::~WorldWidget()
19-{
20- _destroy();
21-}
22-
23-void WorldWidget::_destroy()
24-{
25- delete[] vol;
26- vol = NULL;
27- delete w;
28- w = NULL;
29-}
30-
31-bool WorldWidget::read(const QString &filename)
32-{
33- stand::io::WaveFile wave;
34- if(!wave.read(QDir::toNativeSeparators(filename).toLocal8Bit().data()))
35- {
36- qDebug("WorldWidget::read(%s); Unable to read file.", filename);
37- return false;
38- }
39-}
40-
41-void WorldWidget::paintEvent(QPaintEvent *e)
42-{
43-
44-}
--- vConnect/trunk/stand2.0/StandConverter/gui/SpecgramViewer.cpp (nonexistent)
+++ vConnect/trunk/stand2.0/StandConverter/gui/SpecgramViewer.cpp (revision 1983)
@@ -0,0 +1,37 @@
1+#include "SpecgramViewer.h"
2+
3+#include <QImage>
4+
5+using namespace stand::gui;
6+
7+SpecgramViewer::SpecgramViewer(QWidget *parent) :
8+ QWidget(parent)
9+{
10+ _image = NULL;
11+}
12+
13+SpecgramViewer::~SpecgramViewer()
14+{
15+ _destroy();
16+}
17+
18+void SpecgramViewer::_destroy()
19+{
20+ delete _image;
21+ _image = NULL;
22+}
23+
24+void SpecgramViewer::setSpecgram(double **specgram, int tLen, int fftl)
25+{
26+ if(!specgram)
27+ {
28+ qDebug("SpecgramViewer::setSpecgram(%d, %d %d); // Invalid args", specgram, tLen, fftl);
29+ return;
30+ }
31+
32+ _destroy();
33+ _image = new QImage(tLen, fftl, QImage::Format_ARGB32);
34+
35+ // 最小の値と最大の値を見つけてくる.
36+// for(int x = 0; x)
37+}
--- vConnect/trunk/stand2.0/StandConverter/gui/SpecgramViewer.h (nonexistent)
+++ vConnect/trunk/stand2.0/StandConverter/gui/SpecgramViewer.h (revision 1983)
@@ -0,0 +1,35 @@
1+#ifndef SPECGRAMVIEWER_H
2+#define SPECGRAMVIEWER_H
3+
4+#include <QWidget>
5+
6+class QImage;
7+
8+namespace stand
9+{
10+namespace gui
11+{
12+
13+class SpecgramViewer : public QWidget
14+{
15+ Q_OBJECT
16+public:
17+ explicit SpecgramViewer(QWidget *parent = NULL);
18+ ~SpecgramViewer();
19+
20+ void setSpecgram(double **specgram, int tLen, int fftl);
21+ //void paintEvent(QPaintEvent *e);
22+signals:
23+
24+public slots:
25+ //void specgramDeleted();
26+
27+private:
28+ void _destroy();
29+ QImage *_image;
30+};
31+
32+}
33+}
34+
35+#endif // SPECGRAMVIEWER_H
--- vConnect/trunk/stand2.0/StandConverter/main.cpp (revision 1982)
+++ vConnect/trunk/stand2.0/StandConverter/main.cpp (revision 1983)
@@ -19,7 +19,9 @@
1919
2020 // 実行
2121 // ConverterWindow w;
22+// w.setWindowTitle("Compressor");
2223 TranscriberWindow w;
24+ w.setWindowTitle("Transcriber");
2325 w.show();
2426
2527 return a.exec();
--- vConnect/trunk/stand2.0/StandConverter/io/StandFile.cpp (revision 1982)
+++ vConnect/trunk/stand2.0/StandConverter/io/StandFile.cpp (revision 1983)
@@ -45,7 +45,7 @@
4545 _fftl = 2048;
4646 _fs = 44100;
4747
48- delete vorbis.data;
48+ delete[] vorbis.data;
4949 vorbis.data = NULL;
5050 vorbis.size = 0;
5151 }
--- vConnect/trunk/stand2.0/StandConverter/synthesis/Transcriber.cpp (revision 1982)
+++ vConnect/trunk/stand2.0/StandConverter/synthesis/Transcriber.cpp (revision 1983)
@@ -22,10 +22,6 @@
2222
2323 Transcriber::~Transcriber()
2424 {
25- for(int i = 0; i < setting->libraries.size();i ++)
26- {
27- delete setting->libraries.at(i).body;
28- }
2925 for(int i = 0; i < elements.size(); i++)
3026 {
3127 elements.at(i)->finishTranscription();
@@ -33,6 +29,10 @@
3329 elements.at(i)->disconnect();
3430 delete elements.at(i);
3531 }
32+ for(int i = 0; i < setting->libraries.size();i ++)
33+ {
34+ delete setting->libraries.at(i).body;
35+ }
3636 delete setting;
3737 }
3838
@@ -46,7 +46,6 @@
4646 return;
4747 }
4848
49- QMutex mutex;
5049 mutex.lock();
5150 elements.clear();
5251 for(int i = 0; i < setting->numThreads && i < setting->libraries.at(0).body->size(); i++)
--- vConnect/trunk/stand2.0/StandConverter/synthesis/Transcriber.h (revision 1982)
+++ vConnect/trunk/stand2.0/StandConverter/synthesis/Transcriber.h (revision 1983)
@@ -50,6 +50,7 @@
5050 int currentIndex;
5151 QVector<TranscriberElement *> elements;
5252
53+ QMutex mutex;
5354 QMutex waitMutex;
5455 QWaitCondition condition;
5556 };
--- vConnect/trunk/stand2.0/StandConverter/synthesis/TranscriberElement.cpp (revision 1982)
+++ vConnect/trunk/stand2.0/StandConverter/synthesis/TranscriberElement.cpp (revision 1983)
@@ -52,6 +52,7 @@
5252
5353 void TranscriberElement::_analyze()
5454 {
55+ qDebug("Transcriber::_analyze(%d);", index);
5556 stand::io::StandFile *prev, *current = NULL;
5657 prev = new stand::io::StandFile();
5758 QString filename = items.at(0).body->directory().absolutePath() + QDir::separator() + items.at(0).body->at(index)->filename;
@@ -64,15 +65,22 @@
6465 for(int i = 1; i < items.size(); i++)
6566 {
6667 const stand::io::UtauPhoneme *phoneme = items.at(i).body->find(items.at(0).body->at(index)->pronounce);
67- if(phoneme)
68+ if(!phoneme)
6869 {
70+ current = NULL;
71+ }
72+ else
73+ {
6974 filename = items.at(i).body->directory().absolutePath() + QDir::separator() + phoneme->filename;
7075 current = new stand::io::StandFile();
7176 // 現在のファイルを読み込む→現在のファイルがよめていて,前回もファイルが読めていた場合だけ分析を行う.
72- if(filename.contains(".vvd") && current->read(QDir::toNativeSeparators(filename).toLocal8Bit().data()) && prev)
77+ if(filename.contains(".vvd") && current->read(QDir::toNativeSeparators(filename).toLocal8Bit().data()))
7378 {
7479 // 写像関数の計算と保存
75- stand::io::StandFile::matching(prev, current);
80+ if(prev)
81+ {
82+ stand::io::StandFile::matching(prev, current);
83+ }
7684 current->write(QDir::toNativeSeparators(filename).toLocal8Bit().data());
7785 }
7886 else
@@ -84,5 +92,7 @@
8492 delete prev;
8593 prev = current;
8694 }
87- delete current;
95+ delete prev;
96+ qDebug(" Done : matching \"%s\"", items.at(0).body->at(index)->pronounce.toUtf8().data());
97+ qDebug(" : finished calculation between %d elements at %d", items.size(), index);
8898 }
旧リポジトリブラウザで表示