Skip to content

Commit 24ce44f

Browse files
committed
Further multiple event type handling changes
1 parent 6495d42 commit 24ce44f

File tree

6 files changed

+31
-22
lines changed

6 files changed

+31
-22
lines changed

source/modules/soul_core/heart/soul_heart_AST.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,7 @@ struct heart
217217

218218
EndpointDetails getDetails() const
219219
{
220-
auto sampleType = getSingleSampleType();
221-
return { "in:" + name.toString(), name, kind, sampleType, (uint32_t) sampleType.getPackedSizeInBytes(), annotation };
220+
return { "in:" + name.toString(), name, kind, sampleTypes, (uint32_t) getSingleSampleType().getPackedSizeInBytes(), annotation };
222221
}
223222
};
224223

@@ -233,8 +232,7 @@ struct heart
233232

234233
EndpointDetails getDetails() const
235234
{
236-
auto sampleType = getSingleSampleType();
237-
return { "out:" + name.toString(), name, kind, sampleType, (uint32_t) sampleType.getPackedSizeInBytes(), annotation };
235+
return { "out:" + name.toString(), name, kind, sampleTypes, (uint32_t) getSingleSampleType().getPackedSizeInBytes(), annotation };
238236
}
239237
};
240238

source/modules/soul_core/types/soul_EndpointType.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,12 @@ EndpointProperties::EndpointProperties (double rate, uint32_t size)
3434
}
3535

