Results 1 to 5 of 5
  1. #1
    Member Nicholas_A's Avatar
    Join Date
    Oct 2014
    Location
    own.worldPosition
    Posts
    1,207

    Issue with threading and AUD

    I am using the AUD module to stream music from soundcloud to play in my game. The streaming works fine. However, when I press spacebar to change songs, the game still gets caught up. The threading works. It does everything in a separate thread from the game. I was able to isolate the issue to line 90 of the script: soundcloud.py, where it actually plays the music with handle.play().

    Here is the blend to try it: Space Game 2018-4-15.blend

    Controls are W, S, A, D to fly, and Spacebar to change songs.
    My website | My YouTube channel | My Blendswap profile | My Discord Server

    I sell custom logos for $5 (among other things). Check them out!



  2. #2
    Member sdfgeoff's Avatar
    Join Date
    May 2010
    Location
    Kalpana One
    Posts
    5,235
    BGE is not thread-safe, so it doesn't surprise me that calling handle.play from another thread is causing issues. Maybe use a cross-thread-communication channel (queue, flag, semaphore etc) and have the handle.play() called from the main BGE thread.
    Last edited by sdfgeoff; 18-Apr-18 at 09:56.
    "Someone applied a roof texture to that wall" - martinsh

    Website: www.sdfgeoff.space



  3. #3
    Member Nicholas_A's Avatar
    Join Date
    Oct 2014
    Location
    own.worldPosition
    Posts
    1,207
    Didn't work. It causes blender to freeze.
    My website | My YouTube channel | My Blendswap profile | My Discord Server

    I sell custom logos for $5 (among other things). Check them out!



  4. #4
    Member BluePrintRandom's Avatar
    Join Date
    Jul 2008
    Location
    NoCal Usa
    Posts
    18,773
    maybe start a external py app and use it ?
    Is there a way to include py 3x version in a installer?

    install it,(if it does not exist) - call it and startup a seperate gil basically.
    Break it and remake it - Wrectified
    If you cut off a head, the hydra grows back two.
    "headless upbge"



  5. #5
    As mentioned before, putting this here for other people:

    Run the download in a thread, feed the thread the URLs via one queue, download the music and put it in a file, put the URI of the file on disk into a second queue, in a controller main loop on each tick try to pop the URIs back in the main thread and play the musics then.

    The idea is to just download the files in the thread.
    BGE Python framework: https://gitlab.com/bgez/bgez.git



Posting Permissions

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