Skip to content

Commit

Permalink
(breaking) Remove custom audio path
Browse files Browse the repository at this point in the history
The ability to point to your own sound files was removed by Microsoft
several years ago and has been deprecated in BurntToast for almost as
long. This means only built in system sounds can be used now.
  • Loading branch information
Windos committed Apr 26, 2024
1 parent 4046dcc commit 484c6ff
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 59 deletions.
10 changes: 0 additions & 10 deletions Tests/New-BTAudio.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,4 @@ Describe 'New-BTAudio' {
$Log | Should -Be $Expected
}
}

Context 'input validation' {
It 'throws if audio file doesn''t exist' {
{ New-BTAudio -Path 'C:\Fake\phantom.wav' } | Should -Throw "Cannot validate argument on parameter 'Path'. The file 'C:\Fake\phantom.wav' doesn't exist in the specified location. Please provide a valid path and try again."
}

It 'throws if the extension is not supported' {
{ New-BTAudio -Path 'C:\Fake\phantom.mov' } | Should -Throw "Cannot validate argument on parameter 'Path'. The file extension '.mov' is not supported. Please provide a valid path and try again."
}
}
}
27 changes: 0 additions & 27 deletions src/Private/Test-BTAudioPath.ps1

This file was deleted.

24 changes: 2 additions & 22 deletions src/Public/New-BTAudio.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@
# Specifies one of the built in Microsoft notification sounds.
#
# This paramater takes the full form of the sounds, in the form of a uri. The New-BurntToastNotification function simplifies this, so be aware of the difference.
[Parameter(Mandatory,
ParameterSetName = 'StandardSound')]
[Parameter(ParameterSetName = 'StandardSound')]
[ValidateSet('ms-winsoundevent:Notification.Default',
'ms-winsoundevent:Notification.IM',
'ms-winsoundevent:Notification.Mail',
Expand All @@ -70,24 +69,9 @@
'ms-winsoundevent:Notification.Looping.Call8',
'ms-winsoundevent:Notification.Looping.Call9',
'ms-winsoundevent:Notification.Looping.Call10')]
[uri] $Source,

# The full path to an audio file. Supported file types include:
#
# *.aac
# *.flac
# *.m4a
# *.mp3
# *.wav
# *.wma
[Parameter(Mandatory,
ParameterSetName = 'CustomSound')]
[ValidateScript({Test-BTAudioPath $_})]
[Obsolete('Unfortunately, custom sounds no longer work and this parameter will be removed in v0.9.0. See: https://github.com/MicrosoftDocs/windows-uwp/issues/1593')]
[string] $Path,
[uri] $Source = 'ms-winsoundevent:Notification.Default',

# Specifies that the slected sound should play multiple times if its duration is shorter than that of the toast it accompanies.
[Parameter(ParameterSetName = 'CustomSound')]
[Parameter(ParameterSetName = 'StandardSound')]
[switch] $Loop,

Expand All @@ -103,10 +87,6 @@
$Audio.Src = $Source
}

if ($Path) {
$Audio.Src = $Path
}

$Audio.Loop = $Loop
$Audio.Silent = $Silent

Expand Down

0 comments on commit 484c6ff

Please sign in to comment.