Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Help Me Please (multimedia sort of)

Posted on 1998-08-04
15
Medium Priority
?
226 Views
Last Modified: 2010-05-03
Okay.  I have this program that can play a Midi file (.mid).  and I have a scroll bar that shows the position of the midi while it is playing.  I want the user to be able to click on the scroll bar (the little box) and move it  and when they let go then the midi is in the position of where the scroll bar is.  I am using the Microsoft Multimedia Control.  Please help me
0
Comment
Question by:aquakid
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 4
15 Comments
 

Author Comment

by:aquakid
ID: 1467842
Adjusted points to 100
0
 
LVL 6

Expert Comment

by:clifABB
ID: 1467843
Are you using MMControl, or API?
0
 

Expert Comment

by:woodworker
ID: 1467844
Set the timeformat property of the media control to one that you are comfortable using such as milliseconds. Set the min and max properties of your scrollbar based on the media control length property.  in your change event for the scroll bar figure the position you want to move to in the media control based on the value of the scroll bar. Use the Command property of the media control to "Seek" the position you want.

  MMControl1.Notify = False
  MMControl1.Wait = True
  MMControl1.TimeFormat = 0  'milliseconds
  MMControl1.To = HScroll1.Value
  MMControl1.Command = "Seek"
  MMControl1.Command = "Play"

Let me know if this helps, if it does I guess I can then submit it as an answer.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:aquakid
ID: 1467845
So that code that you have added to your answer is what I put in the Sub_Change of my Scroll Bar (Hscroll1) ??
0
 

Author Comment

by:aquakid
ID: 1467846
So that code that you have added to your answer is what I put in the Sub_Change of my Scroll Bar (Hscroll1) ??
0
 

Author Comment

by:aquakid
ID: 1467847
I tried everything I could think of with that code of yours and nothing would work!  What do you suggest?
0
 
LVL 6

Expert Comment

by:clifABB
ID: 1467848
The code that woodworker supplied would probably go in a command button.  Once a midi is playing you cannot change it's end point.  You will have to stop the midi and then use the scroll bar.
0
 

Expert Comment

by:woodworker
ID: 1467849
My intent was for that to go in the scrollbar change event.  I don't have a sound card here at work, I had to use my cd player with headphones.  It worked fine on that, maybe a midi file is different.
0
 

Author Comment

by:aquakid
ID: 1467850
Well, I have tried it all.  If you look at Microsoft's Media Player you can see what I am talking about.  and it doesn't seem that the midi file is being stopped and then played again in another spot.  Are you sure you don't have any other Ideas?  When I put your code into the CHange event in the Scroll Bar then it messes up because I have a timer telling the scroll bar to move according to the position of the MIdi file as it is being played. and everytime that it moves it is a change event.  SO I am confused right now.  Please, if you have any other Ideas then I would like to hear them.  Thank you all for helping me out here though.  I appreciate the help.
0
 
LVL 6

Expert Comment

by:clifABB
ID: 1467851
A midi shouldn't be any different from a cd for this purpose.
I stand corrected.  Checking your code, this should work.

aquakid: What is the scrollbars Max property set to?  Do you set it to the Length property of MMControl (if not, you should)?
0
 
LVL 6

Expert Comment

by:clifABB
ID: 1467852
MS Media player doesn't use a scroll bar.  They use a combination of picture boxes. (one for the scroll area, one for the button)
0
 

Expert Comment

by:woodworker
ID: 1467853
aquakid, I had to wait until I got home to play with this more.  I got it all to work with a midi file except for the flickering scroll bar.  I started to figure that out and now I have to leave for dinner.  here is my hacked together form code.  This keeps the flickering from happening until the first time you move the scroll bar.

Option Explicit
Private bChangedBySelf As Boolean

Private Sub Form_Load()
  MMControl1.Notify = False
  MMControl1.Wait = True
  MMControl1.Shareable = False
  MMControl1.DeviceType = "Sequencer"
  MMControl1.filename = "C:\WINDOWS\canyon.mid"

  MMControl1.Command = "Open"
  MMControl1.TimeFormat = 0
  If MMControl1.length < 32767 Then
    HScroll1.max = MMControl1.length
  End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
  MMControl1.Command = "Close"
End Sub

Private Sub HScroll1_Change()
  Dim length As Long
  Dim factor As Long
  Dim max As Long
 
  If Not bChangedBySelf Then
    MMControl1.TimeFormat = 0
    length = MMControl1.length
    factor = 1
    max = HScroll1.max
    If length > max Then
      factor = length \ max
    End If
   
   
    MMControl1.To = (factor * HScroll1.Value)
    MMControl1.Command = "Seek"
    MMControl1.Command = "Play"
  End If
  Timer1.Enabled = True
End Sub

Private Sub HScroll1_GotFocus()
  Timer1.Enabled = False
End Sub

Private Sub Timer1_Timer()
  Dim length As Long
  Dim factor As Long
  Dim x As Long
  Dim max As Long
'  Static bBusy As Boolean
'
'  If bBusy Then
'    Exit Sub
'  End If
'  bBusy = True
  Timer1.Enabled = False
  MMControl1.TimeFormat = 0
  length = MMControl1.length
  factor = 1
  max = HScroll1.max
  If length > max Then
    factor = length \ max
  End If
 
 
  x = MMControl1.Position
  bChangedBySelf = True
  HScroll1.Value = x \ factor
  bChangedBySelf = False
  Timer1.Enabled = True
'  bBusy = False
 
End Sub

0
 

Author Comment

by:aquakid
ID: 1467854
Hey, I am at a different COmputer now, With out Visual Basic.  I looked over the code and I am sure It will work.  Thank you for all of your help guys!  I am very pleased with the hard work you have put into it.  Thanks again!

Jason Waters
aquakid@iname.com
http://come.to/aquakid/
0
 

Author Comment

by:aquakid
ID: 1467855
will I be able to see this for future reference?
0
 

Accepted Solution

by:
woodworker earned 400 total points
ID: 1467856
see text above
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question