Skip to content

Commit bd37a08

Browse files
committed
Fix FileReader merge conflicts
1 parent 051b146 commit bd37a08

2 files changed

Lines changed: 19 additions & 68 deletions

File tree

Source/Plugins/LfpDisplayNodeAlpha/LfpDisplayCanvas.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ LfpDisplayCanvas::LfpDisplayCanvas(LfpDisplayNode* processor_) :
8282
TopLevelWindow::getTopLevelWindow(0)->addKeyListener(this);
8383

8484
optionsDrawerIsOpen = false;
85-
m_SpikeRasterPlottingFlag = false;
85+
8686
}
8787

8888
LfpDisplayCanvas::~LfpDisplayCanvas()
@@ -2120,6 +2120,7 @@ LfpDisplay::LfpDisplay(LfpDisplayCanvas* c, Viewport* v)
21202120
, viewport(v)
21212121
, channelsReversed(false)
21222122
, displaySkipAmt(0)
2123+
, m_SpikeRasterPlottingFlag(false)
21232124
{
21242125
perPixelPlotter = new PerPixelBitmapPlotter(this);
21252126
supersampledPlotter = new SupersampledBitmapPlotter(this);

Source/Processors/FileReader/FileReader.cpp

Lines changed: 17 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@ FileReader::FileReader()
6060
supportedExtensions.set (extensions[j].toLowerCase(), i + 1);
6161
}
6262
}
63-
64-
/*
65-
const DataChannel* in = getDataChannel(0);
66-
EventChannel* ev = new EventChannel(EventChannel::TTL, 8, 1, (in) ? in->getSampleRate() : CoreServices::getGlobalSampleRate(), this);
67-
moduleEventChannels.add(ev);
68-
*/
6963
}
7064

7165

@@ -83,6 +77,12 @@ AudioProcessorEditor* FileReader::createEditor()
8377
return editor;
8478
}
8579

80+
void FileReader::createEventChannels()
81+
{
82+
//editor = new FileReaderEditor (this, true);
83+
84+
//return editor;
85+
}
8686

8787
bool FileReader::isReady()
8888
{
@@ -109,8 +109,8 @@ float FileReader::getDefaultSampleRate() const
109109

110110
int FileReader::getDefaultNumDataOutputs(DataChannel::DataChannelTypes type, int subproc) const
111111
{
112-
if (subproc != 0) return 0;
113-
if (type != DataChannel::HEADSTAGE_CHANNEL) return 0;
112+
if (subproc != 0) return 0;
113+
if (type != DataChannel::HEADSTAGE_CHANNEL) return 0;
114114
if (input)
115115
return currentNumChannels;
116116
else
@@ -253,45 +253,15 @@ void FileReader::updateSettings()
253253

254254
void FileReader::process (AudioSampleBuffer& buffer)
255255
{
256-
257-
const int samplesNeeded = int (float (buffer.getNumSamples()) * (getDefaultSampleRate() / 44100.0f));
256+
const int samplesNeededPerBuffer = int (float (buffer.getNumSamples()) * (getDefaultSampleRate() / 44100.0f));
257+
m_samplesPerBuffer.set(samplesNeededPerBuffer);
258258
// FIXME: needs to account for the fact that the ratio might not be an exact
259259
// integer value
260-
int samplesRead = 0;
261-
262-
while (samplesRead < samplesNeeded)
260+
261+
// if cache window id == 0, we need to read and cache BUFFER_WINDOW_CACHE_SIZE more buffer windows
262+
if (bufferCacheWindow == 0)
263263
{
264-
count +=1;
265-
int samplesToRead = samplesNeeded - samplesRead;
266-
int iterationsPerSecond = getDefaultSampleRate()/samplesToRead;
267-
int sample = getDefaultSampleRate()-iterationsPerSecond*samplesToRead;
268-
//std::cout<<"sample: " <<sample<<"\n";
269-
if ( (currentSample + samplesToRead) > stopSample)
270-
{
271-
samplesToRead = stopSample - currentSample;
272-
if (samplesToRead > 0)
273-
input->readData (readBuffer + samplesRead, samplesToRead);
274-
275-
input->seekTo (startSample);
276-
currentSample = startSample;
277-
}
278-
else
279-
{
280-
input->readData (readBuffer + samplesRead, samplesToRead);
281-
currentSample += samplesToRead;
282-
}
283-
//std::cout<<"samplesRead: " << samplesRead << "\n";
284-
//std::cout<<"mod operation: " << count % iterationsPerSecond << "\n";
285-
if (count % iterationsPerSecond == 0){
286-
int *evntData= 0;
287-
TTLEventPtr event = TTLEvent::createTTLEvent(moduleEventChannels[0], getTimestamp(0),
288-
&evntData, sizeof(int), 0);
289-
//TTLEvent::createTTLEvent(<#const EventChannel *channelInfo#>, <#int64 timestamp#>, <#const void *eventData#>, <#int dataSize#>, <#uint16 channel#>)
290-
addEvent(moduleEventChannels[0], event, sample);
291-
//addEvent(<#int channelIndex#>, <#const Event *event#>, <#int sampleNum#>)
292-
}
293-
294-
samplesRead += samplesToRead;
264+
switchBuffer();
295265
}
296266

297267
for (int i = 0; i < currentNumChannels; ++i)
@@ -302,9 +272,9 @@ void FileReader::process (AudioSampleBuffer& buffer)
302272
i,
303273
samplesNeededPerBuffer);
304274
}
305-
306-
timestamp += samplesNeeded;
307-
setTimestampAndSamples(timestamp, samplesNeeded);
275+
276+
timestamp += samplesNeededPerBuffer;
277+
setTimestampAndSamples(timestamp, samplesNeededPerBuffer);
308278

309279
bufferCacheWindow += 1;
310280
bufferCacheWindow %= BUFFER_WINDOW_CACHE_SIZE;
@@ -350,25 +320,6 @@ int64 FileReader::millisecondsToSamples (unsigned int ms) const
350320
return (int64) (currentSampleRate * float (ms) / 1000.f);
351321
}
352322

353-
<<<<<<< HEAD
354-
void FileReader::createEventChannels(){
355-
356-
moduleEventChannels.clear();
357-
358-
const DataChannel* in = getDataChannel(0);
359-
EventChannel* ev = new EventChannel(EventChannel::TTL, 8, 1, (in) ? in->getSampleRate() : CoreServices::getGlobalSampleRate(), this);
360-
361-
ev->setName("regular file reader output ");
362-
ev->setDescription("Triggers about every second");
363-
String identifier = "secondly.reader.";
364-
String typeDesc = "secondly";
365-
ev->setIdentifier(identifier);
366-
//MetaDataDescriptor md(MetaDataDescriptor::CHAR, 34, "Phase Type", "Description of the phase condition", "channelInfo.extra");
367-
//MetaDataValue mv(md);
368-
//mv.setValue(typeDesc);
369-
eventChannelArray.add(ev);
370-
moduleEventChannels.add(ev);
371-
=======
372323
void FileReader::switchBuffer()
373324
{
374325
if (readBuffer == &bufferA)
@@ -437,5 +388,4 @@ void FileReader::readAndFillBufferCache(HeapBlock<int16> &cacheBuffer)
437388

438389
samplesRead += samplesToRead;
439390
}
440-
>>>>>>> a6a98f9d600ce0aa2a396ca953f6a6d68e488e54
441391
}

0 commit comments

Comments
 (0)