git-svn-id: http://svn.sourceforge.jp/svnroot/lipsync@6 b1f601f4-4f45-0410-8980-aecacb008692

This commit is contained in:
kbinani
2009-06-25 14:16:22 +00:00
parent 775d25e7fa
commit 90d1578878
373 changed files with 111302 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<project name="JVsq" default="default" basedir=".">
<description>Builds, tests, and runs the project JVsq.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="JVsq-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>

View File

@@ -0,0 +1,629 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM project.xml - DO NOT EDIT ***
*** EDIT ../build.xml INSTEAD ***
For the purpose of easier reading the script
is divided into following sections:
- initialization
- compilation
- jar
- execution
- debugging
- javadoc
- junit compilation
- junit execution
- junit debugging
- applet
- cleanup
-->
<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="JVsq-impl">
<target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
<!--
======================
INITIALIZATION SECTION
======================
-->
<target name="-pre-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="-pre-init" name="-init-private">
<property file="nbproject/private/config.properties"/>
<property file="nbproject/private/configs/${config}.properties"/>
<property file="nbproject/private/private.properties"/>
</target>
<target depends="-pre-init,-init-private" name="-init-user">
<property file="${user.properties.file}"/>
<!-- The two properties below are usually overridden -->
<!-- by the active platform. Just a fallback. -->
<property name="default.javac.source" value="1.4"/>
<property name="default.javac.target" value="1.4"/>
</target>
<target depends="-pre-init,-init-private,-init-user" name="-init-project">
<property file="nbproject/configs/${config}.properties"/>
<property file="nbproject/project.properties"/>
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
<available file="${manifest.file}" property="manifest.available"/>
<condition property="manifest.available+main.class">
<and>
<isset property="manifest.available"/>
<isset property="main.class"/>
<not>
<equals arg1="${main.class}" arg2="" trim="true"/>
</not>
</and>
</condition>
<condition property="manifest.available+main.class+mkdist.available">
<and>
<istrue value="${manifest.available+main.class}"/>
<isset property="libs.CopyLibs.classpath"/>
</and>
</condition>
<condition property="have.tests">
<or>
<available file="${test.src.dir}"/>
</or>
</condition>
<condition property="have.sources">
<or>
<available file="${src.dir}"/>
</or>
</condition>
<condition property="netbeans.home+have.tests">
<and>
<isset property="netbeans.home"/>
<isset property="have.tests"/>
</and>
</condition>
<condition property="no.javadoc.preview">
<and>
<isset property="javadoc.preview"/>
<isfalse value="${javadoc.preview}"/>
</and>
</condition>
<property name="run.jvmargs" value=""/>
<property name="javac.compilerargs" value=""/>
<property name="work.dir" value="${basedir}"/>
<condition property="no.deps">
<and>
<istrue value="${no.dependencies}"/>
</and>
</condition>
<property name="javac.debug" value="true"/>
<property name="javadoc.preview" value="true"/>
<property name="application.args" value=""/>
<property name="source.encoding" value="${file.encoding}"/>
<condition property="javadoc.encoding.used" value="${javadoc.encoding}">
<and>
<isset property="javadoc.encoding"/>
<not>
<equals arg1="${javadoc.encoding}" arg2=""/>
</not>
</and>
</condition>
<property name="javadoc.encoding.used" value="${source.encoding}"/>
<property name="includes" value="**"/>
<property name="excludes" value=""/>
<property name="do.depend" value="false"/>
<condition property="do.depend.true">
<istrue value="${do.depend}"/>
</condition>
<condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
<and>
<isset property="jaxws.endorsed.dir"/>
<available file="nbproject/jaxws-build.xml"/>
</and>
</condition>
</target>
<target name="-post-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
<fail unless="src.dir">Must set src.dir</fail>
<fail unless="test.src.dir">Must set test.src.dir</fail>
<fail unless="build.dir">Must set build.dir</fail>
<fail unless="dist.dir">Must set dist.dir</fail>
<fail unless="build.classes.dir">Must set build.classes.dir</fail>
<fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
<fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
<fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
<fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
<fail unless="dist.jar">Must set dist.jar</fail>
</target>
<target name="-init-macrodef-property">
<macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute name="name"/>
<attribute name="value"/>
<sequential>
<property name="@{name}" value="${@{value}}"/>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-javac">
<macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${src.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}" name="classpath"/>
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="${javac.debug}" name="debug"/>
<attribute default="" name="sourcepath"/>
<element name="customize" optional="true"/>
<sequential>
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
<classpath>
<path path="@{classpath}"/>
</classpath>
<compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
<customize/>
</javac>
</sequential>
</macrodef>
<macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${src.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}" name="classpath"/>
<sequential>
<depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
<classpath>
<path path="@{classpath}"/>
</classpath>
</depend>
</sequential>
</macrodef>
<macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${build.classes.dir}" name="destdir"/>
<sequential>
<fail unless="javac.includes">Must set javac.includes</fail>
<pathconvert pathsep="," property="javac.includes.binary">
<path>
<filelist dir="@{destdir}" files="${javac.includes}"/>
</path>
<globmapper from="*.java" to="*.class"/>
</pathconvert>
<delete>
<files includes="${javac.includes.binary}"/>
</delete>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-junit">
<macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<sequential>
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
<batchtest todir="${build.test.results.dir}">
<fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
</batchtest>
<classpath>
<path path="${run.test.classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<jvmarg line="${run.jvmargs}"/>
</junit>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-nbjpda">
<macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${main.class}" name="name"/>
<attribute default="${debug.classpath}" name="classpath"/>
<attribute default="" name="stopclassname"/>
<sequential>
<nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="dt_socket">
<classpath>
<path path="@{classpath}"/>
</classpath>
</nbjpdastart>
</sequential>
</macrodef>
<macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${build.classes.dir}" name="dir"/>
<sequential>
<nbjpdareload>
<fileset dir="@{dir}" includes="${fix.classes}">
<include name="${fix.includes}*.class"/>
</fileset>
</nbjpdareload>
</sequential>
</macrodef>
</target>
<target name="-init-debug-args">
<property name="version-output" value="java version &quot;${ant.java.version}"/>
<condition property="have-jdk-older-than-1.4">
<or>
<contains string="${version-output}" substring="java version &quot;1.0"/>
<contains string="${version-output}" substring="java version &quot;1.1"/>
<contains string="${version-output}" substring="java version &quot;1.2"/>
<contains string="${version-output}" substring="java version &quot;1.3"/>
</or>
</condition>
<condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
<istrue value="${have-jdk-older-than-1.4}"/>
</condition>
</target>
<target depends="-init-debug-args" name="-init-macrodef-debug">
<macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${main.class}" name="classname"/>
<attribute default="${debug.classpath}" name="classpath"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" dir="${work.dir}" fork="true">
<jvmarg line="${debug-args-line}"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
<jvmarg line="${run.jvmargs}"/>
<classpath>
<path path="@{classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="run-sys-prop."/>
<mapper from="run-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<customize/>
</java>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-java">
<macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${main.class}" name="classname"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" dir="${work.dir}" fork="true">
<jvmarg line="${run.jvmargs}"/>
<classpath>
<path path="${run.classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="run-sys-prop."/>
<mapper from="run-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<customize/>
</java>
</sequential>
</macrodef>
</target>
<target name="-init-presetdef-jar">
<presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
<jar compress="${jar.compress}" jarfile="${dist.jar}">
<j2seproject1:fileset dir="${build.classes.dir}"/>
</jar>
</presetdef>
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
<!--
===================
COMPILATION SECTION
===================
-->
<target depends="init" name="deps-jar" unless="no.deps"/>
<target depends="init,deps-jar" name="-pre-pre-compile">
<mkdir dir="${build.classes.dir}"/>
</target>
<target name="-pre-compile">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target if="do.depend.true" name="-compile-depend">
<j2seproject3:depend/>
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
<j2seproject3:javac/>
<copy todir="${build.classes.dir}">
<fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
<target name="-pre-compile-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<j2seproject3:force-recompile/>
<j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
</target>
<target name="-post-compile-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
<!--
====================
JAR BUILDING SECTION
====================
-->
<target depends="init" name="-pre-pre-jar">
<dirname file="${dist.jar}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
</target>
<target name="-pre-jar">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
<j2seproject1:jar/>
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
<j2seproject1:jar manifest="${manifest.file}"/>
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
<j2seproject1:jar manifest="${manifest.file}">
<j2seproject1:manifest>
<j2seproject1:attribute name="Main-Class" value="${main.class}"/>
</j2seproject1:manifest>
</j2seproject1:jar>
<echo>To run this application from the command line without Ant, try:</echo>
<property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
<property location="${dist.jar}" name="dist.jar.resolved"/>
<pathconvert property="run.classpath.with.dist.jar">
<path path="${run.classpath}"/>
<map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
</pathconvert>
<echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
<property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
<pathconvert property="run.classpath.without.build.classes.dir">
<path path="${run.classpath}"/>
<map from="${build.classes.dir.resolved}" to=""/>
</pathconvert>
<pathconvert pathsep=" " property="jar.classpath">
<path path="${run.classpath.without.build.classes.dir}"/>
<chainedmapper>
<flattenmapper/>
<globmapper from="*" to="lib/*"/>
</chainedmapper>
</pathconvert>
<taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
<copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
<fileset dir="${build.classes.dir}"/>
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
<attribute name="Class-Path" value="${jar.classpath}"/>
</manifest>
</copylibs>
<echo>To run this application from the command line without Ant, try:</echo>
<property location="${dist.jar}" name="dist.jar.resolved"/>
<echo>java -jar "${dist.jar.resolved}"</echo>
</target>
<target name="-post-jar">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
<!--
=================
EXECUTION SECTION
=================
-->
<target depends="init,compile" description="Run a main class." name="run">
<j2seproject1:java>
<customize>
<arg line="${application.args}"/>
</customize>
</j2seproject1:java>
</target>
<target name="-do-not-recompile">
<property name="javac.includes.binary" value=""/>
</target>
<target depends="init,-do-not-recompile,compile-single" name="run-single">
<fail unless="run.class">Must select one file in the IDE or set run.class</fail>
<j2seproject1:java classname="${run.class}"/>
</target>
<!--
=================
DEBUGGING SECTION
=================
-->
<target depends="init" if="netbeans.home" name="-debug-start-debugger">
<j2seproject1:nbjpdastart name="${debug.class}"/>
</target>
<target depends="init,compile" name="-debug-start-debuggee">
<j2seproject3:debug>
<customize>
<arg line="${application.args}"/>
</customize>
</j2seproject3:debug>
</target>
<target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
<target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
<j2seproject1:nbjpdastart stopclassname="${main.class}"/>
</target>
<target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
<target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
<fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
<j2seproject3:debug classname="${debug.class}"/>
</target>
<target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
<target depends="init" name="-pre-debug-fix">
<fail unless="fix.includes">Must set fix.includes</fail>
<property name="javac.includes" value="${fix.includes}.java"/>
</target>
<target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
<j2seproject1:nbjpdareload/>
</target>
<target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
<!--
===============
JAVADOC SECTION
===============
-->
<target depends="init" name="-javadoc-build">
<mkdir dir="${dist.javadoc.dir}"/>
<javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
<classpath>
<path path="${javac.classpath}"/>
</classpath>
<fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
<filename name="**/*.java"/>
</fileset>
</javadoc>
</target>
<target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
<nbbrowse file="${dist.javadoc.dir}/index.html"/>
</target>
<target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
<!--
=========================
JUNIT COMPILATION SECTION
=========================
-->
<target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
<mkdir dir="${build.test.classes.dir}"/>
</target>
<target name="-pre-compile-test">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target if="do.depend.true" name="-compile-test-depend">
<j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
<j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile-test">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
<target name="-pre-compile-test-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
<j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile-test-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
<!--
=======================
JUNIT EXECUTION SECTION
=======================
-->
<target depends="init" if="have.tests" name="-pre-test-run">
<mkdir dir="${build.test.results.dir}"/>
</target>
<target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
<j2seproject3:junit testincludes="**/*Test.java"/>
</target>
<target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
<fail if="tests.failed">Some tests failed; see details above.</fail>
</target>
<target depends="init" if="have.tests" name="test-report"/>
<target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
<target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
<target depends="init" if="have.tests" name="-pre-test-run-single">
<mkdir dir="${build.test.results.dir}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
<fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
<j2seproject3:junit excludes="" includes="${test.includes}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
<fail if="tests.failed">Some tests failed; see details above.</fail>
</target>
<target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
<!--
=======================
JUNIT DEBUGGING SECTION
=======================
-->
<target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
<fail unless="test.class">Must select one file in the IDE or set test.class</fail>
<property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
<delete file="${test.report.file}"/>
<mkdir dir="${build.test.results.dir}"/>
<j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
<customize>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<arg value="${test.class}"/>
<arg value="showoutput=true"/>
<arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
<arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
</customize>
</j2seproject3:debug>
</target>
<target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
<j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
</target>
<target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
<target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
<j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
</target>
<target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
<!--
=========================
APPLET EXECUTION SECTION
=========================
-->
<target depends="init,compile-single" name="run-applet">
<fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
<j2seproject1:java classname="sun.applet.AppletViewer">
<customize>
<arg value="${applet.url}"/>
</customize>
</j2seproject1:java>
</target>
<!--
=========================
APPLET DEBUGGING SECTION
=========================
-->
<target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
<fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
<j2seproject3:debug classname="sun.applet.AppletViewer">
<customize>
<arg value="${applet.url}"/>
</customize>
</j2seproject3:debug>
</target>
<target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
<!--
===============
CLEANUP SECTION
===============
-->
<target depends="init" name="deps-clean" unless="no.deps"/>
<target depends="init" name="-do-clean">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<target name="-post-clean">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
</project>

View File

@@ -0,0 +1,8 @@
build.xml.data.CRC32=56626a14
build.xml.script.CRC32=9b5d8d76
build.xml.stylesheet.CRC32=be360661
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=56626a14
nbproject/build-impl.xml.script.CRC32=c54cb890
nbproject/build-impl.xml.stylesheet.CRC32=487672f9

View File

@@ -0,0 +1,57 @@
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/JVsq.jar
dist.javadoc.dir=${dist.dir}/javadoc
excludes=
includes=**
jar.compress=false
javac.classpath=
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.source=1.5
javac.target=1.5
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}:\
${libs.junit.classpath}:\
${libs.junit_4.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
meta.inf.dir=${src.dir}/META-INF
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
# or test-sys-prop.name=value to set system properties for unit tests):
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>JVsq</name>
<minimum-ant-version>1.6.5</minimum-ant-version>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>

View File

@@ -0,0 +1,130 @@
/*
* cp932.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.bocoree
*
* jp.sourceforge.lipsync.bocoree is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.bocoree is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.bocoree;
import java.util.*;
import java.nio.charset.*;
public class cp932 {
//private static HashMap _DICT = new HashMap();
private static boolean m_initialized = false;
private static boolean m_cp932_available = false;
//private static Charset m_cp932 = null;
private static String s_sjis = "Shift_JIS";
private static int attatchKey( int key ) {
if ( cp932_a.getMinKey() <= key && key <= cp932_a.getMaxKey() ) {
return cp932_a.get( key );
} else if ( cp932_b.getMinKey() <= key && key <= cp932_b.getMaxKey() ) {
return cp932_b.get( key );
} else if ( cp932_c.getMinKey() <= key && key <= cp932_c.getMaxKey() ) {
return cp932_c.get( key );
} else {
return -1;
}
}
private static void init() {
m_cp932_available = Charset.isSupported( "Shift_JIS" );
m_initialized = true;
}
public static byte[] convert( String str ) {
if ( !m_initialized ) {
init();
}
if ( m_cp932_available ) {
byte[] ret;
try{
ret = str.getBytes( s_sjis );
}catch( Exception e ){
ret = new byte[0];
}
return ret;
} else {
char[] arr = str.toCharArray();
ArrayList list = new ArrayList();
for ( int i = 0; i < arr.length; i++ ) {
int att = attatchKey( arr[i] );
if ( att >= 0 ) {
if ( att > 0xff ) {
byte b1 = (byte) (att >> 8);
byte b2 = (byte) (att - (b1 << 8));
list.add( b1 );
list.add( b2 );
} else {
list.add( (byte) att );
}
} else {
list.add( 0x63 );
}
}
byte[] ret = new byte[list.size()];
for ( int i = 0; i < list.size(); i++ ) {
Integer value = (Integer) list.get( i );
ret[i] = (byte) value.intValue();
}
return ret;
}
}
public static String convert( byte[] dat ) {
if ( !m_initialized ) {
init();
}
if ( m_cp932_available ) {
String ret;
try{
ret = new String( dat, s_sjis );
}catch( Exception e ){
ret = "";
}
return ret;
} else {
StringBuilder sb = new StringBuilder();
/*int i = 0;
while ( i < dat.length ) {
int b1 = dat[i];
boolean found = false;
for ( Iterator keys = _DICT.keySet().iterator(); keys.hasNext();) {
int key = ((Integer) keys.next()).intValue();
int test = (Integer) _DICT.get( key );
if ( b1 == test ) {
found = true;
char ch = (char) key;
sb.append( ch + "" );
break;
}
}
i++;
if ( !found && i < dat.length ) {
int b2 = (dat[i - 1] << 8) + dat[i];
for ( Iterator keys = _DICT.keySet().iterator(); keys.hasNext();) {
Integer key = (Integer) keys.next();
int test = ((Integer) _DICT.get( key )).intValue();
if ( test == b2 ) {
int ik = key.intValue();
char ch = (char) ik;
sb.append( ch + "" );
break;
}
}
i++;
}
}*/
return sb.toString();
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,340 @@
/*
* math.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.bocoree.
*
* jp.sourceforge.lipsync.bocoree is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.bocoree is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.bocoree;
public class math {
private static final double _PI2 = 2.0 * Math.PI;
private static final double _PI4 = 4.0 * Math.PI;
private static final double _PI6 = 6.0 * Math.PI;
private static final double _PI8 = 8.0 * Math.PI;
public enum WindowFunctionType {
Hamming,
rectangular,
Gauss,
Hann,
Blackman,
Bartlett,
Nuttall,
Blackman_Harris,
Blackman_Nattall,
flap_top,
Parzen,
Akaike,
Welch,
Kaiser,
}
public static double window_func(WindowFunctionType type, double x) throws Exception {
switch ( type ) {
case Akaike:
return wnd_akaike(x);
case Bartlett:
return wnd_bartlett(x);
case Blackman:
return wnd_blackman(x);
case Blackman_Harris:
return wnd_blackman_harris(x);
case Blackman_Nattall:
return wnd_blackman_nattall(x);
case flap_top:
return wnd_flap_top(x);
case Gauss:
throw new Exception("too few argument for Gauss window function");
case Hamming:
return wnd_hamming(x);
case Hann:
return wnd_hann(x);
case Kaiser:
throw new Exception("too few argument for Kaiser window function");
case Nuttall:
return wnd_nuttall(x);
case Parzen:
return wnd_parzen(x);
case rectangular:
return wnd_rectangular(x);
case Welch:
return wnd_welch(x);
}
return 0.0;
}
public static double window_func(WindowFunctionType type, double x, double[] param) {
switch ( type ) {
case Akaike:
return wnd_akaike(x);
case Bartlett:
return wnd_bartlett(x);
case Blackman:
return wnd_blackman(x);
case Blackman_Harris:
return wnd_blackman_harris(x);
case Blackman_Nattall:
return wnd_blackman_nattall(x);
case flap_top:
return wnd_flap_top(x);
case Gauss:
return wnd_gauss(x, param[0]);
case Hamming:
return wnd_hamming(x);
case Hann:
return wnd_hann(x);
case Kaiser:
return wnd_kaiser(x, param[0]);
case Nuttall:
return wnd_nuttall(x);
case Parzen:
return wnd_parzen(x);
case rectangular:
return wnd_rectangular(x);
case Welch:
return wnd_welch(x);
}
return 0.0;
}
/**
* カイザー窓
* @param x
* @param alpha
* @return
*/
public static double wnd_kaiser(double x, double alpha) {
if ( 0.0 <= x && x <= 1.0 ) {
double t = 2.0 * x - 1.0;
return besi0(Math.PI * alpha * Math.sqrt(1.0 - t * t)) / besi0(Math.PI * alpha);
} else {
return 0.0;
}
}
/**
* ウェルチ窓
* @param x
* @return
*/
public static double wnd_welch(double x) {
if ( 0.0 <= x && x <= 1.0 ) {
return 4.0 * x * (1.0 - x);
} else {
return 0.0;
}
}
/**
* 赤池窓
* @param x
* @return
*/
public static double wnd_akaike(double x) {
if ( 0.0 <= x && x <= 1.0 ) {
return 0.625 - 0.5 * Math.cos(_PI2 * x) - 0.125 * Math.cos(_PI4 * x);
} else {
return 0.0;
}
}
/**
* パルザン窓
* @param x
* @return
*/
public static double wnd_parzen(double x) {
double x0 = Math.abs(x);
if ( x0 <= 1.0 ) {
return (0.75 * x0 - 1.5) * x0 * x0 + 1.0;
} else {
x0 = 2.0 - x0;
return 0.25 * x0 * x0 * x0;
}
}
/**
* フラット・トップ窓
* @param x
* @return
*/
public static double wnd_flap_top(double x) {
if ( 0.0 <= x && x <= 1.0 ) {
return 1.0 - 1.93 * Math.cos(_PI2 * x) + 1.29 * Math.cos(_PI4 * x) - 0.388 * Math.cos(_PI6 * x) + 0.032 * Math.cos(_PI8 * x);
} else {
return 0.0;
}
}
/**
* ブラックマン‐ナットール窓
* @param x
* @return
*/
public static double wnd_blackman_nattall(double x) {
if ( 0.0 <= x && x <= 1.0 ) {
return 0.3635819 - 0.4891775 * Math.cos(_PI2 * x) + 0.1365995 * Math.cos(_PI4 * x) - 0.0106411 * Math.cos(_PI6 * x);
} else {
return 0.0;
}
}
/**
* ブラックマン‐ハリス窓
* @param x
* @return
*/
public static double wnd_blackman_harris(double x) {
if ( 0.0 <= x && x <= 1.0 ) {
return 0.35875 - 0.48829 * Math.cos(_PI2 * x) + 0.14128 * Math.cos(_PI4 * x) - 0.01168 * Math.cos(_PI6 * x);
} else {
return 0.0;
}
}
/**
* ナットール窓
* @param x
* @return
*/
public static double wnd_nuttall(double x) {
if ( 0.0 <= x && x <= 1.0 ) {
return 0.355768 - 0.487396 * Math.cos(_PI2 * x) + 0.144232 * Math.cos(_PI4 * x) - 0.012604 * Math.cos(_PI6 * x);
} else {
return 0.0;
}
}
/**
* バートレット窓
* @param x
* @return
*/
public static double wnd_bartlett(double x) {
if ( 0.0 <= x && x <= 1.0 ) {
return 1.0 - 2.0 * Math.abs(x - 0.5);
} else {
return 0.0;
}
}
/**
* ブラックマン窓
* @param x
* @return
*/
public static double wnd_blackman(double x) {
if ( 0.0 <= x && x <= 1.0 ) {
return 0.42 - 0.5 * Math.cos(_PI2 * x) + 0.08 * Math.cos(_PI4 * x);
} else {
return 0.0;
}
}
/**
* ハン窓
* @param x
* @return
*/
public static double wnd_hann(double x) {
if ( 0.0 <= x && x <= 1.0 ) {
return 0.5 - 0.5 * Math.cos(_PI2 * x);
} else {
return 0.0;
}
}
/**
* ガウス窓
* @param x
* @param sigma
* @return
*/
public static double wnd_gauss(double x, double sigma) {
return Math.exp(-x * x / (sigma * sigma));
}
/**
* 矩形窓
* @param x
* @return
*/
public static double wnd_rectangular(double x) {
if ( 0.0 <= x && x <= 1.0 ) {
return 1.0;
} else {
return 0.0;
}
}
/**
* ハミング窓
* @param x
* @return
*/
public static double wnd_hamming(double x) {
if ( 0.0 <= x && x <= 1.0 ) {
return 0.54 - 0.46 * Math.cos(_PI2 * x);
} else {
return 0.0;
}
}
/**
* 第1種ベッセル関数
* @param x
* @return
*/
public static double besi0(double x) {
int i;
double w, wx375;
double[] a = {1.0, 3.5156229, 3.0899424,
1.2067492, 0.2659732, 0.0360768
};
double[] b = {0.39894228, 0.013285917, 0.002253187,
-0.001575649, 0.009162808, -0.020577063,
0.026355372, -0.016476329
};
if ( x < 0.0 ) {
return 0.0;
}
if ( x <= 3.75 ) {
wx375 = x * x / 14.0625;
w = 0.0045813;
for ( i = 5; i >= 0; i-- ) {
w = w * wx375 + a[i];
}
return w;
}
wx375 = 3.75 / x;
w = 0.003923767;
for ( i = 7; i >= 0; i-- ) {
w = w * wx375 + b[i];
}
return w / Math.sqrt(x) * Math.exp(x);
}
/**
* 補誤差関数
* @param x
* @return
*/
public static double erfcc(double x) {
double t, z, res;
z = Math.abs(x);
t = 1.0 / (1.0 + 0.5 * z);
res = t * Math.exp(-z * z - 1.26551223 + t * (1.00002368 + t * (0.37409196 + t * (0.09678418 + t * (-0.18628806 + t * (0.27886807 + t * (-1.13520398 + t * (1.48851587 + t * (-0.82215223 + t * 0.17087277)))))))));
if ( x < 0.0 ) {
res = 2.0 - res;
}
return res;
}
}

