> Suggestion: use a compile or make script. 

Yes, of course, if a configure or make script is provided, I use it.

> C is not foreseen to be compiled  with a simple commandline.

Yes, but many things can be done with a complicated commandline:
--->  https://github.com/fredvs/ideU

About our ALSA friend...

After exploration, here some note:

snd_pcm_drop(pcm) ---> snd_pcm_dmix_drop(pcm) :

static int snd_pcm_dmix_drop(snd_pcm_t *pcm)
{
        snd_pcm_direct_t *dmix = pcm->private_data;
        if (dmix->state == SND_PCM_STATE_OPEN)
                return -EBADFD;         dmix->state = SND_PCM_STATE_SETUP;
                
        snd_pcm_direct_timer_stop(dmix); // with or without, still overlapping
        
        return 0;
}

---> Commented snd_pcm_direct_timer_stop(dmix) gives the same result that
uncommented.

int snd_pcm_direct_timer_stop(snd_pcm_direct_t *dmix)
{
        snd_timer_stop(dmix->timer);
        return 0;
}

----> Go here --->

int snd_timer_stop(snd_timer_t *timer)
{
        assert(timer);
        return timer->ops->rt_stop(timer);
}

----> Go here --->

static int snd_timer_hw_stop(snd_timer_t *handle)
{
        snd_timer_t *tmr;
        unsigned int cmd;

        tmr = handle;
        if (!tmr)
                return -EINVAL;
        if (tmr->version < SNDRV_PROTOCOL_VERSION(2, 0, 4))
                cmd = SNDRV_TIMER_IOCTL_STOP_OLD;
        else
                cmd = SNDRV_TIMER_IOCTL_STOP;
        if (ioctl(tmr->poll_fd, cmd) < 0)
                return -errno;
        return 0;
}

And in asound.h:

#define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1)

Maybe this one is not ok ?

I did change in snd_timer_hw_stop() --->

md = SNDRV_TIMER_IOCTL_STOP 
with
md = SNDRV_TIMER_IOCTL_PAUSE

And compile.

Same result, overlapping sound when using snd_drop().

Now checking snd_timer_close() to see what they use, maybe something
interesting...

int snd_timer_close(snd_timer_t *timer)
{
        int err;
        assert(timer);
        while (!list_empty(&timer->async_handlers)) {
                snd_async_handler_t *h = list_entry(timer->async_handlers.next,
snd_async_handler_t, hlist);
                snd_async_del_handler(h);
        }
        err = timer->ops->close(timer);
        if (timer->dl_handle)
                snd_dlclose(timer->dl_handle);
        free(timer->name);
        free(timer);
        return err;
}

----> Ha, maybe adding part of code in timer_stop():

int snd_timer_stop(snd_timer_t *timer)
{
        assert(timer);
     // this added:
      while (!list_empty(&timer->async_handlers)) {  
                snd_async_handler_t *h = list_entry(timer->async_handlers.next,
snd_async_handler_t, hlist);
                snd_async_del_handler(h);
        }
        return timer->ops->rt_stop(timer);
}

No, still the overlapping sound. 

;-(

So maybe it is not the timer , I dont know...

Also I did not find in code the releasing of the remaining buffer after
snd_timer_stop().

I think that I will stay happy with your workaround on pcaudiolib....

Fre;D




--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to