Would like to pan sounds - little code guidance?

purplelava

  • Posts: 82
I have tried looking at the API but I have very little programming experience and can't wrap my head around it.

Can someone be so kind as to post a code snippet that could help me understand how I would go for panning a sound in Stencyl? I've seen the pan functions and variables by I'm confused by the different APIs...Stencyl, Open FL, Haxe APIs...can't wrap my head around it and can't create any code yet.


letmethink

  • *
  • Posts: 2545
What are you targetting? If it is mobile (or anything other than flash or html5) I may be able to help you.
~Letmethink

squeeb

  • Posts: 1617
id like to know also.. i dont think you can.. channels in stencyl seem to not be left right fron rear ect..

purplelava

  • Posts: 82
I am targeting all platforms actually. Somebody has made panning work on Flash,

http://www.stencyl.com/game/play/31925

I have contacted him about it.

Honestly I need something that works on flash, mobile, and desktop. I wouldn't be happy with a solution only for mobile/desktop. I'm gonna publish first as Flash. 

I have tried to do code, with no previous experience. I succeded in looping a sound in update, since it wouldn't on initialize.
I have tried manipulating the panning property like this; it compiles but it doesn't pan anything:


Code: [Select]

public var theSound:Sound;


public inline function update(elapsedTime:Float)
{


loopSound(theSound);

theSound.panning = -100/100;

}


the panning property is a float, but I don't understand if a float should be expressed with point values (0.1) or percentages like there (I have used the "view code" function in the blocks to try to figure that out). It doesn't work in either case (on Flash). Is that the way I would access the panning property?

« Last Edit: October 20, 2015, 12:41:39 pm by purplelava »

purplelava

  • Posts: 82
There is a mystique of Stencyl giving you a panning block in an older version. I have downloaded 3.0 and 2.something, and I didn't find it there. I thought that could help me.