Skip to content

Commit

Permalink
Extended SDL Sound functions
Browse files Browse the repository at this point in the history
This implements the extended GLK sound functions:

glk_schannel_create_ext()
glk_schannel_play_multi()
glk_schannel_set_volume_ext()
glk_schannel_pause()
glk_schannel_unpause()

Sound and volume notifications are still not working properly.
See bug report #204 and pull request #337.

These changes only touch the SDL sound backend.

I've made a test program here:
 https://github.com/angstsmurf/soundtest/releases
  • Loading branch information
angstsmurf committed Nov 16, 2019
1 parent 2e221c6 commit b6f71d5
Show file tree
Hide file tree
Showing 4 changed files with 262 additions and 47 deletions.
2 changes: 2 additions & 0 deletions garglk/Jamfile
Expand Up @@ -20,6 +20,8 @@ if $(OS) = MINGW

if $(USESDL) = yes
{
SubDirCcFlags
-DGARGLK_USESDL ;
SubDirHdrs $(TOP) support sdl ;
SubDirHdrs $(TOP) support sdl_sound ;
}
Expand Down
2 changes: 1 addition & 1 deletion garglk/cggestal.c
Expand Up @@ -110,7 +110,7 @@ glui32 glk_gestalt_ext(glui32 id, glui32 val, glui32 *arr,
return gli_conf_sound;

case gestalt_Sound2:
return FALSE;
return gli_conf_sound;

case gestalt_Unicode:
return TRUE;
Expand Down
16 changes: 16 additions & 0 deletions garglk/garglk.h
Expand Up @@ -30,6 +30,10 @@

#include <stddef.h>

#ifdef GARGLK_USESDL
#include <SDL_timer.h>
#endif

#include "gi_dispa.h"

/* First, we define our own TRUE and FALSE and NULL, because ANSI
Expand Down Expand Up @@ -565,6 +569,18 @@ struct glk_schannel_struct
int notify;
int buffered;

#ifdef GARGLK_USESDL
int paused;

/* for volume fades */
int volume_notify;
int volume_timeout;
int target_volume;
double float_volume;
double volume_delta;
SDL_TimerID timer;
#endif

gidispatch_rock_t disprock;
channel_t *chain_next, *chain_prev;
};
Expand Down

0 comments on commit b6f71d5

Please sign in to comment.