Skip to content

Commit f8236d6

Browse files
committed
Refactored Venue::load to take a Program
1 parent 900bbde commit f8236d6

File tree

4 files changed

+15
-19
lines changed

4 files changed

+15
-19
lines changed

include/soul/3rdParty/choc/containers/choc_Value.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,8 @@ class ValueView final
557557
@see Value::serialise
558558
*/
559559
template <typename Handler>
560-
static void deserialise (InputData&, Handler&& handleResult);
560+
static void deserialise (InputData&, Handler&& handleResult,
561+
Allocator* allocator = nullptr);
561562

562563
private:
563564
//==============================================================================
@@ -2231,11 +2232,10 @@ void ValueView::serialise (OutputStream& output) const
22312232
}
22322233

22332234
template <typename Handler>
2234-
void ValueView::deserialise (InputData& input, Handler&& handleResult)
2235+
void ValueView::deserialise (InputData& input, Handler&& handleResult, Allocator* allocator)
22352236
{
2236-
FixedPoolAllocator<8192> localAllocator;
22372237
ValueView result;
2238-
result.type = Type::deserialise (input, std::addressof (localAllocator));
2238+
result.type = Type::deserialise (input, allocator);
22392239
auto valueDataSize = result.type.getValueDataSize();
22402240
Type::SerialisationHelpers::expect (input.end >= input.start + valueDataSize);
22412241
result.data = const_cast<uint8_t*> (input.start);

source/modules/soul_core/venue/soul_RenderingVenue.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -228,28 +228,24 @@ struct RenderingVenue::Pimpl
228228
venue.removeActiveSession (*this);
229229
}
230230

231-
bool load (BuildBundle build, CompileTaskFinishedCallback loadFinishedCallback) override
231+
bool load (const Program& program, CompileTaskFinishedCallback loadFinishedCallback) override
232232
{
233233
unload();
234234

235-
if (build.sourceFiles.empty())
235+
if (program.isEmpty())
236236
return false;
237237

238-
taskQueue.addTask ([this, build = std::move (build),
238+
taskQueue.addTask ([this, program,
239239
callback = std::move (loadFinishedCallback)] (TaskThread::ShouldStopFlag& cancelled)
240240
{
241241
CompileMessageList messageList;
242+
bool ok = performer->load (messageList, program);
242243

243-
if (auto program = Compiler::build (messageList, build))
244-
{
245-
bool ok = performer->load (messageList, program);
246-
247-
if (cancelled)
248-
return;
244+
if (cancelled)
245+
return;
249246

250-
if (ok)
251-
setState (SessionState::loaded);
252-
}
247+
if (ok)
248+
setState (SessionState::loaded);
253249

254250
callback (messageList);
255251
});

source/modules/soul_core/venue/soul_Venue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class Venue
7272
getInputEndpoints() and getOutputEndpoints() methods become available, so you can query
7373
and connect them to data sources before calling link().
7474
*/
75-
virtual bool load (BuildBundle, CompileTaskFinishedCallback loadFinishedCallback) = 0;
75+
virtual bool load (const Program&, CompileTaskFinishedCallback loadFinishedCallback) = 0;
7676

7777
/** When a program has been loaded, this returns a list of the input endpoints that
7878
the program provides.

source/modules/soul_venue_audioplayer/audio_player/soul_AudioPlayer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ struct AudioPlayerVenue::Pimpl : private AudioMIDISystem::Callback
5151
unload();
5252
}
5353

54-
bool load (BuildBundle build, CompileTaskFinishedCallback loadFinishedCallback) override
54+
bool load (const Program& program, CompileTaskFinishedCallback loadFinishedCallback) override
5555
{
56-
return session->load (std::move (build),
56+
return session->load (program,
5757
[clientCallback = std::move (loadFinishedCallback)] (const CompileMessageList& messages)
5858
{
5959
clientCallback (messages);

0 commit comments

Comments
 (0)