Revision 2e526a15 server/include/RSB/UtteranceRSB.h
server/include/RSB/UtteranceRSB.h | ||
---|---|---|
56 | 56 |
char *audio_data_char = (char *)sound_chunk.data().c_str(); |
57 | 57 |
|
58 | 58 |
//audio.samples = vector<char>(audio_data_char, audio_data_char+audio_len); |
59 |
audio_data.samples.resize(audio_len);
|
|
60 |
audio_data.samples.assign(audio_data_char, audio_data_char+audio_len);
|
|
59 |
audio_data->samples.resize(audio_len);
|
|
60 |
audio_data->samples.assign(audio_data_char, audio_data_char+audio_len);
|
|
61 | 61 |
|
62 |
printf("audio samplesize is %d bytes\n",(unsigned int)audio_data.samples.size());
|
|
62 |
printf("audio samplesize is %d bytes\n",(unsigned int)audio_data->samples.size());
|
|
63 | 63 |
|
64 | 64 |
//extract format: |
65 |
audio_data.sample_signed = true;
|
|
65 |
audio_data->sample_signed = true;
|
|
66 | 66 |
switch (sound_chunk.sample_type()){ |
67 |
case(rst::audition::SoundChunk::SAMPLE_U8): audio_data.sample_signed = false; //and fall through:
|
|
68 |
case(rst::audition::SoundChunk::SAMPLE_S8): audio_data.sample_bit = 8; break;
|
|
67 |
case(rst::audition::SoundChunk::SAMPLE_U8): audio_data->sample_signed = false; //and fall through:
|
|
68 |
case(rst::audition::SoundChunk::SAMPLE_S8): audio_data->sample_bit = 8; break;
|
|
69 | 69 |
|
70 |
case(rst::audition::SoundChunk::SAMPLE_U16): audio_data.sample_signed = false; //and fall through:
|
|
71 |
case(rst::audition::SoundChunk::SAMPLE_S16): audio_data.sample_bit = 16; break;
|
|
70 |
case(rst::audition::SoundChunk::SAMPLE_U16): audio_data->sample_signed = false; //and fall through:
|
|
71 |
case(rst::audition::SoundChunk::SAMPLE_S16): audio_data->sample_bit = 16; break;
|
|
72 | 72 |
|
73 |
case(rst::audition::SoundChunk::SAMPLE_U24): audio_data.sample_signed = false; //and fall through:
|
|
74 |
case(rst::audition::SoundChunk::SAMPLE_S24): audio_data.sample_bit = 24; break;
|
|
73 |
case(rst::audition::SoundChunk::SAMPLE_U24): audio_data->sample_signed = false; //and fall through:
|
|
74 |
case(rst::audition::SoundChunk::SAMPLE_S24): audio_data->sample_bit = 24; break;
|
|
75 | 75 |
|
76 | 76 |
default: |
77 | 77 |
printf("> invalid sample type %d in RST SoundChunk! ignoring request!\n", sound_chunk.sample_type()); |
... | ... | |
79 | 79 |
} |
80 | 80 |
|
81 | 81 |
//bitrate |
82 |
audio_data.sample_rate = sound_chunk.rate();
|
|
82 |
audio_data->sample_rate = sound_chunk.rate();
|
|
83 | 83 |
|
84 | 84 |
//endianness |
85 | 85 |
if (sound_chunk.endianness() == rst::audition::SoundChunk::ENDIAN_LITTLE){ |
86 |
audio_data.sample_big_endian = false;
|
|
86 |
audio_data->sample_big_endian = false;
|
|
87 | 87 |
}else if (sound_chunk.endianness() == rst::audition::SoundChunk::ENDIAN_BIG){ |
88 |
audio_data.sample_big_endian = true;
|
|
88 |
audio_data->sample_big_endian = true;
|
|
89 | 89 |
}else{ |
90 | 90 |
printf("> invalid SoundChunk byte_format"); |
91 | 91 |
throw runtime_error("UtteranceRSB::convert_audio_data() unsupported byte_format in rst::audition::SoundChunk"); |
92 | 92 |
} |
93 | 93 |
|
94 | 94 |
//number of channels |
95 |
audio_data.sample_channels = sound_chunk.channels();
|
|
95 |
audio_data->sample_channels = sound_chunk.channels();
|
|
96 | 96 |
|
97 |
printf("> new AudioData: %s\n",audio_data.to_string().c_str());
|
|
97 |
printf("> new AudioData: %s\n",audio_data->to_string().c_str());
|
|
98 | 98 |
} |
99 | 99 |
|
100 | 100 |
void extract_phonemes(rst::audition::Utterance rst_utterance){ |
Also available in: Unified diff