pisMessage to IRINGERMGR_Create | developer.brewmp.com pisMessage to IRINGERMGR_Create | developer.brewmp.com

Developer

pisMessage to IRINGERMGR_Create

Forums:

I've saved to a regular system file using a byte buffer, but I can't do that with IRINGERMGR_Create() since it expects a stream.

So I'm trying to feed a pisMessage stream from the IWebResp interface into the IRINGERMGR_Create() function. It's not working, always returning EFAILED.

Should this be possible? IRINGERMGR_Create() expects a IAStream, and pisMessage is described in the API as a stream.

Any tips on pulling this off would be greatly apreciated!!! I've seen a few other threads relating to this topic but nothing looked promising.

:confused:

Actually, pisMessage is an ISource, not an IAStream.
You might be able to use ISOURCEUTIL_AStreamFromSource() to convert the source to a stream.
-Erik

Actually, pisMessage is an ISource, not an IAStream.
You might be able to use ISOURCEUTIL_AStreamFromSource() to convert the source to a stream.
-Erik

It doesn't matter whether pisMessage is ISource u can type cast it to IAStream while passsing to function. I think problem is not with pisMessage. Just check the file name it should not contain dot(.). Just pass the filename only, It itself attaches .mid extension after creating ringer.

It doesn't matter whether pisMessage is ISource u can type cast it to IAStream while passsing to function. I think problem is not with pisMessage. Just check the file name it should not contain dot(.). Just pass the filename only, It itself attaches .mid extension after creating ringer.

mangesh wrote:It doesn't matter whether pisMessage is ISource u can type cast it to IAStream while passsing to function.
IAStream and ISource are not related, so you shouldn't cast one to the other. By chance the two interfaces have their Read() functions in the same locations in their vtables, so calling IASTREAM_Read() on an ISource object might actually work, but calling IASTREAM_Readable() will fail horribly.
-Erik

mangesh wrote:It doesn't matter whether pisMessage is ISource u can type cast it to IAStream while passsing to function.
IAStream and ISource are not related, so you shouldn't cast one to the other. By chance the two interfaces have their Read() functions in the same locations in their vtables, so calling IASTREAM_Read() on an ISource object might actually work, but calling IASTREAM_Readable() will fail horribly.
-Erik

ebrowne knows what he's talking about (thanks for the tip ;) ... the following pretty much worked for me:
int i = 0;
uint32 j;
DBGPRINTF("WebCallBackToIRinger:INIT");
ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_ASTREAM, (void **)pApp->pIAStream);
ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_SOURCEUTIL, (void **)&pApp->pISourceUtil);
j = ISOURCEUTIL_AStreamFromSource(pApp->pISourceUtil, pWebRespInfo->pisMessage, &pApp->pIAStream);
STR_TO_WSTR(pApp->fileName, FileName, TEXT_BUFFER_SIZE);
i = IRINGERMGR_Create(pApp->pIRingerMgr, FileName,
AEE_SOUNDPLAYER_FILE_MIDI, (IAStream*)pApp->pIAStream);
if (i == SUCCESS)
DBGPRINTF("REAL GOOD");
else
DBGPRINTF("REAL BAD");
can someone see something wrong with my "real good/bad" logic? because IRINGERMGR_Create is making a file on my file system, and using the CMX player i'm able to listen to the file so i know it's valid, but the logic always comes up "REAL BAD"!

ebrowne knows what he's talking about (thanks for the tip ;) ... the following pretty much worked for me:
int i = 0;
uint32 j;
DBGPRINTF("WebCallBackToIRinger:INIT");
ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_ASTREAM, (void **)pApp->pIAStream);
ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_SOURCEUTIL, (void **)&pApp->pISourceUtil);
j = ISOURCEUTIL_AStreamFromSource(pApp->pISourceUtil, pWebRespInfo->pisMessage, &pApp->pIAStream);
STR_TO_WSTR(pApp->fileName, FileName, TEXT_BUFFER_SIZE);
i = IRINGERMGR_Create(pApp->pIRingerMgr, FileName,
AEE_SOUNDPLAYER_FILE_MIDI, (IAStream*)pApp->pIAStream);
if (i == SUCCESS)
DBGPRINTF("REAL GOOD");
else
DBGPRINTF("REAL BAD");
can someone see something wrong with my "real good/bad" logic? because IRINGERMGR_Create is making a file on my file system, and using the CMX player i'm able to listen to the file so i know it's valid, but the logic always comes up "REAL BAD"!

You don't need this line:
ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_ASTREAM, (void **)pApp->pIAStream);
The call to ISOURCEUTIL_AStreamFromSource() will create the IAStream object.
-Erik

You don't need this line:
ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_ASTREAM, (void **)pApp->pIAStream);
The call to ISOURCEUTIL_AStreamFromSource() will create the IAStream object.
-Erik

mm, another point for erik :p
more serious than my IRINGER_Create always "failing:"
i'm able to detect when the ringer is done streaming and is saved by setting up IRINGERMGR_RegisterNotify to wait for ARE_CREATE ...
but is there a good way to detect if IRINGERMGR_Create failed?
ARE_NONE, ARE_PLAY, ARE_WRITE, where is the ARE_DIDNT_WORK? :D
should i just set up a timer and wait for it to time out to detect an error?

mm, another point for erik :p
more serious than my IRINGER_Create always "failing:"
i'm able to detect when the ringer is done streaming and is saved by setting up IRINGERMGR_RegisterNotify to wait for ARE_CREATE ...
but is there a good way to detect if IRINGERMGR_Create failed?
ARE_NONE, ARE_PLAY, ARE_WRITE, where is the ARE_DIDNT_WORK? :D
should i just set up a timer and wait for it to time out to detect an error?