Xamarin.android using Soundpool for audio playback

Source: Internet
Author: User

I. Introduction of namespaces

using Android.media;

Second, declaring variables

Soundpool Soundpool; int soundpoolid;

Iii. Instantiation of objects

New Soundpool (stream.music, 0= soundpool.load (this,Resource.Drawable.beep, 1);

Four, read MP3 audio

Private void Sound () {     /// first parameter is ID     // Second and third parameter is the left and right channel volume control      // The fourth parameter is the priority, because only this one sound, so the priority is not important     here // The fifth parameter is loop play, 0 is not loop, 1 is a loop      //     // The last parameter is the playback ratio, from 0.5 to 2, which is typically 1, which indicates normal playback.      Soundpool.play (soundpoolid, 1, 1, 0, 0, 1
}

Five, call the sound () method to

Xamarin.android using Soundpool for audio playback

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.