View File

@@ -0,0 +1,58 @@
/*
* BPPair.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
public class BPPair implements Comparable {
//private int m_clock;
public int Clock;
//private int m_value;
public int Value;
public int compareTo( Object arg_item ) {
if ( !arg_item.getClass().equals( BPPair.class.getClass() ) ) {
return 0;
}
BPPair item = (BPPair)arg_item;
if ( Clock > item.Clock ) {
return 1;
} else if ( Clock < item.Clock ) {
return -1;
} else {
return 0;
}
}
/*public property int Clock {
get {
return m_clock;
}
set {
m_clock = value;
}
};*/
/*public property int Value {
get {
return m_value;
}
set {
m_value = value;
}
};*/
public BPPair( int clock, int value ) {
Clock = clock;
Value = value;
}
}

View File

@@ -0,0 +1,88 @@
/*
* IconHandle.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
public class IconHandle extends VsqHandle implements Cloneable {
public Object clone() {
IconHandle ret = new IconHandle();
ret.Caption = Caption;
ret.IconID = IconID;
ret.IDS = IDS;
ret.Index = Index;
ret.Language = Language;
ret.Length = Length;
ret.Original = Original;
ret.Program = Program;
ret.Type = Type;
return ret;
}
/*public property int Program {
get {
return m_program;
}
set {
m_program = value;
}
};*/
/*public property int Language {
get {
return m_language;
}
set {
m_language = value;
}
};*/
/*public property int Length {
get {
return m_length;
}
set {
m_length = value;
}
};*/
/*public property String Caption {
get {
return m_caption;
}
set {
m_caption = value;
}
};*/
/*public property String IconID {
get {
return m_icon_id;
}
set {
m_icon_id = value;
}
};*/
/*public property String IDS {
get {
return m_ids;
}
set {
m_ids = value;
}
};*/
/*public property int Original {
get {
return m_original;
}
set {
m_original = value;
}
};*/
}

View File

@@ -0,0 +1,28 @@
/*
* KeyValuePair.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
/**
*
* @author kbinani
*/
public class KeyValuePair<K, V> {
public K Key;
public V Value;
public KeyValuePair( K key, V value ) {
Key = key;
Value = value;
}
}

View File

@@ -0,0 +1,365 @@
/*
* Lyric.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
import jp.sourceforge.lipsync.bocoree.*;
/**
* VsqHandleに格納される歌詞の情報を扱うクラス。
*/
public class Lyric {
//private String m_phrase;
public String Phrase;
private String[] m_phonetic_symbol;
//private float UnknownFloat;
public float UnknownFloat;
private int[] m_consonant_adjustment;
private boolean m_protected;
public boolean PhoneticSymbolProtected;
/*public proprety boolean PhoneticSymbolProtected {
get {
return m_protected;
}
set {
m_protected = value;
}
};*/
/*public property float UnknownFloat {
get {
return UnknownFloat;
}
set {
UnknownFloat = value;
}
};*/
public int[] getConsonantAdjustment() {
return m_consonant_adjustment;
}
/**
* このオブジェクトの簡易コピーを取得します。
* @returns このインスタンスの簡易コピー
*/
public Lyric clone() {
Lyric result = new Lyric();
result.Phrase = this.Phrase;
result.m_phonetic_symbol = (String[]) this.m_phonetic_symbol.clone();
result.UnknownFloat = this.UnknownFloat;
result.m_consonant_adjustment = (int[]) this.m_consonant_adjustment.clone();
result.m_protected = m_protected;
return result;
}
/**
* 歌詞、発音記号を指定したコンストラクタ
* @param phrase 歌詞
* @param phonetic_symbol 発音記号
*/
public Lyric( String phrase, String phonetic_symbol ) {
Phrase = phrase;
setPhoneticSymbol( phonetic_symbol );
UnknownFloat = 0.000000f;
}
private Lyric() {
}
/*// <summary>
/// この歌詞のフレーズを取得または設定します。
/// </summary>
public proprety String Phrase {
get {
return m_phrase;
}
set {
m_phrase = value;
}
};*/
/// <summary>
/// この歌詞の発音記号を取得または設定します。
/// </summary>
public String getPhoneticSymbol() {
String ret = m_phonetic_symbol[0];
for ( int i = 1; i < m_phonetic_symbol.length; i++ ) {
ret += " " + m_phonetic_symbol[i];
}
return ret;
}
public void setPhoneticSymbol( String value ) {
String s = value.replace( " ", " " );
m_phonetic_symbol = s.split( " ", 16 );
for ( int i = 0; i < m_phonetic_symbol.length; i++ ) {
m_phonetic_symbol[i] = m_phonetic_symbol[i].replace( "\\\\", "\\" );
}
m_consonant_adjustment = new int[m_phonetic_symbol.length];
for ( int i = 0; i < m_phonetic_symbol.length; i++ ) {
if ( VsqPhoneticSymbol.IsConsonant( m_phonetic_symbol[i] ) ) {
m_consonant_adjustment[i] = 64;
} else {
m_consonant_adjustment[i] = 0;
}
}
}
public String[] getPhoneticSymbolList() {
String[] ret = new String[m_phonetic_symbol.length];
for ( int i = 0; i < m_phonetic_symbol.length; i++ ) {
ret[i] = m_phonetic_symbol[i];
}
return ret;
}
/// <summary>
/// 文字列からのコンストラクタ
/// </summary>
/// <param name="_line">生成元の文字列</param>
public Lyric( String _line ) {
if ( _line.length() <= 0 ) {
Phrase = "a";
setPhoneticSymbol( "a" );
UnknownFloat = 1.0f;
m_protected = false;
} else {
String[] spl = _line.split( "," );
int c_length = spl.length - 3;
if ( spl.length < 4 ) {
Phrase = "a";
setPhoneticSymbol( "a" );
UnknownFloat = 0.0f;
m_protected = false;
} else {
Phrase = decode( spl[0] );
setPhoneticSymbol( decode( spl[1] ) );
UnknownFloat = Float.valueOf( spl[2] );
m_protected = (spl[spl.length - 1] == "0") ? false : true;
}
}
}
/// <summary>
/// mIndexOfのテストメソッド。search, valueをいろいろ変えてテストする事。
/// </summary>
/// <returns></returns>
public static boolean test_mIndexOf() {
byte[] search = { 0, 12, 3, 5, 16, 34 };
byte[] value = { 16, 34 };
if ( mIndexOf( search, value ) == 4 ) {
return true;
} else {
return false;
}
}
/// <summary>
/// バイト並びsearchの中に含まれるバイト並びvalueの位置を探します。
/// </summary>
/// <param name="search">検索対象のバイト並び</param>
/// <param name="value">検索するバイト並び</param>
/// <returns>valueが見つかればそのインデックスを、見つからなければ-1を返します</returns>
private static int mIndexOf( byte[] search, byte[] value ) {
int i, j;
int search_length = search.length;
int value_length = value.length;
// 検索するバイト並びが、検索対象のバイト並びより長いとき。
// 見つかるわけない
if ( value_length > search_length ) {
return -1;
}
// i : 検索の基点
for ( i = 0; i <= search_length - value_length; i++ ) {
boolean failed = false;
for ( j = 0; j < value_length; j++ ) {
if ( search[i + j] != value[j] ) {
failed = true;
break;
}
}
if ( !failed ) {
return i;
}
}
return -1;
}
/**
* エスケープされた\"や、\x**を復帰させます
* @param _String デコード対象の文字列
* @returns デコード後の文字列
*/
public static String decode( String _String ) {
String result = _String;
result = result.replace( "\\\"", "" );
//Encoding sjis = Encoding.GetEncoding( 932 );
//Encoding sjis = Encoding.GetEncoding( "Shift_JIS" );
byte[] str = result.getBytes();
//Console.WriteLine( "Lyric.decode; sjis.GetString( str )=" + sjis.GetString( str ) );
byte[] x16 = "\\x".getBytes();
int index = mIndexOf( str, x16 );
while ( index >= 0 ) {
//Console.WriteLine( "Lyric.decode; index=" + index );
byte[] chr_byte = new byte[2];
chr_byte[0] = str[index + 2];
chr_byte[1] = str[index + 3];
String chr;
try {
chr = new String( chr_byte, "UTF-8" );
} catch ( Exception e ) {
chr = "";
}
//Console.WriteLine( "Lyric.decode; chr=" + chr );
int chrcode = Integer.parseInt( chr, 16 );
str[index] = (byte) chrcode;
for ( int i = index + 4; i < str.length; i++ ) {
str[i - 3] = str[i];
}
int length = str.length - 3;
byte[] new_str = new byte[length];
for ( int i = 0; i < length; i++ ) {
new_str[i] = str[i];
}
str = new_str;
index = mIndexOf( str, x16 );
}
//return sjis.GetString( str );
return cp932.convert( str );
}
/// <summary>
/// 与えられた文字列の中の2バイト文字を\x**の形式にエンコードします。
/// </summary>
/// <param name="item">エンコード対象</param>
/// <returns>エンコードした文字列</returns>
public static char[] encode( String item ) {
//Encoding sjis = Encoding.GetEncoding( 932 );
byte[] bytea = cp932.convert( item );// sjis.GetBytes( item );
String result = "";
for ( int i = 0; i <
bytea.length; i++ ) {
if ( isprint( (char) bytea[i] ) ) {
result += (char) bytea[i];
} else {
int a = bytea[i];
result += "\\x" + Integer.toHexString( (int) bytea[i] );
}
}
char[] res = result.toCharArray();
return res;
}
/// <summary>
/// 与えられた文字列をShift_JISとみなし、byte[]に変換しさらにchar[]に変換したもの返します
/// </summary>
/// <param name="item">変換元の文字列</param>
/// <returns>変換後のchar[]</returns>
public static char[] encodeEx( String item ) {
//Encoding sjis = Encoding.GetEncoding( 932 );
byte[] dat = cp932.convert( item );// sjis.GetBytes( item );
char[] result = new char[dat.length];
for ( int i = 0; i < dat.length; i++ ) {
result[i] = (char) dat[i];
}
return result;
}
/// <summary>
/// このインスタンスを文字列に変換します
/// </summary>
/// <param name="a_encode">2バイト文字をエンコードするか否かを指定するフラグ</param>
/// <returns>変換後の文字列</returns>
public String toString( boolean a_encode ) {
String result;
if ( a_encode ) {
String njp = new String( encode( this.Phrase ) );
result = "\"" + njp + "\",\"" + getPhoneticSymbol() + "\"," + String.format( "0.000000", UnknownFloat );
} else {
result = "\"";
//Encoding sjis = Encoding.GetEncoding( 932 );
byte[] dat = cp932.convert( this.Phrase );// sjis.GetBytes( this.Phrase );
for ( int i = 0; i < dat.length; i++ ) {
result += (char) dat[i];
}
result += "\",\"" + getPhoneticSymbol() + "\"," + String.format( "0.000000", UnknownFloat );
result = result.replace( "\\\\", "\\" );
}
for ( int i = 0; i < m_consonant_adjustment.length; i++ ) {
result += "," + m_consonant_adjustment[i];
}
if ( m_protected ) {
result += ",1";
} else {
result += ",0";
}
return result;
}
/// <summary>
/// 文字がプリント出力可能かどうかを判定します
/// </summary>
/// <param name="ch"></param>
/// <returns></returns>
private static boolean isprint( char ch ) {
if ( 32 <= (int) ch && (int) ch <= 126 ) {
return true;
} else {
return false;
}
}
/// <summary>
/// Lyricインスタンスを構築するテストを行います
/// </summary>
/// <returns>テストに成功すればtrue、そうでなければfalseを返します</returns>
public static boolean test() {
String line = "\\\"\\x82\\xe7\\\",\\\"4 a\\\",1.000000,64,1,1";
//Console.WriteLine( "Lyric.test; line=" + line );
Lyric lyric = new Lyric( line );
if ( lyric.Phrase == "" &&
lyric.getPhoneticSymbol() == "4 a" &&
lyric.UnknownFloat == 1.0 &&
lyric.m_consonant_adjustment[0] == 64 &&
lyric.m_consonant_adjustment[1] == 1 &&
lyric.m_consonant_adjustment[2] == 1 ) {
return true;
} else {
return false;
}
}
}

View File

@@ -0,0 +1,47 @@
/*
* LyricHandle.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
public class LyricHandle extends VsqHandle implements Cloneable {
public LyricHandle() {
}
/// <summary>
/// type = Lyric用のhandleのコンストラクタ
/// </summary>
/// <param name="phrase">歌詞</param>
/// <param name="phonetic_symbol">発音記号</param>
public LyricHandle( String phrase, String phonetic_symbol ) {
Type = VsqHandleType.Lyric;
L0 = new Lyric( phrase, phonetic_symbol );
}
/*public property Lyric L0 {
get {
return m_lyric;
}
set {
m_lyric = value;
}
}*/
public Object clone() {
LyricHandle ret = new LyricHandle();
ret.Type = Type;
ret.Index = Index;
ret.L0 = (Lyric)L0.clone();
return ret;
}
}

View File

@@ -0,0 +1,122 @@
/*
* MidiEvent.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
public class MidiEvent implements Comparable<MidiEvent>, Cloneable {
public int index;
public MidiEventType type;
public int[] intValue;
public String stringValue;
public byte[] byteValue;
public static MidiEvent TempoChange( int clock, int tempo ) {
MidiEvent res = new MidiEvent();
res.index = clock;
res.type = MidiEventType.tempo;
res.intValue = new int[1];
res.intValue[0] = tempo;
return res;
}
public static MidiEvent TimeSig( int clock, int numerator, int denominator ) {
MidiEvent res = new MidiEvent();
res.index = clock;
res.type = MidiEventType.time_signal;
res.intValue = new int[2];
res.intValue[0] = numerator;
res.intValue[1] = denominator;
return res;
}
public Object clone() {
MidiEvent res = new MidiEvent();
res.index = index;
res.type = type;
if ( intValue != null ) {
res.intValue = new int[intValue.length];
for ( int i = 0; i < intValue.length; i++ ) {
res.intValue[i] = intValue[i];
}
}
res.stringValue = stringValue;
if ( byteValue != null ) {
res.byteValue = new byte[byteValue.length];
for ( int i = 0; i < byteValue.length; i++ ) {
res.byteValue[i] = byteValue[i];
}
}
return res;
}
public int compareTo( MidiEvent obj ) {
return this.index - obj.index;
}
public boolean Equals( MidiEvent obj ) {
if ( this.index == obj.index ) {
return true;
} else {
return false;
}
}
private MidiEvent() {
}
/**
* かきかけ。メタテキスト以外のmidiイベントを取り扱う。
* @param line
*/
public MidiEvent( String line ) {
index = -1;
type = MidiEventType.unknown;
//intValue = new int[1];
//intValue[0] = -9000;
stringValue = "";
byteValue = null;
String[] spl = line.split( " " );
index = Integer.parseInt( spl[0] );
if ( spl[1].equals( "Tempo" ) ) {
type = MidiEventType.tempo;
intValue = new int[1];
intValue[0] = Integer.parseInt( spl[2] );
} else if ( spl[1].equals( "TimeSig" ) ) {
type = MidiEventType.time_signal;
intValue = new int[4];
String[] spl2 = spl[2].split( "/" );
intValue[0] = Integer.parseInt( spl2[0] );
intValue[1] = Integer.parseInt( spl2[1] );
intValue[2] = Integer.parseInt( spl[3] );
intValue[3] = Integer.parseInt( spl[4] );
} else if ( spl[1].equals( "Par" ) ) {
type = MidiEventType.parameter;
intValue = new int[3];
String[] spl3 = spl[2].split( "=" );
intValue[0] = Integer.parseInt( spl3[1] );
spl3 = spl[3].split( "=" );
intValue[1] = Integer.parseInt( spl3[1] );
spl3 = spl[4].split( "=" );
intValue[2] = Integer.parseInt( spl3[1] );
} else {
type = MidiEventType.unknown;
stringValue = spl[2];
for ( int i = 1; i < spl.length; i++ ) {
stringValue += " " + spl[i];
}
}
}
}

View File

@@ -0,0 +1,71 @@
/*
* MidiEvent.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
public enum MidiEventType {
/// <summary>
/// channel = 015の値
/// </summary>
channel,
/// <summary>
/// note = 0127の値
/// </summary>
note,
/// <summary>
/// dtime = 0268,435,455 (0x0FFFFFFF)の値
/// </summary>
dtime,
/// <summary>
/// velocity = 0127の値
/// </summary>
velocity,
/// <summary>
/// patch = 0127の値
/// </summary>
patch,
/// <summary>
/// sequence = 0-65,535 (0xFFFF)の値
/// </summary>
sequence,
/// <summary>
/// text = 0byte以上のASCII文字列
/// </summary>
text,
/// <summary>
/// raw = 0byte以上のバイナリデータの文字列
/// </summary>
raw,
/// <summary>
/// pitch_wheel = -81928191 (0x1FFF)の値
/// </summary>
pitch_wheel,
/// <summary>
/// song_pos = 016,383 (0x3FFF)の値
/// </summary>
song_pos,
/// <summary>
/// song_number = 0127の値
/// </summary>
song_number,
/// <summary>
/// tempo = マイクロ秒, 016,777,215 (0x00FFFFFF)の値
/// </summary>
tempo,
time_signal,
unknown,
/// <summary>
/// 勝手に追加。スイマセン
/// </summary>
parameter,
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,49 @@
/*
* NrpnData.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
public class NrpnData {
//private int m_clock;
public int Clock;
//private byte m_parameter;
public byte Parameter;
//private byte m_value;
public byte Value;
public NrpnData( int clock, byte parameter, byte value ) {
Clock = clock;
Parameter = parameter;
Value = value;
}
/*public property int Clock {
get {
return m_clock;
}
};*/
/*public property byte Parameter {
get {
return m_parameter;
}
};*/
/*public property byte Value {
get {
return m_value;
}
set {
m_value = value;
}
};*/
}

View File

