Example #1
0
        /** Plays a specified local or online audio effect file.
         *
         * This method allows you to set the loop count, pitch, pan, and gain of the audio effect file, as well as whether the remote user can hear the audio effect.
         *
         * To play multiple audio effect files simultaneously, call this method multiple times with different soundIds and filePaths. We recommend playing no more than three audio effect files at the same time.
         *
         * @note
         * - If the audio effect is preloaded into the memory through the {@link agora_gaming_rtc.AudioEffectManagerImpl.PreloadEffect PreloadEffect} method, the value of `soundId` must be the same as that in the `PreloadEffect` method.
         * - Playing multiple online audio effect files simultaneously is not supported on macOS and Windows.
         *
         * @param soundId ID of the specified audio effect. Each audio effect has a unique ID.
         * @param filePath Specifies the absolute path (including the suffixes of the filename) to the local audio effect file or the URL of the online audio effect file. Supported audio formats: mp3, mp4, m4a, aac, 3gp, mkv and wav.
         * @param loopCount Sets the number of times the audio effect loops:
         * - 0: Play the audio effect once.
         * - 1: Play the audio effect twice.
         * - -1: Play the audio effect in an indefinite loop until the {@link agora_gaming_rtc.AudioEffectManagerImpl.StopEffect StopEffect} or {@link agora_gaming_rtc.AudioEffectManagerImpl.StopAllEffects StopAllEffects} method is called.
         * @param pitch Sets the pitch of the audio effect. The value ranges between 0.5 and 2. The default value is 1 (no change to the pitch). The lower the value, the lower the pitch.
         * @param pan Sets the spatial position of the audio effect. The value ranges between -1.0 and 1.0:
         * - 0.0: The audio effect displays ahead.
         * - 1.0: The audio effect displays to the right.
         * - -1.0: The audio effect displays to the left.
         * @param gain  Sets the volume of the audio effect. The value ranges between 0 and 100 (default). The lower the value, the lower the volume of the audio effect.
         * @param publish Sets whether or not to publish the specified audio effect to the remote stream:
         * - true: The locally played audio effect is published to the Agora Cloud and the remote users can hear it.
         * - false: The locally played audio effect is not published to the Agora Cloud and the remote users cannot hear it.
         *
         * @return
         * - 0: Success.
         * - < 0: Failure.
         */
        public override int PlayEffect(int soundId, string filePath,
                                       int loopCount,
                                       double pitch = 1.0D,
                                       double pan   = 0.0D,
                                       int gain     = 100,
                                       bool publish = false)
        {
            if (_mEngine == null)
            {
                return((int)ERROR_CODE.ERROR_NOT_INIT_ENGINE);
            }

            return(IRtcEngineNative.playEffect(soundId, filePath, loopCount, pitch, pan, gain, publish));
        }