Notes on using the pygame mixerIn order to use the pygame mixer in a Kamaelia component there are a couple of extra steps you need to take to make it initialize properly. These are necessary so you can use the component in conjuction with the various pygame UI components, which disable the mixer by default to allow other sound sources to take control if they need to. The steps to getting the mixer working are as follows.
In __init__()If you call any pygame.mixer methods or objects in your component's __init__() then you initialize the mixer by calling pygame.mixer.init(). Although you would expect this to keep the mixer initialized for the main method in some instances this does not happen, so you also need to make some small changes in your component's main method.
If you call any pygame.mixer methods of objects in your component's main() method then you need to initialize the mixer a second (and potentially third) time. This can be done by adding the following code the the loop in your component's main method.
This is an ongoing community based development site. As a result the contents of this page is the opinions of the contributors of the pages involved not the organisations involved. Specificially, this page may contain personal views which are not the views of the BBC. (the site is powered by a wiki engine)
(C) Copyright 2008 Kamaelia Contributors, including the British Broadcasting Corporation, All Rights Reserved