@@ -0,0 +1,50 @@
/*
* SMFReader.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
import java.util.*;
/// <summary>
/// SMFファイルを解析し、テキストファイル形式のデータに変換します
/// </summary>
public class SMFReader {
//private StreamReader sr = null;
private MidiFile m_midi = null;
//private String _result = "";
private Vector<String> m_lines;
/// <summary>
/// デフォルトコンストラクタ。コンストラクトと同時に解析を行い、指定されたファイルに結果を格納します。
/// </summary>
/// <param name="_path">解析対象のファイルへのパス</param>
public SMFReader( String _path ) {
//_result = Path.GetTempFileName();
m_midi = new MidiFile( _path );//, _result, Mode.Read );
//sr = new StreamReader( _result );
m_lines = new Vector<String>();
String[] splitted = m_midi.ReadToEnd().split( "\n" );
for( int i = 0; i < splitted.length; i++ ){
String spl = splitted[i];
m_lines.add( spl );
}
}
public void dispose() {
m_midi.close();
}
public Vector<String> getLines() {
return m_lines;
}
}

View File

@@ -0,0 +1,327 @@
/*
* SingerConfig.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
import java.util.*;
import java.io.*;
import jp.sourceforge.lipsync.bocoree.*;
public class SingerConfig {
public String ID = "VOCALOID:VIRTUAL:VOICE";
public String FORMAT = "2.0.0.0";
public String VOICEIDSTR = "";
public String VOICENAME = "Miku";
public int Breathiness = 0;
public int Brightness = 0;
public int Clearness = 0;
public int Opening = 0;
public int GenderFactor = 0;
public int Original = 0;
public static void decode_vvd_bytes( Vector dat ) {
for ( int i = 0; i < dat.size(); i++ ) {
byte b = (Byte)dat.get( i );
byte M = (byte)(b >> 4);
byte L = (byte)(b - (M << 4));
byte newM = endecode_vvd_m( M );
byte newL = endecode_vvd_l( L );
dat.set( i, (byte)((newM << 4) | newL) );
}
}
private static byte endecode_vvd_l( byte value ) {
switch ( value ) {
case 0x0:
return 0xa;
case 0x1:
return 0xb;
case 0x2:
return 0x8;
case 0x3:
return 0x9;
case 0x4:
return 0xe;
case 0x5:
return 0xf;
case 0x6:
return 0xc;
case 0x7:
return 0xd;
case 0x8:
return 0x2;
case 0x9:
return 0x3;
case 0xa:
return 0x0;
case 0xb:
return 0x1;
case 0xc:
return 0x6;
case 0xd:
return 0x7;
case 0xe:
return 0x4;
case 0xf:
return 0x5;
}
return 0x0;
}
private static byte endecode_vvd_m( byte value ) {
switch ( value ) {
case 0x0:
return 0x1;
case 0x1:
return 0x0;
case 0x2:
return 0x3;
case 0x3:
return 0x2;
case 0x4:
return 0x5;
case 0x5:
return 0x4;
case 0x6:
return 0x7;
case 0x7:
return 0x6;
case 0x8:
return 0x9;
case 0x9:
return 0x8;
case 0xa:
return 0xb;
case 0xb:
return 0xa;
case 0xc:
return 0xd;
case 0xd:
return 0xc;
case 0xe:
return 0xf;
case 0xf:
return 0xe;
}
return 0x0;
}
public SingerConfig( String file, int original ) throws FileNotFoundException, IOException {
Original = original;
FileInputStream fs = new FileInputStream( file );
File f = new File( file );
int length = (int)f.length();
byte[] tdat = new byte[length];
fs.read( tdat, 0, length );
Vector dat = new Vector();
decode_vvd_bytes( dat );
for ( int i = 0; i < dat.size() - 1; i++ ) {
tdat[i] = (Byte)dat.get( i );
}
for ( int i = 0; i < tdat.length - 1; i++ ) {
byte b = tdat[i];
if ( b == 0x17 && b == 0x10 ) {
tdat[i] = 0x0d;
tdat[i + 1] = 0x0a;
}
}
String str = cp932.convert( tdat );
String crlf = Character.toString( (char)0x0d ) + Character.toString( (char)0x0a );
String[] spl = str.split( crlf );
for ( int i = 0; i < spl.length; i++ ) {
String s = spl[i];
int first = s.indexOf( '"' );
int first_end = get_quated_String( s, first );
int second = s.indexOf( '"', first_end + 1 );
int second_end = get_quated_String( s, second );
char[] chs = s.toCharArray();
String id = new String( chs, first, first_end - first + 1 );
String value = new String( chs, second, second_end - second + 1 );
id = id.substring( 1, id.length() - 2 );
value = value.substring( 1, value.length() - 2 );
value = value.replace( "\\\"", "\"" );
if ( id.equals( "ID" ) ) {
ID = value;
} else if ( id.equals( "FORMAT" ) ) {
FORMAT = value;
} else if ( id.equals( "VOICEIDSTR" ) ) {
VOICEIDSTR = value;
} else if ( id.equals( "VOICENAME" ) ) {
VOICENAME = value;
} else if ( id.equals( "Breathiness" ) ) {
try {
Breathiness = Integer.parseInt( value );
} catch ( Exception e ) {
}
} else if ( id.equals( "Brightness" ) ) {
try {
Brightness = Integer.parseInt( value );
} catch ( Exception e ) {
}
} else if ( id.equals( "Clearness" ) ) {
try {
Clearness = Integer.parseInt( value );
} catch ( Exception e ) {
}
} else if ( id.equals( "Opening" ) ) {
try {
Opening = Integer.parseInt( value );
} catch ( Exception e ) {
}
} else if ( id.equals( "Gender:Factor" ) ) {
try {
GenderFactor = Integer.parseInt( value );
} catch ( Exception e ) {
}
}
}
}
/// <summary>
/// 位置positionにある'"'から,次に現れる'"'の位置を調べる.エスケープされた\"はスキップされる.'"'が見つからなかった場合-1を返す
/// </summary>
/// <param name="s"></param>
/// <param name="position"></param>
/// <returns></returns>
private static int get_quated_String( String s, int position ) {
if ( position < 0 ) {
return -1;
}
char[] chs = s.toCharArray();
if ( position >= chs.length ) {
return -1;
}
if ( chs[position] != '"' ) {
return -1;
}
int end = -1;
for ( int i = position + 1; i <
chs.length; i++ ) {
if ( chs[i] == '"' && chs[i - 1] != '\\' ) {
end = i;
break;
}
}
return end;
}
// ここ注意!!
public String[] toStringEx() {
Vector<String> ret = new Vector<String>();
ret.add( "\"ID\":=:\"" + ID + "\"" );
ret.add( "\"FORMAT\":=:\"" + FORMAT + "\"" );
ret.add( "\"VOICEIDSTR\":=:\"" + VOICEIDSTR + "\"" );
ret.add( "\"VOICENAME\":=:\"" + VOICENAME.replace( "\"", "\\\"" ) + "\"" );
ret.add( "\"Breathiness\":=:\"" + Breathiness + "\"" );
ret.add( "\"Brightness\":=:\"" + Brightness + "\"" );
ret.add( "\"Clearness\":=:\"" + Clearness + "\"" );
ret.add( "\"Opening\":=:\"" + Opening + "\"" );
ret.add( "\"Gender:Factor\":=:\"" + GenderFactor + "\"" );
return ret.toArray( new String[]{} );
}
/*public property int Original {
get {
return m_original;
}
set {
m_original = value;
}
};*/
/*public property String ID {
get {
return m_id;
}
set {
m_id = value;
}
};*/
/*public property String FORMAT {
get {
return m_format;
}
set {
m_format = value;
}
};*/
/*public property String VOICEIDSTR {
get {
return m_voiceidstr;
}
set {
m_voiceidstr = value;
}
};*/
/*public proprety String VOICENAME {
get {
return m_voicename;
}
set {
m_voicename = value;
}
};*/
/*public property int Breathiness {
get {
return m_breathiness;
}
set {
m_breathiness = value;
}
};*/
/*public property int Brightness {
get {
return m_brightness;
}
set {
m_brightness = value;
}
};*/
/*public property int Clearness {
get {
return m_clearness;
}
set {
m_clearness = value;
}
};*/
/*public proprety int Opening {
get {
return m_opening;
}
set {
m_opening = value;
}
};*/
/*public property int GenderFactor {
get {
return m_gender_factor;
}
set {
m_gender_factor = value;
}
};*/
}

View File

@@ -0,0 +1,70 @@
/*
* BPPair.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
public class TempoTableEntry implements Comparable<TempoTableEntry>, Cloneable {
//private int m_clock;
public int Clock;
//private int m_tempo;
public int Tempo;
//private double m_time;
public double Time;
/*public property int Tempo {
get {
return m_tempo;
}
set {
m_tempo = value;
}
};*/
/*public property double Time {
get {
return m_time;
}
set {
m_time = value;
}
};*/
/*public property int Clock {
get {
return m_clock;
}
set {
m_clock = value;
}
};*/
public Object clone() {
return new TempoTableEntry( Clock, Tempo, Time );
}
public TempoTableEntry( int _index, int _tempo, double _time ) {
this.Clock = _index;
this.Tempo = _tempo;
this.Time = _time;
}
public int compareTo( TempoTableEntry entry ) {
return this.Clock - entry.Clock;
}
public boolean equals( TempoTableEntry entry ) {
if ( this.Clock == entry.Clock ) {
return true;
} else {
return false;
}
}
}

View File

@@ -0,0 +1,112 @@
/*
* TextMemoryStream.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
import java.io.*;
import java.util.*;
/**
*
* @author kbinani
*/
public class TextMemoryStream {
StringBuilder m_ms = null;
int m_position;
/// <summary>
///
/// </summary>
/// <param name="s"></param>
public void write( String value ) {
m_ms.append( value );
m_position = m_ms.length();
}
public void rewind() {
m_position = 0;
}
public void writeLine( String s ) {
m_ms.append( s + "\n" );
}
public void close() {
if ( m_ms != null ) {
m_ms = null;
}
}
public int peek() {
if ( m_position >= m_ms.length() ) {
return -1;
} else {
return (int)m_ms.charAt( m_position );
}
}
private int readByte() {
if ( m_position >= m_ms.length() ) {
return -1;
} else {
m_position++;
return (int)m_ms.charAt( m_position );
}
}
public String readLine() {
int ret;
ret = readByte();
ArrayList buffer = new ArrayList();
while ( ret >= 0 ) {
char ch = (char)ret;
if ( ch == '\n' ) {
int next;
long current = m_position; //0x0Dを検出した直後のストリームの位置
break;
}
buffer.add( ch );
ret = readByte();
}
String ans = "";
for ( int i = 0; i < buffer.size(); i++ ) {
ans += buffer.get( i );
}
return ans;
}
public void dispose() {
close();
}
public TextMemoryStream( String path, String encoding ) throws Exception {
m_ms = new StringBuilder();
File f = new File( path );
if ( f.exists() ) {
FileReader fis = new FileReader( f );
BufferedReader br = new BufferedReader( fis );
while ( br.ready() ) {
String line = br.readLine();
m_ms.append( line + "\n" );
}
}
m_position = 0;
}
public TextMemoryStream() {
m_ms = new StringBuilder();
m_position = 0;
}
}

View File

@@ -0,0 +1,43 @@
/*
* TextResult.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
/**
*
* @author kbinani
*/
public class TextResult {
private String m_value;
/**
*
* @param value
*/
public TextResult( String value ) {
m_value = value;
}
/**
*
* @return
*/
public String get() {
return m_value;
}
public void set( String value ) {
m_value = value;
}
}

View File

@@ -0,0 +1,90 @@
/*
* BPPair.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
public class TimeSigTableEntry implements Comparable<TimeSigTableEntry>, Cloneable {
//int m_clock;
public int Clock;
//int m_numerator;
public int Numerator;
//int m_denominator;
public int Denominator;
//int m_bar_count;
public int BarCount;
public Object clone() {
return new TimeSigTableEntry( Clock, Numerator, Denominator, BarCount );
}
public int compareTo( TimeSigTableEntry item ) {
return this.BarCount - item.BarCount;
}
/*// <summary>
/// クロック数
/// </summary>
public property int Clock {
get {
return m_clock;
}
set {
m_clock = value;
}
};*/
/*// <summary>
/// 拍子の分母
/// </summary>
public property int Numerator {
get {
return m_numerator;
}
set {
m_numerator = value;
}
};*/
/*// <summary>
/// 拍子の分母
/// </summary>
public property int Denominator {
get {
return m_denominator;
}
set {
m_denominator = value;
}
};*/
/*// <summary>
/// Clockの時点で何小節目かを取得します。
/// </summary>
public property int BarCount {
get {
return m_bar_count;
}
set {
m_bar_count = value;
}
};*/
public TimeSigTableEntry(
int clock,
int numerator,
int denominator,
int bar_count ) {
Clock = clock;
Numerator = numerator;
Denominator = denominator;
BarCount = bar_count;
}
}

View File

@@ -0,0 +1,156 @@
/*
* VibratoHandle.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
/**
*
* @author kbinani
*/
public class VibratoHandle extends VsqHandle implements Cloneable {
public Object clone() {
VibratoHandle result = new VibratoHandle();
result.Type = Type;
result.Index = Index;
result.IconID = IconID;
result.IDS = this.IDS;
result.Original = this.Original;
result.Caption = this.Caption;
result.Length = this.Length;
result.StartDepth = this.StartDepth;
result.DepthBPNum = this.DepthBPNum;
if ( DepthBPX != null ) {
result.DepthBPX = (float[])this.DepthBPX.clone();
}
if ( DepthBPY != null ) {
result.DepthBPY = (int[])this.DepthBPY.clone();
}
result.StartRate = this.StartRate;
result.RateBPNum = this.RateBPNum;
if ( this.RateBPX != null ) {
result.RateBPX = (float[])this.RateBPX.clone();
}
if ( this.RateBPY != null ) {
result.RateBPY = (int[])this.RateBPY.clone();
}
return result;
}
/*public int Original {
get {
return m_original;
}
set {
m_original = value;
}
}*/
/*public int Length {
get {
return m_length;
}
set {
m_length = value;
}
}*/
/*public string Caption {
get {
return m_caption;
}
set {
m_caption = value;
}
}*/
/*public property String IDS {
get {
return m_ids;
}
set {
m_ids = value;
}
};*/
/*public string IconID {
get {
return m_icon_id;
}
set {
m_icon_id = value;
}
}*/
/*public int StartDepth {
get {
return m_start_depth;
}
set {
m_start_depth = value;
}
}*/
/*public int StartRate {
get {
return m_start_rate;
}
set {
m_start_rate = value;
}
}*/
/*public int DepthBPNum {
get {
return m_depth_bp_num;
}
set {
m_depth_bp_num = value;
}
}*/
/*public property int RateBPNum {
get {
return m_rate_bp_num;
}
set {
m_rate_bp_num = value;
}
};*/
/*public property float[] DepthBPX {
get {
return m_depth_bp_x;
}
set {
m_depth_bp_x = value;
}
};*/
/*public property int[] DepthBPY {
get {
return m_depth_bp_y;
}
set {
m_depth_bp_y = value;
}
};*/
/*public property float[] RateBPX {
get {
return m_rate_bp_x;
}
set {
m_rate_bp_x = value;
}
};*/
/*public property int[] RateBPY {
get {
return m_rate_bp_y;
}
set {
m_rate_bp_y = value;
}
};*/
}

View File

@@ -0,0 +1,33 @@
/*
* VibratoType.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
public enum VibratoType{
NormalType1,
NormalType2,
NormalType3,
NormalType4,
ExtremeType1,
ExtremeType2,
ExtremeType3,
ExtremeType4,
FastType1,
FastType2,
FastType3,
FastType4,
SlightType1,
SlightType2,
SlightType3,
SlightType4,
}

View File

@@ -0,0 +1,253 @@
/*
* VibratoType.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
/**
*
* @author kbinani
*/
public class VibratoTypeUtil {
public static VibratoType FromIconID( String icon_id ) {
if ( icon_id.equals( "$04040001" ) ) {
return VibratoType.NormalType1;
} else if ( icon_id.equals( "$04040002" ) ) {
return VibratoType.NormalType2;
} else if ( icon_id.equals( "$04040003" ) ) {
return VibratoType.NormalType3;
} else if ( icon_id.equals( "$0400004" ) ) {
return VibratoType.NormalType4;
} else if ( icon_id.equals( "$04040005" ) ) {
return VibratoType.ExtremeType1;
} else if ( icon_id.equals( "$04040006" ) ) {
return VibratoType.ExtremeType2;
} else if ( icon_id.equals( "$04040007" ) ) {
return VibratoType.ExtremeType3;
} else if ( icon_id.equals( "$04040008" ) ) {
return VibratoType.ExtremeType4;
} else if ( icon_id.equals( "$04040009" ) ) {
return VibratoType.FastType1;
} else if ( icon_id.equals( "$0404000a" ) ) {
return VibratoType.FastType2;
} else if ( icon_id.equals( "$0404000b" ) ) {
return VibratoType.FastType3;
} else if ( icon_id.equals( "$0404000c" ) ) {
return VibratoType.FastType4;
} else if ( icon_id.equals( "$0404000d" ) ) {
return VibratoType.SlightType1;
} else if ( icon_id.equals( "$0404000e" ) ) {
return VibratoType.SlightType2;
} else if ( icon_id.equals( "$0404000f" ) ) {
return VibratoType.SlightType3;
} else if ( icon_id.equals( "$04040010" ) ) {
return VibratoType.SlightType4;
}
return VibratoType.NormalType1;
}
public static String GetIconID( VibratoType type ) {
switch ( type ) {
case NormalType1:
return "$04040001";
case NormalType2:
return "$04040002";
case NormalType3:
return "$04040003";
case NormalType4:
return "$0400004";
case ExtremeType1:
return "$04040005";
case ExtremeType2:
return "$04040006";
case ExtremeType3:
return "$04040007";
case ExtremeType4:
return "$04040008";
case FastType1:
return "$04040009";
case FastType2:
return "$0404000a";
case FastType3:
return "$0404000b";
case FastType4:
return "$0404000c";
case SlightType1:
return "$0404000d";
case SlightType2:
return "$0404000e";
case SlightType3:
return "$0404000f";
case SlightType4:
return "$04040010";
}
return "";
}
public static VibratoHandle GetDefaultVibratoHandle( VibratoType type, int vibrato_clocks ) {
VibratoHandle res = new VibratoHandle();
res.Type = VsqHandleType.Vibrato;
res.Length = vibrato_clocks;
res.Original = 1;
res.DepthBPNum = 0;
res.RateBPNum = 0;
res.Caption = toString( type );
res.IconID = GetIconID( type );
switch ( type ) {
case NormalType1:
res.IDS = "normal";
res.StartDepth = 64;
res.StartRate = 50;
break;
case NormalType2:
res.IDS = "normal";
res.StartDepth = 40;
res.StartRate = 40;
break;
case NormalType3:
res.IDS = "normal";
res.StartDepth = 127;
res.StartRate = 50;
break;
case NormalType4:
res.IDS = "normal";
res.StartDepth = 64;
res.DepthBPNum = 57;
res.DepthBPX = new float[]{ 0.603900f, 0.612500f, 0.616400f, 0.621100f, 0.625000f, 0.633600f, 0.637500f, 0.641400f, 0.646100f, 0.653900f, 0.658600f, 0.666400f, 0.670300f, 0.675000f, 0.678900f, 0.683600f, 0.691400f, 0.696100f, 0.703900f, 0.708600f, 0.712500f, 0.716400f, 0.721100f, 0.725000f, 0.728900f, 0.737500f, 0.746100f, 0.750000f, 0.758600f, 0.762500f, 0.766400f, 0.771100f, 0.775000f, 0.783600f, 0.791400f, 0.795300f, 0.800000f, 0.803900f, 0.808600f, 0.812500f, 0.821100f, 0.828900f, 0.837500f, 0.841400f, 0.846100f, 0.850000f, 0.853900f, 0.862500f, 0.866400f, 0.875000f, 0.878900f, 0.883600f, 0.887500f, 0.891400f, 0.896100f, 0.900000f, 1.000000f };
res.DepthBPY = new int[]{ 64, 63, 62, 61, 59, 58, 57, 56, 55, 54, 52, 51, 50, 49, 48, 47, 45, 44, 43, 42, 41, 40, 39, 38, 37, 35, 34, 32, 31, 30, 29, 28, 27, 25, 24, 23, 22, 21, 20, 19, 17, 15, 14, 13, 12, 11, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 };
res.StartRate = 50;
res.RateBPNum = 52;
res.RateBPX = new float[]{ 0.600000f, 0.612500f, 0.616400f, 0.621100f, 0.628900f, 0.633600f, 0.637500f, 0.641400f, 0.653900f, 0.658600f, 0.662500f, 0.666400f, 0.675000f, 0.683600f, 0.687500f, 0.691400f, 0.700000f, 0.703900f, 0.708600f, 0.712500f, 0.725000f, 0.728900f, 0.732800f, 0.737500f, 0.746100f, 0.750000f, 0.758600f, 0.762500f, 0.771100f, 0.775000f, 0.778900f, 0.783600f, 0.795300f, 0.800000f, 0.803900f, 0.808600f, 0.816400f, 0.821100f, 0.828900f, 0.833600f, 0.841400f, 0.846100f, 0.850000f, 0.853900f, 0.866400f, 0.871100f, 0.875000f, 0.878900f, 0.887500f, 0.891400f, 0.900000f, 1.000000f };
res.RateBPY = new int[]{ 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 };
break;
case ExtremeType1:
res.IDS = "extreme";
res.StartDepth = 64;
res.StartRate = 64;
break;
case ExtremeType2:
res.IDS = "extreme";
res.StartDepth = 32;
res.StartRate = 32;
break;
case ExtremeType3:
res.IDS = "extreme";
res.StartDepth = 100;
res.StartRate = 50;
break;
case ExtremeType4:
res.IDS = "extreme";
res.StartDepth = 64;
res.DepthBPNum = 57;
res.DepthBPX = new float[]{ 0.603900f, 0.612500f, 0.616400f, 0.621100f, 0.625000f, 0.633600f, 0.637500f, 0.641400f, 0.646100f, 0.653900f, 0.658600f, 0.666400f, 0.670300f, 0.675000f, 0.678900f, 0.683600f, 0.691400f, 0.696100f, 0.703900f, 0.708600f, 0.712500f, 0.716400f, 0.721100f, 0.725000f, 0.728900f, 0.737500f, 0.746100f, 0.750000f, 0.758600f, 0.762500f, 0.766400f, 0.771100f, 0.775000f, 0.783600f, 0.791400f, 0.795300f, 0.800000f, 0.803900f, 0.808600f, 0.812500f, 0.821100f, 0.828900f, 0.837500f, 0.841400f, 0.846100f, 0.850000f, 0.853900f, 0.862500f, 0.866400f, 0.875000f, 0.878900f, 0.883600f, 0.887500f, 0.891400f, 0.896100f, 0.900000f, 1.000000f };
res.DepthBPY = new int[]{ 64, 63, 62, 61, 59, 58, 57, 56, 55, 54, 52, 51, 50, 49, 48, 47, 45, 44, 43, 42, 41, 40, 39, 38, 37, 35, 34, 32, 31, 30, 29, 28, 27, 25, 24, 23, 22, 21, 20, 19, 17, 15, 14, 13, 12, 11, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 };
res.StartRate = 64;
res.RateBPNum = 57;
res.RateBPX = new float[]{ 0.603900f, 0.612500f, 0.616400f, 0.621100f, 0.625000f, 0.633600f, 0.637500f, 0.641400f, 0.646100f, 0.653900f, 0.658600f, 0.666400f, 0.670300f, 0.675000f, 0.678900f, 0.683600f, 0.691400f, 0.696100f, 0.703900f, 0.708600f, 0.712500f, 0.716400f, 0.721100f, 0.725000f, 0.728900f, 0.737500f, 0.746100f, 0.750000f, 0.758600f, 0.762500f, 0.766400f, 0.771100f, 0.775000f, 0.783600f, 0.791400f, 0.795300f, 0.800000f, 0.803900f, 0.808600f, 0.812500f, 0.821100f, 0.828900f, 0.837500f, 0.841400f, 0.846100f, 0.850000f, 0.853900f, 0.862500f, 0.866400f, 0.875000f, 0.878900f, 0.883600f, 0.887500f, 0.891400f, 0.896100f, 0.900000f, 1.000000f };
res.RateBPY = new int[]{ 64, 63, 62, 61, 59, 58, 57, 56, 55, 54, 52, 51, 50, 49, 48, 47, 45, 44, 43, 42, 41, 40, 39, 38, 37, 35, 34, 32, 31, 30, 29, 28, 27, 25, 24, 23, 22, 21, 20, 19, 17, 15, 14, 13, 12, 11, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 };
break;
case FastType1:
res.IDS = "fast";
res.StartDepth = 64;
res.StartRate = 64;
break;
case FastType2:
res.IDS = "fast";
res.StartDepth = 40;
res.StartRate = 50;
break;
case FastType3:
res.IDS = "fast";
res.StartDepth = 80;
res.StartRate = 70;
break;
case FastType4:
res.IDS = "fast";
res.StartDepth = 64;
res.DepthBPNum = 57;
res.DepthBPX = new float[]{ 0.603900f, 0.612500f, 0.616400f, 0.621100f, 0.625000f, 0.633600f, 0.637500f, 0.641400f, 0.646100f, 0.653900f, 0.658600f, 0.666400f, 0.670300f, 0.675000f, 0.678900f, 0.683600f, 0.691400f, 0.696100f, 0.703900f, 0.708600f, 0.712500f, 0.716400f, 0.721100f, 0.725000f, 0.728900f, 0.737500f, 0.746100f, 0.750000f, 0.758600f, 0.762500f, 0.766400f, 0.771100f, 0.775000f, 0.783600f, 0.791400f, 0.795300f, 0.800000f, 0.803900f, 0.808600f, 0.812500f, 0.821100f, 0.828900f, 0.837500f, 0.841400f, 0.846100f, 0.850000f, 0.853900f, 0.862500f, 0.866400f, 0.875000f, 0.878900f, 0.883600f, 0.887500f, 0.891400f, 0.896100f, 0.900000f, 1.000000f };
res.DepthBPY = new int[]{ 64, 63, 62, 61, 59, 58, 57, 56, 55, 54, 52, 51, 50, 49, 48, 47, 45, 44, 43, 42, 41, 40, 39, 38, 37, 35, 34, 32, 31, 30, 29, 28, 27, 25, 24, 23, 22, 21, 20, 19, 17, 15, 14, 13, 12, 11, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 };
res.StartRate = 64;
res.RateBPNum = 57;
res.RateBPX = new float[]{ 0.603900f, 0.612500f, 0.616400f, 0.621100f, 0.625000f, 0.633600f, 0.637500f, 0.641400f, 0.646100f, 0.653900f, 0.658600f, 0.666400f, 0.670300f, 0.675000f, 0.678900f, 0.683600f, 0.691400f, 0.696100f, 0.703900f, 0.708600f, 0.712500f, 0.716400f, 0.721100f, 0.725000f, 0.728900f, 0.737500f, 0.746100f, 0.750000f, 0.758600f, 0.762500f, 0.766400f, 0.771100f, 0.775000f, 0.783600f, 0.791400f, 0.795300f, 0.800000f, 0.803900f, 0.808600f, 0.812500f, 0.821100f, 0.828900f, 0.837500f, 0.841400f, 0.846100f, 0.850000f, 0.853900f, 0.862500f, 0.866400f, 0.875000f, 0.878900f, 0.883600f, 0.887500f, 0.891400f, 0.896100f, 0.900000f, 1.000000f };
res.RateBPY = new int[]{ 64, 63, 62, 61, 59, 58, 57, 56, 55, 54, 52, 51, 50, 49, 48, 47, 45, 44, 43, 42, 41, 40, 39, 38, 37, 35, 34, 32, 31, 30, 29, 28, 27, 25, 24, 23, 22, 21, 20, 19, 17, 15, 14, 13, 12, 11, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 };
break;
case SlightType1:
res.IDS = "slight";
res.StartDepth = 64;
res.StartRate = 64;
break;
case SlightType2:
res.IDS = "slight";
res.StartDepth = 40;
res.StartRate = 64;
break;
case SlightType3:
res.IDS = "slight";
res.StartDepth = 72;
res.StartRate = 64;
break;
case SlightType4:
res.IDS = "slight";
res.StartDepth = 64;
res.DepthBPNum = 57;
res.DepthBPX = new float[]{ 0.604300f, 0.612500f, 0.616800f, 0.620700f, 0.625000f, 0.633200f, 0.637500f, 0.641800f, 0.645700f, 0.654300f, 0.658200f, 0.666800f, 0.670700f, 0.675000f, 0.679300f, 0.683200f, 0.691800f, 0.695700f, 0.704300f, 0.708200f, 0.712500f, 0.716800f, 0.720700f, 0.725000f, 0.729300f, 0.737500f, 0.745700f, 0.750000f, 0.758200f, 0.762500f, 0.766800f, 0.770700f, 0.775000f, 0.783200f, 0.791800f, 0.795700f, 0.800000f, 0.804300f, 0.808200f, 0.812500f, 0.820700f, 0.829300f, 0.837500f, 0.841800f, 0.845700f, 0.850000f, 0.854300f, 0.862500f, 0.866800f, 0.875000f, 0.879300f, 0.883200f, 0.887500f, 0.891800f, 0.895700f, 0.900000f, 1.000000f };
res.DepthBPY = new int[]{ 64, 63, 62, 61, 59, 58, 57, 56, 55, 54, 52, 51, 50, 49, 48, 47, 45, 44, 43, 42, 41, 40, 39, 38, 37, 35, 34, 32, 31, 30, 29, 28, 27, 25, 24, 23, 22, 21, 20, 19, 17, 15, 14, 13, 12, 11, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 };
res.StartRate = 64;
res.RateBPNum = 57;
res.RateBPX = new float[]{ 0.604300f, 0.612500f, 0.616800f, 0.620700f, 0.625000f, 0.633200f, 0.637500f, 0.641800f, 0.645700f, 0.654300f, 0.658200f, 0.666800f, 0.670700f, 0.675000f, 0.679300f, 0.683200f, 0.691800f, 0.695700f, 0.704300f, 0.708200f, 0.712500f, 0.716800f, 0.720700f, 0.725000f, 0.729300f, 0.737500f, 0.745700f, 0.750000f, 0.758200f, 0.762500f, 0.766800f, 0.770700f, 0.775000f, 0.783200f, 0.791800f, 0.795700f, 0.800000f, 0.804300f, 0.808200f, 0.812500f, 0.820700f, 0.829300f, 0.837500f, 0.841800f, 0.845700f, 0.850000f, 0.854300f, 0.862500f, 0.866800f, 0.875000f, 0.879300f, 0.883200f, 0.887500f, 0.891800f, 0.895700f, 0.900000f, 1.000000f };
res.RateBPY = new int[]{ 64, 63, 62, 61, 59, 58, 57, 56, 55, 54, 52, 51, 50, 49, 48, 47, 45, 44, 43, 42, 41, 40, 39, 38, 37, 35, 34, 32, 31, 30, 29, 28, 27, 25, 24, 23, 22, 21, 20, 19, 17, 15, 14, 13, 12, 11, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 };
break;
}
return res;
}
public static String toString( VibratoType value ) {
switch ( value ) {
case NormalType1:
return "[Normal] Type 1";
case NormalType2:
return "[Normal] Type 2";
case NormalType3:
return "[Normal] Type 3";
case NormalType4:
return "[Normal] Type 4";
case ExtremeType1:
return "[Extreme] Type 1";
case ExtremeType2:
return "[Extreme] Type 2";
case ExtremeType3:
return "[Extreme] Type 3";
case ExtremeType4:
return "[Extreme] Type 4";
case FastType1:
return "[Fast] Type 1";
case FastType2:
return "[Fast] Type 2";
case FastType3:
return "[Fast] Type 3";
case FastType4:
return "[Fast] Type 4";
case SlightType1:
return "[Slight] Type 1";
case SlightType2:
return "[Slight] Type 2";
case SlightType3:
return "[Slight] Type 3";
case SlightType4:
return "[Slight] Type 4";
}
return "";
}
}

View File

@@ -0,0 +1,203 @@
/*
* VsqBPList.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
import java.util.*;
import java.io.*;
/**
* BPListのデータ部分を取り扱うためのクラス。
*@author kbinani
*/
public class VsqBPList implements Cloneable {
TreeMap<Integer, Integer> _list = new TreeMap<Integer, Integer>();
int _default = 0;
int _maximum = 127;
int _minimum = 0;
public Object clone() {
VsqBPList res = new VsqBPList( _default, _minimum, _maximum );
Set<Integer> enumerator = _list.keySet();
for ( Iterator itr = enumerator.iterator(); itr.hasNext();) {
Integer key = (Integer)itr.next();
res._list.put( key, _list.get( key ) );
}
return res;
}
/**
* コンストラクタ。デフォルト値はココで指定する。
* @param default_value
*/
public VsqBPList( int default_value, int minimum, int maximum ) {
_default = default_value;
_maximum = maximum;
_minimum = minimum;
}
/**
* このリストに設定された最大値を取得します。
*/
public int getMaximum() {
return _maximum;
}
/**
* このリストに設定された最小値を取得します
/*
public int getMinimum() {
return _minimum;
}
/* // <summary>
/// _listへのアクセッサ
/// </summary>
public SortedList<int, int> List {
get {
return _list;
}
}*/
public Set<Integer> keyClockSet() {
return _list.keySet();
}
public Iterator<Integer> keyClockIterator(){
return _list.keySet().iterator();
}
public void remove( int clock ) {
if ( _list.containsKey( clock ) ) {
_list.remove( clock );
}
}
public boolean containsKey( int clock ) {
return _list.containsKey( clock );
}
public int size() {
return _list.size();
}
public void clear() {
_list.clear();
}
/**
* 新しいデータ点を追加します。
*
* @param clock
* @param value
*/
public void add( int clock, int value ) {
_list.put( clock, value );
}
public int get( int clock ) {
if ( _list.size() == 0 ) {
return _default;
} else {
if ( _list.containsKey( clock ) ) {
return _list.get( clock );
} else {
int index = 0;
int prev = 0;
for ( Iterator itr = _list.keySet().iterator(); itr.hasNext();) {
Integer key = (Integer)itr.next();
if ( clock < key ) {
index = prev;
break;
}
prev = key;
}
if ( _list.containsKey( index ) ) {
return _list.get( index );
} else {
return _default;
}
}
}
}
/**
* このBPListのデフォルト値を取得します
*/
public int getDefault() {
return _default;
}
/**
* このBPListの内容をテキストファイルに書き出します
*
* @param writer
*/
public void print( BufferedWriter writer ) throws IOException {
boolean first = true;
for ( Iterator itr = _list.keySet().iterator(); itr.hasNext();) {
Integer key = (Integer)itr.next();
int val = _list.get( key );
if ( first ) {
writer.write( key + "=" + val + "\n" );
first = false;
} else {
writer.write( key + "=" + val + "\n" );
}
}
}
/**
* このBPListの内容をテキストファイルに書き出します
*
* @param writer
*/
public void print( TextMemoryStream writer, int start, String header ) {
boolean first = true;
for ( Iterator itr = _list.keySet().iterator(); itr.hasNext();) {
Integer key = (Integer)itr.next();
if ( start <= key ) {
if ( first ) {
writer.writeLine( header );
first = false;
}
int val = _list.get( key );
writer.writeLine( key + "=" + val );
}
}
}
/**
* テキストファイルからデータ点を読込み、現在のリストに追加します
*
* @param reader
* @returns
*/
public String readFrom( TextMemoryStream reader ) {
String last_line = reader.readLine();
while ( !last_line.startsWith( "[" ) ) {
String[] spl = last_line.split( "=" );
int i1 = Integer.parseInt( spl[0] );
int i2 = Integer.parseInt( spl[1] );
_list.put( i1, i2 );
if ( reader.peek() < 0 ) {
break;
} else {
last_line = reader.readLine();
}
}
return last_line;
}
}

View File

@@ -0,0 +1,126 @@
/*
* VsqBarLineEnumeration.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
import java.util.*;
/**
*
* @author kbinani
*/
public class VsqBarLineEnumeration implements Enumeration {
Vector<TimeSigTableEntry> TimeSigTable;
int end_clock;
int m_index = 0;
int m_last_clock = -1;
public VsqBarLineEnumeration( Vector<TimeSigTableEntry> time_sig_table, int t_end_clock ) {
TimeSigTable = time_sig_table;
end_clock = t_end_clock;
m_index = 0;
m_last_clock = -1;
}
public boolean hasMoreElements() {
if ( m_last_clock < 0 ) {
return true;
}
for ( int i = m_index; i < TimeSigTable.size(); i++ ) {
int denominator = TimeSigTable.get( i ).Denominator;
int numerator = TimeSigTable.get( i ).Numerator;
int local_clock = TimeSigTable.get( i ).Clock;
int bar_count = TimeSigTable.get( i ).BarCount;
int clock_step = 480 * 4 / denominator;
int mod = clock_step * numerator;
int bar_counter = bar_count - 1;
int t_end = end_clock;
if ( i + 1 < TimeSigTable.size() ) {
t_end = TimeSigTable.get( i + 1 ).Clock;
}
int t_start = m_last_clock + clock_step;
for ( int clock = t_start; clock < t_end; clock += clock_step ) {
if ( (clock - local_clock) % mod == 0 ) {
bar_counter++;
return true;
} else {
return true;
}
}
}
return false;
}
public Object nextElement() {
if ( m_last_clock < 0 ) {
m_last_clock = 0;
return new VsqBarLineType( 0, true, TimeSigTable.get( 0 ).Denominator, TimeSigTable.get( 0 ).Numerator, 0 );
}
int last = m_index;
for ( m_index = last; m_index < TimeSigTable.size(); m_index++ ) {
int denominator = TimeSigTable.get( m_index ).Denominator;
int numerator = TimeSigTable.get( m_index ).Numerator;
int local_clock = TimeSigTable.get( m_index ).Clock;
int bar_count = TimeSigTable.get( m_index ).BarCount;
int clock_step = 480 * 4 / denominator;
int mod = clock_step * numerator;
int bar_counter = bar_count - 1;
int t_end = end_clock;
if ( m_index + 1 < TimeSigTable.size() ) {
t_end = TimeSigTable.get( m_index + 1 ).Clock;
}
int t_start = m_last_clock + clock_step;
for ( int clock = t_start; clock < t_end; clock += clock_step ) {
if ( (clock - local_clock) % mod == 0 ) {
bar_counter++;
m_last_clock = clock;
return new VsqBarLineType( clock, true, denominator, numerator, bar_counter );
} else {
m_last_clock = clock;
return new VsqBarLineType( clock, false, denominator, numerator, bar_counter );
}
}
}
return null;
}
/*private Object imp_nextElement() {
int local_denominator;
int local_numerator;
int local_clock;
int local_bar_count;
int clock_step;
for ( int i = 0; i < TimeSigTable.size(); i++ ) {
local_denominator = TimeSigTable.get( i ).Denominator;
local_numerator = TimeSigTable.get( i ).Numerator;
local_clock = TimeSigTable.get( i ).Clock;
local_bar_count = TimeSigTable.get( i ).BarCount;
clock_step = 480 * 4 / local_denominator;
int mod = clock_step * local_numerator;
int bar_counter = local_bar_count - 1;
int t_end = end_clock;
if ( i + 1 < TimeSigTable.size() ) {
t_end = TimeSigTable.get( i + 1 ).Clock;
}
for ( int clock = local_clock; clock < t_end; clock += clock_step ) {
if ( (clock - local_clock) % mod == 0 ) {
bar_counter++;
return new VsqBarLineType( clock, true, local_denominator, local_numerator, bar_counter );
} else {
return new VsqBarLineType( clock, false, local_denominator, local_numerator, bar_counter );
}
}
}
}*/
}

View File

@@ -0,0 +1,56 @@
/*
* VibratoType.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
public class VsqBarLineType {
public int Clock = 0;
public boolean IsSeparator = true;
public int Denominator;
public int Numerator;
public int BarCount;
/*public property int BarCount {
get {
return m_bar_count;
}
};*/
/*public property int LocalDenominator {
get {
return m_denominator;
}
};*/
/*public property int LocalNumerator {
get {
return m_numerator;
}
};*/
/*public property int Clock {
get {
return m_clock;
}
};*/
/*public boolean property IsSeparator {
get {
return m_is_separator;
}
};*/
public VsqBarLineType( int clock, boolean is_separator, int denominator, int numerator, int bar_count ) {
Clock = clock;
IsSeparator = is_separator;
Denominator = denominator;
Numerator = numerator;
BarCount = bar_count;
}
}

View File

@@ -0,0 +1,44 @@
/*
* VsqCommand.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
import java.util.*;
/// <summary>
///
/// </summary>
public class VsqCommand {
public VsqCommandType Type;
/**
* コマンドの処理内容を保持します。Args具体的な内容は、処理するクラスごとに異なります
*/
public Object[] Args;
/**
* 後続するコマンド
*/
public Vector<VsqCommand> Children = new Vector<VsqCommand>();
/**
* このコマンドの親
*/
public VsqCommand Parent = null;
/**
* VsqCommandは各クラスのGenerateCommandからコンストラクトしなければならない。
* なので、無引数のコンストラクタを隠蔽するためのもの。
*/
protected VsqCommand() {
//throw new Exception( "このコンストラクトは呼び出しちゃいけませんよ" );
}
}

View File

@@ -0,0 +1,45 @@
/*
* VsqCommandType.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
public enum VsqCommandType {
Root,
ChangePreMeasure,
EventAdd,
EventDelete,
EventChangeClock,
EventChangeLyric,
EventChangeNote,
EventChangeClockAndNote,
TrackEditCurve,
TrackEditCurveRange,
EventChangeVelocity,
EventChangeLength,
EventChangeClockAndLength,
EventChangeIDContaints,
EventChangeClockAndIDContaints,
TrackChangeName,
AddTrack,
DeleteTrack,
EventChangeClockAndIDContaintsRange,
EventDeleteRange,
EventAddRange,
UpdateTempo,
UpdateTempoRange,
UpdateTimesig,
UpdateTimesigRange,
EventChangeIDContaintsRange,
TrackReplace,
Replace,
}

View File

@@ -0,0 +1,103 @@
/*
* VsqCommon.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
import java.awt.*;
/**
* vsqファイルのメタテキストの[Common]セクションに記録される内容を取り扱う
* @author kbinani
*/
public class VsqCommon implements Cloneable {
public String m_version;
public String m_name;
public String m_color;
public int m_dynamics_mode;
public int m_play_mode;
public Object clone() {
String[] spl = m_color.split( ",", 3 );
int r = Integer.parseInt( spl[0] );
int g = Integer.parseInt( spl[1] );
int b = Integer.parseInt( spl[2] );
Color color = new Color( r, g, b );
VsqCommon res = new VsqCommon( m_name, color, m_dynamics_mode, m_play_mode );
res.m_version = m_version;
return res;
}
/**
* 各パラメータを指定したコンストラクタ
* @param name トラック名
* @param color Color値意味は不明
* @param dynamics_mode DynamicsModeデフォルトは1
* @param play_mode PlayModeデフォルトは1
*/
public VsqCommon( String name, Color color, int dynamics_mode, int play_mode ) {
m_version = "DSB301";
m_name = name;
m_color = color.getRed() + "," + color.getGreen() + "," + color.getBlue();
m_dynamics_mode = dynamics_mode;
m_play_mode = play_mode;
}
/**
* MetaTextのテキストファイルからのコンストラクタ
* @param sr 読み込むテキストファイル
* @param last_line 読み込んだ最後の行が返される
*/
public VsqCommon( TextMemoryStream sr, TextResult last_line ) {
m_version = "";
m_name = "";
m_color = "0,0,0";
m_dynamics_mode = 0;
m_play_mode = 0;
last_line.set( sr.readLine() );
String[] spl;
while ( !last_line.get().startsWith( "[" ) ) {
spl = last_line.get().split( "=" );
if ( spl[0].equals( "Version" ) ) {
this.m_version = spl[1];
} else if ( spl[0].equals( "Name" ) ) {
this.m_name = spl[1];
break;
} else if ( spl[0].equals( "Color" ) ) {
this.m_color = spl[1];
} else if ( spl[0].equals( "DynamicsMode" ) ) {
this.m_dynamics_mode = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "PlayMode" ) ) {
this.m_play_mode = Integer.parseInt( spl[1] );
}
if ( sr.peek() < 0 ) {
break;
}
last_line.set( sr.readLine() );
}
}
/**
* インスタンスの内容をテキストファイルに出力します
*
* @param sw 出力先
*/
public void write( TextMemoryStream sw ) {
sw.writeLine( "[Common]" );
sw.writeLine( "Version=" + m_version );
sw.writeLine( "Name=" + m_name );
sw.writeLine( "Color=" + m_color );
sw.writeLine( "DynamicsMode=" + m_dynamics_mode );
sw.writeLine( "PlayMode=" + this.m_play_mode );
}
}

View File

@@ -0,0 +1,60 @@
/*
* VsqCurveType.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
/// <summary>
/// vsqファイルで編集可能なカーブ・プロパティの種類
/// </summary>
public enum VsqCurveType {
/// <summary>
/// ベロシティ
/// </summary>
VEL,
/// <summary>
/// ダイナミクス 64
/// </summary>
DYN,
/// <summary>
/// ブレシネス 0
/// </summary>
BRE,
/// <summary>
/// ブライトネス 64
/// </summary>
BRI,
/// <summary>
/// クリアネス 0
/// </summary>
CLE,
/// <summary>
/// オープニング 127
/// </summary>
OPE,
/// <summary>
/// ジェンダーファクター 64
/// </summary>
GEN,
/// <summary>
/// ポルタメントタイミング 64
/// </summary>
POR,
/// <summary>
/// ピッチベンド 0
/// </summary>
PIT,
/// <summary>
/// ピッチベンドセンシティビティ 2
/// </summary>
PBS,
}

View File

@@ -0,0 +1,110 @@
/*
* VsqEvent.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
/**
* vsqファイルのメタテキスト内に記述されるイベント。
*/
public class VsqEvent implements Comparable<VsqEvent>, Cloneable {
//int m_internal_id;
/**
* 内部で使用するインスタンス固有のID<br>
* for furutre implement:<pre>
* public property int InternalID {
* get {
* return m_internal_id;
* }
* set {
* m_internal_id = value;
* }
* };</pre>
*/
public int InternalID;
//int m_clock;
public int Clock;
//VsqID m_id;
public VsqID ID;
/**
* このオブジェクトのコピーを作成します
* @returns>
*/
public Object clone() {
VsqEvent ret = new VsqEvent( Clock, ID );
ret.InternalID = InternalID;
return ret;
}
/* // <summary>
/// このイベントが発生するクロック。
/// </summary>
public property int Clock {
get {
return m_clock;
}
set {
m_clock = value;
}
};*/
/* // <summary>
/// 発生するイベントの内容を表したID
/// </summary>
public property VsqID ID {
get {
return m_id;
}
set {
m_id = value;
}
};*/
public int compareTo( VsqEvent item ) {
int ret = this.Clock - item.Clock;
if ( ret == 0 ) {
if ( this.ID != null && item.ID != null ) {
if ( this.ID == item.ID ) {
return 0;
} else {
if ( this.ID.type == VsqIDType.Singer ) {
return -1;
} else if ( item.ID.type == VsqIDType.Anote ) {
return 1;
}
}
} else {
return ret;
}
} else {
return ret;
}
return 0;
}
public VsqEvent( String line ) {
String[] spl = line.split( "=" );
Clock = Integer.parseInt( spl[0] );
if ( spl[1].equals( "EOS" ) ) {
ID = VsqID.EOS;
}
}
public VsqEvent( int clock, VsqID id /*, int internal_id*/ ) {
Clock = clock;
ID = (VsqID)id.clone();
//InternalID = internal_id;
InternalID = 0;
}
}

View File

@@ -0,0 +1,84 @@
/*
* VsqEventIterator.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
import java.util.*;
/**
*
* @author kbinani
*/
public class VsqEventIterator implements Iterator {
private Vector<VsqEvent> m_list;
private int m_index = 0;
private VsqEventIteratorMode m_mode;
public VsqEventIterator( Vector<VsqEvent> list, VsqEventIteratorMode mode ) {
m_list = list;
m_index = 0;
m_mode = mode;
}
public void remove() {
m_list.remove( m_index );
}
public Object next() {
int last = m_index;
for ( m_index = last; m_index < m_list.size(); m_index++ ) {
VsqEvent ret = m_list.get( m_index );
if ( m_mode == VsqEventIteratorMode.All ) {
return ret;
} else if ( m_mode == VsqEventIteratorMode.Anote ) {
if ( ret.ID.type == VsqIDType.Anote ) {
return ret;
} else {
continue;
}
} else if ( m_mode == VsqEventIteratorMode.Singer ) {
if ( ret.ID.type == VsqIDType.Singer ) {
return ret;
} else {
continue;
}
}
}
return null;
}
public boolean hasNext() {
if ( m_mode == VsqEventIteratorMode.All ) {
return (m_index + 1 < m_list.size());
} else {
for ( int i = m_index; i < m_list.size(); i++ ) {
VsqEvent ret = m_list.get( i );
if ( m_mode == VsqEventIteratorMode.Anote ) {
if ( ret.ID.type == VsqIDType.Anote ) {
return true;
} else {
continue;
}
} else if ( m_mode == VsqEventIteratorMode.Singer ) {
if ( ret.ID.type == VsqIDType.Singer ) {
return true;
} else {
continue;
}
}
}
return false;
}
}
}

View File

@@ -0,0 +1,24 @@
/*
* VsqEventIterator.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
/**
*
* @author kbinani
*/
public enum VsqEventIteratorMode {
Anote,
Singer,
All,
}

View File

@@ -0,0 +1,97 @@
/*
* VsqEventList.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
import java.util.*;
/// <summary>
/// 固有ID付きのVsqEventのリストを取り扱う
/// </summary>
public class VsqEventList {
private Vector<VsqEvent> m_list;
private Vector<Integer> m_ids;
/// <summary>
/// コンストラクタ
/// </summary>
public VsqEventList() {
m_list = new Vector<VsqEvent>();
m_ids = new Vector<Integer>();
}
public VsqEventIterator iterator( VsqEventIteratorMode mode ) {
return new VsqEventIterator( m_list, mode );
}
public VsqEventIterator iterator(){
return iterator( VsqEventIteratorMode.All );
}
public void add( VsqEvent item ) {
int new_id = GetNextId( 0 );
item.InternalID = new_id;
m_list.add( item );
m_ids.add( new_id );
boolean changed = true;
while ( changed ) {
changed = false;
for ( int i = 0; i < m_list.size() - 1; i++ ) {
if ( m_list.get( i ).compareTo( m_list.get( i + 1 ) ) > 0 ) {
VsqEvent t = (VsqEvent)m_list.get( i ).clone();
m_list.set( i, m_list.get( i + 1 ) );
m_list.set( i + 1, t );
changed = true;
}
}
}
for ( int i = 0; i < m_list.size(); i++ ) {
m_ids.set( i, m_list.get( i ).InternalID );
}
}
public void removeAt( int index ) {
m_list.remove( index );
m_ids.remove( index );
}
private int GetNextId( int next ) {
int index = -1;
Vector<Integer> current = new Vector<Integer>( m_ids );
int nfound = 0;
while ( true ) {
index++;
if ( !current.contains( index ) ) {
nfound++;
if ( nfound == next + 1 ) {
return index;
} else {
current.add( index );
}
}
}
}
public int size() {
return m_list.size();
}
public VsqEvent get( int index ) {
return m_list.get( index );
}
public void set( int index, VsqEvent value ) {
m_list.add( index, value );
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,391 @@
/*
* VsqHandle.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
import java.io.*;
import java.text.*;
/// <summary>
/// ハンドルを取り扱います。ハンドルにはLyricHandle、VibratoHandleおよびIconHandleがある
/// </summary>
public class VsqHandle {
public VsqHandleType Type;
public int Index;
/*protected String m_icon_id;
protected String m_ids;
protected Lyric m_lyric;
protected int m_original;
protected String m_caption;
protected int m_length;
protected int m_start_depth;
protected int DepthBPNum;
protected float[] DepthBPX;
protected int[] DepthBPY;
protected int m_start_rate;
protected int RateBPNum;
protected float[] RateBPX;
protected int[] RateBPY;
protected int m_language;
protected int m_program;*/
public String IconID;
public String IDS;
public Lyric L0;
public int Original;
public String Caption;
public int Length;
public int StartDepth;
public int DepthBPNum;
public float[] DepthBPX;
public int[] DepthBPY;
public int StartRate;
public int RateBPNum;
public float[] RateBPX;
public int[] RateBPY;
public int Language;
public int Program;
public LyricHandle ConvertToLyricHandle() {
LyricHandle ret = new LyricHandle();
ret.L0 = (Lyric)L0.clone();
ret.Type = Type;//m_type;
ret.Index = Index;// m_index;
return ret;
}
public VibratoHandle ConvertToVibratoHandle() {
VibratoHandle ret = new VibratoHandle();
ret.Type = Type;
ret.Index = Index;
ret.Caption = Caption;
ret.DepthBPNum = DepthBPNum;
ret.DepthBPX = DepthBPX;
ret.DepthBPY = DepthBPY;
;
ret.IconID = IconID;
ret.IDS = IDS;
ret.Length = Length;
ret.Original = Original;
ret.RateBPNum = RateBPNum;
ret.RateBPX = RateBPX;
ret.RateBPY = RateBPY;
ret.StartDepth = StartDepth;
ret.StartRate = StartRate;
return ret;
}
public IconHandle ConvertToIconHandle() {
IconHandle ret = new IconHandle();
ret.Type = Type;
ret.Index = Index;
ret.Caption = Caption;
ret.IconID = IconID;
ret.IDS = IDS;
ret.Language = Language;
ret.Length = Length;
ret.Original = Original;
ret.Program = Program;
return ret;
}
/*public VsqHandleType Type {
get {
return m_type;
}
set {
m_type = value;
}
}
public int Index {
get {
return m_index;
}
set {
m_index = value;
}
}*/
/*// <summary>
/// このインスタンスの簡易コピーを取得します。
/// </summary>
/// <returns></returns>
public object Clone() {
VsqHandle result = new VsqHandle();
result.m_type = m_type;
result.m_index = m_index;
result.m_icon_id = m_icon_id;
result.IDS = this.IDS;
if ( this.L0 != null ) {
result.L0 = this.L0.Clone();
}
result.Original = this.Original;
result.Caption = this.Caption;
result.Length = this.Length;
result.StartDepth = this.StartDepth;
result.DepthBPNum = this.DepthBPNum;
if ( this.DepthBPX != null ) {
result.DepthBPX = (float[])this.DepthBPX.Clone();
}
if ( this.DepthBPY != null ) {
result.DepthBPY = (int[])this.DepthBPY.Clone();
}
result.StartRate = this.StartRate;
result.RateBPNum = this.RateBPNum;
if ( this.RateBPX != null ) {
result.RateBPX = (float[])this.RateBPX.Clone();
}
if ( this.RateBPY != null ) {
result.RateBPY = (int[])this.RateBPY.Clone();
}
result.Language = this.Language;
result.Program = this.Program;
return result;
}*/
public VsqHandle() {
}
/// <summary>
/// インスタンスをストリームに書き込みます。
/// encode=trueの場合、2バイト文字をエンコードして出力します。
/// </summary>
/// <param name="sw">書き込み対象</param>
/// <param name="encode">2バイト文字をエンコードするか否かを指定するフラグ</param>
public void write( TextMemoryStream sw, boolean encode ) {
sw.writeLine( this.toString( encode ) );
}
/// <summary>
/// FileStreamから読み込みながらコンストラクト
/// </summary>
/// <param name="sr">読み込み対象</param>
public VsqHandle( TextMemoryStream sr, int value, TextResult last_line ) {
this.Index = value;
String[] spl;
String[] spl2;
// default値で梅
this.Type = VsqHandleType.Vibrato;
IconID = "";
IDS = "normal";
L0 = new Lyric( "" );
Original = 0;
Caption = "";
Length = 0;
StartDepth = 0;
DepthBPNum = 0;
DepthBPX = null;
DepthBPY = null;
StartRate = 0;
RateBPNum = 0;
RateBPX = null;
RateBPY = null;
Language = 0;
Program = 0;
String tmpDepthBPX = "";
String tmpDepthBPY = "";
String tmpRateBPX = "";
String tmpRateBPY = "";
// "["にぶち当たるまで読込む
last_line.set( sr.readLine() );
while ( !last_line.get().startsWith( "[" ) ) {
spl = last_line.get().split( "=" );
if ( spl[0].equals( "Language" ) ) {
Language = Integer.parseInt( spl[1] );
} else if ( spl[0].endsWith( "Program" ) ) {
Program = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "IconID" ) ) {
IconID = spl[1];
} else if ( spl[0].equals( "IDS" ) ) {
IDS = spl[1];
} else if ( spl[0].equals( "Original" ) ) {
Original = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "Caption" ) ) {
Caption = spl[1];
for ( int i = 2; i < spl.length; i++ ) {
Caption += "=" + spl[i];
}
} else if ( spl[0].equals( "Length" ) ) {
Length = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "StartDepth" ) ) {
StartDepth = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "DepthBPNum" ) ) {
DepthBPNum = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "DepthBPX" ) ) {
tmpDepthBPX = spl[1];
} else if ( spl[0].equals( "DepthBPY" ) ) {
tmpDepthBPY = spl[1];
} else if ( spl[0].equals( "StartRate" ) ) {
StartRate = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "RateBPNum" ) ) {
RateBPNum = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "RateBPX" ) ) {
tmpRateBPX = spl[1];
} else if ( spl[0].equals( "RateBPY" ) ) {
tmpRateBPY = spl[1];
} else if ( spl[0].equals( "L0" ) ) {
Type = VsqHandleType.Lyric;
L0 = new Lyric( spl[1] );
}
if ( sr.peek() < 0 ) {
break;
}
last_line.set( sr.readLine() );
}
if ( IDS != "normal" ) {
Type = VsqHandleType.Singer;
} else if ( IconID != "" ) {
Type = VsqHandleType.Vibrato;
} else {
Type = VsqHandleType.Lyric;
}
// RateBPX, RateBPYの設定
if ( this.Type == VsqHandleType.Vibrato ) {
if ( RateBPNum > 0 ) {
RateBPX = new float[RateBPNum];
spl2 = tmpRateBPX.split( "," );
for ( int i = 0; i < RateBPNum; i++ ) {
RateBPX[i] = Float.parseFloat( spl2[i] );
}
RateBPY = new int[RateBPNum];
spl2 = tmpRateBPY.split( "," );
for ( int i = 0; i < RateBPNum; i++ ) {
RateBPY[i] = Integer.parseInt( spl2[i] );
}
} else {
RateBPX = null;
RateBPY = null;
}
// DepthBPX, DepthBPYの設定
if ( DepthBPNum > 0 ) {
DepthBPX = new float[DepthBPNum];
spl2 = tmpDepthBPX.split( "," );
for ( int i = 0; i < DepthBPNum; i++ ) {
DepthBPX[i] = Float.parseFloat( spl2[i] );
}
DepthBPY = new int[DepthBPNum];
spl2 = tmpDepthBPY.split( "," );
for ( int i = 0; i < DepthBPNum; i++ ) {
DepthBPY[i] = Integer.parseInt( spl2[i] );
}
} else {
DepthBPX = null;
DepthBPY = null;
}
}
}
/// <summary>
/// ハンドル指定子(例えば"h#0123"という文字列)からハンドル番号を取得します
/// </summary>
/// <param name="_String">ハンドル指定子</param>
/// <returns>ハンドル番号</returns>
public static int HandleIndexFromString( String _String ) {
String[] spl = _String.split( "#" );
return Integer.parseInt( spl[1] );
}
/// <summary>
/// インスタンスをテキストファイルに出力します
/// </summary>
/// <param name="sw">出力先</param>
public void Print( java.io.BufferedWriter sw ) throws IOException {
String result = this.toString();
sw.write( result + "\n" );
}
/// <summary>
/// インスタンスをコンソール画面に出力します
/// </summary>
private void Print() {
String result = this.toString();
System.out.println( result );
}
/// <summary>
/// インスタンスを文字列に変換します
/// </summary>
/// <param name="encode">2バイト文字をエンコードするか否かを指定するフラグ</param>
/// <returns>インスタンスを変換した文字列</returns>
public String toString( boolean encode ) {
String result = "";
result += "[h#" + (new DecimalFormat( "0000" )).format( Index ) + "]";
switch ( Type ) {
case Lyric:
result += "\nL0=" + L0.toString( encode );
break;
case Vibrato:
DecimalFormat df = new DecimalFormat( "0.000000" );
result += "\nIconID=" + IconID + "\n";
result += "IDS=" + IDS + "\n";
result += "Original=" + Original + "\n";
result += "Caption=" + Caption + "\n";
result += "Length=" + Length + "\n";
result += "StartDepth=" + StartDepth + "\n";
result += "DepthBPNum=" + DepthBPNum + "\n";
if ( DepthBPNum > 0 ) {
result += "DepthBPX=" + df.format( DepthBPX[0] );
for ( int i = 1; i < DepthBPNum; i++ ) {
result += "," + df.format( DepthBPX[i] );
}
result += "\n" + "DepthBPY=" + DepthBPY[0];
for ( int i = 1; i < DepthBPNum; i++ ) {
result += "," + DepthBPY[i];
}
result += "\n";
}
result += "StartRate=" + StartRate + "\n";
result += "RateBPNum=" + RateBPNum;
if ( RateBPNum > 0 ) {
result += "\n" + "RateBPX=" + df.format( RateBPX[0] );
for ( int i = 1; i < RateBPNum; i++ ) {
result += "," + df.format( RateBPX[i] );
}
result += "\n" + "RateBPY=" + RateBPY[0];
for ( int i = 1; i < RateBPNum; i++ ) {
result += "," + RateBPY[i];
}
}
break;
case Singer:
result += "\n" + "IconID=" + IconID + "\n";
result += "IDS=" + IDS + "\n";
result += "Original=" + Original + "\n";
result += "Caption=" + Caption + "\n";
result += "Length=" + Length + "\n";
result += "Language=" + Language + "\n";
result += "Program=" + Program;
break;
default:
break;
}
return result;
}
}

View File

@@ -0,0 +1,24 @@
/*
* VibratoHandleType.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
/**
*
* @author kbinani
*/
public enum VsqHandleType {
Lyric,
Vibrato,
Singer
}

View File

@@ -0,0 +1,209 @@
/*
* VsqID.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
import java.text.*;
/// <summary>
/// メタテキストに埋め込まれるIDを表すクラス。
/// </summary>
public class VsqID implements Cloneable {
public int value;
public VsqIDType type;
public int IconHandle_index;
public IconHandle IconHandle;
public int Length;
public int Note;
public int Dynamics;
public int PMBendDepth;
public int PMBendLength;
public int PMbPortamentoUse;
public int DEMdecGainRate;
public int DEMaccent;
public int LyricHandle_index;
public LyricHandle LyricHandle;
public int VibratoHandle_index;
public VibratoHandle VibratoHandle;
public int VibratoDelay;
public static VsqID EOS = new VsqID( -1 );
/// <summary>
/// このインスタンスの簡易コピーを取得します。
/// </summary>
/// <returns>このインスタンスの簡易コピー</returns>
public Object clone() {
VsqID result = new VsqID( this.value );
result.type = this.type;
if ( this.IconHandle != null ) {
result.IconHandle = (IconHandle)this.IconHandle.clone();
}
result.Length = this.Length;
result.Note = this.Note;
result.Dynamics = this.Dynamics;
result.PMBendDepth = this.PMBendDepth;
result.PMBendLength = this.PMBendLength;
result.PMbPortamentoUse = this.PMbPortamentoUse;
result.DEMdecGainRate = this.DEMdecGainRate;
result.DEMaccent = this.DEMaccent;
if ( this.LyricHandle != null ) {
result.LyricHandle = (LyricHandle)this.LyricHandle.clone();
}
if ( this.VibratoHandle != null ) {
result.VibratoHandle = (VibratoHandle)this.VibratoHandle.clone();
}
result.VibratoDelay = this.VibratoDelay;
return result;
}
/// <summary>
/// IDの番号ID#****の****)を指定したコンストラクタ。
/// </summary>
/// <param name="a_value">IDの番号</param>
public VsqID( int a_value ) {
value = a_value;
}
/// <summary>
/// テキストファイルからのコンストラクタ
/// </summary>
/// <param name="sr">読み込み対象</param>
/// <param name="value"></param>
/// <param name="last_line">読み込んだ最後の行が返されます</param>
public VsqID( TextMemoryStream sr, int value, TextResult last_line ) {
String[] spl;
this.value = value;
this.type = VsqIDType.Unknown;
this.IconHandle_index = -2;
this.LyricHandle_index = -1;
this.VibratoHandle_index = -1;
this.Length = 0;
this.Note = 0;
this.Dynamics = 0;
this.PMBendDepth = 0;
this.PMBendLength = 0;
this.PMbPortamentoUse = 0;
this.DEMdecGainRate = 0;
this.DEMaccent = 0;
//this.LyricHandle_index = -2;
//this.VibratoHandle_index = -2;
this.VibratoDelay = 0;
last_line.set( sr.readLine() );
while ( !last_line.get().startsWith( "[" ) ) {
spl = last_line.get().split( "=" );
if ( spl[0].equals( "Type" ) ) {
if ( spl[1].equals( "Anote" ) ) {
type = VsqIDType.Anote;
} else if ( spl[1].equals( "Singer" ) ) {
type = VsqIDType.Singer;
} else {
type = VsqIDType.Unknown;
}
} else if ( spl[0].equals( "Length" ) ) {
this.Length = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "Note#" ) ) {
this.Note = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "Dynamics" ) ) {
this.Dynamics = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "PMBendDepth" ) ) {
this.PMBendDepth = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "PMBendLength" ) ) {
this.PMBendLength = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "DEMdecGainRate" ) ) {
this.DEMdecGainRate = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "DEMaccent" ) ) {
this.DEMaccent = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "LyricHandle" ) ) {
this.LyricHandle_index = VsqHandle.HandleIndexFromString( spl[1] );
} else if ( spl[0].equals( "IconHandle" ) ) {
this.IconHandle_index = VsqHandle.HandleIndexFromString( spl[1] );
} else if ( spl[0].equals( "VibratoHandle" ) ) {
this.VibratoHandle_index = VsqHandle.HandleIndexFromString( spl[1] );
} else if ( spl[0].equals( "VibratoDelay" ) ) {
this.VibratoDelay = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "PMbPortamentoUse" ) ) {
PMbPortamentoUse = Integer.parseInt( spl[1] );
}
if ( sr.peek() < 0 ) {
break;
}
last_line.set( sr.readLine() );
}
}
public String toString() {
String ret = "{Type=" + type;
DecimalFormat df = new DecimalFormat( "0000" );
switch ( type ) {
case Anote:
ret += ", Length=" + Length;
ret += ", Note#=" + Note;
ret += ", Dynamics=" + Dynamics;
ret += ", PMBendDepth=" + PMBendDepth;
ret += ", PMBendLength=" + PMBendLength;
ret += ", PMbPortamentoUse=" + PMbPortamentoUse;
ret += ", DEMdecGainRate=" + DEMdecGainRate;
ret += ", DEMaccent=" + DEMaccent;
if ( LyricHandle != null ) {
ret += ", LyricHandle=h#" + df.format( LyricHandle_index );
}
if ( VibratoHandle != null ) {
ret += ", VibratoHandle=h#" + df.format( VibratoHandle_index );
ret += ", VibratoDelay=" + VibratoDelay;
}
break;
case Singer:
ret += ", IconHandle=h#" + df.format( IconHandle_index );
break;
}
ret += "}";
return ret;
}
/// <summary>
/// インスタンスをテキストファイルに出力します
/// </summary>
/// <param name="sw">出力先</param>
public void write( TextMemoryStream sw ) {
DecimalFormat df = new DecimalFormat( "0000" );
sw.writeLine( "[ID#" + df.format( value ) + "]" );
sw.writeLine( "Type=" + type );
switch ( type ) {
case Anote:
sw.writeLine( "Length=" + Length );
sw.writeLine( "Note#=" + Note );
sw.writeLine( "Dynamics=" + Dynamics );
sw.writeLine( "PMBendDepth=" + PMBendDepth );
sw.writeLine( "PMBendLength=" + PMBendLength );
sw.writeLine( "PMbPortamentoUse=" + PMbPortamentoUse );
sw.writeLine( "DEMdecGainRate=" + DEMdecGainRate );
sw.writeLine( "DEMaccent=" + DEMaccent );
if ( LyricHandle != null ) {
sw.writeLine( "LyricHandle=h#" + df.format( LyricHandle_index ) );
}
if ( VibratoHandle != null ) {
sw.writeLine( "VibratoHandle=h#" + df.format( VibratoHandle_index ) );
sw.writeLine( "VibratoDelay=" + VibratoDelay );
}
break;
case Singer:
sw.writeLine( "IconHandle=h#" + df.format( IconHandle_index ) );
break;
}
}
}

View File

@@ -0,0 +1,24 @@
/*
* VsqIDType.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
/**
*
* @author kbinani
*/
public enum VsqIDType {
Singer,
Anote,
Unknown
}

View File

@@ -0,0 +1,69 @@
/*
* VsqMaster.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
import java.io.*;
/**
*
* @author kbinani
*/
public class VsqMaster implements Cloneable {
public int PreMeasure;
public Object clone() {
VsqMaster res = new VsqMaster( PreMeasure );
return res;
}
/**
* プリメジャー値を指定したコンストラクタ
*/
public VsqMaster( int pre_measure ) {
this.PreMeasure = pre_measure;
}
/**
* テキストファイルからのコンストラクタ
* @param sr 読み込み元
* @param last_line 最後に読み込んだ行が返されます
* @throws java.lang.Exception
*/
public VsqMaster( TextMemoryStream sr, TextResult last_line ) {
PreMeasure = 0;
String[] spl;
last_line.set( sr.readLine() );
while ( !last_line.get().startsWith( "[" ) ) {
spl = last_line.get().split( "=" );
if ( spl[0].equals( "PreMeasure" ) ) {
this.PreMeasure = Integer.valueOf( spl[1] );
break;
}
if ( sr.peek() < 0 ) {
break;
}
last_line.set( sr.readLine() );
}
}
/**
* インスタンスの内容をテキストファイルに出力します
* @param sw出力先
*/
public void write( TextMemoryStream sw ){
sw.writeLine( "[Master]" );
sw.writeLine( "PreMeasure=" + PreMeasure );
}
}

View File

@@ -0,0 +1,911 @@
/*
* VsqMetaText.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
import java.util.*;
import java.text.*;
import java.awt.*;
/**
* vsqのメタテキストの中身を処理するためのクラス
* @author kbinani
*/
public class VsqMetaText implements Cloneable {
protected VsqCommon common;
protected VsqMaster master;
protected VsqMixer mixer;
//private List<VsqEvent> m_events;
private VsqEventList m_events;
//private List<VsqEvent> m_another_events;
/// <summary>
/// PIT。ピッチベンド。default=0
/// </summary>
private VsqBPList pitchBendBPList;
/// <summary>
/// PBS。ピッチベンドセンシティビティ。dfault=2
/// </summary>
private VsqBPList pitchBendSensBPList;
/// <summary>
/// DYN。ダイナミクス。default=64
/// </summary>
private VsqBPList dynamicsBPList;
/// <summary>
/// BRE。ブレシネス。default=0
/// </summary>
private VsqBPList epRResidualBPList;
/// <summary>
/// BRI。ブライトネス。default=64
/// </summary>
private VsqBPList epRESlopeBPList;
/// <summary>
/// CLE。クリアネス。default=0
/// </summary>
private VsqBPList epRESlopeDepthBPList;
private VsqBPList reso1FreqBPList;
private VsqBPList reso2FreqBPList;
private VsqBPList reso3FreqBPList;
private VsqBPList reso4FreqBPList;
private VsqBPList reso1BWBPList;
private VsqBPList reso2BWBPList;
private VsqBPList reso3BWBPList;
private VsqBPList reso4BWBPList;
private VsqBPList reso1AmpBPList;
private VsqBPList reso2AmpBPList;
private VsqBPList reso3AmpBPList;
private VsqBPList reso4AmpBPList;
/// <summary>
/// GEN。ジェンダーファクター。default=64
/// </summary>
private VsqBPList genderFactorBPList;
/// <summary>
/// POR。ポルタメントタイミング。default=64
/// </summary>
private VsqBPList portamentoTimingBPList;
/// <summary>
/// OPE。オープニング。default=127
/// </summary>
private VsqBPList openingBPList;
public Object clone() {
VsqMetaText res = new VsqMetaText();
if ( common != null ) {
res.common = (VsqCommon)common.clone();
}
if ( master != null ) {
res.master = (VsqMaster)master.clone();
}
if ( mixer != null ) {
res.mixer = (VsqMixer)mixer.clone();
}
if ( m_events != null ) {
res.m_events = new VsqEventList();// List<VsqEvent>();
for ( Iterator itr = m_events.iterator(); itr.hasNext();) {
VsqEvent item = (VsqEvent)itr.next();
res.m_events.add( (VsqEvent)item.clone() );
}
}
/*if ( m_another_events != null ) {
res.m_another_events = new List<VsqEvent>();
foreach ( VsqEvent item in m_another_events ) {
res.m_another_events.Add( (VsqEvent)item.clone() );
}
}*/
if ( pitchBendBPList != null ) {
res.pitchBendBPList = (VsqBPList)pitchBendBPList.clone();
}
if ( pitchBendSensBPList != null ) {
res.pitchBendSensBPList = (VsqBPList)pitchBendSensBPList.clone();
}
if ( dynamicsBPList != null ) {
res.dynamicsBPList = (VsqBPList)dynamicsBPList.clone();
}
if ( epRResidualBPList != null ) {
res.epRResidualBPList = (VsqBPList)epRResidualBPList.clone();
}
if ( epRESlopeBPList != null ) {
res.epRESlopeBPList = (VsqBPList)epRESlopeBPList.clone();
}
if ( epRESlopeDepthBPList != null ) {
res.epRESlopeDepthBPList = (VsqBPList)epRESlopeDepthBPList.clone();
}
if ( reso1FreqBPList != null ) {
res.reso1FreqBPList = (VsqBPList)reso1FreqBPList.clone();
}
if ( reso2FreqBPList != null ) {
res.reso2FreqBPList = (VsqBPList)reso2FreqBPList.clone();
}
if ( reso3FreqBPList != null ) {
res.reso3FreqBPList = (VsqBPList)reso3FreqBPList.clone();
}
if ( reso4FreqBPList != null ) {
res.reso4FreqBPList = (VsqBPList)reso4FreqBPList.clone();
}
if ( reso1BWBPList != null ) {
res.reso1BWBPList = (VsqBPList)reso1BWBPList.clone();
}
if ( reso2BWBPList != null ) {
res.reso2BWBPList = (VsqBPList)reso2BWBPList.clone();
}
if ( reso3BWBPList != null ) {
res.reso3BWBPList = (VsqBPList)reso3BWBPList.clone();
}
if ( reso4BWBPList != null ) {
res.reso4BWBPList = (VsqBPList)reso4BWBPList.clone();
}
if ( reso1AmpBPList != null ) {
res.reso1AmpBPList = (VsqBPList)reso1AmpBPList.clone();
}
if ( reso2AmpBPList != null ) {
res.reso2AmpBPList = (VsqBPList)reso2AmpBPList.clone();
}
if ( reso3AmpBPList != null ) {
res.reso3AmpBPList = (VsqBPList)reso3AmpBPList.clone();
}
if ( reso4AmpBPList != null ) {
res.reso4AmpBPList = (VsqBPList)reso4AmpBPList.clone();
}
if ( genderFactorBPList != null ) {
res.genderFactorBPList = (VsqBPList)genderFactorBPList.clone();
}
if ( portamentoTimingBPList != null ) {
res.portamentoTimingBPList = (VsqBPList)portamentoTimingBPList.clone();
}
if ( openingBPList != null ) {
res.openingBPList = (VsqBPList)openingBPList.clone();
}
return res;
}
// public List<VsqEvent> Events {
public VsqEventList getEventList() {
return m_events;
}
/*public List<VsqEvent> AnotherEvents {
get {
return m_another_events;
}
}*/
public VsqBPList getVsqBPList( VsqCurveType type ) {
switch ( type ) {
case BRE:
return this.epRResidualBPList;
case BRI:
return this.epRESlopeBPList;
case CLE:
return this.epRESlopeDepthBPList;
case DYN:
return this.dynamicsBPList;
case GEN:
return this.genderFactorBPList;
case OPE:
return this.openingBPList;
case PBS:
return this.pitchBendSensBPList;
case PIT:
return this.pitchBendBPList;
case POR:
return this.portamentoTimingBPList;
default:
return null;
}
}
public void setVsqBPList( VsqCurveType type, VsqBPList value ) {
switch ( type ) {
case BRE:
this.epRResidualBPList = value;
break;
case BRI:
this.epRESlopeBPList = value;
break;
case CLE:
this.epRESlopeDepthBPList = value;
break;
case DYN:
this.dynamicsBPList = value;
break;
case GEN:
this.genderFactorBPList = value;
break;
case OPE:
this.openingBPList = value;
break;
case PBS:
this.pitchBendSensBPList = value;
break;
case PIT:
this.pitchBendBPList = value;
break;
case POR:
this.portamentoTimingBPList = value;
break;
}
}
/*// <summary>
/// LyricEvents用に使用できる空きID番号を取得しますnext=0の時は次に利用可能なIDnext=1はnext=0として得られるIDを使用した後利用可能なIDetc..
/// </summary>
/// <returns></returns>
private int GetNextId_( int next ) {
int index = -1;
int count = m_events.Count;
boolean[] list = new boolean[count];
for ( int i = 0; i < count; i++ ) {
list[i] = false;
}
for ( int i = 0; i < count; i++ ) {
if ( 0 <= m_events[i].InternalID && m_events[i].InternalID < count ) {
list[i] = true;
}
}
int j = -1;
for ( int i = 0; i < count; i++ ) {
if ( !list[i] ) {
j++;
if ( j == next ) {
return i;
}
}
}
return count + next + 1;
}
private int GetNextId( int next ) {
int index = -1;
List<int> current = new List<int>();
for ( int i = 0; i < m_events.Count; i++ ) {
current.Add( m_events[i].InternalID );
}
int nfound = 0;
while ( true ) {
index++;
boolean found = false;
for ( int i = 0; i < current.Count; i++ ) {
if ( index == current[i] ) {
found = true;
break;
}
}
if ( !found ) {
nfound++;
if ( nfound == next + 1 ) {
return index;
} else {
current.Add( index );
}
}
}
}*/
/*// <summary>
/// AnotherEvents用に使用できる次の空きID番号を取得します
/// </summary>
/// <returns></returns>
public int GetNextIdForAnotherEvent( int next ) {
int index = -1;
List<int> current = new List<int>();
for ( int i = 0; i < m_another_events.Count; i++ ) {
current.Add( m_another_events[i].InternalID );
}
int nfound = 0;
while ( true ) {
index++;
boolean found = false;
for ( int i = 0; i < current.Count; i++ ) {
if ( index == current[i] ) {
found = true;
break;
}
}
if ( !found ) {
nfound++;
if ( nfound == next + 1 ) {
return index;
} else {
current.Add( index );
}
}
}
}*/
/// <summary>
/// Editor画面上で上からindex番目のカーブを表すBPListを求めます
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
/*public VsqBPList GetCurve(
int index ) {
switch ( index ) {
case 1:
return DYN;
case 2:
return BRE;
case 3:
return BRI;
case 4:
return CLE;
case 5:
return OPE;
case 6:
return GEN;
case 7:
return POR;
case 8:
return PIT;
case 9:
return PBS;
default:
return null;
}
}*/
/// <summary>
/// Editor画面上で上からindex番目のカーブの名前を調べます
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public static String getCurveName( int index ) {
switch ( index ) {
case 0:
return "VEL";
case 1:
return "DYN";
case 2:
return "BRE";
case 3:
return "BRI";
case 4:
return "CLE";
case 5:
return "OPE";
case 6:
return "GEN";
case 7:
return "POR";
case 8:
return "PIT";
case 9:
return "PBS";
default:
return "";
}
}
/// <summary>
/// Singerプロパティに指定されている
/// </summary>
public String getSinger() {
for ( Iterator itr = m_events.iterator(); itr.hasNext();) {
VsqEvent item = (VsqEvent)itr.next();
if ( item.ID.type == VsqIDType.Singer ) {
return item.ID.IconHandle.IDS;
}
}
return "";
}
public void setSinger( String value ) {
for ( Iterator itr = m_events.iterator(); itr.hasNext();) {
VsqEvent item = (VsqEvent)itr.next();
if ( item.ID.type == VsqIDType.Singer ) {
item.ID.IconHandle.IDS = value;
break;
}
}
}
/// <summary>
/// EOSイベントが記録されているクロックを取得します。
/// </summary>
/// <returns></returns>
public int getIndexOfEos() {
int result;
if ( m_events.size() > 0 ) {
int ilast = m_events.size() - 1;
result = m_events.get( ilast ).Clock;
} else {
result = -1;
}
return result;
}
/**
* このインスタンスから、IDとHandleのリストを構築します
*
*@param id
*@param handle
**/
private void buildIdHandleList( Vector<VsqID> id, Vector<VsqHandle> handle ) {
id = new Vector<VsqID>();
handle = new Vector<VsqHandle>();
int current_id = -1;
int current_handle = -1;
Vector<VsqEvent> events = new Vector<VsqEvent>();
for ( Iterator itr = m_events.iterator(); itr.hasNext();) {
VsqEvent item = (VsqEvent)itr.next();
events.add( item );
}
Collections.sort( events );
for ( int i = 0; i < events.size(); i++ ) {
VsqEvent item = events.get( i );
VsqID id_item = (VsqID)item.ID.clone();
current_id++;
item.ID.value = current_id;
id_item.value = current_id;
// IconHandle
if ( item.ID.IconHandle != null ) {
current_handle++;
VsqHandle handle_item = (VsqHandle)item.ID.IconHandle.clone();
handle_item.Index = current_handle;
handle.add( handle_item );
id_item.IconHandle_index = current_handle;
}
// LyricHandle
if ( item.ID.LyricHandle != null ) {
current_handle++;
VsqHandle handle_item = (VsqHandle)item.ID.LyricHandle.clone();
handle_item.Index = current_handle;
handle.add( handle_item );
id_item.LyricHandle_index = current_handle;
}
// VibratoHandle
if ( item.ID.VibratoHandle != null ) {
current_handle++;
VsqHandle handle_item = (VsqHandle)item.ID.VibratoHandle.clone();
handle_item.Index = current_handle;
handle.add( handle_item );
id_item.VibratoHandle_index = current_handle;
}
id.add( id_item );
}
}
/// <summary>
/// このインスタンスの内容を指定されたファイルに出力します。
/// </summary>
/// <param name="sw"></param>
/// <param name="encode"></param>
public void print( TextMemoryStream sw, boolean encode, long eos, int start ) {
//using ( StreamWriter sw = new StreamWriter( fpath ) ) {
if ( common != null ) {
common.write( sw );
}
if ( master != null ) {
master.write( sw );
}
if ( mixer != null ) {
mixer.write( sw );
}
Vector<VsqID> id = null;
Vector<VsqHandle> handle = null;
buildIdHandleList( id, handle );
writeEventList( sw, eos );
int i;
for ( i = 0; i < id.size(); i++ ) {
id.get( i ).write( sw );
}
for ( i = 0; i < handle.size(); i++ ) {
handle.get( i ).write( sw, encode );
}
if ( pitchBendBPList.size() > 0 ) {
pitchBendBPList.print( sw, start, "[PitchBendBPList]" );
}
if ( pitchBendSensBPList.size() > 0 ) {
pitchBendSensBPList.print( sw, start, "[PitchBendSensBPList]" );
}
if ( dynamicsBPList.size() > 0 ) {
dynamicsBPList.print( sw, start, "[DynamicsBPList]" );
}
if ( epRResidualBPList.size() > 0 ) {
epRResidualBPList.print( sw, start, "[EpRResidualBPList]" );
}
if ( epRESlopeBPList.size() > 0 ) {
epRESlopeBPList.print( sw, start, "[EpRESlopeBPList]" );
}
if ( epRESlopeDepthBPList.size() > 0 ) {
epRESlopeDepthBPList.print( sw, start, "[EpRESlopeDepthBPList]" );
}
if ( reso1FreqBPList.size() > 0 ) {
reso1FreqBPList.print( sw, start, "[Reso1FreqBPList]" );
}
if ( reso2FreqBPList.size() > 0 ) {
reso2FreqBPList.print( sw, start, "[Reso2FreqBPList]" );
}
if ( reso3FreqBPList.size() > 0 ) {
reso3FreqBPList.print( sw, start, "[Reso3FreqBPList]" );
}
if ( reso4FreqBPList.size() > 0 ) {
reso4FreqBPList.print( sw, start, "[Reso4FreqBPList]" );
}
if ( reso1BWBPList.size() > 0 ) {
reso1BWBPList.print( sw, start, "[Reso1BWBPList]" );
}
if ( reso2BWBPList.size() > 0 ) {
reso2BWBPList.print( sw, start, "[Reso2BWBPList]" );
}
if ( reso3BWBPList.size() > 0 ) {
reso3BWBPList.print( sw, start, "[Reso3BWBPList]" );
}
if ( reso4BWBPList.size() > 0 ) {
reso4BWBPList.print( sw, start, "[Reso4BWBPList]" );
}
if ( reso1AmpBPList.size() > 0 ) {
reso1AmpBPList.print( sw, start, "[Reso1AmpBPList]" );
}
if ( reso2AmpBPList.size() > 0 ) {
reso2AmpBPList.print( sw, start, "[Reso2AmpBPList]" );
}
if ( reso3AmpBPList.size() > 0 ) {
reso3AmpBPList.print( sw, start, "[Reso3AmpBPList]" );
}
if ( reso4AmpBPList.size() > 0 ) {
reso4AmpBPList.print( sw, start, "[Reso4AmpBPList]" );
}
if ( genderFactorBPList.size() > 0 ) {
genderFactorBPList.print( sw, start, "[GenderFactorBPList]" );
}
if ( portamentoTimingBPList.size() > 0 ) {
portamentoTimingBPList.print( sw, start, "[PortamentoTimingBPList]" );
}
if ( openingBPList.size() > 0 ) {
openingBPList.print( sw, start, "[OpeningBPList]" );
}
//}
}
private void writeEventList( TextMemoryStream sw, long eos ) {
sw.writeLine( "[EventList]" );
Vector<VsqEvent> temp = new Vector<VsqEvent>();
/*foreach ( VsqEvent item in m_another_events ) {
temp.Add( item );
}*/
for ( Iterator itr = m_events.iterator(); itr.hasNext();) {
temp.add( (VsqEvent)itr.next() );
}
Collections.sort( temp );
int i = 0;
DecimalFormat df = new DecimalFormat( "0000" );
while ( i < temp.size() ) {
VsqEvent item = temp.get( i );
if ( !item.ID.equals( VsqID.EOS ) ) {
String ids = "ID#" + df.format( i );
int clock = temp.get( i ).Clock;
while ( i + 1 < temp.size() && clock == temp.get( i + 1 ).Clock ) {
i++;
ids += ",ID#" + df.format( i );
}
sw.writeLine( clock + "=" + ids );
}
i++;
}
sw.writeLine( eos + "=EOS" );
}
/// <summary>
/// 何も無いVsqMetaTextを構築する。これは、Master Track用のMetaTextとしてのみ使用されるべき
/// </summary>
public VsqMetaText() {
}
/// <summary>
/// 最初のトラック以外の一般のメタテキストを構築。(Masterが作られない)
/// </summary>
public VsqMetaText( String name, String singer ) {
this( name, 0, singer, false );
}
/// <summary>
/// 最初のトラックのメタテキストを構築。(Masterが作られる)
/// </summary>
/// <param name="pre_measure"></param>
public VsqMetaText( String name, String singer, int pre_measure ) {
this( name, pre_measure, singer, true );
}
private VsqMetaText( String name, int pre_measure, String singer, boolean is_first_track ) {
common = new VsqCommon( name, new Color( 179, 181, 123 ), 1, 1 );
pitchBendBPList = new VsqBPList( 0, -8192, 8192 );
pitchBendBPList.add( 0, pitchBendBPList.getDefault() );
pitchBendSensBPList = new VsqBPList( 2, 0, 24 );
pitchBendSensBPList.add( 0, pitchBendSensBPList.getDefault() );
dynamicsBPList = new VsqBPList( 64, 0, 127 );
dynamicsBPList.add( 0, dynamicsBPList.getDefault() );
epRResidualBPList = new VsqBPList( 0, 0, 127 );
epRResidualBPList.add( 0, epRResidualBPList.getDefault() );
epRESlopeBPList = new VsqBPList( 64, 0, 127 );
epRESlopeBPList.add( 0, epRESlopeBPList.getDefault() );
epRESlopeDepthBPList = new VsqBPList( 0, 0, 127 );
epRESlopeDepthBPList.add( 0, epRESlopeDepthBPList.getDefault() );
reso1FreqBPList = new VsqBPList( 255, 0, 255 );
reso1FreqBPList.add( 0, reso1FreqBPList.getDefault() );
reso2FreqBPList = new VsqBPList( 255, 0, 255 );
reso2FreqBPList.add( 0, reso2FreqBPList.getDefault() );
reso3FreqBPList = new VsqBPList( 255, 0, 255 );
reso3FreqBPList.add( 0, reso3FreqBPList.getDefault() );
reso4FreqBPList = new VsqBPList( 255, 0, 255 );
reso4FreqBPList.add( 0, reso4FreqBPList.getDefault() );
reso1BWBPList = new VsqBPList( 255, 0, 255 );
reso1BWBPList.add( 0, reso1BWBPList.getDefault() );
reso2BWBPList = new VsqBPList( 255, 0, 255 );
reso2BWBPList.add( 0, reso2BWBPList.getDefault() );
reso3BWBPList = new VsqBPList( 255, 0, 255 );
reso3BWBPList.add( 0, reso3BWBPList.getDefault() );
reso4BWBPList = new VsqBPList( 255, 0, 255 );
reso4BWBPList.add( 0, reso4BWBPList.getDefault() );
reso1AmpBPList = new VsqBPList( 255, 0, 255 );
reso1AmpBPList.add( 0, reso1AmpBPList.getDefault() );
reso2AmpBPList = new VsqBPList( 255, 0, 255 );
reso2AmpBPList.add( 0, reso2AmpBPList.getDefault() );
reso3AmpBPList = new VsqBPList( 255, 0, 255 );
reso3AmpBPList.add( 0, reso3AmpBPList.getDefault() );
reso4AmpBPList = new VsqBPList( 255, 0, 255 );
reso4AmpBPList.add( 0, reso4AmpBPList.getDefault() );
genderFactorBPList = new VsqBPList( 64, 0, 127 );
genderFactorBPList.add( 0, genderFactorBPList.getDefault() );
portamentoTimingBPList = new VsqBPList( 64, 0, 127 );
portamentoTimingBPList.add( 0, portamentoTimingBPList.getDefault() );
openingBPList = new VsqBPList( 127, 0, 127 );
openingBPList.add( 0, openingBPList.getDefault() );
if ( is_first_track ) {
master = new VsqMaster( pre_measure );
} else {
master = null;
}
m_events = new VsqEventList();
//m_another_events = new List<VsqEvent>();
VsqID id = new VsqID( 0 );
id.type = VsqIDType.Singer;
id.IconHandle = new IconHandle();
id.IconHandle.Type = VsqHandleType.Singer;
id.IconHandle.IconID = "$07010000";
id.IconHandle.IDS = singer;
id.IconHandle.Original = 0;
id.IconHandle.Caption = "";
id.IconHandle.Length = 1;
id.IconHandle.Language = 0;
id.IconHandle.Program = 0;
m_events.add( new VsqEvent( 0, id ) );
}
public VsqMetaText( TextMemoryStream sr ) {
Vector<KeyValuePair<Integer, Integer>> t_event_list = new Vector<KeyValuePair<Integer, Integer>>();
//SortedDictionary<int, int> t_event_list = new SortedDictionary<int, int>();
TreeMap<Integer, VsqID> __id = new TreeMap<Integer, VsqID>();
TreeMap<Integer, VsqHandle> __handle = new TreeMap<Integer, VsqHandle>();
pitchBendBPList = new VsqBPList( 0, -8192, 8192 );
pitchBendSensBPList = new VsqBPList( 2, 0, 24 );
dynamicsBPList = new VsqBPList( 64, 0, 127 );
epRResidualBPList = new VsqBPList( 0, 0, 127 );
epRESlopeBPList = new VsqBPList( 64, 0, 127 );
epRESlopeDepthBPList = new VsqBPList( 0, 0, 127 );
reso1FreqBPList = new VsqBPList( 255, 0, 255 );
reso2FreqBPList = new VsqBPList( 255, 0, 255 );
reso3FreqBPList = new VsqBPList( 255, 0, 255 );
reso4FreqBPList = new VsqBPList( 255, 0, 255 );
reso1BWBPList = new VsqBPList( 255, 0, 255 );
reso2BWBPList = new VsqBPList( 255, 0, 255 );
reso3BWBPList = new VsqBPList( 255, 0, 255 );
reso4BWBPList = new VsqBPList( 255, 0, 255 );
reso1AmpBPList = new VsqBPList( 255, 0, 255 );
reso2AmpBPList = new VsqBPList( 255, 0, 255 );
reso3AmpBPList = new VsqBPList( 255, 0, 255 );
reso4AmpBPList = new VsqBPList( 255, 0, 255 );
genderFactorBPList = new VsqBPList( 64, 0, 127 );
portamentoTimingBPList = new VsqBPList( 64, 0, 127 );
openingBPList = new VsqBPList( 127, 0, 127 );
TextResult last_line = new TextResult( "" );
last_line.set( sr.readLine() );
while ( true ) {
if ( last_line.get().length() == 0 ) {
break;
}
if ( last_line.get().equals( "[Common]" ) ) {
common = new VsqCommon( sr, last_line );
} else if ( last_line.get().equals( "[Master]" ) ) {
master = new VsqMaster( sr, last_line );
} else if ( last_line.get().equals( "[Mixer]" ) ) {
mixer = new VsqMixer( sr, last_line );
} else if ( last_line.get().equals( "[EventList]" ) ) {
last_line.set( sr.readLine() );
while ( !last_line.get().startsWith( "[" ) ) {
String[] spl2 = last_line.get().split( "=" );
int clock = Integer.parseInt( spl2[0] );
int id_number = -1;
if ( spl2[1] != "EOS" ) {
String[] ids = spl2[1].split( "," );
for ( int i = 0; i < ids.length; i++ ) {
String[] spl3 = ids[i].split( "#" );
id_number = Integer.parseInt( spl3[1] );
t_event_list.add( new KeyValuePair<Integer, Integer>( clock, id_number ) );
}
} else {
t_event_list.add( new KeyValuePair<Integer, Integer>( clock, -1 ) );
}
if ( sr.peek() < 0 ) {
break;
} else {
last_line.set( sr.readLine() );
}
}
} else if ( last_line.get().equals( "[PitchBendBPList]" ) ) {
last_line.set( pitchBendBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[PitchBendSensBPList]" ) ) {
last_line.set( pitchBendSensBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[DynamicsBPList]" ) ) {
last_line.set( dynamicsBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[EpRResidualBPList]" ) ) {
last_line.set( epRResidualBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[EpRESlopeBPList]" ) ) {
last_line.set( epRESlopeBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[EpRESlopeDepthBPList]" ) ) {
last_line.set( epRESlopeDepthBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[Reso1FreqBPList]" ) ) {
last_line.set( reso1FreqBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[Reso2FreqBPList]" ) ) {
last_line.set( reso2FreqBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[Reso3FreqBPList]" ) ) {
last_line.set( reso3FreqBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[Reso4FreqBPList]" ) ) {
last_line.set( reso4FreqBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[Reso1BWBPList]" ) ) {
last_line.set( reso1BWBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[Reso2BWBPList]" ) ) {
last_line.set( reso2BWBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[Reso3BWBPList]" ) ) {
last_line.set( reso3BWBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[Reso4BWBPList]" ) ) {
last_line.set( reso4BWBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[Reso1AmpBPList]" ) ) {
last_line.set( reso1AmpBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[Reso2AmpBPList]" ) ) {
last_line.set( reso2AmpBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[Reso3AmpBPList]" ) ) {
last_line.set( reso3AmpBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[Reso4AmpBPList]" ) ) {
last_line.set( reso4AmpBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[GenderFactorBPList]" ) ) {
last_line.set( genderFactorBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[PortamentoTimingBPList]" ) ) {
last_line.set( portamentoTimingBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[OpeningBPList]" ) ) {
last_line.set( openingBPList.readFrom( sr ) );
} else {
String buffer = last_line.get();
buffer =
buffer.replace( "[", "" );
buffer =
buffer.replace( "]", "" );
String[] spl = buffer.split( "#" );
int index = Integer.parseInt( spl[1] );
if ( last_line.get().startsWith( "[ID#" ) ) {
__id.put( index, new VsqID( sr, index, last_line ) );
} else if ( last_line.get().startsWith( "[h#" ) ) {
__handle.put( index, new VsqHandle( sr, index, last_line ) );
}
}
if ( sr.peek() < 0 ) {
break;
}
}
// まずhandleをidに埋め込み
for ( int i = 0; i <
__id.size(); i++ ) {
if ( __handle.containsKey( __id.get( i ).IconHandle_index ) ) {
__id.get( i ).IconHandle = __handle.get( __id.get( i ).IconHandle_index ).ConvertToIconHandle();
}
if ( __handle.containsKey( __id.get( i ).LyricHandle_index ) ) {
__id.get( i ).LyricHandle = __handle.get( __id.get( i ).LyricHandle_index ).ConvertToLyricHandle();
}
if ( __handle.containsKey( __id.get( i ).VibratoHandle_index ) ) {
__id.get( i ).VibratoHandle = __handle.get( __id.get( i ).VibratoHandle_index ).ConvertToVibratoHandle();
}
}
// idをeventListに埋め込み
m_events = new VsqEventList();// List<VsqEvent>();
//m_another_events = new List<VsqEvent>();
for ( int i = 0; i < t_event_list.size(); i++ ) {
KeyValuePair<Integer, Integer> item = t_event_list.get( i );
int clock = item.Key;
int id_number = item.Value;
if ( __id.containsKey( id_number ) ) {
//if ( __id[id_number].type == VsqIDType.Anote ) {
m_events.add( new VsqEvent( clock, (VsqID)__id.get( id_number ).clone() ) );
//} else {
// m_another_events.Add( new VsqEvent( clock, (VsqID)__id[id_number].clone(), GetNextIdForAnotherEvent( 0 ) ) );
//}
}
}
}
}

View File

@@ -0,0 +1,219 @@
/*
* VsqMixer.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
import java.util.*;
/// <summary>
/// vsqファイルのメタテキストの[Mixer]セクションに記録される内容を取り扱う
/// </summary>
public class VsqMixer implements Cloneable {
//private int MasterFeder;
public int MasterFeder;
//private int MasterPanpot;
public int MasterPanpot;
//private int MasterMute;
public int MasterMute;
//private int OutputMode;
public int OutputMode;
//public int Tracks;
/// <summary>
/// vsqファイルの各トラックのfader, panpot, muteおよびoutputmode値を保持します
/// </summary>
public Vector<VsqMixerEntry> Slave = new Vector<VsqMixerEntry>();
/// <summary>
/// このインスタンスのSlave要素に保持されるアイテムの個数。vsqファイルの"トラック数 - 1"に等しい
/// </summary>
public int getTracks() {
return Slave.size();
}
/*public property Vector<VsqMixerEntry> Slave {
get {
return m_slave;
}
set {
m_slave = value;
}
};*/
/*public property int MasterFeder {
get {
return MasterFeder;
}
set {
MasterFeder = value;
}
};*/
/*public property int MasterPanpot {
get {
return MasterPanpot;
}
set {
MasterPanpot = value;
}
};*/
/*public property int MasterMute {
get {
return MasterMute;
}
set {
MasterMute = value;
}
};*/
/*public property int OutputMode {
get {
return MasterMute;
}
set {
MasterMute = value;
}
};*/
public Object clone() {
VsqMixer res = new VsqMixer( MasterFeder, MasterPanpot, MasterMute, OutputMode );
res.Slave = new Vector<VsqMixerEntry>();
//res.Tracks = Tracks;
for ( int i = 0; i < Slave.size(); i++ ) {
VsqMixerEntry item = Slave.get( i );
res.Slave.add( (VsqMixerEntry) item.clone() );
}
return res;
}
/// <summary>
/// 各パラメータを指定したコンストラクタ
/// </summary>
/// <param name="master_fader">MasterFader値</param>
/// <param name="master_panpot">MasterPanpot値</param>
/// <param name="master_mute">MasterMute値</param>
/// <param name="output_mode">OutputMode値</param>
public VsqMixer( int master_fader, int master_panpot, int master_mute, int output_mode ) {
this.MasterFeder = master_fader;
this.MasterMute = master_mute;
this.MasterPanpot = master_panpot;
this.OutputMode = output_mode;
Slave = new Vector<VsqMixerEntry>();
}
/// <summary>
/// テキストファイルからのコンストラクタ
/// </summary>
/// <param name="sr">読み込み対象</param>
/// <param name="last_line">最後に読み込んだ行が返されます</param>
public VsqMixer( TextMemoryStream sr, TextResult last_line ) {
MasterFeder = 0;
MasterPanpot = 0;
MasterMute = 0;
OutputMode = 0;
//Tracks = 1;
int tracks = 0;
String[] spl;
String buffer = "";
last_line.set( sr.readLine() );
while ( !last_line.get().startsWith( "[" ) ) {
spl = last_line.get().split( "=" );
if ( spl[0].equals( "MasterFeder" ) ) {
MasterFeder = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "MasterPanpot" ) ) {
MasterPanpot = Integer.parseInt(
spl[1] );
} else if ( spl[0].equals( "MasterMute" ) ) {
MasterMute = Integer.parseInt(
spl[1] );
} else if ( spl[0].equals( "OutputMode" ) ) {
OutputMode = Integer.parseInt(
spl[1] );
} else if ( spl[0].equals( "Tracks" ) ) {
tracks = Integer.parseInt(
spl[1] );
} else {
if ( spl[0].startsWith( "Feder" ) ||
spl[0].startsWith( "Panpot" ) ||
spl[0].startsWith( "Mute" ) ||
spl[0].startsWith( "Solo" ) ) {
buffer += spl[0] + "=" + spl[1] + "\n";
}
}
if ( sr.peek() < 0 ) {
break;
}
last_line.set( sr.readLine() );
}
Slave = new Vector<VsqMixerEntry>();
for ( int i = 0; i < tracks; i++ ) {
Slave.add( new VsqMixerEntry( 0, 0, 0, 0 ) );
}
spl = buffer.split( "\n" );
String[] spl2;
for ( int i = 0; i < spl.length; i++ ) {
String ind = "";
int index;
spl2 = spl[i].split( "=" );
if ( spl2[0].startsWith( "Feder" ) ) {
ind = spl2[0].replace( "Feder", "" );
index = Integer.parseInt(
ind );
Slave.get( index ).Feder = Integer.parseInt(
spl2[1] );
} else if ( spl2[0].startsWith( "Panpot" ) ) {
ind = spl2[0].replace( "Panpot", "" );
index = Integer.parseInt(
ind );
Slave.get( index ).Panpot = Integer.parseInt(
spl2[1] );
} else if ( spl2[0].startsWith( "Mute" ) ) {
ind = spl2[0].replace( "Mute", "" );
index = Integer.parseInt(
ind );
Slave.get( index ).Mute = Integer.parseInt(
spl2[1] );
} else if ( spl2[0].startsWith( "Solo" ) ) {
ind = spl2[0].replace( "Solo", "" );
index = Integer.parseInt(
ind );
Slave.get( index ).Solo = Integer.parseInt(
spl2[1] );
}
}
}
/// <summary>
/// このインスタンスをテキストファイルに出力します
/// </summary>
/// <param name="sw">出力対象</param>
public void write( TextMemoryStream sw ) {
sw.writeLine( "[Mixer]" );
sw.writeLine( "MasterFeder=" + MasterFeder );
sw.writeLine( "MasterPanpot=" + MasterPanpot );
sw.writeLine( "MasterMute=" + MasterMute );
sw.writeLine( "OutputMode=" + OutputMode );
sw.writeLine( "Tracks=" + getTracks() );
for ( int i = 0; i < Slave.size(); i++ ) {
sw.writeLine( "Feder" + i + "=" + Slave.get( i ).Feder );
sw.writeLine( "Panpot" + i + "=" + Slave.get( i ).Panpot );
sw.writeLine( "Mute" + i + "=" + Slave.get( i ).Mute );
sw.writeLine( "Solo" + i + "=" + Slave.get( i ).Solo );
}
}
}

View File

@@ -0,0 +1,40 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package jp.sourceforge.lipsync.vsq;
/**
*
* @author kbinani
*/
/// <summary>
/// VsqMixerのSlave要素に格納される各エントリ
/// </summary>
public class VsqMixerEntry implements Cloneable {
public int Feder;
public int Panpot;
public int Mute;
public int Solo;
public Object clone() {
VsqMixerEntry res = new VsqMixerEntry( Feder, Panpot, Mute, Solo );
return res;
}
/// <summary>
/// 各パラメータを指定したコンストラクタ
/// </summary>
/// <param name="feder">Feder値</param>
/// <param name="panpot">Panpot値</param>
/// <param name="mute">Mute値</param>
/// <param name="solo">Solo値</param>
public VsqMixerEntry( int feder, int panpot, int mute, int solo ) {
this.Feder = feder;
this.Panpot = panpot;
this.Mute = mute;
this.Solo = solo;
}
}

View File

@@ -0,0 +1,239 @@
/*
* VsqMixer.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
/// <summary>
/// 音階を表現するためのクラス
/// </summary>
public class VsqNote {
int _note;
private static final boolean[] _KEY_TYPE = new boolean[]{
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
true,
false,
true,
};
/// <summary>
/// 音階のノート値からのコンストラクタ。
/// </summary>
/// <param name="note">この音階を初期化するためのノート値</param>
public VsqNote( int note ) {
_note = note;
}
/*// <summary>
/// このインスタンスが表す音階のノート値
/// </summary>
public property int Value {
get {
return _note;
}
set {
_note = value;
}
}*/
/// <summary>
/// このインスタンスが表す音階が、ピアノの白鍵かどうかを返します
/// </summary>
public boolean getIsWhiteKey() {
return NoteIsWhiteKey( _note );
}
/// <summary>
/// 指定した音階が、ピアノの白鍵かどうかを返します
/// </summary>
/// <param name="note"></param>
/// <returns></returns>
public static boolean NoteIsWhiteKey( int note ) {
if ( 0 <= note && note <= 127 ) {
return _KEY_TYPE[note];
} else {
int odd = note % 12;
switch ( odd ) {
case 1:
case 3:
case 6:
case 8:
case 10:
return false;
default:
return true;
}
}
}
public static String NoteToString( int note ) {
int odd = note % 12;
int order = (note - odd) / 12 - 2;
switch ( odd ) {
case 0:
return "C" + order;
case 1:
return "C#" + order;
case 2:
return "D" + order;
case 3:
return "Eb" + order;
case 4:
return "E" + order;
case 5:
return "F" + order;
case 6:
return "F#" + order;
case 7:
return "G" + order;
case 8:
return "G#" + order;
case 9:
return "A" + order;
case 10:
return "Bb" + order;
case 11:
return "B" + order;
default:
return "";
}
}
public String toString() {
return NoteToString( _note );
}
}

View File

@@ -0,0 +1,143 @@
/*
* VsqMixer.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
import java.util.*;
public class VsqNrpn implements Comparable<VsqNrpn> {
/**
* <pre>
* public property int Clock {
* get {
* return m_clock;
* }
* set {
* m_clock = value;
* }
*};</pre>
*/
public int Clock;
private int m_nrpn;
private byte m_datamsb;
private byte m_datalsb;
private boolean m_datalsb_specified = false;
private Vector<VsqNrpn> m_list;
public VsqNrpn( int clock, int nrpn, byte data_msb ) {
Clock = clock;
m_nrpn = nrpn;
m_datamsb = data_msb;
m_datalsb_specified = false;
m_list = new Vector<VsqNrpn>();
}
public VsqNrpn( int clock, int nrpn, byte data_msb, byte data_lsb ) {
Clock = clock;
m_nrpn = nrpn;
m_datamsb = data_msb;
m_datalsb = data_lsb;
m_datalsb_specified = true;
m_list = new Vector<VsqNrpn>();
}
private VsqNrpn() {
}
public VsqNrpn[] expand() {
Vector<VsqNrpn> ret = new Vector<VsqNrpn>();
if ( m_datalsb_specified ) {
ret.add( new VsqNrpn( Clock, m_nrpn, m_datamsb, m_datalsb ) );
} else {
ret.add( new VsqNrpn( Clock, m_nrpn, m_datamsb ) );
}
for ( int i = 0; i < m_list.size(); i++ ) {
VsqNrpn item = m_list.get( i );
if ( item.m_datalsb_specified ) {
ret.add( new VsqNrpn( item.Clock, item.m_nrpn, item.m_datamsb, item.m_datalsb ) );
} else {
ret.add( new VsqNrpn( item.Clock, item.m_nrpn, item.m_datamsb ) );
}
}
return ret.toArray( new VsqNrpn[0] );
}
public static VsqNrpn[] merge( VsqNrpn[] src1, VsqNrpn[] src2 ) {
Vector<VsqNrpn> ret = new Vector<VsqNrpn>();
for ( int i = 0; i < src1.length; i++ ) {
ret.add( src1[i] );
}
for ( int i = 0; i < src2.length; i++ ) {
ret.add( src2[i] );
}
Collections.sort( ret );
return ret.toArray( new VsqNrpn[0] );
}
public static NrpnData[] convert( VsqNrpn[] source ) {
int nrpn = source[0].getNrpn();
byte msb = (byte)(nrpn >> 8);
byte lsb = (byte)(nrpn - (nrpn << 8));
Vector<NrpnData> ret = new Vector<NrpnData>();
ret.add( new NrpnData( source[0].Clock, (byte)0x63, msb ) );
ret.add( new NrpnData( source[0].Clock, (byte)0x62, lsb ) );
ret.add( new NrpnData( source[0].Clock, (byte)0x06, source[0].getDataMsb() ) );
if ( source[0].getDataLsbSpecified() ) {
ret.add( new NrpnData( source[0].Clock, (byte)0x26, source[0].getDataLsb() ) );
}
for ( int i = 1; i < source.length; i++ ) {
int tnrpn = source[i].getNrpn();
byte tmsb = (byte)(tnrpn >> 8);
byte tlsb = (byte)(tnrpn - (tnrpn << 8));
if ( tmsb != msb ) {
ret.add( new NrpnData( source[i].Clock, (byte)0x63, tmsb ) );
msb = tmsb;
}
ret.add( new NrpnData( source[i].Clock, (byte)0x62, tlsb ) );
ret.add( new NrpnData( source[i].Clock, (byte)0x06, source[i].getDataMsb() ) );
if ( source[i].getDataLsbSpecified() ) {
ret.add( new NrpnData( source[i].Clock, (byte)0x26, source[i].getDataLsb() ) );
}
}
return ret.toArray( new NrpnData[0] );
}
public int compareTo( VsqNrpn item ) {
return Clock - item.Clock;
}
public void append( int nrpn, byte data_msb ) {
m_list.add( new VsqNrpn( Clock, nrpn, data_msb ) );
}
public void append( int nrpn, byte data_msb, byte data_lsb ) {
m_list.add( new VsqNrpn( Clock, nrpn, data_msb, data_lsb ) );
}
public int getNrpn() {
return m_nrpn;
}
public byte getDataMsb() {
return m_datamsb;
}
public byte getDataLsb() {
return m_datalsb;
}
private boolean getDataLsbSpecified() {
return m_datalsb_specified;
}
}

View File

@@ -0,0 +1,146 @@
/*
* VsqPhoneticSymbol.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
public class VsqPhoneticSymbol {
private static final String[] _SYMBOL_VOWEL_JP = new String[] {
"a",
"i",
"M",
"e",
"o",
};
private static String[] _SYMBOL_CONSONANT_JP = new String[] {
"k",
"k'",
"g",
"g'",
"N",
"N'",
"s",
"S",
"z",
"Z",
"dz",
"dZ",
"t",
"t'",
"ts",
"tS",
"d",
"d'",
"n",
"J",
"h",
"h\\",
"C",
"p\\",
"p\\'",
"b",
"b'",
"p",
"p'",
"m",
"m'",
"j",
"4",
"4'",
"w",
"N\\",
};
private static String[] _SYMBOL_EN = new String[] {
"@",
"V",
"e",
"e",
"I",
"i:",
"{",
"O:",
"Q",
"U",
"u:",
"@r",
"eI",
"aI",
"OI",
"@U",
"aU",
"I@",
"e@",
"U@",
"O@",
"Q@",
"w",
"j",
"b",
"d",
"g",
"bh",
"dh",
"gh",
"dZ",
"v",
"D",
"z",
"Z",
"m",
"n",
"N",
"r",
"l",
"l0",
"p",
"t",
"k",
"ph",
"th",
"kh",
"tS",
"f",
"T",
"s",
"S",
"h",
};
public static boolean IsConsonant( String symbol ) {
for ( int i = 0; i < _SYMBOL_CONSONANT_JP.length; i++ ) {
if ( _SYMBOL_CONSONANT_JP[i].equals( symbol ) ) {
return true;
}
}
return false;
}
public static boolean IsValidSymbol( String symbol ) {
for ( int i = 0; i < _SYMBOL_VOWEL_JP.length; i++ ) {
if ( _SYMBOL_VOWEL_JP[i].equals( symbol ) ) {
return true;
}
}
for ( int i = 0; i < _SYMBOL_CONSONANT_JP.length; i++ ) {
if ( _SYMBOL_CONSONANT_JP[i].equals( symbol ) ) {
return true;
}
}
for ( int i = 0; i < _SYMBOL_EN.length; i++ ) {
if ( _SYMBOL_EN[i].equals( symbol ) ) {
return true;
}
}
return false;
}
}

View File

@@ -0,0 +1,307 @@
/*
* VsqTrack.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
import java.util.*;
import java.io.*;
public class VsqTrack implements Cloneable {
private String m_name;
private VsqMetaText m_meta_text;
private Vector<MidiEvent> m_midi_event;
private int m_edited_start = Integer.MAX_VALUE;
private int m_edited_end = Integer.MIN_VALUE;
public VsqEventIterator singerEventEnumerator() {
return m_meta_text.getEventList().iterator( VsqEventIteratorMode.Singer );
}
public VsqEventIterator noteEventEnumerator() {
return m_meta_text.getEventList().iterator( VsqEventIteratorMode.Anote );
}
public void printMetaText( TextMemoryStream sw, boolean encode, long eos, int start ) {
m_meta_text.print( sw, encode, eos, start );
}
public void printMetaText( String file ) throws IOException {
TextMemoryStream tms = new TextMemoryStream();
int count = m_meta_text.getEventList().size();
int clLast = m_meta_text.getEventList().get( count - 1 ).Clock + 480;
m_meta_text.print( tms, true, (long)clLast, 0 );
BufferedWriter sw = new BufferedWriter( new FileWriter( file ) );
tms.rewind();
while ( tms.peek() >= 0 ) {
String line = tms.readLine();
sw.write( line + "\n" );
}
}
/**
* for future implement:<pre>
*property VsqMaster Master {
* public get {
* return m_meta_text.master;
* }
* protected set {
* m_meta_text.master = value;
* }
*};</pre>
* @return
*/
public VsqMaster getMaster() {
return m_meta_text.master;
}
protected void setMaster( VsqMaster value ) {
m_meta_text.master = value;
}
/**
* for future implement:<pre>
*property VsqMixer Mixer {
* public get {
* return m_meta_text.mixer;
* }
* protected set {
* m_meta_text.mixer = value;
* }
*};</pre>
* @return
*/
public VsqMixer getMixer() {
return m_meta_text.mixer;
}
protected void setMixer( VsqMixer value ) {
m_meta_text.mixer = value;
}
public VsqBPList getVsqBPList( VsqCurveType curveType ) {
return m_meta_text.getVsqBPList( curveType );
}
public void setVsqBPList( VsqCurveType curveType, VsqBPList value ) {
m_meta_text.setVsqBPList( curveType, value );
}
public VsqEventList getEvents() {
return m_meta_text.getEventList();
}
/**
* for future implement:<pre>
* property int EditedStart {
* public get {
* return m_edited_start;
* }
* protected set {
* if ( value &lt; m_edited_start ) {
* m_edited_start = value;
* }
* }
* };</pre>
*/
public int getEditedStart(){
return m_edited_start;
}
protected void setEditedStart( int value ){
m_edited_start = value;
}
public int getEditedEnd() {
return m_edited_end;
}
protected void setEditedEnd( int value ) {
if ( m_edited_end < value ) {
m_edited_end = value;
}
}
public void resetEditedArea() {
m_edited_start = Integer.MAX_VALUE;
m_edited_end = Integer.MIN_VALUE;
}
public Object clone() {
VsqTrack res = new VsqTrack();
res.m_name = m_name;
if ( m_meta_text != null ) {
res.m_meta_text = (VsqMetaText)m_meta_text.clone();
}
if ( m_midi_event != null ) {
res.m_midi_event = new Vector<MidiEvent>();
for ( int i = 0; i < m_midi_event.size(); i++ ) {
MidiEvent item = m_midi_event.get( i );
res.m_midi_event.add( (MidiEvent)item.clone() );
}
}
res.m_edited_start = m_edited_start;
res.m_edited_end = m_edited_end;
return res;
}
private VsqTrack() {
}
/**
* Master Trackを構築
* @param tempo
* @param numerator
* @param denominator
*/
public VsqTrack( int tempo, int numerator, int denominator ) {
this.m_name = "Master Track";
this.m_meta_text = null;
this.m_midi_event = new Vector<MidiEvent>();
this.m_midi_event.add( new MidiEvent( "0 Tempo " + tempo ) );
this.m_midi_event.add( new MidiEvent( "0 TimeSig " + numerator + "/" + denominator + " 24 8" ) );
}
/**
* Master Trackでないトラックを構築。
* @param name
* @param singer
*/
public VsqTrack( String name, String singer ) {
m_name = name;
m_meta_text = new VsqMetaText( name, singer );
m_midi_event = new Vector<MidiEvent>();
}
/**
*
* メタテキスト。
* private property VsqMetaText MetaText {
* get {
* return m_meta_text;
* }
* };
*/
protected VsqMetaText getVsqMetaText() {
return m_meta_text;
}
/**
* トラックの名前。
* public property String Name {
* get {
* return m_name;
* }
* set {
* m_name = value;
* }
* };
*/
public String getName() {
return m_name;
}
public void setName( String value ) {
m_name = value;
}
/**
* 歌詞の文字数を調べます
* @returns
*/
public int getLyricLength() {
int counter = 0;
VsqEventList list = m_meta_text.getEventList();
for ( int i = 0; i < list.size(); i++ ) {
if ( list.get( i ).ID.type == VsqIDType.Anote ) {
counter++;
}
}
return counter;
}
/**
* vsqファイルをmf2t形式にテキスト化されたファイルからコンストラクト。
* @param lines
*/
public VsqTrack( Vector<String> lines ) throws IOException {
m_midi_event = new Vector<MidiEvent>();
m_name = "";
String meta_text_path;
File temp_file = File.createTempFile( "temp", ".bin" );
meta_text_path = temp_file.getPath();
TextMemoryStream sw = new TextMemoryStream();
int signal;
for ( int j = 0; j < lines.size(); j++ ) {
String s = lines.get( j );
String line = s;
// signalを取得
int index = line.indexOf( ' ' );
String str_signal = line.substring( 0, index );
signal = Integer.parseInt( str_signal );
String remain = line.substring( index + 1 );
// イベントの種類で処理を分岐
String[] spl = remain.split( " " );
if ( spl[0] == "Meta" && spl[1] == "Text" ) {
line = line.replace( signal + " Meta Text \"", "" );
int second_colon = line.indexOf( ":", 3 );
line = line.substring( second_colon + 1 );
line = line.substring( 0, line.length() - 1 );
line = line.replace( "\\n", "\n" );
sw.write( line );
} else if ( spl[0] == "Meta" && (spl[1] == "TrkName" || spl[1] == "SeqName") ) {
m_name = spl[2];
for ( int i = 3; i < spl.length; i++ ) {
m_name += " " + spl[i];
}
m_name = m_name.replace( "\"", "" );
m_name = Lyric.decode( m_name );
} else {
m_midi_event.add( new MidiEvent( line ) );
}
}
sw.rewind();
m_meta_text = new VsqMetaText( sw );
temp_file.delete();
}
/**
* MidiEventの中からテンポ情報を抽出します
* @returns
*/
public Vector<MidiEvent> getTempoList() {
Vector<MidiEvent> list = new Vector<MidiEvent>();
for ( int i = 0; i < m_midi_event.size(); i++ ) {
if ( m_midi_event.get( i ).type == MidiEventType.tempo ) {
list.add( m_midi_event.get( i ) );
}
}
Collections.sort( list );
return list;
}
/**
* MidiEventの中から拍子情報を抽出します
* @returns
*/
public Vector<MidiEvent> getTimeSigList() {
Vector<MidiEvent> list = new Vector<MidiEvent>();
for ( int i = 0; i < m_midi_event.size(); i++ ) {
if ( m_midi_event.get( i ).type == MidiEventType.time_signal ) {
list.add( m_midi_event.get( i ) );
}
}
Collections.sort( list );
return list;
}
}

View File

@@ -0,0 +1,326 @@
/*
* VsqUtil.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
import java.util.*;
/// <summary>
/// コンピュータにインストールされたVOCALOID2システムについての情報を取得するためのスタティック・ライブラリ。
/// </summary>
public class VsqUtil {
/// <summary>
/// VOCALOIDシステムの仕様上設定可能な歌手の最大数
/// </summary>
public final int MAX_SINGERS = 0x4000;
private static String s_dll_path = "";
private static boolean s_dll_path_done = false;
private static String s_exp_db_dir = "";
private static boolean s_exp_db_dir_done = false;
private static Dictionary<int, SingerConfig> s_singer_configs = null;
private static Vector<SingerConfig> s_installed_singers = new Vector<SingerConfig>();
/// <summary>
/// 指定したプログラムチェンジが担当する歌手の歌唱言語を表すインデクスを取得します
/// </summary>
/// <param name="program_change"></param>
/// <returns></returns>
public static VsqVoiceLanguage GetLanguage( int program_change ) {
String name = GetOriginalSinger( program_change );
switch ( name ) {
case "Miku":
case "Rin":
case "Len":
case "Rin_ACT2":
case "Len_ACT2":
case "Gackpoid":
return VsqVoiceLanguage.Japanese;
}
return VsqVoiceLanguage.Default;
}
/// <summary>
/// 指定したプログラムチェンジが担当する歌手の、オリジナルの歌手名を取得します。
/// </summary>
/// <param name="program_change"></param>
/// <returns></returns>
public static String GetOriginalSinger( int program_change ) {
if ( s_singer_configs == null ) {
LoadSingerConfigs();
}
if ( s_singer_configs.ContainsKey( program_change ) ) {
SingerConfig sc = GetSingerInfo( program_change );
String voiceidstr = sc.VOICEIDSTR;
foreach ( SingerConfig installed in s_installed_singers ) {
if ( installed.VOICEIDSTR == voiceidstr ) {
return installed.VOICENAME;
}
}
}
return "";
}
/// <summary>
/// 指定したプログラムチェンジが担当する歌手の情報を、VsqIDに変換した物を取得します
/// </summary>
/// <param name="program_change"></param>
/// <returns></returns>
public static VsqID GetSingerID( int program_change ) {
VsqID ret = new VsqID( 0 );
ret.type = VsqIDType.Singer;
SingerConfig sc = GetSingerInfo( program_change );
int language = 0;
foreach ( SingerConfig sc2 in s_installed_singers ) {
if ( sc.VOICEIDSTR == sc2.VOICEIDSTR ) {
switch ( sc2.VOICENAME ) {
case "Miku":
language = 0;
break;
}
}
}
ret.IconHandle = new IconHandle();
ret.IconHandle.IconID = "$0701" + program_change.ToString( "0000" );
ret.IconHandle.IDS = sc.VOICENAME;
ret.IconHandle.Index = 0;
ret.IconHandle.Language = language;
ret.IconHandle.Length = 1;
ret.IconHandle.Original = sc.Original;
ret.IconHandle.Program = program_change;
ret.IconHandle.Type = VsqHandleType.Singer;
ret.IconHandle.Caption = "";
return ret;
}
/// <summary>
/// 指定したプログラムチェンジの歌手情報を取得します。
/// </summary>
/// <param name="program_change"></param>
/// <returns></returns>
public static SingerConfig GetSingerInfo( int program_change ) {
if ( s_singer_configs == null ) {
LoadSingerConfigs();
}
if ( s_singer_configs.ContainsKey( program_change ) ) {
return s_singer_configs[program_change];
} else {
return null;
}
}
/// <summary>
/// 歌手設定を読み込む。GetSingerInfo, GetSingerIDが最初に呼ばれた時に自動的に呼び出されるが、明示的に呼び出しても良い。
/// </summary>
public static void LoadSingerConfigs() {
if ( s_singer_configs == null ) {
LoadSingerConfigs( GetExpDbPath() );
}
}
/// <summary>
/// SingerEditorによって設定された歌手のリストを取得するリストのキーは「プログラムチェンジ」の値に対応する
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
private static void LoadSingerConfigs( String path ) {
s_singer_configs = new Dictionary<int, SingerConfig>();
String map_file = Path.Combine( path, "voice.map" );
if ( !File.Exists( map_file ) ) {
return;
}
using ( FileStream fs = new FileStream( map_file, FileMode.Open, FileAccess.Read ) ) {
byte[] dat = new byte[8];
fs.Seek( 0x20, SeekOrigin.Begin );
for ( int i = 0; i < MAX_SINGERS; i++ ) {
fs.Read( dat, 0, 8 );
ulong value = makelong_le( dat );
if ( value >= 1 ) {
#if DEBUG
Console.WriteLine( " value=" + value );
#endif
String file = Path.Combine( path, "vvoice" + value + ".vvd" );
if ( File.Exists( file ) ) {
s_singer_configs.Add( i, new SingerConfig( file, (int)(value - 1) ) );
}
}
}
}
Vector<String> voiceidstrs = new Vector<String>();
foreach ( SingerConfig sc in s_singer_configs.Values ) {
if ( !voiceidstrs.Contains( sc.VOICEIDSTR ) ) {
voiceidstrs.Add( sc.VOICEIDSTR );
}
}
foreach ( String s in voiceidstrs ) {
String dir = Path.Combine( path, s );
String[] files = Directory.GetFiles( dir, "*.vvd" );
foreach ( String s2 in files ) {
String file = Path.Combine( dir, s2 );
if ( File.Exists( file ) ) {
s_installed_singers.Add( new SingerConfig( file, -1 ) );
}
}
}
}
/// <summary>
/// 長さ8のバイト列をリトルエンディアンとみなし、unsigned longに変換します
/// </summary>
/// <param name="oct"></param>
/// <returns></returns>
private static long makelong_le( byte[] oct ) {
return (ulong)oct[7] << 56 | (ulong)oct[6] << 48 | (ulong)oct[5] << 40 | (ulong)oct[4] << 32 | (ulong)oct[3] << 24 | (ulong)oct[2] << 16 | (ulong)oct[1] << 8 | (ulong)oct[0];
}
/// <summary>
/// VOCALOID2 VSTiのdllへのフルパスを取得します
/// </summary>
/// <returns></returns>
public static unsafe String GetVstiDllPath() {
if ( s_dll_path_done ) {
return s_dll_path;
}
try {
uint hKey;
int ret = windows.RegOpenKeyExW( windows.HKEY_LOCAL_MACHINE, "SOFTWARE\\VOCALOID2\\APPLICATION", 0, windows.KEY_READ, &hKey );
if ( ret != windows.ERROR_SUCCESS ) {
ret = windows.RegOpenKeyExW( windows.HKEY_LOCAL_MACHINE, "SOFTWARE\\VOCALOID2_DEMO\\APPLICATION", 0, windows.KEY_READ, &hKey );
if ( ret != windows.ERROR_SUCCESS ) {
return s_dll_path;
}
}
FILETIME ft;
for ( uint i = 0; ; i++ ) {
String lpszName = new String( new char[64] );
String pClass = new String( new char[64] );
uint dwNameSize = (uint)lpszName.Length;
uint pcbClass = 64;
int lRes = windows.RegEnumKeyExW( hKey, i, lpszName, &dwNameSize, (uint*)0, pClass, &pcbClass, &ft );
if ( lRes != windows.ERROR_SUCCESS ) {
break;
}
uint hChildKey;
ret = windows.RegOpenKeyExW( hKey, lpszName, 0, windows.KEY_READ, &hChildKey );
if ( ret != windows.ERROR_SUCCESS ) {
continue;
}
uint dwType = windows.REG_SZ;
uint dwSize = windows.MAX_PATH;
byte[] tszVSTPlugin = new byte[windows.MAX_PATH];
tszVSTPlugin[0] = (byte)'\0';
fixed ( byte* pData = &tszVSTPlugin[0] ) {
ret = windows.RegQueryValueExW( hChildKey, "PATH", (uint*)0, &dwType, pData, &dwSize );
}
windows.RegCloseKey( hChildKey );
if ( ret != windows.ERROR_SUCCESS ) {
continue;
}
String name = Encoding.Unicode.GetString( tszVSTPlugin, 0, (int)dwSize );
if ( name.EndsWith( "\0" ) ) {
name = name.SubString( 0, name.Length - 1 );
}
// 製品版
if ( name.EndsWith( "\\vocaloid2.dll" ) ) {
s_dll_path = name;
break;
}
// デモ版
if ( name.EndsWith( "\\vocaloid2_demo.dll" ) ) {
s_dll_path = name;
break;
}
}
windows.RegCloseKey( hKey );
} catch {
} finally {
s_dll_path_done = true;
}
return s_dll_path;
}
/// <summary>
/// 歌唱データベースが保存されているディレクトリのフルパスを取得します
/// </summary>
/// <returns></returns>
public static unsafe String GetExpDbPath() {
if ( s_exp_db_dir_done ) {
return s_exp_db_dir;
}
try {
uint hKey;
int ret = windows.RegOpenKeyExW( windows.HKEY_LOCAL_MACHINE, "SOFTWARE\\VOCALOID2\\DATABASE\\VOICE", 0, windows.KEY_READ, &hKey );
if ( ret != windows.ERROR_SUCCESS ) {
ret = windows.RegOpenKeyExW( windows.HKEY_LOCAL_MACHINE, "SOFTWARE\\VOCALOID2_DEMO\\DATABASE\\VOICE", 0, windows.KEY_READ, &hKey );
if ( ret != windows.ERROR_SUCCESS ) {
return s_exp_db_dir;
}
}
FILETIME ft;
for ( uint i = 0; ; i++ ) {
String lpszName = new String( new char[64] );
String pClass = new String( new char[64] );
uint dwNameSize = (uint)lpszName.Length;
uint pcbClass = 64;
int lRes = windows.RegEnumKeyExW( hKey, i, lpszName, &dwNameSize, (uint*)0, pClass, &pcbClass, &ft );
if ( lRes != windows.ERROR_SUCCESS ) {
break;
}
uint hChildKey;
ret = windows.RegOpenKeyExW( hKey, lpszName, 0, windows.KEY_READ, &hChildKey );
if ( ret != windows.ERROR_SUCCESS ) {
continue;
}
uint dwType = windows.REG_SZ;
uint dwSize = windows.MAX_PATH;
byte[] tszVSTPlugin = new byte[windows.MAX_PATH];
tszVSTPlugin[0] = (byte)'\0';
fixed ( byte* pData = &tszVSTPlugin[0] ) {
ret = windows.RegQueryValueExW( hChildKey, "INSTALLDIR", (uint*)0, &dwType, pData, &dwSize );
}
windows.RegCloseKey( hChildKey );
if ( ret != windows.ERROR_SUCCESS ) {
continue;
}
String name = Encoding.Unicode.GetString( tszVSTPlugin, 0, (int)dwSize );
if ( name.EndsWith( "\0" ) ) {
name = name.SubString( 0, name.Length - 1 );
}
if ( name.EndsWith( "\\voicedbdir" ) ) {
s_exp_db_dir = name;
break;
}
}
windows.RegCloseKey( hKey );
} catch {
} finally {
s_exp_db_dir_done = true;
}
return s_exp_db_dir;
}
}

View File

@@ -0,0 +1,29 @@
/*
* VsqVoiceLanguage.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package jp.sourceforge.lipsync.vsq;
/**
*VOCALOID2の歌唱言語
* @author kbinani
*/
public enum VsqVoiceLanguage {
/**
* デフォルト。Japaneseと同値
*/
Default,
/**
* 日本語
*/
Japanese,
}