class slScheduler ;
class slDSP ;
+extern char *__slPendingError ;
+
class slDSP
{
private:
void play ( void *buffer, size_t length ) { write ( buffer, length ) ; }
+ int working () { return !error ; }
int not_working () { return error ; }
int getBps () { return bps ; }
~slSample ()
{
- if ( ref_count != 0 )
- {
- fprintf ( stderr,
- "slSample: FATAL ERROR - Application deleted a sample while it was playing.\n" ) ;
- exit ( 1 ) ;
- }
+ if ( ref_count != 0 && __slPendingError == NULL )
+ __slPendingError =
+ "slSample: FATAL ERROR - Application deleted a sample while it was playing.\n" ;
delete buffer ;
}
int loadAUFile ( char *fname ) ;
int loadWavFile ( char *fname ) ;
- void changeRate ( int r ) ;
- void changeBps ( int b ) ;
- void changeStereo ( int s ) ;
+ void changeRate ( int r ) ;
+ void changeBps ( int b ) ;
+ void changeStereo ( int s ) ;
+ void changeToUnsigned () ;
void adjustVolume ( float vol ) ;
class slEnvelope
{
+public: /* SJB TESTING! */
+
float *time ;
float *value ;
int nsteps ;
~slEnvelope ()
{
- if ( ref_count != 0 )
- {
- fprintf ( stderr,
- "slEnvelope: FATAL ERROR - Application deleted an envelope while it was playing.\n" ) ;
- exit ( 1 ) ;
- }
+ if ( ref_count != 0 && __slPendingError == NULL )
+ __slPendingError =
+ "slEnvelope: FATAL ERROR - Application deleted an envelope while it was playing.\n" ;
delete time ;
delete value ;
float getValue ( float _time ) ;
+ void applyToPitch ( Uchar *dst, slSamplePlayer *src, int nframes, int start, int next_env ) ;
+ void applyToInvPitch ( Uchar *dst, slSamplePlayer *src, int nframes, int start, int next_env ) ;
void applyToVolume ( Uchar *dst, Uchar *src, int nframes, int start ) ;
void applyToInvVolume ( Uchar *dst, Uchar *src, int nframes, int start ) ;
} ;
class slSamplePlayer
{
- int lengthRemaining ;
- Uchar *bufferPos ;
+ int lengthRemaining ; /* Sample frames remaining until repeat */
+ Uchar *bufferPos ; /* Sample frame to replay next */
slSample *sample ;
slEnvelope *env [ SL_MAX_ENVELOPES ] ;
slCallBack callback ;
int magic ;
+ void low_read ( int nframes, Uchar *dest ) ;
+
public:
slSamplePlayer ( slSample *s, slReplayMode rp_mode = SL_SAMPLE_ONE_SHOT,
~slSamplePlayer () ;
- int getAmountLeft ()
- {
- return lengthRemaining ;
- }
-
slPreemptMode getPreemptMode () { return preempt_mode ; }
int getPriority ()
int isRunning () { return status == SL_SAMPLE_RUNNING ; }
int isDone () { return status == SL_SAMPLE_DONE ; }
- void skip ( int nframes ) ;
- Uchar *read ( int nframes, Uchar *spare1, Uchar *spare2 ) ;
+ void skip ( int nframes ) ;
+ void read ( int nframes, Uchar *dest, int next_env = 0 ) ;
} ;
int num_pending_callbacks ;
float safety_margin ;
+
int mixer_buffer_size ;
- Uchar *mixer_buffer ;
+
+ Uchar *mixer_buffer ;
+ Uchar *spare_buffer0 ;
+ Uchar *spare_buffer1 ;
+ Uchar *spare_buffer2 ;
+
Uchar *mixer ;
int amount_left ;
slSamplePlayer *samplePlayer [ SL_MAX_SAMPLES ] ;
- Uchar *spare_buffer1 [ 3 ] ;
- Uchar *spare_buffer2 [ 3 ] ;
-
void init () ;
- Uchar *mergeBlock ( Uchar *d ) ;
- Uchar *mergeBlock ( Uchar *d, slSamplePlayer *spa ) ;
- Uchar *mergeBlock ( Uchar *d, slSamplePlayer *spa,
- slSamplePlayer *spb ) ;
- Uchar *mergeBlock ( Uchar *d, slSamplePlayer *spa,
- slSamplePlayer *spb,
- slSamplePlayer *spc ) ;
- void mixBuffer () ;
- void mixBuffer ( slSamplePlayer *a ) ;
void mixBuffer ( slSamplePlayer *a,
slSamplePlayer *b ) ;
+
void mixBuffer ( slSamplePlayer *a,
slSamplePlayer *b,
slSamplePlayer *c ) ;