python类mixer()的实例源码

mixer_test.py 文件源码 项目:Projects 作者: it2school 项目源码 文件源码 阅读 44 收藏 0 点赞 0 评论 0
def todo_test_init__zero_values(self):
        # Ensure that argument values of 0 are replaced with
        # preset values. No way to check buffer size though.
        mixer.pre_init(44100, 8, 1)  # None default values
        mixer.init(0, 0, 0)
        try:
            self.failUnlessEqual(mixer.get_init(), (44100, 8, 1))
        finally:
            mixer.quit()
            mixer.pre_init(0, 0, 0, 0)
mixer_test.py 文件源码 项目:Projects 作者: it2school 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def test_get_init__returns_None_if_mixer_not_initialized(self):
        self.assert_(mixer.get_init() is None)
mixer_test.py 文件源码 项目:Projects 作者: it2school 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def test_get_num_channels__defaults_eight_after_init(self):
        mixer.init()

        num_channels = mixer.get_num_channels()

        self.assert_(num_channels == 8)

        mixer.quit()
mixer_test.py 文件源码 项目:Projects 作者: it2school 项目源码 文件源码 阅读 42 收藏 0 点赞 0 评论 0
def test_set_num_channels(self):
        mixer.init()

        for i in xrange_(1, mixer.get_num_channels() + 1):
            mixer.set_num_channels(i)
            self.assert_(mixer.get_num_channels() == i)

        mixer.quit()
mixer_test.py 文件源码 项目:Projects 作者: it2school 项目源码 文件源码 阅读 39 收藏 0 点赞 0 评论 0
def test_quit(self):
        """ get_num_channels() Should throw pygame.error if uninitialized
        after mixer.quit() """

        mixer.init()
        mixer.quit()

        self.assertRaises (
            pygame.error, mixer.get_num_channels,
        )
mixer_test.py 文件源码 项目:Projects 作者: it2school 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def NEWBUF_test_newbuf(self):
        mixer.init(22050, -16, 1)
        try:
            self.NEWBUF_export_check()
        finally:
            mixer.quit()
        mixer.init(22050, -16, 2)
        try:
            self.NEWBUF_export_check()
        finally:
            mixer.quit()
mixer_test.py 文件源码 项目:Projects 作者: it2school 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def todo_test_fadeout(self):

        # __doc__ (as of 2008-08-02) for pygame.mixer.fadeout:

          # pygame.mixer.fadeout(time): return None
          # fade out the volume on all sounds before stopping
          #
          # This will fade out the volume on all active channels over the time
          # argument in milliseconds. After the sound is muted the playback will
          # stop.
          #

        self.fail()
mixer_test.py 文件源码 项目:Projects 作者: it2school 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def todo_test_init(self):

        # __doc__ (as of 2008-08-02) for pygame.mixer.init:

          # pygame.mixer.init(frequency=22050, size=-16, channels=2,
          # buffer=3072): return None
          #
          # initialize the mixer module
          #
          # Initialize the mixer module for Sound loading and playback. The
          # default arguments can be overridden to provide specific audio
          # mixing. The size argument represents how many bits are used for each
          # audio sample. If the value is negative then signed sample values
          # will be used. Positive values mean unsigned audio samples will be
          # used.
          #
          # The channels argument is used to specify whether to use mono or
          # stereo.  1 for mono and 2 for stereo. No other values are supported.
          #
          # The buffer argument controls the number of internal samples used in
          # the sound mixer. The default value should work for most cases. It
          # can be lowered to reduce latency, but sound dropout may occur. It
          # can be raised to larger values to ensure playback never skips, but
          # it will impose latency on sound playback. The buffer size must be a
          # power of two.
          #
          # Some platforms require the pygame.mixer module to be initialized
          # after the display modules have initialized. The top level
          # pygame.init() takes care of this automatically, but cannot pass any
          # arguments to the mixer init. To solve this, mixer has a function
          # pygame.mixer.pre_init() to set the proper defaults before the
          # toplevel init is used.
          #
          # It is safe to call this more than once, but after the mixer is
          # initialized you cannot change the playback arguments without first
          # calling pygame.mixer.quit().
          #

        self.fail()
mixer_test.py 文件源码 项目:Projects 作者: it2school 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def todo_test_pause(self):

        # __doc__ (as of 2008-08-02) for pygame.mixer.pause:

          # pygame.mixer.pause(): return None
          # temporarily stop playback of all sound channels
          #
          # This will temporarily stop all playback on the active mixer
          # channels. The playback can later be resumed with
          # pygame.mixer.unpause()
          #

        self.fail()
mixer_test.py 文件源码 项目:Projects 作者: it2school 项目源码 文件源码 阅读 38 收藏 0 点赞 0 评论 0
def todo_test_stop(self):

        # __doc__ (as of 2008-08-02) for pygame.mixer.stop:

          # pygame.mixer.stop(): return None
          # stop playback of all sound channels
          #
          # This will stop all playback of all active mixer channels.

        self.fail()
