Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Sound recycling on .NET  (Read 3859 times)

0 Members and 1 Guest are viewing this topic.

TechRogue

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Sound recycling on .NET
« on: July 03, 2013, 03:44:49 pm »
When I use SFML with C++, I delete sound objects after they finish so as to not hit the limit of 256 sounds. How might I go about this in .NET? Is there a better way that I should be managing this?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Sound recycling on .NET
« Reply #1 on: July 03, 2013, 04:06:47 pm »
You can do the same. Why would it have to be different?
Laurent Gomila - SFML developer

TechRogue

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Re: Sound recycling on .NET
« Reply #2 on: July 03, 2013, 04:07:36 pm »
I can't manually delete objects in C#, can I? To be honest I'm only using it because it's what my team agreed on; I don't have a lot of experience with it myself.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Sound recycling on .NET
« Reply #3 on: July 03, 2013, 05:06:48 pm »
Explicitly destroying an object:

sound.Dispose();

Limiting an object's scope:

using (sound = new Sound())
{

} // implicitly calls sound.Dispose()
Laurent Gomila - SFML developer

TechRogue

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Re: Sound recycling on .NET
« Reply #4 on: July 03, 2013, 05:21:32 pm »
Thanks, I didn't know about the Dispose method.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Sound recycling on .NET
« Reply #5 on: July 03, 2013, 06:11:59 pm »
It's inherited from the IDisposable interface, which is standard in .Net (not specific to SFML).
Laurent Gomila - SFML developer

 

anything