Skip to content
Discussion options

You must be logged in to vote

Hi,
Using a timer is usually a bad idea. For instance some media files give an incorrect length.
What you should do, implement this in a callback or when the renderer signals playing has been ended (end of stream).
For example:

If you only want to play audio, then look for example, XAudio2Player Sample 1.

Here you find function TXaudio2Engine.InitializeXAudio2 in unit TXaudio2Engine.

  // While the audio is rendering, keep track of the position and samples played.

  TThread.Synchronize(nil,
                      procedure
                      var
                        bReady: Boolean;
                        voiceState: XAUDIO2_VOICE_STATE;

                        begin
             …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@StacyPointe
Comment options

Answer selected by StacyPointe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants