handled audio playback with aurora library
This commit is contained in:
parent
9b5198a6ce
commit
22323b504f
13 changed files with 11711 additions and 41 deletions
|
@ -59,21 +59,13 @@ void M::Audio::h_requestFrames(const W::Event& ev)
|
|||
evc->insert(u"result", new W::Uint64(1));
|
||||
} else {
|
||||
evc->insert(u"result", new W::Uint64(0));
|
||||
uint64_t start = 0;
|
||||
uint64_t size = 0;
|
||||
bool first = true;
|
||||
W::Vector* vframes = new W::Vector();
|
||||
for (int i = 0; i < amount; ++i) {
|
||||
const std::pair<uint64_t, uint64_t>& pair = frames[index + i];
|
||||
if (first) {
|
||||
start = pair.first;
|
||||
first = false;
|
||||
}
|
||||
size += pair.second;
|
||||
const std::pair<uint64_t, uint64_t>& pair = frames[index + i]; //TODO optimize?
|
||||
vframes->push(file->slice(pair.first, pair.second));
|
||||
}
|
||||
|
||||
evc->insert(u"data", file->slice(start, size));
|
||||
evc->insert(u"amount", new W::Uint64(amount));
|
||||
|
||||
evc->insert(u"frames", vframes);
|
||||
}
|
||||
|
||||
response(evc, W::Address{u"responseFrames"}, ev);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue