mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-21 22:31:19 +00:00
Minor cleanup of bincue vars
This commit is contained in:
parent
3e32a6da32
commit
7441d04a28
@ -153,7 +153,8 @@ static uint8 silence_byte;
|
||||
// CD Player state; multiple players supported through vectors
|
||||
|
||||
std::vector<CDPlayer*> players;
|
||||
CDPlayer* current_player = NULL;
|
||||
|
||||
CDPlayer* currently_playing = NULL;
|
||||
|
||||
CDPlayer* CSToPlayer(CueSheet* cs)
|
||||
{
|
||||
@ -688,10 +689,10 @@ bool GetPosition_bincue(void *fh, uint8 *pos)
|
||||
return false;
|
||||
}
|
||||
|
||||
void CDPause_currentplayer(CDPlayer* player) {
|
||||
if (current_player && current_player != player) {
|
||||
current_player->audiostatus = CDROM_AUDIO_PAUSED;
|
||||
current_player = NULL;
|
||||
void CDPause_playing(CDPlayer* player) {
|
||||
if (currently_playing && currently_playing != player) {
|
||||
currently_playing->audiostatus = CDROM_AUDIO_PAUSED;
|
||||
currently_playing = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -702,11 +703,11 @@ bool CDPause_bincue(void *fh)
|
||||
|
||||
if (cs && player) {
|
||||
// Pause another player if needed
|
||||
CDPause_currentplayer(player);
|
||||
CDPause_playing(player);
|
||||
|
||||
// doesn't matter if it was playing, just ensure it's now paused
|
||||
player->audiostatus = CDROM_AUDIO_PAUSED;
|
||||
current_player = NULL;
|
||||
currently_playing = NULL;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -719,7 +720,7 @@ bool CDStop_bincue(void *fh)
|
||||
|
||||
if (cs && player) {
|
||||
// Pause another player if needed
|
||||
CDPause_currentplayer(player);
|
||||
CDPause_playing(player);
|
||||
|
||||
#ifdef OSX_CORE_AUDIO
|
||||
player->soundoutput.stop();
|
||||
@ -727,7 +728,7 @@ bool CDStop_bincue(void *fh)
|
||||
if (player->audiostatus != CDROM_AUDIO_INVALID)
|
||||
player->audiostatus = CDROM_AUDIO_NO_STATUS;
|
||||
|
||||
current_player = NULL;
|
||||
currently_playing = NULL;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -740,11 +741,11 @@ bool CDResume_bincue(void *fh)
|
||||
|
||||
if (cs && player) {
|
||||
// Pause another player if needed
|
||||
CDPause_currentplayer(player);
|
||||
CDPause_playing(player);
|
||||
|
||||
// doesn't matter if it was paused, just ensure this one plays now
|
||||
player->audiostatus = CDROM_AUDIO_PLAY;
|
||||
current_player = player;
|
||||
currently_playing = player;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -758,7 +759,7 @@ bool CDPlay_bincue(void *fh, uint8 start_m, uint8 start_s, uint8 start_f,
|
||||
|
||||
if (cs && player) {
|
||||
// Pause another player if needed
|
||||
CDPause_currentplayer(player);
|
||||
CDPause_playing(player);
|
||||
|
||||
int track;
|
||||
MSF msf;
|
||||
@ -820,7 +821,7 @@ bool CDPlay_bincue(void *fh, uint8 start_m, uint8 start_s, uint8 start_f,
|
||||
// should be from current track !
|
||||
player->soundoutput.start(16, 2, 44100);
|
||||
#endif
|
||||
current_player = player;
|
||||
currently_playing = player;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -951,15 +952,11 @@ static uint8 *fill_buffer(int stream_len, CDPlayer* player)
|
||||
#ifdef USE_SDL_AUDIO
|
||||
void MixAudio_bincue(uint8 *stream, int stream_len, int volume)
|
||||
{
|
||||
|
||||
// for (std::vector<CDPlayer*>::iterator it = players.begin(); it != players.end(); ++it)
|
||||
// {
|
||||
// CDPlayer *player = *it;
|
||||
|
||||
if (current_player) {
|
||||
CDPlayer *player = current_player;
|
||||
if (currently_playing) {
|
||||
|
||||
if (player->audio_enabled && (player->audiostatus == CDROM_AUDIO_PLAY)) {
|
||||
CDPlayer *player = currently_playing;
|
||||
|
||||
if (player->audiostatus == CDROM_AUDIO_PLAY) {
|
||||
uint8 *buf = fill_buffer(stream_len, player);
|
||||
if (buf)
|
||||
SDL_AudioStreamPut(player->stream, buf, stream_len);
|
||||
@ -970,6 +967,7 @@ void MixAudio_bincue(uint8 *stream, int stream_len, int volume)
|
||||
SDL_MixAudio(stream, converted, stream_len, player->volume_mono);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user