# HG changeset patch # User punk # Date 1273639201 14400 # Node ID 34fc182a1daabb518331dd34404bc621757a81f6 # Parent 86360c5ae9f2822d6278008ecb8ffe47ebfe646d [svn r73] fixed bad code diff -r 86360c5ae9f2 -r 34fc182a1daa modules/bluespec/Pygar/core/AudioCoreSystem.cpp --- a/modules/bluespec/Pygar/core/AudioCoreSystem.cpp Wed May 12 00:21:40 2010 -0400 +++ b/modules/bluespec/Pygar/core/AudioCoreSystem.cpp Wed May 12 00:40:01 2010 -0400 @@ -75,7 +75,10 @@ UINT16 sample; UINT16 sample1; - Bool fileFini[NUM_VOICES] = {false, false}; + bool fileFini[NUM_VOICES]; + for (int n = 0; n < NUM_VOICES; n++) + fileFini[n] = false; + //rlm: not sure if normal ints are ok here; using UINT16 because I know it works UINT16 channel0 = 0; UINT16 channel1 = 1; @@ -84,7 +87,7 @@ int sleepCount = 0; int result = 0; - int numcCoreFin = 0; + int numCoreFini = 0; printf("SendSide Main\n"); fflush(stdout); @@ -113,8 +116,8 @@ //rlm: here we read both files. later refactor into a function. // also, this will terminate when the FIRST file reaches its end. while( !feof(inputFile) || !feof(inputFile1)) - { - + { + sem_wait(&throttle); if(count%1000 == 0) @@ -136,20 +139,22 @@ clientStub->SendUnprocessedStream((UINT32)channel0, EndOfFile,0); } } - if !fileFini[1]) + + if (!fileFini[1]) { if (fread(&sample1, 2 , 1, inputFile1)) clientStub->SendUnprocessedStream((UINT32)channel1 , Data,(UINT32)sample1); - else{ + else + { fileFini[1] = true; - numCoreFini++; + numCoreFini++; if (numCoreFini >= NUM_VOICES) // Need lock on last eof // Need to put lock here to prevent potential race condition pthread_mutex_lock(&lock); clientStub->SendUnprocessedStream((UINT32)channel1, EndOfFile,0); - } - } - } + } + } + } printf("main: out of loop\n"); printf("main: wait for end of file\n");