diff --git a/plugins/zynaddsubfx/AUTHORS.txt b/plugins/zynaddsubfx/AUTHORS.txt index 33cddf36b..3018c29a0 100644 --- a/plugins/zynaddsubfx/AUTHORS.txt +++ b/plugins/zynaddsubfx/AUTHORS.txt @@ -11,7 +11,7 @@ Contributors: Daniel Clemente (with a workaround of X11 repeated key bug) Emmanuel Saracco (fix for JACK output) Achim Settelmeier (QUERTZ keyboard layout for virtual keyboard) - Jérémie Andréi (AZERTY keyboard layout, Array index fix) + Jérémie Andréi (AZERTY keyboard layout, Array index fix, OSS failsafe) Alexis Ballier (const char* <-> string mismatch, NULLMidi prototype fix) Tobias Doerffel (static vs instance variables alteration) James Morris (Memory leaks in FLTK GUI) diff --git a/plugins/zynaddsubfx/ChangeLog b/plugins/zynaddsubfx/ChangeLog index ed744b4b6..a652196a4 100644 --- a/plugins/zynaddsubfx/ChangeLog +++ b/plugins/zynaddsubfx/ChangeLog @@ -941,5 +941,6 @@ - Corrected the ADsynth unison LFO rounding function - Made Unison based on Bandwidth (in cents) parameter - +02 Oct 2009 (Mark McCurry) + - Added OSS failsafe by Jérémie Andréi diff --git a/plugins/zynaddsubfx/src/Output/OSSaudiooutput.cpp b/plugins/zynaddsubfx/src/Output/OSSaudiooutput.cpp index d10d32c96..893387d05 100644 --- a/plugins/zynaddsubfx/src/Output/OSSaudiooutput.cpp +++ b/plugins/zynaddsubfx/src/Output/OSSaudiooutput.cpp @@ -42,6 +42,8 @@ OSSaudiooutput::OSSaudiooutput() snd_stereo=1;//stereo snd_format=AFMT_S16_LE; snd_samplerate=SAMPLE_RATE; + playing_until.tv_sec=0; + playing_until.tv_usec=0; smps=new short int[SOUND_BUFFER_SIZE*2]; for (i=0;i 10000) //Don't sleep() less than 10ms. + //This will add latency... + usleep(remaining-10000); + if(remaining < 0) + cerr << "WARNING - too late" << endl; + } + playing_until.tv_usec += SOUND_BUFFER_SIZE*1000000/SAMPLE_RATE; + if(remaining < 0) + playing_until.tv_usec -= remaining; + playing_until.tv_sec += playing_until.tv_usec/1000000; + playing_until.tv_usec %= 1000000; + return; + } + for (i=0;i #include "../globals.h" class OSSaudiooutput @@ -40,6 +41,7 @@ private: int snd_stereo; int snd_format; int snd_samplerate; + struct timeval playing_until; short int *smps;//Samples to be sent to soundcard };