Song.java 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. package audio;
  2. import image.Images;
  3. import java.awt.image.BufferedImage;
  4. import java.io.File;
  5. import java.util.ArrayList;
  6. import java.util.List;
  7. public class Song implements Comparable<Song>{
  8. private String title;
  9. private String subtitle;
  10. private String author;
  11. private double sample_start;
  12. private double BPM;
  13. private File audio;
  14. private File background;
  15. private File banner;
  16. private File file;
  17. private BufferedImage backgroundImage;
  18. private BufferedImage bannerImage;
  19. public List<SongInstance> songs;
  20. public Song() {
  21. title = "";
  22. subtitle = "";
  23. author = "";
  24. sample_start = 0;
  25. BPM = 0.0;
  26. audio = null;
  27. background = null;
  28. banner = null;
  29. file = null;
  30. backgroundImage = null;
  31. bannerImage = null;
  32. songs = new ArrayList<SongInstance>();
  33. }
  34. public void addSongInstance(SongInstance s) {
  35. songs.add(s);
  36. }
  37. public String getTitle() {
  38. return title;
  39. }
  40. public void setTitle(String title) {
  41. this.title = title;
  42. }
  43. public String getSubtitle() {
  44. return subtitle;
  45. }
  46. public void setSubtitle(String subtitle) {
  47. this.subtitle = subtitle;
  48. }
  49. public String getAuthor() {
  50. return author;
  51. }
  52. public void setAuthor(String author) {
  53. this.author = author;
  54. }
  55. public double getSampleStart() {
  56. return sample_start;
  57. }
  58. public void setSampleStart(double sample_start) {
  59. this.sample_start = sample_start;
  60. }
  61. public double getBPM() {
  62. return BPM;
  63. }
  64. public void setBPM(double bPM) {
  65. BPM = bPM;
  66. }
  67. public File getAudio() {
  68. return audio;
  69. }
  70. public void setAudio(File audio) {
  71. this.audio = audio;
  72. }
  73. public File getBackground() {
  74. return background;
  75. }
  76. public void setBackground(File background) {
  77. this.background = background;
  78. }
  79. public BufferedImage getBackgroundImage()
  80. {
  81. if(backgroundImage == null)
  82. {
  83. this.backgroundImage = Images.readImage(background);
  84. }
  85. return backgroundImage;
  86. }
  87. public File getBanner() {
  88. return banner;
  89. }
  90. public BufferedImage getBannerImage()
  91. {
  92. if(bannerImage == null)
  93. {
  94. this.bannerImage = Images.readImage(banner);
  95. }
  96. return bannerImage;
  97. }
  98. public void setBanner(File banner) {
  99. this.banner = banner;
  100. }
  101. public File getFile() {
  102. return file;
  103. }
  104. public String getFolder()
  105. {
  106. return file.getParentFile().getName();
  107. }
  108. public void setFile(File file) {
  109. this.file = file;
  110. }
  111. public List<SongInstance> getSongs() {
  112. return songs;
  113. }
  114. public void close()
  115. {
  116. }
  117. @Override
  118. public int compareTo(Song s) {
  119. return getTitle().compareTo(s.getTitle());
  120. }
  121. }