The Lab (Technical Talk) > Protocol Discussions

file format for FPP

(1/3) > >>

charleskerr:
With out having to dig through others code, is there a place that the file format for the FPP is documented, if one wanted to export to that format?

David Pitts:
Yes. When I get home I will place it in documents and place a link to it here.

smeighan:
and to go along with dave's document, here is the routine that writes a fpp *.fseq file from xlights


--- Code: ---void xLightsFrame::WriteFalconPiFile(const wxString& filename)
{
    wxUint8 vMinor = 0;
    wxUint8 vMajor = 1;
    wxUint32 dataOffset = 28;
    wxUint16 fixedHeaderLength = 28;
    wxUint32 stepSize = SeqNumChannels + (SeqNumChannels%4);
    // Fixed 50 Milliseconds
    wxUint16 stepTime = 50;
    // Ignored by Pi Player
    wxUint16 numUniverses = 0;
    // Ignored by Pi Player
    wxUint16 universeSize = 0;
    // Gamma 0=encoded 1=linear
    wxUint8 gamma = 1;
    // Gamma 0=unknown 1=mono 2=RGB
    wxUint8 colorEncoding = 2;

    wxFile f;
    // Step Size must be multiple of 4
    //wxUint8 buf[stepSize];
    wxUint8* buf;
    buf = (wxUint8 *)calloc(sizeof(wxUint8),stepSize);

    size_t ch;
    if (!f.Create(filename,true))
    {
        ConversionError(_("Unable to create file: ")+filename);
        return;
    }

    // Header Information
    // Format Identifier
    buf[0] = 'F';
    buf[1] = 'S';
    buf[2] = 'E';
    buf[3] = 'Q';
    // Data offset
    buf[4] = (wxUint8)(dataOffset%256);
    buf[5] = (wxUint8)(dataOffset/256);
    // Data offset
    buf[6] = vMinor;
    buf[7] = vMajor;
    // Fixed header length
    buf[8] = (wxUint8)(fixedHeaderLength%256);
    buf[9] = (wxUint8)(fixedHeaderLength/256);
    // Step Size
    buf[10] = (wxUint8)(stepSize & 0xFF);
    buf[11] = (wxUint8)((stepSize >> 8) & 0xFF);
    buf[12] = (wxUint8)((stepSize >> 16) & 0xFF);
    buf[13] = (wxUint8)((stepSize >> 24) & 0xFF);
    // Number of Steps
    buf[14] = (wxUint8)(SeqNumPeriods & 0xFF);
    buf[15] = (wxUint8)((SeqNumPeriods >> 8) & 0xFF);
    buf[16] = (wxUint8)((SeqNumPeriods >> 16) & 0xFF);
    buf[17] = (wxUint8)((SeqNumPeriods >> 24) & 0xFF);
    // Step time in ms
    buf[18] = (wxUint8)(stepTime & 0xFF);
    buf[19] = (wxUint8)((stepTime >> 8) & 0xFF);
    // universe count
    buf[20] = (wxUint8)(numUniverses & 0xFF);
    buf[21] = (wxUint8)((numUniverses >> 8) & 0xFF);
    // universe Size
    buf[22] = (wxUint8)(universeSize & 0xFF);
    buf[23] = (wxUint8)((universeSize >> 8) & 0xFF);
    // universe Size
    buf[24] = gamma;
    // universe Size
    buf[25] = colorEncoding;
    buf[26] =0;
    buf[27] = 0;
    f.Write(buf,fixedHeaderLength);

    for (long period=0; period < SeqNumPeriods; period++)
    {
        //if (period % 500 == 499) TextCtrlConversionStatus->AppendText(wxString::Format("Writing time period %ld\n",period+1));
        wxYield();
        for(ch=0;ch<stepSize;ch++)
        {
          buf[ch] = ch < SeqNumChannels ? SeqData[(ch *SeqNumPeriods) + period] : 0;
        }
        f.Write(buf,stepSize);
    }
    f.Close();
}
--- End code ---

David Pitts:
Here is the file.

[attachment deleted by admin]

MyKroFt:
for future reference - please put pasted code into the CODE BBC - that way it does not get displayed differently - Seans code for me has smiles etc into it - so the forum software is not displaying it in its orig form.....

Myk

Navigation

[0] Message Index

[#] Next page

Go to full version