Why would you want to do that? Unless you mean you cant get the old song to stop when you do a new song?but I can't get it to stop songs once they've started.
Resolved
---
Hey everyone.
I'm a noob to E2 and decided to learn it. So far it's been awesome, heaps better and easier than E2 (Especially considering it's a lot like C, I'm used to that syntax).
So the first thing I decided to make was a wire DJ expression that let you play songs. It's been going well so far, but I can't get it to stop songs once they've started.
Here's my code to stop a song, the played song index is 1 as well
[highlight=e2]if(InStop==1) {
soundStop(1,1)
}[/highlight]
Here's the speaker code to see if there are any bigger errors in my code, any constructive critisism welcome
[highlight=e2]@name MusicPlayerSpeaker
@inputs InSong:string InPlay InStop InHelp
@outputs
@persist
@trigger InPlay InStop InHelp
if(first()==1) {
hint("Need help to connect a speaker a DJ booth?",5.5)
hint("Just connect a button to InHelp and get pressing!",6)
}
if(InHelp==1) {
hint("Speaker Input - DJ Output",5.5)
hint("InSong - SongPath[STRING]",6)
hint("InPlay - OutPlay",6.5)
hint("InStop - OutStop **BROKEN**"7)
hint("InHelp to view this help"7)
}
if(InStop==1) {
soundStop(1,1)
}
if(InPlay==1) {
soundPlay(1,2000,InSong)
}
[/highlight]
Last edited by Danneh; 03-21-2009 at 10:28 AM. Reason: Making the help section clearer
Why would you want to do that? Unless you mean you cant get the old song to stop when you do a new song?but I can't get it to stop songs once they've started.
Wait, you've actually got a point there.
I don't need a button to stop songs mid-play.
And because the songs all run off an index of 1, the new one simply replaces the old one when the next one is played.
But I'm just curious anyways, incase I wanna try and stop sounds in any other application
Thanks for the reply malcum
Last edited by Danneh; 03-21-2009 at 06:34 AM. Reason: Adding info
Well, you cant because of what you said (they all write to directory 1)
if you wrote them to directory 2, you could just do "soundStop(1,1)"
soundPurge() also works.(I think)
I'm an e2 noob. Just wait for someone smarter than me to come around :S
Good work but I am fairly sure that == 1 isn't needed you can just do (first())
or (Button) etc
Aah yeah,forgot that it'll just put the button's value in there, so you don't need the ==1.
Thanks for the help!
Ahh k, I can't test it at the moment because my comp's dead but I will when I can.
Thanks for the help!
Edit:
Thanks for the help, but it turns out my E2 was mucked up elsewhere, and fixing that fixed the sound stopping.
Thanks for helping!
Last edited by Danneh; 03-21-2009 at 10:24 AM. Reason: Fixing quote tag, Resolved
Bookmarks