本文整理汇总了C#中Vector.add方法的典型用法代码示例。如果您正苦于以下问题:C# Vector.add方法的具体用法?C# Vector.add怎么用?C# Vector.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector
的用法示例。
在下文中一共展示了Vector.add方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: reload
/// <summary>
/// スクリプトを読み込み、コンパイルします。
/// </summary>
public static void reload() {
// 拡張子がcs, txtのファイルを列挙
String dir = Utility.getScriptPath();
Vector<String> files = new Vector<String>();
files.addAll( Arrays.asList( PortUtil.listFiles( dir, ".txt" ) ) );
files.addAll( Arrays.asList( PortUtil.listFiles( dir, ".cs" ) ) );
// 既存のスクリプトに無いまたは新しいやつはロード。
Vector<String> added = new Vector<String>(); //追加または更新が行われたスクリプトのID
foreach ( String file in files ) {
String id = PortUtil.getFileName( file );
double time = PortUtil.getFileLastModified( file );
added.add( id );
boolean loadthis = true;
if ( scripts.containsKey( id ) ) {
double otime = scripts.get( id ).fileTimestamp;
if ( time <= otime ) {
// 前回コンパイルした時点でのスクリプトファイルよりも更新日が同じか古い。
loadthis = false;
}
}
// ロードする処理
if ( !loadthis ) {
continue;
}
ScriptInvoker si = (new PluginLoader()).loadScript( file );
scripts.put( id, si );
}
// 削除されたスクリプトがあれば登録を解除する
boolean changed = true;
while ( changed ) {
changed = false;
for ( Iterator<String> itr = scripts.keySet().iterator(); itr.hasNext(); ) {
String id = itr.next();
if ( !added.contains( id ) ) {
scripts.remove( id );
changed = true;
break;
}
}
}
}
示例2: removeSelf
} // removeSelf()
/*
****************************************************************************
* find()
****************************************************************************
*/ /**
* Finds subsegments under this CacheNode. Will popluate oCachedDescriptors
* along the way.
* @param oAuth - The authority to search for
* @param nNextSubsegment - The index of the next subsegment to search for
* @param bCompleteChain - Whether or not a descriptor is necessary for all
* subsegments in oAuth
* @param oCachedDescriptors - If not null, stores descriptors found in the
* cache, in the order of the subsegments.
*/
CacheResult find(
XRIAuthority oAuth, int nNextSubsegment, bool bCompleteChain,
Vector oCachedDescriptors)
{
// if there are no new subsegments to get, just return "this", we are done
XRISubSegment oSubSegment = oAuth.getSubSegmentAt(nNextSubsegment);
if (oSubSegment == null)
{
return new CacheResult(this, nNextSubsegment);
}
// also return if we can't find the next subsegment
CacheNode oNode = find(oSubSegment.toString());
if (oNode == null)
{
return new CacheResult(this, nNextSubsegment);
}
// if the found node doesn't have a cached value, potentially bail
if (
(oNode.moCacheValue == null) ||
(oNode.moCacheValue.getDescriptor() == null))
{
if (bCompleteChain)
{
return new CacheResult(this, nNextSubsegment);
}
}
else if (oCachedDescriptors != null)
{
oCachedDescriptors.add(oNode.moCacheValue.getDescriptor());
}
// N O T E: The direcory metaphore used here allows for directories
// to be "empty" (null moCacheValue) and still have subdirs.
//
// As we recurse up, if the returned CacheNode has an empty
// moCacheValue, we'll return "this" unless they caller does not
// allow partials.
return oNode.find(
oAuth, nNextSubsegment + 1, bCompleteChain, oCachedDescriptors);
} // find()
示例3: find
} // find()
/*
****************************************************************************
* findNode()
****************************************************************************
*/ /**
*
*/
private CacheNode findNode(
XRIAuthority oAuth, bool bPartial, bool bCompleteChain,
Vector oCachedDescriptors)
{
// get the Node for the community root
CacheNode oCommunityNode = moRootNode.find(oAuth.getRootAuthority());
if (oCommunityNode == null)
{
return null;
}
// if the found node doesn't have a cached value, potentially bail
if (
(oCommunityNode.moCacheValue == null) ||
(oCommunityNode.moCacheValue.getDescriptor() == null))
{
if (bCompleteChain)
{
return null;
}
}
else if (oCachedDescriptors != null)
{
oCachedDescriptors.add(oCommunityNode.moCacheValue.getDescriptor());
}
// find the deepest node that fits the bill
CacheResult oDeepestNode =
oCommunityNode.find(oAuth, 0, bCompleteChain, oCachedDescriptors);
// return the node we found if we got everything, or we are in partial mode
if (bPartial || (oDeepestNode.mnNumFound == oAuth.getNumSubSegments()))
{
return oDeepestNode.moLastCacheNode;
}
else
{
return null;
}
} // findNode()
示例4: generateMidiEvent
/// <summary>
///
/// </summary>
/// <param name="vsq"></param>
/// <param name="track"></param>
/// <param name="clock_start"></param>
/// <param name="clock_end"></param>
/// <returns></returns>
private TreeMap<Integer, MidiEventQueue> generateMidiEvent( VsqFileEx vsq, int track, int clock_start, int clock_end )
{
TreeMap<Integer, MidiEventQueue> list = new TreeMap<Integer, MidiEventQueue>();
VsqTrack t = vsq.Track.get( track );
// 歌手変更
for ( Iterator<VsqEvent> itr = t.getSingerEventIterator(); itr.hasNext(); ) {
VsqEvent item = itr.next();
if ( clock_start <= item.Clock && item.Clock <= clock_end ) {
if ( item.ID.IconHandle == null ) {
continue;
}
int program = item.ID.IconHandle.Program;
if ( 0 > program || program >= AquesToneDriver.SINGERS.Length ) {
program = 0;
}
ParameterEvent singer = new ParameterEvent();
singer.index = mDriver.phontParameterIndex;
singer.value = program + 0.01f;
if ( !list.containsKey( item.Clock ) ) {
list.put( item.Clock, new MidiEventQueue() );
}
MidiEventQueue queue = list.get( item.Clock );
if ( queue.param == null ) {
queue.param = new Vector<ParameterEvent>();
}
queue.param.add( singer );
} else if ( clock_end < item.Clock ) {
break;
}
}
// ノートon, off
Vector<Point> pit_send = new Vector<Point>(); // PITが追加されたゲートタイム。音符先頭の分を重複して送信するのを回避するために必要。
VsqBPList pit = t.getCurve( "pit" );
VsqBPList pbs = t.getCurve( "pbs" );
VsqBPList dyn = t.getCurve( "dyn" );
VsqBPList bre = t.getCurve( "bre" );
VsqBPList cle = t.getCurve( "cle" );
VsqBPList por = t.getCurve( "por" );
for ( Iterator<VsqEvent> itr = t.getNoteEventIterator(); itr.hasNext(); ) {
VsqEvent item = itr.next();
int endclock = item.Clock + item.ID.getLength();
boolean contains_start = clock_start <= item.Clock && item.Clock <= clock_end;
boolean contains_end = clock_start <= endclock && endclock <= clock_end;
if ( contains_start || contains_end ) {
if ( contains_start ) {
#region contains_start
// noteonのゲートタイムが,範囲に入っている
// noteon MIDIイベントを作成
String lyric = item.ID.LyricHandle.L0.Phrase;
String katakana = KanaDeRomanization.hiragana2katakana( KanaDeRomanization.Attach( lyric ) );
int index = -1;
for ( int i = 0; i < AquesToneDriver.PHONES.Length; i++ ) {
if ( katakana.Equals( AquesToneDriver.PHONES[i] ) ) {
index = i;
break;
}
}
if ( index >= 0 ) {
if ( !list.containsKey( item.Clock ) ) {
list.put( item.Clock, new MidiEventQueue() );
}
MidiEventQueue queue = list.get( item.Clock );
if ( queue.noteon == null ) {
queue.noteon = new Vector<MidiEvent>();
}
// index行目に移動するコマンドを贈る
MidiEvent moveline = new MidiEvent();
moveline.firstByte = 0xb0;
moveline.data = new[] { 0x0a, index };
MidiEvent noteon = new MidiEvent();
noteon.firstByte = 0x90;
noteon.data = new int[] { item.ID.Note, item.ID.Dynamics };
Vector<MidiEvent> add = Arrays.asList( new MidiEvent[] { moveline, noteon } );
queue.noteon.addAll( add );
pit_send.add( new Point( item.Clock, item.Clock ) );
}
/* 音符頭で設定するパラメータ */
// Release
MidiEventQueue q = null;
if ( !list.containsKey( item.Clock ) ) {
q = new MidiEventQueue();
} else {
q = list.get( item.Clock );
}
if ( q.param == null ) {
q.param = new Vector<ParameterEvent>();
}
//.........这里部分代码省略.........
示例5: ReGenerateMidiQueue
private static Vector<MidiQueue> ReGenerateMidiQueue( MidiQueue sender ) {
Vector<MidiQueue> ret = new Vector<MidiQueue>();
if ( sender.Track != 0 ) {
int track = sender.Track;
int clock = sender.Clock;
#if DEBUG
AppManager.debugWriteLine( "MidiPlayer#ReGenerateMidiQueue; track=" + track );
#endif
for ( Iterator<VsqEvent> itr = m_vsq.Track.get( track ).getNoteEventIterator(); itr.hasNext(); ) {
VsqEvent item = itr.next();
if ( clock < item.Clock ) {
int thisclock = item.Clock;
boolean first = true;
while( !m_stop_required ) {
MidiQueue q = new MidiQueue();
q.Track = track;
q.Channel = (byte)(track - 1);
q.Clock = item.Clock;
q.Note = (byte)(item.ID.Note);
q.Program = 0;
q.Velocity = 0x40;
if ( first ) {
q.Done += new MidiQueueDoneEventHandler( ReGenerateMidiQueue );
}
first = false;
ret.add( q );
MidiQueue q_end = new MidiQueue(); //ノートオフ
q_end.Track = track;
q_end.Channel = (byte)(track - 1);
q_end.Clock = item.Clock + item.ID.Length;
q_end.Note = (byte)(item.ID.Note);
q_end.Program = 0;
q_end.Velocity = 0x0;
ret.add( q_end );
if ( itr.hasNext() ) {
item = (VsqEvent)itr.next();
if ( item.Clock != thisclock ) {
break;
}
} else {
break;
}
}
break;
}
}
}
return ret;
}
示例6: Preference
public Preference()
{
InitializeComponent();
fontDialog = new FontDialog();
fontDialog.AllowVectorFonts = false;
fontDialog.AllowVerticalFonts = false;
fontDialog.FontMustExist = true;
fontDialog.ShowEffects = false;
openUtauCore = new OpenFileDialog();
folderBrowserSingers = new FolderBrowserDialog();
folderBrowserSingers.ShowNewFolderButton = false;
applyLanguage();
comboVibratoLength.Items.Clear();
foreach ( DefaultVibratoLengthEnum dvl in Enum.GetValues( typeof( DefaultVibratoLengthEnum ) ) ) {
comboVibratoLength.Items.Add( DefaultVibratoLengthUtil.toString( dvl ) );
}
comboVibratoLength.SelectedIndex = 1;
txtAutoVibratoThresholdLength.Text = "480";
comboAutoVibratoType1.Items.Clear();
for ( Iterator<VibratoHandle> itr = VocaloSysUtil.vibratoConfigIterator( SynthesizerType.VOCALOID1 ); itr.hasNext(); ) {
VibratoHandle vconfig = itr.next();
comboAutoVibratoType1.Items.Add( vconfig );
}
if ( comboAutoVibratoType1.Items.Count > 0 ) {
comboAutoVibratoType1.SelectedIndex = 0;
}
comboAutoVibratoType2.Items.Clear();
for ( Iterator<VibratoHandle> itr = VocaloSysUtil.vibratoConfigIterator( SynthesizerType.VOCALOID2 ); itr.hasNext(); ) {
VibratoHandle vconfig = itr.next();
comboAutoVibratoType2.Items.Add( vconfig );
}
if ( comboAutoVibratoType2.Items.Count > 0 ) {
comboAutoVibratoType2.SelectedIndex = 0;
}
updateCustomVibrato();
comboResolControlCurve.Items.Clear();
for ( Iterator<ClockResolution> itr = ClockResolutionUtility.iterator(); itr.hasNext(); ) {
ClockResolution cr = itr.next();
comboResolControlCurve.Items.Add( ClockResolutionUtility.toString( cr ) );
}
comboResolControlCurve.SelectedIndex = 0;
comboLanguage.Items.Clear();
String[] list = Messaging.getRegisteredLanguage();
int index = 0;
comboLanguage.Items.Add( "Default" );
int count = 0;
foreach ( String s in list ) {
count++;
comboLanguage.Items.Add( s );
if ( s.Equals( Messaging.getLanguage() ) ) {
index = count;
}
}
comboLanguage.SelectedIndex = index;
SingerConfig[] dict = VocaloSysUtil.getSingerConfigs( SynthesizerType.VOCALOID2 );
m_program_change = new Vector<String>();
comboDefualtSinger.Items.Clear();
foreach ( SingerConfig kvp in dict ) {
m_program_change.add( kvp.VOICENAME );
comboDefualtSinger.Items.Add( kvp.VOICENAME );
}
comboDefualtSinger.Enabled = (comboDefualtSinger.Items.Count > 0);
if ( comboDefualtSinger.Items.Count > 0 ) {
comboDefualtSinger.SelectedIndex = 0;
}
updateMidiDevice();
txtVOCALOID1.Text = VocaloSysUtil.getDllPathVsti( SynthesizerType.VOCALOID1 );
txtVOCALOID2.Text = VocaloSysUtil.getDllPathVsti( SynthesizerType.VOCALOID2 );
listSingers.Columns[0].Width = columnWidthHeaderProgramChange;
listSingers.Columns[1].Width = columnWidthHeaderName;
listSingers.Columns[2].Width = columnWidthHeaderPath;
// default synthesizer
comboDefaultSynthesizer.Items.Clear();
(from kind
in Enum.GetValues( typeof( RendererKind ) ).Cast<RendererKind>()
where kind != RendererKind.NULL
select kind.getString()
)
.Distinct()
.OrderBy( ( kind ) => kind ).ToList()
.ForEach( ( kind ) => comboDefaultSynthesizer.Items.Add( kind ) );
comboDefaultSynthesizer.SelectedIndex = 0;
numBuffer.Maximum = EditorConfig.MAX_BUFFER_MILLISEC;
numBuffer.Minimum = EditorConfig.MIN_BUFFER_MILLIXEC;
registerEventHandlers();
//.........这里部分代码省略.........
示例7: updateMidiDevice
/// <summary>
/// MIDIデバイスの選択肢の欄を更新します
/// </summary>
private void updateMidiDevice()
{
int sel_midi = comboMidiInPortNumber.SelectedIndex;
int sel_mtc = comboMtcMidiInPortNumber.SelectedIndex;
comboMidiInPortNumber.Items.Clear();
comboMtcMidiInPortNumber.Items.Clear();
#if ENABLE_MIDI
Vector<MidiDevice.Info> midiins = new Vector<MidiDevice.Info>();
foreach ( MidiDevice.Info info in MidiSystem.getMidiDeviceInfo() ) {
#if DEBUG
if ( info != null ) {
sout.println( "Preference#updateMidiDevice; info.getName()=" + info.getName() );
}
#endif
MidiDevice device = null;
try {
device = MidiSystem.getMidiDevice( info );
} catch ( Exception ex ) {
device = null;
}
if ( device == null ) continue;
#if DEBUG
sout.println( "Preference#updateMidiDevice; (device is Receiver)=" + (device is Receiver) );
#endif
// MIDI-OUTの最大接続数.-1は制限なしを表す
int max = device.getMaxTransmitters();
if ( max > 0 || max == -1 ) {
midiins.add( info );
}
}
foreach ( MidiDevice.Info info in midiins ) {
comboMidiInPortNumber.Items.Add( info );
comboMtcMidiInPortNumber.Items.Add( info );
}
if ( midiins.Count <= 0 ) {
comboMtcMidiInPortNumber.Enabled = false;
comboMidiInPortNumber.Enabled = false;
} else {
#if ENABLE_MTC
comboMtcMidiInPortNumber.setEnabled( true );
#else // ENABLE_MTC
comboMtcMidiInPortNumber.Enabled = false;
#endif // ENABLE_MTC
comboMidiInPortNumber.Enabled = true;
}
#else // ENABLE_MIDI
comboMtcMidiInPortNumber.setEnabled( false );
comboMidiInPortNumber.setEnabled( false );
#endif // ENABLE_MIDI
// 可能なら選択状態を復帰
if ( sel_midi >= 0 ) {
if ( comboMidiInPortNumber.Items.Count <= sel_midi ) {
sel_midi = comboMidiInPortNumber.Items.Count - 1;
}
comboMidiInPortNumber.SelectedIndex = sel_midi;
}
if ( sel_mtc >= 0 ) {
if ( comboMtcMidiInPortNumber.Items.Count <= sel_mtc ) {
sel_mtc = comboMtcMidiInPortNumber.Items.Count - 1;
}
comboMtcMidiInPortNumber.SelectedIndex = sel_mtc;
}
}
示例8: copyResamplersConfig
public void copyResamplersConfig( Vector<String> ret, Vector<Boolean> with_wine )
{
for ( int i = 0; i < listResampler.Items.Count; i++ ) {
ret.add( (String)listResampler.Items[i].SubItems[0].Text );
with_wine.add( listResampler.Items[i].Checked );
}
}
示例9: merge_events
private Vector<MidiEvent> merge_events( Vector<MidiEvent> x0, Vector<MidiEvent> y0 )
{
Vector<MidiEvent> ret = new Vector<MidiEvent>();
for ( int i = 0; i < x0.size(); i++ ) {
ret.add( x0.get( i ) );
}
for ( int i = 0; i < y0.size(); i++ ) {
ret.add( y0.get( i ) );
}
boolean changed = true;
while ( changed ) {
changed = false;
for ( int i = 0; i < ret.size() - 1; i++ ) {
if ( ret.get( i ).CompareTo( ret.get( i + 1 ) ) > 0 ) {
MidiEvent m = ret.get( i );
ret.set( i, ret.get( i + 1 ) );
ret.set( i + 1, m );
changed = true;
}
}
}
return ret;
}
示例10: open
public override boolean open( int block_size, int sample_rate )
{
boolean ret = base.open( block_size, sample_rate );
#if DEBUG
sout.println( "VocaloidDriver#open; dllHandle=0x" + PortUtil.toHexString( dllHandle.ToInt32() ).ToUpper() );
#endif
g_pEvents = new Vector<MidiEvent>();
g_midiPrepared0 = false;
g_midiPrepared1 = false;
g_tcCurrent = 0;
g_tcPrevious = 0;
g_saProcessed = 0;
g_saTotalSamples = 0;
g_tempoList = new Vector<TempoInfo>();
g_numTempoList = 0;
//g_cancelRequired = false;
g_progress = 0.0;
s_track_events = new Vector<Vector<MidiEvent>>();
s_track_events.add( new Vector<MidiEvent>() );
s_track_events.add( new Vector<MidiEvent>() );
return ret;
}