Modified by : sgadamsetty real.com
Reviewed by : "Eric Hyche" <ehyche real.com>
Date : 05-16-2006
Project : Tone generator plugin for Helix Client DNA
Thanks for detailed review Eric.
Added license headers for all the files and removed .def
files
from the tone generator plug-in modules.
Checked in the tone generator plug-in modules.
Thanks
Sateesh
>>Thanks for detailed review Eric.
>>
>>Sateesh, this check-in should be applied to HEAD
branch only.
>>
>>Given that this code does not interfere with other
modules and is still
>>work in progress, please correct the following
subset of issues and
>>check-in into the repository (HEAD only):
>>- update and add license headers per review
>>- remove.def files from check-in
>>
>>Other issues can be addressed after the check-in.
>>
>>Thanks,
>>Milko
>>
>>
>>At 07:52 AM 4/28/2006, Eric Hyche wrote:
>>
>>>Sateesh:
>>>
>>>Here are my comments on the added files:
>>>
>>>audio/tonegen:
>>>
>>>1) It appears the source file headers are out of
date.
>>> Headers can be found here:
>>> https://helix.dev.prognet.com/index.cgi/SourceFileHeade
rs
>>> Added C++ files should use the header in
2.1.1.
>>> Added Python files should use the header in
2.2.1.
>>>
>>>2) In audio/tonegen, there doesn't seem to be
any
>>> need for a sub-Umakefil (Umakefil
referencing libumakefil,
>>> which has the real build instructions). Just
put the code
>>> which is currently in libumakefil into
Umakefil and
>>> eliminate the MultiTargetMake() in Umakefil.
>>>
>>>3) Don't check in tonerenderer.def, since .def
files are
>>> generated by the build system.
>>>
>>>4) tonegen.cpp needs a license header.
>>>
>>>5) tongen.h needs a license header.
>>>
>>>datatype/tone/fileformat:
>>>
>>>1) License file headers are out of date - see
above
>>>
>>>2) MLOG_xxx has been deprecated as a logging
system. You should
>>> use HXLOG, as documented here:
>>> https://common.helixcommunity.org/2005/devdocs/Unif
iedLogging
>>> Therefore, toneffmlog.h should not be
needed.
>>>
>>>3) Code lines that have been commented out
should be removed,
>>> unless they are needed to explain some
behavior or we
>>> think we might eventually switch over to
using the commented
>>> out code.
>>>
>>>4) I see that Seek() returns HXR_UNEXPECTED, but
I saw
>>> in your status report that you are still
working
>>> on getting seeking working. So I assume that
>>> the Seek() method will be changed in a
separate CR.
>>> Is that correct?
>>>
>>>5) This code block in toneff.cpp:
>>>
>>> // Call back to the response
>>> IHXFileMimeMapper* pMapper = NULL;
>>>
m_pFileObject->QueryInterface(IID_IHXFileMimeMapper,
>>> (void**) &pMapper);
>>> if (pMapper)
>>> {
>>> // Get the URL
>>> const char* pszURL = NULL;
>>> m_pRequest->GetURL(pszURL);
>>> if (pszURL)
>>> {
>>> // Get our own response
interface
>>> IHXFileMimeMapperResponse*
pResponse = NULL;
>>>
QueryInterface(IID_IHXFileMimeMapperResponse,
>>> (void**) &pResponse);
>>> if (pResponse)
>>> {
>>> // Call FindMimeType -
look in MimeTypeFound for
>>> // the response
>>>
pMapper->FindMimeType(pszURL, pResponse);
>>> }
>>> HX_RELEASE(pResponse);
>>> }
>>> }
>>> HX_RELEASE(pMapper);
>>>
>>> doesn't make any sense. CTONEFileFormat
doesn't even support
>>> IHXFileMimeMapperResponse so FindMimeType
will never be called.
>>> Why do you need to know the mime type of the
file?
>>>
>>>6) In SeekDone(), you have this:
>>>
>>> retVal =
m_pFileObject->Read(8);//TONE_HEADER_READ_SIZE
>>>
>>> If TONE_HEADER_READ_SIZE is 8, then just use
it
>>> in the Read() call:
>>>
>>> retVal =
m_pFileObject->Read(TONE_HEADER_READ_SIZE);
>>>
>>>7) These two comments don't make sense beside
each other:
>>>
>>> // Now read
TONE_HEADER_READ_SIZE bytes
>>> //No Header Information available
to read
>>> retVal =
m_pFileObject->Read(8);//TONE_HEADER_READ_SIZE
>>>
>>> I suspect one of them is a left-over from
the old code
>>> that you used as a template for this new
code. Please
>>> remove the inapplicable comment.
>>>
>>>8) In GetFileHeader, you first Seek() to the
beginning of
>>> the file, then in SeekDone(), you read 8
bytes of the file,
>>> and then in ReadDone(), you don't do
anything with those 8
>>> bytes you just read. Then in
GetStreamHeader(), you Seek()
>>> back to the beginning of the file again. So
it looks to
>>> me as if the seek and read started by
GetFileHeader are
>>> completely unnecessary. If so, remove them
since they
>>> are just adding unnecessary code size and
complexity.
>>>
>>>9) Remove commented-out code in
GetStreamHeader()
>>>
>>>10) I don't understand this logic:
>>>
>>> // Create a raw file packet
>>> IHXPacket* pPacket = NULL;
>>> retVal =
MakeRawFilePacket(pBuffer,
>>> m_ulNextTimeStamp, pPacket);
>>> if (SUCCEEDED(retVal))
>>> {
>>> // Process this input
packet into output queue
>>> packets.
>>> // We could have done
this either in
>>> SetPacket() or GetPacket(),
>>> // but we choose to do
it here. We don't force
>>> flushing yet,
>>> // since we may get
more data. Once we get a
>>> call to flush,
>>> // then we process all
the input, regardless of
>>> min size.
>>>
pHdr->GetPropertyULONG32("MinPacketSize",
>>> m_ulMinPacketSize);
>>> retVal =
ProcessInputPacket(pPacket, m_bFlush,
>>> m_ulMinPacketSize,
>>>
m_ulPacketBytesConsumed, m_ulDurationConsumed);
>>>
>>> if (SUCCEEDED(retVal))
>>> {
>>> // Update the next
file offset
>>> m_ulNextFileOffset
+= GetPacketBytesConsumed();
>>> // Update the next
time stamp
>>> m_ulNextTimeStamp
+= GetDurationConsumed();
>>> // Set the state
>>> m_eState =
StateReady;
>>> // Send the stream
header
>>> retVal =
>>> m_pFormatResponse->StreamHeaderReady(HXR_OK,
pHdr);
>>> }
>>> }
>>> HX_RELEASE(pPacket);
>>>
>>> You are taking pBuffer and putting it into
a packet in
>>> MakeRawFilePacket(),
>>> then turning right around in
ProcessInputPacket() and pulling the
>>> buffer
>>> back out and making a new different packet
out of it. Why? It seems
>>> like the first creation of the packet is
not necessary.
>>>
>>>11) Remove commented-out code in GetPacket()
>>>
>>>12) This code block in ReadDone() will never get
executed:
>>>
>>> if (m_bScanForFrameBegin)
>>> {
>>> ...
>>> }
>>>
>>> Why is it there? It looks to me like it's
left-overs from
>>> the code you started with...
>>>
>>>13) Same comment as #10 above in this code block
in ReadDone()
>>>
>>> else if (m_eState ==
StateGetPacketReadDonePending)
>>> {
>>> ...
>>> }
>>> It appears there is an unnecessary step of
creating a packet.
>>>
>>>14) FindAllTONEFramesLength() does not appear to
be called at all.
>>>
>>>
>>>15) The file win32.pcf should actually be called
toneffdll_win32.pcf.
>>> If it is called win32.pcf then it is
applied to both tonefflib
>>> and toneffdll, and it only needs to be
applied to toneff.
>>>
>>>16) In toneff.h, there are these definitions:
>>>
>>> const char VERSION = (UINT8)(-2);
>>> const char TEMPO = (UINT8)(-3);
>>>
>>> This is needlessly confusing. You are
taking a negative number,
>>> casting it to unsigned number, and then
assigning
>>> it to a char. And then in the code you are
comparing that
>>> to a BYTE. Also, these are declared as
global variables
>>> and there is no need for them to be. They
can just be
>>> preprocessor definitions.
>>>
>>> Why not just make the definitions clear as
in:
>>>
>>> #define HXTONE_SILENCE 0xFF
>>> #define HXTONE_C4 0x3C
>>> ...
>>>
>>>17) In toneff.h, these are public methods:
>>>
>>> UINT32 GetPacketBytesConsumed() { return
m_ulPacketBytesConsumed; }
>>> UINT32 GetDurationConsumed() { return
m_ulDurationConsumed; }
>>>
>>> and they should be private.
>>>
>>>
>>>datatype/tone/renderer:
>>>
>>>1) In libumakefil, you have:
>>>
>>>
project.AddModuleLibraries("audio/tonegen[tonegenlib]
")
>>>
>>> There is no need in a LibraryTarget to have
an
>>> AddModuleLibraries, since libs don't link
with anything.
>>> Instead, just add this line to your
AddModuleIncludes:
>>>
>>>
"audio/tongen/pub",
>>>
>>> Also, is adding "audio/tonegen"
to the AddModuleIncludes
>>> really needed?
>>>
>>>2) In tonefmt.cpp in CreateAssembledPacket(), it
looks
>>> like it only creates m_pMediapkt for the
first IHXPacket
>>> passed in and then just keeps returning
m_pMediapkt. Is
>>> this really what you wanted? So any packets
after the
>>> first one are just thrown away?
>>>
>>>3) In CToneAudioFormat: ecodeAud
ioData(), it appears that
>>> you create a temporary IHXBuffer in
m_pInputBuffer and
>>> then pass it into ParseAudioData(). However,
you already
>>> have an IHXBuffer() in the CMediaPacket.
Therefore, it
>>> appears that this is a needless memcpy. Why
not just use
>>> the IHXBuffer that already exists in the
CMediaPacket?
>>>
>>> Also, on the output, it appears that you are
copying
>>> the output PCM again into a new IHXBuffer
output buffer.
>>> What is the reason for this extra copy on
the output?
>>>
>>>Now the changed files:
>>>
>>> > > -const char*
DataFileSystem::zm_pProtocol = "data";
>>> > > -
>>> > > +//#ifdef
HELIX_FEATURE_TONE_GENERATOR
>>> > > +const char*
DataFileSystem::zm_pProtocol = "data|tone";
>>> > > +//#else
>>> > > +//const char*
DataFileSystem::zm_pProtocol = "data|tone";
>>> > > +//#endif
>>> > > int g_nRefCount_datafsys = 0;
>>> > >
>>>
>>>Shouldn't this be:
>>>
>>>-const char* DataFileSystem::zm_pProtocol
= "data";
>>>-
>>>+#ifdef HELIX_FEATURE_TONE_GENERATOR
>>>+const char* DataFileSystem::zm_pProtocol
= "data|tone";
>>>+#else
>>>+const char* DataFileSystem::zm_pProtocol
= "data";
>>>+#endif
>>>
>>>In other words, if HELIX_FEATURE_TONE_GENERATOR
is
>>>not defined, then datafsys only claims the
"data://" scheme.
>>>
>>> > > +#ifdef HELIX_FEATURE_TONE_GENERATOR
>>> > > +const char VERSION = (UINT8)(-2);
>>> > > +const char TEMPO = (UINT8)(-3);
>>> > > +const char RESOLUTION =
(UINT8)(-4);
>>> > > +const char BLOCK_START =
(UINT8)(-5);
>>> > > +const char BLOCK_END =
(UINT8)(-6);
>>> > > +const char PLAY_BLOCK =
(UINT8)(-7);
>>> > > +const char SET_VOLUME =
(UINT8)(-8);
>>> > > +const char C4 =
(UINT8)(60);
>>> > > +const char REPEAT = (UINT8)(-9);
>>> > > +const char SILENCE = (UINT8)(-1);
>>> > > +#endif
>>> > >
>>>
>>>I saw these definitions somewhere else - I think
in
>>>the file format. They should NOT be duplicated,
but rather
>>>put into a common header file.
>>>
>>> > > + IHXBuffer* pData, IHXRequest*
pRequest);
>>> > > +
>>> > > +#define HELIX_FEATURE_TONE_GENERATOR
1
>>> > > +#ifdef HELIX_FEATURE_TONE_GENERATOR
>>> > > + STDMETHOD(SetSequence)(UINT32
ulNote, UINT32 ulToneDuration,
>>>
>>>HELIX_FEATURE_TONE_GENERATOR should not be
hard-coded
>>>in the code anywhere. Instead, it should be
placed into
>>>the appropriate profile.
>>>
>>>
>>>That's all.
>>>
>>>Eric
>>>
>>>==============================================
>>>Eric Hyche (ehyche real.com)
>>>Technical Lead
>>>Embedded Player and Technologies
>>>RealNetworks, Inc.
>>>
>>>
>>>
>>>_______________________________________________
>>>Datatype-dev mailing list
>>>Datatype-dev helixcommunity.org
>>>http://lists.helixcommunity.org/mailman/listinfo/da
tatype-dev
>>
>>
>>
>>_______________________________________________
>>Datatype-dev mailing list
>>Datatype-dev helixcommunity.org
>>http://lists.helixcommunity.org/mailman/listinfo/da
tatype-dev
>
Modified by : sgadamsetty real.com
Reviewed by :
Date : 04-27-2006
Project : Tone generator plugin for Helix Client DNA
Synopsis: Tone generator plugin for Helix Client DNA
Overview:
Implementation of file system,file format and renderer
component to Helix DNA Client that will act as a
tone sequence generator.
Files Modified:
\filesystem\data\pub\datafsys.h
\filesystem\data\datafsys.cpp
Files Added:
a] Tone Fileformat files:
\datatype\tone\fileformat\toneff.cpp
\datatype\tone\fileformat\toneffdll.cpp
\datatype\tone\fileformat\pub\toneff.h
\datatype\tone\fileformat\pub\toneffmlog.h
\datatype\tone\fileformat\toneffdll
\datatype\tone\fileformat\tonefflib
\datatype\tone\fileformat\Umakefil
\datatype\tone\fileformat\win32.pcf
\datatype\tone\fileformat\toneff.ver
b] Tone renderer files:
\datatype\tone\renderer\tonefmt.cpp
\datatype\tone\renderer\tonerend.cpp
\datatype\tone\renderer\tonerenddll.cpp
\datatype\tone\renderer\pub\tonefmt.h
\datatype\tone\renderer\pub\tonerend.h
\datatype\tone\renderer\dllumakefil
\datatype\tone\renderer\libumakefil
\datatype\tone\renderer\Umakefil
\datatype\tone\renderer\win32.pcf
\datatype\tone\renderer\tonerend.ver
c] Tone generator files:
\audio\tonegen\tonegen.cpp
\audio\tonegen\pub\tonegen.h
\audio\tonegen\libumakefil
\audio\tonegen\Umakefil
\audio\tonegen\win32.pcf
\audio\tonegen\tonerend.ver
Attached added files with this mail.
Image Size and Heap Use impact (Client - Only):
Minor
Distribution Libraries Affected:
Data File system
HTTP File system
Distribution library impact and planned action:
None
Platforms and Profiles Build Verified:
Windows platform, helix-client-all-defines
Platforms and Profiles Functionality verified:
1] Test/verified the functionality with splaypr.exe.
2] Able to play the simple tone and polytone sequences.
3] Tested with multiple repeat note events,block events
and volume change events.
Profile: helix-client-all-defines
Branch: HEAD, Cay150
cvs diff:
Index: datafsys.cpp
============================================================
=======
RCS file: /cvsroot/filesystem/data/datafsys.cpp,v
retrieving revision 1.7
diff -u -w -r1.7 datafsys.cpp
--- datafsys.cpp 2 Nov 2004 22:52:44 -0000 1.7
+++ datafsys.cpp 28 Apr 2006 04:19:47 -0000
 -92,7
