]> git.mxchange.org Git - simgear.git/blobdiff - src/sl.h
added a working() method.
[simgear.git] / src / sl.h
index 6e3fe6e0499c159ca92acaf0569587c2c2f019a7..dd026b7f074c3e57db6d8efa588827c72410878b 100644 (file)
--- a/src/sl.h
+++ b/src/sl.h
@@ -24,6 +24,9 @@ typedef unsigned short Ushort ;
 
 #define SL_DEFAULT_SAMPLING_RATE 11025
 
+/* Set if the next slScheduler::update will die */
+extern char *__slPendingError ;
+
 class slSample       ;
 class slSamplePlayer ;
 class slEnvelope     ;
@@ -109,6 +112,7 @@ public:
 
   void play ( void *buffer, size_t length ) { write ( buffer, length ) ; } 
 
+  int working () { return !error ; }
   int not_working () { return error ; }
 
   int getBps   () { return bps    ; }
@@ -165,9 +169,9 @@ public:
   {
     if ( ref_count != 0 )
     {
-      fprintf ( stderr,
-        "slSample: FATAL ERROR - Application deleted a sample while it was playing.\n" ) ;
-      exit ( 1 ) ;
+    if ( __slPendingError == NULL )
+      __slPendingError =
+            "slXXXX: FATAL ERROR - Application deleted a sample while it was playing.\n" ;
     }
 
     delete buffer ;
@@ -329,9 +333,9 @@ public:
   {
     if ( ref_count != 0 )
     {
-      fprintf ( stderr,
-        "slEnvelope: FATAL ERROR - Application deleted an envelope while it was playing.\n" ) ;
-      exit ( 1 ) ;
+    if ( __slPendingError == NULL )
+      __slPendingError =
+            "slXXXX: FATAL ERROR - Application deleted an envelope while it was playing.\n" ;
     }
 
     delete time ;