Skip to content

Commit

Permalink
fix: fixed array serialization and typo in descriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
Maciej Makowski committed Sep 2, 2024
1 parent 2a64c01 commit 421908b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion android/src/main/cpp/AudioBuffer/AudioBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace audiocontext {

class AudioBuffer : public jni::HybridClass<AudioBuffer> {
public:
static auto constexpr kJavaDescriptor = "Lcom/audiocontext/parameters/AudioBuffer;";
static auto constexpr kJavaDescriptor = "Lcom/audiocontext/utils/AudioBuffer;";

static jni::local_ref<AudioBuffer::jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis)
{
Expand Down
8 changes: 7 additions & 1 deletion cpp/AudioBuffer/AudioBufferHostObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ namespace audiocontext {
return jsi::Function::createFromHostFunction(runtime, propNameId, 1, [this](jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) -> jsi::Value {
int channel = args[0].getNumber();
short** channelData = wrapper_->getChannelData(channel);
return jsi::Value::null();

auto array = jsi::Array(rt, wrapper_->getLength());
for (int i = 0; i < wrapper_->getLength(); i++) {
array.setValueAtIndex(rt, i, jsi::Value(channelData[i]));
}

return array;
});
}

Expand Down

0 comments on commit 421908b

Please sign in to comment.