repair default keyframe load, tweak init default histogram threshold
[goodguy/history.git] / cinelerra-5.1 / cinelerra / audioalsa.C
index 166324d61a4e482712c88e623df868252cdb4c88..7a8d712c3b8f2687280dd33a9bccfa0925872c12 100644 (file)
@@ -22,6 +22,7 @@
 #include "audiodevice.h"
 #include "audioalsa.h"
 #include "bcsignals.h"
+#include "language.h"
 #include "mutex.h"
 #include "playbackconfig.h"
 #include "preferences.h"
@@ -273,7 +274,8 @@ int AudioALSA::set_params(snd_pcm_t *dsp, int mode,
        err = snd_pcm_hw_params_any(dsp, params);
 
        if (err < 0) {
-               fprintf(stderr, "AudioALSA::set_params: no PCM configurations available\n");
+               fprintf(stderr, "AudioALSA::set_params: ");
+               fprintf(stderr, _("no PCM configurations available\n"));
                return 1;
        }
 
@@ -281,8 +283,8 @@ int AudioALSA::set_params(snd_pcm_t *dsp, int mode,
                params,
                SND_PCM_ACCESS_RW_INTERLEAVED);
         if(err) {
-               fprintf(stderr, "AudioALSA::set_params: failed to set up "
-                               "interleaved device access.\n");
+               fprintf(stderr, "AudioALSA::set_params: ");
+               fprintf(stderr, _("failed to set up interleaved device access.\n"));
                return 1;
         }
 
@@ -290,7 +292,8 @@ int AudioALSA::set_params(snd_pcm_t *dsp, int mode,
                params,
                translate_format(bits));
         if(err) {
-               fprintf(stderr, "AudioALSA::set_params: failed to set output format.\n");
+               fprintf(stderr, "AudioALSA::set_params: ");
+               fprintf(stderr, _("failed to set output format.\n"));
                return 1;
         }
 
@@ -298,8 +301,8 @@ int AudioALSA::set_params(snd_pcm_t *dsp, int mode,
                params,
                channels);
         if(err) {
-               fprintf(stderr, "AudioALSA::set_params: Configured ALSA device "
-                               "does not support %d channel operation.\n",
+               fprintf(stderr, "AudioALSA::set_params: ");
+               fprintf(stderr, _("Configured ALSA device does not support %d channel operation.\n"),
                        channels);
                return 1;
         }
@@ -309,8 +312,8 @@ int AudioALSA::set_params(snd_pcm_t *dsp, int mode,
                (unsigned int*)&samplerate,
                (int*)0);
         if(err) {
-               fprintf(stderr, "AudioALSA::set_params: Configured ALSA device "
-                               "does not support %u Hz playback.\n",
+               fprintf(stderr, "AudioALSA::set_params: ");
+               fprintf(stderr, _(" Configured ALSA device does not support %u Hz playback.\n"),
                        (unsigned int)samplerate);
                return 1;
         }
@@ -564,8 +567,8 @@ int AudioALSA::write_buffer(char *buffer, int size)
                timer->update();
 
        AudioThread *audio_out = device->audio_out;
-       while(attempts < 2 && !done && !device->playback_interrupted)
-       {
+       while( count > 0 && attempts < 2 && !done ) {
+               if( device->playback_interrupted ) break;
 // Buffers written must be equal to period_time
                audio_out->Thread::enable_cancel();
                int ret = snd_pcm_avail_update(get_output());
@@ -583,6 +586,7 @@ int AudioALSA::write_buffer(char *buffer, int size)
                        if( ret > 0 ) ret = 0;
                }
                audio_out->Thread::disable_cancel();
+               if( device->playback_interrupted ) break;
                if( ret == 0 ) continue;
 
                if( ret > 0 ) {