surf68
surf68
CC#
Created by nutsack 2003 on 12/22/2024 in #help
adding music on forms app
anyhow i've got to dip, you've got a bunch of reading to do so good luck.
101 replies
CC#
Created by nutsack 2003 on 12/22/2024 in #help
adding music on forms app
- you'll end up publishing the application (or just using the build output) and you'll have to RAR it separately - generally people keep track of the state of their source code using a version control system (VCS). git is by far the most popular VCS in use these days
101 replies
CC#
Created by nutsack 2003 on 12/22/2024 in #help
adding music on forms app
your click handler will end up something like
using (var player = new SoundPlayer("path_to_sound.wav"))
{
player.Play();
}
using (var player = new SoundPlayer("path_to_sound.wav"))
{
player.Play();
}
101 replies
CC#
Created by nutsack 2003 on 12/22/2024 in #help
adding music on forms app
so you want to make sure that the SoundPlayers are disposed of (you'll see what that means when you read the link)
101 replies
CC#
Created by nutsack 2003 on 12/22/2024 in #help
adding music on forms app
and other system resources it'll be using to play the audio
101 replies
CC#
Created by nutsack 2003 on 12/22/2024 in #help
adding music on forms app
i'm talking about resources like file handles etc rather than the actual files
101 replies
CC#
Created by nutsack 2003 on 12/22/2024 in #help
adding music on forms app
as long as you distribute them with the application, yes
101 replies
CC#
Created by nutsack 2003 on 12/22/2024 in #help
adding music on forms app
101 replies
CC#
Created by nutsack 2003 on 12/22/2024 in #help
adding music on forms app
yeah but another thing to bear in mind is that playing sound uses external resources which is why these SoundPlayers implement IDisposable
101 replies
CC#
Created by nutsack 2003 on 12/22/2024 in #help
adding music on forms app
it's been a long time since i worked with win forms but it'll be something like that
101 replies
CC#
Created by nutsack 2003 on 12/22/2024 in #help
adding music on forms app
if you're using the GUI i believe you'd need to go back onto the button, go to its properties and remove the handler there. you can then just delete the code.
101 replies
CC#
Created by nutsack 2003 on 12/22/2024 in #help
adding music on forms app
the event already exists (it's part of the framework), you're talking about generating an event handler and wiring it up
101 replies
CC#
Created by nutsack 2003 on 12/22/2024 in #help
adding music on forms app
you mean it adds a function to act as an event handler?
101 replies
CC#
Created by nutsack 2003 on 12/22/2024 in #help
adding music on forms app
what do you mean by add an event?
101 replies
CC#
Created by nutsack 2003 on 12/22/2024 in #help
adding music on forms app
and you then click on startgame, the sound stops and the loading screen is shown?
101 replies
CC#
Created by nutsack 2003 on 12/22/2024 in #help
adding music on forms app
and when you click on label3, the selection form is shown and the sound continues to play?
101 replies
CC#
Created by nutsack 2003 on 12/22/2024 in #help
adding music on forms app
so the main screen loads and plays the wav file correctly?
101 replies
CC#
Created by nutsack 2003 on 12/22/2024 in #help
adding music on forms app
right, so that form is having its soundplayer passed in via constructor. where's the code that does that?
101 replies
CC#
Created by nutsack 2003 on 12/22/2024 in #help
adding music on forms app
and send the equivalent code from your other form that does work
101 replies
CC#
Created by nutsack 2003 on 12/22/2024 in #help
adding music on forms app
go for it
101 replies