Public Sub Button2_Click()
FMain.Sonido.Atencion.Play
End
Public Sub Button1_Click()
Dim RutaX, Extencion As String
Dialog.Filter = ["*.ogg", ("Archivos de sonido ogg"), "*.wav", ("Archivos de sonido wav")]
Dialog.Path = User.Home
If Dialog.OpenFile() Then Return
Extencion = File.Ext(Dialog.Path)
TextBox1.Text = Dialog.Path
Select Case Extencion
Case "ogg", "wav"
Case Else
FMain.SonidoError.Play
Message.Error("El archivo " & File.Name(Dialog.Path) & gb.NewLine & "no es un archivo admitido por el programa" & gb.NewLine & "por favor elija archivos de sonido con extencion .ogg / .wav")
Return
End Select
FMain.cfg.Atencion = Dialog.Path
End
FMain.Sonido.Atencion.Play
End
Public Sub Button1_Click()
Dim RutaX, Extencion As String
Dialog.Filter = ["*.ogg", ("Archivos de sonido ogg"), "*.wav", ("Archivos de sonido wav")]
Dialog.Path = User.Home
If Dialog.OpenFile() Then Return
Extencion = File.Ext(Dialog.Path)
TextBox1.Text = Dialog.Path
Select Case Extencion
Case "ogg", "wav"
Case Else
FMain.SonidoError.Play
Message.Error("El archivo " & File.Name(Dialog.Path) & gb.NewLine & "no es un archivo admitido por el programa" & gb.NewLine & "por favor elija archivos de sonido con extencion .ogg / .wav")
Return
End Select
FMain.cfg.Atencion = Dialog.Path
End
Clase cfgAudio que administra las rutas de los audios a ejecutar
' gambas class file
Property Atencion As String
Property Hecho As String
Property ConfigAudio As Settings
Private $Atencion As String
Private $hecho As String
Private $ConfigAudio As Settings
Public Sub _new(nombre As String, ruta As String)
Dim archivo As String
archivo = ruta &/ nombre
Print "ruta archivo Settings=" & archivo
$ConfigAudio = New Settings(archivo, nombre)
If Not Exist(archivo) Then
$ConfigAudio["Partido/Atencion"] = "Sonidos/Error2.ogg"
$ConfigAudio["Partido/Hecho"] = "Sonidos/go.ogg"
$ConfigAudio.Save
Endif
$Atencion = $ConfigAudio["Partido/Atencion"]
$hecho = $ConfigAudio["Partido/Hecho"]
End
Private Function Atencion_Read() As String
Return $Atencion
End
Private Sub Atencion_Write(Value As String)
$Atencion = Value
$ConfigAudio["Partido/Atencion"] = $Atencion
$ConfigAudio.Save
End
Private Function Hecho_Read() As String
Return $hecho
End
Private Sub Hecho_Write(Value As String)
$hecho = Value
End
Private Function ConfigAudio_Read() As Settings
Return $ConfigAudio
End
Private Sub ConfigAudio_Write(Value As Settings)
$ConfigAudio = Value
End
Property Atencion As String
Property Hecho As String
Property ConfigAudio As Settings
Private $Atencion As String
Private $hecho As String
Private $ConfigAudio As Settings
Public Sub _new(nombre As String, ruta As String)
Dim archivo As String
archivo = ruta &/ nombre
Print "ruta archivo Settings=" & archivo
$ConfigAudio = New Settings(archivo, nombre)
If Not Exist(archivo) Then
$ConfigAudio["Partido/Atencion"] = "Sonidos/Error2.ogg"
$ConfigAudio["Partido/Hecho"] = "Sonidos/go.ogg"
$ConfigAudio.Save
Endif
$Atencion = $ConfigAudio["Partido/Atencion"]
$hecho = $ConfigAudio["Partido/Hecho"]
End
Private Function Atencion_Read() As String
Return $Atencion
End
Private Sub Atencion_Write(Value As String)
$Atencion = Value
$ConfigAudio["Partido/Atencion"] = $Atencion
$ConfigAudio.Save
End
Private Function Hecho_Read() As String
Return $hecho
End
Private Sub Hecho_Write(Value As String)
$hecho = Value
End
Private Function ConfigAudio_Read() As Settings
Return $ConfigAudio
End
Private Sub ConfigAudio_Write(Value As Settings)
$ConfigAudio = Value
End
Clase Audio que se encarga de ejecutar sonidos
gambas class file
Property Atencion As Sound
Property Hecho As Sound
Property cfg As CfgAudio
Private $Atencion As Sound
Private $Hecho As Sound
Private $cfg As CfgAudio
Public Sub _new(cfg As CfgAudio)
$Atencion = Sound.Load(cfg.Atencion)
$Hecho = Sound.Load(cfg.Hecho)
$cfg = cfg
End
Private Function Atencion_Read() As Sound
$Atencion = Sound.Load($cfg.Atencion)
Return $Atencion
End
Private Sub Atencion_Write(Value As Sound)
$Atencion = Value
End
Private Function Hecho_Read() As Sound
$Hecho = Sound.Load($cfg.Hecho)
Return $Hecho
End
Private Sub Hecho_Write(Value As Sound)
$Hecho = Value
End
Private Function cfg_Read() As CfgAudio
Return $cfg
End
Private Sub cfg_Write(Value As CfgAudio)
$cfg = Value
End
Property Atencion As Sound
Property Hecho As Sound
Property cfg As CfgAudio
Private $Atencion As Sound
Private $Hecho As Sound
Private $cfg As CfgAudio
Public Sub _new(cfg As CfgAudio)
$Atencion = Sound.Load(cfg.Atencion)
$Hecho = Sound.Load(cfg.Hecho)
$cfg = cfg
End
Private Function Atencion_Read() As Sound
$Atencion = Sound.Load($cfg.Atencion)
Return $Atencion
End
Private Sub Atencion_Write(Value As Sound)
$Atencion = Value
End
Private Function Hecho_Read() As Sound
$Hecho = Sound.Load($cfg.Hecho)
Return $Hecho
End
Private Sub Hecho_Write(Value As Sound)
$Hecho = Value
End
Private Function cfg_Read() As CfgAudio
Return $cfg
End
Private Sub cfg_Write(Value As CfgAudio)
$cfg = Value
End
la idea es tener dos objetos uno que ejecuta sonidos y el otro que le administra las rutas de los archivos de audio.
estoy haciendo bien?
es programación orientada a objetos
voy bien o esta mal mi planteo?