diff modules/bluespec/Pygar/core/AudioCoreSystem.cpp @ 52:49049f97312c pygar svn.53

[svn r53] sends to two cores (but has issues)
author punk
date Thu, 06 May 2010 08:57:53 -0400
parents 2b18894f75e2
children 2991344775f8
line wrap: on
line diff
     1.1 --- a/modules/bluespec/Pygar/core/AudioCoreSystem.cpp	Wed May 05 17:01:04 2010 -0400
     1.2 +++ b/modules/bluespec/Pygar/core/AudioCoreSystem.cpp	Thu May 06 08:57:53 2010 -0400
     1.3 @@ -64,13 +64,13 @@
     1.4  {
     1.5    //rlm: two files
     1.6    FILE *inputFile;
     1.7 -//  FILE *inputFile1;
     1.8 +  FILE *inputFile1;
     1.9    UINT16 sample;
    1.10 -//UINT16 sample1;
    1.11 +  UINT16 sample1;
    1.12  
    1.13    //rlm: not sure if normal ints are ok here; using UINT16 because I know it works
    1.14 -  UINT16 channel0 = 5;
    1.15 -  //UINT16 channel1 = 1;
    1.16 +  UINT16 channel0 = 0;
    1.17 +  UINT16 channel1 = 1;
    1.18  
    1.19    //init processor 
    1.20    int sleepCount = 0;
    1.21 @@ -86,15 +86,15 @@
    1.22    //rlm: for now we are going to going to just have 2 files with "common names"
    1.23  
    1.24    generate_pcm("input.wav","input.pcm");
    1.25 -  //generate_pcm("input1.wav", "input1.pcm");
    1.26 +  generate_pcm("input1.wav", "input1.pcm");
    1.27  
    1.28  
    1.29    //Send data to the machine here.
    1.30    //rlm: two files
    1.31    inputFile = fopen("input.pcm","r");
    1.32 -  // inputFile = fopen("input1.pcm", "r");
    1.33 +  inputFile = fopen("input1.pcm", "r");
    1.34    
    1.35 -  //assert(inputFile1);
    1.36 +  assert(inputFile1);
    1.37    assert(inputFile);
    1.38  
    1.39    int count = 0;
    1.40 @@ -103,20 +103,12 @@
    1.41  
    1.42    //rlm: here we read both files. later refactor into a function.
    1.43    // also, this will terminate when the FIRST file reaches its end.
    1.44 -  while( fread(&sample, 2, 1, inputFile)) //&& (fread(&sample1, 2 , 1, inputFile1))) 
    1.45 +  while( (fread(&sample, 2, 1, inputFile)) || (fread(&sample1, 2 , 1, inputFile1))) 
    1.46    { /*
    1.47      printf("hi\n");
    1.48       if (!coreFin && (result = clientStub->ReadCPUToHost(0)) != 1) 
    1.49       {
    1.50         sleepCount++;
    1.51 -       if(sleepCount == 200) {
    1.52 -	 printf("Failed to get response from hardware, bailing\n\n");
    1.53 -	 printf("This means that either your hardware is hanging\n");
    1.54 -	 printf("or that the software hasn't given it enough time\n");
    1.55 -	 printf("to complete.  If you think it needs more time, then\n");
    1.56 -	 printf("edit CONNECTED_APPLICATION_CLASS::Main() in ProcessorSystem.cpp\n");
    1.57 -	 printf("(connected_application)\n");
    1.58 -      }
    1.59       }
    1.60       else if (!coreFin && result == 1) 
    1.61         {
    1.62 @@ -132,9 +124,8 @@
    1.63      
    1.64      //rlm: two files.
    1.65      // clientStub->SendUnprocessedStream( Data,(UINT32)sample);
    1.66 -               clientStub->SendUnprocessedStream((UINT32)channel0 , Data,(UINT32)sample);
    1.67 -     //clientStub->SendUnprocessedStream(channel1 , Data,(UINT32)sample1);
    1.68 -
    1.69 +     clientStub->SendUnprocessedStream((UINT32)channel0 , Data,(UINT32)sample);
    1.70 +     clientStub->SendUnprocessedStream((UINT32)channel1 , Data,(UINT32)sample1);
    1.71    } 
    1.72  
    1.73    printf("main: out of loop\n");
    1.74 @@ -146,7 +137,7 @@
    1.75    // all of these operations wil eventually be moved into functions.
    1.76    //clientStub->SendUnprocessedStream(EndOfFile,0);
    1.77    clientStub->SendUnprocessedStream((UINT32)channel0, EndOfFile,0);
    1.78 -  // clientStub->SendUnprocessedStream(channel1, EndOfFile,0);
    1.79 +  clientStub->SendUnprocessedStream((UINT32)channel1, EndOfFile,0);
    1.80  
    1.81    printf("main: wait for end of file\n");
    1.82