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