示例#1
0
    def __init__(self, wave='sine', freq=440.0, buffersize=4096):
        inits = pygame.mixer.get_init()
        if inits == None:
            print "Error. pygame not initialized"
            return

        #detect bit
        if inits[1] == -16:
            self.m_type = numpy.int16
        elif inits[1] == 16:
            self.m_type = numpy.uint16
        elif inits[1] == -8:
            self.m_type = numpy.int8
        elif inits[1] == 8:
            self.m_type = numpy.uint8
        else:
            print "Error. Unknown bit size"

        self.m_length = buffersize
        self.m_table = WaveTable(wave, inits[0], inits[1])
        self.m_frequency = freq