Skip to content

Commit 352b751

Browse files
authored
Fix building MFC examples for TTS (k2-fsa#3388)
1 parent 5f3dcc1 commit 352b751

9 files changed

Lines changed: 51 additions & 24 deletions

File tree

.github/workflows/aarch64-linux-gnu-shared.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,18 +212,18 @@ jobs:
212212
path: sherpa-onnx-*.tar.bz2
213213

214214
- name: Release pre-compiled binaries and libs for linux aarch64
215-
if: github.repository_owner == 'csukuangfj' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') && matrix.build_type == 'Release'
215+
if: github.repository_owner == 'csukuangfj' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
216216
uses: svenstaro/upload-release-action@v2
217217
with:
218218
file_glob: true
219219
overwrite: true
220220
file: sherpa-onnx-*.tar.bz2
221221
repo_name: k2-fsa/sherpa-onnx
222222
repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
223-
tag: v1.12.31
223+
tag: v1.12.32
224224

225225
- name: Release pre-compiled binaries and libs for linux aarch64
226-
if: github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') && matrix.build_type == 'Release'
226+
if: github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
227227
uses: svenstaro/upload-release-action@v2
228228
with:
229229
file_glob: true

.github/workflows/aarch64-linux-gnu-static.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,18 @@ jobs:
141141
path: sherpa-onnx-*.tar.bz2
142142

143143
- name: Release pre-compiled binaries and libs for linux aarch64
144-
if: github.repository_owner == 'csukuangfj' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') && matrix.build_type == 'Release'
144+
if: github.repository_owner == 'csukuangfj' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
145145
uses: svenstaro/upload-release-action@v2
146146
with:
147147
file_glob: true
148148
overwrite: true
149149
file: sherpa-onnx-*.tar.bz2
150150
repo_name: k2-fsa/sherpa-onnx
151151
repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
152-
tag: v1.12.31
152+
tag: v1.12.32
153153

154154
- name: Release pre-compiled binaries and libs for linux aarch64
155-
if: github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') && matrix.build_type == 'Release'
155+
if: github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
156156
uses: svenstaro/upload-release-action@v2
157157
with:
158158
file_glob: true

.github/workflows/dot-net.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: release-nuget-package
22

33
on:
4+
push:
5+
branches:
6+
- release
7+
- release-nuget
48
workflow_dispatch:
59

610
concurrency:

.github/workflows/mfc.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ jobs:
127127
file: ./mfc-examples/${{ matrix.arch }}/Release/sherpa-onnx-streaming-*.exe
128128
# repo_name: k2-fsa/sherpa-onnx
129129
# repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
130-
# tag: v1.12.24
130+
# tag: v1.12.32
131131

132132
- name: Release pre-compiled binaries and libs for Windows ${{ matrix.arch }}
133133
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
@@ -138,7 +138,7 @@ jobs:
138138
file: ./mfc-examples/${{ matrix.arch }}/Release/sherpa-onnx-non-streaming-*.exe
139139
# repo_name: k2-fsa/sherpa-onnx
140140
# repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
141-
# tag: v1.12.24
141+
# tag: v1.12.32
142142

143143
- name: Release pre-compiled binaries and libs for Windows ${{ matrix.arch }}
144144
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
@@ -149,4 +149,4 @@ jobs:
149149
file: ./mfc-examples/${{ matrix.arch }}/sherpa-onnx-non-streaming-*.exe
150150
# repo_name: k2-fsa/sherpa-onnx
151151
# repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
152-
# tag: v1.12.24
152+
# tag: v1.12.32

.github/workflows/release-dart-package.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,7 @@ jobs:
688688
- name: Fix version
689689
shell: bash
690690
run: |
691+
sleep 60 # Wait for pub.dev to index
691692
SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
692693
693694
src_dir=$PWD/flutter/sherpa_onnx

.github/workflows/release-go.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: release-go
22

33
on:
4+
push:
5+
branches:
6+
- release
7+
- release-go
48
workflow_dispatch:
59

610
concurrency:

.github/workflows/release-rust.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Publish Rust Crates
33
on:
44
push:
55
branches:
6+
- release
67
- release-rust
78

89
workflow_dispatch:

mfc-examples/NonStreamingTextToSpeech/NonStreamingTextToSpeechDlg.cpp

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ static int32_t AudioGeneratedCallback(const float *s, int32_t n) {
7272
return 1;
7373
}
7474

75+
static int32_t AudioGeneratedProgressCallback(const float *s, int32_t n,
76+
float /*progress*/,
77+
void * /*arg*/) {
78+
return AudioGeneratedCallback(s, n);
79+
}
80+
7581
static int PlayCallback(const void * /*in*/, void *out,
7682
unsigned long _n, // NOLINT
7783
const PaStreamCallbackTimeInfo * /*time_info*/,
@@ -667,25 +673,32 @@ void CNonStreamingTextToSpeechDlg::OnBnClickedOk() {
667673

668674
// generate_btn_.EnableWindow(FALSE);
669675

670-
const SherpaOnnxGeneratedAudio *audio =
671-
SherpaOnnxOfflineTtsGenerateWithCallback(tts_, text.c_str(), speaker_id, speed, &AudioGeneratedCallback);
676+
SherpaOnnxGenerationConfig config = {0};
677+
config.silence_scale = 0.2f;
678+
config.sid = speaker_id;
679+
config.speed = speed;
680+
681+
const SherpaOnnxGeneratedAudio *audio =
682+
SherpaOnnxOfflineTtsGenerateWithConfig(tts_, text.c_str(), &config,
683+
&AudioGeneratedProgressCallback,
684+
nullptr);
672685
// generate_btn_.EnableWindow(TRUE);
673686
g_stopped = true;
674687

675-
int ok = SherpaOnnxWriteWave(audio->samples, audio->n, audio->sample_rate,
676-
filename.c_str());
688+
int ok = SherpaOnnxWriteWave(audio->samples, audio->n, audio->sample_rate,
689+
filename.c_str());
677690

678-
SherpaOnnxDestroyOfflineTtsGeneratedAudio(audio);
691+
SherpaOnnxDestroyOfflineTtsGeneratedAudio(audio);
679692

680-
if (ok) {
681-
// AfxMessageBox(Utf8ToUtf16(std::string("Saved to ") + filename + " successfully").c_str(), MB_OK);
693+
if (ok) {
694+
// AfxMessageBox(Utf8ToUtf16(std::string("Saved to ") + filename + " successfully").c_str(), MB_OK);
682695

683-
// AppendLineToMultilineEditCtrl(my_hint_, std::string("Saved to ") + filename + " successfully");
684-
} else {
685-
// AfxMessageBox(Utf8ToUtf16(std::string("Failed to save to ") + filename).c_str(), MB_OK);
696+
// AppendLineToMultilineEditCtrl(my_hint_, std::string("Saved to ") + filename + " successfully");
697+
} else {
698+
// AfxMessageBox(Utf8ToUtf16(std::string("Failed to save to ") + filename).c_str(), MB_OK);
686699

687-
// AppendLineToMultilineEditCtrl(my_hint_, std::string("Failed to saved to ") + filename);
688-
}
700+
// AppendLineToMultilineEditCtrl(my_hint_, std::string("Failed to saved to ") + filename);
701+
}
689702
});
690703

691704
//CDialogEx::OnOK();

rust-api-examples/Cargo.lock

Lines changed: 7 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)