<phyphox xmlns="http://phyphox.org/xml" xmlns:editor="http://phyphox.org/editor/xml" version="1.7" editor:version="1.0" locale="en">
    <title>Test first run</title>
    <category>Other</category>
    <description>Test program to determine the first run of the analysis.</description>
    <icon>T</icon>
	
    <data-containers>
			<!-- analysis gestion buffers *********************************-->	
        <container size="1" init="0" static="false">index</container>	
        <container size="1" init="0" static="false">temp</container>
        <container size="1" init="0" static="false">now</container>		
        <container size="1" init="0" static="false">first_run</container>	
        <container size="1" init="0" static="false">temporary</container>		

		<container size="1" init="0" static="false">size_audio_in</container>
	    <container size="48000" static="false">audio_in</container>			
    </data-containers>

    <input>
        <audio rate="48000">
            <output>audio_in</output>
        </audio>
    </input>
	
    <views>		
		<view label="Debug">
			<separator height="1" /> 
			
			<value label="time:" unit="s">
				<input>now</input>
			</value>
			<value label="index:" >
				<input>index</input>
			</value>		
			<value label="first run?" >
				<input>first_run</input>
			</value>
			<separator height="1" /> 
			
			<value label="size audio in" >
				<input>size_audio_in</input>
			</value>
				
		</view>
    </views>	
	
    <analysis sleep="1"  onUserInput="false">
	
<!-- now will be smaller than 1s during the first run in Android (but larger than 1 in iOS ?) -->	
<!-- index will be equal to 1 during the first run in iOS (but equal to 2 in Android) -->
<!-- index+now  will be smaler than 3 during the first run in iOS and Android... -->

		<count>
			<input clear="false">audio_in</input>
			<output>size_audio_in</output>	
		</count>
		<timer>
			<output>now</output>			
		</timer>
		<add>
            <input clear="false">index</input>
			<input type="value">1</input>
            <output>index</output>		
		</add>	
		<add>
            <input clear="false">index</input>
			<input clear="false">now</input>
            <output>temporary</output>		
		</add>	
        <if less="true">
            <input clear="false">temporary</input>
            <input type="value">3</input>
            <input type="value">1</input>
            <input type="value">0</input>			
            <output>first_run</output>
        </if>			


    </analysis>
	

	
    <export>
 
    </export>
</phyphox>
