Udates from Steve.
This commit is contained in:
19
src/sl.h
19
src/sl.h
@@ -24,15 +24,14 @@ 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 ;
|
||||
class slScheduler ;
|
||||
class slDSP ;
|
||||
|
||||
extern char *__slPendingError ;
|
||||
|
||||
class slDSP
|
||||
{
|
||||
private:
|
||||
@@ -167,12 +166,9 @@ public:
|
||||
|
||||
~slSample ()
|
||||
{
|
||||
if ( ref_count != 0 )
|
||||
{
|
||||
if ( __slPendingError == NULL )
|
||||
if ( ref_count != 0 && __slPendingError == NULL )
|
||||
__slPendingError =
|
||||
"slXXXX: FATAL ERROR - Application deleted a sample while it was playing.\n" ;
|
||||
}
|
||||
"slSample: FATAL ERROR - Application deleted a sample while it was playing.\n" ;
|
||||
|
||||
delete buffer ;
|
||||
}
|
||||
@@ -331,12 +327,9 @@ public:
|
||||
|
||||
~slEnvelope ()
|
||||
{
|
||||
if ( ref_count != 0 )
|
||||
{
|
||||
if ( __slPendingError == NULL )
|
||||
if ( ref_count != 0 && __slPendingError == NULL )
|
||||
__slPendingError =
|
||||
"slXXXX: FATAL ERROR - Application deleted an envelope while it was playing.\n" ;
|
||||
}
|
||||
"slEnvelope: FATAL ERROR - Application deleted an envelope while it was playing.\n" ;
|
||||
|
||||
delete time ;
|
||||
delete value ;
|
||||
|
||||
@@ -336,6 +336,9 @@ void slDSP::sync ()
|
||||
|
||||
void slDSP::stop ()
|
||||
{
|
||||
if ( error )
|
||||
return ;
|
||||
|
||||
waveOutReset( hWaveOut );
|
||||
}
|
||||
|
||||
@@ -647,6 +650,9 @@ float slDSP::secondsUsed ()
|
||||
|
||||
void slDSP::sync ()
|
||||
{
|
||||
if ( error )
|
||||
return ;
|
||||
|
||||
/* found this in the header file - but no description
|
||||
* or example for the long parameter.
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
|
||||
#include "sl.h"
|
||||
|
||||
slScheduler *slScheduler::current = NULL ;
|
||||
char *__slPendingError = NULL ;
|
||||
|
||||
slScheduler *slScheduler::current = NULL ;
|
||||
|
||||
void slScheduler::init ()
|
||||
{
|
||||
current = this ;
|
||||
@@ -49,7 +50,8 @@ void slScheduler::init ()
|
||||
|
||||
void slScheduler::initBuffers ()
|
||||
{
|
||||
if ( not_working () ) return ;
|
||||
if ( not_working () )
|
||||
return ;
|
||||
|
||||
delete mixer_buffer ;
|
||||
delete spare_buffer0 ;
|
||||
@@ -118,17 +120,17 @@ void slScheduler::mixBuffer ( slSamplePlayer *spa, slSamplePlayer *spb,
|
||||
|
||||
void slScheduler::realUpdate ( int dump_first )
|
||||
{
|
||||
int i ;
|
||||
|
||||
if ( not_working () )
|
||||
return ;
|
||||
|
||||
if ( __slPendingError != NULL )
|
||||
{
|
||||
fprintf ( stderr, __slPendingError ) ;
|
||||
exit ( 1 ) ;
|
||||
fprintf ( stderr, "%s", __slPendingError ) ;
|
||||
exit ( 1 ) ;
|
||||
}
|
||||
|
||||
int i ;
|
||||
|
||||
while ( secondsUsed() <= safety_margin )
|
||||
{
|
||||
slSamplePlayer *psp [ 3 ] ;
|
||||
@@ -208,6 +210,9 @@ void slScheduler::realUpdate ( int dump_first )
|
||||
|
||||
void slScheduler::addCallBack ( slCallBack c, slSample *s, slEvent e, int m )
|
||||
{
|
||||
if ( not_working () )
|
||||
return ;
|
||||
|
||||
if ( num_pending_callbacks >= SL_MAX_CALLBACKS )
|
||||
{
|
||||
fprintf ( stderr, "slScheduler: Too many pending callback events!\n" ) ;
|
||||
@@ -224,6 +229,9 @@ void slScheduler::addCallBack ( slCallBack c, slSample *s, slEvent e, int m )
|
||||
|
||||
void slScheduler::flushCallBacks ()
|
||||
{
|
||||
if ( not_working () )
|
||||
return ;
|
||||
|
||||
/*
|
||||
Execute all the callbacks that we accumulated
|
||||
in this iteration.
|
||||
|
||||
Reference in New Issue
Block a user