A book companion site by Chris Griffith
RSS icon Email icon Home icon
  • Chapter 7

    Posted on July 26th, 2009 Chris 7 comments

    Chapter 7 covers the use of audio in Flash.  In addition to discussing formats and compression, we walk through the creation of a sound managing class that can be re-used in future projects.

    Chapter 7 Files

     

    7 responses to “Chapter 7”

    1. I found a small error on side 106

      _loops- should be _loops–

      Enjoying the book very much so far!

    2. There is one other error in line 368 that was pointed out by a forum user. It should be new SoundTransform(_transform.volume, _transform.pan). As is, this will get caught in a recursive loop as it tries to call the accessor over and over again.

    3. Sorry but I dont see anything resembling loops on or near line 106 in the SoundEngine.as

      on line 368 just to clarify
      should the complete line be
      new SoundTransform(_transform.volume, _transform.pan);

      or

      return new SoundTransform(_transform.volume, _transform.pan);

      Also in it’s present form are these classes usable in Flash 9 framework?

      Thanks struggling to figure this thing out.

    4. Hi Jim,
      I’m guessing he was referring to page 106 of the book, not to a line of code.

      As for the other correction, the problem was that I was originally returning:

      return new SoundTransform(transform.volume, transform.pan);

      and it should be:

      return new SoundTransform(_transform.volume, _transform.pan);

      Notice the addition of the underscores. When the code attempted to retrieve the volume and pan values, it would trigger a recursive call to the get transform accessor. It should return the values from the private variable instead. Make sense?

    5. Chris, yes understand completely. Just wanted to clarify the return which made sense too but I wanted to make sure that wasn’t the cause of my errors while trying to implement this as a approach.

      Thanks

    6. There seems to be more to the small error I posted about a year ago (top post)…

      Just to clarify – I refer to code line 350:
      play(_offset, _loops–, _transform);
      on book page 106.

      In the book _loops– is replaced by _loops-.

      Well, neither is correct. It should be –_loops. I.e., the decrement should be before the function parameter is set. Otherwise _loops will stay the same and all loops will be infinite loops.

    7. The font on this forum sure doesn’t help. The decrement operator is written like one long line — without space between the two minus symbols.

      two minus: –
      one minus: -
      two minus with an extra space between: – -

      Murphy’s law, I guess :)

    Leave a reply