Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

名前のなかった引数に名前を追加 #35

Merged
merged 4 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

## develop

- [CHANGE] SoraAudioSource.on_data, SoraVideoSource.on_captured, SoraVAD.analyze の引数名を変更
- @tnoho
- [ADD] 発話区間の検出が可能な SoraVAD の追加
- @tnoho
- [ADD] リアルタイム性を重視した AudioStreamSink の追加
Expand Down
26 changes: 17 additions & 9 deletions src/sora_sdk_ext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,35 +179,43 @@ NB_MODULE(sora_sdk_ext, m) {
.def("set_enabled", &SoraTrackInterface::set_enabled, "enable"_a);

nb::class_<SoraAudioSource, SoraTrackInterface>(m, "SoraAudioSource")
.def("on_data", nb::overload_cast<const int16_t*, size_t, double>(
&SoraAudioSource::OnData))
.def("on_data",
nb::overload_cast<const int16_t*, size_t>(&SoraAudioSource::OnData))
nb::overload_cast<const int16_t*, size_t, double>(
&SoraAudioSource::OnData),
"data"_a, "samples_per_channel"_a, "timestamp"_a)
.def("on_data",
nb::overload_cast<const int16_t*, size_t>(&SoraAudioSource::OnData),
"data"_a, "samples_per_channel"_a)
.def("on_data",
nb::overload_cast<nb::ndarray<int16_t, nb::shape<nb::any, nb::any>,
nb::c_contig, nb::device::cpu>,
double>(&SoraAudioSource::OnData))
double>(&SoraAudioSource::OnData),
"ndarray"_a, "timestamp"_a)
.def("on_data",
nb::overload_cast<nb::ndarray<int16_t, nb::shape<nb::any, nb::any>,
nb::c_contig, nb::device::cpu>>(
&SoraAudioSource::OnData));
&SoraAudioSource::OnData),
"ndarray"_a);

nb::class_<SoraVideoSource, SoraTrackInterface>(m, "SoraVideoSource")
.def(
"on_captured",
nb::overload_cast<nb::ndarray<uint8_t, nb::shape<nb::any, nb::any, 3>,
nb::c_contig, nb::device::cpu>>(
&SoraVideoSource::OnCaptured))
&SoraVideoSource::OnCaptured),
"ndarray"_a)
.def(
"on_captured",
nb::overload_cast<nb::ndarray<uint8_t, nb::shape<nb::any, nb::any, 3>,
nb::c_contig, nb::device::cpu>,
double>(&SoraVideoSource::OnCaptured))
double>(&SoraVideoSource::OnCaptured),
"ndarray"_a, "timestamp"_a)
.def(
"on_captured",
nb::overload_cast<nb::ndarray<uint8_t, nb::shape<nb::any, nb::any, 3>,
nb::c_contig, nb::device::cpu>,
int64_t>(&SoraVideoSource::OnCaptured));
int64_t>(&SoraVideoSource::OnCaptured),
"ndarray"_a, "timestamp_us"_a);

nb::class_<SoraAudioSinkImpl>(m, "SoraAudioSinkImpl",
nb::type_slots(audio_sink_slots))
Expand Down Expand Up @@ -253,7 +261,7 @@ NB_MODULE(sora_sdk_ext, m) {

nb::class_<SoraVAD>(m, "SoraVAD")
.def(nb::init<>())
.def("analyze", &SoraVAD::Analyze);
.def("analyze", &SoraVAD::Analyze, "frame"_a);

nb::class_<SoraVideoFrame>(m, "SoraVideoFrame")
.def("data", &SoraVideoFrame::Data, nb::rv_policy::reference);
Expand Down