Skip to content
Snippets Groups Projects
Commit 81648f71 authored by Aaron Cuevas Lopez's avatar Aaron Cuevas Lopez
Browse files

Merge branch 'sept-en-filereader_Adjustments' into development

parents fe3f24e4 0da0e0ed
Branches
No related tags found
No related merge requests found
......@@ -23,92 +23,113 @@
#include "FileSource.h"
FileSource::FileSource() : fileOpened(false), numRecords(0), activeRecord(-1)
FileSource::FileSource()
: fileOpened (false)
, numRecords (0)
, activeRecord (-1)
, filename ("")
{
}
FileSource::~FileSource()
{
}
int FileSource::getNumRecords()
int FileSource::getNumRecords() const
{
return numRecords;
}
String FileSource::getRecordName(int index)
String FileSource::getRecordName (int index) const
{
return infoArray[index].name;
}
int FileSource::getRecordNumChannels(int index)
int FileSource::getRecordNumChannels (int index) const
{
return infoArray[index].channels.size();
}
int FileSource::getActiveNumChannels()
int FileSource::getActiveNumChannels() const
{
return getRecordNumChannels(activeRecord);
return getRecordNumChannels (activeRecord);
}
float FileSource::getRecordSampleRate(int index)
float FileSource::getRecordSampleRate (int index) const
{
return infoArray[index].sampleRate;
}
float FileSource::getActiveSampleRate()
float FileSource::getActiveSampleRate() const
{
return getRecordSampleRate(activeRecord);
return getRecordSampleRate (activeRecord);
}
int64 FileSource::getRecordNumSamples(int index)
int64 FileSource::getRecordNumSamples (int index) const
{
return infoArray[index].numSamples;
}
int64 FileSource::getActiveNumSamples()
int64 FileSource::getActiveNumSamples() const
{
return getRecordNumSamples(activeRecord);
return getRecordNumSamples (activeRecord);
}
int FileSource::getActiveRecord()
int FileSource::getActiveRecord() const
{
return activeRecord;
}
RecordedChannelInfo FileSource::getChannelInfo(int recordIndex, int channel)
RecordedChannelInfo FileSource::getChannelInfo (int recordIndex, int channel) const
{
return infoArray[recordIndex].channels[channel];
}
RecordedChannelInfo FileSource::getChannelInfo(int channel)
RecordedChannelInfo FileSource::getChannelInfo (int channel) const
{
return getChannelInfo(activeRecord, channel);
return getChannelInfo (activeRecord, channel);
}
void FileSource::setActiveRecord(int index)
void FileSource::setActiveRecord (int index)
{
activeRecord = index;
updateActiveRecord();
}
bool FileSource::fileIsOpened()
bool FileSource::isFileOpened() const
{
return fileOpened;
}
String FileSource::getFileName()
String FileSource::getFileName() const
{
return filename;
}
bool FileSource::OpenFile(File file)
bool FileSource::OpenFile (File file)
{
if (Open(file))
if (Open (file))
{
fileOpened = true;
fillRecordInfo();
filename = file.getFullPathName();
}
else
......@@ -116,5 +137,6 @@ bool FileSource::OpenFile(File file)
fileOpened = false;
filename = String::empty;
}
return fileOpened;
}
\ No newline at end of file
}
......@@ -27,42 +27,46 @@
#include "../../../JuceLibraryCode/JuceHeader.h"
#include "../PluginManager/OpenEphysPlugin.h"
struct RecordedChannelInfo
{
String name;
float bitVolts;
};
class PLUGIN_API FileSource
{
public:
FileSource();
virtual ~FileSource();
int getNumRecords();
String getRecordName(int index);
int getNumRecords() const;
int getActiveRecord() const;
String getRecordName (int index) const;
int getActiveRecord();
void setActiveRecord(int index);
float getRecordSampleRate (int index) const;
int getRecordNumChannels (int index) const;
int64 getRecordNumSamples (int index) const;
float getRecordSampleRate(int index);
int getRecordNumChannels(int index);
int64 getRecordNumSamples(int index);
float getActiveSampleRate() const;
int getActiveNumChannels() const;
int64 getActiveNumSamples() const;
float getActiveSampleRate();
int getActiveNumChannels();
int64 getActiveNumSamples();
RecordedChannelInfo getChannelInfo (int recordIndex, int channel) const;
RecordedChannelInfo getChannelInfo (int channel) const;
RecordedChannelInfo getChannelInfo(int recordIndex, int channel);
RecordedChannelInfo getChannelInfo(int channel);
void setActiveRecord (int index);
bool OpenFile(File file);
bool fileIsOpened();
String getFileName();
bool OpenFile (File file);
bool isFileOpened() const;
String getFileName() const;
virtual int readData (int16* buffer, int nSamples) = 0;
virtual void processChannelData (int16* inBuffer, float* outBuffer, int channel, int64 numSamples) = 0;
virtual void seekTo (int64 sample) = 0;
virtual int readData(int16* buffer, int nSamples) =0;
virtual void processChannelData(int16* inBuffer, float* outBuffer, int channel, int64 numSamples)=0;
virtual void seekTo(int64 sample) =0;
protected:
struct RecordInfo
......@@ -79,14 +83,14 @@ protected:
int activeRecord;
String filename;
private:
virtual bool Open(File file)=0;
virtual void fillRecordInfo()=0;
virtual void updateActiveRecord()=0;
virtual bool Open (File file) = 0;
virtual void fillRecordInfo() = 0;
virtual void updateActiveRecord() = 0;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(FileSource);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileSource);
};
#endif // FILESOURCE_H_INCLUDED
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment