comparison modules/bluespec/Pygar/core/AudioCoreSystem.cpp @ 57:b5be746a0d74 pygar svn.58

[svn r58] removed throttle in main
author punk
date Mon, 10 May 2010 12:17:52 -0400
parents 2991344775f8
children bf08daea854e
comparison
equal deleted inserted replaced
56:4449e17a2237 57:b5be746a0d74
34 pthread_mutex_init(&lock, NULL); 34 pthread_mutex_init(&lock, NULL);
35 pthread_cond_init(&cond, NULL); 35 pthread_cond_init(&cond, NULL);
36 sem_init(&throttle, 0, 64); 36 sem_init(&throttle, 0, 64);
37 37
38 // enable stats 38 // enable stats
39 STATS_DEVICE_SERVER_CLASS::GetInstance()->SetupStats(); 39 // STATS_DEVICE_SERVER_CLASS::GetInstance()->SetupStats();
40 } 40 }
41 41
42 //This isn't called.
42 void 43 void
43 CONNECTED_APPLICATION_CLASS::UpdateSemaphore() 44 CONNECTED_APPLICATION_CLASS::UpdateSemaphore()
44 { 45 {
45 sem_post(&throttle); 46 sem_post(&throttle);
46 } 47 }
80 81
81 fflush(stdout); 82 fflush(stdout);
82 83
83 // Convert input wav to pcm 84 // Convert input wav to pcm
84 85
85
86 //rlm: for now we are going to going to just have 2 files with "common names" 86 //rlm: for now we are going to going to just have 2 files with "common names"
87 87
88 generate_pcm("input.wav","input.pcm"); 88 generate_pcm("input.wav","input.pcm");
89 generate_pcm("input1.wav", "input1.pcm"); 89 generate_pcm("input1.wav", "input1.pcm");
90 90
97 assert(inputFile1); 97 assert(inputFile1);
98 assert(inputFile); 98 assert(inputFile);
99 99
100 int count = 0; 100 int count = 0;
101 101
102 printf("main:PROCESSOR about to enter loop %d\n", count); 102 printf("main:samples about to start sending %d\n", count);
103 103
104 //rlm: here we read both files. later refactor into a function. 104 //rlm: here we read both files. later refactor into a function.
105 // also, this will terminate when the FIRST file reaches its end. 105 // also, this will terminate when the FIRST file reaches its end.
106 while( (fread(&sample, 2, 1, inputFile)) || (fread(&sample1, 2 , 1, inputFile1))) 106 while( (fread(&sample, 2, 1, inputFile)) || (fread(&sample1, 2 , 1, inputFile1)))
107 { /* 107 { /*
118 */ 118 */
119 119
120 if(count%1000 == 0) 120 if(count%1000 == 0)
121 printf("main: %d\n", count); 121 printf("main: %d\n", count);
122 count++; 122 count++;
123 sem_wait(&throttle);
124 123
125 //rlm: two files. 124 //rlm: two files.
126 // clientStub->SendUnprocessedStream( Data,(UINT32)sample); 125 // clientStub->SendUnprocessedStream( Data,(UINT32)sample);
127 clientStub->SendUnprocessedStream((UINT32)channel0 , Data,(UINT32)sample); 126 clientStub->SendUnprocessedStream((UINT32)channel0 , Data,(UINT32)sample);
128 clientStub->SendUnprocessedStream((UINT32)channel1 , Data,(UINT32)sample1); 127 clientStub->SendUnprocessedStream((UINT32)channel1 , Data,(UINT32)sample1);