Results 1 to 3 of 3

Thread: How to play realtime raw PCM data?

  1. #1

    Question How to play realtime raw PCM data?

    Hello!


    I have a question about playing raw PCM data in realtime and I wish someone here could help me on this. :-)

    The task I am going to do is to play some raw PCM data in my application. My first thought was to use the 'CL_SoundProvider_Raw' class. However, the problem of it is that this class doesn't provide an interface to 'update' the internal buffer; therefore, each time new raw PCM data being delivered (for example, from 'libvlc' library), I have to create a new 'CL_SoundProvider_Raw' object.

    So, my question is that creating a new 'CL_SoundProvider_Raw' object each time when a audio frame being delivered is indeed the optimized way of doing my task or there is actually another way to do this in Clanlib better than this?


    Please give me some thoughts on this.


    Best regards,


    Chris

  2. #2
    Lesser Knight
    Join Date
    Mar 2009
    Posts
    54

    Default

    CL_SoundProvider_Raw is intended for playing sound that is already decoded and therefore it isn't suitable for streaming.
    Continuously creating/destroying a sound provider would likely lead to bad performance since it has to allocate and copy the user supplied buffer to an internal buffer.

    For a better solution, I'd recommend you implement CL_SoundProvider and CL_SoundProvider_Session interfaces first by overriding the virtual functions.
    Once you done that, register your sound provider with clanlib to make it available for loading via the more generic CL_SoundBuffer classes.

    Have a look at the soundprovider_wave/soundprovider_wave_session.cpp files in Source/Sound/SoundProviders to see how its done.
    Also look at setupsound.cpp to see how soundprovider is registered.

    If you follow Clanlib's "provider" pattern you should have no problem getting real time PCM streaming working.

  3. #3

    Default Thank you!

    Hi huntercool,


    Thank you very much for your comment.
    I think your comment is very helpful and certainly, I will have a look at the classes you mentioned.


    Best regards,

    Chris

Similar Threads

  1. setting overlayEntity position in realtime problem
    By blackMasoon in forum Proton SDK
    Replies: 0
    Last Post: 08-08-2011, 11:50 AM
  2. CL_NetGame data types
    By catch22 in forum Official ClanLib SDK Forums
    Replies: 6
    Last Post: 03-30-2010, 06:01 AM
  3. about save data
    By DavinciZhe in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 01-24-2008, 03:18 PM
  4. How to use the vector data from CL_Raw ?
    By ARme in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 12-21-2006, 08:35 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •