Results 1 to 3 of 3
  1. #1
    Codeless is offline Member
    Join Date
    Nov 2010
    Posts
    37
    Rep Power
    0

    Default How would I use a sound clip class, static or not?

    this might be a stupid question... but it's one of those moments when I look back and go, hold on. do I want to do this?

    ok so I have a soundClip class with instance variables and methods. methods like play, stop, set loopcount etc. it's basically a small class to delegate the sequencer code for sound effects.

    my question is do I make this class static or not?

    I didn't make it a static class but then I thought, isn't it silly to create an instance of this in each of my classes that need sound?

    my sprite class is a static class with image arrays and reference numbers.

    isn't sound kinda the same thing, a resource to be shared?

    so basically do I turn my soundclip class into a static class with private static variables and static methods or not?

    how is sound usually handled in games. what is logical?

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,184
    Rep Power
    19

    Default Re: How would I use a sound clip class, static or not?

    Quote Originally Posted by Codeless View Post
    my question is do I make this class static or not?
    Static class or utility class?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,386
    Blog Entries
    7
    Rep Power
    20

    Default Re: How would I use a sound clip class, static or not?

    I think you have your terminology wrong (als see Darryl's reply); only nested classes can be static; I assume you mean a class with only (public) static methods? (not unlike the System class). If there really is no need for an instance of your class it can be a possibility ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Can non-static Inner Class have static fields ?
    By fatabass in forum New To Java
    Replies: 3
    Last Post: 02-05-2012, 09:47 PM
  2. Static and non static class methods question
    By silverglade in forum New To Java
    Replies: 2
    Last Post: 05-14-2011, 10:10 PM
  3. how to program sound into your class
    By jaytee in forum New To Java
    Replies: 2
    Last Post: 03-13-2010, 09:42 PM
  4. Replies: 3
    Last Post: 02-09-2010, 05:22 AM
  5. sound clip
    By f_the_cook in forum Advanced Java
    Replies: 4
    Last Post: 10-17-2008, 05:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •