1cb93a386Sopenharmony_ci/*
2cb93a386Sopenharmony_ci * Copyright 2019 The Android Open Source Project
3cb93a386Sopenharmony_ci *
4cb93a386Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
5cb93a386Sopenharmony_ci * you may not use this file except in compliance with the License.
6cb93a386Sopenharmony_ci * You may obtain a copy of the License at
7cb93a386Sopenharmony_ci *
8cb93a386Sopenharmony_ci *      http://www.apache.org/licenses/LICENSE-2.0
9cb93a386Sopenharmony_ci *
10cb93a386Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
11cb93a386Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
12cb93a386Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13cb93a386Sopenharmony_ci * See the License for the specific language governing permissions and
14cb93a386Sopenharmony_ci * limitations under the License.
15cb93a386Sopenharmony_ci */
16cb93a386Sopenharmony_ci
17cb93a386Sopenharmony_ci#include <algorithm>
18cb93a386Sopenharmony_ci#include <unistd.h>
19cb93a386Sopenharmony_ci#include "flowgraph/FlowGraphNode.h"
20cb93a386Sopenharmony_ci#include "SourceFloatCaller.h"
21cb93a386Sopenharmony_ci
22cb93a386Sopenharmony_ciusing namespace oboe;
23cb93a386Sopenharmony_ciusing namespace flowgraph;
24cb93a386Sopenharmony_ci
25cb93a386Sopenharmony_ciint32_t SourceFloatCaller::onProcess(int32_t numFrames) {
26cb93a386Sopenharmony_ci    int32_t numBytes = mStream->getBytesPerFrame() * numFrames;
27cb93a386Sopenharmony_ci    int32_t bytesRead = mBlockReader.read((uint8_t *) output.getBuffer(), numBytes);
28cb93a386Sopenharmony_ci    int32_t framesRead = bytesRead / mStream->getBytesPerFrame();
29cb93a386Sopenharmony_ci    return framesRead;
30cb93a386Sopenharmony_ci}
31