• R/O
  • SSH
  • HTTPS

cadencii: コミット


コミットメタ情報

リビジョン1970 (tree)
日時2012-01-15 09:24:25
作者kbinani

ログメッセージ

[vConnect/trunk/stand2.0] moved: vsqMetaTextをvsqに改名

変更サマリ

差分

--- vConnect/trunk/stand2.0/stand/vsqMetaText/TempoList.h (revision 1969)
+++ vConnect/trunk/stand2.0/stand/vsqMetaText/TempoList.h (nonexistent)
@@ -1,60 +0,0 @@
1-/*
2- * TempoList.h
3- * Copyright © 2010-2012 HAL
4- * Copyright © 2012 kbinani
5- *
6- * This file is part of vConnect-STAND.
7- *
8- * vConnect-STAND is free software; you can redistribute it and/or
9- * modify it under the terms of the GPL License.
10- *
11- * vConnect-STAND is distributed in the hope that it will be useful,
12- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14- */
15-#ifndef __TempoList_h__
16-#define __TempoList_h__
17-
18-#include <string>
19-
20-using namespace std;
21-
22-namespace vconnect
23-{
24- class TempoList
25- {
26- public:
27- /**
28- * デフォルトのテンポ値
29- */
30- static const double DEFAULT_TEMPO;
31-
32- private:
33- /**
34- * テンポ値
35- */
36- double tempo;
37-
38- public:
39- TempoList()
40- {
41- this->tempo = DEFAULT_TEMPO;
42- }
43-
44- void setParameter( string left, string right );
45-
46- long secondToTick( double second );
47-
48- double tickToSecond( long tick );
49-
50- /**
51- * テンポ値を取得する
52- * @return テンポ値
53- */
54- double getTempo()
55- {
56- return this->tempo;
57- }
58- };
59-}
60-#endif
--- vConnect/trunk/stand2.0/stand/vsqMetaText/Event.h (revision 1969)
+++ vConnect/trunk/stand2.0/stand/vsqMetaText/Event.h (nonexistent)
@@ -1,85 +0,0 @@
1-/*
2- * Event.h
3- * Copyright (C) 2010- HAL,
4- * Copyright (C) 2011-2012 kbinani.
5- *
6- * This files is a part of v.Connect.
7- * vsqEventEx contains vsq-event's properties
8- * and some UTAU properties such as preutterance and voice-overlap.
9- *
10- * These files are distributed in the hope that it will be useful,
11- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13- *
14- */
15-#ifndef __Event_h__
16-#define __Event_h__
17-
18-#include "Handle.h"
19-#include "../utau/UtauParameter.h"
20-
21-namespace vconnect
22-{
23- class Event
24- {
25- public:
26- Event(){
27- utauSetting.fileName = "";
28- utauSetting.lyric = "";
29- utauSetting.msLeftBlank = 0.0f;
30- utauSetting.msFixedLength = 0.0f;
31- utauSetting.msRightBlank = 0.0f;
32- utauSetting.msPreUtterance = 0.0f;
33- utauSetting.msVoiceOverlap = 0.0f;
34- vibratoDelay = 0;
35- isContinuousBack = false;
36- isRest = false;
37-
38- portamentoDepth = 8;
39- portamentoLength = 0;
40- portamentoUse = 0;
41- decay = 50;
42- attack = 50;
43-
44- singerIndex = 0;
45- }
46- //void setParameter( string left, string right );
47-
48- string toString()
49- {
50- char buff[1024];
51- buff[0] = '\n';
52- sprintf( buff, "%d", singerIndex );
53- string str_buff = buff;
54- return "{singerIndex=" + str_buff + "}";
55- }
56-
57- Handle vibratoHandle;
58- Handle lyricHandle;
59- Handle iconHandle;
60-
61- string type;
62- long tick;
63- long length;
64- long vibratoDelay;
65- unsigned char note;
66- char velocity;
67- unsigned char portamentoDepth;
68- unsigned char portamentoLength;
69- unsigned char portamentoUse;
70- unsigned char decay;
71- unsigned char attack;
72-
73- bool isVCV;
74- bool isContinuousBack;
75- bool isRest;
76-
77- int singerIndex;
78-
79- long beginFrame;
80- long endFrame;
81-
82- UtauParameter utauSetting;
83- };
84-}
85-#endif
--- vConnect/trunk/stand2.0/stand/vsqMetaText/Lyric.h (revision 1969)
+++ vConnect/trunk/stand2.0/stand/vsqMetaText/Lyric.h (nonexistent)
@@ -1,38 +0,0 @@
1-/**
2- * Lyric.h
3- * Copyright (C) 2010 HAL, 2012 kbinani
4- *
5- * This file is part of v.Connect.
6- *
7- * v.Connect is free software; you can redistribute it and/or
8- * modify it under the terms of the GNU GPL Lisence.
9- *
10- * v.Connect is distributed in the hope that it will be useful,
11- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13- */
14-#ifndef __Lyric_h__
15-#define __Lyric_h__
16-
17-#include <string>
18-
19-namespace vconnect
20-{
21- using namespace std;
22-
23- class Lyric
24- {
25- private:
26- string lyric;
27-
28- public:
29- Lyric();
30-
31- Lyric( string line );
32-
33- string getLyric();
34-
35- string toString();
36- };
37-}
38-#endif
--- vConnect/trunk/stand2.0/stand/vsqMetaText/Handle.cpp (revision 1969)
+++ vConnect/trunk/stand2.0/stand/vsqMetaText/Handle.cpp (nonexistent)
@@ -1,163 +0,0 @@
1-/**
2- * vsqHandle.cpp
3- * Copyright (C) 2010 HAL, kbinani
4- *
5- * This file is a part of v.Connect,
6- * implements the class 'vsqHandle' for handling singer, vibrato, and lyric
7- * data in VSQ meta-text.
8- *
9- * These files are distributed in the hope that it will be useful,
10- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12- */
13-#include <iostream>
14-#include "Handle.h"
15-
16-using namespace std;
17-
18-namespace vconnect
19-{
20- void Handle::setParameter( string left, string right )
21- {
22- if( left.compare( "IconID" ) == 0 ){
23- iconID = right;
24- }else if( left.compare( "IDS" ) == 0 ){
25- IDS = right;
26- }else if( left.compare( "Caption" ) == 0 ){
27- caption = right;
28- }else if( left.compare( "Length" ) == 0 ){
29- length = atoi( right.c_str() );
30- }else if( left.compare( "Language" ) == 0 ){
31- language = atoi( right.c_str() );
32- }else if( left.compare( "Program" ) == 0 ){
33- program = atoi( right.c_str() );
34- }else if( left.compare( "Original" ) == 0 ){
35- original = atoi( right.c_str() );
36- }else if( left.compare( "StartDepth" ) == 0 ){
37- VibratoBP point;
38- point.value = atoi( right.c_str() );
39- point.position = -1.0;
40- if( vibratoDepth.size() <= 0 )
41- {
42- vibratoDepth.resize( 1 );
43- }
44- vibratoDepth[0] = point;
45- }else if( left.compare( "DepthBPNum" ) == 0 ){
46- parseBPNum( vibratoDepth, right );
47- }else if( left.compare( "DepthBPX" ) == 0 ){
48- parseBP( vibratoDepth, right, true );
49- }else if( left.compare( "DepthBPY" ) == 0 ){
50- parseBP( vibratoDepth, right, false );
51- }else if( left.compare( "StartRate" ) == 0 ){
52- VibratoBP point;
53- point.value = atoi( right.c_str() );
54- point.position = -1.0;
55- if( vibratoRate.size() <= 0 )
56- {
57- vibratoRate.resize( 1 );
58- }
59- vibratoRate[0] = point;
60- }else if( left.compare( "RateBPNum" ) == 0 ){
61- parseBPNum( vibratoRate, right );
62- }else if( left.compare( "RateBPX" ) == 0 ){
63- parseBP( vibratoRate, right, true );
64- }else if( left.compare( "RateBPY" ) == 0 ){
65- parseBP( vibratoRate, right, false );
66- }else if( left.find( "L" ) != string::npos ){
67- lyric = Lyric( right );
68- }else{
69- string Message = "warning: unknown Property in VsqHandle : " + left;
70- cout << Message << endl;
71- }
72- }
73-
74- void Handle::parseBPNum( vector<VibratoBP> &list, string str )
75- {
76- vector<VibratoBP>::size_type new_size = atoi( str.c_str() ) + 1;
77- list.resize( new_size );
78- }
79-
80- void Handle::parseBP( vector<VibratoBP> &list, string str, bool parse_x )
81- {
82- string s;
83- string::size_type indx_comma = str.find( "," );
84- int indx = 1;
85- while( indx_comma != string::npos )
86- {
87- s = str.substr( 0, indx_comma );
88- if( list.size() <= indx ){
89- list.resize( indx + 1 );
90- }
91-
92- if( parse_x ){
93- list[indx].position = (float)atof( s.c_str() );
94- }else{
95- list[indx].value = atoi( s.c_str() );
96- }
97- str = str.substr( indx_comma + 1 );
98- indx_comma = str.find( "," );
99- indx++;
100- }
101- if( str.size() > 0 ){
102- if( list.size() <= indx ){
103- list.resize( indx + 1 );
104- }
105- s = str;
106- if( parse_x ){
107- list[indx].position = (float)atof( s.c_str() );
108- }else{
109- list[indx].value = atoi( s.c_str() );
110- }
111- }
112- }
113-
114- short Handle::getVibratoDepth( double position )
115- {
116- short ret;
117- vector<VibratoBP>::size_type i;
118- vector<VibratoBP>::size_type c = vibratoDepth.size();
119- for( i = 0; i < c; i++ )
120- {
121- if( vibratoDepth[i].position > position )
122- {
123- break;
124- }
125- }
126- if( i != 0 )
127- {
128- i--;
129- ret = vibratoDepth[i].value;
130- }
131- else
132- {
133- ret = 0;
134- }
135-
136- return ret;
137- }
138-
139- short Handle::getVibratoRate( double position )
140- {
141- short ret = 0;
142- vector<VibratoBP>::size_type i;
143- vector<VibratoBP>::size_type c = vibratoRate.size();
144- for( i = 0; i < c; i++ )
145- {
146- if( vibratoRate[i].position > position )
147- {
148- break;
149- }
150- }
151- if( i != 0 )
152- {
153- i--;
154- ret = vibratoRate[i].value;
155- }
156- else
157- {
158- ret = 0;
159- }
160-
161- return ret;
162- }
163-}
--- vConnect/trunk/stand2.0/stand/vsqMetaText/BPList.cpp (revision 1969)
+++ vConnect/trunk/stand2.0/stand/vsqMetaText/BPList.cpp (nonexistent)
@@ -1,55 +0,0 @@
1-/*
2- * BPList.cpp
3- * Copyright © 2010-2012 HAL, 2012 kbinani
4- *
5- * This file is part of vConnect-STAND.
6- *
7- * vConnect-STAND is free software; you can redistribute it and/or
8- * modify it under the terms of the GPL License.
9- *
10- * vConnect-STAND is distributed in the hope that it will be useful,
11- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13- */
14-#include "BPList.h"
15-#include "../Configuration.h"
16-
17-namespace vconnect
18-{
19- void BPList::setParameter( string left, string right )
20- {
21- BP current;
22- current.tick = atoi( left.c_str() );
23- current.value = atoi( right.c_str() );
24-
25- data.push_back( current );
26- }
27-
28- void BPList::setParameter( long tick, int value )
29- {
30- BP current;
31- current.tick = tick;
32- current.value = value;
33- data.push_back( current );
34- }
35-
36- void BPList::getList( vector<FrameBP>& dst, double tempo )
37- {
38- vector<BP>::size_type size = this->data.size();
39- dst.clear();
40- dst.resize( size );
41- double framePeriod = Configuration::getMilliSecondsPerFrame();
42- for( vector<BP>::size_type i = 0; i < size; i++ ){
43- dst[i].value = this->data[i].value;
44- dst[i].frameTime = INT_MAX; // the value will continue till this time.
45- if( i ){
46- dst[i - 1].frameTime = (long)(1000.0 * (double)(this->data[i].tick) / 480.0 * 60.0 / tempo / framePeriod);
47- }
48- }
49- }
50-
51- BP BPList::get( int index )
52- {
53- return this->data[index];
54- }
55-}
--- vConnect/trunk/stand2.0/stand/vsqMetaText/VibratoBP.h (revision 1969)
+++ vConnect/trunk/stand2.0/stand/vsqMetaText/VibratoBP.h (nonexistent)
@@ -1,25 +0,0 @@
1-/**
2- * VibratoBP.h
3- * Copyright (C) 2010 HAL, kbinani
4- *
5- * This file is part of v.Connect.
6- *
7- * v.Connect is free software; you can redistribute it and/or
8- * modify it under the terms of the GNU GPL Lisence.
9- *
10- * v.Connect is distributed in the hope that it will be useful,
11- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13- */
14-#ifndef __VibratoBP_h__
15-#define __VibratoBP_h__
16-
17-namespace vconnect
18-{
19- struct VibratoBP
20- {
21- float position;
22- short value;
23- };
24-}
25-#endif
--- vConnect/trunk/stand2.0/stand/vsqMetaText/Handle.h (revision 1969)
+++ vConnect/trunk/stand2.0/stand/vsqMetaText/Handle.h (nonexistent)
@@ -1,92 +0,0 @@
1-/**
2- * Handle.h
3- * Copyright (C) 2010 HAL, 2012 kbinani
4- *
5- * This files is a part of v.Connect.
6- * vsqHandle class contains vsq-handle.
7- *
8- * These files are distributed in the hope that it will be useful,
9- * but WITHOUT ANY WARRANTY; without even the implied warranty of
10- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11- *
12- */
13-#ifndef __Handle_h__
14-#define __Handle_h__
15-
16-#include <string>
17-#include <vector>
18-#include "VibratoBP.h"
19-#include "Lyric.h"
20-
21-namespace vconnect
22-{
23- using namespace std;
24-
25- class Handle
26- {
27- public:
28- void setParameter( string left, string right );
29-
30- string getLyric( void ){ return lyric.getLyric(); }
31- string getIDS( void ){ return IDS; }
32- /**
33- * ビブラート深さの値を取得しする
34- * @param position 値を取得する位置.ビブラートの開始位置が0,終了位置が1となるような値を渡す
35- * @return 指定した位置でのビブラート深さの値
36- */
37- short getVibratoDepth( double position );
38- /**
39- * ビブラート速さの値を取得しする
40- * @param position 値を取得する位置.ビブラートの開始位置が0,終了位置が1となるような値を渡す
41- * @return 指定した位置でのビブラート速さの値
42- */
43- short getVibratoRate( double position );
44-
45- string toString()
46- {
47- string ret = "";
48- ret += "{iconID=" + iconID + ",IDS=" + IDS + ",lyric=" + lyric.toString() + "}";
49- return ret;
50- }
51-
52-
53- private:
54- string iconID;
55- string IDS;
56- string caption;
57- short original;
58- short length;
59- short language;
60- short program;
61-
62- /**
63- * Vibrato Depthのカーブを保持する.
64- * StartDepthがインデックス0に,BPX, BPYによる指定がインデックス1以降に記録される
65- */
66- vector<VibratoBP> vibratoDepth;
67- /**
68- * Vibrato Rateのカーブを保持する.
69- * StartRateがインデックス0に,BPX, BPYによる指定がインデックス1以降に記録される
70- */
71- vector<VibratoBP> vibratoRate;
72- Lyric lyric;
73-
74- /**
75- * DepthBPNum, RateBPNumの解釈を行う.setParameterから呼ばれる内部関数
76- * @param list 解釈を行う対象のBPリスト.vibratoDepthまたはvibratoRate
77- * @param str 解釈するソース文字列の,"="の右側.例:"DepthBPNum=1"なら"1"を渡す
78- * @return [void]
79- */
80- void parseBPNum( vector<VibratoBP>& list, string str );
81-
82- /**
83- * DepthBPX, DepthBPY, RateBPX, RateBPYの解釈を行う.setParameterから呼ばれる内部関数
84- * @param list 解釈を行う対象のBPリスト.vibratoDepthまたはvibratoRate
85- * @param str 解釈するソース文字列の,"="の右側.例:"DepthBPX=0.1,1.0"なら"0.1,1.0"を渡す
86- * @param parse_x *BPXを解釈する場合にtrue, *BPYを解釈する場合にfalse
87- * @return [void]
88- */
89- void parseBP( vector<VibratoBP>& list, string str, bool parse_x );
90- };
91-}
92-#endif
--- vConnect/trunk/stand2.0/stand/vsqMetaText/BPList.h (revision 1969)
+++ vConnect/trunk/stand2.0/stand/vsqMetaText/BPList.h (nonexistent)
@@ -1,48 +0,0 @@
1-/*
2- * BPList.h
3- * Copyright © 2010-2012 HAL, 2012 kbinani
4- *
5- * This file is part of vConnect-STAND.
6- *
7- * vConnect-STAND is free software; you can redistribute it and/or
8- * modify it under the terms of the GPL License.
9- *
10- * vConnect-STAND is distributed in the hope that it will be useful,
11- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13- * ---------------------------------------------------------------------
14- * vsqBPList class contains and reads vsqBP data.
15- */
16-#ifndef __BPList_h__
17-#define __BPList_h__
18-
19-#include <string>
20-#include <vector>
21-#include "BP.h"
22-#include "../FrameBP.h"
23-
24-namespace vconnect
25-{
26- using namespace std;
27-
28- class BPList
29- {
30- public:
31- void getList( vector<FrameBP> &dst, double tempo );
32-
33- void setParameter( long tick, int value );
34-
35- void setParameter( string left, string right );
36-
37- /**
38- * 指定したインデックスにおけるカーブの値を取得する
39- * @param index インデックス
40- * @return カーブの値
41- */
42- BP get( int index );
43-
44- private:
45- vector<BP> data;
46- };
47-}
48-#endif
--- vConnect/trunk/stand2.0/stand/vsqMetaText/BP.h (revision 1969)
+++ vConnect/trunk/stand2.0/stand/vsqMetaText/BP.h (nonexistent)
@@ -1,25 +0,0 @@
1-/**
2- * BP.h
3- * Copyright (C) 2010 HAL, 2012 kbinani
4- *
5- * This file is part of vConnect-STAND.
6- *
7- * vConnect-STAND is free software; you can redistribute it and/or
8- * modify it under the terms of the GNU GPL Lisence.
9- *
10- * v.Connect is distributed in the hope that it will be useful,
11- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13- */
14-#ifndef __BP_h__
15-#define __BP_h__
16-
17-namespace vconnect
18-{
19- struct BP
20- {
21- long tick;
22- int value;
23- };
24-}
25-#endif // __BP_h__
--- vConnect/trunk/stand2.0/stand/vsqMetaText/Sequence.cpp (revision 1969)
+++ vConnect/trunk/stand2.0/stand/vsqMetaText/Sequence.cpp (nonexistent)
@@ -1,227 +0,0 @@
1-/*
2- * Sequence.cpp
3- * Copyright © 2009-2011 HAL,
4- * Copyright © 2011-2012 kbinani.
5- *
6- * This file is part of vConnect-STAND.
7- *
8- * vConnect-STAND is free software; you can redistribute it and/or
9- * modify it under the terms of the GPL License.
10- *
11- * vConnect-STAND is distributed in the hope that it will be useful,
12- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14- */
15-#include "Sequence.h"
16-#include "../utau/UtauDBManager.h"
17-
18-namespace vconnect
19-{
20- const string Sequence::OBJ_NAME_OTOINI = "[oto.ini]";
21- const string Sequence::OBJ_NAME_EVENT_LIST = "[EventList]";
22- const string Sequence::OBJ_NAME_TEMPO = "[Tempo]";
23-
24- void Sequence::setParamOtoIni( string singerName, string otoIniPath, string encoding )
25- {
26- // 名前登録して
27- int index = UtauDBManager::find( otoIniPath );
28- if( index < 0 ){
29- // 中身読んで
30- UtauDB *p = new UtauDB( otoIniPath, encoding );
31- // リストに追加
32- UtauDBManager::regist( p );
33- index = UtauDBManager::find( otoIniPath );
34- }
35- singerMap.insert( std::make_pair( singerName, index ) );
36- }
37-
38- void Sequence::setParamEvent( Event *target, string left, string right )
39- {
40- if( left.compare( "Type" ) == 0 ){
41- target->type = right;
42- }else if( left.compare( "Length" ) == 0 ){
43- target->length = atoi( right.c_str() );
44- }else if( left.compare( "Note#" ) == 0 ){
45- target->note = atoi( right.c_str() );
46- }else if( left.compare( "Dynamics" ) == 0 ){
47- target->velocity = atoi( right.c_str() );
48- }else if( left.compare( "PMBendDepth" ) == 0 ){
49- target->portamentoDepth = atoi( right.c_str() );
50- }else if( left.compare( "PMBendLength" ) == 0 ){
51- target->portamentoLength = atoi( right.c_str() );
52- }else if( left.compare( "PMbPortamentoUse" ) == 0 ){
53- target->portamentoUse = atoi( right.c_str() );
54- }else if( left.compare( "DEMdecGainRate" ) == 0 ){
55- target->decay = atoi( right.c_str() );
56- }else if( left.compare( "DEMaccent" ) == 0 ){
57- target->attack = atoi( right.c_str() );
58- }else if( left.compare( "VibratoDelay" ) == 0 ){
59- target->vibratoDelay = atoi( right.c_str() );
60- }else if( left.compare( "PreUtterance" ) == 0 ){
61- target->utauSetting.msPreUtterance = (float)atof( right.c_str() );
62- }else if( left.compare( "VoiceOverlap" ) == 0 ){
63- target->utauSetting.msVoiceOverlap = (float)atof( right.c_str() );
64- }else if( left.compare( "LyricHandle" ) == 0 ){
65- right = "[" + right + "]";
66- mMapHandles.insert( make_pair( right, &target->lyricHandle ) );
67- }else if( left.compare( "VibratoHandle" ) == 0 ){
68- right = "[" + right + "]";
69- mMapHandles.insert( make_pair( right, &target->vibratoHandle ) );
70- }else if( left.compare( "IconHandle" ) == 0 ){
71- right = "[" + right + "]";
72- mMapHandles.insert( make_pair( right, &target->iconHandle ) );
73- }else{
74- string message = "warning: unknown Property in VsqEvent : " + left;
75- cout << message << endl;//outputError( message.c_str() );
76- }
77-
78- return;
79- }
80-
81- long Sequence::getEndTick()
82- {
83- return this->events.endTick;
84- }
85-
86- double Sequence::getTempo()
87- {
88- return this->vsqTempoBp.getTempo();
89- }
90-
91- Sequence::Sequence()
92- {
93- vector<CurveTypeEnum::CurveType> values = CurveTypeEnum::values();
94- int size = values.size();
95- this->controlCurves.resize( size );
96- for( int i = 0; i < size; i++ ){
97- int defaultValue = CurveTypeEnum::getDefault( values[i] );
98- string name = CurveTypeEnum::getName( values[i] );
99- this->controlCurves[i].setParameter( -10000, defaultValue );
100- this->mMapCurves.insert( make_pair( name, &this->controlCurves[i] ) );
101- }
102- }
103-
104- bool Sequence::read( string file_name, RuntimeOption option )
105- {
106- bool result = false;
107- TextInputStream *stream = new TextInputStream( file_name, option.getEncodingVsqText() );
108- bool ret = this->readCore( stream, file_name, option.getEncodingOtoIni() );
109- delete stream;
110- return ret;
111- }
112-
113- bool Sequence::readCore( InputStream *stream, string vsqFilePath, string encodingOtoIni )
114- {
115- if( !stream ) return false;
116-
117- string temp, search, left, right;
118- //Map<string, vsqBase *>::iterator i;
119-
120- while( stream->ready() ){
121- temp = stream->readLine();
122-
123- // 空文字の場合は次へ
124- if( temp.size() <= 0 ) continue;
125-
126- if( temp.find( "[" ) == 0 ){
127- search = temp;
128- continue;
129- }
130- string::size_type indx_equal = temp.find( "=" );
131- if( indx_equal == string::npos ){
132- left = temp;
133- right = "";
134- }else{
135- left = temp.substr( 0, indx_equal );
136- right = temp.substr( indx_equal + 1 );
137- }
138-
139- if( search.compare( OBJ_NAME_EVENT_LIST ) == 0 ){
140- // [EventList]
141- string::size_type indx_comma = right.find( "," );
142- while( indx_comma != string::npos ){
143- // コンマが見つからなくなるまでループ
144- string tright = right.substr( 0, indx_comma );
145- this->events.setParameter( left, tright, mMapIDs );
146- right = right.substr( indx_comma + 1 );
147- indx_comma = right.find( "," );
148- }
149- this->events.setParameter( left, right, mMapIDs );
150- }else if( search.compare( OBJ_NAME_OTOINI ) == 0 ){
151- // [oto.ini]
152- string::size_type index = left.find( "\t" );
153- string singerName, otoIniPath;
154-
155- if( index == string::npos ){
156- singerName = "";
157- otoIniPath = left;
158- }else{
159- singerName = left.substr( 0, index );
160- otoIniPath = left.substr( index + 1 );
161- }
162- if( false == Path::exists( otoIniPath ) ){
163- string directory = Path::getDirectoryName( vsqFilePath );
164- otoIniPath = Path::combine( directory, otoIniPath );
165- }
166- this->setParamOtoIni( singerName, otoIniPath, encodingOtoIni );
167- }else if( search.compare( OBJ_NAME_TEMPO ) == 0 ){
168- // [Tempo]
169- this->vsqTempoBp.setParameter( left, right );
170- }else if( search.find( "[ID#" ) == 0 ){
171- // ID
172- Map<string, Event *>::iterator i;
173- i = mMapIDs.find( search );
174- if( i != mMapIDs.end() && i->second ){
175- setParamEvent( i->second, left, right );
176- }
177- }else if( search.find( "[h#" ) == 0 ){
178- // handle
179- Map<string, Handle *>::iterator i;
180- i = mMapHandles.find( search );
181- if( i != mMapHandles.end() && i->second ){
182- i->second->setParameter( left, right );
183- }
184- }else{
185- // たぶんコントロールカーブ
186- Map<string, BPList *>::iterator i;
187- i = mMapCurves.find( search );
188- if( i != mMapCurves.end() && i->second ){
189- i->second->setParameter( left, right );
190- }else{
191- // そんなセクション名知らねー
192- string message;
193- message = "vsqFileEx::readCore; not found: " + search;
194- cout << message << endl;
195- }
196- }
197- }
198-
199- // utau音源が無ければ合成しようがないので false.
200- int size = UtauDBManager::size();
201-
202- #if defined( _DEBUG )
203- dumpEvents();
204- dumpMapIDs();
205- dumpMapHandles();
206- cout << "vsqFileEx::readCore; size=" << size << endl;
207- #endif
208-
209- return (size > 0);
210- }
211-
212- double Sequence::getEndSec()
213- {
214- return this->vsqTempoBp.tickToSecond( getEndTick() );
215- }
216-
217- int Sequence::getSingerIndex( string t_search )
218- {
219- int ret = 0;
220- Map<string, int>::iterator i = singerMap.find( t_search );
221- if( i != singerMap.end() )
222- {
223- ret = i->second;
224- }
225- return ret;
226- }
227-}
--- vConnect/trunk/stand2.0/stand/vsqMetaText/Sequence.h (revision 1969)
+++ vConnect/trunk/stand2.0/stand/vsqMetaText/Sequence.h (nonexistent)
@@ -1,234 +0,0 @@
1-/*
2- * Sequence.h
3- * Copyright © 2009-2011 HAL,
4- * Copyright © 2011-2012 kbinani.
5- *
6- * This file is part of vConnect-STAND.
7- *
8- * vConnect-STAND is free software; you can redistribute it and/or
9- * modify it under the terms of the GPL License.
10- *
11- * vConnect-STAND is distributed in the hope that it will be useful,
12- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14- */
15-#ifndef __vsqFileEx_h__
16-#define __vsqFileEx_h__
17-
18-#include <string>
19-#include "Event.h"
20-#include "EventList.h"
21-#include "BPList.h"
22-#include "TempoList.h"
23-#include "CurveTypeEnum.h"
24-#include "../RuntimeOption.h"
25-#include "../Socket.h"
26-#include "../Path.h"
27-#include "../InputStream.h"
28-#include "../TextInputStream.h"
29-#include "../Map.h"
30-
31-namespace vconnect
32-{
33- using namespace std;
34-
35- /// <summary>
36- /// VSQメタテキストが表現するシーケンスを取り扱うクラスです.
37- /// </summary>
38- class Sequence
39- {
40- public:
41- /// <summary>
42- /// コンストラクタ.コントロールカーブのvectorの初期化等を行います.
43- /// </summary>
44- Sequence();
45-
46- /// <summary>
47- /// ファイルからVSQのメタテキストを読み込みます.
48- /// </summary>
49- /// <param name="file_name">読み込むメタテキストファイルのパス.</param>
50- /// <param name="options">読み込み時の設定値.</param>
51- /// <returns>読み込みに成功した場合true,それ以外はfalseを返します.</returns>
52- bool read( string file_name, RuntimeOption option );
53-
54- /// <summary>
55- /// ソケットからVSQのメタテキストを読み込みます.
56- /// </summary>
57- /// <param name="socket">読み込むソケット.</param>
58- /// <param name="options">読み込み時の設定値.</param>
59- /// <returns>読み込みに成功した場合true,それ以外はfalseを返します.</returns>
60- bool read( Socket socket, RuntimeOption option );
61-
62- /// <summary>
63- /// シーケンスの演奏長さを取得します.単位は秒です.
64- /// </summary>
65- /// <returns>シーケンスの演奏長さ.</returns>
66- double getEndSec();
67-
68- /// <summary>
69- /// 歌手の名前から,歌手を特定するためのインデックスを取得します.
70- /// </summary>
71- /// <param name="singer_name">歌手の名前</param>
72- /// <returns>歌手を特定するインデックス.歌手が見つけられなかった場合は規定値の0を返します.</returns>
73- int getSingerIndex( string singer_name );
74-
75- /// <summary>
76- /// テンポ値を取得します.
77- /// </summary>
78- double getTempo();
79-
80- /// <summary>
81- /// シーケンスの長さ(tick単位)を取得します.
82- /// </summary>
83- /// <returns>シーケンスの長さ(tick単位)</returns>
84- long getEndTick();
85-
86- /**
87- * 四分音符一拍あたりの Tick 単位の時間を取得する
88- * @return Tick 単位の時間
89- */
90- static int getTickPerBeat()
91- {
92- return 480;
93- }
94-
95- /**
96- * A4 の音の周波数(Hz)を取得する
97- * @return 周波数(Hz)
98- */
99- static double getA4Frequency()
100- {
101- return 440.0;
102- }
103-
104- /**
105- * A4 の音のノート番号を取得する
106- * @return ノート番号
107- */
108- static int getA4NoteNumber()
109- {
110- return 69;
111- }
112-
113- public:
114-
115- /// <summary>
116- /// ダイナミクスなどのコントロールカーブを格納したvector.
117- /// </summary>
118- vector<BPList> controlCurves;
119-
120- Map<string, BPList *> mMapCurves;
121-
122- /// <summary>
123- /// シーケンス内の音符と歌手変更イベントを格納したリスト.
124- /// </summary>
125- EventList events;
126-
127- /// <summary>
128- /// テンポの変更情報を格納したリスト.
129- /// </summary>
130- TempoList vsqTempoBp;
131-
132- /// <summary>
133- /// [ID#]の文字列と,その中身との紐付けを保持するマップ.
134- /// </summary>
135- Map<string, vconnect::Event *> mMapIDs;
136-
137- /// <summary>
138- /// [h#]の文字列と,その中身との紐付けを保持するマップ.
139- /// </summary>
140- Map<string, Handle *> mMapHandles;
141-
142- /**
143- * 歌手の名称(だったけ?IDSのぶぶんだったかIconIDの部分だったか忘れた)と,
144- * 歌手のインデックスとの紐付けを保持する.
145- */
146- Map<string, int> singerMap;
147-
148- private:
149- /**
150- * VSQのメタテキストを読み込みます.
151- * @param stream 読み込むストリーム.
152- * @param vsqFilePath 読み込むファイルのパス
153- * @param encodingOtoIni oto.ini ファイルのテキストエンコーディング
154- * @return 読み込みに成功した場合true,それ以外はfalseを返します.
155- */
156- bool readCore( InputStream *stream, string vsqFilePath, string encodingOtoIni );
157-
158- /// <summary>
159- /// 指定したイベントの内容を,メタテキストの行データを元に設定します.
160- /// </summary>
161- /// <param name="target>設定対象のイベント</param>
162- /// <param name="left">メタテキストの"="の左側部分</param>
163- /// <param name="right">メタテキストの"="の右側部分</param>
164- void setParamEvent( vconnect::Event *target, string left, string right );
165-
166- /**
167- * 歌手名と oto.ini のパスの紐付けを登録する
168- * @param singerName 歌手名
169- * @param otoIniPath oto.ini のパス
170- * @param encoding oto.ini のテキストエンコーディング
171- */
172- void setParamOtoIni( string singerName, string otoIniPath, string encoding );
173-
174- /**
175- * [oto.ini] セクションの名前
176- */
177- static const string OBJ_NAME_OTOINI;
178-
179- /**
180- * [EventList] セクションの名前
181- */
182- static const string OBJ_NAME_EVENT_LIST;
183-
184- /**
185- * [Tempo] セクションの名前
186- */
187- static const string OBJ_NAME_TEMPO;
188-
189- private:
190-
191-#if defined( _DEBUG )
192- public:
193-#endif
194- /// <summary>
195- /// eventsの中身をダンプします
196- /// </summary>
197- void dumpEvents()
198- {
199- cout << "vsqFileEx::dumpEvents" << endl;
200- int size = events.eventList.size();
201- for( int i = 0; i < size; i++ )
202- {
203- Event *item = events.eventList[i];
204- cout << "[" << i << "]" << " tick=" << item->tick << endl;
205- }
206- }
207-
208- /// <summary>
209- /// mMapIDsの中身をダンプします.
210- /// </summary>
211- void dumpMapIDs()
212- {
213- cout << "vsqFileEx::dumpMapIDs" << endl;
214- Map<string, Event *>::iterator i;
215- for( i = mMapIDs.begin(); i != mMapIDs.end(); i++ ){
216- Event *item = i->second;
217- cout << i->first << ":" << item->toString() << endl;
218- }
219- }
220-
221- /// <summary>
222- /// mMapHandlesの中身をダンプします.
223- /// </summary>
224- void dumpMapHandles()
225- {
226- cout << "vsqFileEx::dumpMapHandles" << endl;
227- Map<string, Handle *>::iterator i;
228- for( i = mMapHandles.begin(); i != mMapHandles.end(); i++ ){
229- cout << i->first << ":" << i->second->toString() << endl;
230- }
231- }
232- };
233-}
234-#endif
--- vConnect/trunk/stand2.0/stand/vsqMetaText/EventList.cpp (revision 1969)
+++ vConnect/trunk/stand2.0/stand/vsqMetaText/EventList.cpp (nonexistent)
@@ -1,34 +0,0 @@
1-/**
2- * EventList.cpp
3- * Copyright (C) 2009-2011 HAL,
4- * Copyright (C) 2011-2012 kbinani
5- */
6-#include "EventList.h"
7-
8-namespace vconnect
9-{
10- EventList::~EventList()
11- {
12- for( unsigned long i = 0; i < eventList.size(); i++ )
13- {
14- if( eventList[i] )
15- {
16- delete eventList[i];
17- }
18- }
19- }
20-
21- void EventList::setParameter( string left, string right, Map<string, Event *> &id_map )
22- {
23- /* If Back is EOS, Front is End Tick */
24- if( right.compare( "EOS" ) == 0 ){
25- endTick = atol( left.c_str() );
26- }else{
27- Event *target = new Event();
28- right = "[" + right + "]";
29- target->tick = atoi( left.c_str() );
30- eventList.push_back( target );
31- id_map.insert( make_pair( right, target ) );
32- }
33- }
34-}
--- vConnect/trunk/stand2.0/stand/vsqMetaText/CurveTypeEnum.h (revision 1969)
+++ vConnect/trunk/stand2.0/stand/vsqMetaText/CurveTypeEnum.h (nonexistent)
@@ -1,118 +0,0 @@
1-/**
2- * CurveTypeEnum.h
3- * Copyright (C) 2012 kbinani
4- *
5- * This file is part of vConnect-STAND.
6- *
7- * vConnect-STAND is free software; you can redistribute it and/or
8- * modify it under the terms of the GNU GPL Lisence.
9- *
10- * v.Connect is distributed in the hope that it will be useful,
11- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13- */
14-#ifndef __CurveTypeEnum_h__
15-#define __CurveTypeEnum_h__
16-
17-namespace vconnect
18-{
19- /**
20- * コントロールカーブの種類を表す
21- */
22- class CurveTypeEnum
23- {
24- public:
25- enum CurveType
26- {
27- PITCH_BEND = 0,
28- PITCH_BEND_SENS,
29- DYNAMICS,
30- BRETHINESS,
31- BRIGHTNESS,
32- CLEARNESS,
33- GENDER,
34- };
35-
36- /**
37- * カーブの種類から、そのカーブのデフォルト値を取得する
38- * @param curveType カーブの種類
39- * @return デフォルト値
40- */
41- static int getDefault( CurveType curveType )
42- {
43- switch( curveType ){
44- case PITCH_BEND:{
45- return 0;
46- }
47- case PITCH_BEND_SENS:{
48- return 2;
49- }
50- case DYNAMICS:{
51- return 64;
52- }
53- case BRETHINESS:{
54- return 0;
55- }
56- case BRIGHTNESS:{
57- return 64;
58- }
59- case CLEARNESS:{
60- return 0;
61- }
62- case GENDER:{
63- return 64;
64- }
65- }
66- }
67-
68- /**
69- * カーブの種類から、そのカーブの名前を取得する
70- * @param curveType カーブの種類
71- * @return 名前
72- */
73- static string getName( CurveType curveType )
74- {
75- switch( curveType ){
76- case PITCH_BEND:{
77- return "[PitchBendBPList]";
78- }
79- case PITCH_BEND_SENS:{
80- return "[PitchBendSensBPList]";
81- }
82- case DYNAMICS:{
83- return "[DynamicsBPList]";
84- }
85- case BRETHINESS:{
86- return "[EpRResidualBPList]";
87- }
88- case BRIGHTNESS:{
89- return "[EpRESlopeBPList]";
90- }
91- case CLEARNESS:{
92- return "[EpRESlopeDepthBPList]";
93- }
94- case GENDER:{
95- return "[GenderFactorBPList]";
96- }
97- }
98- }
99-
100- /**
101- * カーブの種類の一覧を取得する
102- * @return カーブ種類のリスト
103- */
104- static vector<CurveType> values()
105- {
106- vector<CurveType> result;
107- result.push_back( PITCH_BEND );
108- result.push_back( PITCH_BEND_SENS );
109- result.push_back( DYNAMICS );
110- result.push_back( BRETHINESS );
111- result.push_back( BRIGHTNESS );
112- result.push_back( CLEARNESS );
113- result.push_back( GENDER );
114- return result;
115- }
116- };
117-}
118-#endif
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
--- vConnect/trunk/stand2.0/stand/vsqMetaText/TempoList.cpp (revision 1969)
+++ vConnect/trunk/stand2.0/stand/vsqMetaText/TempoList.cpp (nonexistent)
@@ -1,37 +0,0 @@
1-/*
2- * TempoList.cpp
3- * Copyright © 2010-2012 HAL
4- * Copyright © 2012 kbinani
5- *
6- * This file is part of vConnect-STAND.
7- *
8- * vConnect-STAND is free software; you can redistribute it and/or
9- * modify it under the terms of the GPL License.
10- *
11- * vConnect-STAND is distributed in the hope that it will be useful,
12- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14- */
15-#include "TempoList.h"
16-#include "Sequence.h"
17-
18-namespace vconnect
19-{
20- const double TempoList::DEFAULT_TEMPO = 120.0;
21-
22- void TempoList::setParameter( string left, string right )
23- {
24- tempo = atof( left.c_str() );
25- }
26-
27- long TempoList::secondToTick( double second )
28- {
29- /* In This Code, only static tempo is available */
30- return (long)(second / 60.0 * tempo * Sequence::getTickPerBeat());
31- }
32-
33- double TempoList::tickToSecond( long tick )
34- {
35- return 60.0 / tempo * (double)tick / Sequence::getTickPerBeat();
36- }
37-}
--- vConnect/trunk/stand2.0/stand/vsqMetaText/EventList.h (revision 1969)
+++ vConnect/trunk/stand2.0/stand/vsqMetaText/EventList.h (nonexistent)
@@ -1,33 +0,0 @@
1-/**
2- * EventList.h
3- * Copyright (C) 2009-2011 HAL,
4- * Copyright (C) 2011-2012 kbinani
5- */
6-#ifndef __EventList_h__
7-#define __EventList_h__
8-
9-#include "../Map.h"
10-#include "Event.h"
11-
12-namespace vconnect
13-{
14- class EventList
15- {
16- public:
17-
18- ~EventList();
19-
20- void setParameter( string left, string right, Map<string, Event *> &id_map );
21-
22-
23- public:
24-
25- vector<Event *> eventList;
26-
27- /// <summary>
28- /// �V�[�P���X�̒����itick�P�ʁj
29- /// </summary>
30- long endTick;
31- };
32-}
33-#endif
--- vConnect/trunk/stand2.0/stand/vsqMetaText/Lyric.cpp (revision 1969)
+++ vConnect/trunk/stand2.0/stand/vsqMetaText/Lyric.cpp (nonexistent)
@@ -1,40 +0,0 @@
1-/**
2- * Lyric.cpp
3- * Copyright (C) 2010 HAL, 2012 kbinani
4- *
5- * This file is part of v.Connect.
6- *
7- * v.Connect is free software; you can redistribute it and/or
8- * modify it under the terms of the GNU GPL Lisence.
9- *
10- * v.Connect is distributed in the hope that it will be useful,
11- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13- */
14-#include "Lyric.h"
15-
16-namespace vconnect
17-{
18- Lyric::Lyric()
19- {
20- this->lyric = "あ";
21- }
22-
23- Lyric::Lyric( string line )
24- {
25- this->lyric = line.substr( 0, line.find( "," ) );
26- this->lyric = this->lyric.substr( this->lyric.find( "\"" ) + 1, this->lyric.rfind( "\"" ) - 1 );
27- }
28-
29- string Lyric::getLyric()
30- {
31- return this->lyric;
32- }
33-
34- string Lyric::toString()
35- {
36- string ret;
37- ret += "{lyric=" + this->lyric + "}";
38- return ret;
39- }
40-}
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
--- vConnect/trunk/stand2.0/stand/corpusManager.h (revision 1969)
+++ vConnect/trunk/stand2.0/stand/corpusManager.h (revision 1970)
@@ -20,7 +20,7 @@
2020 #include "utau/UtauDB.h"
2121 #include "vConnectSetting.h"
2222 #include "RuntimeOption.h"
23-#include "vsqMetaText/Sequence.h"
23+#include "vsq/Sequence.h"
2424 #include "Mutex.h"
2525
2626 using namespace vconnect;
--- vConnect/trunk/stand2.0/stand/tests/LyricTest.cpp (revision 1969)
+++ vConnect/trunk/stand2.0/stand/tests/LyricTest.cpp (revision 1970)
@@ -1,7 +1,7 @@
11 #ifndef TEST_LyricTest
22 #define TEST_LyricTest
33 #include "AllTests.h"
4-#include "../vsqMetaText/Lyric.h"
4+#include "../vsq/Lyric.h"
55
66 using namespace std;
77 using namespace vconnect;
--- vConnect/trunk/stand2.0/stand/tests/vsq/TempoListTest.cpp (revision 1969)
+++ vConnect/trunk/stand2.0/stand/tests/vsq/TempoListTest.cpp (revision 1970)
@@ -1,7 +1,7 @@
11 #ifndef TEST_TempoListTest
22 #define TEST_TempoListTest
33 #include "../AllTests.h"
4-#include "../../vsqMetaText/TempoList.h"
4+#include "../../vsq/TempoList.h"
55
66 using namespace std;
77 using namespace vconnect;
--- vConnect/trunk/stand2.0/stand/tests/vsq/SequenceTest.cpp (revision 1969)
+++ vConnect/trunk/stand2.0/stand/tests/vsq/SequenceTest.cpp (revision 1970)
@@ -1,7 +1,7 @@
11 #ifndef TEST_SequenceTest
22 #define TEST_SequenceTest
33 #include "../AllTests.h"
4-#include "../../vsqMetaText/Sequence.h"
4+#include "../../vsq/Sequence.h"
55
66 using namespace std;
77 using namespace vconnect;
--- vConnect/trunk/stand2.0/stand/tests/Makefile (revision 1969)
+++ vConnect/trunk/stand2.0/stand/tests/Makefile (revision 1970)
@@ -1,5 +1,5 @@
11 SOURCE=./*.cpp ./*/*.cpp \
2- ../Thread.cpp ../Mutex.cpp ../vsqMetaText/*.cpp \
2+ ../Thread.cpp ../Mutex.cpp ../vsq/*.cpp \
33 ../utau/*.cpp
44
55 all: *.cpp *.h
--- vConnect/trunk/stand2.0/stand/Synthesizer.cpp (revision 1969)
+++ vConnect/trunk/stand2.0/stand/Synthesizer.cpp (revision 1970)
@@ -19,10 +19,10 @@
1919 #include "Synthesizer.h"
2020 #include "vConnectPhoneme.h"
2121 #include "vConnectUtility.h"
22-#include "vsqMetaText/EventList.h"
22+#include "vsq/EventList.h"
2323 #include "Thread.h"
2424 #include "utau/UtauDBManager.h"
25-#include "vsqMetaText/CurveTypeEnum.h"
25+#include "vsq/CurveTypeEnum.h"
2626 #include "world/world.h"
2727 #include "waveFileEx/waveFileEx.h"
2828
--- vConnect/trunk/stand2.0/stand/Makefile (revision 1969)
+++ vConnect/trunk/stand2.0/stand/Makefile (revision 1970)
@@ -1,12 +1,12 @@
11 SRC=*.cpp \
22 utau/*.cpp \
3- vsqMetaText/*.cpp \
3+ vsq/*.cpp \
44 waveFileEx/*.cpp \
55 world/*.cpp
66
77 HEADER=*.h \
88 utau/*.h \
9- vsqMetaText/*.h \
9+ vsq/*.h \
1010 waveFileEx/*.h \
1111 world/*.h
1212
--- vConnect/trunk/stand2.0/stand/corpusManager.cpp (revision 1969)
+++ vConnect/trunk/stand2.0/stand/corpusManager.cpp (revision 1970)
@@ -15,7 +15,7 @@
1515 #include "corpusManager.h"
1616 #include "vConnectPhoneme.h"
1717 #include "utau/UtauDB.h"
18-#include "vsqMetaText/Sequence.h"
18+#include "vsq/Sequence.h"
1919
2020 using namespace vconnect;
2121
--- vConnect/trunk/stand2.0/stand/vConnectSetting.cpp (revision 1969)
+++ vConnect/trunk/stand2.0/stand/vConnectSetting.cpp (revision 1970)
@@ -14,7 +14,7 @@
1414 #include <cmath>
1515 #include "vConnectSetting.h"
1616 #include "TextInputStream.h"
17-#include "vsqMetaText/Sequence.h"
17+#include "vsq/Sequence.h"
1818
1919 #define SETTING_BUF_LEN 4096
2020
--- vConnect/trunk/stand2.0/stand/vsq/Sequence.h (nonexistent)
+++ vConnect/trunk/stand2.0/stand/vsq/Sequence.h (revision 1970)
@@ -0,0 +1,234 @@
1+/*
2+ * Sequence.h
3+ * Copyright © 2009-2011 HAL,
4+ * Copyright © 2011-2012 kbinani.
5+ *
6+ * This file is part of vConnect-STAND.
7+ *
8+ * vConnect-STAND is free software; you can redistribute it and/or
9+ * modify it under the terms of the GPL License.
10+ *
11+ * vConnect-STAND is distributed in the hope that it will be useful,
12+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14+ */
15+#ifndef __vsqFileEx_h__
16+#define __vsqFileEx_h__
17+
18+#include <string>
19+#include "Event.h"
20+#include "EventList.h"
21+#include "BPList.h"
22+#include "TempoList.h"
23+#include "CurveTypeEnum.h"
24+#include "../RuntimeOption.h"
25+#include "../Socket.h"
26+#include "../Path.h"
27+#include "../InputStream.h"
28+#include "../TextInputStream.h"
29+#include "../Map.h"
30+
31+namespace vconnect
32+{
33+ using namespace std;
34+
35+ /// <summary>
36+ /// VSQメタテキストが表現するシーケンスを取り扱うクラスです.
37+ /// </summary>
38+ class Sequence
39+ {
40+ public:
41+ /// <summary>
42+ /// コンストラクタ.コントロールカーブのvectorの初期化等を行います.
43+ /// </summary>
44+ Sequence();
45+
46+ /// <summary>
47+ /// ファイルからVSQのメタテキストを読み込みます.
48+ /// </summary>
49+ /// <param name="file_name">読み込むメタテキストファイルのパス.</param>
50+ /// <param name="options">読み込み時の設定値.</param>
51+ /// <returns>読み込みに成功した場合true,それ以外はfalseを返します.</returns>
52+ bool read( string file_name, RuntimeOption option );
53+
54+ /// <summary>
55+ /// ソケットからVSQのメタテキストを読み込みます.
56+ /// </summary>
57+ /// <param name="socket">読み込むソケット.</param>
58+ /// <param name="options">読み込み時の設定値.</param>
59+ /// <returns>読み込みに成功した場合true,それ以外はfalseを返します.</returns>
60+ bool read( Socket socket, RuntimeOption option );
61+
62+ /// <summary>
63+ /// シーケンスの演奏長さを取得します.単位は秒です.
64+ /// </summary>
65+ /// <returns>シーケンスの演奏長さ.</returns>
66+ double getEndSec();
67+
68+ /// <summary>
69+ /// 歌手の名前から,歌手を特定するためのインデックスを取得します.
70+ /// </summary>
71+ /// <param name="singer_name">歌手の名前</param>
72+ /// <returns>歌手を特定するインデックス.歌手が見つけられなかった場合は規定値の0を返します.</returns>
73+ int getSingerIndex( string singer_name );
74+
75+ /// <summary>
76+ /// テンポ値を取得します.
77+ /// </summary>
78+ double getTempo();
79+
80+ /// <summary>
81+ /// シーケンスの長さ(tick単位)を取得します.
82+ /// </summary>
83+ /// <returns>シーケンスの長さ(tick単位)</returns>
84+ long getEndTick();
85+
86+ /**
87+ * 四分音符一拍あたりの Tick 単位の時間を取得する
88+ * @return Tick 単位の時間
89+ */
90+ static int getTickPerBeat()
91+ {
92+ return 480;
93+ }
94+
95+ /**
96+ * A4 の音の周波数(Hz)を取得する
97+ * @return 周波数(Hz)
98+ */
99+ static double getA4Frequency()
100+ {
101+ return 440.0;
102+ }
103+
104+ /**
105+ * A4 の音のノート番号を取得する
106+ * @return ノート番号
107+ */
108+ static int getA4NoteNumber()
109+ {
110+ return 69;
111+ }
112+
113+ public:
114+
115+ /// <summary>
116+ /// ダイナミクスなどのコントロールカーブを格納したvector.
117+ /// </summary>
118+ vector<BPList> controlCurves;
119+
120+ Map<string, BPList *> mMapCurves;
121+
122+ /// <summary>
123+ /// シーケンス内の音符と歌手変更イベントを格納したリスト.
124+ /// </summary>
125+ EventList events;
126+
127+ /// <summary>
128+ /// テンポの変更情報を格納したリスト.
129+ /// </summary>
130+ TempoList vsqTempoBp;
131+
132+ /// <summary>
133+ /// [ID#]の文字列と,その中身との紐付けを保持するマップ.
134+ /// </summary>
135+ Map<string, vconnect::Event *> mMapIDs;
136+
137+ /// <summary>
138+ /// [h#]の文字列と,その中身との紐付けを保持するマップ.
139+ /// </summary>
140+ Map<string, Handle *> mMapHandles;
141+
142+ /**
143+ * 歌手の名称(だったけ?IDSのぶぶんだったかIconIDの部分だったか忘れた)と,
144+ * 歌手のインデックスとの紐付けを保持する.
145+ */
146+ Map<string, int> singerMap;
147+
148+ private:
149+ /**
150+ * VSQのメタテキストを読み込みます.
151+ * @param stream 読み込むストリーム.
152+ * @param vsqFilePath 読み込むファイルのパス
153+ * @param encodingOtoIni oto.ini ファイルのテキストエンコーディング
154+ * @return 読み込みに成功した場合true,それ以外はfalseを返します.
155+ */
156+ bool readCore( InputStream *stream, string vsqFilePath, string encodingOtoIni );
157+
158+ /// <summary>
159+ /// 指定したイベントの内容を,メタテキストの行データを元に設定します.
160+ /// </summary>
161+ /// <param name="target>設定対象のイベント</param>
162+ /// <param name="left">メタテキストの"="の左側部分</param>
163+ /// <param name="right">メタテキストの"="の右側部分</param>
164+ void setParamEvent( vconnect::Event *target, string left, string right );
165+
166+ /**
167+ * 歌手名と oto.ini のパスの紐付けを登録する
168+ * @param singerName 歌手名
169+ * @param otoIniPath oto.ini のパス
170+ * @param encoding oto.ini のテキストエンコーディング
171+ */
172+ void setParamOtoIni( string singerName, string otoIniPath, string encoding );
173+
174+ /**
175+ * [oto.ini] セクションの名前
176+ */
177+ static const string OBJ_NAME_OTOINI;
178+
179+ /**
180+ * [EventList] セクションの名前
181+ */
182+ static const string OBJ_NAME_EVENT_LIST;
183+
184+ /**
185+ * [Tempo] セクションの名前
186+ */
187+ static const string OBJ_NAME_TEMPO;
188+
189+ private:
190+
191+#if defined( _DEBUG )
192+ public:
193+#endif
194+ /// <summary>
195+ /// eventsの中身をダンプします
196+ /// </summary>
197+ void dumpEvents()
198+ {
199+ cout << "vsqFileEx::dumpEvents" << endl;
200+ int size = events.eventList.size();
201+ for( int i = 0; i < size; i++ )
202+ {
203+ Event *item = events.eventList[i];
204+ cout << "[" << i << "]" << " tick=" << item->tick << endl;
205+ }
206+ }
207+
208+ /// <summary>
209+ /// mMapIDsの中身をダンプします.
210+ /// </summary>
211+ void dumpMapIDs()
212+ {
213+ cout << "vsqFileEx::dumpMapIDs" << endl;
214+ Map<string, Event *>::iterator i;
215+ for( i = mMapIDs.begin(); i != mMapIDs.end(); i++ ){
216+ Event *item = i->second;
217+ cout << i->first << ":" << item->toString() << endl;
218+ }
219+ }
220+
221+ /// <summary>
222+ /// mMapHandlesの中身をダンプします.
223+ /// </summary>
224+ void dumpMapHandles()
225+ {
226+ cout << "vsqFileEx::dumpMapHandles" << endl;
227+ Map<string, Handle *>::iterator i;
228+ for( i = mMapHandles.begin(); i != mMapHandles.end(); i++ ){
229+ cout << i->first << ":" << i->second->toString() << endl;
230+ }
231+ }
232+ };
233+}
234+#endif
--- vConnect/trunk/stand2.0/stand/vsq/TempoList.cpp (nonexistent)
+++ vConnect/trunk/stand2.0/stand/vsq/TempoList.cpp (revision 1970)
@@ -0,0 +1,37 @@
1+/*
2+ * TempoList.cpp
3+ * Copyright © 2010-2012 HAL
4+ * Copyright © 2012 kbinani
5+ *
6+ * This file is part of vConnect-STAND.
7+ *
8+ * vConnect-STAND is free software; you can redistribute it and/or
9+ * modify it under the terms of the GPL License.
10+ *
11+ * vConnect-STAND is distributed in the hope that it will be useful,
12+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14+ */
15+#include "TempoList.h"
16+#include "Sequence.h"
17+
18+namespace vconnect
19+{
20+ const double TempoList::DEFAULT_TEMPO = 120.0;
21+
22+ void TempoList::setParameter( string left, string right )
23+ {
24+ tempo = atof( left.c_str() );
25+ }
26+
27+ long TempoList::secondToTick( double second )
28+ {
29+ /* In This Code, only static tempo is available */
30+ return (long)(second / 60.0 * tempo * Sequence::getTickPerBeat());
31+ }
32+
33+ double TempoList::tickToSecond( long tick )
34+ {
35+ return 60.0 / tempo * (double)tick / Sequence::getTickPerBeat();
36+ }
37+}
--- vConnect/trunk/stand2.0/stand/vsq/TempoList.h (nonexistent)
+++ vConnect/trunk/stand2.0/stand/vsq/TempoList.h (revision 1970)
@@ -0,0 +1,60 @@
1+/*
2+ * TempoList.h
3+ * Copyright © 2010-2012 HAL
4+ * Copyright © 2012 kbinani
5+ *
6+ * This file is part of vConnect-STAND.
7+ *
8+ * vConnect-STAND is free software; you can redistribute it and/or
9+ * modify it under the terms of the GPL License.
10+ *
11+ * vConnect-STAND is distributed in the hope that it will be useful,
12+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14+ */
15+#ifndef __TempoList_h__
16+#define __TempoList_h__
17+
18+#include <string>
19+
20+using namespace std;
21+
22+namespace vconnect
23+{
24+ class TempoList
25+ {
26+ public:
27+ /**
28+ * デフォルトのテンポ値
29+ */
30+ static const double DEFAULT_TEMPO;
31+
32+ private:
33+ /**
34+ * テンポ値
35+ */
36+ double tempo;
37+
38+ public:
39+ TempoList()
40+ {
41+ this->tempo = DEFAULT_TEMPO;
42+ }
43+
44+ void setParameter( string left, string right );
45+
46+ long secondToTick( double second );
47+
48+ double tickToSecond( long tick );
49+
50+ /**
51+ * テンポ値を取得する
52+ * @return テンポ値
53+ */
54+ double getTempo()
55+ {
56+ return this->tempo;
57+ }
58+ };
59+}
60+#endif
--- vConnect/trunk/stand2.0/stand/vsq/Sequence.cpp (nonexistent)
+++ vConnect/trunk/stand2.0/stand/vsq/Sequence.cpp (revision 1970)
@@ -0,0 +1,227 @@
1+/*
2+ * Sequence.cpp
3+ * Copyright © 2009-2011 HAL,
4+ * Copyright © 2011-2012 kbinani.
5+ *
6+ * This file is part of vConnect-STAND.
7+ *
8+ * vConnect-STAND is free software; you can redistribute it and/or
9+ * modify it under the terms of the GPL License.
10+ *
11+ * vConnect-STAND is distributed in the hope that it will be useful,
12+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14+ */
15+#include "Sequence.h"
16+#include "../utau/UtauDBManager.h"
17+
18+namespace vconnect
19+{
20+ const string Sequence::OBJ_NAME_OTOINI = "[oto.ini]";
21+ const string Sequence::OBJ_NAME_EVENT_LIST = "[EventList]";
22+ const string Sequence::OBJ_NAME_TEMPO = "[Tempo]";
23+
24+ void Sequence::setParamOtoIni( string singerName, string otoIniPath, string encoding )
25+ {
26+ // 名前登録して
27+ int index = UtauDBManager::find( otoIniPath );
28+ if( index < 0 ){
29+ // 中身読んで
30+ UtauDB *p = new UtauDB( otoIniPath, encoding );
31+ // リストに追加
32+ UtauDBManager::regist( p );
33+ index = UtauDBManager::find( otoIniPath );
34+ }
35+ singerMap.insert( std::make_pair( singerName, index ) );
36+ }
37+
38+ void Sequence::setParamEvent( Event *target, string left, string right )
39+ {
40+ if( left.compare( "Type" ) == 0 ){
41+ target->type = right;
42+ }else if( left.compare( "Length" ) == 0 ){
43+ target->length = atoi( right.c_str() );
44+ }else if( left.compare( "Note#" ) == 0 ){
45+ target->note = atoi( right.c_str() );
46+ }else if( left.compare( "Dynamics" ) == 0 ){
47+ target->velocity = atoi( right.c_str() );
48+ }else if( left.compare( "PMBendDepth" ) == 0 ){
49+ target->portamentoDepth = atoi( right.c_str() );
50+ }else if( left.compare( "PMBendLength" ) == 0 ){
51+ target->portamentoLength = atoi( right.c_str() );
52+ }else if( left.compare( "PMbPortamentoUse" ) == 0 ){
53+ target->portamentoUse = atoi( right.c_str() );
54+ }else if( left.compare( "DEMdecGainRate" ) == 0 ){
55+ target->decay = atoi( right.c_str() );
56+ }else if( left.compare( "DEMaccent" ) == 0 ){
57+ target->attack = atoi( right.c_str() );
58+ }else if( left.compare( "VibratoDelay" ) == 0 ){
59+ target->vibratoDelay = atoi( right.c_str() );
60+ }else if( left.compare( "PreUtterance" ) == 0 ){
61+ target->utauSetting.msPreUtterance = (float)atof( right.c_str() );
62+ }else if( left.compare( "VoiceOverlap" ) == 0 ){
63+ target->utauSetting.msVoiceOverlap = (float)atof( right.c_str() );
64+ }else if( left.compare( "LyricHandle" ) == 0 ){
65+ right = "[" + right + "]";
66+ mMapHandles.insert( make_pair( right, &target->lyricHandle ) );
67+ }else if( left.compare( "VibratoHandle" ) == 0 ){
68+ right = "[" + right + "]";
69+ mMapHandles.insert( make_pair( right, &target->vibratoHandle ) );
70+ }else if( left.compare( "IconHandle" ) == 0 ){
71+ right = "[" + right + "]";
72+ mMapHandles.insert( make_pair( right, &target->iconHandle ) );
73+ }else{
74+ string message = "warning: unknown Property in VsqEvent : " + left;
75+ cout << message << endl;//outputError( message.c_str() );
76+ }
77+
78+ return;
79+ }
80+
81+ long Sequence::getEndTick()
82+ {
83+ return this->events.endTick;
84+ }
85+
86+ double Sequence::getTempo()
87+ {
88+ return this->vsqTempoBp.getTempo();
89+ }
90+
91+ Sequence::Sequence()
92+ {
93+ vector<CurveTypeEnum::CurveType> values = CurveTypeEnum::values();
94+ int size = values.size();
95+ this->controlCurves.resize( size );
96+ for( int i = 0; i < size; i++ ){
97+ int defaultValue = CurveTypeEnum::getDefault( values[i] );
98+ string name = CurveTypeEnum::getName( values[i] );
99+ this->controlCurves[i].setParameter( -10000, defaultValue );
100+ this->mMapCurves.insert( make_pair( name, &this->controlCurves[i] ) );
101+ }
102+ }
103+
104+ bool Sequence::read( string file_name, RuntimeOption option )
105+ {
106+ bool result = false;
107+ TextInputStream *stream = new TextInputStream( file_name, option.getEncodingVsqText() );
108+ bool ret = this->readCore( stream, file_name, option.getEncodingOtoIni() );
109+ delete stream;
110+ return ret;
111+ }
112+
113+ bool Sequence::readCore( InputStream *stream, string vsqFilePath, string encodingOtoIni )
114+ {
115+ if( !stream ) return false;
116+
117+ string temp, search, left, right;
118+ //Map<string, vsqBase *>::iterator i;
119+
120+ while( stream->ready() ){
121+ temp = stream->readLine();
122+
123+ // 空文字の場合は次へ
124+ if( temp.size() <= 0 ) continue;
125+
126+ if( temp.find( "[" ) == 0 ){
127+ search = temp;
128+ continue;
129+ }
130+ string::size_type indx_equal = temp.find( "=" );
131+ if( indx_equal == string::npos ){
132+ left = temp;
133+ right = "";
134+ }else{
135+ left = temp.substr( 0, indx_equal );
136+ right = temp.substr( indx_equal + 1 );
137+ }
138+
139+ if( search.compare( OBJ_NAME_EVENT_LIST ) == 0 ){
140+ // [EventList]
141+ string::size_type indx_comma = right.find( "," );
142+ while( indx_comma != string::npos ){
143+ // コンマが見つからなくなるまでループ
144+ string tright = right.substr( 0, indx_comma );
145+ this->events.setParameter( left, tright, mMapIDs );
146+ right = right.substr( indx_comma + 1 );
147+ indx_comma = right.find( "," );
148+ }
149+ this->events.setParameter( left, right, mMapIDs );
150+ }else if( search.compare( OBJ_NAME_OTOINI ) == 0 ){
151+ // [oto.ini]
152+ string::size_type index = left.find( "\t" );
153+ string singerName, otoIniPath;
154+
155+ if( index == string::npos ){
156+ singerName = "";
157+ otoIniPath = left;
158+ }else{
159+ singerName = left.substr( 0, index );
160+ otoIniPath = left.substr( index + 1 );
161+ }
162+ if( false == Path::exists( otoIniPath ) ){
163+ string directory = Path::getDirectoryName( vsqFilePath );
164+ otoIniPath = Path::combine( directory, otoIniPath );
165+ }
166+ this->setParamOtoIni( singerName, otoIniPath, encodingOtoIni );
167+ }else if( search.compare( OBJ_NAME_TEMPO ) == 0 ){
168+ // [Tempo]
169+ this->vsqTempoBp.setParameter( left, right );
170+ }else if( search.find( "[ID#" ) == 0 ){
171+ // ID
172+ Map<string, Event *>::iterator i;
173+ i = mMapIDs.find( search );
174+ if( i != mMapIDs.end() && i->second ){
175+ setParamEvent( i->second, left, right );
176+ }
177+ }else if( search.find( "[h#" ) == 0 ){
178+ // handle
179+ Map<string, Handle *>::iterator i;
180+ i = mMapHandles.find( search );
181+ if( i != mMapHandles.end() && i->second ){
182+ i->second->setParameter( left, right );
183+ }
184+ }else{
185+ // たぶんコントロールカーブ
186+ Map<string, BPList *>::iterator i;
187+ i = mMapCurves.find( search );
188+ if( i != mMapCurves.end() && i->second ){
189+ i->second->setParameter( left, right );
190+ }else{
191+ // そんなセクション名知らねー
192+ string message;
193+ message = "vsqFileEx::readCore; not found: " + search;
194+ cout << message << endl;
195+ }
196+ }
197+ }
198+
199+ // utau音源が無ければ合成しようがないので false.
200+ int size = UtauDBManager::size();
201+
202+ #if defined( _DEBUG )
203+ dumpEvents();
204+ dumpMapIDs();
205+ dumpMapHandles();
206+ cout << "vsqFileEx::readCore; size=" << size << endl;
207+ #endif
208+
209+ return (size > 0);
210+ }
211+
212+ double Sequence::getEndSec()
213+ {
214+ return this->vsqTempoBp.tickToSecond( getEndTick() );
215+ }
216+
217+ int Sequence::getSingerIndex( string t_search )
218+ {
219+ int ret = 0;
220+ Map<string, int>::iterator i = singerMap.find( t_search );
221+ if( i != singerMap.end() )
222+ {
223+ ret = i->second;
224+ }
225+ return ret;
226+ }
227+}
--- vConnect/trunk/stand2.0/stand/vsq/EventList.h (nonexistent)
+++ vConnect/trunk/stand2.0/stand/vsq/EventList.h (revision 1970)
@@ -0,0 +1,33 @@
1+/**
2+ * EventList.h
3+ * Copyright (C) 2009-2011 HAL,
4+ * Copyright (C) 2011-2012 kbinani
5+ */
6+#ifndef __EventList_h__
7+#define __EventList_h__
8+
9+#include "../Map.h"
10+#include "Event.h"
11+
12+namespace vconnect
13+{
14+ class EventList
15+ {
16+ public:
17+
18+ ~EventList();
19+
20+ void setParameter( string left, string right, Map<string, Event *> &id_map );
21+
22+
23+ public:
24+
25+ vector<Event *> eventList;
26+
27+ /// <summary>
28+ /// �V�[�P���X�̒����itick�P�ʁj
29+ /// </summary>
30+ long endTick;
31+ };
32+}
33+#endif
--- vConnect/trunk/stand2.0/stand/vsq/Event.h (nonexistent)
+++ vConnect/trunk/stand2.0/stand/vsq/Event.h (revision 1970)
@@ -0,0 +1,85 @@
1+/*
2+ * Event.h
3+ * Copyright (C) 2010- HAL,
4+ * Copyright (C) 2011-2012 kbinani.
5+ *
6+ * This files is a part of v.Connect.
7+ * vsqEventEx contains vsq-event's properties
8+ * and some UTAU properties such as preutterance and voice-overlap.
9+ *
10+ * These files are distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13+ *
14+ */
15+#ifndef __Event_h__
16+#define __Event_h__
17+
18+#include "Handle.h"
19+#include "../utau/UtauParameter.h"
20+
21+namespace vconnect
22+{
23+ class Event
24+ {
25+ public:
26+ Event(){
27+ utauSetting.fileName = "";
28+ utauSetting.lyric = "";
29+ utauSetting.msLeftBlank = 0.0f;
30+ utauSetting.msFixedLength = 0.0f;
31+ utauSetting.msRightBlank = 0.0f;
32+ utauSetting.msPreUtterance = 0.0f;
33+ utauSetting.msVoiceOverlap = 0.0f;
34+ vibratoDelay = 0;
35+ isContinuousBack = false;
36+ isRest = false;
37+
38+ portamentoDepth = 8;
39+ portamentoLength = 0;
40+ portamentoUse = 0;
41+ decay = 50;
42+ attack = 50;
43+
44+ singerIndex = 0;
45+ }
46+ //void setParameter( string left, string right );
47+
48+ string toString()
49+ {
50+ char buff[1024];
51+ buff[0] = '\n';
52+ sprintf( buff, "%d", singerIndex );
53+ string str_buff = buff;
54+ return "{singerIndex=" + str_buff + "}";
55+ }
56+
57+ Handle vibratoHandle;
58+ Handle lyricHandle;
59+ Handle iconHandle;
60+
61+ string type;
62+ long tick;
63+ long length;
64+ long vibratoDelay;
65+ unsigned char note;
66+ char velocity;
67+ unsigned char portamentoDepth;
68+ unsigned char portamentoLength;
69+ unsigned char portamentoUse;
70+ unsigned char decay;
71+ unsigned char attack;
72+
73+ bool isVCV;
74+ bool isContinuousBack;
75+ bool isRest;
76+
77+ int singerIndex;
78+
79+ long beginFrame;
80+ long endFrame;
81+
82+ UtauParameter utauSetting;
83+ };
84+}
85+#endif
--- vConnect/trunk/stand2.0/stand/vsq/BPList.h (nonexistent)
+++ vConnect/trunk/stand2.0/stand/vsq/BPList.h (revision 1970)
@@ -0,0 +1,48 @@
1+/*
2+ * BPList.h
3+ * Copyright © 2010-2012 HAL, 2012 kbinani
4+ *
5+ * This file is part of vConnect-STAND.
6+ *
7+ * vConnect-STAND is free software; you can redistribute it and/or
8+ * modify it under the terms of the GPL License.
9+ *
10+ * vConnect-STAND is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13+ * ---------------------------------------------------------------------
14+ * vsqBPList class contains and reads vsqBP data.
15+ */
16+#ifndef __BPList_h__
17+#define __BPList_h__
18+
19+#include <string>
20+#include <vector>
21+#include "BP.h"
22+#include "../FrameBP.h"
23+
24+namespace vconnect
25+{
26+ using namespace std;
27+
28+ class BPList
29+ {
30+ public:
31+ void getList( vector<FrameBP> &dst, double tempo );
32+
33+ void setParameter( long tick, int value );
34+
35+ void setParameter( string left, string right );
36+
37+ /**
38+ * 指定したインデックスにおけるカーブの値を取得する
39+ * @param index インデックス
40+ * @return カーブの値
41+ */
42+ BP get( int index );
43+
44+ private:
45+ vector<BP> data;
46+ };
47+}
48+#endif
--- vConnect/trunk/stand2.0/stand/vsq/CurveTypeEnum.h (nonexistent)
+++ vConnect/trunk/stand2.0/stand/vsq/CurveTypeEnum.h (revision 1970)
@@ -0,0 +1,118 @@
1+/**
2+ * CurveTypeEnum.h
3+ * Copyright (C) 2012 kbinani
4+ *
5+ * This file is part of vConnect-STAND.
6+ *
7+ * vConnect-STAND is free software; you can redistribute it and/or
8+ * modify it under the terms of the GNU GPL Lisence.
9+ *
10+ * v.Connect is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13+ */
14+#ifndef __CurveTypeEnum_h__
15+#define __CurveTypeEnum_h__
16+
17+namespace vconnect
18+{
19+ /**
20+ * コントロールカーブの種類を表す
21+ */
22+ class CurveTypeEnum
23+ {
24+ public:
25+ enum CurveType
26+ {
27+ PITCH_BEND = 0,
28+ PITCH_BEND_SENS,
29+ DYNAMICS,
30+ BRETHINESS,
31+ BRIGHTNESS,
32+ CLEARNESS,
33+ GENDER,
34+ };
35+
36+ /**
37+ * カーブの種類から、そのカーブのデフォルト値を取得する
38+ * @param curveType カーブの種類
39+ * @return デフォルト値
40+ */
41+ static int getDefault( CurveType curveType )
42+ {
43+ switch( curveType ){
44+ case PITCH_BEND:{
45+ return 0;
46+ }
47+ case PITCH_BEND_SENS:{
48+ return 2;
49+ }
50+ case DYNAMICS:{
51+ return 64;
52+ }
53+ case BRETHINESS:{
54+ return 0;
55+ }
56+ case BRIGHTNESS:{
57+ return 64;
58+ }
59+ case CLEARNESS:{
60+ return 0;
61+ }
62+ case GENDER:{
63+ return 64;
64+ }
65+ }
66+ }
67+
68+ /**
69+ * カーブの種類から、そのカーブの名前を取得する
70+ * @param curveType カーブの種類
71+ * @return 名前
72+ */
73+ static string getName( CurveType curveType )
74+ {
75+ switch( curveType ){
76+ case PITCH_BEND:{
77+ return "[PitchBendBPList]";
78+ }
79+ case PITCH_BEND_SENS:{
80+ return "[PitchBendSensBPList]";
81+ }
82+ case DYNAMICS:{
83+ return "[DynamicsBPList]";
84+ }
85+ case BRETHINESS:{
86+ return "[EpRResidualBPList]";
87+ }
88+ case BRIGHTNESS:{
89+ return "[EpRESlopeBPList]";
90+ }
91+ case CLEARNESS:{
92+ return "[EpRESlopeDepthBPList]";
93+ }
94+ case GENDER:{
95+ return "[GenderFactorBPList]";
96+ }
97+ }
98+ }
99+
100+ /**
101+ * カーブの種類の一覧を取得する
102+ * @return カーブ種類のリスト
103+ */
104+ static vector<CurveType> values()
105+ {
106+ vector<CurveType> result;
107+ result.push_back( PITCH_BEND );
108+ result.push_back( PITCH_BEND_SENS );
109+ result.push_back( DYNAMICS );
110+ result.push_back( BRETHINESS );
111+ result.push_back( BRIGHTNESS );
112+ result.push_back( CLEARNESS );
113+ result.push_back( GENDER );
114+ return result;
115+ }
116+ };
117+}
118+#endif
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
--- vConnect/trunk/stand2.0/stand/vsq/BPList.cpp (nonexistent)
+++ vConnect/trunk/stand2.0/stand/vsq/BPList.cpp (revision 1970)
@@ -0,0 +1,55 @@
1+/*
2+ * BPList.cpp
3+ * Copyright © 2010-2012 HAL, 2012 kbinani
4+ *
5+ * This file is part of vConnect-STAND.
6+ *
7+ * vConnect-STAND is free software; you can redistribute it and/or
8+ * modify it under the terms of the GPL License.
9+ *
10+ * vConnect-STAND is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13+ */
14+#include "BPList.h"
15+#include "../Configuration.h"
16+
17+namespace vconnect
18+{
19+ void BPList::setParameter( string left, string right )
20+ {
21+ BP current;
22+ current.tick = atoi( left.c_str() );
23+ current.value = atoi( right.c_str() );
24+
25+ data.push_back( current );
26+ }
27+
28+ void BPList::setParameter( long tick, int value )
29+ {
30+ BP current;
31+ current.tick = tick;
32+ current.value = value;
33+ data.push_back( current );
34+ }
35+
36+ void BPList::getList( vector<FrameBP>& dst, double tempo )
37+ {
38+ vector<BP>::size_type size = this->data.size();
39+ dst.clear();
40+ dst.resize( size );
41+ double framePeriod = Configuration::getMilliSecondsPerFrame();
42+ for( vector<BP>::size_type i = 0; i < size; i++ ){
43+ dst[i].value = this->data[i].value;
44+ dst[i].frameTime = INT_MAX; // the value will continue till this time.
45+ if( i ){
46+ dst[i - 1].frameTime = (long)(1000.0 * (double)(this->data[i].tick) / 480.0 * 60.0 / tempo / framePeriod);
47+ }
48+ }
49+ }
50+
51+ BP BPList::get( int index )
52+ {
53+ return this->data[index];
54+ }
55+}
--- vConnect/trunk/stand2.0/stand/vsq/EventList.cpp (nonexistent)
+++ vConnect/trunk/stand2.0/stand/vsq/EventList.cpp (revision 1970)
@@ -0,0 +1,34 @@
1+/**
2+ * EventList.cpp
3+ * Copyright (C) 2009-2011 HAL,
4+ * Copyright (C) 2011-2012 kbinani
5+ */
6+#include "EventList.h"
7+
8+namespace vconnect
9+{
10+ EventList::~EventList()
11+ {
12+ for( unsigned long i = 0; i < eventList.size(); i++ )
13+ {
14+ if( eventList[i] )
15+ {
16+ delete eventList[i];
17+ }
18+ }
19+ }
20+
21+ void EventList::setParameter( string left, string right, Map<string, Event *> &id_map )
22+ {
23+ /* If Back is EOS, Front is End Tick */
24+ if( right.compare( "EOS" ) == 0 ){
25+ endTick = atol( left.c_str() );
26+ }else{
27+ Event *target = new Event();
28+ right = "[" + right + "]";
29+ target->tick = atoi( left.c_str() );
30+ eventList.push_back( target );
31+ id_map.insert( make_pair( right, target ) );
32+ }
33+ }
34+}
--- vConnect/trunk/stand2.0/stand/vsq/Handle.h (nonexistent)
+++ vConnect/trunk/stand2.0/stand/vsq/Handle.h (revision 1970)
@@ -0,0 +1,92 @@
1+/**
2+ * Handle.h
3+ * Copyright (C) 2010 HAL, 2012 kbinani
4+ *
5+ * This files is a part of v.Connect.
6+ * vsqHandle class contains vsq-handle.
7+ *
8+ * These files are distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11+ *
12+ */
13+#ifndef __Handle_h__
14+#define __Handle_h__
15+
16+#include <string>
17+#include <vector>
18+#include "VibratoBP.h"
19+#include "Lyric.h"
20+
21+namespace vconnect
22+{
23+ using namespace std;
24+
25+ class Handle
26+ {
27+ public:
28+ void setParameter( string left, string right );
29+
30+ string getLyric( void ){ return lyric.getLyric(); }
31+ string getIDS( void ){ return IDS; }
32+ /**
33+ * ビブラート深さの値を取得しする
34+ * @param position 値を取得する位置.ビブラートの開始位置が0,終了位置が1となるような値を渡す
35+ * @return 指定した位置でのビブラート深さの値
36+ */
37+ short getVibratoDepth( double position );
38+ /**
39+ * ビブラート速さの値を取得しする
40+ * @param position 値を取得する位置.ビブラートの開始位置が0,終了位置が1となるような値を渡す
41+ * @return 指定した位置でのビブラート速さの値
42+ */
43+ short getVibratoRate( double position );
44+
45+ string toString()
46+ {
47+ string ret = "";
48+ ret += "{iconID=" + iconID + ",IDS=" + IDS + ",lyric=" + lyric.toString() + "}";
49+ return ret;
50+ }
51+
52+
53+ private:
54+ string iconID;
55+ string IDS;
56+ string caption;
57+ short original;
58+ short length;
59+ short language;
60+ short program;
61+
62+ /**
63+ * Vibrato Depthのカーブを保持する.
64+ * StartDepthがインデックス0に,BPX, BPYによる指定がインデックス1以降に記録される
65+ */
66+ vector<VibratoBP> vibratoDepth;
67+ /**
68+ * Vibrato Rateのカーブを保持する.
69+ * StartRateがインデックス0に,BPX, BPYによる指定がインデックス1以降に記録される
70+ */
71+ vector<VibratoBP> vibratoRate;
72+ Lyric lyric;
73+
74+ /**
75+ * DepthBPNum, RateBPNumの解釈を行う.setParameterから呼ばれる内部関数
76+ * @param list 解釈を行う対象のBPリスト.vibratoDepthまたはvibratoRate
77+ * @param str 解釈するソース文字列の,"="の右側.例:"DepthBPNum=1"なら"1"を渡す
78+ * @return [void]
79+ */
80+ void parseBPNum( vector<VibratoBP>& list, string str );
81+
82+ /**
83+ * DepthBPX, DepthBPY, RateBPX, RateBPYの解釈を行う.setParameterから呼ばれる内部関数
84+ * @param list 解釈を行う対象のBPリスト.vibratoDepthまたはvibratoRate
85+ * @param str 解釈するソース文字列の,"="の右側.例:"DepthBPX=0.1,1.0"なら"0.1,1.0"を渡す
86+ * @param parse_x *BPXを解釈する場合にtrue, *BPYを解釈する場合にfalse
87+ * @return [void]
88+ */
89+ void parseBP( vector<VibratoBP>& list, string str, bool parse_x );
90+ };
91+}
92+#endif
--- vConnect/trunk/stand2.0/stand/vsq/Lyric.cpp (nonexistent)
+++ vConnect/trunk/stand2.0/stand/vsq/Lyric.cpp (revision 1970)
@@ -0,0 +1,40 @@
1+/**
2+ * Lyric.cpp
3+ * Copyright (C) 2010 HAL, 2012 kbinani
4+ *
5+ * This file is part of v.Connect.
6+ *
7+ * v.Connect is free software; you can redistribute it and/or
8+ * modify it under the terms of the GNU GPL Lisence.
9+ *
10+ * v.Connect is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13+ */
14+#include "Lyric.h"
15+
16+namespace vconnect
17+{
18+ Lyric::Lyric()
19+ {
20+ this->lyric = "あ";
21+ }
22+
23+ Lyric::Lyric( string line )
24+ {
25+ this->lyric = line.substr( 0, line.find( "," ) );
26+ this->lyric = this->lyric.substr( this->lyric.find( "\"" ) + 1, this->lyric.rfind( "\"" ) - 1 );
27+ }
28+
29+ string Lyric::getLyric()
30+ {
31+ return this->lyric;
32+ }
33+
34+ string Lyric::toString()
35+ {
36+ string ret;
37+ ret += "{lyric=" + this->lyric + "}";
38+ return ret;
39+ }
40+}
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
--- vConnect/trunk/stand2.0/stand/vsq/Lyric.h (nonexistent)
+++ vConnect/trunk/stand2.0/stand/vsq/Lyric.h (revision 1970)
@@ -0,0 +1,38 @@
1+/**
2+ * Lyric.h
3+ * Copyright (C) 2010 HAL, 2012 kbinani
4+ *
5+ * This file is part of v.Connect.
6+ *
7+ * v.Connect is free software; you can redistribute it and/or
8+ * modify it under the terms of the GNU GPL Lisence.
9+ *
10+ * v.Connect is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13+ */
14+#ifndef __Lyric_h__
15+#define __Lyric_h__
16+
17+#include <string>
18+
19+namespace vconnect
20+{
21+ using namespace std;
22+
23+ class Lyric
24+ {
25+ private:
26+ string lyric;
27+
28+ public:
29+ Lyric();
30+
31+ Lyric( string line );
32+
33+ string getLyric();
34+
35+ string toString();
36+ };
37+}
38+#endif
--- vConnect/trunk/stand2.0/stand/vsq/Handle.cpp (nonexistent)
+++ vConnect/trunk/stand2.0/stand/vsq/Handle.cpp (revision 1970)
@@ -0,0 +1,163 @@
1+/**
2+ * vsqHandle.cpp
3+ * Copyright (C) 2010 HAL, kbinani
4+ *
5+ * This file is a part of v.Connect,
6+ * implements the class 'vsqHandle' for handling singer, vibrato, and lyric
7+ * data in VSQ meta-text.
8+ *
9+ * These files are distributed in the hope that it will be useful,
10+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+ */
13+#include <iostream>
14+#include "Handle.h"
15+
16+using namespace std;
17+
18+namespace vconnect
19+{
20+ void Handle::setParameter( string left, string right )
21+ {
22+ if( left.compare( "IconID" ) == 0 ){
23+ iconID = right;
24+ }else if( left.compare( "IDS" ) == 0 ){
25+ IDS = right;
26+ }else if( left.compare( "Caption" ) == 0 ){
27+ caption = right;
28+ }else if( left.compare( "Length" ) == 0 ){
29+ length = atoi( right.c_str() );
30+ }else if( left.compare( "Language" ) == 0 ){
31+ language = atoi( right.c_str() );
32+ }else if( left.compare( "Program" ) == 0 ){
33+ program = atoi( right.c_str() );
34+ }else if( left.compare( "Original" ) == 0 ){
35+ original = atoi( right.c_str() );
36+ }else if( left.compare( "StartDepth" ) == 0 ){
37+ VibratoBP point;
38+ point.value = atoi( right.c_str() );
39+ point.position = -1.0;
40+ if( vibratoDepth.size() <= 0 )
41+ {
42+ vibratoDepth.resize( 1 );
43+ }
44+ vibratoDepth[0] = point;
45+ }else if( left.compare( "DepthBPNum" ) == 0 ){
46+ parseBPNum( vibratoDepth, right );
47+ }else if( left.compare( "DepthBPX" ) == 0 ){
48+ parseBP( vibratoDepth, right, true );
49+ }else if( left.compare( "DepthBPY" ) == 0 ){
50+ parseBP( vibratoDepth, right, false );
51+ }else if( left.compare( "StartRate" ) == 0 ){
52+ VibratoBP point;
53+ point.value = atoi( right.c_str() );
54+ point.position = -1.0;
55+ if( vibratoRate.size() <= 0 )
56+ {
57+ vibratoRate.resize( 1 );
58+ }
59+ vibratoRate[0] = point;
60+ }else if( left.compare( "RateBPNum" ) == 0 ){
61+ parseBPNum( vibratoRate, right );
62+ }else if( left.compare( "RateBPX" ) == 0 ){
63+ parseBP( vibratoRate, right, true );
64+ }else if( left.compare( "RateBPY" ) == 0 ){
65+ parseBP( vibratoRate, right, false );
66+ }else if( left.find( "L" ) != string::npos ){
67+ lyric = Lyric( right );
68+ }else{
69+ string Message = "warning: unknown Property in VsqHandle : " + left;
70+ cout << Message << endl;
71+ }
72+ }
73+
74+ void Handle::parseBPNum( vector<VibratoBP> &list, string str )
75+ {
76+ vector<VibratoBP>::size_type new_size = atoi( str.c_str() ) + 1;
77+ list.resize( new_size );
78+ }
79+
80+ void Handle::parseBP( vector<VibratoBP> &list, string str, bool parse_x )
81+ {
82+ string s;
83+ string::size_type indx_comma = str.find( "," );
84+ int indx = 1;
85+ while( indx_comma != string::npos )
86+ {
87+ s = str.substr( 0, indx_comma );
88+ if( list.size() <= indx ){
89+ list.resize( indx + 1 );
90+ }
91+
92+ if( parse_x ){
93+ list[indx].position = (float)atof( s.c_str() );
94+ }else{
95+ list[indx].value = atoi( s.c_str() );
96+ }
97+ str = str.substr( indx_comma + 1 );
98+ indx_comma = str.find( "," );
99+ indx++;
100+ }
101+ if( str.size() > 0 ){
102+ if( list.size() <= indx ){
103+ list.resize( indx + 1 );
104+ }
105+ s = str;
106+ if( parse_x ){
107+ list[indx].position = (float)atof( s.c_str() );
108+ }else{
109+ list[indx].value = atoi( s.c_str() );
110+ }
111+ }
112+ }
113+
114+ short Handle::getVibratoDepth( double position )
115+ {
116+ short ret;
117+ vector<VibratoBP>::size_type i;
118+ vector<VibratoBP>::size_type c = vibratoDepth.size();
119+ for( i = 0; i < c; i++ )
120+ {
121+ if( vibratoDepth[i].position > position )
122+ {
123+ break;
124+ }
125+ }
126+ if( i != 0 )
127+ {
128+ i--;
129+ ret = vibratoDepth[i].value;
130+ }
131+ else
132+ {
133+ ret = 0;
134+ }
135+
136+ return ret;
137+ }
138+
139+ short Handle::getVibratoRate( double position )
140+ {
141+ short ret = 0;
142+ vector<VibratoBP>::size_type i;
143+ vector<VibratoBP>::size_type c = vibratoRate.size();
144+ for( i = 0; i < c; i++ )
145+ {
146+ if( vibratoRate[i].position > position )
147+ {
148+ break;
149+ }
150+ }
151+ if( i != 0 )
152+ {
153+ i--;
154+ ret = vibratoRate[i].value;
155+ }
156+ else
157+ {
158+ ret = 0;
159+ }
160+
161+ return ret;
162+ }
163+}
--- vConnect/trunk/stand2.0/stand/vsq/VibratoBP.h (nonexistent)
+++ vConnect/trunk/stand2.0/stand/vsq/VibratoBP.h (revision 1970)
@@ -0,0 +1,25 @@
1+/**
2+ * VibratoBP.h
3+ * Copyright (C) 2010 HAL, kbinani
4+ *
5+ * This file is part of v.Connect.
6+ *
7+ * v.Connect is free software; you can redistribute it and/or
8+ * modify it under the terms of the GNU GPL Lisence.
9+ *
10+ * v.Connect is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13+ */
14+#ifndef __VibratoBP_h__
15+#define __VibratoBP_h__
16+
17+namespace vconnect
18+{
19+ struct VibratoBP
20+ {
21+ float position;
22+ short value;
23+ };
24+}
25+#endif
--- vConnect/trunk/stand2.0/stand/vsq/BP.h (nonexistent)
+++ vConnect/trunk/stand2.0/stand/vsq/BP.h (revision 1970)
@@ -0,0 +1,25 @@
1+/**
2+ * BP.h
3+ * Copyright (C) 2010 HAL, 2012 kbinani
4+ *
5+ * This file is part of vConnect-STAND.
6+ *
7+ * vConnect-STAND is free software; you can redistribute it and/or
8+ * modify it under the terms of the GNU GPL Lisence.
9+ *
10+ * v.Connect is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13+ */
14+#ifndef __BP_h__
15+#define __BP_h__
16+
17+namespace vconnect
18+{
19+ struct BP
20+ {
21+ long tick;
22+ int value;
23+ };
24+}
25+#endif // __BP_h__
--- vConnect/trunk/stand2.0/stand/Synthesizer.h (revision 1969)
+++ vConnect/trunk/stand2.0/stand/Synthesizer.h (revision 1970)
@@ -18,7 +18,7 @@
1818 #define __Synthesizer_h__
1919
2020 #include "corpusManager.h"
21-#include "vsqMetaText/Sequence.h"
21+#include "vsq/Sequence.h"
2222 #include "Task.h"
2323 #include "RuntimeOption.h"
2424 #include "FrameBP.h"
旧リポジトリブラウザで表示