DataReaderListenerImpl::DataReaderListenerImpl(const Options& options,
                                               const std::string& process,
                                               unsigned int participant,
                                               unsigned int writer)
  : options_(options)
  , expected_num_samples_(calc_num_samples(options))
  , num_samples_(0)
{
  std::stringstream ss;
  ss << process << "->" << participant << "->" << writer;
  id_ = ss.str();
  std::cout << "Starting DataReaderListenerImpl for " << id_ << std::endl;
  std::cout << "Readers/Writers identified as (process_id)->(participant_id)->(writer_id)" << std::endl;
}
Exemple #2
0
void init_sample_info(WAV_HEADER* header,WAV_SAMPLES* samples,long buffer_sample_size){
	int i = 0;
	samples->bytes_in_each_channel = calc_bytes_in_channel(header);
	samples->num_samples = calc_num_samples(header);
	samples->size_of_each_sample = calc_size_of_sample(header);
	samples->duration_seconds = calc_duration_seconds(header);
	samples->channels = (int**)malloc(sizeof(int*)*header->channels);
	samples->current_sample_read = 0;
	samples->buffer_sample_size = buffer_sample_size;
	for(i = 0; i < header->channels; i++){
		if(buffer_sample_size == 0)
			*((samples->channels)+i) = malloc(sizeof(int)*samples->num_samples);
		else
			*((samples->channels)+i) = malloc(sizeof(int)*samples->buffer_sample_size);
	}
}