News:

SMF - Just Installed!

Main Menu

Recent posts

#31
Hello,

the main error is caused by the fact that you are not passing the correct file pathname to the PlayListAddItem method. Try to change the following code

    For Each file As String In Directory.GetFiles(m_strInputPathname)
          err = m_audioAPI.PlayListAddItem(0, m_strInputPathname, 0)
          Console.WriteLine("{0} {1}", file, err.ToString)
    Next

with the following code:

    For Each file As String In Directory.GetFiles(m_strInputPathname)
          err = m_audioAPI.PlayListAddItem(0, file, 0)
          Console.WriteLine("{0} {1}", file, err.ToString)
    Next

Another problem is the fact that you set the following code inside the handler of the enumPlayerEvents.EV_SOUND_DONE event, causing the playlist being stopped after the first song

m_bSoundDone = True
please, move that line inside the handler of the enumPlayerEvents.EV_PLAYLIST_DONE event instead.


Another important point: The original source code of the Visual Basic.NET version of the PlayerCmdLine project (so also your code) contains the following line:

    Thread.Sleep(50)
Be sure to replace this line with the following one or your application may experience several malfunctions

    m_audioAPI.ConsoleWait(50)

Hope this helps.

Severino Delaurenti
#32
Hi,

I discovered that the AudioDjStudioApi cannot play audio files in a playlist within a command line program.
I modified the sample program "PlayerCmdLine" so that the program can load a directory containing audio source files and play them, but it seems to be unsuccessful. It can load a single audio file and play but a playlist. The program code is as follows. Is there anything I'm missing?



'---------------------------------------------------------------
Namespace PlayerCmdLine
   Friend Class Program
      Private Shared m_bSoundDone As Boolean = False
        Private Shared m_strInputPathname As String = ""
        Private Shared addrCallbackForPlayersEvents As CallbackForPlayersEvents = New CallbackForPlayersEvents(AddressOf PlayerCallback)
        Private Shared m_audioAPI As AudioDjStudioApi.AudioDjStudioApiObj = New AudioDjStudioApi.AudioDjStudioApiObj()


      Private Shared Sub PlayerCallback(ByVal nEvent As enumPlayerEvents, ByVal nPlayer As Int16, ByVal nData1 As Int32, ByVal nData2 As Int32, ByVal fData3 As Single, ByVal pBufferUnicode As IntPtr, ByVal nBufferLength As Int32)
         Select Case nEvent
            Case enumPlayerEvents.EV_SOUND_DONE
                    Console.WriteLine(Constants.vbCr & nEvent.ToString)
                    m_bSoundDone = True

                Case enumPlayerEvents.EV_SOUND_PLAYING
                    Console.WriteLine(Constants.vbCr & "Status: Sound playing...")

                Case enumPlayerEvents.EV_PLAYLIST_LOAD_DONE
                    Console.WriteLine(Constants.vbCr & nEvent.ToString)
                    If nData1 = 0 Then
                        Console.WriteLine(Constants.vbCr & "Error loading playlist")
                    End If
                Case enumPlayerEvents.EV_PLAYLIST_DONE
                    Console.WriteLine(Constants.vbCr & nEvent.ToString)

                Case enumPlayerEvents.EV_PLAYLIST_LOAD_STARTED
                    Console.WriteLine(Constants.vbCr & nEvent.ToString)

                Case Else
               Return
         End Select
      End Sub

      Shared Sub Main(ByVal args As String())
         If args Is Nothing Then
                Console.WriteLine("args is null") ' Check for null array
                Return
            End If
            ' read command line arguments
            Dim prefixes As String() = New String() {"/i:"}
            Dim cae As CmdArgExtractor = New CmdArgExtractor(prefixes, "/"c, ":"c)

            If (Not cae.ValidArgsPrefixes(args)) Then
                Return
            End If

            Dim my2dArr As String(,) = cae.GetArgsTwoDimArray(args)
            Dim i As Integer = 0
            Do While i < my2dArr.GetLength(1)
                Select Case my2dArr(0, i)
                    Case "i"
                        m_strInputPathname = my2dArr(1, i)
                End Select
                i += 1
            Loop
            Console.Clear()
            m_audioAPI.InitSoundSystem(1, 0, 0, 0, 0)
            m_audioAPI.CallbackForPlayersEventsSet(addrCallbackForPlayersEvents)
            m_audioAPI.DisplayVUMeter.Create(0, IntPtr.Zero)
            m_audioAPI.StreamVolumeLevelSet(0, 100, enumVolumeScales.SCALE_LINEAR)
            Dim err As enumErrorCodes
            Select Case True
                Case Directory.Exists(m_strInputPathname)
                    For Each file As String In Directory.GetFiles(m_strInputPathname)
                        err = m_audioAPI.PlayListAddItem(0, m_strInputPathname, 0)
                        Console.WriteLine("{0} {1}", file, err.ToString)
                    Next
                    Console.WriteLine(m_audioAPI.PlayListExecute(0, True).ToString)

                Case File.Exists(m_strInputPathname)
                    err = m_audioAPI.LoadSound(0, m_strInputPathname)
                    Console.WriteLine("{0} {1}", m_strInputPathname, err.ToString)
                    Console.WriteLine(m_audioAPI.PlaySound(0).ToString)

            End Select

            If m_audioAPI.LastError <> enumErrorCodes.ERR_NOERROR Then
                Console.WriteLine("Cannot load file due to error " & m_audioAPI.LastError.ToString)
            Else
                Dim info As ConsoleKeyInfo = New ConsoleKeyInfo()
                Do While Not Console.KeyAvailable
                    If m_bSoundDone Then
                        Exit Do
                    End If
                    Thread.Sleep(50)
                Loop
                m_audioAPI.StopSound(0)
                Console.WriteLine(Constants.vbCrLf & "Status: Stop")
            End If

            m_audioAPI.Dispose()
        End Sub
    End Class
