# Path: IO.py
# VIDEO_SAMPLE_TIME = 100 # Milliseconds
# NAP_STRIDE = 441
# NAP_RATE = 22050
# FRAME_SIZE = (640,480)
# PROCESS_TIME_OUT = 5*60 
# SYSTEM_TIME_OUT = 30*60 
# CAMERA = 5561
# PROJECTOR = 5562
# MIC = 5563
# SPEAKER = 5564
# STATE = 5565
# EXTERNAL = 5566 # If you change this, you're out of luck.
# SNAPSHOT= 5567
# EVENT = 5568
# SCHEDULER = 5569
# ROBO = 5570
# COGNITION = 5571
# FACE = 5572
# BRAIN = 5573
# ASSOCIATION = 5574
# SENTINEL = 5575
# LOGGER = 5576
# DREAM = 5577
# COUNTER = 5578
# def video():
# def audio():
# 
# Path: utils.py
# def wav_duration(filename):
#     sound = wave.open(filename, 'r')
#     return sound.getnframes()/float(sound.getframerate())


from time import sleep
from IO import send
from utils import wav_duration
import glob
#    [self.] is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with [self.].  If not, see <http://www.gnu.org/licenses/>.

''' Test suite for self.

@author: Axel Tidemann, Øyvind Brandtsegg
@contact: axel.tidemann@gmail.com, obrandts@gmail.com
@license: GPL
'''



def play_sounds(wait_secs):

    for f in glob.glob('testsounds/44100/*.wav')[:5]:
        send('playfile_input {}'.format(f))
        sleep(wav_duration(f) + wait_secs)

if __name__ == '__main__':

    for i in range(4):
        sleep(10)
        print 'Starting recording'
        send('startrec')
        sleep(3)

# Path: IO.py
# VIDEO_SAMPLE_TIME = 100 # Milliseconds
# NAP_STRIDE = 441
# NAP_RATE = 22050
# FRAME_SIZE = (640,480)
# PROCESS_TIME_OUT = 5*60 
# SYSTEM_TIME_OUT = 30*60 
# CAMERA = 5561
# PROJECTOR = 5562
# MIC = 5563
# SPEAKER = 5564
# STATE = 5565
# EXTERNAL = 5566 # If you change this, you're out of luck.
# SNAPSHOT= 5567
# EVENT = 5568
# SCHEDULER = 5569
# ROBO = 5570
# COGNITION = 5571
# FACE = 5572
# BRAIN = 5573
# ASSOCIATION = 5574
# SENTINEL = 5575
# LOGGER = 5576
# DREAM = 5577
# COUNTER = 5578
# def video():
# def audio():
# 
# Path: utils.py
# def wav_duration(filename):
#     sound = wave.open(filename, 'r')
#     return sound.getnframes()/float(sound.getframerate())


# Path: test_suite.py
from time import sleep
from IO import send
from utils import wav_duration
import glob

#    [self.] is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with [self.].  If not, see <http://www.gnu.org/licenses/>.

''' Test suite for self.

@author: Axel Tidemann, Øyvind Brandtsegg
@contact: axel.tidemann@gmail.com, obrandts@gmail.com
@license: GPL
'''



def play_sounds(wait_secs):

    for f in glob.glob('testsounds/44100/*.wav')[:5]:
        send('playfile_input {}'.format(f))
        sleep(wav_duration(f) + wait_secs)

if __name__ == '__main__':

    for i in range(4):
        sleep(10)
        print 'Starting recording'
        send('startrec')
        sleep(3)

        send('stoprec')