Mercurial > pygar
changeset 72:34fc182a1daa pygar svn.73
[svn r73] fixed bad code
author | punk |
---|---|
date | Wed, 12 May 2010 00:40:01 -0400 |
parents | 86360c5ae9f2 |
children | 0f86d486e38e |
files | modules/bluespec/Pygar/core/AudioCoreSystem.cpp |
diffstat | 1 files changed, 15 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
1.1 --- a/modules/bluespec/Pygar/core/AudioCoreSystem.cpp Wed May 12 00:21:40 2010 -0400 1.2 +++ b/modules/bluespec/Pygar/core/AudioCoreSystem.cpp Wed May 12 00:40:01 2010 -0400 1.3 @@ -75,7 +75,10 @@ 1.4 UINT16 sample; 1.5 UINT16 sample1; 1.6 1.7 - Bool fileFini[NUM_VOICES] = {false, false}; 1.8 + bool fileFini[NUM_VOICES]; 1.9 + for (int n = 0; n < NUM_VOICES; n++) 1.10 + fileFini[n] = false; 1.11 + 1.12 //rlm: not sure if normal ints are ok here; using UINT16 because I know it works 1.13 UINT16 channel0 = 0; 1.14 UINT16 channel1 = 1; 1.15 @@ -84,7 +87,7 @@ 1.16 int sleepCount = 0; 1.17 int result = 0; 1.18 1.19 - int numcCoreFin = 0; 1.20 + int numCoreFini = 0; 1.21 1.22 printf("SendSide Main\n"); 1.23 fflush(stdout); 1.24 @@ -113,8 +116,8 @@ 1.25 //rlm: here we read both files. later refactor into a function. 1.26 // also, this will terminate when the FIRST file reaches its end. 1.27 while( !feof(inputFile) || !feof(inputFile1)) 1.28 - { 1.29 - 1.30 + { 1.31 + 1.32 sem_wait(&throttle); 1.33 1.34 if(count%1000 == 0) 1.35 @@ -136,20 +139,22 @@ 1.36 clientStub->SendUnprocessedStream((UINT32)channel0, EndOfFile,0); 1.37 } 1.38 } 1.39 - if !fileFini[1]) 1.40 + 1.41 + if (!fileFini[1]) 1.42 { 1.43 if (fread(&sample1, 2 , 1, inputFile1)) 1.44 clientStub->SendUnprocessedStream((UINT32)channel1 , Data,(UINT32)sample1); 1.45 - else{ 1.46 + else 1.47 + { 1.48 fileFini[1] = true; 1.49 - numCoreFini++; 1.50 + numCoreFini++; 1.51 if (numCoreFini >= NUM_VOICES) // Need lock on last eof 1.52 // Need to put lock here to prevent potential race condition 1.53 pthread_mutex_lock(&lock); 1.54 clientStub->SendUnprocessedStream((UINT32)channel1, EndOfFile,0); 1.55 - } 1.56 - } 1.57 - } 1.58 + } 1.59 + } 1.60 + } 1.61 1.62 printf("main: out of loop\n"); 1.63 printf("main: wait for end of file\n");