mixer_test.py 文件源码 项目:Projects 作者: it2school 项目源码 文件源码 阅读 42 收藏 0 点赞 0 评论 0
def todo_test_fadeout(self):

        # __doc__ (as of 2008-08-02) for pygame.mixer.Channel.fadeout:

          # Channel.fadeout(time): return None
          # stop playback after fading channel out
          #
          # Stop playback of a channel after fading out the sound over the given
          # time argument in milliseconds.
          #

        self.fail()
mixer_test.py 文件源码 项目:Projects 作者: it2school 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def todo_test_get_busy(self):

        # __doc__ (as of 2008-08-02) for pygame.mixer.Channel.get_busy:

          # Channel.get_busy(): return bool
          # check if the channel is active
          #
          # Returns true if the channel is activily mixing sound. If the channel
          # is idle this returns False.
          #

        self.fail()
mixer_test.py 文件源码 项目:Projects 作者: it2school 项目源码 文件源码 阅读 43 收藏 0 点赞 0 评论 0
def todo_test_get_endevent(self):

        # __doc__ (as of 2008-08-02) for pygame.mixer.Channel.get_endevent:

          # Channel.get_endevent(): return type
          # get the event a channel sends when playback stops
          #
          # Returns the event type to be sent every time the Channel finishes
          # playback of a Sound. If there is no endevent the function returns
          # pygame.NOEVENT.
          #

        self.fail()
mixer_test.py 文件源码 项目:Projects 作者: it2school 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def todo_test_get_queue(self):

        # __doc__ (as of 2008-08-02) for pygame.mixer.Channel.get_queue:

          # Channel.get_queue(): return Sound
          # return any Sound that is queued
          #
          # If a Sound is already queued on this channel it will be returned.
          # Once the queued sound begins playback it will no longer be on the
          # queue.
          #

        self.fail()
mixer_test.py 文件源码 项目:Projects 作者: it2school 项目源码 文件源码 阅读 50 收藏 0 点赞 0 评论 0
def todo_test_get_volume(self):

        # __doc__ (as of 2008-08-02) for pygame.mixer.Channel.get_volume:

          # Channel.get_volume(): return value
          # get the volume of the playing channel
          #
          # Return the volume of the channel for the current playing sound. This
          # does not take into account stereo separation used by
          # Channel.set_volume. The Sound object also has its own volume which
          # is mixed with the channel.
          #

        self.fail()
mixer_test.py 文件源码 项目:Projects 作者: it2school 项目源码 文件源码 阅读 43 收藏 0 点赞 0 评论 0
def todo_test_pause(self):

        # __doc__ (as of 2008-08-02) for pygame.mixer.Channel.pause:

          # Channel.pause(): return None
          # temporarily stop playback of a channel
          #
          # Temporarily stop the playback of sound on a channel. It can be
          # resumed at a later time with Channel.unpause()
          #

        self.fail()
mixer_test.py 文件源码 项目:Projects 作者: it2school 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def todo_test_set_endevent(self):

        # __doc__ (as of 2008-08-02) for pygame.mixer.Channel.set_endevent:

          # Channel.set_endevent(): return None
          # Channel.set_endevent(type): return None
          # have the channel send an event when playback stops
          #
          # When an endevent is set for a channel, it will send an event to the
          # pygame queue every time a sound finishes playing on that channel
          # (not just the first time). Use pygame.event.get() to retrieve the
          # endevent once it's sent.
          #
          # Note that if you called Sound.play(n) or Channel.play(sound,n), the
          # end event is sent only once: after the sound has been played "n+1"
          # times (see the documentation of Sound.play).
          #
          # If Channel.stop() or Channel.play() is called while the sound was
          # still playing, the event will be posted immediately.
          #
          # The type argument will be the event id sent to the queue. This can
          # be any valid event type, but a good choice would be a value between
          # pygame.locals.USEREVENT and pygame.locals.NUMEVENTS. If no type
          # argument is given then the Channel will stop sending endevents.
          #

        self.fail()
mixer_test.py 文件源码 项目:Projects 作者: it2school 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def todo_test_stop(self):

        # __doc__ (as of 2008-08-02) for pygame.mixer.Channel.stop:

          # Channel.stop(): return None
          # stop playback on a Channel
          #
          # Stop sound playback on a channel. After playback is stopped the
          # channel becomes available for new Sounds to play on it.
          #

        self.fail()
mixer_test.py 文件源码 项目:Projects 作者: it2school 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def todo_test_unpause(self):

        # __doc__ (as of 2008-08-02) for pygame.mixer.Channel.unpause:

          # Channel.unpause(): return None
          # resume pause playback of a channel
          #
          # Resume the playback on a paused channel.

        self.fail()

############################### SOUND CLASS TESTS ##############################
mixer_test.py 文件源码 项目:Projects 作者: it2school 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def todo_test_fadeout(self):

        # __doc__ (as of 2008-08-02) for pygame.mixer.Sound.fadeout:

          # Sound.fadeout(time): return None
          # stop sound playback after fading out
          #
          # This will stop playback of the sound after fading it out over the
          # time argument in milliseconds. The Sound will fade and stop on all
          # actively playing channels.
          #

        self.fail()


问题


面经


文章

微信
公众号

扫码关注公众号