Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lukasz Pawelczyk <havner@pld-linux.org>
To: alsa-devel@alsa-project.org
Subject: How to stop playback on alsa synth?
Date: Sun, 16 Mar 2008 17:53:39 +0100	[thread overview]
Message-ID: <47DD5093.6070702@pld-linux.org> (raw)

Hello.

I'd like to ask how to completely stop playback using alsa synth.

Basically my program initialized output in the following way:

snd_seq_open()
snd_seq_set_client_name()
snd_seq_client_id()
snd_seq_parse_address()
snd_seq_create_simple_port()
snd_seq_connect_to()
snd_seq_alloc_named_queue()

Then I create a new thread that processes events.
It sets tempo and in infinite loop it does:
snd_seq_ev_set_fixed()
snd_seq_event_output()

This all is based on aplaymidi code.

How can I asynchronously immediately stop all the playback? Basicaly it 
requires breaking snd_seq_event_output() thats locked on my thread.
I tried everything I could come up with. I know very little about alsa 
synth programming and basically thats the only thing i need to do now.

Tried:
snd_seq_ev_set_queue_stop()
snd_seq_stop_queue()
snd_seq_remove_events()

or even closing the seq completely to reopen it on another file playback 
with:
snd_seq_stop_queue()
snd_seq_disconnect_to()
snd_seq_delete_simple_port()
snd_seq_close()

All failed, results were very various. I simply run out of ideas. It 
doesn't matter if the method would require to close seq or not. I just 
need to stop the playback so i can gracefully stop the thread and play 
another file (with eventual reopening ports/seq).

Would appreciate any help.

-- 
Regards    Havner                     {jid,mail}:havner(at)pld-linux.org
                    "Quis custodiet ipsos custodes?"

             reply	other threads:[~2008-03-16 16:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-16 16:53 Lukasz Pawelczyk [this message]
2008-03-16 21:48 ` How to stop playback on alsa synth? Lukasz Pawelczyk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47DD5093.6070702@pld-linux.org \
    --to=havner@pld-linux.org \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox