/* * UstEvent.cs * Copyright (c) 2009 kbinani * * This file is part of Boare.Lib.Vsq. * * Boare.Lib.Vsq is free software; you can redistribute it and/or * modify it under the terms of the BSD License. * * Boare.Lib.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. */ using System; using System.IO; using System.Collections.Generic; using System.Text; namespace Boare.Lib.Vsq { public class UstEvent : ICloneable { public object Tag; public int Length = 0; public string Lyric = ""; public int Note = -1; public int Intensity = -1; public int PBType = -1; public float[] Pitches = null; public float Tempo = -1; public object Clone() { UstEvent ret = new UstEvent(); ret.Length = Length; ret.Lyric = Lyric; ret.Note = Note; ret.Intensity = Intensity; ret.PBType = PBType; if ( Pitches != null ) { ret.Pitches = new float[Pitches.Length]; for ( int i = 0; i < Pitches.Length; i++ ) { ret.Pitches[i] = Pitches[i]; } } ret.Tempo = Tempo; return ret; } public void print( StreamWriter sw, uint index ) { sw.WriteLine( string.Format( "[#{0:d4}]", index ) ); sw.WriteLine( "Length=" + Length ); sw.WriteLine( "Lyric=" + Lyric ); sw.WriteLine( "NoteNum=" + Note ); if ( Intensity >= 0 ) { sw.WriteLine( "Intensity=" + Intensity ); } if ( PBType >= 0 && Pitches != null ) { sw.WriteLine( "PBType=" + PBType ); sw.Write( "Piches=" ); for ( int i = 0; i < Pitches.Length; i++ ) { if ( i == 0 ) { sw.Write( Pitches[i] ); } else { sw.Write( "," + Pitches[i] ); } } sw.WriteLine(); } if ( Tempo > 0 ) { sw.WriteLine( "Tempo=" + Tempo ); } } } }