 |
 |

07-09-2004, 05:28 PM
|
|
Centurion
|
|
Join Date: Jun 2004
Posts: 113
|
|
Guitar Tuner
|
Hi guys, im making a guitar tuner which works fine but you can only play the same not once any ideas heres the code for one of the notes
Private Sub Command1_Click()
With MMControl1
.Visible = False
.FileName = "C:\Documents and Settings\guitar tuning\E string.mp3"
.Command = "Open"
.Command = "Play"
End With
End Sub
|
|

07-09-2004, 06:15 PM
|
 |
Bald Mountain Survivor
Super Moderator * Expert *
|
|
Join Date: Aug 2003
Location: Oregon, USA
Posts: 5,877
|
|
Quote:
|
Originally Posted by cooljj2003uk
Hi guys, im making a guitar tuner which works fine but you can only play the same not once any ideas heres the code for one of the notes
Private Sub Command1_Click()
With MMControl1
.Visible = False
.FileName = "C:\Documents and Settings\guitar tuning\E string.mp3"
.Command = "Open"
.Command = "Play"
End With
End Sub
|
If your creating a 'Tuner' then you only want one note to play at a time.
Perhaps you could put your code inside a timer control so that it repeats itself at regular intervals until you click a Stop Button.
What other feature did you have in mind?
~Tom
|
__________________
Burn the land and boil the sea
You can't take the sky from me
~T
|

07-09-2004, 06:24 PM
|
|
Centurion
|
|
Join Date: Jun 2004
Posts: 113
|
|
Reply
|
its ok now, my dad is slowly but surely sorting this out. i didnt want it to repeat itself what i meant was once you click on a button for that not you cant click it again unless you restart the program.
thanks anyway
|
|

07-09-2004, 06:27 PM
|
 |
Bald Mountain Survivor
Super Moderator * Expert *
|
|
Join Date: Aug 2003
Location: Oregon, USA
Posts: 5,877
|
|
Quote:
|
Originally Posted by cooljj2003uk
its ok now, my dad is slowly but surely sorting this out. i didnt want it to repeat itself what i meant was once you click on a button for that not you cant click it again unless you restart the program.
thanks anyway
|
Sorry not following your post at all. Are you saying your program locks up?
|
__________________
Burn the land and boil the sea
You can't take the sky from me
~T
|

07-09-2004, 06:32 PM
|
|
Retired Contributor
|
|
Join Date: Mar 2002
Posts: 1,829
|
|
Quote:
|
Originally Posted by cooljj2003uk
its ok now, my dad is slowly but surely sorting this out. i didnt want it to repeat itself what i meant was once you click on a button for that not you cant click it again unless you restart the program.
thanks anyway
|
This is code that will let a routine only run once.
Code:
Sub Command1_Click()
Static hasClicked as Boolean
If Not hasClicked Then
' Set the boolean and let the code run one time
hasClicked = True
Else
' You already have ran this code, so Hit the road Jack!
Exit Sub
End If
' Your code here
' It will only run one time
End Sub
|
|

07-09-2004, 06:40 PM
|
|
Centurion
|
|
Join Date: Jun 2004
Posts: 113
|
|
reply
|
Sorry about my other post It came out rong i meant to say i didnt want for it to repeat its self unless you click the button.
on my tuner i got 6 command buttons for each note. when i play one and it finishes i cant play it again it just does nothing. so i can play each note only once but i want to be able to play them as many times as i want. any ideas?
|
Last edited by cooljj2003uk; 07-09-2004 at 06:48 PM.
|

07-09-2004, 07:14 PM
|
|
Retired Contributor
|
|
Join Date: Mar 2002
Posts: 1,829
|
|
|
Well, you'd have to post your click event code then. There's no way to just "guess" at why it's doing that.
Are your 6 buttons in an array and call a common function and use an Index perhaps?
|
|

07-09-2004, 07:18 PM
|
|
Centurion
|
|
Join Date: Jun 2004
Posts: 113
|
|
reply
|
command1 - E string
command2 - A string
command3 - D string
command4 - G string
command5 - B string
command6 - e string
the code is like this
Private Sub Command1_Click()
With MMControl1
.Visible = True
.FileName = App.Path & "\E string.mp3"
.Command = "Open"
.Command = "Play"
End With
End Sub
|
|

07-09-2004, 07:29 PM
|
 |
Bald Mountain Survivor
Super Moderator * Expert *
|
|
Join Date: Aug 2003
Location: Oregon, USA
Posts: 5,877
|
|
The reason it went silent after you played it was that you did not reset it to the beginning of the track. Likewise you need to close your file before you open a new one. The following code works for me.
Code:
Option Explicit
' Uses a command button control array:
' cmdNote(0) thru cmdNote(5)
Dim FileName(5) As String
Private Sub Form_Load()
FileName(0) = "\6E.mp3"
FileName(1) = "\5A.mp3"
FileName(2) = "\4D.mp3"
FileName(3) = "\3G.mp3"
FileName(4) = "\2B.mp3"
FileName(5) = "\1E.mp3"
End Sub
Private Sub cmdNote_Click(Index As Integer)
With MMControl1
.Command = "Close"
.FileName = VB.App.Path & FileName(Index)
.Command = "Open"
.Command = "Play"
.Command = "Prev"
End With
End Sub
~Tom
|
__________________
Burn the land and boil the sea
You can't take the sky from me
~T
|

07-13-2004, 12:19 PM
|
|
Centurion
|
|
Join Date: Jun 2004
Posts: 113
|
|
Thanks
|
thanks ive finished it now
here is what i used
With MMControl1
.Visible = True
.Command = "close"
.FileName = App.Path & "\E string.mp3"
.Command = "Open"
.Command = "Play"
.Command = "prev"
End With
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
|
|
 |
|