def testDecreaseVolume(self):
        '''Test Decrease Volume'''

        f = SOUNDS + 'Blip.wav'
        media.setTestMediaFolder()
        sound = media.makeSound(f)
        # samples = media.getSamples(sound)
        i = 0
        counter = 0

        print "changing"

        # while i <= media.getLength(sound):
        for sample in media.getSamples(sound):
            value = media.getSample(sample)
            media.setSample(sample, (value * 0.5))

        print "comparing"
        original = media.makeSound(f)

        counter = 0
        while counter < media.getLength(sound):
            if(int(media.getSampleValueAt(sound, counter)) != int(media.getSampleValueAt(original, counter) * 0.5)):
                self.fail("Sample %s not decreased properly" % counter)
                # print "%s != %s at %s" %
                # (media.getSampleValueAt(sound,counter),
                # (media.getSampleValueAt(original,counter)*2.0), counter)
            counter += 1
    def testDecreaseVolume(self):
        '''Test Decrease Volume'''

        f = SOUNDS + 'Blip.wav'
        media.setTestMediaFolder()
        sound = media.makeSound(f)
        # samples = media.getSamples(sound)
        i = 0
        counter = 0

        print "changing"

        # while i <= media.getLength(sound):
        for sample in media.getSamples(sound):
            value = media.getSample(sample)
            media.setSample(sample, (value * 0.5))

        print "comparing"
        original = media.makeSound(f)

        counter = 0
        while counter < media.getLength(sound):
            if (int(media.getSampleValueAt(sound, counter)) != int(
                    media.getSampleValueAt(original, counter) * 0.5)):
                self.fail("Sample %s not decreased properly" % counter)
                # print "%s != %s at %s" %
                # (media.getSampleValueAt(sound,counter),
                # (media.getSampleValueAt(original,counter)*2.0), counter)
            counter += 1
    def testIncreaseVol(self):
        '''Test Increase Volume'''

        f = SOUNDS + 'Blip.wav'
        media.setTestMediaFolder()
        sound = media.makeSound(f)

        samples = media.getSamples(sound)
        i = 0

        while i < media.getLength(sound):
            # for sample in media.getSamples(sound):
            value = media.getSampleValueAt(sound, i)
            media.setSample(media.getSampleObjectAt(sound, i), (value * 2.0))
            i = i + 1

        original = media.makeSound(f)

        counter = 0
        while counter < media.getLength(sound):
            newval = int(
                round(media.getSampleValueAt(original, counter) * 2.0))
            if (newval > 32767):
                newval = 32767
            if(newval < -32768):
                newval = -32768
            if(media.getSampleValueAt(sound, counter) != newval):
                self.fail("Sample %s not increased properly" % counter)
            counter += 1
    def testIncreaseVol(self):
        '''Test Increase Volume'''

        f = SOUNDS + 'Blip.wav'
        media.setTestMediaFolder()
        sound = media.makeSound(f)

        samples = media.getSamples(sound)
        i = 0

        while i < media.getLength(sound):
            # for sample in media.getSamples(sound):
            value = media.getSampleValueAt(sound, i)
            media.setSample(media.getSampleObjectAt(sound, i), (value * 2.0))
            i = i + 1

        original = media.makeSound(f)

        counter = 0
        while counter < media.getLength(sound):
            newval = int(round(
                media.getSampleValueAt(original, counter) * 2.0))
            if (newval > 32767):
                newval = 32767
            if (newval < -32768):
                newval = -32768
            if (media.getSampleValueAt(sound, counter) != newval):
                self.fail("Sample %s not increased properly" % counter)
            counter += 1