/***********************************************************************************
* @fn      readXY
*
* @brief  Read X and Y Coordinates of Touch
*
* @param   none
*
* @return  none
*/
void readXY()
{
	// Find X Coordinate
	setXDrive();                              // Set X wires to drives
	x = getSamples(CHAN_YP);          // Sample Y+ to get X coordinate
	
	// Find Y Coordinate
	setYDrive();                              // Set Y wires to drives
	y = getSamples(CHAN_XP);          // Sample X+ to get Y coordinate
	
	// Setup pins to check if screen is still touched
	setTouchDrives();                         // See if screen still touched
	
	clearDrives();                            // Clear drive wires
}
Esempio n. 2
0
int main(int argc, char *argv[])
{
	printf("Wav Write Test\n");
	if (argc != 2) {
		fprintf(stderr, "Expecting wav file as argument\n");
		return 1;
	}

	short samples[len];
  	memset(samples, 0, len);
	printf("\n Getting the Samples");
	getSamples(samples);
        printf("\n Got the Samples. Writing to File\n");	
	// Write to a new file
	SF_INFO sfinfo_w ;
    	sfinfo_w.channels = 1;
    	sfinfo_w.samplerate = 16000;
    	sfinfo_w.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16;
	
	SNDFILE *sndFile_w = sf_open(argv[1], SFM_WRITE, &sfinfo_w);
	sf_count_t count_w = sf_write_short(sndFile_w, samples, len) ;
    	sf_write_sync(sndFile_w);
    	sf_close(sndFile_w);

	return 0;
}
void ObjectModelPlaneFromLines::computeRandomModel (int &iterations, Eigen::VectorXf &model_coefficients, bool &isDegenerate, bool &modelFound){

	std::vector<int> samples;
	std::vector<int> selection;
	getSamples(iterations,selection);

	if (selection.size () == 0){
		isDegenerate = false;
		modelFound = false;
		return;
	} else {

		isDegenerate = true;

	}

	if (!computeModelCoefficients (selection, model_coefficients)){
		modelFound = false;
		return;
	} else {
		modelFound = true;
		return;
	}

}
Esempio n. 4
0
bool setup(BelaContext *context, void *userData)
{

	// Check that we have the same number of inputs and outputs.
	if(context->audioInChannels != context->audioOutChannels ||
			context->analogInChannels != context-> analogOutChannels){
		printf("Error: for this project, you need the same number of input and output channels.\n");
		return false;
	}

    for(int ch=0;ch<NUM_CHANNELS;ch++) {
        gSampleData[ch].sampleLen = getNumFrames(gFilename);
    	gSampleData[ch].samples = new float[gSampleData[ch].sampleLen];
        getSamples(gFilename,gSampleData[ch].samples,ch,0,gSampleData[ch].sampleLen);
    }

	gReadPtr = -1;
	
	gAudioFramesPerAnalogFrame = context->audioFrames / context->analogFrames;


	// setup the scope with 3 channels at the audio sample rate
	scope.setup(3, context->audioSampleRate);

	return true;
}
Esempio n. 5
0
void genLibSvmTrainSet(FILE *f, int label, char* output, int samples) {
	int y;
	int samp[NOSAMPS];
	char buff[10240];
	char valstr[1024];
	printf("Am ajuns in genLibSvmTrainSet(..)\n");
	FILE *out_file;
	out_file = fopen(output, "a+");
	//printf("Samples ramase:%i\n", samples);
	//printf("Condifie: \n", (samples>0));
	printf("Am deschis deja fisierul de iesire.\n");
	while(!kbhit() && (samples>0)) {
		printf("Incerc citirea de pe atmega");
		getSamples(f, samp);
		
		printf("Am terminat citirea de pe atmega");
		sprintf(buff, "%i", label);
		for (y=0; y<NOSAMPS; y++) {
			sprintf(valstr, " %i:%i", y+1, samp[y]);
			strcat(buff, valstr);
		}
		fprintf(out_file,"%s\n", buff);
		printf("Am scris in fisier!\n");
		printf("%s\n", buff);
		samples--;
	}

	printf("Inchid fisierul de iesire");
	fclose(out_file);
	printf("Done");
}
Esempio n. 6
0
/**
 * Return the ending local row index for this processor
 */
