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;
|
long Index = 0;
|
||||||
int FrameSkip = 6;
|
int FrameSkip = 6;
|
||||||
byte[] AudioData;
|
byte[] AudioData;
|
||||||
|
Process MPVProcess;
|
||||||
|
|
||||||
string ShowtapeName = "";
|
string ShowtapeName = "";
|
||||||
string ShowtapeStageType = "";
|
string ShowtapeStageType = "";
|
||||||
|
@ -66,6 +67,10 @@ namespace PC2Player
|
||||||
}
|
}
|
||||||
SerialPortDropDown.SelectedValueChanged += (sender, e) => Event_SelectSerialPort();
|
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 = new System.Timers.Timer((1000d/60d)*FrameSkip);
|
||||||
FrameTimer.Elapsed += Event_FrameTimerTick;
|
FrameTimer.Elapsed += Event_FrameTimerTick;
|
||||||
FrameTimer.AutoReset = true;
|
FrameTimer.AutoReset = true;
|
||||||
|
@ -271,7 +276,7 @@ namespace PC2Player
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
File.WriteAllBytes("tmp.wav", AudioData);
|
File.WriteAllBytes("tmp.wav", AudioData);
|
||||||
Process.Start("mpv", "tmp.wav");
|
MPVProcess.Start();
|
||||||
FrameTimer.Start();
|
FrameTimer.Start();
|
||||||
|
|
||||||
Playing = true;
|
Playing = true;
|
||||||
|
@ -285,6 +290,7 @@ namespace PC2Player
|
||||||
void Event_StopButton()
|
void Event_StopButton()
|
||||||
{
|
{
|
||||||
FrameTimer.Stop();
|
FrameTimer.Stop();
|
||||||
|
MPVProcess.Kill();
|
||||||
File.Delete("tmp.wav");
|
File.Delete("tmp.wav");
|
||||||
Playing = false;
|
Playing = false;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue