diff options
author | Aki <nthirtyone@gmail.com> | 2017-07-12 09:04:23 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2017-07-12 09:04:23 +0200 |
commit | 47d4e1c229adfffb70b3c984d00049bcebcfc183 (patch) | |
tree | ab4b34ade5b5cc19d122c4f396e413b61aacbf04 /not/MusicPlayer.lua | |
parent | 4e69182a6d36966847430f01b440a9cdac0e4cdc (diff) | |
download | roflnauts-47d4e1c229adfffb70b3c984d00049bcebcfc183.zip roflnauts-47d4e1c229adfffb70b3c984d00049bcebcfc183.tar.gz roflnauts-47d4e1c229adfffb70b3c984d00049bcebcfc183.tar.bz2 |
All music playing moved to single instance of MusicPlayer
Diffstat (limited to 'not/MusicPlayer.lua')
-rw-r--r-- | not/MusicPlayer.lua | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/not/MusicPlayer.lua b/not/MusicPlayer.lua index d2a89c3..e838d96 100644 --- a/not/MusicPlayer.lua +++ b/not/MusicPlayer.lua @@ -6,12 +6,15 @@ MusicPlayer = Object:extends() function MusicPlayer:new (trackName) self.tracks = {} - self:setTrack(trackName) + if trackName then + self:setTrack(trackName) + self:play() + end end function MusicPlayer:delete () self.tracks = nil - self.source:stop() + self:stop() end function MusicPlayer:setTrack (trackName) @@ -27,7 +30,14 @@ function MusicPlayer:setTrack (trackName) self.source = source self.tracks[trackName] = source end +end + +function MusicPlayer:play () self.source:play() end +function MusicPlayer:stop () + self.source:stop() +end + return MusicPlayer |