I am using start-process
to call vlc to play an audio file. I want to capture the keyboard input of this vlc process. Pressed keys should not be passed to vlc but to my calling program, such that I can check using $host.UI.RawUI.KeyAvailable
or something similar. How can that be done?
function PlaySong {
param ( [Parameter(Mandatory=$true)]
$SongObject,
[Parameter(Mandatory=$false)]
$CurrentSpeed = $SongObject.StartSpeed
)
$ArgList = " --play-and-exit" +
" --quiet -I dummy" +
" --audio-filter=scaletempo_pitch --pitch-shift " + $SongObject.PitchShift +
" --start-time " + $SongObject.StartTime +
" --stop-time " + $SongObject.EndTime +
" --rate " + $CurrentSpeed +
" --novideo" +
" `"" + $SongObject.Path + "`""
$prc = start-process -PassThru -FilePath vlc -ArgumentList $ArgList
Wait-Process -Id $prc.Id -ErrorAction SilentlyContinue
}