[Solved] System event sounds?

Kinda low on my priority list, but while I'm thinking about it, is there a convenient way to trigger the OS's sounds, or should I just be using DzAudioClip to call OS-appropriate sound files?

I want to be able to easily trigger system Notification and Critical sounds without worrying about platform-specifics, or including my own soundscape to distribute.

Post edited by ghost_of_delete_key on

Comments

  • Richard HaseltineRichard Haseltine Posts: 101,516
    edited August 2021

    http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/general_ui/display_document_dynamic/start could be used to play a sound file (it will perform the default action for the file type used, so this does depend on the association).

    Post edited by Richard Haseltine on
  • edited August 2021

    Thank you for the reply, but that's not even close to what I want. I'm neither trying to open a media player to play the sound nor actually open a message box to get it. I'm just trying to trigger that alert sound without a message box.

    But, having thought about it for a bit, and having a peek at the SDK docs, I figured out I can just create a DzWinAudioClip in script (in spite of an AudioManager instance), and work it from there. So I just tried this out:

    var clip = new DzWinAudioClip();        clip.openFile("C:/Windows/Media/Windows Background.wav");    clip.play();

     

    and it works exactly as I need it. I can trigger any sound I like in response to some event in code without invoking a message box.

    <edit> I suppose if I were to distribute code using this arrangement, I'll have to use App.platform() to decide whether to create either a DzWinAudioClip or a DzMacAudioClip, to stay truly cross-platform; which brings me to a whole other rant...

    Thanks again, and I hope this is useful to someone in Future Land cool

    Post edited by ghost_of_delete_key on
  • The idea of the sample was to show how to use the commands to trigger the nadling of a document - in your case a sound clip - nott o provide a finished solution.

Sign In or Register to comment.