mirror of https://github.com/bjornbytes/lovr.git
rm unneeded internal Source functions;
Now that things are in the same file, setters for internal source fields are unnecessary, making things a bit simpler.
This commit is contained in:
parent
c455b0750e
commit
ed4b8d1f3d
|
@ -103,23 +103,22 @@ void lovrAudioUpdate() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t id = lovrSourceGetId(source);
|
|
||||||
ALenum sourceState;
|
ALenum sourceState;
|
||||||
alGetSourcei(id, AL_SOURCE_STATE, &sourceState);
|
alGetSourcei(source->id, AL_SOURCE_STATE, &sourceState);
|
||||||
bool isStopped = sourceState == AL_STOPPED;
|
bool isStopped = sourceState == AL_STOPPED;
|
||||||
ALint processed;
|
ALint processed;
|
||||||
alGetSourcei(id, AL_BUFFERS_PROCESSED, &processed);
|
alGetSourcei(source->id, AL_BUFFERS_PROCESSED, &processed);
|
||||||
|
|
||||||
if (processed) {
|
if (processed) {
|
||||||
ALuint buffers[SOURCE_BUFFERS];
|
ALuint buffers[SOURCE_BUFFERS];
|
||||||
alSourceUnqueueBuffers(id, processed, buffers);
|
alSourceUnqueueBuffers(source->id, processed, buffers);
|
||||||
lovrSourceStream(source, buffers, processed);
|
lovrSourceStream(source, buffers, processed);
|
||||||
if (isStopped) {
|
if (isStopped) {
|
||||||
alSourcePlay(id);
|
alSourcePlay(source->id);
|
||||||
}
|
}
|
||||||
} else if (isStopped) {
|
} else if (isStopped) {
|
||||||
// in case we'll play this source in the future, rewind it now. This also frees up queued raw buffers.
|
// in case we'll play this source in the future, rewind it now. This also frees up queued raw buffers.
|
||||||
lovrAudioStreamRewind(lovrSourceGetStream(source));
|
lovrAudioStreamRewind(source->stream);
|
||||||
|
|
||||||
arr_splice(&state.sources, i, 1);
|
arr_splice(&state.sources, i, 1);
|
||||||
lovrRelease(Source, source);
|
lovrRelease(Source, source);
|
||||||
|
@ -262,14 +261,6 @@ SourceType lovrSourceGetType(Source* source) {
|
||||||
return source->type;
|
return source->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t lovrSourceGetId(Source* source) {
|
|
||||||
return source->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
AudioStream* lovrSourceGetStream(Source* source) {
|
|
||||||
return source->stream;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t lovrSourceGetBitDepth(Source* source) {
|
uint32_t lovrSourceGetBitDepth(Source* source) {
|
||||||
return source->type == SOURCE_STATIC ? source->soundData->bitDepth : source->stream->bitDepth;
|
return source->type == SOURCE_STATIC ? source->soundData->bitDepth : source->stream->bitDepth;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,8 +46,6 @@ Source* lovrSourceCreateStatic(struct SoundData* soundData);
|
||||||
Source* lovrSourceCreateStream(struct AudioStream* stream);
|
Source* lovrSourceCreateStream(struct AudioStream* stream);
|
||||||
void lovrSourceDestroy(void* ref);
|
void lovrSourceDestroy(void* ref);
|
||||||
SourceType lovrSourceGetType(Source* source);
|
SourceType lovrSourceGetType(Source* source);
|
||||||
uint32_t lovrSourceGetId(Source* source);
|
|
||||||
struct AudioStream* lovrSourceGetStream(Source* source);
|
|
||||||
uint32_t lovrSourceGetBitDepth(Source* source);
|
uint32_t lovrSourceGetBitDepth(Source* source);
|
||||||
uint32_t lovrSourceGetChannelCount(Source* source);
|
uint32_t lovrSourceGetChannelCount(Source* source);
|
||||||
void lovrSourceGetCone(Source* source, float* innerAngle, float* outerAngle, float* outerGain);
|
void lovrSourceGetCone(Source* source, float* innerAngle, float* outerAngle, float* outerGain);
|
||||||
|
|
Loading…
Reference in New Issue