sVB-Small-Visual-Basic
sVB-Small-Visual-Basic copied to clipboard
Sound.Play function couldn't resume the mp3 where it's been paused
Version: 2.8.7.5
The Sound.Play function couldn't resume the mp3 where it's been paused; it just replays the mp3 from the very beginning.
Hi dynamicboy, I have an application where 3 balls bounce from the form sides with a boing sound, but trying to play a sound that is already playing in small intervals causes the sound to stop, so I forced the play method to first stop the played file before replaying it. I found that the best solution for your issue is to add a Resume method, which is ready now in the sVB 2.8.8 which I just published: https://marketplace.visualstudio.com/items?itemName=ModernVBNET.sVBInstaller
I didn't add the property window in this version because it still needs some work, but I reviewed the event system and made many enhancements like:
- Registering only one handler for each event.
- Add the Event.LastMouseWheelDirection to be used with the OnMouseWheel event. Without this property, this event was useless!
- I also added the Form.OnPreviewMouseWheel event.
- I moved the OnPreviewKeyUp and OnPreviewKeyDown events from the Control to the Form.
- In the codde editor, the event-handlers list now allows to select the handler name when the users presses a character that matches any uppercase character in the handler name.
- I fixed other bugs and issues you reported.
So, I hope you try this version and make sure that the issues you have reported are now gone. Thanks.
From: dynamicboy @.> Sent: Tuesday, January 2, 2024 3:26 PM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Subscribed @.***> Subject: [VBAndCs/sVB-Small-Visual-Basic] Sound.Play function couldn't resume the mp3 where it's been paused (Issue #43)
Version: 2.8.7.5
The Sound.Play function couldn't resume the mp3 where it's been paused; it just replays the mp3 from the very beginning.
— Reply to this email directly, view it on GitHubhttps://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/43, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQ5MVSPCSACVGHRXTBP3P3YMQRMDAVCNFSM6AAAAABBKF2EX2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGA3DENJXGU2DENY. You are receiving this because you are subscribed to this thread.Message ID: @.***>
Hi @VBAndCs, I have tried V2.8.8, it turns out that the issues I reported is already gone. Thanks for your dedicating.
This is details:
-
The Sound.Resume function works fine.
-
Only one handler for each event (I only tried the OnKeyDown event of the form, and it seems that the last added handler is the one that works).
-
Flow chart or geometric shapes on the form no longer block form pop-ups.
-
The toggle button's check state works correctly in both the OnClick and OnCheck events.
-
Array.IndexOf works correctly.
At last, I just found another two issues:
-
There is no difference between Colors.None and Colors.Transparent: Both delete the surface of the graphic, and the transparent area doesn't respond to mouse and keyboard events. Therefore, the intelligent description of Colors.None needs to be updated.
-
In the OnPreviewMouseWheel event and the OnMouseWheel event of the form, the value of Event.LastMouseWheelDirection is empty when the mouse wheel scrolls for the very first time.
Hi @dynamicboy, Thanks for your feedback.
-
regarding the None and Transparent colors, please provide a sample code, because I don't see this error. I tested the OnMouseMove event of a label, and it is fired when it has a transparent color and is not fired when it has a none color.
-
Your observation regards the LastMouseWheelDirection is correct. This property is defined in Mouse module so you can also use Mouse.LastMouseWheelDirection beside Event.LastMouseWheelDirection. The mouse module tracks the MouseWheel event, but this starts after the module is loaded, which doesn't happen until you use it. I fixed this by calling the Mouse.LastMouseWheelDirection when the form is loaded, so it works fine now, and until I publish the new version with this fix, you can add this code in the global area of the form: X = Mouse.LastMouseWheelDirection
Thanks
From: dynamicboy @.> Sent: Thursday, January 4, 2024 1:41 PM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Mohammad Hamdy Ghanem @.>; Mention @.> Subject: Re: [VBAndCs/sVB-Small-Visual-Basic] Sound.Play function couldn't resume the mp3 where it's been paused (Issue #43)
Hi @VBAndCshttps://github.com/VBAndCs, I have tried V2.8.8, it turns out that the issues I reported is already gone. Thanks for your dedicating.
This is details:
-
The Sound.Resume function works fine.
-
Only one handler for each event (I only tried the OnKeyDown event of the form, and it seems that the last added handler is the one that works).
-
Flow chart or geometric shapes on the form no longer block form pop-ups.
-
The toggle button's check state works correctly in both the OnClick and OnCheck events.
-
Array.IndexOf works correctly.
At last, I just found another two issues:
-
There is no difference between Colors.None and Colors.Transparent: Both delete the surface of the graphic, and the transparent area doesn't respond to mouse and keyboard events. Therefore, the intelligent description of Colors.None needs to be updated.
-
In the OnPreviewMouseWheel event and the OnMouseWheel event of the form, the value of Event.LastMouseWheelDirection is empty when the mouse wheel scrolls for the very first time.
— Reply to this email directly, view it on GitHubhttps://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/43#issuecomment-1877114119, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQ5MVV7HGIWZ4HL6OJCBDLYM2WSFAVCNFSM6AAAAABBKF2EX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZXGEYTIMJRHE. You are receiving this because you were mentioned.Message ID: @.***>
Note: I decided to change the down value of the LastMouseWheelDirection property from 0 to -1. This will eliminate thee need for the If statement in most use cases, as the LastMouseWheelDirection will carry the sign of the direction, and a simple multi[plication can increas or decreas values, such as: N = 0
Sub Label1_OnMouseWheel() N = N + Event.LastMouseWheelDirection
Label1.Text = N EndSub
This change will take effect in the next sVB update.
From: dynamicboy @.> Sent: Thursday, January 4, 2024 1:41 PM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Mohammad Hamdy Ghanem @.>; Mention @.> Subject: Re: [VBAndCs/sVB-Small-Visual-Basic] Sound.Play function couldn't resume the mp3 where it's been paused (Issue #43)
Hi @VBAndCshttps://github.com/VBAndCs, I have tried V2.8.8, it turns out that the issues I reported is already gone. Thanks for your dedicating.
This is details:
-
The Sound.Resume function works fine.
-
Only one handler for each event (I only tried the OnKeyDown event of the form, and it seems that the last added handler is the one that works).
-
Flow chart or geometric shapes on the form no longer block form pop-ups.
-
The toggle button's check state works correctly in both the OnClick and OnCheck events.
-
Array.IndexOf works correctly.
At last, I just found another two issues:
-
There is no difference between Colors.None and Colors.Transparent: Both delete the surface of the graphic, and the transparent area doesn't respond to mouse and keyboard events. Therefore, the intelligent description of Colors.None needs to be updated.
-
In the OnPreviewMouseWheel event and the OnMouseWheel event of the form, the value of Event.LastMouseWheelDirection is empty when the mouse wheel scrolls for the very first time.
— Reply to this email directly, view it on GitHubhttps://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/43#issuecomment-1877114119, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQ5MVV7HGIWZ4HL6OJCBDLYM2WSFAVCNFSM6AAAAABBKF2EX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZXGEYTIMJRHE. You are receiving this because you were mentioned.Message ID: @.***>