Skip to content

Commit

Permalink
- Added playback for "ogg", "m4a", "aac", "flac" file format
Browse files Browse the repository at this point in the history
  • Loading branch information
Speedvicio committed May 19, 2024
1 parent 89313cb commit 76b119d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
2 changes: 1 addition & 1 deletion gUiADE/AudioFile.vb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
If _filename = "" Or Filename.Length <= 4 Then Exit Sub

Select Case Right(Filename, 3).ToLower
Case "mp3"
Case "mp3", "ogg", "m4a", "aac", "flac"
mciSendString("open """ & _filename & """ type mpegvideo alias audiofile", Nothing, 0, IntPtr.Zero)

Dim playCommand As String = "play audiofile from 0"
Expand Down
41 changes: 26 additions & 15 deletions gUiADE/gUiADE.vb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Public Class gUiADE
Private SW As New Stopwatch

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
OpenFileDialog1.Filter = "Archive Files|*.lha;*.lhz;*.zip;*.7z;*.rar|Common Audio|*.mp3;*.wav|Playlist|*.ade|All Files|*.*"
OpenFileDialog1.Filter = "Archive Files|*.lha;*.lhz;*.zip;*.7z;*.rar|Common Audio|*.mp3;*.ogg;*.aac;*.m4a;*.flac;*.wav|Playlist|*.ade|All Files|*.*"
OpenFileDialog1.FilterIndex = 4
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
LoadFile(OpenFileDialog1.FileName)
Expand Down Expand Up @@ -60,7 +60,7 @@ Public Class gUiADE
pModule = Path.Combine(Application.StartupPath, "temp")
PrepareList(pModule)
SoundName = Path.GetFileNameWithoutExtension(pModule).Trim
Case ".mp3", ".wav"
Case ".mp3", ".wav", ".ogg", ".aac", ".m4a", ".flac"
PlayWavMp3()
SoundName = Path.GetFileNameWithoutExtension(audio.filename).Trim
Case Else
Expand Down Expand Up @@ -150,17 +150,19 @@ Public Class gUiADE
Control_UADE("c")
If Button2.BackgroundImage Is imgStop Then
Button2.BackgroundImage = imgPlay
If LCase(Path.GetExtension(pModule)) = ".mp3" Or LCase(Path.GetExtension(pModule)) = ".wav" Then
audio.Resume()
End If
Select Case LCase(Path.GetExtension(pModule))
Case ".mp3", ".ogg", ".m4a", ".aac", ".flac", ".wav"
audio.resume()
End Select
Timer1.Start()
SW.Start()
TimerAudio.Start()
Else
Button2.BackgroundImage = imgStop
If LCase(Path.GetExtension(pModule)) = ".mp3" Or LCase(Path.GetExtension(pModule)) = ".wav" Then
audio.Pause()
End If
Select Case LCase(Path.GetExtension(pModule))
Case ".mp3", ".ogg", ".m4a", ".aac", ".flac", ".wav"
audio.Pause()
End Select
Timer1.Stop()
SW.Stop()
Threading.Thread.Sleep(TSleep)
Expand Down Expand Up @@ -371,7 +373,7 @@ Public Class gUiADE
Action_UADE("kill")

Select Case LCase(Path.GetExtension(pModule))
Case ".mp3", ".wav"
Case ".mp3", ".wav", ".ogg", ".aac", ".m4a", ".flac"
audio.Stop()
SW.Stop()
Panel1.Enabled = False
Expand Down Expand Up @@ -445,6 +447,7 @@ Public Class gUiADE

If File.ReadAllText(modulelist).Length = 0 Then
MsgBox("No supported module in this folder", MsgBoxStyle.Information + vbOKOnly, "No module...")
My.Computer.FileSystem.DeleteFile(modulelist)
Exit Sub
Else
If File.Exists(Replace(modulelist, "_CgWin", "")) Then My.Computer.FileSystem.DeleteFile(Replace(modulelist, "_CgWin", ""))
Expand Down Expand Up @@ -592,18 +595,26 @@ Public Class gUiADE
ResizeTextLabel()

Select Case ext
Case ".mp3", ".wav"
Case ".mp3", ".wav", ".ogg", ".aac", ".m4a", ".flac"
TimerAudio.Start()
Dim Astat = audio.Status.Trim
If Astat = "playing" Then
Label1.Image = Nothing
Label1.Text = "Song Name: " & scrolltext
Dim ftype As String
If ext = ".mp3" Then
ftype = "MPEG Audio Layer III "
Else
ftype = "Waveform Audio File Format"
End If
Select Case ext
Case ".mp3"
ftype = "MPEG Audio Layer III "
Case ".wav"
ftype = "Waveform Audio File Format "
Case ".ogg"
ftype = "Ogg Vorbisftype "
Case ".m4a", "aac"
ftype = "Advanced Audio Coding "
Case ".flac"
ftype = "Free Lossless Audio Codec "
End Select

Dim ts = TimeSpan.FromMilliseconds(audio.milleseconds)
Label1.Text += vbCrLf & vbCrLf & "Format Type: " & ftype & vbCrLf & vbCrLf & "Song Length: " & String.Format("{0:00}:{1:00}:{2:00}", ts.Minutes, ts.Seconds, ts.Milliseconds)
Else
Expand Down

0 comments on commit 76b119d

Please sign in to comment.