I have managed to make a radio station, kinda...however I am wanting to add my voice to make it sound like a real station.
The code for the station with voiceovers (found in help files) is:
What I need to know is, how to link for example DJ_track1 with Song1.opus so that it actually plays the track I have spoke about in the DJ Announcement, rather than it playing random stuff.
The code for the station with voiceovers (found in help files) is:
Code:
local err, files = AsyncListFiles(self:GetTracksFolder(), "*.opus") -- find all files in the folder with opus extension
if err or not next(files) then return end -- skip if enumeration fails or folder is empty
local dj = {}
local music = {}
for i = 1, #files do
files[i] = string.sub(files[i], 1, -6) -- strip the opus extension
if files[i]:find("music",1,true) then -- check if the file name contains "music"
music[#music+1] = files[i] -- if so, add it to the music files list
elseif files[i]:find("dj",1,true)then --check if the file name contains "dj"
dj[#dj +1] = files[i] -- if so, add it to the DJ announcement files list
end
end
local music_index = #music +1
local dj_index = #dj +1
while true do
if(music_index >#music) then -- if at the end of the music list, shuffle and start from the beginning
table.permute(music)
music_index =1
end
if(dj_index> #dj) then -- if at the end of the DJ anouncment list, shuffle and start from the beginning
table.permute(dj)
dj_index = 1
end
Music:PlayTrack({ path = dj[dj_index] }) -- play a DJ announcement
WaitMsg("MusicTrackEnded", 30*60*1000) -- wait till it ends, or at most 30 minutes
Music:PlayTrack({ path = music[music_index] }) -- play a music piece
WaitMsg("MusicTrackEnded", 30*60*1000) -- wait till it ends, or at most 30 minutes
Sleep(self.silence * 1000) -- pause for silence
-- increment the indices so you can access the next file in the list
dj_index = dj_index+1
music_index = music_index+1
end
What I need to know is, how to link for example DJ_track1 with Song1.opus so that it actually plays the track I have spoke about in the DJ Announcement, rather than it playing random stuff.