handle on process
This commit is contained in:
parent
1fb697626e
commit
854d6e4c37
1 changed files with 7 additions and 1 deletions
|
@ -19,6 +19,7 @@ namespace PC2Player
|
|||
long Index = 0;
|
||||
int FrameSkip = 6;
|
||||
byte[] AudioData;
|
||||
Process MPVProcess;
|
||||
|
||||
string ShowtapeName = "";
|
||||
string ShowtapeStageType = "";
|
||||
|
@ -66,6 +67,10 @@ namespace PC2Player
|
|||
}
|
||||
SerialPortDropDown.SelectedValueChanged += (sender, e) => Event_SelectSerialPort();
|
||||
|
||||
MPVProcess = new Process();
|
||||
MPVProcess.StartInfo.FileName = "mpv";
|
||||
MPVProcess.StartInfo.Arguments = "tmp.wav";
|
||||
|
||||
FrameTimer = new System.Timers.Timer((1000d/60d)*FrameSkip);
|
||||
FrameTimer.Elapsed += Event_FrameTimerTick;
|
||||
FrameTimer.AutoReset = true;
|
||||
|
@ -271,7 +276,7 @@ namespace PC2Player
|
|||
return;
|
||||
}
|
||||
File.WriteAllBytes("tmp.wav", AudioData);
|
||||
Process.Start("mpv", "tmp.wav");
|
||||
MPVProcess.Start();
|
||||
FrameTimer.Start();
|
||||
|
||||
Playing = true;
|
||||
|
@ -285,6 +290,7 @@ namespace PC2Player
|
|||
void Event_StopButton()
|
||||
{
|
||||
FrameTimer.Stop();
|
||||
MPVProcess.Kill();
|
||||
File.Delete("tmp.wav");
|
||||
Playing = false;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue