Determine audio driver used by bmax.

BlitzMax Forums/BlitzMax Programming/Determine audio driver used by bmax.

hub(Posted 2009) [#1]
Hi !
Since 1.35 and 1.36 bmax version sounds and musics not works correctly into my game. This is a big project now difficult to debug...

i've just noticed that if i comment these following lines and let bmax automatically choose the audio driver my game works...

	If gbPasDeSon = False Then
		Local n
		If AudioDriverExists(Config.Pilote_audio$) = True Then
			n = SetAudioDriver(Config.Pilote_audio$) 
			If n = Null Then
				Notify CTE_PHRASE_PILOTE_SONS$ + Config.Pilote_audio$ + " !"
				gbPasDeSon = True
			End If
		Else
			Notify "Driver audio non trouvé '" + Config.Pilote_audio$ + "' ?"
		End If
	End If


So Is there a way to know the audio driver automatically used by blitzmax ?


(to play a music or a sound i use this code inside the game :
	Function Jouer_musique:TSonGeneral(hMusique:TSound)

		
		If gbPasDeSon = False Then
		

			If Channel_musique_Generale <> Null Then StopChannel Channel_musique_Generale
			
			Channel_musique_Generale = PlaySound (hMusique)
			If Channel_musique_Generale = Null Then
				Arreter_programme ("problème channel audio !!!")
			End If
			Channel_musique_Generale.SetVolume(Config.Volume_musique#)	
			ResumeChannel Channel_musique_Generale
			
		End If
						
	End Function

	Function Jouer_son(hSon:TSound, Pan#,Profondeur#, Volume#)
		
		If gbPasDeSon = False Then
		
			Local bJouer_son = True
			
			Local Temps_local = MilliSecs()
			
			For Local s:TSonGeneral = EachIn Liste_channels
				If s.Channel.Playing() = False Then
					Liste_channels.remove s
				End If
			Next
			
			For Local s:TSonGeneral = EachIn Liste_channels
				If s.hSon = hSon And s.Genre=1 Then
					If s.Temps_debut > Temps_local + Temps_latence_son Or s.Temps_debut < Temps_local - Temps_latence_son Then
						If s.Pan# = Pan# And s.Profondeur# = Profondeur# Then
							bJouer_son = False
							Exit
						End If
					End If
			End If	
			Next
			
			If bJouer_son = True Then
			
			
				Local s:TSonGeneral = New TSonGeneral
				
				s.Channel = AllocChannel()
				s.Channel.setvolume (Volume#)
				SetChannelPan s.Channel, Pan#
				SetChannelDepth s.Channel,Profondeur#		
				PlaySound (hSon, s.Channel)

				s.hSon = hSon
				s.Temps_debut = Temps_local
				s.pan# = pan#
				s.Profondeur# = Profondeur#
				s.Genre = 1
				
				ListAddLast Liste_channels , s	
				
'			Else Notify "zappé"		
				
			End If
			
		End If
		
	End Function



Thanks for your help !


Tachyon(Posted 2009) [#2]
Not really. I manually add this to the bottom of my audio.bmx file:

Function GetAudioDriver$()
    Return Driver().Name()
End Function

This function does just as it says: returns the name of the current sound driver. I have begged on several occasions to have it formally added to BlitzMax.


hub(Posted 2009) [#3]
Thanks Tachyon