JA_GetMusicState & JA_GetChannelState replace paused ones

This commit is contained in:
2021-02-07 22:06:21 +01:00
parent f94d9294eb
commit 852710d15d
3 changed files with 13 additions and 13 deletions

View File

@@ -9,8 +9,6 @@ struct JA_Sound_t {
Uint8* buffer {NULL};
};
enum JA_Channel_state { JA_CHANNEL_FREE, JA_CHANNEL_PLAYING, JA_CHANNEL_PAUSED };
struct JA_Channel_t {
JA_Sound sound;
int pos {0};
@@ -18,8 +16,6 @@ struct JA_Channel_t {
JA_Channel_state state { JA_CHANNEL_FREE };
};
enum JA_Music_state { JA_MUSIC_INVALID, JA_MUSIC_PLAYING, JA_MUSIC_PAUSED, JA_MUSIC_STOPPED };
struct JA_Music_t {
int samples {0};
int pos {0};
@@ -127,8 +123,9 @@ void JA_StopMusic() {
current_music->state = JA_MUSIC_STOPPED;
}
bool JA_IsMusicPlaying() {
return current_music != NULL && current_music->state == JA_MUSIC_PLAYING;
JA_Music_state JA_GetMusicState() {
if (current_music == NULL) return JA_MUSIC_INVALID;
return current_music->state;
}
void JA_DeleteMusic(JA_Music music) {
@@ -209,8 +206,8 @@ void JA_StopChannel(const int channel) {
}
}
bool JA_IsChannelPlaying(const int channel) {
if (channel < 0 || channel >= JA_MAX_SIMULTANEOUS_CHANNELS) return false;
return channels[channel].state == JA_CHANNEL_PLAYING;
JA_Channel_state JA_GetChannelState(const int channel) {
if (channel < 0 || channel >= JA_MAX_SIMULTANEOUS_CHANNELS) return JA_CHANNEL_INVALID;
return channels[channel].state;
}