File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -1064,6 +1064,15 @@ extern SDL_DECLSPEC SDL_AudioStream * SDLCALL SDL_CreateAudioStream(const SDL_Au
1064
1064
/**
1065
1065
* Get the properties associated with an audio stream.
1066
1066
*
1067
+ * The application can hang any data it wants here, but
1068
+ * the following properties are understood by SDL:
1069
+ *
1070
+ * - `SDL_PROP_AUDIOSTREAM_KEEP_ON_SHUTDOWN_BOOLEAN`: if true, the stream will
1071
+ * not be automatically destroyed during SDL_Quit(). This property is
1072
+ * ignored for streams created through SDL_OpenAudioDeviceStream(). Streams
1073
+ * bound to devices that aren't destroyed will still be unbound.
1074
+ * Default false. (since SDL 3.4.0)
1075
+ *
1067
1076
* \param stream the SDL_AudioStream to query.
1068
1077
* \returns a valid property ID on success or 0 on failure; call
1069
1078
* SDL_GetError() for more information.
@@ -1074,6 +1083,9 @@ extern SDL_DECLSPEC SDL_AudioStream * SDLCALL SDL_CreateAudioStream(const SDL_Au
1074
1083
*/
1075
1084
extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetAudioStreamProperties (SDL_AudioStream * stream );
1076
1085
1086
+ #define SDL_PROP_AUDIOSTREAM_KEEP_ON_SHUTDOWN_BOOLEAN "SDL.audiostream.keep_on_shutdown"
1087
+
1088
+
1077
1089
/**
1078
1090
* Query the current format of an audio stream.
1079
1091
*
Original file line number Diff line number Diff line change @@ -1073,9 +1073,16 @@ void SDL_QuitAudio(void)
1073
1073
1074
1074
current_audio .impl .DeinitializeStart ();
1075
1075
1076
- // Destroy any audio streams that still exist...
1077
- while (current_audio .existing_streams ) {
1078
- SDL_DestroyAudioStream (current_audio .existing_streams );
1076
+ // Destroy any audio streams that still exist...unless app asked to keep it.
1077
+ SDL_AudioStream * next = NULL ;
1078
+ for (SDL_AudioStream * i = current_audio .existing_streams ; i ; i = next ) {
1079
+ next = i -> next ;
1080
+ if (i -> simplified || !SDL_GetBooleanProperty (i -> props , SDL_PROP_AUDIOSTREAM_KEEP_ON_SHUTDOWN_BOOLEAN , false)) {
1081
+ SDL_DestroyAudioStream (i );
1082
+ } else {
1083
+ i -> prev = NULL ;
1084
+ i -> next = NULL ;
1085
+ }
1079
1086
}
1080
1087
1081
1088
SDL_LockRWLockForWriting (current_audio .device_hash_lock );
You can’t perform that action at this time.
0 commit comments