| 41 | } |
| 42 | |
| 43 | void speech_processor::process(sample_ptr samples,std::size_t count) |
| 44 | { |
| 45 | sample_ptr start=samples; |
| 46 | sample_ptr end=start+count; |
| 47 | while(fill_input_buffer(start,end)) |
| 48 | { |
| 49 | on_input(); |
| 50 | input.clear(); |
| 51 | if(is_stopped()) |
| 52 | return; |
| 53 | on_output(); |
| 54 | if(is_stopped()) |
| 55 | return; |
| 56 | if(!next) |
| 57 | continue; |
| 58 | if(!insertion.empty()) |
| 59 | { |
| 60 | next->insert(&insertion[0],insertion.size()); |
| 61 | insertion.clear(); |
| 62 | if(is_stopped()) |
| 63 | { |
| 64 | output.clear(); |
| 65 | return; |
| 66 | } |
| 67 | } |
| 68 | if(output.empty()) |
| 69 | continue; |
| 70 | next->process(&output[0],output.size()); |
| 71 | output.clear(); |
| 72 | if(is_stopped()) |
| 73 | return; |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | void speech_processor::finish() |
| 78 | { |