Android Question Soundpool Clips Playback

Discussion in 'Android Questions' started by RichardN, May 7, 2015.

  1. RichardN

    RichardN Active Member Licensed User

    I have an app that should play a certain 'jingle' when required by program activity. I realise the Audio Lib Soundpool object has limitations but I have a 10 second 'jingle' (~300kb) that completely refuses to play more than the first ~6 seconds before cutting out.

    I have tried .mp3 / .wav / .ogg files all of various bitrates. I thought maybe it was a memory issue so tried 'Large Heap' in the manifest but all with no success. Strangely it always cuts at precisely the same point irrespective of soundfile type, size or bit-rate. I am using the following code:

    Code:
    Sub Process_Globals
        
    Dim Sp As SoundPool
    End Sub

    Sub Globals
        
    Dim Jingle As Int
    End Sub

    Sub Activity_Create(FirstTime As Boolean)

        
    If FirstTime Then
            Sp.Initialize(
    1)
            Jingle = Sp.Load(
    File.DirAssets,"Jingle.ogg")
        
    End If

    End Sub

    Sub Activity_Resume
        Sp.Play(Jingle,
    1,1,1,0,1)
    End Sub

    Any ideas ???
     
    Last edited: May 7, 2015
  2. Erel

    Erel Administrator Staff Member Licensed User

    It is not related to the available memory. SoundPool can only be used for short audio playbacks. You should use MediaPlayer instead.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice