diff --git a/Source/Plugins/BasicSpikeDisplay/SpikeDetector/SpikeDetector.cpp b/Source/Plugins/BasicSpikeDisplay/SpikeDetector/SpikeDetector.cpp index 2b4b2a4c1e82a65bb28c6cb20d0e9b3087e7a1fe..5db1eb2ea3226c0f7ba2f895631ff21e119f41d1 100644 --- a/Source/Plugins/BasicSpikeDisplay/SpikeDetector/SpikeDetector.cpp +++ b/Source/Plugins/BasicSpikeDisplay/SpikeDetector/SpikeDetector.cpp @@ -450,7 +450,7 @@ void SpikeDetector::process (AudioSampleBuffer& buffer) channel); thresholds.add((int)*(electrode->thresholds + channel)); } - uint64 timestamp = getTimestamp(electrode->channels[0]) + peakIndex; + int64 timestamp = getTimestamp(electrode->channels[0]) + peakIndex; SpikeEventPtr newSpike = SpikeEvent::createSpikeEvent(spikeChan, timestamp, thresholds, spikeData, 0); // package spikes; diff --git a/Source/Plugins/BinaryWriter/BinaryRecording.cpp b/Source/Plugins/BinaryWriter/BinaryRecording.cpp index 7562d6d1b633268abfbe3438930561c7aaf3355b..5437da004059b4f6fd908d99ee1336bef820e162 100644 --- a/Source/Plugins/BinaryWriter/BinaryRecording.cpp +++ b/Source/Plugins/BinaryWriter/BinaryRecording.cpp @@ -329,12 +329,12 @@ void BinaryRecording::writeEvent(int eventIndex, const MidiMessage& event) } } -void BinaryRecording::writeTimestampSyncText(uint16 sourceID, uint16 sourceIdx, uint64 timestamp, float, String text) +void BinaryRecording::writeTimestampSyncText(uint16 sourceID, uint16 sourceIdx, int64 timestamp, float, String text) { writeMessage(text, sourceID, 255, timestamp); } -void BinaryRecording::writeMessage(String message, uint16 processorID, uint16 channel, uint64 timestamp) +void BinaryRecording::writeMessage(String message, uint16 processorID, uint16 channel, int64 timestamp) { if (messageFile == nullptr) return; @@ -366,7 +366,7 @@ void BinaryRecording::writeTTLEvent(int eventIndex, const MidiMessage& event) EventPtr ev = Event::deserializeFromMessage(event, getEventChannel(eventIndex)); if (!ev) return; - *reinterpret_cast<uint64*>(data) = ev->getTimestamp(); + *reinterpret_cast<int64*>(data) = ev->getTimestamp(); *reinterpret_cast<int16*>(data + 8) = samplePos; *(data + 10) = static_cast<uint8>(ev->getEventType()); *(data + 11) = static_cast<uint8>(ev->getSourceID()); @@ -404,8 +404,8 @@ void BinaryRecording::writeSpike(int electrodeIndex, const SpikeEvent* spike) 42; // 42, from SpikeObject.h spikeBuffer.malloc(totalBytes); *(spikeBuffer.getData()) = static_cast<char>(channel->getChannelType()); - *reinterpret_cast<uint64*>(spikeBuffer.getData() + 1) = spike->getTimestamp(); - *reinterpret_cast<uint64*>(spikeBuffer.getData() + 9) = 0; //Legacy unused value + *reinterpret_cast<int64*>(spikeBuffer.getData() + 1) = spike->getTimestamp(); + *reinterpret_cast<int64*>(spikeBuffer.getData() + 9) = 0; //Legacy unused value *reinterpret_cast<uint16*>(spikeBuffer.getData() + 17) = spike->getSourceID(); *reinterpret_cast<uint16*>(spikeBuffer.getData() + 19) = numChannels; *reinterpret_cast<uint16*>(spikeBuffer.getData() + 21) = chanSamples; diff --git a/Source/Plugins/BinaryWriter/BinaryRecording.h b/Source/Plugins/BinaryWriter/BinaryRecording.h index e75d227f236f07d027f797ddb98281c83f92e5bf..a92f2acd429f274a370618dacce59d75dfe73697 100644 --- a/Source/Plugins/BinaryWriter/BinaryRecording.h +++ b/Source/Plugins/BinaryWriter/BinaryRecording.h @@ -51,7 +51,7 @@ namespace BinaryRecordingEngine void resetChannels() override; void addSpikeElectrode(int index, const SpikeChannel* elec) override; void writeSpike(int electrodeIndex, const SpikeEvent* spike) override; - void writeTimestampSyncText(uint16 sourceID, uint16 sourceIdx, uint64 timestamp, float, String text) override; + void writeTimestampSyncText(uint16 sourceID, uint16 sourceIdx, int64 timestamp, float, String text) override; static RecordEngineManager* getEngineManager(); @@ -64,7 +64,7 @@ namespace BinaryRecordingEngine void openMessageFile(String basepath, int recordingNumber); void openEventFile(String basepath, int recordingNumber); void writeTTLEvent(int eventIndex, const MidiMessage& event); - void writeMessage(String message, uint16 processorID, uint16 channel, uint64 timestamp); + void writeMessage(String message, uint16 processorID, uint16 channel, int64 timestamp); HeapBlock<float> m_scaledBuffer; HeapBlock<int16> m_intBuffer; @@ -76,7 +76,7 @@ namespace BinaryRecordingEngine FILE* messageFile; Array<FILE*> spikeFileArray; int m_recordingNum; - Array<uint64> m_startTS; + Array<int64> m_startTS; CriticalSection diskWriteLock; diff --git a/Source/Plugins/EcubeSource/EcubeThread.cpp b/Source/Plugins/EcubeSource/EcubeThread.cpp index ef9be77475c3a3dd8284a9ad602c9427e81f4378..00e36507b95e4979ac437dd76b744e25dfe75a62 100644 --- a/Source/Plugins/EcubeSource/EcubeThread.cpp +++ b/Source/Plugins/EcubeSource/EcubeThread.cpp @@ -54,7 +54,7 @@ public: HeapBlock<uint32_t, true> bit_conversion_tables; bool buf_timestamp_locked; unsigned long buf_timestamp; - uint64 buf_timestamp64; + int64 buf_timestamp64; unsigned long int_buf_size; DataFormat data_format; unsigned long sampletime_80mhz; diff --git a/Source/Plugins/KWIKFormat/RecordEngine/HDF5Recording.cpp b/Source/Plugins/KWIKFormat/RecordEngine/HDF5Recording.cpp index 55187bb1a724d31c439d4c22fd77de0da55f82c0..19d7f8f4b92e565640b8816ed4dff78122c9a77f 100644 --- a/Source/Plugins/KWIKFormat/RecordEngine/HDF5Recording.cpp +++ b/Source/Plugins/KWIKFormat/RecordEngine/HDF5Recording.cpp @@ -260,7 +260,7 @@ void HDF5Recording::writeEvent(int eventChannel, const MidiMessage& event) } } -void HDF5Recording::writeTimestampSyncText(uint16 sourceID, uint16 sourceIdx, uint64 timestamp, float, String text) +void HDF5Recording::writeTimestampSyncText(uint16 sourceID, uint16 sourceIdx, int64 timestamp, float, String text) { eventFile->writeEvent(1, 0xFF, sourceID, text.toUTF8().getAddress(), timestamp); } diff --git a/Source/Plugins/KWIKFormat/RecordEngine/HDF5Recording.h b/Source/Plugins/KWIKFormat/RecordEngine/HDF5Recording.h index da49e22fe4a1f62ee150dfc3bd303129e8da1cc1..7b9705032f8af2913bbde42a706f4e314d36d137 100644 --- a/Source/Plugins/KWIKFormat/RecordEngine/HDF5Recording.h +++ b/Source/Plugins/KWIKFormat/RecordEngine/HDF5Recording.h @@ -37,7 +37,7 @@ public: void closeFiles() override; void writeData(int writeChannel, int realChannel, const float* buffer, int size) override; void writeEvent(int eventType, const MidiMessage& event) override; - void writeTimestampSyncText(uint16 sourceID, uint16 sourceIdx, uint64 timestamp, float, String text) override; + void writeTimestampSyncText(uint16 sourceID, uint16 sourceIdx, int64 timestamp, float, String text) override; void addDataChannel(int index, const DataChannel* chan) override; void addSpikeElectrode(int index,const SpikeChannel* elec) override; void writeSpike(int electrodeIndex, const SpikeEvent* spike) override; diff --git a/Source/Plugins/KWIKFormat/RecordEngine/KWIKFormat.cpp b/Source/Plugins/KWIKFormat/RecordEngine/KWIKFormat.cpp index 80e3e90a7b8f87fc6d570f7cf132d79a688acaed..2bf8593d367e778fea0e048de2996f81b2a7cac8 100644 --- a/Source/Plugins/KWIKFormat/RecordEngine/KWIKFormat.cpp +++ b/Source/Plugins/KWIKFormat/RecordEngine/KWIKFormat.cpp @@ -257,7 +257,7 @@ void KWEFile::stopRecording() eventData.clear(); } -void KWEFile::writeEvent(int type, uint8 id, uint8 processor, void* data, uint64 timestamp) +void KWEFile::writeEvent(int type, uint8 id, uint8 processor, void* data, int64 timestamp) { if (type > eventNames.size() || type < 0) { @@ -392,7 +392,7 @@ void KWXFile::resetChannels() channelArray.clear(); } -void KWXFile::writeSpike(int groupIndex, int nSamples, const float* data, Array<float>& bitVolts, uint64 timestamp) +void KWXFile::writeSpike(int groupIndex, int nSamples, const float* data, Array<float>& bitVolts, int64 timestamp) { if ((groupIndex < 0) || (groupIndex >= numElectrodes)) { diff --git a/Source/Plugins/KWIKFormat/RecordEngine/KWIKFormat.h b/Source/Plugins/KWIKFormat/RecordEngine/KWIKFormat.h index e9597e72051c4fe49bb49366a8d678ff057b8ef5..73a839a497f3638dd75ee2ce00ce1756cb4a566b 100644 --- a/Source/Plugins/KWIKFormat/RecordEngine/KWIKFormat.h +++ b/Source/Plugins/KWIKFormat/RecordEngine/KWIKFormat.h @@ -78,7 +78,7 @@ public: void initFile(String basename); void startNewRecording(int recordingNumber, KWIKRecordingInfo* info); void stopRecording(); - void writeEvent(int type, uint8 id, uint8 processor, void* data, uint64 timestamp); + void writeEvent(int type, uint8 id, uint8 processor, void* data, int64 timestamp); // void addKwdFile(String filename); void addEventType(String name, DataTypes type, String dataName); String getFileName(); @@ -113,7 +113,7 @@ public: void stopRecording(); void addChannelGroup(int nChannels); void resetChannels(); - void writeSpike(int groupIndex, int nSamples, const float* data, Array<float>& bitVolts, uint64 timestamp); + void writeSpike(int groupIndex, int nSamples, const float* data, Array<float>& bitVolts, int64 timestamp); String getFileName(); protected: diff --git a/Source/Plugins/NWBFormat/NWBRecording.cpp b/Source/Plugins/NWBFormat/NWBRecording.cpp index d904a3b6543e5b3503fdc9f3241bec2a09330a87..1533888dd74d348040860997304190c7d58729a0 100644 --- a/Source/Plugins/NWBFormat/NWBRecording.cpp +++ b/Source/Plugins/NWBFormat/NWBRecording.cpp @@ -190,7 +190,7 @@ void NWBRecordEngine::writeEvent(int eventIndex, const MidiMessage& event) } } -void NWBRecordEngine::writeTimestampSyncText(uint16 sourceID, uint16 sourceIdx, uint64 timestamp, float sourceSampleRate, String text) +void NWBRecordEngine::writeTimestampSyncText(uint16 sourceID, uint16 sourceIdx, int64 timestamp, float sourceSampleRate, String text) { recordFile->writeMessage(text.toUTF8(), double(timestamp) / sourceSampleRate); } diff --git a/Source/Plugins/NWBFormat/NWBRecording.h b/Source/Plugins/NWBFormat/NWBRecording.h index 055ca773e707d1638af9d37d4788864351353b41..58864e061acb9a09ff3a72b04e2816a4d36cf02a 100644 --- a/Source/Plugins/NWBFormat/NWBRecording.h +++ b/Source/Plugins/NWBFormat/NWBRecording.h @@ -41,7 +41,7 @@ void writeEvent(int eventIndex, const MidiMessage& event) override; void addSpikeElectrode(int index,const SpikeChannel* elec) override; void writeSpike(int electrodeIndex, const SpikeEvent* spike) override; - void writeTimestampSyncText(uint16 sourceID, uint16 sourceIdx, uint64 timestamp, float sourceSampleRate, String text) override; + void writeTimestampSyncText(uint16 sourceID, uint16 sourceIdx, int64 timestamp, float sourceSampleRate, String text) override; void resetChannels() override; void setParameter(EngineParameter& parameter) override; diff --git a/Source/Plugins/SerialInput/SerialInput.cpp b/Source/Plugins/SerialInput/SerialInput.cpp index a8cf5569752b68c114d19938ecc7d483e3387803..c9abd0c377dad4b7f559ebff153d6431b9d9881d 100644 --- a/Source/Plugins/SerialInput/SerialInput.cpp +++ b/Source/Plugins/SerialInput/SerialInput.cpp @@ -129,7 +129,7 @@ bool SerialInput::disable() void SerialInput::process (AudioSampleBuffer&) { - uint64 timestamp = CoreServices::getGlobalTimestamp(); + int64 timestamp = CoreServices::getGlobalTimestamp(); setTimestampAndSamples(timestamp, 0); int bytesAvailable = serial.available(); diff --git a/Source/Plugins/SpikeSorter/SpikeSortBoxes.cpp b/Source/Plugins/SpikeSorter/SpikeSortBoxes.cpp index 1029c047d4fdec3295159be25e6a01baa33d3886..04bf5f8cb2392f9695f0a08fae465e364c59c66a 100644 --- a/Source/Plugins/SpikeSorter/SpikeSortBoxes.cpp +++ b/Source/Plugins/SpikeSorter/SpikeSortBoxes.cpp @@ -2208,7 +2208,7 @@ int microSecondsToSpikeTimeBin(SorterSpikePtr s, float t, int ch) } -SorterSpikeContainer::SorterSpikeContainer(const SpikeChannel* channel, SpikeEvent::SpikeBuffer& spikedata, uint64 timestamp) +SorterSpikeContainer::SorterSpikeContainer(const SpikeChannel* channel, SpikeEvent::SpikeBuffer& spikedata, int64 timestamp) { color[0] = color[1] = color[2] = 127; pcProj[0] = pcProj[1] = 0; @@ -2230,7 +2230,7 @@ const SpikeChannel* SorterSpikeContainer::getChannel() const return chan; } -uint64 SorterSpikeContainer::getTimestamp() const +int64 SorterSpikeContainer::getTimestamp() const { return timestamp; } \ No newline at end of file diff --git a/Source/Plugins/SpikeSorter/SpikeSortBoxes.h b/Source/Plugins/SpikeSorter/SpikeSortBoxes.h index 33c15ea3d6daa888927275d702cedfed5da7d95e..9a1ea0aabbbaf8efe624e8c1aae3cb11a9e6b0dc 100644 --- a/Source/Plugins/SpikeSorter/SpikeSortBoxes.h +++ b/Source/Plugins/SpikeSorter/SpikeSortBoxes.h @@ -33,17 +33,17 @@ class SorterSpikeContainer : public ReferenceCountedObject { public: //This invalidates the original SpikeEventPtr, so be careful - SorterSpikeContainer(const SpikeChannel* channel, SpikeEvent::SpikeBuffer& data, uint64 timestamp); + SorterSpikeContainer(const SpikeChannel* channel, SpikeEvent::SpikeBuffer& data, int64 timestamp); SorterSpikeContainer() = delete; const float* getData() const; const SpikeChannel* getChannel() const; - uint64 getTimestamp() const; + int64 getTimestamp() const; uint8 color[3]; uint8 pcProj[2]; uint16 sortedId; private: - uint64 timestamp; + int64 timestamp; HeapBlock<float> data; const SpikeChannel* chan; }; diff --git a/Source/Plugins/SpikeSorter/SpikeSorter.cpp b/Source/Plugins/SpikeSorter/SpikeSorter.cpp index 80b45612ae61e6f10e1a45fcbc553e0ba552e019..d026d3a7d1295b3853b11e06cebd9de1dd7695d0 100644 --- a/Source/Plugins/SpikeSorter/SpikeSorter.cpp +++ b/Source/Plugins/SpikeSorter/SpikeSorter.cpp @@ -922,7 +922,7 @@ void SpikeSorter::process(AudioSampleBuffer& buffer) channel); thresholds.add((int)*(electrode->thresholds + channel)); } - uint64 timestamp = getTimestamp(electrode->channels[0]) + peakIndex; + int64 timestamp = getTimestamp(electrode->channels[0]) + peakIndex; SorterSpikePtr sorterSpike = new SorterSpikeContainer(spikeChan, spikeData, timestamp); diff --git a/Source/Processors/Events/Events.cpp b/Source/Processors/Events/Events.cpp index 9da7c1db2abe7218e975ce70d3f50599116c8394..dc3f8bd04cebfbcb4b9dbed25206bf0e5038766c 100644 --- a/Source/Processors/Events/Events.cpp +++ b/Source/Processors/Events/Events.cpp @@ -37,18 +37,18 @@ EventType EventBase::getBaseType(const MidiMessage& msg) return static_cast<EventType>((*data)&0x7F); } -uint64 EventBase::getTimestamp() const +int64 EventBase::getTimestamp() const { return m_timestamp; } -uint64 EventBase::getTimestamp(const MidiMessage& msg) +int64 EventBase::getTimestamp(const MidiMessage& msg) { const uint8* data = msg.getRawData(); - return *reinterpret_cast<const uint64*>(data + 8); + return *reinterpret_cast<const int64*>(data + 8); } -EventBase::EventBase(EventType type, uint64 timestamp, uint16 sourceID, uint16 sourceSubIdx, uint16 sourceIndex) +EventBase::EventBase(EventType type, int64 timestamp, uint16 sourceID, uint16 sourceSubIdx, uint16 sourceIndex) : m_baseType(type), m_timestamp(timestamp), m_sourceID(sourceID), m_sourceSubIdx(sourceSubIdx), m_sourceIndex(sourceIndex) {} @@ -134,7 +134,7 @@ SystemEventType SystemEvent::getSystemEventType(const MidiMessage& msg) return static_cast<SystemEventType>(*(data + 1)); } -size_t SystemEvent::fillTimestampAndSamplesData(HeapBlock<char>& data, const GenericProcessor* proc, int16 subProcessorIdx, uint64 timestamp, uint32 nSamples) +size_t SystemEvent::fillTimestampAndSamplesData(HeapBlock<char>& data, const GenericProcessor* proc, int16 subProcessorIdx, int64 timestamp, uint32 nSamples) { /** Event packet structure * SYSTEM_EVENT - 1 byte @@ -153,12 +153,12 @@ size_t SystemEvent::fillTimestampAndSamplesData(HeapBlock<char>& data, const Gen *reinterpret_cast<uint16*>(data.getData() + 4) = subProcessorIdx; data[6] = 0; data[7] = 0; - *reinterpret_cast<uint64*>(data.getData() + 8) = timestamp; + *reinterpret_cast<int64*>(data.getData() + 8) = timestamp; *reinterpret_cast<uint32*>(data.getData() + 16) = nSamples; return eventSize; } -size_t SystemEvent::fillTimestampSyncTextData(HeapBlock<char>& data, const GenericProcessor* proc, int16 subProcessorIdx, uint64 timestamp, bool softwareTime) +size_t SystemEvent::fillTimestampSyncTextData(HeapBlock<char>& data, const GenericProcessor* proc, int16 subProcessorIdx, int64 timestamp, bool softwareTime) { /** Event packet structure * SYSTEM_EVENT - 1 byte @@ -195,7 +195,7 @@ size_t SystemEvent::fillTimestampSyncTextData(HeapBlock<char>& data, const Gener data[1] = TIMESTAMP_SYNC_TEXT; *reinterpret_cast<uint16*>(data.getData() + 2) = proc->getNodeId(); *reinterpret_cast<uint16*>(data.getData() + 4) = subProcessorIdx; - *reinterpret_cast<uint64*>(data.getData() + 8) = timestamp; + *reinterpret_cast<int64*>(data.getData() + 8) = timestamp; memcpy(data.getData() + 16, eventString.toUTF8(), textSize); return dataSize; } @@ -234,7 +234,7 @@ EventChannel::EventChannelTypes Event::getEventType(const MidiMessage& msg) return static_cast<EventChannel::EventChannelTypes>(*(data + 1)); } -Event::Event(const EventChannel* channelInfo, uint64 timestamp, uint16 channel) +Event::Event(const EventChannel* channelInfo, int64 timestamp, uint16 channel) : EventBase(PROCESSOR_EVENT, timestamp, channelInfo->getSourceNodeID(), channelInfo->getSubProcessorIdx(), channelInfo->getSourceIndex()), m_channel(channel), m_channelInfo(channelInfo), @@ -277,7 +277,7 @@ bool Event::serializeHeader(EventChannel::EventChannelTypes type, char* buffer, *(reinterpret_cast<uint16*>(buffer + 2)) = m_channelInfo->getSourceNodeID(); *(reinterpret_cast<uint16*>(buffer + 4)) = m_channelInfo->getSubProcessorIdx(); *(reinterpret_cast<uint16*>(buffer + 6)) = m_channelInfo->getSourceIndex(); - *(reinterpret_cast<uint64*>(buffer + 8)) = m_timestamp; + *(reinterpret_cast<int64*>(buffer + 8)) = m_timestamp; *(reinterpret_cast<uint16*>(buffer + 16)) = m_channel; return true; } @@ -302,7 +302,7 @@ bool Event::createChecks(const EventChannel* channelInfo, EventChannel::EventCha //TTLEvent -TTLEvent::TTLEvent(const EventChannel* channelInfo, uint64 timestamp, uint16 channel, const void* eventData) +TTLEvent::TTLEvent(const EventChannel* channelInfo, int64 timestamp, uint16 channel, const void* eventData) : Event(channelInfo, timestamp, channel) { size_t size = m_channelInfo->getDataSize(); @@ -346,7 +346,7 @@ void TTLEvent::serialize(void* dstBuffer, size_t dstSize) const serializeMetaData(buffer + eventSize); } -TTLEventPtr TTLEvent::createTTLEvent(const EventChannel* channelInfo, uint64 timestamp, const void* eventData, int dataSize, uint16 channel) +TTLEventPtr TTLEvent::createTTLEvent(const EventChannel* channelInfo, int64 timestamp, const void* eventData, int dataSize, uint16 channel) { if (!createChecks(channelInfo, EventChannel::TTL, channel)) @@ -364,7 +364,7 @@ TTLEventPtr TTLEvent::createTTLEvent(const EventChannel* channelInfo, uint64 tim return new TTLEvent(channelInfo, timestamp, channel, eventData); } -TTLEventPtr TTLEvent::createTTLEvent(const EventChannel* channelInfo, uint64 timestamp, const void* eventData, int dataSize, const MetaDataValueArray& metaData, uint16 channel) +TTLEventPtr TTLEvent::createTTLEvent(const EventChannel* channelInfo, int64 timestamp, const void* eventData, int dataSize, const MetaDataValueArray& metaData, uint16 channel) { if (!createChecks(channelInfo, EventChannel::TTL, channel, metaData)) @@ -433,7 +433,7 @@ TTLEventPtr TTLEvent::deserializeFromMessage(const MidiMessage& msg, const Event return nullptr; } - uint64 timestamp = *(reinterpret_cast<const uint64*>(buffer + 8)); + int64 timestamp = *(reinterpret_cast<const int64*>(buffer + 8)); uint16 channel = *(reinterpret_cast<const uint16*>(buffer + 16)); ScopedPointer<TTLEvent> event = new TTLEvent(channelInfo, timestamp, channel, (buffer + EVENT_BASE_SIZE)); @@ -451,7 +451,7 @@ TTLEventPtr TTLEvent::deserializeFromMessage(const MidiMessage& msg, const Event } //TextEvent -TextEvent::TextEvent(const EventChannel* channelInfo, uint64 timestamp, uint16 channel, const String& text) +TextEvent::TextEvent(const EventChannel* channelInfo, int64 timestamp, uint16 channel, const String& text) : Event(channelInfo, timestamp, channel), m_text(text) { @@ -484,7 +484,7 @@ void TextEvent::serialize(void* dstBuffer, size_t dstSize) const serializeMetaData(buffer + eventSize); } -TextEventPtr TextEvent::createTextEvent(const EventChannel* channelInfo, uint64 timestamp, const String& text, uint16 channel) +TextEventPtr TextEvent::createTextEvent(const EventChannel* channelInfo, int64 timestamp, const String& text, uint16 channel) { if (!createChecks(channelInfo, EventChannel::TEXT, channel)) { @@ -501,7 +501,7 @@ TextEventPtr TextEvent::createTextEvent(const EventChannel* channelInfo, uint64 return new TextEvent(channelInfo, timestamp, channel, text); } -TextEventPtr TextEvent::createTextEvent(const EventChannel* channelInfo, uint64 timestamp, const String& text, const MetaDataValueArray& metaData, uint16 channel) +TextEventPtr TextEvent::createTextEvent(const EventChannel* channelInfo, int64 timestamp, const String& text, const MetaDataValueArray& metaData, uint16 channel) { if (!createChecks(channelInfo, EventChannel::TEXT, channel, metaData)) { @@ -568,7 +568,7 @@ TextEventPtr TextEvent::deserializeFromMessage(const MidiMessage& msg, const Eve return nullptr; } - uint64 timestamp = *(reinterpret_cast<const uint64*>(buffer + 8)); + int64 timestamp = *(reinterpret_cast<const int64*>(buffer + 8)); uint16 channel = *(reinterpret_cast<const uint16*>(buffer + 16)); String text = String::fromUTF8(reinterpret_cast<const char*>(buffer + EVENT_BASE_SIZE), dataSize); @@ -587,7 +587,7 @@ TextEventPtr TextEvent::deserializeFromMessage(const MidiMessage& msg, const Eve } //BinaryEvent -BinaryEvent::BinaryEvent(const EventChannel* channelInfo, uint64 timestamp, uint16 channel, const void* data, EventChannel::EventChannelTypes type) +BinaryEvent::BinaryEvent(const EventChannel* channelInfo, int64 timestamp, uint16 channel, const void* data, EventChannel::EventChannelTypes type) : Event(channelInfo, timestamp, channel), m_type(type) { @@ -647,7 +647,7 @@ void BinaryEvent::serialize(void* dstBuffer, size_t dstSize) const } template<typename T> -BinaryEventPtr BinaryEvent::createBinaryEvent(const EventChannel* channelInfo, uint64 timestamp, const T* data, int dataSize, uint16 channel) +BinaryEventPtr BinaryEvent::createBinaryEvent(const EventChannel* channelInfo, int64 timestamp, const T* data, int dataSize, uint16 channel) { EventChannel::EventChannelTypes type = getType<T>(); if (type == EventChannel::INVALID) @@ -672,7 +672,7 @@ BinaryEventPtr BinaryEvent::createBinaryEvent(const EventChannel* channelInfo, u } template<typename T> -BinaryEventPtr BinaryEvent::createBinaryEvent(const EventChannel* channelInfo, uint64 timestamp, const T* data, int dataSize, const MetaDataValueArray& metaData, uint16 channel) +BinaryEventPtr BinaryEvent::createBinaryEvent(const EventChannel* channelInfo, int64 timestamp, const T* data, int dataSize, const MetaDataValueArray& metaData, uint16 channel) { EventChannel::EventChannelTypes type = getType<T>(); if (type == EventChannel::INVALID) @@ -746,7 +746,7 @@ BinaryEventPtr BinaryEvent::deserializeFromMessage(const MidiMessage& msg, const jassertfalse; return nullptr; } - uint64 timestamp = *(reinterpret_cast<const uint64*>(buffer + 8)); + int64 timestamp = *(reinterpret_cast<const int64*>(buffer + 8)); uint16 channel = *(reinterpret_cast<const uint16*>(buffer + 16)); ScopedPointer<BinaryEvent> event = new BinaryEvent(channelInfo, timestamp, channel, (buffer + EVENT_BASE_SIZE), type); @@ -764,7 +764,7 @@ BinaryEventPtr BinaryEvent::deserializeFromMessage(const MidiMessage& msg, const } //SpikeEvent -SpikeEvent::SpikeEvent(const SpikeChannel* channelInfo, uint64 timestamp, Array<float> thresholds, HeapBlock<float>& data, uint16 sortedID) +SpikeEvent::SpikeEvent(const SpikeChannel* channelInfo, int64 timestamp, Array<float> thresholds, HeapBlock<float>& data, uint16 sortedID) : EventBase(SPIKE_EVENT, timestamp, channelInfo->getSourceNodeID(), channelInfo->getSubProcessorIdx(), channelInfo->getSourceIndex()), m_thresholds(thresholds), m_channelInfo(channelInfo), @@ -834,7 +834,7 @@ void SpikeEvent::serialize(void* dstBuffer, size_t dstSize) const *(reinterpret_cast<uint16*>(buffer + 2)) = m_channelInfo->getSourceNodeID(); *(reinterpret_cast<uint16*>(buffer + 4)) = m_channelInfo->getSubProcessorIdx(); *(reinterpret_cast<uint16*>(buffer + 6)) = m_channelInfo->getSourceIndex(); - *(reinterpret_cast<uint64*>(buffer + 8)) = m_timestamp; + *(reinterpret_cast<int64*>(buffer + 8)) = m_timestamp; *(reinterpret_cast<uint16*>(buffer + 16)) = m_sortedID; int memIdx = SPIKE_BASE_SIZE; for (int i = 0; i < m_thresholds.size(); i++) @@ -846,7 +846,7 @@ void SpikeEvent::serialize(void* dstBuffer, size_t dstSize) const serializeMetaData(buffer + eventSize); } -SpikeEvent* SpikeEvent::createBasicSpike(const SpikeChannel* channelInfo, uint64 timestamp, Array<float> thresholds, SpikeBuffer& dataSource, uint16 sortedID) +SpikeEvent* SpikeEvent::createBasicSpike(const SpikeChannel* channelInfo, int64 timestamp, Array<float> thresholds, SpikeBuffer& dataSource, uint16 sortedID) { if (!dataSource.m_ready) { @@ -880,7 +880,7 @@ SpikeEvent* SpikeEvent::createBasicSpike(const SpikeChannel* channelInfo, uint64 } -SpikeEventPtr SpikeEvent::createSpikeEvent(const SpikeChannel* channelInfo, uint64 timestamp, Array<float> thresholds, SpikeBuffer& dataSource, uint16 sortedID) +SpikeEventPtr SpikeEvent::createSpikeEvent(const SpikeChannel* channelInfo, int64 timestamp, Array<float> thresholds, SpikeBuffer& dataSource, uint16 sortedID) { if (!channelInfo) { @@ -899,7 +899,7 @@ SpikeEventPtr SpikeEvent::createSpikeEvent(const SpikeChannel* channelInfo, uint } -SpikeEventPtr SpikeEvent::createSpikeEvent(const SpikeChannel* channelInfo, uint64 timestamp, Array<float> thresholds, SpikeBuffer& dataSource, uint16 sortedID, const MetaDataValueArray& metaData) +SpikeEventPtr SpikeEvent::createSpikeEvent(const SpikeChannel* channelInfo, int64 timestamp, Array<float> thresholds, SpikeBuffer& dataSource, uint16 sortedID, const MetaDataValueArray& metaData) { if (!channelInfo) { @@ -973,7 +973,7 @@ SpikeEventPtr SpikeEvent::deserializeFromMessage(const MidiMessage& msg, const S return nullptr; } - uint64 timestamp = *(reinterpret_cast<const uint64*>(buffer + 8)); + int64 timestamp = *(reinterpret_cast<const int64*>(buffer + 8)); uint16 sortedID = *(reinterpret_cast<const uint16*>(buffer + 16)); Array<float> thresholds; thresholds.addArray(reinterpret_cast<const float*>(buffer + SPIKE_BASE_SIZE), nChans); @@ -1080,24 +1080,24 @@ const float* SpikeEvent::SpikeBuffer::getRawPointer() } //Template definitions -template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<int8>(const EventChannel*, uint64, const int8* data, int, uint16); -template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<uint8>(const EventChannel*, uint64, const uint8* data, int, uint16); -template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<int16>(const EventChannel*, uint64, const int16* data, int, uint16); -template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<uint16>(const EventChannel*, uint64, const uint16* data, int, uint16); -template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<int32>(const EventChannel*, uint64, const int32* data, int, uint16); -template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<uint32>(const EventChannel*, uint64, const uint32* data, int, uint16); -template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<int64>(const EventChannel*, uint64, const int64* data, int, uint16); -template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<uint64>(const EventChannel*, uint64, const uint64* data, int, uint16); -template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<float>(const EventChannel*, uint64, const float* data, int, uint16); -template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<double>(const EventChannel*, uint64, const double* data, int, uint16); - -template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<int8>(const EventChannel*, uint64, const int8* data, int, const MetaDataValueArray&, uint16); -template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<uint8>(const EventChannel*, uint64, const uint8* data, int, const MetaDataValueArray&, uint16); -template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<int16>(const EventChannel*, uint64, const int16* data, int, const MetaDataValueArray&, uint16); -template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<uint16>(const EventChannel*, uint64, const uint16* data, int, const MetaDataValueArray&, uint16); -template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<int32>(const EventChannel*, uint64, const int32* data, int, const MetaDataValueArray&, uint16); -template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<uint32>(const EventChannel*, uint64, const uint32* data, int, const MetaDataValueArray&, uint16); -template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<int64>(const EventChannel*, uint64, const int64* data, int, const MetaDataValueArray&, uint16); -template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<uint64>(const EventChannel*, uint64, const uint64* data, int, const MetaDataValueArray&, uint16); -template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<float>(const EventChannel*, uint64, const float* data, int, const MetaDataValueArray&, uint16); -template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<double>(const EventChannel*, uint64, const double* data, int, const MetaDataValueArray&, uint16); \ No newline at end of file +template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<int8>(const EventChannel*, int64, const int8* data, int, uint16); +template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<uint8>(const EventChannel*, int64, const uint8* data, int, uint16); +template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<int16>(const EventChannel*, int64, const int16* data, int, uint16); +template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<uint16>(const EventChannel*, int64, const uint16* data, int, uint16); +template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<int32>(const EventChannel*, int64, const int32* data, int, uint16); +template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<uint32>(const EventChannel*, int64, const uint32* data, int, uint16); +template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<int64>(const EventChannel*, int64, const int64* data, int, uint16); +template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<uint64>(const EventChannel*, int64, const uint64* data, int, uint16); +template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<float>(const EventChannel*, int64, const float* data, int, uint16); +template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<double>(const EventChannel*, int64, const double* data, int, uint16); + +template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<int8>(const EventChannel*, int64, const int8* data, int, const MetaDataValueArray&, uint16); +template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<uint8>(const EventChannel*, int64, const uint8* data, int, const MetaDataValueArray&, uint16); +template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<int16>(const EventChannel*, int64, const int16* data, int, const MetaDataValueArray&, uint16); +template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<uint16>(const EventChannel*, int64, const uint16* data, int, const MetaDataValueArray&, uint16); +template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<int32>(const EventChannel*, int64, const int32* data, int, const MetaDataValueArray&, uint16); +template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<uint32>(const EventChannel*, int64, const uint32* data, int, const MetaDataValueArray&, uint16); +template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<int64>(const EventChannel*, int64, const int64* data, int, const MetaDataValueArray&, uint16); +template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<uint64>(const EventChannel*, int64, const uint64* data, int, const MetaDataValueArray&, uint16); +template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<float>(const EventChannel*, int64, const float* data, int, const MetaDataValueArray&, uint16); +template PLUGIN_API BinaryEventPtr BinaryEvent::createBinaryEvent<double>(const EventChannel*, int64, const double* data, int, const MetaDataValueArray&, uint16); \ No newline at end of file diff --git a/Source/Processors/Events/Events.h b/Source/Processors/Events/Events.h index 14b51f7dda6eabeabda991885071ecaf74901741..2a5076e2b84ac63265ac038851039783381ee6f5 100644 --- a/Source/Processors/Events/Events.h +++ b/Source/Processors/Events/Events.h @@ -86,7 +86,7 @@ public: virtual ~EventBase(); virtual void serialize(void* dstBuffer, size_t dstSize) const = 0; EventType getBaseType() const; - uint64 getTimestamp() const; + int64 getTimestamp() const; uint16 getSourceID() const; uint16 getSubProcessorIdx() const; uint16 getSourceIndex() const; @@ -97,15 +97,15 @@ public: static uint16 getSourceID(const MidiMessage& msg); static uint16 getSubProcessorIdx(const MidiMessage& msg); static uint16 getSourceIndex(const MidiMessage& msg); - static uint64 getTimestamp(const MidiMessage &msg); + static int64 getTimestamp(const MidiMessage &msg); protected: - EventBase(EventType type, uint64 timestamp, uint16 sourceID, uint16 subIdx, uint16 sourceIndex); + EventBase(EventType type, int64 timestamp, uint16 sourceID, uint16 subIdx, uint16 sourceIndex); EventBase() = delete; static bool compareMetaData(const MetaDataEventObject* channelInfo, const MetaDataValueArray& metaData); const EventType m_baseType; - const uint64 m_timestamp; + const int64 m_timestamp; const uint16 m_sourceID; const uint16 m_sourceSubIdx; const uint16 m_sourceIndex; @@ -118,8 +118,8 @@ class PLUGIN_API SystemEvent : public EventBase { public: - static size_t fillTimestampAndSamplesData(HeapBlock<char>& data, const GenericProcessor* proc, int16 subProcessorIdx, uint64 timestamp, uint32 nSamples); - static size_t fillTimestampSyncTextData(HeapBlock<char>& data, const GenericProcessor* proc, int16 subProcessorIdx, uint64 timestamp, bool softwareTime = false); + static size_t fillTimestampAndSamplesData(HeapBlock<char>& data, const GenericProcessor* proc, int16 subProcessorIdx, int64 timestamp, uint32 nSamples); + static size_t fillTimestampSyncTextData(HeapBlock<char>& data, const GenericProcessor* proc, int16 subProcessorIdx, int64 timestamp, bool softwareTime = false); static SystemEventType getSystemEventType(const MidiMessage& msg); static uint32 getNumSamples(const MidiMessage& msg); static String getSyncText(const MidiMessage& msg); @@ -144,7 +144,7 @@ public: static EventPtr deserializeFromMessage(const MidiMessage& msg, const EventChannel* channelInfo); protected: - Event(const EventChannel* channelInfo, uint64 timestamp, uint16 channel); + Event(const EventChannel* channelInfo, int64 timestamp, uint16 channel); Event() = delete; bool serializeHeader(EventChannel::EventChannelTypes type, char* buffer, size_t dstSize) const; static bool createChecks(const EventChannel* channelInfo, EventChannel::EventChannelTypes eventType, uint16 channel); @@ -172,12 +172,12 @@ public: const void* getTTLWordPointer() const; - static TTLEventPtr createTTLEvent(const EventChannel* channelInfo, uint64 timestamp, const void* eventData, int dataSize, uint16 channel); - static TTLEventPtr createTTLEvent(const EventChannel* channelInfo, uint64 timestamp, const void* eventData, int dataSize, const MetaDataValueArray& metaData, uint16 channel); + static TTLEventPtr createTTLEvent(const EventChannel* channelInfo, int64 timestamp, const void* eventData, int dataSize, uint16 channel); + static TTLEventPtr createTTLEvent(const EventChannel* channelInfo, int64 timestamp, const void* eventData, int dataSize, const MetaDataValueArray& metaData, uint16 channel); static TTLEventPtr deserializeFromMessage(const MidiMessage& msg, const EventChannel* channelInfo); private: TTLEvent() = delete; - TTLEvent(const EventChannel* channelInfo, uint64 timestamp, uint16 channel, const void* eventData); + TTLEvent(const EventChannel* channelInfo, int64 timestamp, uint16 channel, const void* eventData); HeapBlock<char> m_data; JUCE_LEAK_DETECTOR(TTLEvent); @@ -195,12 +195,12 @@ public: void serialize(void* dstBuffer, size_t dstSize) const override; String getText() const; - static TextEventPtr createTextEvent(const EventChannel* channelInfo, uint64 timestamp, const String& text, uint16 channel = 0); - static TextEventPtr createTextEvent(const EventChannel* channelInfo, uint64 timestamp, const String& text, const MetaDataValueArray& metaData, uint16 channel = 0); + static TextEventPtr createTextEvent(const EventChannel* channelInfo, int64 timestamp, const String& text, uint16 channel = 0); + static TextEventPtr createTextEvent(const EventChannel* channelInfo, int64 timestamp, const String& text, const MetaDataValueArray& metaData, uint16 channel = 0); static TextEventPtr deserializeFromMessage(const MidiMessage& msg, const EventChannel* channelInfo); private: TextEvent() = delete; - TextEvent(const EventChannel* channelInfo, uint64 timestamp, uint16 channel, const String& text); + TextEvent(const EventChannel* channelInfo, int64 timestamp, uint16 channel, const String& text); const String m_text; JUCE_LEAK_DETECTOR(TextEvent); @@ -221,16 +221,16 @@ public: EventChannel::EventChannelTypes getBinaryType() const; template<typename T> - static BinaryEventPtr createBinaryEvent(const EventChannel* channelInfo, uint64 timestamp, const T* data, int dataSize, uint16 channel = 0); + static BinaryEventPtr createBinaryEvent(const EventChannel* channelInfo, int64 timestamp, const T* data, int dataSize, uint16 channel = 0); template<typename T> - static BinaryEventPtr createBinaryEvent(const EventChannel* channelInfo, uint64 timestamp, const T* data, int dataSize, const MetaDataValueArray& metaData, uint16 channel = 0); + static BinaryEventPtr createBinaryEvent(const EventChannel* channelInfo, int64 timestamp, const T* data, int dataSize, const MetaDataValueArray& metaData, uint16 channel = 0); static BinaryEventPtr deserializeFromMessage(const MidiMessage& msg, const EventChannel* channelInfo); private: BinaryEvent() = delete; - BinaryEvent(const EventChannel* channelInfo, uint64 timestamp, uint16 channel, const void* data, EventChannel::EventChannelTypes type); + BinaryEvent(const EventChannel* channelInfo, int64 timestamp, uint16 channel, const void* data, EventChannel::EventChannelTypes type); template<typename T> static EventChannel::EventChannelTypes getType(); @@ -291,14 +291,14 @@ public: uint16 getSortedID() const; - static SpikeEventPtr createSpikeEvent(const SpikeChannel* channelInfo, uint64 timestamp, Array<float> thresholds, SpikeBuffer& dataSource, uint16 sortedID); - static SpikeEventPtr createSpikeEvent(const SpikeChannel* channelInfo, uint64 timestamp, Array<float> thresholds, SpikeBuffer& dataSource, uint16 sortedID, const MetaDataValueArray& metaData); + static SpikeEventPtr createSpikeEvent(const SpikeChannel* channelInfo, int64 timestamp, Array<float> thresholds, SpikeBuffer& dataSource, uint16 sortedID); + static SpikeEventPtr createSpikeEvent(const SpikeChannel* channelInfo, int64 timestamp, Array<float> thresholds, SpikeBuffer& dataSource, uint16 sortedID, const MetaDataValueArray& metaData); static SpikeEventPtr deserializeFromMessage(const MidiMessage& msg, const SpikeChannel* channelInfo); private: SpikeEvent() = delete; - SpikeEvent(const SpikeChannel* channelInfo, uint64 timestamp, Array<float> thresholds, HeapBlock<float>& data, uint16 sortedID); - static SpikeEvent* createBasicSpike(const SpikeChannel* channelInfo, uint64 timestamp, Array<float> threshold, SpikeBuffer& dataSource, uint16 sortedID); + SpikeEvent(const SpikeChannel* channelInfo, int64 timestamp, Array<float> thresholds, HeapBlock<float>& data, uint16 sortedID); + static SpikeEvent* createBasicSpike(const SpikeChannel* channelInfo, int64 timestamp, Array<float> threshold, SpikeBuffer& dataSource, uint16 sortedID); const Array<float> m_thresholds; const SpikeChannel* m_channelInfo; diff --git a/Source/Processors/RecordNode/OriginalRecording.cpp b/Source/Processors/RecordNode/OriginalRecording.cpp index 8dd3b0c5a75774a612cfc2e3bc33d8a3a030049b..c5d16241105194f1e28f439da20fe95a43aba38e 100644 --- a/Source/Processors/RecordNode/OriginalRecording.cpp +++ b/Source/Processors/RecordNode/OriginalRecording.cpp @@ -405,12 +405,12 @@ void OriginalRecording::writeEvent(int eventIndex, const MidiMessage& event) } } -void OriginalRecording::writeTimestampSyncText(uint16 sourceID, uint16 sourceIdx, uint64 timestamp, float, String text) +void OriginalRecording::writeTimestampSyncText(uint16 sourceID, uint16 sourceIdx, int64 timestamp, float, String text) { writeMessage(text, sourceID, 255, timestamp); } -void OriginalRecording::writeMessage(String message, uint16 processorID, uint16 channel, uint64 timestamp) +void OriginalRecording::writeMessage(String message, uint16 processorID, uint16 channel, int64 timestamp) { if (messageFile == nullptr) return; @@ -442,7 +442,7 @@ void OriginalRecording::writeTTLEvent(int eventIndex, const MidiMessage& event) EventPtr ev = Event::deserializeFromMessage(event, getEventChannel(eventIndex)); if (!ev) return; - *reinterpret_cast<uint64*>(data) = ev->getTimestamp(); + *reinterpret_cast<int64*>(data) = ev->getTimestamp(); *reinterpret_cast<int16*>(data + 8) = samplePos; *(data + 10) = static_cast<uint8>(ev->getEventType()); *(data + 11) = static_cast<uint8>(ev->getSourceID()); @@ -663,8 +663,8 @@ void OriginalRecording::writeSpike(int electrodeIndex, const SpikeEvent* spike) 42; // 42, from SpikeObject.h spikeBuffer.malloc(totalBytes); *(spikeBuffer.getData()) = static_cast<char>(channel->getChannelType()); - *reinterpret_cast<uint64*>(spikeBuffer.getData() + 1) = spike->getTimestamp(); - *reinterpret_cast<uint64*>(spikeBuffer.getData() + 9) = 0; //Legacy unused value + *reinterpret_cast<int64*>(spikeBuffer.getData() + 1) = spike->getTimestamp(); + *reinterpret_cast<int64*>(spikeBuffer.getData() + 9) = 0; //Legacy unused value *reinterpret_cast<uint16*>(spikeBuffer.getData() + 17) = spike->getSourceID(); *reinterpret_cast<uint16*>(spikeBuffer.getData() + 19) = numChannels; *reinterpret_cast<uint16*>(spikeBuffer.getData() + 21) = chanSamples; diff --git a/Source/Processors/RecordNode/OriginalRecording.h b/Source/Processors/RecordNode/OriginalRecording.h index 380cf2a26d00b951c8d7ddeb36b3d2fe3eb6e6dd..e417a1b708a9010918753dd7f09917b679205dc5 100644 --- a/Source/Processors/RecordNode/OriginalRecording.h +++ b/Source/Processors/RecordNode/OriginalRecording.h @@ -55,7 +55,7 @@ public: void resetChannels() override; void addSpikeElectrode(int index, const SpikeChannel* elec) override; void writeSpike(int electrodeIndex, const SpikeEvent* spike) override; - void writeTimestampSyncText(uint16 sourceID, uint16 sourceIdx, uint64 timestamp, float sourceSampleRate, String text) override; + void writeTimestampSyncText(uint16 sourceID, uint16 sourceIdx, int64 timestamp, float sourceSampleRate, String text) override; static RecordEngineManager* getEngineManager(); @@ -72,7 +72,7 @@ private: void openMessageFile(File rootFolder); void writeTTLEvent(int eventIndex, const MidiMessage& event); - void writeMessage(String message, uint16 processorID, uint16 channel, uint64 timestamp); + void writeMessage(String message, uint16 processorID, uint16 channel, int64 timestamp); void writeXml(); diff --git a/Source/Processors/RecordNode/RecordEngine.h b/Source/Processors/RecordNode/RecordEngine.h index c1f94adbfabcf8d125b71a5bb998bbd11a17997a..a87fa260f35704685923379b0cc6df697c8c1a4e 100644 --- a/Source/Processors/RecordNode/RecordEngine.h +++ b/Source/Processors/RecordNode/RecordEngine.h @@ -106,7 +106,7 @@ public: virtual void writeEvent (int eventChannel, const MidiMessage& event) = 0; /** Handle the timestamp sync text messages*/ - virtual void writeTimestampSyncText(uint16 sourceID, uint16 sourceIdx, uint64 timestamp, float sourceSampleRate, String text) = 0; + virtual void writeTimestampSyncText(uint16 sourceID, uint16 sourceIdx, int64 timestamp, float sourceSampleRate, String text) = 0; /** Called when acquisition starts once for each processor that might record continuous data */ virtual void registerProcessor (const GenericProcessor* processor); diff --git a/Source/Processors/RecordNode/RecordThread.cpp b/Source/Processors/RecordNode/RecordThread.cpp index 1d2c3ba616080266d5ffd5dab5b7d7ff65614779..6c0e81bd0e5837e6ad55840acffedb3bebf61981 100644 --- a/Source/Processors/RecordNode/RecordThread.cpp +++ b/Source/Processors/RecordNode/RecordThread.cpp @@ -144,7 +144,7 @@ void RecordThread::writeData(const AudioSampleBuffer& dataBuffer, int maxSamples { uint16 sourceID = SystemEvent::getSourceID(event); uint16 subProcIdx = SystemEvent::getSubProcessorIdx(event); - uint64 timestamp = SystemEvent::getTimestamp(event); + int64 timestamp = SystemEvent::getTimestamp(event); EVERY_ENGINE->writeTimestampSyncText(sourceID, subProcIdx, timestamp, AccessClass::getProcessorGraph()->getRecordNode()->getSourceTimestamp(sourceID, subProcIdx), SystemEvent::getSyncText(event));