Skip to content

Commit

Permalink
Disable SDL sound on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
indigoparadox committed Sep 8, 2024
1 parent eadd1f3 commit 9d61fa0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
29 changes: 26 additions & 3 deletions api/sdl/retapif.h
Original file line number Diff line number Diff line change
Expand Up @@ -1175,11 +1175,11 @@ void retroflat_resize_v() {

/* === */

#ifndef NO_RETROSND

MERROR_RETVAL retrosnd_init( struct RETROFLAT_ARGS* args ) {
MERROR_RETVAL retval = MERROR_OK;

#ifndef NO_RETROSND

if( 0 > SDL_Init( SDL_INIT_AUDIO ) ) {
error_printf( "couldn't initialize SDL audio: %s", SDL_GetError() );
retval = MERROR_SND;
Expand Down Expand Up @@ -1208,70 +1208,82 @@ MERROR_RETVAL retrosnd_init( struct RETROFLAT_ARGS* args ) {

cleanup:

#endif /* !NO_RETROSND */

return retval;
}

/* === */

void retrosnd_midi_set_sf_bank( const char* filename_in ) {
#ifndef NO_RETROSND
if(
RETROSND_FLAG_INIT !=
(RETROSND_FLAG_INIT & g_retroflat_state->sound.flags)
) {
return;
}
#endif /* !NO_RETROSND */

# pragma message( "warning: set_sf_bank not implemented" )
}

/* === */

void retrosnd_midi_set_voice( uint8_t channel, uint8_t voice ) {
#ifndef NO_RETROSND
if(
RETROSND_FLAG_INIT !=
(RETROSND_FLAG_INIT & g_retroflat_state->sound.flags)
) {
return;
}
#endif /* !NO_RETROSND */

# pragma message( "warning: set_voice not implemented" )
}

/* === */

void retrosnd_midi_set_control( uint8_t channel, uint8_t key, uint8_t val ) {
#ifndef NO_RETROSND
if(
RETROSND_FLAG_INIT !=
(RETROSND_FLAG_INIT & g_retroflat_state->sound.flags)
) {
return;
}
#endif /* !NO_RETROSND */

# pragma message( "warning: set_control not implemented" )
}

/* === */

void retrosnd_midi_note_on( uint8_t channel, uint8_t pitch, uint8_t vel ) {
#ifndef NO_RETROSND
if(
RETROSND_FLAG_INIT !=
(RETROSND_FLAG_INIT & g_retroflat_state->sound.flags)
) {
return;
}
#endif /* !NO_RETROSND */

# pragma message( "warning: note_on not implemented" )
}

/* === */

void retrosnd_midi_note_off( uint8_t channel, uint8_t pitch, uint8_t vel ) {
#ifndef NO_RETROSND
if(
RETROSND_FLAG_INIT !=
(RETROSND_FLAG_INIT & g_retroflat_state->sound.flags)
) {
return;
}
#endif /* !NO_RETROSND */

# pragma message( "warning: note_off not implemented" )
}
Expand All @@ -1281,6 +1293,8 @@ void retrosnd_midi_note_off( uint8_t channel, uint8_t pitch, uint8_t vel ) {
MERROR_RETVAL retrosnd_midi_play_smf( const char* filename ) {
MERROR_RETVAL retval = MERROR_OK;

#ifndef NO_RETROSND

/* TODO: Use chunks and play at pitch/velocity? */

if( Mix_PlayingMusic() ) {
Expand Down Expand Up @@ -1312,19 +1326,27 @@ MERROR_RETVAL retrosnd_midi_play_smf( const char* filename ) {

cleanup:

#endif /* !NO_RETROSND */

return retval;
}

/* === */

uint8_t retrosnd_midi_is_playing_smf() {
#ifndef NO_RETROSND
return Mix_PlayingMusic();
#else
return 1;
#endif /* !NO_RETROSND */
}

/* === */

void retrosnd_shutdown() {

#ifndef NO_RETROSND

if( RETROSND_FLAG_INIT != (RETROSND_FLAG_INIT & g_retroflat_state->sound.flags) ) {
return;
}
Expand All @@ -1342,9 +1364,10 @@ void retrosnd_shutdown() {
}

Mix_Quit();
}

#endif /* !NO_RETROSND */

}

#endif /* !RETPLTF_H */

3 changes: 2 additions & 1 deletion make/Makewin.inc
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ define TGT_WATCOM386_WIN_SDL
# SDL is always on Pentium.
CFLAGS_WATCOM386_WIN_SDL += \
-mf -5s -ei -fp5 -dSDL_main=main -bt=nt -i=$(MAUG_ROOT)/api/sdl \
-i=$(WATCOM)/h/nt -i=$(WATCOM)/h/nt/SDL -DRETROFLAT_API_SDL1
-i=$(WATCOM)/h/nt -i=$(WATCOM)/h/nt/SDL -DRETROFLAT_API_SDL1 \
-DNO_RETROSND

LDFLAGS_WATCOM386_WIN_SDL += system nt_win libr {SDL SDLmain}

Expand Down

0 comments on commit 9d61fa0

Please sign in to comment.