Ejemplo n.º 1
0
void KWDFile::startNewRecording(int recordingNumber, int nChannels, KWIKRecordingInfo* info)
{
    this->recordingNumber = recordingNumber;
    this->nChannels = nChannels;
    this->multiSample = info->multiSample;
    uint8 mSample = info->multiSample ? 1 : 0;

	ScopedPointer<HDF5RecordingData> bitVoltsSet;
	ScopedPointer<HDF5RecordingData> sampleRateSet;

    String recordPath = String("/recordings/")+String(recordingNumber);
    CHECK_ERROR(createGroup(recordPath));
    CHECK_ERROR(setAttributeStr(info->name,recordPath,String("name")));
    CHECK_ERROR(setAttribute(U64,&(info->start_time),recordPath,String("start_time")));
    CHECK_ERROR(setAttribute(U32,&(info->start_sample),recordPath,String("start_sample")));
    CHECK_ERROR(setAttribute(F32,&(info->sample_rate),recordPath,String("sample_rate")));
    CHECK_ERROR(setAttribute(U32,&(info->bit_depth),recordPath,String("bit_depth")));
    CHECK_ERROR(createGroup(recordPath+"/application_data"));
   // CHECK_ERROR(setAttributeArray(F32,info->bitVolts.getRawDataPointer(),info->bitVolts.size(),recordPath+"/application_data",String("channel_bit_volts")));
	bitVoltsSet = createDataSet(F32, info->bitVolts.size(), 0, recordPath + "/application_data/channel_bit_volts");
	if (bitVoltsSet.get())
		bitVoltsSet->writeDataBlock(info->bitVolts.size(), F32, info->bitVolts.getRawDataPointer());
	else
		std::cerr << "Error creating bitvolts data set" << std::endl;
	
    CHECK_ERROR(setAttribute(U8,&mSample,recordPath+"/application_data",String("is_multiSampleRate_data")));
    //CHECK_ERROR(setAttributeArray(F32,info->channelSampleRates.getRawDataPointer(),info->channelSampleRates.size(),recordPath+"/application_data",String("channel_sample_rates")));
	sampleRateSet = createDataSet(F32, info->channelSampleRates.size(), 0, recordPath + "/application_data/channel_sample_rates");
	if (sampleRateSet.get())
		sampleRateSet->writeDataBlock(info->channelSampleRates.size(), F32, info->channelSampleRates.getRawDataPointer());
	else
		std::cerr << "Error creating sample rates data set" << std::endl;

    recdata = createDataSet(I16,0,nChannels,CHUNK_XSIZE,recordPath+"/data");
    if (!recdata.get())
        std::cerr << "Error creating data set" << std::endl;

	tsData = createDataSet(I64, 0, nChannels, TIMESTAMP_CHUNK_SIZE, recordPath + "/application_data/timestamps");
	if (!tsData.get())
		std::cerr << "Error creating timestamps data set" << std::endl;

    curChan = nChannels;
}
Ejemplo n.º 2
0
    Result fetch (Journal journal)
    {
        Result result;

        ScopedPointer <HTTPClientBase> client (HTTPClientBase::New ());

        HTTPClientBase::result_type httpResult (client->get (m_url));

        if (httpResult.first == 0)
        {
            //Logger::outputDebugString (httpResult.second->toString ());
        }
        else
        {
            journal.error <<
                "HTTP GET to " << m_url.full().toStdString() <<
                " failed: '" << httpResult.first.message () << "'";
        }

        return result;
    }