PDA

View Full Version : URGENT HELP!!! How can i get the value of the audio channel?


valym23
02-02-2008, 08:57 AM
Hy...
I have a verry strong problem. I have loaded some audio files in some channels (CHANNEL_USER1, CHANNEL_USER2, etc ...). What is the script command to get or find the channel number that is current playing?
Urgent please....:rolleyes
This is my project exemple:
I load a file to Channel_User1 and a File to Channel_user2. After the page is started i push a button (play) that play Channel_User1. When i press the "next button" it's stop Channel_User1 and start to play Channel_User2. And so on...
How can i do this?
PLS Help Me Guys!!!:huh

yosik
02-02-2008, 11:36 AM
Channels have numbers (0 to 6), check help file.
You can use an Audio action, for example Audio.GetCurrentPos(Channel) in a for loop. If there is an error (like the channel is not loaded for example), instead of getting a "proper" result, you will get -1 as the value. You can check for which channel that value was NOT -1 and that will give you the number of the channel currently playing.

Good luck
Yossi

valym23
02-03-2008, 02:47 AM
:huhI didn't understand much thing of your explication. Give me a script command or something to view it with my eyes otherwise i do not understand anything.

yosik
02-03-2008, 03:28 AM
Audio channels are numbered.
From the help file:
CHANNEL_BACKGROUND 5 Background audio channel.

CHANNEL_EFFECTS 0 Effects channel (used for mouse over, down, and click sounds).

CHANNEL_NARRATION 6 Narration channel (used for voice overs).

CHANNEL_USER1 1 User channel 1.

CHANNEL_USER2 2 User channel 2.

CHANNEL_USER3 3 User channel 3.

CHANNEL_USER4 4 User channel 4.

So, you can use the following in any event you want to use to check your audio status (buttons click, Page onShow etc...)

--checking channels
for i = 1, 4 do
position = Audio.GetCurrentPos(i); -- check if channel is running
--if no sound loaded in channel i , position will be equal to -1
if position ~= -1then
break; --when running channel is found, break from the loop
end
end

Now you know that i is the number of the audio channel and can use that to your advantage.

Good luck

Yossi