This is a threads issue. Since the dialog is running in the same thread as the sound loop (assumption based off discription of issue) then there can be only a couple of outcomes but the bottom line is that once the dialog becomes active the main loop will wait until the dialog is exited before doing anything else. Thus you might either get no sound, the dialog, then exit or you get one beep, the dialog, then exit depending on which is run first.
You will need to seperate your sound loop from the dialog loop. I usually do this with queues but whatever works for you. Below is a snapshot of what you wanted to do using queues... any questions just post back