dof_id_type
Sampler::getLocalRowEnd()
{
  if (_total_rows == 0)
    reinit(getSamples());
  return _local_row_end;
}
Esempio n. 7
0
/**
 * Return the beginning local row index for this processor
 */
dof_id_type
Sampler::getLocalRowBegin()
{
  if (_total_rows == 0)
    reinit(getSamples());
  return _local_row_begin;
}
Esempio n. 8
0
/**
 * Return the number of rows local to this processor.
 */
dof_id_type
Sampler::getLocalNumerOfRows()
{
  if (_total_rows == 0)
    reinit(getSamples());
  return _local_rows;
}
Esempio n. 9
0
bool BufferSinkFilterContext::getAudioSamples(AudioSamples &samples, size_t samplesCount, OptionalErrorCode ec)
{
    if (m_type != FilterMediaType::Audio) {
        throws_if(ec, Errors::IncorrectBufferSinkMediaType);
        return false;
    }
    return getSamples(samples.raw(), samplesCount, ec);
}
Esempio n. 10
0
//by marshmellow
//see ASKDemod for what args are accepted
int CmdNexWatchRead(const char *Cmd) {
	// read lf silently
	CmdLFRead("s");
	// get samples silently
	getSamples("10000",false);
	// demod and output viking ID	
	return CmdPSKNexWatch(Cmd);
}
Esempio n. 11
0
void
Sampler::execute()
{
  // Get the samples then save the state so that subsequent calls to getSamples returns the same
  // random numbers until this execute command is called again.
  std::vector<DenseMatrix<Real>> data = getSamples();
  _generator.saveState();
  reinit(data);
}
void vkeGameRendererDynamic::initRenderPass(){

	/*----------------------------------------------------------
	Define the render pass
	----------------------------------------------------------*/

	VkAttachmentDescription attachments[3];

	/*
	3 attachments:
	1 : Color attachment
	R8G8B8A8 UNORM
	4 samples per pixel
	2 : Depth stencil attachment
	D24S8_UNORM
	4 samples per pixel
	3 : Resolve attachment
	R8G8B8A8 UNORM
	1 sample per pixel
	*/
	attachmentDescription(&attachments[0], VK_FORMAT_R8G8B8A8_UNORM, getSamples(), VK_ATTACHMENT_LOAD_OP_CLEAR, VK_ATTACHMENT_STORE_OP_STORE);
	depthStencilAttachmentDescription(&attachments[1], VK_FORMAT_D24_UNORM_S8_UINT, getSamples());
	attachmentDescription(&attachments[2], VK_FORMAT_R8G8B8A8_UNORM, VK_SAMPLE_COUNT_1_BIT, VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_STORE);

	/*
	Define the attachment referrences
	*/

	VkAttachmentReference color_reference = { 0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL };
	VkAttachmentReference resolve_reference = { 2, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL };
	VkAttachmentReference depth_reference = { 1, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL };

	/*
	Define the only subpass
	*/
	VkSubpassDescription subpass[1];
	subpassDescription(&subpass[0], 1, &color_reference, &depth_reference, NULL);// &resolve_reference);

	/*
	Create the render pass.
	*/
	renderPassCreate(&m_render_pass, 3, attachments, 1, subpass);// , 1, &dep);
}
Esempio n. 13
0
void
Sampler::setSampleNames(const std::vector<std::string> & names)
{
  _sample_names = names;

  // Use assert because to check the size a getSamples call is required, which you don't
  // want to do if you don't need it.
  mooseAssert(getSamples().size() == _sample_names.size(),
              "The number of sample names must match the number of samples returned.");
}
Esempio n. 14
0
// * Acquire Samples as Reader (enables carrier, sends inquiry)
//helptext
int CmdHF15Samples(const char *Cmd) {
	char cmdp = param_getchar(Cmd, 0);
	if (cmdp == 'h' || cmdp == 'H') return usage_15_samples();

	UsbCommand c = {CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_15693, {0,0,0}};
	clearCommandBuffer();	
	SendCommand(&c);
	
	//download samples 
	getSamples(0, false);
	return 0;
}
u16 ResolverIn::getAngle()
{
	static DelayedConditional faultdelay(parentSys,0.2,false);
	//TODO

	/* status 9.2012:
	 * pinnia heilutetaan systemin hf taskista
	 *
	 *
	 * update:kytkis loytyy psvn skemana, natti RC ulostulo resosta
	 *
	 * luenta:
	 * säädetään keskeytys 20kHz:iin ja luetaan adc arvot talteen pulssin keskeltä
	 *
	 * skooppi:
	 * transcend muistitikulla skooppikuvia resolverista kun lähdön kanssa sarjassa 6.8 ohm ja
	 * kelan rinnan 0.33uf -> melkein siniaalto mutta LC oskillaatiota reunoissa
	 *
	 * sin ja kelt: käämin päät maahan nähden
	 * pink: erotus käämin yli
	 * vih: toision ulostulo
	 *
	 * Tarvinnee myös isomman sarjaresistanssin koska driveri lämpenee 70Chen 25Cssä ja ulostuloksi tulee
	 * yli +-2v
	 *
	 */

	/* TODO add fault detection if voltages of both channels less than 100mV or so
	 * this detects disconnected resolver and prevents angle going crazy*/

	lastAngle = currAngle;
	float x, y; //parentSys->physIO.ADin.getVoltageVolts(AnalogIn::EncA),parentSys->physIO.ADin.getVoltageVolts(AnalogIn::EncB)

	getSamples( x, y );

	//detect loss of input voltage (resolver disconnected or miswired)
	bool fault=false;
	if((x*x+y*y)<(0.2*0.2)) fault=true;
	if(faultdelay.delayedTrue( fault ) )
	{
		parentSys->setFault(FLT_ENCODER,FAULTLOCATION_BASE+101);
	}


	currAngle = u16( s32( 65536.0 * atan2f( x, y ) * (0.5 / M_PI) ) );

	lastOutputCount = outputCount;
	unrolledCount += s16( currAngle - lastAngle );
	outputCount = unrolledCount / (65536 / countsPerRev);

	return outputCount;
}
Esempio n. 16
0
/**
 * Perform a DFB on a single polarization.
 *
 * Description:\n
 * 	Converts the data to single precision floating point, optionally swaps
 * 	real and imaginary, and stores the data in a working buffer.  Then
 * 	performs a DFB::iterate on the buffer to produce the output.  Returns
 * 	the total number of samples consumed; this should be the same as threshold.\n\n
 * Notes:\n
 * 	Since the input data is in a circular buffer, it may be necessary to
 * 	wrap past the end of the buffer and do the copy in two parts.
 */
