Skip to content

Commit 7cdfe0a

Browse files
committed
Swap FromPositionString with FromSeconds
The other method doesn't work in other system cultures
1 parent a29f6b2 commit 7cdfe0a

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

YTPMVE.cs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ static bool track_empty(Track track)
3131
}
3232

3333
}
34-
static void track_event_generate(Track track, string note_start, string note_duration)
34+
static void track_event_generate(Track track, double note_start, double note_duration)
3535
{
3636
TrackEvent current_event = track.Events[0];
37-
TrackEvent copied_event = current_event.Copy(track, Timecode.FromPositionString(note_start, RulerFormat.Seconds));
38-
copied_event.AdjustStartLength(Timecode.FromPositionString(note_start, RulerFormat.Seconds), Timecode.FromPositionString(note_duration, RulerFormat.Seconds), false);
37+
TrackEvent copied_event = current_event.Copy(track, Timecode.FromSeconds(note_start));
38+
copied_event.AdjustStartLength(Timecode.FromSeconds(note_start), Timecode.FromSeconds(note_duration), false);
3939
}
40-
static void audio_event_generate(Track audio_track, AudioEvent audio_track_source_audio_event, string note_start, string note_duration, int note_tone_offset, bool pitchsemis_supported)
40+
static void audio_event_generate(Track audio_track, AudioEvent audio_track_source_audio_event, double note_start, double note_duration, int note_tone_offset, bool pitchsemis_supported)
4141
{
4242
if (!audio_track.IsAudio()) { return; }
4343
TrackEvent current_event;
@@ -58,8 +58,8 @@ static void audio_event_generate(Track audio_track, AudioEvent audio_track_sourc
5858
}
5959

6060
//Copy the audio event. MAKE THIS A FUNCTION
61-
TrackEvent copied_event = current_event.Copy(audio_track, Timecode.FromPositionString(note_start, RulerFormat.Seconds));
62-
copied_event.AdjustStartLength(Timecode.FromPositionString(note_start, RulerFormat.Seconds), Timecode.FromPositionString(note_duration, RulerFormat.Seconds), false);
61+
TrackEvent copied_event = current_event.Copy(audio_track, Timecode.FromSeconds(note_start));
62+
copied_event.AdjustStartLength(Timecode.FromSeconds(note_start), Timecode.FromSeconds(note_duration), false);
6363

6464
/*PitchSemis NOT SUPPORTED IN VEGAS 14*/
6565
try
@@ -481,7 +481,7 @@ public void FromVegas(Vegas vegas)
481481

482482
if (note_duration == "NULL")
483483
{
484-
list_timecodes.Add(note_channel + "|" + note_tone_offset + "|" + note_start + "|" + str_default_event_duration);
484+
list_timecodes.Add(current_note[0] + "|" + current_note[1] + "|" + current_note[2] + "|" + str_default_event_duration);
485485

486486
this_application.Project.Markers.Add(new Marker(Timecode.FromSeconds(note_start), "NULL DURATION"));
487487
timestamps_contains_nulls = true;
@@ -514,8 +514,10 @@ public void FromVegas(Vegas vegas)
514514

515515
int note_channel = Int32.Parse(current_note[0], CultureInfo.InvariantCulture);
516516
int note_tone_offset = Int32.Parse(current_note[1], CultureInfo.InvariantCulture);
517-
string note_start = current_note[2];
518-
string note_duration = current_note[3];
517+
double note_start = Double.Parse(current_note[2], CultureInfo.InvariantCulture);
518+
//string note_start = current_note[2];
519+
double note_duration = Double.Parse(current_note[3], CultureInfo.InvariantCulture);
520+
//string note_duration = current_note[3];
519521

520522
//Search through the track to channel index
521523
iterator = 0;

0 commit comments

Comments
 (0)