| Here is the code, it should run as it is, comment the REMs to make it not work, Thanks a lot!: 
 
 
'T_Sound
'T_MusicaStream
rem 'Uncomment to make it not work
Import MaxMod.AudioStream
Import MaxMod.OGG
endrem
Strict
rem 'Uncomment to make it not work
If EnableOpenALAudio()
	SetAudioDriver("openal")
	print "OpenAL driver"
Else
	SetAudioDriver("DirectSound")
	print "Directound Driver"
EndIf
Local SoDrivers:String[] = AudioDrivers()
For Local sd:Int = 0 To 9
	Print "Sound driver " + sd + ": " + SoDrivers[sd]
Next
endrem
'----------------------------------------------------------------------------------------------------------------------------------------
'	Objeto pra manejar la musica del juego usando un metodo de streaming de MaxMod
'------------------------------------------------------------------------------------------------
Type T_MusicaStream
	Global Me:T_MusicaStream
	Field Channel:TChannel
	Field File:String = "MenuPrincipal.ogg"'indica el nombre del ARCHIVO de la cancion
	Field SongIndex:Byte = 0'el index de la cancion, el id, el numero,usado para ir cambiando de cancion
	Field LoopSong:Byte = False
	
	Field Active = True
	
	Function Createme:T_MusicaStream()
		Local inst:T_MusicaStream = New T_MusicaStream
		
		T_MusicaStream.Me = inst
		inst.LoadSong()
		rem 'Uncomment to make it not work
		inst.UpdateVolume()
		ResumeChannel(inst.Channel)
		endrem
		
		Return inst
	End Function
	
	Method LoadSong()
		If Not Active Then Return
		rem 'Uncomment to make it not work
		Channel = CreateAudioStream(file, LoopSong, True)
		if channel=null then runtimeerror "Unable to play Music."
		UpdateVolume()
		ResumeChannel(Channel)
		endrem
	EndMethod
	
	Method ShuffleSong()
		songindex = Rand(3, 6)
		
		
		SetFile()
		rem 'Uncomment to make it not work
		If channel Then StopChannel(Channel)
		LoadSong()
		endrem
	End Method
	
	Method ChangeSong(index0:Int)
		If Channel Then StopChannel(Channel)
		SongIndex = index0
		SetFile()
		LoadSong()
	End Method
	
	Method SetFile()
		Select SongIndex
			Case 0
				File = "MenuPrincipal.ogg"
			Case 1
				File = "HighScores.ogg"
			Case 2
				File = "EndLevel.ogg"
			Case 3
				File = "Juego.ogg"
			Case 4
				File = "CanonD.ogg"
			Case 5
				File = "NocturneF.ogg" 
			Case 6
				File = "ToccataF.ogg"
				
		End Select		
	End Method
	
	Method Update_Me()
		CheckSongEnd()
	End Method
		
	Method UpdateVolume()
		rem 'Uncomment to make it not work
		'Channel.SetVolume(T_profile.Me.byte_Volume_Music * (1.0 / 255))
		'Channel.SetVolume(1.0)
		endrem
	End Method
	
	Method CheckSongEnd()
		If Not (Channel.Playing())
			If Not SongIndex < 2
				LoopSong = False'para que no repita la cancion y shufflee cuando termine una
		 		ShuffleSong()
		 	Else
				LoopSong = True	'para que repita las canciones que no pertenezcan al gameplay
			EndIf
		EndIf
	End Method
	 
End Type
'----------------------------------------------------------------------------------------------------------------------------------------
'	Objeto de sonido usado por el manager de sonidos Type T_Sound_Player
'------------------------------------------------------------------------------------------------
Type T_Sound
	Field File:String = ""'indica el nombre del ARCHIVO de la cancion
	Field SoundObj:TSound
	Field SoundID:String
	Field SoundNumber:Int
	Field Channel:TChannel
	
	Function Createme:T_Sound(SfxFile:String, SfxId:String, Player_List:T_Sound[], iDnumber:Int)'url, id para usarlo, array del objeto playerlist,numero de id para localizarlo en array
		Local inst:T_Sound = New T_Sound
		
		inst.File = SfxFile
		inst.SoundID = SfxId
		
		inst.SoundObj = LoadSound(SfxFile)
		If inst.SoundObj = Null RuntimeError "Couldn't load the sound sample!"
		
		Player_List[iDnumber] = inst
		
		Return inst
	End Function
	
    	
	Method Update_Me()
		rem 'Uncomment to make it not work
		CheckSfxEnd()
		endrem
	End Method	
		
	Method CheckSfxEnd()
		If Not(Channel = Null)
		 If Not (Channel.Playing()) Then StopChannel(Channel) ;Channel = Null ';Print "sonido borrado"
		EndIf
	End Method
	
