×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    10

    Audio Player / MMAPI Class

    In the following code snippet :

    ByteArrayInputStream in = new ByteArrayInputStream(dataBuffer);
    Player player = Manager.createPlayer(in, "audio/x-wav");

    I create a .wav file samples on the fly and feed them to the data buffers. The problem i am facing is :
    I have to prepend the .wav header each time to the data samples i generate. Also, I have to close the player and create a new player instance each time the buffer is switched...as a result i am getting a discontinuous song with horrible time latency...

    1) Is there a way by which I can just feed the .wav header just once and keep on filling the buffer with just the data samples later on ?
    2) Is there a way in which I dont have to close and create a new player each time ? Can this problem be overcome by having 2 Players and switching between them ?

    Please help
    Thanks
    -kiks

  2. #2
    Nokia Developer Expert
    Join Date
    Jul 2003
    Posts
    46
    The implementation you're running your application reads the whole content in when you initialise the Player.

    Recycling Player objects is not possible so you must create a new one for each sample. prefetch the Player right after the initialisation to minimize the delay between the previous Player stopping and the next one starting.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •