×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Jan 2006
    Posts
    59

    Question Getting ringtone weird result

    Hi,

    I'm trying to get the current ringtone programmatically. However when I do so the result I get is gibberish. To be exact: "f@@@ffr"

    When I set the ringtone, it does work. I also have the correct capabilities (otherwise setting a ringtone would surely not work)

    here's the code snippet I use:

    Code:
    	MProEngEngine* engine = ProEngFactory::NewEngineL();
    	CleanupReleasePushL(*engine);
    	MProEngProfile* activeProfile = engine->ActiveProfileL();
    	CleanupReleasePushL(*activeProfile);
    	MProEngTones& tones = activeProfile->ProfileTones();
    	
    	//query current tone
    	TDesC currentTone = tones.RingingTone1();
    
            //convert to ascii
    	TBuf<255> currentTone16(currentTone);
    	TBuf8<255> currentTone8;
    	currentTone8.Copy(currentTone16);
    
    	//log the filename to check if it worked
    	char *oldFilename = (char*)currentTone8.Ptr();
    	int oldFilenameLength = currentTone8.Length();
    	FILE *fp;
            fp = fopen("c:\\data\\others\\debug.txt","w");
    	if(fp)
    	{
    		fwrite(oldFilename, oldFilenameLength, 1, fp);
    		fclose(fp);
    		fflush(fp);
    	}
    If anyone has a good idea, please tell me. I've been staring too long.... what am I missing? ;^)

    Thanks

    Reinier

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,572

    Re: Getting ringtone weird result

    When you write TDesC xy=something, you immediately loose the content of that something. TDesC is the abstract base class for all (16-bit) descriptors, and the only property which is common for descriptors is the length. Thus xy is going to contain the proper length of something, and that is all.
    Try feeding tones.RingingTone1() directly to currentTone16.

  3. #3
    Regular Contributor
    Join Date
    Jan 2006
    Posts
    59

    Re: Getting ringtone weird result

    great! that was it!!!

    These descriptors keep on messing with my head!
    thanks for solving the puzzle!

    R

Similar Threads

  1. Random RingTone within Contact List for 3rd
    By cckfranky in forum Symbian
    Replies: 5
    Last Post: 2007-12-29, 18:33
  2. Ringtone play terminates unexpectedly
    By skaran76 in forum Smart Messaging
    Replies: 2
    Last Post: 2006-11-02, 16:23
  3. file transfer example
    By jachu19 in forum Bluetooth Technology
    Replies: 4
    Last Post: 2006-04-14, 09:45
  4. Ringtone in concatenated message
    By desmondchang in forum Smart Messaging
    Replies: 5
    Last Post: 2004-06-10, 11:19

Posting Permissions

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