View Full Version : The Trouble with Trebles...
Tezcatlipoca
04-14-2003, 10:54 AM
Ok, Firstly I would like to apologise sincerely for the pun title to this thread. It was very naughty of me, and I promise that once you solves my query I will go and stand in the corner.
With that out of the way, I'm experiencing a little trouble with the audio part of Autoplay (hence the thread title). I essentially want an introductory sound to play when my menu first loads up, much like the welcome sound for windows.
At the moment, I'm putting the command to play this .wav in the OnInitialise section of the frontpage setup. It plays fine, but, if I track the mouse over anything that produces a sound before this welcome wave has finished playing, it cuts dead and plays the new sound. This just looks, or, more properly sounds, unprofessional.
The only alteration to sound playing I can see is the Sychronise checkbox, but if I have that selected, the sound file plays before the menu appears. Effectively, it seems to freeze everything whilst the .wav runs, then loads the menu afterwards. This also looks shoddy and realy not acceptable.
So, my query is, is it possible to have this welcome sound, or any sound for that matter, play alongside a seperate .wav, such that my user can put in the CD, the menu appears with the welcome wave file, but even before it has finished, the user can start (with full sound if applicable) navigating the buttons?
Derek
04-14-2003, 11:28 AM
Hi - dont use the Action WAV.Play ... instead, use the MediaPlayer Object and adjust the size to almost nothing.
This allows you to play the 'startup sound' and it doesnt get effected by 'clicks' of other objects.
Darryl
04-14-2003, 11:47 AM
Yes, you could do what Derek suggested, however if you look on your WAV.Play action, you will find an option labeled as "Play synchronous". This option is defined as follows:
"Select this option if you don't want your AutoPlay application to respond to any further events until the WAV has finished playing. If this option is disabled, the next sound that is played will interrupt the current one if the current one hasn't finished yet."
That may be what you are looking for. Give it a try.
Derek
04-14-2003, 11:53 AM
I tried that too Darryl, but it didnt work properly. The app didnt show upon starting, however, the music played fine ... until a few seconds into it, then the music stopped and the page showed as it should and gave a 'click' upon showing!
Is this a known issue or, perhaps, something wrong with my test? [time to update to 4.0.0.4]
Tezcatlipoca
04-14-2003, 11:55 AM
Thanks for the advice, Darryl, but as I said in my original post, I tried that checkbox with unwanted results.
Derek: Your methods works, but I now get a new problem. Basically I create a Media Browser Object and pointed it at the wav file. On the page properties for the frontpage, I include the Media Browser Object > Play command. However, whenever I try to preview my project, I get a windows error box saying 'Can't find object XXX', where XXX is the name of my media browser object. But, when I click on OK, the preview finishes setting up, and runs exactly as required (i.e. the sound plays and I can navigate other buttons with their sound files behind it). I guess I'd really should be worried about whether this error box will appear on the final build, but mainly I'm confused as to why it appears at all, since it's telling me that it can't find an object which is quite clearly there, and, as proven when the preview loads, it runs quite happily.
Lorne
04-14-2003, 11:59 AM
Make sure you put the action in On Show, and not in On Initialize.
Lorne
04-14-2003, 12:02 PM
The reason it produces that error is because the media player control hasn't been instantiated yet -- it doesn't exist to receive the play command until the objects on the page are created.
Derek
04-14-2003, 12:05 PM
Oh yes! Thanx, Lorne /ubbthreads/images/icons/smile.gif
Darryl
04-14-2003, 12:05 PM
Sorry for not reading carefully enough. My bad.
Have you considered converting it to MP3 format instead?
Tezcatlipoca
04-14-2003, 01:58 PM
Thanks all, works perfectly now. On the mp3 format front, I could convert the .wav to an .mp3 I suppose. I hadn't considered it. Is there any advantage to doing so?
Tezcatlipoca
04-14-2003, 02:17 PM
Just one quick point. I've noticed that the mp3 (or wav) now plays as I want it to, but because I've set it to the OnShow criterea, it plays every time I navigate to that page (i.e. go back to the main menu). What I want is for it to play once at the very first startup and that's it. Another thread hints that I can use registry keys to do this, but I have no idea how to go about writing the coding to do this. Any suggestions?
Lorne
04-14-2003, 02:29 PM
Don't need registry keys, unless you only want it to play the first time the user ever runs your application (and never again, even if they exit and run it again).
If you jsut want to keep it from happening more than once in a single "session," then just set a variable to "true" the first time, and only play the sound if that variable is false.
<pre>IF(! %sound_has_played%)
// insert action to play sound here
%sound_has_played% = true
END IF</pre>
Tezcatlipoca
04-14-2003, 02:42 PM
ummm...ok, but how do I get that code from the screen to my project? I don't see any option for inserting code, and Copy/Paste doesn't work.
Lorne
04-14-2003, 03:25 PM
You can't...at least not directly. That's just pseudo-code. Read it to get the gist of what you need to do.
Basically, you use a variable (I called it %sound_has_played% but you can call it whatever you want) that gets set to TRUE the first time the sound plays. And, you use an IF statement to only play the sound if that variable is not TRUE. (The ! operator means "not".)
The pseudo-code reads like this: "if %sound_has_played% is not true, then play the sound, and set %sound_has_played% to true."
With a little help from the user's guide, you should be able to figure it out from there. /ubbthreads/images/icons/smile.gif
Lorne
04-14-2003, 03:30 PM
A bit more help for 'ya:
To do this, you'll need to use 4 actions, in this order:
IF
WAV - Play
Variable - Set Value
END IF
In the IF, put this text:
<font color=green>! %sound_has_played%</font color=green>
In the Variable - Set Value action, change the variable name to <font color=green>%sound_has_played%</font color=green>, and use this text for the value:
<font color=green>true</font color=green>
That's it.
Tezcatlipoca
04-15-2003, 12:18 AM
Ok. I'm going to Page Properties for my main menu screen. I already have a Media Object Browser hidden on the page, that is linked to my sound file.
I go to OnShow, and enter the following in the Command Structure > IF section:
IF ! %sound_has_played%
MediaPlayerObject[sound].Play
%sound_has_played% = TRUE
END IF
I now can't click OK, since an error box tells me that 'Values must be separated by operators'. What am I doing wrong?
Lorne
04-15-2003, 09:24 AM
Don't put that in the IF action.
All you put in the IF action is "! %sound_has_played%" (without the quotes).
Here -- copy and paste this XML into your action list. Note that you will have to add an action to actually play your WAV, but you already know how to do that.
<IR_ACTIONS_LIST>
<Action name="IF">
<Type>200</Type>
<Function>1</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<Condition>! %sound_has_played%</Condition>
</Action>
<Action name="Comment">
<Type>202</Type>
<Function>2</Function>
<DTIndentLevel>1</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<Comment>Insert your action to play the WAV file BELOW this line</Comment>
</Action>
<Action name="Comment">
<Type>202</Type>
<Function>2</Function>
<DTIndentLevel>1</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<Comment>Insert your action to play the WAV file ABOVE this line</Comment>
</Action>
<Action name="Set Value">
<Type>6</Type>
<Function>0</Function>
<DTIndentLevel>1</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<Variable>%sound_has_played%</Variable>
<Value>true</Value>
<Evaluate>0</Evaluate>
</Action>
<Action name="END IF">
<Type>201</Type>
<Function>1</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
</Action>
</IR_ACTIONS_LIST>
Once you've pasted that into your action list, you should see something that looks like this:
<pre>IF (! %sound_has_played%)
// Insert your action to play the WAV file BELOW this line
// Insert your action to play the WAV file ABOVE this line
%sound_has_played% = "true"
END IF</pre>Now, don't just blindly use this code...open up each action and have a look at how it's made, figure it out so you understand what's going on and can reproduce it on your own. Understanding this little snippet will open the door to making your projects do pretty much anything... /ubbthreads/images/icons/smile.gif
Tezcatlipoca
04-15-2003, 10:07 AM
That bit now works perfectly, but I'm back to square one on the other problem.
Basically, I couldn't get both the WAV file and the WAVs attached to the buttons to play at the same time, so when a user started the program and scrolled over a button, the WAV cut dead. I solved it by embedding a Media Browser object on the page, and pointing it at the WAV.
With this taken out, your code inserted, and a command to play a WAV. It nows plays once on the first startup as it should do, but suffers from the same problem with cutting out if another WAV is played. If I use your code, the preview runs an error message saying it can't find the sound file (which it can), it then loads, plays the sound without cutting the other sound files, but then plays everytime a user goes to the main menu.
Am I right in thinking the Autoplay software isn't able to allow you to play one sound at startup only, but one which will not cut out suddenly if the user causes another sound (such as clicking a button) to cut is dead?
Lorne
04-15-2003, 10:19 AM
I think WAVs are all played in the same channel. If you want the sounds to "mix" like that, you need to convert the sound to an MP3, and play it using MP3 - Play instead. I'm pretty sure MP3s and WAVs can mix, because they use two different audio channels.
Incidentally, this is something we plan to address in version 5.0. The audio technology we used in version 4.0 didn't allow the same kind of mixing options, and although it's technically possible to do it on some hardware, such capabilities are definitely not universal, and we opted for compatibility instead.
Derek
04-15-2003, 10:33 AM
Incidentally, this is something we plan to address in version 5.0
I KNOW you want to give us some hints on whats likely to be new in v5 ... so go ahead! /ubbthreads/images/icons/smile.gif
[We know you hate this question, but ... ]
Will be ready in [roughly roughly .. best guess] how many days?????
Tezcatlipoca
04-15-2003, 10:38 AM
Hurruh! It now behaves exactly as it should. Thanks, Lorne. Much appreciated.
Lorne
04-15-2003, 11:11 AM
Sorry Derek, I can't say anything. It just doesn't make sense for us to lay our cards out on the table until we're ready to play our hand. (There are...other companies who would like to mimic our success.)
As for when...we will release the next version when it's ready, and not one day sooner. /ubbthreads/images/icons/smile.gif We're putting a LOT of work into this puppy, so don't expect it for a while yet.
You're right, btw...I'm constantly biting my tongue to keep from talking about the new features. Sometimes I'm about to answer "oh man, that's SO easy, just..." and then I realize I'm thinking in 5.0 mode.
In the mean time, rest assured that we're working our butts off. /ubbthreads/images/icons/smile.gif
Derek
04-15-2003, 11:26 AM
"There are...other companies who would like to mimic our success"
... of course! Hadnt even thought of that. Didnt really expect any info, was just asking coz i could. /ubbthreads/images/icons/smile.gif I'll wait (im)patiently like the rest /ubbthreads/images/icons/frown.gif
Lorne
04-15-2003, 11:35 AM
No problem. I'm glad it worked out. /ubbthreads/images/icons/smile.gif
"With AutoPlay, there is always a way." (tm)
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.