End Namespace

'---------------------------------------------------------------

Terry
#33
Hello, you are welcome.

In this case unfortunately no specific event is available but you may obtain the total duration by applying a couple of arithmetic operations:

- in "Insert" mode you can simply add the duration of the previous session, which can be obtained through the RecordedSound.GetDuration method, to the duration of the current session as reported by the RecordingDuration event

- in "overwrite" mode is a bit more tricky because you need to keep count of the overwrite position and add to this position the duration of the current session as reported by the RecordingDuration event:

   a) if the result of this sum is smaller than the duration of the previous session, which can be obtained through the RecordedSound.GetDuration method, then the total duration is still represented by the value returned by the previous call to the RecordedSound.GetDuration method

   b) if the result of this sum is higher, then the new total duration will be the sum between the overwrite position and the duration of the current session as reported by the RecordingDuration event.

In both cases, please, keep count that the RecordedSound.GetDuration method needs to be invoked before starting the recording session or it will return the error ERR_RECORDER_BUSY (-64).

Hope this helps.

Kind regards

Severino Delaurenti
MultiMedia Soft
#34
Audio recording components / Re: Obtaining total record tim...
Last post by mjividen - May 07, 2024, 03:39:19 PM
Thanks for the answer.  My problem is not APPEND but is displaying the total recording length in INSERT and OVERWRITE modes.  (I'm writing code in VB on Visual Studio).
#35
Audio recording components / Re: Obtaining total record tim...
Last post by Administrator - March 14, 2024, 04:28:49 PM
Hello,

if you look into the RecordedSoundEditor VB6 sample project, you will see how the duration of a recording session is currently managed into the LabelTotalDuration label: it's important to note that, after a recording session is "stopped" instead of "paused", you will have to restart it using the SetRecordingMode method with the REC_MODE_APPEND option.

You will also notice that, when a new recording session is started in append mode, the RecordingDuration event will return the duration of the current session only; if you should need to know the total sum of the durations of previous appended sessions as well, you would have to catch the RecordingPosition event instead of the RecordingDuration event.

Hope this helps

Kind Regards

Severino Delaurenti
MultiMedia Soft
#36
Audio recording components / Obtaining total record time
Last post by mjividen - March 12, 2024, 03:25:41 PM
Hello, Severino,

I've written an audio recording application for recording magazines and books that would later be listened to by persons who are blind.  The recordings are typically a half-hour to an hour long.  I've included a total time display but I haven't successfully made it work.  I've attempted to use the record position and record duration numbers but I when the I pause or stop and restart the recording, I'm not coming up with the total length of the recording in minutes and seconds.  Can you suggest a way to do this.  I'm most comfortable in visual basic. 

#37
Audio playback and audio management components / Re: Mic to icecast
Last post by Administrator - February 26, 2024, 02:40:08 PM
Hello,

please, take a look into the WasapiMixAndClone VB6 sample project which allows to attach an input device to a specific player and to send the output of the WASAPI stream mixer to a ShoutCast/IceCast server.

Hope this helps to achieve your goals.

Kind regards

Severino Delaurenti
MultiMedia Soft
#38
Audio playback and audio management components / Mic to icecast
Last post by grupo.virtual - February 26, 2024, 12:54:12 PM
Could you advice with a vb6 sample of the activex dj studio to know how to cast to icecast from a capture device (mic on my case, but I suppose applies exactly the same for line in).

I think the way is using wasapi, but I can't find how exactly


Cheers from Mazatlan, Mexico
#39
Hello,
unfortunately we don't have Delphi developers so we don't have a porting to this language available for the mentioned samples.

Kind regards

Severino Delaurenti
MultiMedia Soft
#40
Audio playback and audio management components / sample about in delphi
Last post by billychou - December 24, 2023, 11:51:23 AM
CastMixedStreams

TestEqualizer

Thanks.