Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Guitar Tuner


Reply
 
Thread Tools Display Modes
  #1  
Old 07-09-2004, 05:28 PM
cooljj2003uk cooljj2003uk is offline
Centurion
 
Join Date: Jun 2004
Posts: 113
Question 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
Reply With Quote
  #2  
Old 07-09-2004, 06:15 PM
Gruff's Avatar
Gruff Gruff is offline
Bald Mountain Survivor

Super Moderator
* Expert *
 
Join Date: Aug 2003
Location: Oregon, USA
Posts: 6,294
Default

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
Reply With Quote
  #3  
Old 07-09-2004, 06:24 PM
cooljj2003uk cooljj2003uk is offline
Centurion
 
Join Date: Jun 2004
Posts: 113
Default 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
Reply With Quote
  #4  
Old 07-09-2004, 06:27 PM
Gruff's Avatar
Gruff Gruff is offline
Bald Mountain Survivor

Super Moderator
* Expert *
 
Join Date: Aug 2003
Location: Oregon, USA
Posts: 6,294
Default

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
Reply With Quote
  #5  
Old 07-09-2004, 06:32 PM
Agent707 Agent707 is offline
Retired Contributor
 
Join Date: Mar 2002
Posts: 1,829
Default

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
Reply With Quote
  #6  
Old 07-09-2004, 06:40 PM
cooljj2003uk cooljj2003uk is offline
Centurion
 
Join Date: Jun 2004
Posts: 113
Default 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.
Reply With Quote
  #7  
Old 07-09-2004, 07:14 PM
Agent707 Agent707 is offline
Retired Contributor
 
Join Date: Mar 2002
Posts: 1,829
Default

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?
Reply With Quote
  #8  
Old 07-09-2004, 07:18 PM
cooljj2003uk cooljj2003uk is offline
Centurion
 
Join Date: Jun 2004
Posts: 113
Default 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
Reply With Quote
  #9  
Old 07-09-2004, 07:29 PM
Gruff's Avatar
Gruff Gruff is offline
Bald Mountain Survivor

Super Moderator
* Expert *
 
Join Date: Aug 2003
Location: Oregon, USA
Posts: 6,294
Default

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
Reply With Quote
  #10  
Old 07-13-2004, 12:19 PM
cooljj2003uk cooljj2003uk is offline
Centurion
 
Join Date: Jun 2004
Posts: 113
Default 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
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->