Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


mp3 player glitch


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-11-2008, 09:30 AM
Junior Member
 
Join Date: Sep 2007
Posts: 28
Default mp3 player glitch

Hello again,

I've written a simple mp3 player but have a small glitch. I'm using a trackbar to show/control the position in the mp3 file. Once the file is playing a timer is set so that once a second I update the trackbar position. I would like however for the user to be able to change the position of the trackbar as well using sub trackbar_valuechanged.

What happens however is that when the timer event is triggered the trackbar_valuechanged is subsequently triggered as well because the trackbar value is changed programatically. The sub trackbar_valuechanged then reassigns fmod.position which causes a small tick in the audio playback.

Has anybody found the same problem?

Thanks
Reply With Quote
  #2 (permalink)  
Old 03-11-2008, 12:02 PM
Junior Member
 
Join Date: Sep 2007
Posts: 28
Default

OK!

Now to answer my own question... Using a global variable to keep track of the previous trackbar value I can reduce the effect. If the trackbar has changed significantly, the user moved the trackbar, only then do I change fmod.position. This works good enough.
Reply With Quote
  #3 (permalink)  
Old 03-11-2008, 12:06 PM
Junior Member
 
Join Date: Feb 2008
Posts: 17
Default

kolbe,

one way of solving your problem would be to declare a global variable that your trackbar ValueChanged sub can use to differentiate a change made within the program from a change made by user input. In this example, the code in bar_ValueChanged only executes if the change DOES NOT come from Timer1_Tick:

Sub Globals
Dim auto_change
End Sub

Sub Timer1_Tick
auto_change=true
' change bar.value here
auto_change=false
End Sub

Sub bar_ValueChanged
If auto_change=false Then
' change fmod.position here
End If
End Sub
Reply With Quote
  #4 (permalink)  
Old 03-11-2008, 06:20 PM
Senior Member
 
Join Date: May 2007
Posts: 188
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default track bar

I had the same problem and decided to show the advance of the song by a progress bar, and allow the user to select a new point in the song by moving the track bar - but the track bar is not moving, only by the user:

Sub Timer1_Tick
...
progressBar1.Value = fmod.Position / fmod.Length1 * 100
...
end sub

Sub Bar1_ValueChanged
fmod.Position = bar1.Value * fmod.Length1 /100
End Sub

not ellegant but efficient...
Attached Images
File Type: jpg Screen01.jpg (12.5 KB, 22 views)
__________________
David Erez
Ramat Hasharon, Israel
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to play 3gp file in Windows media player vijay_vrc Questions & Help Needed 1 11-04-2008 12:55 AM
Mp3 Player Thexmachine Portuguese Forum 2 08-20-2008 01:53 PM
player-recorder derez Share Your Creations 0 03-13-2008 10:26 AM
Flash Player Control alfcen Basic4ppc Wishlist 1 05-27-2007 12:51 PM


All times are GMT. The time now is 09:59 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0