3636
EndpointDetails::EndpointDetails (EndpointID id, std::string nm, EndpointKind kind_,
37-
Type sampleType_, uint32_t stride, Annotation a)
38-
: endpointID (std::move (id)), name (std::move (nm)), kind (kind_),
39-
sampleType (sampleType_), strideBytes (stride),
37+
std::vector<Type> sampleTypes_, uint32_t stride, Annotation a)
38+
: endpointID (std::move (id)),
39+
name (std::move (nm)),
40+
kind (kind_),
41+
sampleTypes (std::move (sampleTypes_)),
42+
strideBytes (stride),
4043
annotation (std::move (a))
4144
{
4245
}
@@ -45,6 +48,8 @@ uint32_t EndpointDetails::getNumAudioChannels() const
4548
{
4649
if (isStream (kind))
4750
{
51+
auto sampleType = getSingleSampleType();
52+
4853
if (sampleType.isFloatingPoint())
4954
{
5055
if (sampleType.isPrimitive())

source/modules/soul_core/types/soul_EndpointType.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,23 @@ struct EndpointDetails
7171
EndpointDetails& operator= (EndpointDetails&&) = default;
7272

7373
EndpointDetails (EndpointID, std::string name, EndpointKind,
74-
Type sampleType, uint32_t strideBytes,
74+
std::vector<Type> sampleTypes, uint32_t strideBytes,
7575
Annotation);
7676

7777
uint32_t getNumAudioChannels() const;
7878

7979
EndpointID endpointID;
8080
std::string name;
8181
EndpointKind kind;
82-
Type sampleType;
82+
std::vector<Type> sampleTypes;
8383
uint32_t strideBytes;
8484
Annotation annotation;
85+
86+
Type getSingleSampleType() const
87+
{
88+
SOUL_ASSERT (sampleTypes.size() == 1);
89+
return sampleTypes.front();
90+
}
8591
};
8692

8793
//==============================================================================

source/modules/soul_core/utilities/soul_SynchronousPerformerWrapper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ struct SynchronousPerformerWrapper
131131
{
132132
auto& details = inputToAttachTo.getDetails();
133133

134-
if (details.sampleType.isFloat64())
134+
if (details.getSingleSampleType().isFloat64())
135135
{
136136
inputToAttachTo.setStreamSource ([=] (void* dest, uint32_t requestedFrames) -> uint32_t
137137
{
@@ -206,7 +206,7 @@ struct SynchronousPerformerWrapper
206206
{
207207
auto& details = outputToAttachTo.getDetails();
208208

209-
if (details.sampleType.isFloat64())
209+
if (details.getSingleSampleType().isFloat64())
210210
{
211211
outputToAttachTo.setStreamSink ([=] (const void* src, uint32_t numFrames) -> uint32_t
212212
{

source/modules/soul_core/venue/soul_Endpoints.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ inline bool isMIDIEventEndpoint (const EndpointDetails& details)
218218
};
219219

220220
return isEvent (details.kind)
221-
&& details.sampleType.isStruct()
222-
&& isMIDIMessageStruct (details.sampleType.getStructRef());
221+
&& details.getSingleSampleType().isStruct()
222+
&& isMIDIMessageStruct (details.getSingleSampleType().getStructRef());
223223
}
224224

225225
inline bool isMIDIEventEndpoint (InputEndpoint& i) { return isMIDIEventEndpoint (i.getDetails()); }

source/modules/soul_venue_audioplayer/audio_player/soul_AudioPlayer.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,9 @@ class AudioPlayerVenue : public soul::Venue,
333333
: input (inputToAttachTo), startChannelIndex (startChannel)
334334
{
335335
auto& details = inputToAttachTo.getDetails();
336-
auto numDestChannels = (uint32_t) details.sampleType.getVectorSize();
336+
auto numDestChannels = (uint32_t) details.getSingleSampleType().getVectorSize();
337337

338-
if (details.sampleType.isFloat64())
338+
if (details.getSingleSampleType().isFloat64())
339339
{
340340
inputToAttachTo.setStreamSource ([=] (void* dest, uint32_t num) -> uint32_t
341341
{
@@ -353,7 +353,7 @@ class AudioPlayerVenue : public soul::Venue,
353353
return 0;
354354
}, properties);
355355
}
356-
else if (details.sampleType.isFloat32())
356+
else if (details.getSingleSampleType().isFloat32())
357357
{
358358
inputToAttachTo.setStreamSource ([=] (void* dest, uint32_t num) -> uint32_t
359359
{
@@ -372,7 +372,7 @@ class AudioPlayerVenue : public soul::Venue,
372372
return 0;
373373
}, properties);
374374
}
375-
else if (details.sampleType.isInteger32())
375+
else if (details.getSingleSampleType().isInteger32())
376376
{
377377
inputToAttachTo.setStreamSource ([=] (void* dest, uint32_t num) -> uint32_t
378378
{
@@ -421,9 +421,9 @@ class AudioPlayerVenue : public soul::Venue,
421421
: output (outputToAttachTo), startChannelIndex (startChannel)
422422
{
423423
auto& details = outputToAttachTo.getDetails();
424-
auto numSrcChannels = (uint32_t) details.sampleType.getVectorSize();
424+
auto numSrcChannels = (uint32_t) details.getSingleSampleType().getVectorSize();
425425

426-
if (details.sampleType.isFloat64())
426+
if (details.getSingleSampleType().isFloat64())
427427
{
428428
outputToAttachTo.setStreamSink ([=] (const void* src, uint32_t num) -> uint32_t
429429
{
@@ -440,7 +440,7 @@ class AudioPlayerVenue : public soul::Venue,
440440

441441
}, properties);
442442
}
443-
else if (details.sampleType.isFloat32())
443+
else if (details.getSingleSampleType().isFloat32())
444444
{
445445
outputToAttachTo.setStreamSink ([=] (const void* src, uint32_t num) -> uint32_t
446446
{
@@ -456,7 +456,7 @@ class AudioPlayerVenue : public soul::Venue,
456456
return num;
457457
}, properties);
458458
}
459-
else if (details.sampleType.isInteger32())
459+
else if (details.getSingleSampleType().isInteger32())
460460
{
461461
outputToAttachTo.setStreamSink ([=] (const void* src, uint32_t num) -> uint32_t
462462
{
@@ -772,7 +772,7 @@ class AudioPlayerVenue : public soul::Venue,
772772
e.details.endpointID = std::move (id);
773773
e.details.name = std::move (name);
774774
e.details.kind = kind;
775-
e.details.sampleType = sampleType;
775+
e.details.sampleTypes.push_back (sampleType);
776776
e.details.strideBytes = 0;
777777

778778
e.audioChannelIndex = audioChannelIndex;

0 commit comments

Comments
 (0)