sound support

Posted by Tspivey on Sat 12 Nov 2005 02:07 AM — 4 posts, 17,102 views.

Canada #0
I think that sound support should call a function with the name of the
sound file that is wanting to be played. Personally, I think that the
sound support not being able to play more than 1 sound at once is quite
annoying, and want to override it cleanly without needing to use an
alias that would be incompatible with the rest of the system.
Australia Forum Administrator #1
I don't see why not.

Version 3.69 now supports a plugin callback that lets you override default sound output. Here is an example:



function OnPluginPlaySound (sound)
  Note ("Playing sound " .. sound)
end -- function


Of course, you would normally do something more complicated than doing a Note. Inside the plugin you can use COM objects or other techniques to play multiple sounds at once.
Amended on Sat 12 Nov 2005 07:28 PM by Nick Gammon
Canada #2
What will this do if a "stop all sound" command is issued from the menu or the stopSound function?
Would a check for an empty string be sufficient to tell your custom sound
function to stop?
Australia Forum Administrator #3
I was hoping you wouldn't ask that, but as you have, I have amended it so that the "stop sound playing" menu item will call your plugin with an empty sound name. You could use that to tell your sounds to stop.