+92,9 
#include "hxfiles.h"
#include "ihxpckts.h"
#include "hxver.h"
-
+#include "hxcore.h"
+#include "hxurl.h"
+#include <math.h>
#undef INITGUID
#include "hxstrutl.h"
 -113,8
+115,11 
const char* DataFileSystem::zm_pCopyright =
HXVER_COPYRIGHT;
const char* DataFileSystem::zm_pMoreInfoURL =
HXVER_MOREINFO;
const char* DataFileSystem::zm_pShortName =
"pn-datafsys";
-const char* DataFileSystem::zm_pProtocol =
"data";
-
+//#ifdef HELIX_FEATURE_TONE_GENERATOR
+const char* DataFileSystem::zm_pProtocol =
"data|tone";
+//#else
+//const char* DataFileSystem::zm_pProtocol =
"data|tone";
+//#endif
int g_nRefCount_datafsys = 0;
const char tokenChars[] =
 -133,7
+138,18 
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
};
-
+#ifdef HELIX_FEATURE_TONE_GENERATOR
+const char VERSION = (UINT8)(-2);
+const char TEMPO = (UINT8)(-3);
+const char RESOLUTION = (UINT8)(-4);
+const char BLOCK_START = (UINT8)(-5);
+const char BLOCK_END = (UINT8)(-6);
+const char PLAY_BLOCK = (UINT8)(-7);
+const char SET_VOLUME = (UINT8)(-8);
+const char C4 = (UINT8)(60);
+const char REPEAT = (UINT8)(-9);
+const char SILENCE = (UINT8)(-1);
+#endif
/***********************************************************
*****************
*
* Function:
 -760,7
+776,6 
const char* pURL;
IHXValues* pHeaders = 0;
IHXBuffer* pBuffer0 = 0;
-
hresult = m_pRequest->GetURL(pURL);
if (hresult != HXR_OK)
 -771,7
+786,7 
hresult =
m_pClassFactory->CreateInstance(CLSID_IHXBuffer,
(void**)&pBuffer0);
- hresult = ParseURL(pURL, m_MediaType, pBuffer0);
+ hresult = ParseURL(pURL, m_MediaType,
pBuffer0,m_pRequest);
if (SUCCEEDED(hresult))
{
m_pDataURL = pBuffer0;
 -855,7
+870,7 
CHXString mimeString;
pMimeMapperResponse->AddRef();
- status = ParseURL(pURL, mimeString, NULL);
+ status = ParseURL(pURL, mimeString, NULL,NULL);
status = pMimeMapperResponse->MimeTypeFound(status,
(const
char*)mimeString);
pMimeMapperResponse->Release();
 -915,13
+930,18 
*/
const char DATA_SCHEME[] = "data:";
+#ifdef HELIX_FEATURE_TONE_GENERATOR
+const char TONE_SCHEME[] = "tone:";
+#define TONE_SCHEME_SIZE (sizeof(TONE_SCHEME) - 1)
+#endif
#define DATA_SCHEME_SIZE (sizeof(DATA_SCHEME) - 1)
const char BASE64_TOKEN[] = ";base64";
#define BASE64_TOKEN_SIZE (sizeof(BASE64_TOKEN) - 1)
STDMETHODIMP DataFileObject::ParseURL(const char* pURL,
CHXString&
mimeString,
- IHXBuffer* pBuffer)
+ IHXBuffer* pBuffer,
+ IHXRequest* pRequest)
{
HX_RESULT pnr = HXR_OK;
UINT32 ulDataURLSize = strlen(pURL);
 -932,7
+952,46 
const char* pMimeStringStart = NULL;
const char* pMimeStringEnd = NULL;
BOOL bHasMimeString = TRUE;
+#ifdef HELIX_FEATURE_TONE_GENERATOR
+ HXBOOL bIstoneprotocol = FALSE;
+ CHXURL cURL(pURL, m_pContext);
+ pnr = cURL.GetLastError();
+ IHXValues* pRequestHeaders = NULL;
+
+ /* if (SUCCEEDED(pnr))
+ {
+ IHXBuffer* pToneBuffer = NULL;
+ if (HXR_OK == cURL.GetProperties() &&
pRequestHeaders)
+ {
+ pnr =
pRequestHeaders->GetPropertyBuffer("ToneSequence&q
uot;,
pToneBuffer);
+ if (SUCCEEDED(pnr))
+ {
+ pBuffer = pToneBuffer;
+ HX_RELEASE(pRequestHeaders);
+ HX_RELEASE(pToneBuffer);
+ pnr = HXR_OK;
+ goto exit;
+ }
+ }
+ }*/
+ if(HXR_OK ==
m_pRequest->GetRequestHeaders(pRequestHeaders) &&
pRequestHeaders)
+ {
+ UINT32 ulNote = 0;
+ UINT32 ulToneDuration = 0;
+ UINT32 ulToneVolume = 0;
+
pRequestHeaders->GetPropertyULONG32("Tone",ul
Note);
+
pRequestHeaders->GetPropertyULONG32("ToneDuration&
quot;,ulToneDuration);
+
pRequestHeaders->GetPropertyULONG32("ToneDuration&
quot;,ulToneVolume);
+ if(ulNote != 0 && ulToneDuration !=0
&& ulToneVolume != 0 )
+ {
+
SetSequence(ulNote,ulToneDuration,ulToneVolume,pBuffer);
+ HX_RELEASE(pRequestHeaders);
+ pnr = HXR_OK;
+ goto exit;
+ }
+ }
+#endif
// Skip any leading whitespace
while (*pCurrentChar &&
*pCurrentChar < 0x20)
 -940,6
+999,20 
pCurrentChar++;
}
+#ifdef HELIX_FEATURE_TONE_GENERATOR
+ // pURL must begin with data|tone scheme
+ // dataurl := "data:" [ mediatype ] [
";base64" ] "," data
+ /* toneurl :=
"tone"://[tonename]?Note=value&ToneDuration=
value
+ &ToneVolume=value */
+ // toneurl := "tone"://[testtonename]
+ if(strncasecmp(pCurrentChar, TONE_SCHEME,
TONE_SCHEME_SIZE) == 0)
+ {
+ bIstoneprotocol = TRUE;
+ pCurrentChar += TONE_SCHEME_SIZE;
+ }
+ else
+#endif
+ {
// pURL must begin with data scheme
// dataurl := "data:" [ mediatype ] [
";base64" ] "," data
if (strncasecmp(pCurrentChar, DATA_SCHEME,
DATA_SCHEME_SIZE))
 -951,6
