×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Regular Contributor
    Join Date
    Oct 2009
    Posts
    314

    Finding difficulty in moving a rectangle with streaming an audio file

    Hi

    I am streaming an audio from a server. I have developed the code in the View class and I have drawn a rectangle in the container class in the Draw function . Now I wanted to synchronize the streaming and moving of the rectangle

    What i did was found out the total size of the file (say total_length) and my audio data is coming in chunks (say chunk_length) Now my rectangle length is say width. So in the draw function

    Code:
    void CMyContainer::Draw()
    {
    TReal progress_bar = 0;
    
    if(chunk_length != 0)
    {
         progress_bar = (chunk_length/total_length)* width;
    }
    
    drawRoundedRectangle(gc,89+progress_bar,202,24,11,
    		TSize(2,2),TSize(2,2),
    		TSize(2,2),TSize(2,2),
    		TSize(2,2),TRgb(0x00000),TRgb(0xcdc9c9));
    	    
    }
    In the view class I am having a menu where I am playing the audio file from the server. My View class has an HTTP observer which is sending it information about the events


    Code:
    void CMyView:: HttpEvent(const TDesC& aEventDescription,TInt aSize)
    {
    		
      iContainer->total_length = aSize;
    }
    
    
    void CMyView:: HttpBodyReceived(const TDesC8& aBodyData)
    {
      if(!iBodyData)
    {
    iBodyData = HBufC8::NewL(aBodyData.Length());
    }
    
    else 
    {
    iBodyData = iBodyData->ReAllocL(iBodyData->Length() + aBodyData.Length());
    }
    
    TPtr8 ptr_iBodyData = iBodyData->Des();
    ptr_iBodyData.Append(aBodyData);
    		
    		
    if((iDownloadCount == 30)||(aBodyData.Length()==0))
    {
      TInt chunk_length = ptr_iBodyData.Length();
    			  
      iPreViewContainer->chunk_length = ptr_iBodyData.Length();
    }
    iDownloadCount++;		
    }
    From the above code I am getting the total length and the chunk of data which I am passing to the container class member varibales. But the Draw function is not working .The rectangle is not moving. Can anyone suggest what more I need to do.

  2. #2
    Registered User
    Join Date
    Jun 2007
    Location
    Mumbai, India
    Posts
    1,998

    Re: Finding difficulty in moving a rectangle with streaming an audio file

    Debug and check what value you are getting for progress_bar when drawing the rect.

  3. #3
    Regular Contributor
    Join Date
    Oct 2009
    Posts
    314

    Re: Finding difficulty in moving a rectangle with streaming an audio file

    Actually my emulator is not dwonloading the song so i am test on the device. Just wanted to know that whether my logic is correct or should i have to implement some other modifications

  4. #4
    Regular Contributor
    Join Date
    Oct 2009
    Posts
    314

    Re: Finding difficulty in moving a rectangle with streaming an audio file

    Hi

    I have some problem I implemented this code but it seems when the rectangle is moving i am not getting access to the option menu . As if it makes the screen inactive

  5. #5
    Regular Contributor
    Join Date
    May 2006
    Posts
    79

    Re: Finding difficulty in moving a rectangle with streaming an audio file

    Hi

    You need to call the Draw method explicitly because the Draw method gets called while the creation of the contianer. Use DrawNow() to call the Draw method.

    Once the you got the new chunk_length then call the DrawNow()...

    Cheers...
    KB

  6. #6
    Regular Contributor
    Join Date
    Oct 2009
    Posts
    314

    Re: Finding difficulty in moving a rectangle with streaming an audio file

    I did that too but same problem . While the rectangle is moving I am not able to handle the Option menu.

Similar Threads

  1. Replies: 2
    Last Post: 2010-07-19, 10:04
  2. Streaming an audio file
    By joy.mca in forum Symbian
    Replies: 1
    Last Post: 2009-10-16, 09:15
  3. Replies: 1
    Last Post: 2009-02-19, 13:53
  4. Client-less streaming (streaming audio from a web page)
    By nfogel in forum Streaming and Video
    Replies: 0
    Last Post: 2008-06-15, 15:17
  5. simultaneous streaming of audio file and playing it
    By amalshah71 in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2007-01-31, 00:14

Posting Permissions

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