Skip to content

Commit c7ec173

Browse files
fix
1 parent 74a9817 commit c7ec173

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/audio/audio_utils.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ ov::genai::RawSpeechInput readMp3(const std::string_view& mp3Data) {
163163
std::vector<float> output(buffer, buffer + outputLength);
164164
return output;
165165
}
166-
#pragma warning(pop)
167-
void prepareAudioOutput(void** ppData, size_t& pDataSize, uint16_t bitsPerSample, size_t speechSize, ov::Tensor& cpuTensor) {
166+
167+
void prepareAudioOutput(void** ppData, size_t& pDataSize, uint16_t bitsPerSample, size_t speechSize, const float* waveformPtr) {
168168
enum : unsigned int {
169169
OUTPUT_PREPARATION,
170170
TIMER_END
@@ -181,7 +181,6 @@ void prepareAudioOutput(void** ppData, size_t& pDataSize, uint16_t bitsPerSample
181181
auto waveformSize = speechSize;
182182
size_t totalSamples = waveformSize * format.channels;
183183

184-
auto waveformPtr = cpuTensor.data<const float>();
185184
OPENVINO_ASSERT(drwav_init_memory_write_sequential_pcm_frames(&wav, ppData, &pDataSize, &format, totalSamples, nullptr),
186185
"Failed to initialize WAV writer");
187186
drwav_uint64 framesWritten = drwav_write_pcm_frames(&wav, totalSamples, waveformPtr);

src/audio/audio_utils.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ bool isWavBuffer(const std::string buf);
2525

2626
ov::genai::RawSpeechInput readWav(const std::string_view& wavData);
2727
ov::genai::RawSpeechInput readMp3(const std::string_view& mp3Data);
28-
void prepareAudioOutput(void** ppData, size_t& pDataSize, uint16_t bitsPerSample, size_t speechSize, ov::Tensor& cpuTensor);
28+
void prepareAudioOutput(void** ppData, size_t& pDataSize, uint16_t bitsPerSample, size_t speechSize, const float* waveformPtr);

src/audio/text_to_speech/tts_calculator.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,13 @@ class TtsCalculator : public CalculatorBase {
108108
auto generatedSpeech = pipe->ttsPipeline->generate(inputIt->value.GetString());
109109
auto bitsPerSample = generatedSpeech.speeches[0].get_element_type().bitwidth();
110110
auto speechSize = generatedSpeech.speeches[0].get_size();
111-
ov::Tensor cpu_tensor(generatedSpeech.speeches[0].get_element_type(), generatedSpeech.speeches[0].get_shape());
111+
ov::Tensor cpuTensor(generatedSpeech.speeches[0].get_element_type(), generatedSpeech.speeches[0].get_shape());
112112
// copy results to release inference request
113-
generatedSpeech.speeches[0].copy_to(cpu_tensor);
113+
generatedSpeech.speeches[0].copy_to(cpuTensor);
114114
lock.unlock();
115115
void* ppData;
116116
size_t pDataSize;
117-
prepareAudioOutput(&ppData, pDataSize, bitsPerSample, speechSize, cpu_tensor);
117+
prepareAudioOutput(&ppData, pDataSize, bitsPerSample, speechSize, cpuTensor.data<const float>());
118118
output = std::make_unique<std::string>(reinterpret_cast<char*>(ppData), pDataSize);
119119
// drwav_free(ppData, NULL); TODO: is needed?
120120
} else {

0 commit comments

Comments
 (0)