Wave file won't play!

I'm trying to play a wave file using resource file.

Page 1 of 1

3 Replies - 1836 Views - Last Post: 21 May 2009 - 03:08 AM Rate Topic: -----

#1 EvolutionMedia  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 125
  • Joined: 11-August 08

Wave file won't play!

Post icon  Posted 04 October 2008 - 12:39 AM

Hey

So, I re did my project in VB.NEt instead of C#. So, I put all the sound files in the resource files. I made a routine to play the sound file but it says that to make sure the sound file exists. Which it does because it played in the resource manager.

Here's the sub routine to play the sound:


  Dim sndplayer As New Media.SoundPlayer

	Public Sub TestSound(ByVal snd As String)
		My.Computer.Audio.Play(snd)




	End Sub




I thought the dim sndplayer as new media.soundplayer would help but i noticed it didn't do anything. Was I almost close when i did that?

Also, when you click on the preview button on the form it looks like this:


 Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
		If Sound1.Checked = True Then
			TestSound(My.Resources.prnk.AHHH2.ToString)

		End If
	End Sub




Any sugguestions or guidence would be greatly appreciated! Thanks!

-Paul

Is This A Good Question/Topic? 0
  • +

Replies To: Wave file won't play!

#2 EvolutionMedia  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 125
  • Joined: 11-August 08

Re: Wave file won't play!

Posted 04 October 2008 - 01:48 AM

Forget about it - I already got it! Thanks though!
Was This Post Helpful? 0
  • +
  • -

#3 bagonks  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 21-May 09

Re: Wave file won't play!

Posted 21 May 2009 - 02:04 AM

help me load playlist m3u using vb.net?

this code create using vb 6

Public Function LoadM3U(ByVal strFileName As String, ByRef strFilePaths() As String, ByRef strNames() As String) As Boolean

'Error handler
On Error GoTo ErrHap

'Declare variables
Dim lngFileNo As Long
Dim strTemp As String
Dim i As Long
Dim strLines() As String
Dim lngLines As Long
Dim strM3ULoc As String

'Check if file exists
If Dir(strFileName) <> "" Then

'Get M3U location
strM3ULoc = Left$(strFileName, InStrRev(strFileName, "\"))

'Get new file number
lngFileNo = FreeFile

'Open the file
Open strFileName For Input As lngFileNo

'Get the file
strTemp = Input(LOF(lngFileNo), #lngFileNo)

Close lngFileNo

'Split the file into it's lines
strLines = Split(strTemp, vbCrLf)

'Check that this file has enough lines
If UBound(strLines) > 2 Then

'Check that it's an M3U file
If strLines(0) = "#EXTM3U" Then

'Get number of lines
lngLines = UBound(strLines)

'Attention! If you have any errors over the next 2 lines then you need to make sure
'that you have declared the array variables without specifying their size,
'because here we're changing their sizes to match. - Thanks
ReDim strFilePaths(0 To (lngLines / 2)) As String
ReDim strNames(0 To (lngLines / 2)) As String

'Loop through each line
For i = 1 To lngLines

'Check what kind of data we've got
If Left$(strLines(i), 7) = "#EXTINF" Then

'File name & length (but we don't return that). Get file name
strNames((i - 1) / 2) = Right$(strLines(i), Len(strLines(i)) - InStr(1, strLines(i), ","))

Else
'File path. Verify the path
If Dir(strLines(i)) <> "" Then
'Pure path, including drive letter
strFilePaths((i / 2) - 1) = strLines(i)
ElseIf Dir(strM3ULoc & strLines(i)) <> "" Then
'Adding onto the M3U's path (most common)
strFilePaths((i / 2) - 1) = strM3ULoc & strLines(i)
ElseIf Dir(Left$(strM3ULoc, 3) & strLines(i)) <> "" Then
'Adding onto the M3U's drive only
strFilePaths((i / 2) - 1) = Left$(strM3ULoc, 3) & strLines(i)
Else
'Display error message
Call MsgBox("Cannot find file!" & vbCrLf & strLines(i), vbExclamation, "Error while loading a file!")
End If
End If

Next i

'Set return value to true
LoadM3U = True

End If

Else
'Return error
LoadM3U = False
End If

Else
'Return error
LoadM3U = False
End If

Exit Function
ErrHap:
'Check error
If Err.Number = 10 Then
'Display message and exit function
Call MsgBox("Cannot accept fixed length arrays!", vbExclamation, "Error - Function 'LoadM3U'")
Exit Function
End If

'Display error
Call MsgBox(Err.Description & " Number: " & Err.Number, vbExclamation)

'Set return value
LoadM3U = False

End Function

please top code convert to vb.net
please
please
Was This Post Helpful? 0
  • +
  • -

#4 firebolt  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 92
  • View blog
  • Posts: 5,561
  • Joined: 20-February 09

Re: Wave file won't play!

Posted 21 May 2009 - 03:08 AM

@bagonks,

It is best to start a new thread then continue on from one that is about half a year old. Make a new one and describe the problems which have occured. Thanks.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1