End Type
'----------------------------------------------------------------------------------------------------------------------------------------
'	Objeto que maneja todos los sonidos del juego, se cargan con LoadSFX() overraideandolo y
'	luego cada uno se debe cargar usando el metodo 	PlaySfx(id del sonido)
'------------------------------------------------------------------------------------------------
Type T_Sound_Player
	Global Me:T_Sound_Player
	Field Channel:TChannel
	Field SoundsArray:T_Sound[20]
	
	Field Active = true
	
	Function Createme:T_Sound_Player()
		Local inst:T_Sound_Player = New T_Sound_Player
		
		T_Sound_Player.me = inst
		inst.LoadSFX()
		
		
		Return inst
	End Function
	
	Method LoadSFX()'carga todos los sonidos del juego
		T_Sound.Createme("Boton.ogg", "Boton", Self.SoundsArray, 0)
		T_Sound.Createme("Comprar.ogg", "Comprar", Self.SoundsArray, 1)
		T_Sound.Createme("ExitoCarita.ogg", "Exito Carita", Self.SoundsArray, 2)
		T_Sound.Createme("Simbolos.ogg", "Simbolos", Self.SoundsArray, 3)
		T_Sound.Createme("Coinc-Niv1.ogg", "Coinc-Niv1", Self.SoundsArray, 4)
		T_Sound.Createme("Coinc-Niv2.ogg", "Coinc-Niv2", Self.SoundsArray, 5)
		T_Sound.Createme("Coinc-Niv3.ogg", "Coinc-Niv3", Self.SoundsArray, 6)
		T_Sound.Createme("Coinc-Niv4.ogg", "Coinc-Niv4", Self.SoundsArray, 7)
		T_Sound.Createme("Coinc-Niv5.ogg", "Coinc-Niv5", Self.SoundsArray, 8)
		T_Sound.Createme("Coinc-Niv6.ogg", "Coinc-Niv6", Self.SoundsArray, 9)
		T_Sound.Createme("Coinc-Niv7.ogg", "Coinc-Niv7", Self.SoundsArray, 10)
		T_Sound.Createme("Contador.ogg", "Contador", Self.SoundsArray, 11)
		T_Sound.Createme("Deshacer.ogg", "Deshacer", Self.SoundsArray, 12)
		T_Sound.Createme("Enojo.ogg", "Enojo", Self.SoundsArray, 13)
		T_Sound.Createme("Operacion.ogg", "Operacion", Self.SoundsArray, 14)
		T_Sound.Createme("SumaValor.ogg", "SumaValor", Self.SoundsArray, 15)
		T_Sound.Createme("Vender.ogg", "Vender", Self.SoundsArray, 16)
		T_Sound.Createme("RestaValor.ogg", "RestaFel", Self.SoundsArray, 17)
		T_Sound.Createme("Calculo-Cortina.ogg", "CalculoCortina", Self.SoundsArray, 18)
				
	EndMethod
	
	Method CueSoundObj(IdNumber)
		rem 'Uncomment to make it not work
		Local ActualSound:TSound = T_Sound(SoundsArray[IdNumber]).SoundObj
		
		Channel = CueSound(ActualSound)
		T_Sound(SoundsArray[IdNumber]).Channel = Channel
		
		endrem
	End Method
		
	Method PlaySfx(sfxId:String = "")
	
		Select sfxId
			Case "Boton"
				CueSoundObj(0)
				
			Case "Comprar"
				CueSoundObj(1)
				
			Case "Exito Carita"
				CueSoundObj(2)
				
			Case "Simbolos"
				CueSoundObj(3)
				
			Case "Coinc-Niv1"
				CueSoundObj(4)
				
			Case "Coinc-Niv2"
				CueSoundObj(5)
				
			Case "Coinc-Niv3"
				CueSoundObj(6)
				
			Case "Coinc-Niv4"
				CueSoundObj(7)
				
			Case "Coinc-Niv5"
				CueSoundObj(8)
				
			Case "Coinc-Niv6"
				CueSoundObj(9)
				
			Case "Coinc-Niv7"
				CueSoundObj(10)
				
			Case "Contador"
				CueSoundObj(11)
				
			Case "Deshacer"
				CueSoundObj(12)
											
			Case "Enojo"
				CueSoundObj(13)
			Case "Operacion"
				CueSoundObj(14)
				
			Case "SumaValor"
				CueSoundObj(15)
				
			Case "Vender"
				CueSoundObj(16)
				
			Case "RestaFel"
				CueSoundObj(17)
			
			Case "CalculoCortina"
				CueSoundObj(18)
				
			Default
				Return
		EndSelect
		
		If Not Active Then Return
		rem 'Uncomment to make it not work
		UpdateVolume()
		ResumeChannel(Channel)
		endrem
	End Method
	
			
	Method UpdateVolume()
		rem 'Uncomment to make it not work
		Channel.SetVolume(T_profile.Me.byte_Volume_sound * (1.0 / 255))
		endrem
	End Method
End Type
Graphics 800, 600, 0
While Not (KeyDown(KEY_ESCAPE)) And Not(AppTerminate())
Wend
 
 |