MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / play

Method play

extlibs/soloud/src/core/soloud_queue.cpp:101–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99 }
100
101 result Queue::play(AudioSource &aSound)
102 {
103 if (!mSoloud)
104 {
105 return INVALID_PARAMETER;
106 }
107
108 findQueueHandle();
109
110 if (mQueueHandle == 0)
111 return INVALID_PARAMETER;
112
113 if (mCount >= SOLOUD_QUEUE_MAX)
114 return OUT_OF_MEMORY;
115
116 if (!aSound.mAudioSourceID)
117 {
118 aSound.mAudioSourceID = mSoloud->mAudioSourceID;
119 mSoloud->mAudioSourceID++;
120 }
121
122 SoLoud::AudioSourceInstance *instance = aSound.createInstance();
123
124 if (instance == 0)
125 {
126 return OUT_OF_MEMORY;
127 }
128
129 instance->mAudioSourceID = aSound.mAudioSourceID;
130
131 mSoloud->lockAudioMutex();
132 mSource[mWriteIndex] = instance;
133 mWriteIndex = (mWriteIndex + 1) % SOLOUD_QUEUE_MAX;
134 mCount++;
135 mSoloud->unlockAudioMutex();
136
137 return SO_NO_ERROR;
138 }
139
140
141 unsigned int Queue::getQueueCount()

Callers

nothing calls this directly

Calls 3

lockAudioMutexMethod · 0.80
unlockAudioMutexMethod · 0.80
createInstanceMethod · 0.45

Tested by

no test coverage detected