Song.java 2.4 KB

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