public Emotiv_trial_recorder(){
		
		
		
		try {
			sender = new OSCPortOut();		
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SocketException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	    for(int i=0;i<data2d.length-3;i++) // don't use channels 0-3 of raw data (they are not EEG)
	    	alldata2d.add(new ArrayList<Double>()) ;
	    	    
	    switch (option){
		case 1:{
			if (Edk.INSTANCE.EE_EngineConnect("Emotiv Systems-5") != EdkErrorCode.EDK_OK.ToInt()){
				System.out.println("Emotiv Engine start up failed.");
				return;
			}
			break;
		}
		case 2:{
			System.out.println("Target IP of EmoComposer: [127.0.0.1] ");
	
			if (Edk.INSTANCE.EE_EngineRemoteConnect("127.0.0.1", composerPort, "Emotiv Systems-5") != EdkErrorCode.EDK_OK.ToInt()){
				System.out.println("Cannot connect to EmoComposer on [127.0.0.1]");
				return;
			}
			System.out.println("Connected to EmoComposer on [127.0.0.1]");
			break;
		}
		default:
			System.out.println("Invalid option...");
			return;
	   	}
	    		
		Edk.INSTANCE.EE_DataSetBufferSizeInSec(secs);
		System.out.print("Buffer size in secs: ");
		System.out.println(secs);		
		edisp = new Emotiv_log_and_display(1500,1000,1200) ; //display to render and paint the EEG time course				
		 startTime = System.nanoTime() ; 
		 new Thread(this).start() ;
	}