Skip to content

Commit

Permalink
Added button to play/stop wav audio files
Browse files Browse the repository at this point in the history
  • Loading branch information
morphx666 committed Dec 2, 2016
1 parent 24ca3aa commit bd86980
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 19 deletions.
52 changes: 40 additions & 12 deletions SoftScope/FormMain.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions SoftScope/FormMain.resx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,26 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="ButtonPlayFile.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAYAAACoYAD2AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAANESURBVFhH1Zm5ixRBFIfXMxVcjRTECxGMTBQDMTD0BA8QVNbACxFMBAMVDxQVMyMxcAUDA/8A
AwMXQQUvTFwNBY9EVFwDD2x/X1vV1FS/7p6d3p3p+cHHVr16/fptTXXXm5qBJEk6ZY7YJ26IB+K1+CEQ
f+ljZxw//K04lZjGEqaJPeKZ+CvQJ3FP3BSnxSFxyvWxM47w57rdgjhWfBPTWMAO8VagV+KqWCEs3xj8
8Oc6RBziWb45TGPEYjEi0COxVlh+7cL1xEHEJb7ll2EaA9aJX+Kz2O5sEwXxiEt87mP5pJhGx1GBWPyz
heVTF+ISH3E/y6cwyYMC3RLW+ETDfdB+kRvPGQRTj64La3yy4H4ot+ZbOmKRQA9FPNYNuC9aIDJ76AC8
x1jIg4Gtm3Bf7v8ksLUkuVWgTSK0d5vNAmV5+IEp4oN46fq9hjzeC/LKkmSrQ6tE6NwryAORV5Yk29Ub
124K5ENeaZIsVnRZxI69hHzQIJ2h/+1kuYgdd4qngsomHqvinHjs2rMEO8sW12etsX/vdX0L8kFDdIbF
RxE7wXnhxWthjbD8YvynQwFBf2naS5Ljgv6MtJckl0R4XQx5DdMgEHVf7AAE+SrWC544dFvMF5a/545A
cwV9kvwtjri+T5K6M7wuhrxGaIwKCtTYAagBSdL3jwletn/ESWeLWSnQGeFtSwTXjTdJ8hqlMSaoqGMH
uCK+C4J6G7NzTTAzz8VGkb7PHMw4JZjvQ6dJktcYDXRYxA5gJelhJtE3MVNgo0ZEce3ZaZLklTaqZpLx
MEmKkLsC8eRvEH6MGbR2rdozWbUmv7j2dHFBID7qEyL0ZQ0i1mRoh9prsuzpviiYHd6X7wTiwnki9GOd
Ip7q0O4hyVpPd9l78qzw4uW7Wlh+/otaUYm3TKCO35NlO84u8UKYZX0A/0DRugYOBmrtOFV791TD1g1a
9m5ofBUEfVFP9kVlDo3/juNp/LdF6Ivv3dD4EwzPAYEaexbk8adqbHmTearmt9Rxn6p5mPqfgiKj7ZPZ
NiEecYlfejBrGiMWivsCsd+WBmwDricOIi7xLb8M01jANsFWhdiu6pyZE4d4lm8O01hC4399iOnS7zjJ
wD+yNbFvATmdIAAAAABJRU5ErkJggg==
</value>
</data>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAAAAAAAEAIAAGDwEAFgAAAIlQTkcNChoKAAAADUlIRFIAAAEAAAABAAgGAAAAXHKoZgAAgABJ
Expand Down
27 changes: 22 additions & 5 deletions SoftScope/FormMain.vb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Imports System.IO
Imports NAudio.Wave
Imports System.Xml.Linq

' <div>Icons made by <a href="http://www.flaticon.com/authors/madebyoliver" title="Madebyoliver">Madebyoliver</a> from <a href="http://www.flaticon.com" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div>

Public Class FormMain
Private Enum AxisAssignments
Off = 0
Expand Down Expand Up @@ -106,7 +108,7 @@ Public Class FormMain
LoadSettings()

'PlayFromFile("youscope.wav")
PlayFromFile("kickstarter192khz.wav")
'PlayFromFile("kickstarter192khz.wav")
End Sub

Private Sub SetWindowParams()
Expand Down Expand Up @@ -253,7 +255,7 @@ Public Class FormMain
End If
End Sub

AddHandler LabelAudioSource.MouseEnter, Sub() ComboBoxAudioDevices.Visible = True
AddHandler LabelAudioSource.MouseEnter, Sub() If audioOut Is Nothing Then ComboBoxAudioDevices.Visible = True
AddHandler ComboBoxAudioDevices.MouseLeave, Sub() ComboBoxAudioDevices.Visible = False
AddHandler ComboBoxAudioDevices.SelectedIndexChanged, Sub() InitAudioSource()

Expand Down Expand Up @@ -308,8 +310,23 @@ Public Class FormMain
rightChannelColor = PanelRightChannel.BackColor
End Sub

' FIXME: Cheap trick to "fix" panel rendering issue, likely caused by the AllPaintingInWmPaint flag
' FIXME: Cheap trick to "fix" panel rendering issues, likely caused by the AllPaintingInWmPaint flag
AddHandler PanelOptions.MouseMove, Sub() If PanelOptions.Visible Then PanelOptions.Refresh()

AddHandler ButtonPlayFile.Click, Sub()
If audioOut IsNot Nothing Then
StopAudioDevice()
InitAudioSource()
Else
Using dlg As New OpenFileDialog()
dlg.Filter = "WAV Files|*.wav"
If dlg.ShowDialog(Me) = DialogResult.OK Then
PanelOptions.Visible = False
PlayFromFile(dlg.FileName)
End If
End Using
End If
End Sub
End Sub

Private Sub ProcessAudio(sender As Object, e As WaveInEventArgs)
Expand Down Expand Up @@ -618,9 +635,9 @@ Public Class FormMain
End Sub
audioOut.DesiredLatency = desiredLatency
audioOut.NumberOfBuffers = numBuf
Application.DoEvents()
audioOut.Init(wp)

audioOut.Play()

Application.DoEvents()
End Sub
End Class
4 changes: 2 additions & 2 deletions SoftScope/My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("2016.12.2.1832")>
<Assembly: AssemblyFileVersion("2016.12.2.1832")>
<Assembly: AssemblyVersion("2016.12.2.1839")>
<Assembly: AssemblyFileVersion("2016.12.2.1839")>
10 changes: 10 additions & 0 deletions SoftScope/My Project/Resources.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions SoftScope/My Project/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,7 @@
<data name="icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="playIcon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\playIcon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
Binary file added SoftScope/Resources/playIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SoftScope/SoftScope.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="icon.ico" />
<None Include="Resources\playIcon.png" />
<None Include="README.md" />
<None Include="Resources\icon.png" />
</ItemGroup>
Expand Down

0 comments on commit bd86980

Please sign in to comment.