6 Replies Latest reply on Aug 26, 2009 8:14 PM by knew-bee

    I'm just not getting mixers

    knew-bee

      I'd like to access a mixer cast member through lingo.

      I have a mixer in the cast. I can do this:

       

      mixer = member("mixerCastMember")

      mixer.play()

       

      and it works great. but that's where it ends. I can't access any other functions or properties of the mixer object such as volume or createSoundObject().

      Is there a better way to reference a pre-made mixer object?

       

      PS: put(ilk(mixer)) outputs #void. what's that about?

       

      PPS: How do I get a single sound object in a mixer to play?

      mixer.getSoundObject("mySound").play()  -- doesn't work.

        • 1. Re: I'm just not getting mixers
          Sean_Wilson Adobe Community Professional

          If you read the docs for mixers, you see:

          Method summary for the Mixer object:
          createSoundObject
          deleteSoundObject
          getSoundObject()
          getSoundObjectList
          mute (Mixer)
          pause() (Mixer)
          play() (Mixer)
          reset (Mixer)
          save (Mixer)
          startSave (Mixer)
          stop() (Mixer)
          stopSave (Mixer)
          unmute (Mixer)
          
          Property summary for the Mixer object:
          bufferSize (Mixer)
          bitDepth (Mixer)
          channel
          channelCount (Mixer)
          elapsedTime (Mixer)
          filterList (Mixer)
          isSaving (Mixer)
          name (Mixer)
          numBuffersToPreload
          panMatrix (Mixer)
          sampleRate (Mixer)
          status (Mixer)
          soundObjectList
          toChannels
          useMatrix (Mixer)
          volume (Mixer)
          

          Can you be more specific about what's not working for you? For example, the docs for createSoundObject() say (as one option):

          Mixer.createSoundObject(SoundObjname, castMem, [startTime, endTime, loopCount, loopStartTime, loopEndTime, preLoadTime])
          

          which seems self-explanatory.

          • 2. Re: I'm just not getting mixers
            Sean_Wilson Adobe Community Professional
            put(ilk(mixer)) outputs #void. what's that about?

            That might be your entire problem. Given what you posted:

            mixer = member("mixerCastMember")

            it should output

             -- #member
            • 3. Re: I'm just not getting mixers
              knew-bee Level 1

              I've been through the docs, and I can't find anything about accessing pre-build mixer cast members through lingo. All I could find was how to access dynamically created mixers.

               

              So I've scratched trying to use pre-built members and I'm creating them dynamically.

              Here's my code:


                pMusicMixer = new(#mixer)
                pMusicMixer.createSoundObject("bgm1", member("bm1"))
                pMusicMixer.createSoundObject("bgm2", member("Danger"))
                pMusicMixer.createSoundObject("bgm3", member("Menu"))
                pMusicMixer.createSoundObject("bgm4", member("theme_classic"))

               

              if I

              trace( pMusicMixer.getSoundObjectList() )

              it outputs:

              [<SoundObject: bgm1 1167ce14>, <SoundObject: bgm2 1167cd60>, <SoundObject: bgm3 115fe720>, <SoundObject: bgm4 1165da14>]

               

              Now, if I use:

              pMusicMixer.getSoundObject("bm1").play()

              or

              pMusicMixer.getSoundObjectList()[1].play()

               

              shouldn't it start playing? because it's not.

              or am I misunderstanding Mixer and SoundObject?

               

              P.S. pMusicMixer.play() works. All 4 songs play at the same time. So I know the mixer is valid. I just can't seem to figure out how to play single SoundObjects withing the mixer.

              • 4. Re: I'm just not getting mixers
                Sean_Wilson Adobe Community Professional

                As I understand it, a mixer is used to mix down a number of sounds playing simultaneously. I don't, therefore, understand why you would create one and then try to start playing a single sound you have added to it, instead of something like:

                sound(3).play( [#member: member("bm1")] )

                I will add, though, that I haven't spent much time with 11.5 or its new mixer objects. The documentation is scant and examples are hard to come by. You might be better off asking on directorforum or looking through some of Noisecrime's examples

                • 5. Re: I'm just not getting mixers
                  knew-bee Level 1

                  I may have to convert to the old way, as you suggest. There are issues with that way, for example I lose 8 channels (using mixer gives us 16 channels rather than the 8 we used to get).

                  Plus mixers are much easier on sound cards from what I've heard.

                  But if I can't use the damn things then they're not much good to me.

                  • 6. Re: I'm just not getting mixers
                    Sean_Wilson Adobe Community Professional

                    If you only want to play a single sound, then load that single sound into the mixer and play it.