Skip to content

Commit

Permalink
[bugfixed] problem with multiple x7 devices
Browse files Browse the repository at this point in the history
  • Loading branch information
Willner committed Mar 21, 2023
1 parent bcdf5be commit 42e0cd9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ If($containsWord -contains $true)
{
$fileSysexHead= Get-Content "$PSScriptRoot/../sendmidi/win/sysexhead.txt"
$fileSysexTail= Get-Content "$PSScriptRoot/../sendmidi/win/sysextail.txt"

# parse content for the x7 device name
$x7deviceToken = "(?<=(# X7 send `")).*(?=`")"
$x7device = select-string $x7deviceToken -inputobject $droidcontent
if ([string]::IsNullOrWhiteSpace($x7device)) {$x7device = "x7" }
else { $x7device = $x7device.Matches.groups[0].value }

# remove tabs, spaces & comments
$droidcontent = $droidcontent -replace '(^\s+|\s+$)','' -replace '\t+','' -replace '(#)(.*)','' -replace '\s+\r\n+', "`r`n"

# write temporary file
$fileSysexTmp= "$PSScriptRoot/../sendmidi/tmp.syx"
Set-Content $fileSysexTmp "$fileSysexHead $droidcontent $fileSysexTail"

# parse content for the x7 device name
$x7deviceToken = "(?<=(# X7 send `")).*(?=`")"
$x7device = select-string $x7deviceToken -inputobject $droidcontent
if ([string]::IsNullOrWhiteSpace($x7device)) {$x7device = "x7" }
else { $x7device = $x7device.Matches.groups[0].value }

# send the content of the temporary file
Write-Host -ForegroundColor Yellow "Sending data via sysex to device" $x7device
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ If($containsWord -contains $true)
{
$fileSysexHead= Get-Content "$PSScriptRoot/../sendmidi/win/sysexhead.txt"
$fileSysexTail= Get-Content "$PSScriptRoot/../sendmidi/win/sysextail.txt"

# parse content for the x7 device name
$x7deviceToken = "(?<=(# X7 send `")).*(?=`")"
$x7device = select-string $x7deviceToken -inputobject $droidcontent
if ([string]::IsNullOrWhiteSpace($x7device)) {$x7device = "x7" }
else { $x7device = $x7device.Matches.groups[0].value }

# remove tabs, spaces & comments
$droidcontent = $droidcontent -replace '(^\s+|\s+$)','' -replace '\t+','' -replace '(#)(.*)','' -replace '\s+\r\n+', "`r`n"

# write temporary file
$fileSysexTmp= "$PSScriptRoot/../sendmidi/tmp.syx"
Set-Content $fileSysexTmp "$fileSysexHead $droidcontent $fileSysexTail"

# parse content for the x7 device name
$x7deviceToken = "(?<=(# X7 send `")).*(?=`")"
$x7device = select-string $x7deviceToken -inputobject $droidcontent
if ([string]::IsNullOrWhiteSpace($x7device)) {$x7device = "x7" }
else { $x7device = $x7device.Matches.groups[0].value }

# send the content of the temporary file
Write-Host -ForegroundColor Yellow "Sending data via sysex to device" $x7device
Expand Down

0 comments on commit 42e0cd9

Please sign in to comment.