XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently 2017年 Apr 28日 04:02

All times are UTC - 8 hours




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: 2013年 Jul 29日 14:39 
Offline
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 427
Is there a way of getting a OnMouseMove event on an object to play a sound multiple times / continuously? At the moment it plays just once when the movement is completed. I just want the sound to be played each and every time the mouse movement occurs.


Last edited by yereverluvinuncleber on 2014年 Oct 26日 04:28, edited 2 times in total.

Top
 Profile  
 
PostPosted: 2013年 Jul 29日 19:34 
Offline
User avatar

Joined: 2012年 Jun 10日 05:57
Posts: 315
function text1OnMouseMove(Sender,Shift,X,Y,Dx,Dy)
{
PlaySound2("abc.wav")
}


Top
 Profile  
 
PostPosted: 2013年 Jul 30日 03:21 
Offline
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 427
Yes, that almost works but it seems to play the sound synchronously, ie. it plays the sound before it lets the next mouse movement complete so mouse movement is interrupted while the sound plays.
I was hoping that the sound would play in parallel whilst the movement continued. In this way each movement of the mouse would cause a sound to play, one sound overlapping the other. A simple buzz would then be played multiple times whilst the mouse was dragged giving the impression of a electrical interference whilst the mouse is dragged.

On YWE the sounds are played as objects in an asynchronous fashion and I am trying to replicate that behaviour. any thoughts?

Thanks for the quick response.


Top
 Profile  
 
PostPosted: 2013年 Jul 30日 07:06 
Offline
User avatar

Joined: 2012年 Jun 10日 05:57
Posts: 315
yereverluvinuncleber wrote:
Yes, that almost works but it seems to play the sound synchronously, ie. it plays the sound before it lets the next mouse movement complete so mouse movement is interrupted while the sound plays.
I was hoping that the sound would play in parallel whilst the movement continued. In this way each movement of the mouse would cause a sound to play, one sound overlapping the other. A simple buzz would then be played multiple times whilst the mouse was dragged giving the impression of a electrical interference whilst the mouse is dragged.

On YWE the sounds are played as objects in an asynchronous fashion and I am trying to replicate that behaviour. any thoughts?

Thanks for the quick response.


playsound("abc.wav") meets your request :D


Top
 Profile  
 
PostPosted: 2013年 Jul 30日 10:05 
Offline
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 427
It only plays the sound once though on a mousemove and only at the end of the mousemove.


Top
 Profile  
 
PostPosted: 2013年 Aug 8日 07:43 
Offline
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 427
I'm looking to play the sound asynchronously, one sound is kicked off immediately the mouse is moved - and when the next mouse movement happens the next sound plays. The end result is that the sounds overlap, ie. they play asynchronously. I suppose if this is not possible then I should raise it as a feature request.


Top
 Profile  
 
PostPosted: 2013年 Nov 2日 20:07 
Offline

Joined: 2013年 Oct 26日 08:17
Posts: 362
playsound("abc.wav") meets your request and works ok

the problem is from OnMouseMove Function:
if you don't move your mouse (your mouse stay on Object without movement) it still run the function multiple times.

This means when you are inside object it will play a moment of sound multiple times and maybe you don't hear that (because it's too little that sounds a noise) and when you get out of object it will get out of last function and you hear last play fully played

i tested with PhotoAlbum and !Next Command in the OnMouseMove Function:
Even when don't move the mouse it will do !Next until i get out of the Object

=============

Solution:
use your own sound in [yoursound.wav] and create an empty sound for [empty.wav] and use following code:

Code:
var x1=0
var y1=0
function text1OnMouseMove(Sender,Shift,X,Y,Dx,Dy)
{
  if(X!=x1|Y!=y1)    //Only Play if Mouse Moves
  {
   PlaySound("yoursound.wav")
  }
  else      //to Stop sound when Stop Mouse Movement
  {
    PlaySound("empty.wav")
  }
 
  x1=X
  y1=Y
}


//to prevent last play after getting out of object
//remember to set text1OnMouseLeave in OnMouseLeave of Object
function text1OnMouseLeave(Sender)
{
  PlaySound("empty.wav")
}


Top
 Profile  
 
PostPosted: 2014年 Jun 1日 05:36 
Offline
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 427
I will try that though I think that is not exactly what I wanted to achieve, will respond later, thanks.


Top
 Profile  
 
PostPosted: 2014年 Oct 19日 12:29 
Offline
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 427
Hamid, in fact it is the opposite of what you describe.

On the OnMouseMove function it is meant to play the sound multiple times but it plays the sound only once.

On the other engine I use, the onMouseMove function, every mouse movement the sound plays and the sounds are combined as you would expect. The sound builds up and each sound layers upon the previous.

On the Xwidget engine, although I see the function running multiple times I only hear the sound running once when the onMouseMove function has completed. It plays just once. It is as if the Xwidget engine can only play one sound synchronously.


Top
 Profile  
 
PostPosted: 2014年 Oct 25日 22:22 
Offline

Joined: 2013年 Oct 26日 08:17
Posts: 362
my explanation for my above code is correct for that code,
i thought you want it to create a scratch sound,
so on moving of mouse, it will stop the running one and start another one,
if your sound is placed at the beginning of the soundfile (at the 00:00:00),
it should generate a noise for movement of mouse

=============

but as i understand from your new post,
you want it to play multiple times and all of them together,
so they will get mixed up with each other,

for this one:
since only one instance of playsound() function will be ran on Xwidget,
it will need to call multiple instances of playsound() function in widget,
and i don't know a way to do that,
so maybe it's not possible right now


Top
 Profile  
 
PostPosted: 2014年 Oct 26日 04:28 
Offline
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 427
Thanks Hamid, the previous widget engine would allow a sound to be played multiple times altogether and I took advantage of that. I can do without that function for now, perhaps I will simply create a new sound.

Marked as CLOSED.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB® Forum Software © phpBB Group