from retail
This commit is contained in:
@@ -160,6 +160,16 @@ local function SoundRepeatStop(self)
|
||||
Private.StopProfileSystem("sound");
|
||||
end
|
||||
|
||||
--[[
|
||||
local function SoundStop(self)
|
||||
Private.StartProfileSystem("sound");
|
||||
if (self.soundHandle) then
|
||||
StopSound(self.soundHandle);
|
||||
end
|
||||
Private.StopProfileSystem("sound");
|
||||
end
|
||||
]]
|
||||
|
||||
local function SoundPlayHelper(self)
|
||||
Private.StartProfileSystem("sound");
|
||||
local options = self.soundOptions;
|
||||
@@ -174,24 +184,52 @@ local function SoundPlayHelper(self)
|
||||
end
|
||||
|
||||
if (options.sound == " custom") then
|
||||
if (options.sound_path) then
|
||||
pcall(PlaySoundFile, options.sound_path, options.sound_channel or "Master");
|
||||
end
|
||||
local ok, _, handle = pcall(PlaySoundFile, options.sound_path, options.sound_channel or "Master")
|
||||
--if ok then
|
||||
--self.soundHandle = handle
|
||||
--end
|
||||
elseif (options.sound == " KitID") then
|
||||
if (options.sound_kit_id) then
|
||||
pcall(PlaySound, options.sound_kit_id, options.sound_channel or "Master");
|
||||
end
|
||||
local ok, _, handle = pcall(PlaySound, options.sound_kit_id, options.sound_channel or "Master")
|
||||
--if ok then
|
||||
--self.soundHandle = handle
|
||||
--end
|
||||
else
|
||||
pcall(PlaySoundFile, options.sound, options.sound_channel or "Master");
|
||||
local ok, _, handle = pcall(PlaySoundFile, options.sound, options.sound_channel or "Master")
|
||||
--if ok then
|
||||
--self.soundHandle = handle
|
||||
--end
|
||||
end
|
||||
Private.StopProfileSystem("sound");
|
||||
end
|
||||
|
||||
local function hasSound(options)
|
||||
if (options.sound == " custom") then
|
||||
if (options.sound_path and options.sound_path ~= "") then
|
||||
return true
|
||||
end
|
||||
elseif (options.sound == " KitID") then
|
||||
if (options.sound_kit_id and options.sound_kit_id ~= "") then
|
||||
return true
|
||||
end
|
||||
else
|
||||
if options.sound and options.sound ~= "" then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function SoundPlay(self, options)
|
||||
if (not options or WeakAuras.IsOptionsOpen()) then
|
||||
return
|
||||
end
|
||||
Private.StartProfileSystem("sound");
|
||||
if not hasSound(options) then
|
||||
Private.StopProfileSystem("sound")
|
||||
return
|
||||
end
|
||||
|
||||
--self:SoundStop();
|
||||
self:SoundRepeatStop();
|
||||
|
||||
self.soundOptions = options;
|
||||
|
||||
Reference in New Issue
Block a user