+1024,7 
{
pCurrentChar += DATA_SCHEME_SIZE;
}
+ }
// The URL may begin with "data:",
"data:/", or "data://"
if (*pCurrentChar == '/')
 -962,13
+1036,24 
pCurrentChar++;
}
+#ifdef HELIX_FEATURE_TONE_GENERATOR
+ if(bIstoneprotocol)
+ {
+ while (*pCurrentChar == '?')
+ {
+ pCurrentChar++;
+ }
+ bHasMimeString = FALSE;
+ }
+ else
+#endif
+ {
if (*pCurrentChar == ';' || *pCurrentChar == ',')
{
bHasMimeString = FALSE;
}
else
{
-
if (strncasecmp(pCurrentChar, BASE64_TOKEN,
BASE64_TOKEN_SIZE))
{
pMimeStringStart = pCurrentChar;
 -1048,8
+1133,9 
bHasMimeString = FALSE;
pCurrentChar += BASE64_TOKEN_SIZE;
}
- }
+ }
+ }
if (bHasMimeString)
{
// copy the mime string into the parameter
 -1061,9
+1147,79 
}
else
{
+#ifdef HELIX_FEATURE_TONE_GENERATOR
+ if(bIstoneprotocol)
+ {
+ mimeString =
"audio/x-hx-tonesequence";
+ }
+ else
+#endif
+ {
mimeString = "text/plain";
}
+ }
+#ifdef HELIX_FEATURE_TONE_GENERATOR
+ if(bIstoneprotocol)
+ {
+ UINT32 ulNote = 0;
+ UINT32 ulToneDuration = 0;
+ UINT32 ulToneVolume = 0;
+ BYTE* pOutput = NULL;
+ if (pCurrentChar)
+ {
+ // Check for a Note parameter. If it
exists, remove it
+ // from the URL
+ const char *pEnd = NULL;
+ char ptemp[10] = ;
+ char *pNote = strstr((char
*)pCurrentChar,"Note=" );
+ if(pNote)
+ {
+ pNote +=
strlen("Note=");
+ pEnd = pNote;
+ while (*pEnd != '&')
+ {
+ pEnd++;
+ }
+
SafeStrCpy(ptemp,pNote,pEnd-pNote+1);
+ ulNote = (UINT32) atol((const
char*)(ptemp));
+ }
+ // Check for a ToneDuration parameter. If it
exists,
+ //remove it from the URL
+ pNote = NULL;
+ pNote = strstr(pCurrentChar,
"ToneDuration=");
+ if (pNote)
+ {
+ pNote +=
strlen("ToneDuration=");
+ pEnd = pNote;
+ while (*pEnd != '&')
+ {
+ pEnd++;
+ }
+ SafeStrCpy(ptemp,pNote,pEnd-pNote+1);
+ ulToneDuration = (UINT32)
atol((const char*)(ptemp));
+ }
+ // Check for a ToneVolume parameter. If
it exists,
+ //remove it from the URL
+ pNote = NULL;
+ pNote = strstr(pCurrentChar,
"ToneVolume=");
+ if (pNote)
+ {
+ pNote += strlen("ToneVolume=");
+ pEnd = pNote;
+ while (*pEnd)
+ {
+ pEnd++;
+ }
+ SafeStrCpy(ptemp,pNote,pEnd-pNote+1);
+ ulToneVolume = (UINT32) atol((const
char*)(ptemp));
+ }
+ }
+
SetSequence(ulNote,ulToneDuration,ulToneVolume,pBuffer);
+ }
+ else
+#endif
+ {
// should be a comma between mediatype and data
if (*pCurrentChar != ',')
{
 -1116,17
+1272,57 
}
}
}
+ }
exit:
return pnr;
}
-
-
-
-
-
-
-
-
-
-
+#ifdef HELIX_FEATURE_TONE_GENERATOR
+//Generate simple tone based on specified parameters
+STDMETHODIMP DataFileObject::SetSequence(const UINT32
ulNote,
+const UINT32 ulToneDuration,const UINT32 ulToneVolume,
IHXBuffer* pData)
+{
+ HX_RESULT pnr = HXR_OK;
+ UINT32 ulIndx = 0;
+ BYTE uTempo = 30;//default tempo
+ BYTE uResolution = 64;//default resolution
+ UINT32 ulabsdur = 0;
+ BYTE uRpt = 1;
+ BYTE uRemdur = 0;
+ pData->SetSize(50);
+ BYTE* pOutput = (BYTE*)pData->GetBuffer();
+ BYTE* pStart = pOutput;
+ *pStart++ = VERSION; //VERSION := -2
+ *pStart++ = (UINT8)1; //version_number = 1(default)
+ *pStart++ = TEMPO; //TEMPO = -3
+ *pStart++ = (UINT8)(30);//tempo_modifier = 30(default)
+ *pStart++ = RESOLUTION; //RESOLUTION = -4
+ *pStart++ = (UINT8)64; //resolution_unit = 64(default)
+ *pStart++ = BLOCK_START;//BLOCK_START = -5
+ *pStart++ = (UINT8)0; //block_number = 0(default)
+ ulabsdur = (UINT32)((8* 60 * 1000)/( uResolution *
uTempo));
+ *pStart++ = (UINT8)ulNote; //Note
+ *pStart++ = (UINT8)8; //ToneDuration
+ if(ulToneDuration > ulabsdur)
+ {
+ UINT32 ultemp = ulToneDuration/ulabsdur;
+
+ while(ultemp > 127)
+ {
+ *pStart++ = REPEAT; //REPEAT -9
+ *pStart++ = 127; //REPEAT MULTIPLIER
+ ultemp = ulToneDuration/(127 * ulabsdur);
+ }
+ *pStart++ = REPEAT; //REPEAT -9
+ *pStart++ = (UINT8)(ultemp-1); //REPEAT MULTIPLIER
+ }
+ *pStart++ = (UINT8)SET_VOLUME; //SET_VOLUME = -8;
+ *pStart++ = (UINT8)ulToneVolume;//volume
+ *pStart++ = BLOCK_END; //BLOCK_END = -6
+ *pStart++ = (UINT8)0; //block_number = 0(default)
+ *pStart++ = PLAY_BLOCK; //PLAY_BLOCK = -7
+ *pStart++ = (UINT8)0; //block_number = 0(default)
+ pData->SetSize(pStart - pOutput);
+ return pnr;
+}
+#endif
Index: pub/datafsys.h
============================================================
=======
RCS file: /cvsroot/filesystem/data/pub/datafsys.h,v
retrieving revision 1.2
diff -u -w -r1.2 datafsys.h
--- pub/datafsys.h 9 Jul 2004 18:40:05 -0000 1.2
+++ pub/datafsys.h 28 Apr 2006 04:19:47 -0000
 -307,7
+307,14 
UINT32 m_ulFilePointer;
STDMETHOD(ParseURL)(THIS_ const char* pURL,
CHXString& mimeString,
- IHXBuffer* pData);
+ IHXBuffer* pData, IHXRequest* pRequest);
+
+#define HELIX_FEATURE_TONE_GENERATOR 1
+#ifdef HELIX_FEATURE_TONE_GENERATOR
+ STDMETHOD(SetSequence)(UINT32 ulNote, UINT32
ulToneDuration,
+ UINT32 ulToneVolume, IHXBuffer* pData);
+#endif
+
};
#endif // ndef _DATAFSYS_H_
_______________________________________________
Audio-dev mailing list
Audio-dev helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/audio
-dev
|