Skip to content

Commit

Permalink
Merge pull request #35 from shiguredo/feature/overhaul
Browse files Browse the repository at this point in the history
名前のなかった引数に名前を追加
  • Loading branch information
miosakuma committed Sep 21, 2023
2 parents a23bbd4 + c230dad commit 66c8245
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
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
- [UPDATE] SoraMediaTrack を追加し、 SoraConnection.on_track の引数を SoraMediaTrack に変更
- @tnoho
- [ADD] 発話区間の検出が可能な SoraVAD の追加
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 @@ -182,35 +182,43 @@ NB_MODULE(sora_sdk_ext, m) {
.def_prop_ro("stream_id", &SoraMediaTrack::stream_id);

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 @@ -256,7 +264,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

0 comments on commit 66c8245

Please sign in to comment.