Skip to content
This repository was archived by the owner on Nov 4, 2023. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions modules/mojo/audio.monkey
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Import audiodevice
Import data

Global device:AudioDevice
'0-31 for sounds, 32 for music -> array length = 33
Global channelVolumes:Float[] = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]


Public

Expand Down Expand Up @@ -70,9 +73,17 @@ Function ChannelState( channel )
End

Function SetChannelVolume( channel,volume# )
'store as current volume (if valid)
If channel >= 0 And channel < 32 Then channelVolumes[channel] = volume
device.SetVolume channel,volume
End

Function GetChannelVolume:Float( channel:Int )
If channel >= 0 And channel < 32 Then Return channelVolumes[channel]
'a not existing channel is silent!
Return 0.0
End

Function SetChannelPan( channel,pan# )
device.SetPan channel,pan
End
Expand Down Expand Up @@ -102,7 +113,13 @@ Function MusicState()
End

Function SetMusicVolume( volume# )
'store as current volume
channelVolumes[32] = volume
device.SetMusicVolume volume
End

Function GetMusicVolume:Float()
Return channelVolumes[32]
End

#Endif