File: audio.lua

package info (click to toggle)
gltron 0.70final-14
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,992 kB
  • sloc: ansic: 19,172; sh: 3,004; cpp: 973; makefile: 209
file content (64 lines) | stat: -rw-r--r-- 1,521 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
function setupSoundTrack()
   local i,name
   for i,name in tracks do
      print("[scripting audio] found track '", name, "'")
      if name == settings.current_track then
	 current_track_index = i
	 return
      end
   end
   settings.current_track = tracks[1]
   current_track_index = 1
end

function nextTrack()
   if current_track_index < getn(tracks) then
      current_track_index = current_track_index + 1
   else
      current_track_index = 1
   end
   settings.current_track = tracks[ current_track_index ]
   c_reloadTrack()
end

function previousTrack()
   if current_track_index > 1 then
      current_track_index = current_track_index - 1
   else
      current_track_index = getn(tracks) 
   end
   settings.current_track = tracks[ current_track_index ]
   c_reloadTrack()
end

function MusicVolumeUp()
   settings.musicVolume = settings.musicVolume + 0.05
   if settings.musicVolume > 1.0 then
      settings.musicVolume = 1.0
   end
   c_update_audio_volume()
end

function MusicVolumeDown()
   settings.musicVolume = settings.musicVolume - 0.05
   if settings.musicVolume < 0.0 then
      settings.musicVolume = 0.0
   end
   c_update_audio_volume()
end

function FXVolumeUp()
   settings.fxVolume = settings.fxVolume + 0.05
   if settings.fxVolume > 1.0 then
      settings.fxVolume = 1.0
   end
   c_update_audio_volume()
end

function FXVolumeDown()
   settings.fxVolume = settings.fxVolume - 0.05
   if settings.fxVolume < 0.0 then
      settings.fxVolume = 0.0
   end
   c_update_audio_volume()
end