os dejo, y en particular a v3ctor , un siiimple ejemplo que utiliza Extern para conocer con las funciones externas de SDL2 los dispositivos audio del nuestro sistema.
Library "libSDL2-2.0:0.2.0"
Private Const SDL_INIT_AUDIO As Integer = 16
' int SDL_Init(Uint32 flags)
' Initialize the SDL library.
Private Extern SDL_Init(flags As Integer) As Integer
' int SDL_GetNumAudioDrivers(void)
' Returns the number of built in audio drivers.
Private Extern SDL_GetNumAudioDrivers() As Integer
' const char* SDL_GetAudioDriver(int index)
' Returns the name of the audio driver at the requested index, or NULL if an invalid index was specified.
Private Extern SDL_GetAudioDriver(index As Integer) As String
' const char* SDL_GetCurrentAudioDriver(void)
' Returns the name of the current audio driver or NULL if no driver has been initialized.
Private Extern SDL_GetCurrentAudioDriver() As String
' int SDL_GetNumAudioDevices(int iscapture)
' Returns the number of available devices exposed by the current driver or -1 if an explicit list of devices can't be determined.
Private Extern SDL_GetNumAudioDevices(iscapture As Integer) As Integer
' const char* SDL_GetAudioDeviceName(int index, int iscapture)
' Returns the name of the audio device at the requested index, or NULL on error.
Private Extern SDL_GetAudioDeviceName(index As Integer, iscapture As Integer) As String
' void SDL_Quit(void)
' Clean up all initialized subsystems.
Private Extern SDL_Quit()
Public Sub Main()
Dim n, i As Integer
' Inicializa la libreria SDL2:
If SDL_Init(SDL_INIT_AUDIO) < 0 Then Error.Raise("Imposibile inicializar la libreria SDL2 !")
' Muestra los dispositivos audio disponibles:
n = SDL_GetNumAudioDrivers()
If n = 0 Then
Print "Ningunos driver audio presente en el sistema !\n\n"
Else
Print "Driver audio presente en el sistema:"
For i = 0 To n - 1
Print " "; SDL_GetAudioDriver(i)
Next
Endif
Print "\nDriver audio utilizado: \n "; SDL_GetCurrentAudioDriver()
Dispositivi(0)
Dispositivi(1)
SDL_Quit()
End
Private Procedure Dispositivi(captura As Integer)
Dim ts As String
Dim n, i As Integer
ts = IIf(captura, "captura", "salida")
n = SDL_GetNumAudioDevices(captura)
Print "\nDispositivos de "; ts; ":"
If n = -1 Then
Print " El driver no puede averiguar específicos dispositivos "; ts; "."
Else If n = 0 Then
Print " Ningún dispositivo de "; ts; " encontrado."
Else
For i = 0 To n - 1
Print " "; SDL_GetAudioDeviceName(i, captura)
Next
Endif
End
Private Const SDL_INIT_AUDIO As Integer = 16
' int SDL_Init(Uint32 flags)
' Initialize the SDL library.
Private Extern SDL_Init(flags As Integer) As Integer
' int SDL_GetNumAudioDrivers(void)
' Returns the number of built in audio drivers.
Private Extern SDL_GetNumAudioDrivers() As Integer
' const char* SDL_GetAudioDriver(int index)
' Returns the name of the audio driver at the requested index, or NULL if an invalid index was specified.
Private Extern SDL_GetAudioDriver(index As Integer) As String
' const char* SDL_GetCurrentAudioDriver(void)
' Returns the name of the current audio driver or NULL if no driver has been initialized.
Private Extern SDL_GetCurrentAudioDriver() As String
' int SDL_GetNumAudioDevices(int iscapture)
' Returns the number of available devices exposed by the current driver or -1 if an explicit list of devices can't be determined.
Private Extern SDL_GetNumAudioDevices(iscapture As Integer) As Integer
' const char* SDL_GetAudioDeviceName(int index, int iscapture)
' Returns the name of the audio device at the requested index, or NULL on error.
Private Extern SDL_GetAudioDeviceName(index As Integer, iscapture As Integer) As String
' void SDL_Quit(void)
' Clean up all initialized subsystems.
Private Extern SDL_Quit()
Public Sub Main()
Dim n, i As Integer
' Inicializa la libreria SDL2:
If SDL_Init(SDL_INIT_AUDIO) < 0 Then Error.Raise("Imposibile inicializar la libreria SDL2 !")
' Muestra los dispositivos audio disponibles:
n = SDL_GetNumAudioDrivers()
If n = 0 Then
Print "Ningunos driver audio presente en el sistema !\n\n"
Else
Print "Driver audio presente en el sistema:"
For i = 0 To n - 1
Print " "; SDL_GetAudioDriver(i)
Next
Endif
Print "\nDriver audio utilizado: \n "; SDL_GetCurrentAudioDriver()
Dispositivi(0)
Dispositivi(1)
SDL_Quit()
End
Private Procedure Dispositivi(captura As Integer)
Dim ts As String
Dim n, i As Integer
ts = IIf(captura, "captura", "salida")
n = SDL_GetNumAudioDevices(captura)
Print "\nDispositivos de "; ts; ":"
If n = -1 Then
Print " El driver no puede averiguar específicos dispositivos "; ts; "."
Else If n = 0 Then
Print " Ningún dispositivo de "; ts; " encontrado."
Else
For i = 0 To n - 1
Print " "; SDL_GetAudioDeviceName(i, captura)
Next
Endif
End