Results 1 to 5 of 5

Thread: Reversing buffer array - losing bytes

  1. #1
    Member
    Join Date
    Aug 09
    Posts
    47

    Reversing buffer array - losing bytes

    Hey, I'm assisting in a project I can't disclose until it's release, and we've run into a bit of a problem.

    Say you have a 32 or 16 bit audio buffer, it gets the bytes from an imported file.
    Now, make a copy of that same array, but reverse it. Now if you were to start playing the audio buffer, and halfway through, decide to reverse it,
    you hit a reverse button and it finds whatever byte you're at in Buffer 1, but it finds it in Buffer 2 and moves forward in that buffer.

    Recap:
    Buffer 1 is forwards
    Buffer 2 is reversed
    hitting the reverse button will find the byte you're at in Buffer 1, but in Buffer 2 so that when it moves forward in buffer 2, it'd be the same as moving backwards in buffer 1.

    Now, there's also an automatic replay option. when it reaches the end of the buffer you're playing, it will go to the opposite end and continue to play from there.
    This works fine in buffer 1,
    But in Buffer 2, you start to lose bytes and the sound appears sped up and whatever speech you have loaded seems nearly inaudible. It only does so when the automatic replay function is on.

    Does anyone have any ideas as to why this might be?

    Thanks, I really appreciate any help!
    Last edited by Arightwizard; Aug 11th, 2012 at 09:19 AM.
    The following statements are true. The following statement is false. The first statement is true.

  2. #2
    Fanatic Member ThomasJohnsen's Avatar
    Join Date
    Jul 10
    Location
    Denmark
    Posts
    521

    Re: Reversing buffer array - losing bytes

    How do you play the sound? Does the buffers contain anything besides raw sound?
    In truth, a mature man who uses hair-oil, unless medicinally , that man has probably got a quoggy spot in him somewhere. As a general rule, he can't amount to much in his totality. (Melville: Moby Dick)

  3. #3
    Member
    Join Date
    Aug 09
    Posts
    47

    Re: Reversing buffer array - losing bytes

    I'm assuming it's just raw sound, but the audio guy was unclear on that part. He's using this plugin to handle the audio. http://naudio.codeplex.com/

    Thanks for the reply!
    Edit: I remember, he said there's headers in the first stream as well, but when it switches to buffer 2, it keeps the headers of buffer 1, and buffer 2 is just the audio.
    The following statements are true. The following statement is false. The first statement is true.

  4. #4
    Fanatic Member ThomasJohnsen's Avatar
    Join Date
    Jul 10
    Location
    Denmark
    Posts
    521

    Re: Reversing buffer array - losing bytes

    And playing audio from buffer2 works allright, except when auto-replay is on?

    Truly and odd problem. I had a quick glance through the documentation you provided. If I were to guess, I would assume that this had something to do with:
    1) Encoding
    2) Data-packing
    3) Stream-format
    but neither of them seem likely, if you can play in reverse ok without auto-replay.

    I'm going to have to draw a blank on this - sry


    #EDIT: I would be interested in hearing what caused the problem, assuming ofc you solve it eventually.
    Last edited by ThomasJohnsen; Aug 11th, 2012 at 11:11 PM.
    In truth, a mature man who uses hair-oil, unless medicinally , that man has probably got a quoggy spot in him somewhere. As a general rule, he can't amount to much in his totality. (Melville: Moby Dick)

  5. #5
    Member
    Join Date
    Aug 09
    Posts
    47

    Re: Reversing buffer array - losing bytes

    I talked to the audio guy again, he said he solved it but has no clue why it wasn't working in the first place.
    He had the functions set up in a way where there was a function handling all things reversed, then another handling the auto-replay. he had if(_reversed) under the auto replay function, and by changing it to if(_areplay) under the reversed function, it just started working out of nowhere.
    Hopefully anyone finding this thread by google has the same structure lol, otherwise this will probably be of no help.
    The following statements are true. The following statement is false. The first statement is true.

Posting Permissions

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