int32_t
Channel::dfbPol(uint64_t sample, InputBuffer *inBuf,
		ComplexFloat32 *sampleBuf, ComplexFloat32 **buf)
{
#if CHANNEL_TIMING
	uint64_t t0 = getticks();
#endif

	// copy the input data to the DFB buffer.  Since the input buffer
	// is circular, it may be necessary to wrap around to the beginning
	// during the copy, so we have two loops.
	int32_t len = threshold;
	ComplexInt16 *samples = static_cast<ComplexInt16 *>
			(inBuf->getSampleBlk(sample, len));
	if (swap)
			getSwappedSamples(sampleBuf, samples, len);
	else
			getSamples(sampleBuf, samples, len);
	uint64_t s = sample + len;
	int32_t len2 = threshold - len;
	if (len2) {
		samples = static_cast<ComplexInt16 *> (inBuf->getSampleBlk(s, len2));
		if (swap)
			getSwappedSamples(sampleBuf + len, samples, len2);
		else
			getSamples(sampleBuf + len, samples, len2);
	}
#if CHANNEL_TIMING
	uint64_t t1 = getticks();
	timing.dfb.list += elapsed(t1, t0);
#endif

	// perform the DFB
	// DFB is performed on linear sample buffer
	ComplexFloat32 *td[1];
	td[0] = sampleBuf;
	int32_t n = dfb.iterate((const ComplexFloat32 **) td, 1, threshold, buf);
	return (n);
}
Esempio n. 17
0
void printAvgValsOver(FILE *f, int loops) {
	int x,y;
	int samp[NOSAMPS];
	int avg[NOSAMPS];
	for (x=0; x<NOSAMPS; x++) avg[x]=0;
	for (x=0; x<loops; x++) {
		getSamples(f, samp);
		for (y=0; y<NOSAMPS; y++) avg[y]+=samp[y];
	}
	for (x=0; x<NOSAMPS; x++) {
		printf("%i\n", avg[x]/loops);
	}
}
Esempio n. 18
0
bool PrismaticModel::guessParameters() {
	if(model.track.pose.size() < 2)
		return false;

	size_t i,j;
	do{
		i = rand() % getSamples();
		j = rand() % getSamples();
	} while (i==j);

	tf::Transform pose1 = poseToTransform(model.track.pose[i]);
	tf::Transform pose2 = poseToTransform(model.track.pose[j]);

	rigid_position = pose1.getOrigin();
	rigid_orientation = pose1.getRotation();
	prismatic_dir =  pose2.getOrigin() - pose1.getOrigin();
	prismatic_dir.normalize();

	if(!check_values(rigid_position)) return false;
	if(!check_values(rigid_orientation)) return false;
	if(!check_values(prismatic_dir)) return false;

	return true;
}
Esempio n. 19
0
/*!
  Construtor
 */
Train::Train(Config config){

	clock_t start, finish;
	start = clock();
	this->conf = config;
	hog.winSize = cv::Size(config.hog_wsize, config.hog_hsize);
	positives = 0;
	negatives = 0;
	getSamples();
	computeFeatures();
	//prepareData();
	trainWithDescriptors();
	finish = clock();
	std::cout << "Tempo utilizado (segundos): "<< (finish - start)/CLOCKS_PER_SEC << std::endl;
}
	/// \brief Handles all USB things until the device gets disconnected.
	void Control::run() {
		int errorCode, cycleCounter = 0;

		while (!terminate) {
			if (sampling) {
				errorCode = getSamples(true);
				if (errorCode < 0)
					qDebug("Getting sample data failed: %s", Helper::libUsbErrorString(errorCode).toLocal8Bit().data());
            } else {
             usleep(1000);
            }
		}
		
		device->disconnect();
		emit statusMessage(tr("The device has been disconnected"), 0);
	}
void ossimQtIgenController::setSceneBoundingRect()
{
   if (!theWidget) return;

   //---
   // theWidget is actually on a tile boundary so we want the fitted
   // rect and not any null buffer pixels.
   //---
   setWidgetRect(theWidget->getSceneBoundingRect());

   theLines   = getLines();
   theSamples = getSamples();

   updateOutputGrect();
   updateDialog();
}
void ossimQtIgenController::handleRectangleROIEvent( ossimROIEvent& event)
{
   if (event.getEventType() == ossimROIEvent::OSSIM_RECTANGLE_ROI)
   {
      if (event.getMovingFlag() == false)
      {
         // Mouse drag, update lines and samples.
         theLines   = getLines();
         theSamples = getSamples();
      }
      
      // Update the geo rect from ROI rect.
      updateOutputGrect();
      updateDialog();
   }
}
Esempio n. 23
0
// this is executed continuously
void appBase::run() {
  float idletime;
  uint32_t thisLoop;

  // delay loop to force update on even looptime boundaries
  while ( millis() < nextLoop ) { // delay until time for next loop
    if( /* lcd != NULL && */ buttons != NULL ) // check for button press
      checkInput();
    checkSerial(); // Has a command been received?
  }

  thisLoop = millis(); // actual time marker for this loop
  // time stamp = system time, seconds, for this set of samples
  timestamp = 0.001 * float( thisLoop ) - reftime;
  getSamples(); // retrieve values from MCP9800 and MCP3424
  if( first ) { // use first set of samples for RoR base values only
    first = false;
    initControl();
  }
  else {
    logSamples(); // output results to serial port
    doControl(); // perform control operations, if required
  }

  // save values for RoR calculation in next loop
  for( int j = 0; j < _NCHAN; j++ ) {
   int k = chan.getChan( j );
   if( k != 0 ) {
     --k;
     flast[k] = ftemps[k];
     lasttimes[k] = ftimes[k];
   }
  }

  idletime = looptime - ( millis() - thisLoop );
  // complain if we don't have some time left
  if (idletime < _IDLE_TIME_ALARM ) {
    Serial.print("# idle: ");
    Serial.println(idletime);
  }

  nextLoop += looptime; // time mark for start of next update
//  Serial.print("nextLoop="); Serial.print( nextLoop );
//  Serial.print("   looptime="); Serial.print( looptime );
//  Serial.println();
}
Esempio n. 24
0
void classifyInput(FILE *f, char *modelfile) {
	struct svm_model *model;
	struct svm_node features[NOSAMPS+1];
	int samp[NOSAMPS];
	int rmin[NOSAMPS];
	int rmax[NOSAMPS];
	double *decVals;
	int x, noLabels, noDecVals;
	double r;
	char buff[1024];

	strcpy(buff, modelfile);
	strcat(buff, ".range");
	loadRangeFile(buff, rmin, rmax);

	strcpy(buff, modelfile);
	strcat(buff, ".model");
	model=svm_load_model(buff);
	if (model==NULL) {
		printf("Couldn't load model!\n");
		exit(0);
	}
	noLabels=svm_get_nr_class(model);
	noDecVals=noLabels*(noLabels-1)/2;
	decVals=malloc(sizeof(double)*noDecVals);

	while(1) {
		getSamples(f, samp);
		for (x=0; x<NOSAMPS; x++) {
			features[x].index=x;
			//rescale to [-1, 1]
			r=(samp[x]-rmin[x+1]);
			r=r/(rmax[x+1]-rmin[x+1]);
			r=(r*2)-1;
			features[x+1].value=r;
//			printf("%f ", features[x].value);
		}
//		printf("\n");
		features[x].index=-1;
		r=svm_predict_values(model,features,decVals);
		printf("prediction value: %f\n", r);
//		for (x=0; x<noDecVals; x++) printf("%f ", decVals[x]);
//		printf("\n");
	}
}
Esempio n. 25
0
void StereoSample::addSamplesStereo(float *samples, int length) {
		
	if(length>BUFF_SIZE) {
		printf("Buffer not big enough!!\n");
		memset(samples, 0, length*2*sizeof(float));
		return;
	}
		
	// get the samples to work on
	getSamples(StereoSample_buffer, length);
	float lerpAmt = 0.05f;
    
    if(fadePos>-1) {
        targetVolume = getFadeVolume();
        fadePos += length;
    }
    

	if(getNumChannels()==1) {
		for(int i = 0; i < length; i++) {
            volume = volume*(1.f-lerpAmt) + targetVolume*lerpAmt;
            
			pan = pan*(1.f-lerpAmt) + targetPan*lerpAmt;				
				
			samples[i*2] += StereoSample_buffer[i]*(1 - pan)*volume;
			samples[i*2 + 1] += StereoSample_buffer[i]*pan*volume;
		}
	} else if(getNumChannels()==2) {
		for(int i = 0; i < length; i++) {
				
			volume = volume*(1.f-lerpAmt) + targetVolume*lerpAmt;
			pan = pan*(1.f-lerpAmt) + targetPan*lerpAmt;
				
			samples[i*2] += StereoSample_buffer[i*2]*(1 - pan)*volume;
			samples[i*2 + 1] += StereoSample_buffer[i*2+1]*pan*volume;
		}
	}
    if(fadePos>=fadeDuration) {
        fadePos = -1;
        if(targetVolume<0.001 && volume<0.001) {
            stop();
        }
    }
		
}
Esempio n. 26
0
void SampleStream::fillBuffer() {
    
    if(!gBusy) {
    
        // increment buffer read pointer by buffer length
        gBufferReadPtr+=gBufferLength;
        
        // reset buffer pointer if it exceeds the number of frames in the file
        if(gBufferReadPtr>=gNumFramesInFile)
            gBufferReadPtr=0;
        
        int endFrame = gBufferReadPtr + gBufferLength;
        int zeroPad = 0;
        
        // if reaching the end of the file take note of the last frame index
        // so we can zero-pad the rest later
        if((gBufferReadPtr+gBufferLength)>=gNumFramesInFile-1) {
              endFrame = gNumFramesInFile-1;
              zeroPad = 1;
        }
        
        for(int ch=0;ch<gNumChannels;ch++) {
            
            // fill (nonactive) buffer
            getSamples(gFilename,gSampleBuf[!gActiveBuffer][ch].samples,ch
                        ,gBufferReadPtr,endFrame);
                        
            // zero-pad if necessary
            if(zeroPad) {
                int numFramesToPad = gBufferLength - (endFrame-gBufferReadPtr);
                for(int n=0;n<numFramesToPad;n++)
                    gSampleBuf[!gActiveBuffer][ch].samples[n+(gBufferLength-numFramesToPad)] = 0;
            }
            
        }
        
        gDoneLoadingBuffer = 1;
        gBufferToBeFilled = 0;
        
        // printf("done loading buffer!\n");
        
    }
    
}
Esempio n. 27
0
Sampler::Location
Sampler::getLocation(dof_id_type global_index)
{
  if (_offsets.empty())
    reinit(getSamples());

  mooseAssert(_offsets.size() > 1,
              "The getSamples method returned an empty vector, if you are seeing this you have "
              "done something to bypass another assert in the 'getSamples' method that should "
              "prevent this message.");

  // The lower_bound method returns the first value "which does not compare less than" the value and
  // upper_bound performs "which compares greater than." The upper_bound -1 method is used here
  // because lower_bound will provide the wrong index, but the method here will provide the correct
  // index, see the Sampler.GetLocation test in moose/unit/src/Sampler.C for an example.
  std::vector<unsigned int>::iterator iter =
      std::upper_bound(_offsets.begin(), _offsets.end(), global_index) - 1;
  return Sampler::Location(std::distance(_offsets.begin(), iter), global_index - *iter);
}
Esempio n. 28
0
void renderScene(Scene* scene){
	Color final_color;
	HitRecord record = createHitRecord();
    Sample sample = createSample(scene->num_samples);

    Color black = {0, 0, 0};

    int xres = scene->image.width;
    int yres = scene->image.height;

	for(int i = 0; i < xres; i++){
		for(int j = 0; j < yres; j++){

            getSamples(&sample);
            applyFilter(&sample);

            final_color = black;

            int hit_count = 0;
            for(int k = 0; k < scene->num_samples; k++){
                double x = 2 * (i - xres/2. + sample.samples[k].x)/xres;
                double y = 2 * (j - yres/2. + sample.samples[k].y)/yres;

                Ray ray = cameraCreateRay(&scene->camera, x, -y);
                resetHitRecord(&record);
                Color result = hitScene(scene, &record, ray, 0);
                if(result.red != 0 || result.green != 0 || result.blue != 0){
                    final_color = addColors(final_color, result);
                    hit_count++;
                }
            }

            if(hit_count > 0){
                final_color = multiplyColorByNumber(final_color, 1.0 / (double)hit_count);
            }

			setImageColor(&scene->image, i, j, final_color);
		}
	}
}
bool ADS7843AsyncTouchScreen::getCoordinates(Point& point) {

    uint16_t xvalues[7],yvalues[7];
    Point p;
    TouchScreenPostProcessor::PostProcessAction ppa;
    int16_t sequenceNumber;

    sequenceNumber=0;

    do {

        // get the samples

        getSamples(xvalues,yvalues,7);

        // the panel must have been touched all this time

        if(!isTouched())
            return errorProvider.set(ErrorProvider::ERROR_PROVIDER_TOUCH_SCREEN,E_NO_TOUCH,0);

        // get the median values

        p.X=fastMedian(xvalues);
        p.Y=fastMedian(yvalues);

        // translate the co-ordinates using the calibration routine

        point=_calibration->translate(p);

        // pass the co-ordinate to the post processor and abort if it fails

        if((ppa=_postProcessor->postProcess(point,sequenceNumber++))==TouchScreenPostProcessor::Error)
            return false;

        // keep going until the post processor signals it's finished

    } while(ppa==TouchScreenPostProcessor::MoreSamplesRequired);

    return true;
}
Esempio n. 30
0
// SeneGraph program
int main(){
	int noOfSamples = 0;
	int samples[MAX_NO_OF_SAMPLES] = { 0 };
	bool done = false;
	cout << "Welcome to SeneGraph" << endl;
	while (!done){
		cout << "No Of Samples: " << noOfSamples << endl;
		switch (menu()){
		case 1:
			cout << "Enter number of samples on hand: ";
			noOfSamples = getInt(1, MAX_NO_OF_SAMPLES);
			break;
		case 2:
			if (noOfSamples == 0){
				cout << "First enter the number of Samples." << endl;
			}
			else{
				cout << "Please enter the sample values: " << endl;
				getSamples(samples, noOfSamples);
			}
			break;
		case 3:
			if (noOfSamples == 0){
				cout << "First enter the number of Samples." << endl;
			}
			else if (samples[0] == 0){
				cout << "Firt enter the samples." << endl;
			}
			else{
				printGraph(samples, noOfSamples);
			}
			break;
		case 0:
			cout << "Thanks for using SeneGraph" << endl;
			done = true;
		}
	}
	return 0;
}