1 /*
2 * Copyright 2021 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 #include <cstring>
17
18 #include "SilenceAudioSource.h"
19
pull(float * buffer,int numFrames,int numChans)20 int SilenceAudioSource::pull(float* buffer, int numFrames, int numChans) {
21 memset(buffer, 0, sizeof(float) * numFrames * numChans);
22 return numFrames;
23 }
24
25 //
26 // JNI functions
27 //
28 #include <jni.h>
29
30 #include <android/log.h>
31
32 extern "C" {
Java_org_hyphonate_megaaudio_player_sources_SilenceAudioSourceProvider_allocNativeSource(JNIEnv * env,jobject thiz)33 JNIEXPORT JNICALL jlong Java_org_hyphonate_megaaudio_player_sources_SilenceAudioSourceProvider_allocNativeSource(
34 JNIEnv *env, jobject thiz) {
35 return (jlong)new SilenceAudioSource();
36 }
37
38 } // extern "C"
39
40 #include "SilenceAudioSource.h"
41