1 /* 2 * Copyright (c) 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef SOUNDPOOL_FFI_H 17 #define SOUNDPOOL_FFI_H 18 19 #include "cj_common_ffi.h" 20 #include "cj_soundpool.h" 21 #include "ffi_remote_data.h" 22 23 namespace OHOS { 24 namespace Media { 25 26 extern "C" 27 28 { 29 FFI_EXPORT int64_t FfiSoundPoolCreateSoundPool(int32_t maxStreams, AudioStandard::CAudioRendererInfo info, 30 int32_t *errorcode); 31 FFI_EXPORT int32_t FfiSoundPoolLoadURI(int64_t id, char *uri, int32_t *errorcode); 32 FFI_EXPORT int32_t FfiSoundPoolLoad(int64_t id, int32_t fd, int64_t offset, int64_t length, int32_t *errorcode); 33 FFI_EXPORT int32_t FfiSoundPoolPlayParam(int64_t id, int32_t soundID, CPlayParameters params, int32_t *errorcode); 34 FFI_EXPORT int32_t FfiSoundPoolPlay(int64_t id, int32_t soundID, int32_t *errorcode); 35 FFI_EXPORT int32_t FfiSoundPoolStop(int64_t id, int32_t streamID); 36 FFI_EXPORT int32_t FfiSoundPoolSetLoop(int64_t id, int32_t streamID, int32_t loop); 37 FFI_EXPORT int32_t FfiSoundPoolSetPriority(int64_t id, int32_t streamID, int32_t priority); 38 FFI_EXPORT int32_t FfiSoundPoolSetRate(int64_t id, int32_t streamID, int32_t rate); 39 FFI_EXPORT int32_t FfiSoundPoolSetVolume(int64_t id, int32_t streamID, float leftVolume, float rightVolume); 40 FFI_EXPORT int32_t FfiSoundPoolUnload(int64_t id, int32_t soundID); 41 FFI_EXPORT int32_t FfiSoundPoolRelease(int64_t id); 42 FFI_EXPORT void FfiSoundPoolOnLoadCompleted(int64_t id, int64_t callbackId); 43 FFI_EXPORT void FfiSoundPoolOnPlayFinished(int64_t id, int64_t callbackId); 44 FFI_EXPORT void FfiSoundPoolOnError(int64_t id, int64_t callbackId); 45 FFI_EXPORT void FfiSoundPoolOff(int64_t id, int8_t type); 46 } 47 48 } // namespace Media 49 } // namespace OHOS 50 51 #endif // SOUNDPOOL_FFI_H