I not found thread code delegate PositionChanging EventHandler (Timer Position) , Help me :)
Hello,
also in this case I cannot understand what you exactly mean: please, try to be more specific and detailed in your questions and, by the way, you should at least specify which of our components you are speaking about :)
Kind Regards
Severino Delaurenti
MultiMedia Soft
Quote from: Administrator on July 10, 2015, 10:25:17 AM
Hello,
also in this case I cannot understand what you exactly mean: please, try to be more specific and detailed in your questions and, by the way, you should at least specify which of our components you are speaking about :)
Kind Regards
Severino Delaurenti
MultiMedia Soft
The DJ studio has events thread is Song startting event, Song pausing event and Song stopping event , but has not event thread position changing is timer for song current postion.
Hello,
now it's clear what you need :)
Effectively there is no event provided for this purpose: the suggestion is to use the same approach used in some of the samples, for example the TestPlayers sample, which create an instance of a timer (where you can select the delay) and, inside the timer's event handler, perform a call to the SoundPositionGet method or, in alternative if you need to display a string of the current position, a call to the SoundPositionStringGet method.
Kind regards
Severino Delaurenti
MultiMedia Soft
Quote from: Administrator on July 10, 2015, 12:06:28 PM
Hello,
now it's clear what you need :)
Effectively there is no event provided for this purpose: the suggestion is to use the same approach used in some of the samples, for example the TestPlayers sample, which create an instance of a timer (where you can select the delay) and, inside the timer's event handler, perform a call to the SoundPositionGet method or, in alternative if you need to display a string of the current position, a call to the SoundPositionStringGet method.
Kind regards
Severino Delaurenti
MultiMedia Soft
I'm not want using Timer1 on the Form1 for changing current sound position.
But, i wanted Delegate Timer EventHandler and Current Position Change EventHandler.
Hello,
if you need to change the current sound position the way to go is the SeekSound method.
Kind regards
Severino Delaurenti
MultiMedia Soft
Quote from: Administrator on July 11, 2015, 12:24:15 AM
Hello,
if you need to change the current sound position the way to go is the SeekSound method.
Kind regards
Severino Delaurenti
MultiMedia Soft
The SeekSound method using with mouse scrolling event method.
It cann't using with timer position events.
EG: my sample codes
Class sample:
Option Explicit Off
Option Strict On
Imports AMP3DJLib
Imports AxAMP3DJLib
Public NotInheritable Class AxDjStudio
Inherits Object
Private Shared WithEvents AxAmp3dj1 As AxAmp3dj
Private Shared sPlayer As Short
Private Shared sFilename As String
Shared Sub New()
AxAmp3dj1 = New AxAmp3dj
sPlayer = 0
sFilename = String.Empty
End Sub
#Region "DjStudio methods Fields"
Public Shared Function InitSound(ByVal nTotalPlayers As Short, ByVal hWndParent As Integer) As Short
Return AxAmp3dj1.InitDJSystem(nTotalPlayers, hWndParent, 0, 0, 0, -1)
End Function
Public Shared Sub ControlAdd(ByVal win As Control)
win.Controls.Add(AxAmp3dj1)
Return
End Sub
Public Shared Function LoadSound(ByVal nPlayer As Short, ByVal strFilename As String) As enumErrorCodes
sFilename = strFilename
sPlayer = nPlayer
Return AxAmp3dj1.LoadSound(sPlayer, sFilename)
End Function
Public Shared Function PlaySound(ByVal nPlayer As Short) As enumErrorCodes
sPlayer = nPlayer
PosTime.Enabled = True
Return AxAmp3dj1.PlaySound(sPlayer)
End Function
Public Shared Function PauseSound(ByVal nPlayer As Short) As enumErrorCodes
sPlayer = nPlayer
Return AxAmp3dj1.PauseSound(sPlayer)
End Function
Public Shared Function StopSound(ByVal nPlayer As Short) As enumErrorCodes
sPlayer = nPlayer
Return AxAmp3dj1.StopSound(sPlayer)
End Function
Public Shared Function Duration(ByVal nPlayer As Short) As Integer
sPlayer = nPlayer
Return AxAmp3dj1.GetSoundDuration(sPlayer)
End Function
Public Shared Function DurationString(ByVal nPlayer As Short, ByVal formats As String) As String
sPlayer = nPlayer
Select Case formats
Case "mm:ss"
Return AxAmp3dj1.SoundDurationStringGet(sPlayer, enumBoolean.BOOL_FALSE, enumBoolean.BOOL_FALSE, ":", ":", 0, enumBoolean.BOOL_TRUE)
Case Else
GoTo LIO
End Select
LIO:
Return Nothing
End Function
Public Shared Function PositionString(ByVal nPlayer As Short, ByVal formats As String) As String
sPlayer = nPlayer
Select Case formats
Case "mm:ss"
Return AxAmp3dj1.GetCurrentPosString(sPlayer, enumBoolean.BOOL_FALSE, enumBoolean.BOOL_FALSE)
Case Else
GoTo LIO
End Select
LIO:
Return Nothing
End Function
Public Shared Function MaxPosition(ByVal nPlayer As Short) As Integer
sPlayer = nPlayer
Return Duration(sPlayer)
End Function
Public Shared Function CurrentPosition(ByVal nPlayer As Short) As Integer
sPlayer = nPlayer
Return AxAmp3dj1.GetCurrentPos(sPlayer)
End Function
Public Shared Function SetPosition(ByVal nPlayer As Short, ByVal nOffset As Integer) As enumErrorCodes
sPlayer = nPlayer
Return AxAmp3dj1.SeekSound(sPlayer, nOffset)
End Function
Public Shared Function Status(ByVal nPlayer As Short) As String
sPlayer = nPlayer
Dim retStatus As String = Nothing
Select Case AxAmp3dj1.GetPlayerStatus(sPlayer)
Case enumStates.SOUND_BUFFERING
retStatus = "Buffering"
Case enumStates.SOUND_NONE
retStatus = "None"
Case enumStates.SOUND_PAUSED
retStatus = "Paused"
Case enumStates.SOUND_PLAYING
retStatus = "Playing"
Case enumStates.SOUND_STOPPED
retStatus = "Stopped"
Case Else
Exit Select
End Select
Return retStatus
End Function
Public Shared Function GetFileInfo() As String
Dim s As String = FileIO.FileSystem.GetFileInfo(sFilename).FullName.ToString
Dim parts As String() = s.Split(New Char() {"\"c})
Dim retPath As String = Nothing
For Each part As String In parts
retPath &= part & vbCrLf
Next part
Return retPath
End Function
#End Region
#Region "DjStudio Events Fields"
Public Shared Sub SyncTimeObject(ByVal hWnd As Form)
PosTime.SynchronizingObject = hWnd
PosTime.Enabled = False
End Sub
Private Shared Sub PosTime_Elapsed(ByVal sender As Object, ByVal e As EventArgs) Handles PosTime.Elapsed
Try
RaiseEvent PositionChange(sender, e)
If AxAmp3dj1.GetPlayerStatus(sPlayer) = enumStates.SOUND_STOPPED Then
PosTime.Enabled = False
RaiseEvent SoundStopping(sender, New EventArgs)
End If
Catch
PosTime.Enabled = False
RaiseEvent SoundEnding(sender, New EventArgs)
End Try
End Sub
Private Shared WithEvents PosTime As New System.Timers.Timer
Public Shared Event PositionChange(ByVal sender As Object, ByVal e As EventArgs)
Public Shared Event SoundEnding As EventHandler
Public Shared Event SoundStopping As EventHandler
#End Region
End Class
Form sample:
Option Explicit Off
Option Strict On
Imports System
Public Class Form1
Inherits Form
Private btnLoad As Button
Private btnPlay As Button
Private btnPause As Button
Private btnStop As Button
Private lblDuration As Label
Private lblPosition As Label
Private lblStatus As Label
Private lblTag As Label
Private ofdlg As OpenFileDialog
Private trackPos As TrackBar
Private nPlayer As Short
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If AxDjStudio.InitSound(1, Me.Handle.ToInt32) = 0 Then
MsgBox("Error! init sound system.")
Exit Sub
End If
End Sub
Public Sub New()
MyBase.New()
Me.StartPosition = FormStartPosition.CenterScreen
InitializeComponent()
ofdlg = New OpenFileDialog
btnLoad = New Button
btnLoad.Text = "Load"
btnPlay = New Button
btnPlay.Text = "Play"
btnPlay.Location = New Point(0, btnLoad.Height)
btnPause = New Button
btnPause.Text = "Pause"
btnPause.Location = New Point(0, btnLoad.Height + btnPlay.Height)
btnStop = New Button
btnStop.Text = "Stop"
btnStop.Location = New Point(0, btnLoad.Height + btnPlay.Height + btnPause.Height)
lblDuration = New Label
lblDuration.Text = Format(0, "00:00")
lblDuration.AutoSize = True
lblDuration.Location = New Point(0, 100)
lblPosition = New Label
lblPosition.Text = Format(0, "00:00")
lblPosition.AutoSize = True
lblPosition.Location = New Point(240, 100)
lblStatus = New Label
lblStatus.Text = "Stopped"
lblStatus.Location = New Point(120, 140)
lblStatus.AutoSize = True
lblTag = New Label
lblTag.Text = "TagInfo:"
lblTag.Location = New Point(0, 160)
lblTag.AutoSize = True
trackPos = New TrackBar
trackPos.Width = 200
trackPos.Location = New Point(40, 100)
Me.Controls.AddRange(New Control() {btnLoad, btnPlay, btnPause, btnStop, lblDuration, lblPosition, lblStatus, lblTag, trackPos})
AxDjStudio.ControlAdd(Me)
nPlayer = 0
AxDjStudio.SyncTimeObject(Me)
AddHandler btnLoad.Click, AddressOf btnLoad_Click
AddHandler btnPlay.Click, AddressOf btnPlay_Click
AddHandler btnPause.Click, AddressOf btnPause_Click
AddHandler btnStop.Click, AddressOf btnStop_Click
AddHandler AxDjStudio.PositionChange, AddressOf AxDjStudio_PositionChange
AddHandler trackPos.Scroll, AddressOf trackPos_Scroll
AddHandler AxDjStudio.SoundEnding, AddressOf AxDjStudio_SoundEnding
AddHandler AxDjStudio.SoundStopping, AddressOf AxDjStudio_SoundStopping
End Sub
Private Sub AxDjStudio_PositionChange(ByVal sender As Object, ByVal e As EventArgs)
lblPosition.Text = AxDjStudio.PositionString(nPlayer, "mm:ss")
trackPos.Value = AxDjStudio.CurrentPosition(nPlayer)
lblStatus.Text = AxDjStudio.Status(nPlayer)
End Sub
Private Sub AxDjStudio_SoundEnding(ByVal sender As Object, ByVal e As EventArgs)
lblPosition.Text = Format(0, "00:00")
trackPos.Value = trackPos.Minimum
lblStatus.Text = "Done"
MsgBox("Ended")
End Sub
Private Sub AxDjStudio_SoundStopping(ByVal sender As Object, ByVal e As EventArgs)
lblPosition.Text = Format(0, "00:00")
trackPos.Value = trackPos.Minimum
MsgBox("Stopped")
End Sub
Private Sub trackPos_Scroll(ByVal sender As Object, ByVal e As EventArgs)
AxDjStudio.SetPosition(nPlayer, trackPos.Value)
End Sub
Private Sub btnLoad_Click(ByVal sender As Object, ByVal e As EventArgs)
If ofdlg.ShowDialog = Windows.Forms.DialogResult.OK Then
If Not AxDjStudio.LoadSound(nPlayer, ofdlg.FileName) = AMP3DJLib.enumErrorCodes.ERR_NOERROR Then
MsgBox("Error! file not support.")
Exit Sub
End If
lblDuration.Text = AxDjStudio.DurationString(nPlayer, "mm:ss")
trackPos.Maximum = AxDjStudio.MaxPosition(nPlayer)
lblTag.Text = AxDjStudio.GetFileInfo()
End If
End Sub
Private Sub btnPlay_Click(ByVal sender As Object, ByVal e As EventArgs)
AxDjStudio.PlaySound(nPlayer)
End Sub
Private Sub btnPause_Click(ByVal sender As Object, ByVal e As EventArgs)
AxDjStudio.PauseSound(nPlayer)
End Sub
Private Sub btnStop_Click(ByVal sender As Object, ByVal e As EventArgs)
AxDjStudio.StopSound(nPlayer)
End Sub
End Class
Hello,
probably I still don't have clear what you really need to obtain but, if your need is the availability of an event reporting in real-time the current playback position, as already mentioned some post ago this is not available inside the component. If your need is different, please, try to explain more clearly and with some more detail what you need to obtain.
Kind regards
Severino Delaurenti
MultiMedia Soft
Quote from: Administrator on July 11, 2015, 08:46:30 AM
Hello,
probably I still don't have clear what you really need to obtain but, if your need is the availability of an event reporting in real-time the current playback position, as already mentioned some post ago this is not available inside the component. If your need is different, please, try to explain more clearly and with some more detail what you need to obtain.
Kind regards
Severino Delaurenti
MultiMedia Soft
I'm basic programming and bad english. If something goes wrong, apologize.