Richard Shann | 1 Jan 2012 19:13
Favicon

Real time playback in Denemo

I think the next big step for Denemo will be to get the playback working
in its own thread.

Below are some ideas for how to do this, first there are some notes
which you can cut out if you already know how the soc code is working.

8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 
I have studied the soc branch code and made the following notes:

The playback works by using two threads, one is the
process_thread_func() of the backend chosen (I see alsabackend.c and
dummybackend.c so far) and the other is the queue_thread_func() in
audiointerface.c

The process_thread_func() creates a mutex and then runs a loop:
the loop gets the system time g_get_current_time() and to it adds 5ms (a
compiler constant called PLAYBACK_INTERVAL). This time is then used for
a timed wait on a condition with the mutex, that is a call to
g_cond_timed_wait(). This means that the thread waits for the condition
process_cond to be signalled or until the 5ms have elapsed.
The g_cond_timed_wait() unlocks the mutex before the thread sleeps and
locks it when it continues. 
***Question*** is it ok that the mutex has not been locked for the first
time (and correspondingly, at the end g_mutex_free() is called without
unlocking the mutex, is that ok?).

Next a check is made for quitting the loop - this is done by making an
atomic access to an int which is set by the alsa_seq_destroy() call.
***Question*** does that need to be an atomic access? The int in
question is just a boolean, so in C it just means that if any of the
(Continue reading)

Jeremiah Benham | 1 Jan 2012 21:41

Re: Real time playback in Denemo

Are we going to have a release before we start this?

Jeremiah

Sent from my Samsung smartphone on AT&T

Richard Shann <richard.shann@...> wrote:

>I think the next big step for Denemo will be to get the playback working
>in its own thread.
>
>Below are some ideas for how to do this, first there are some notes
>which you can cut out if you already know how the soc code is working.
>
>8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 
>I have studied the soc branch code and made the following notes:
>
>The playback works by using two threads, one is the
>process_thread_func() of the backend chosen (I see alsabackend.c and
>dummybackend.c so far) and the other is the queue_thread_func() in
>audiointerface.c
>
>The process_thread_func() creates a mutex and then runs a loop:
>the loop gets the system time g_get_current_time() and to it adds 5ms (a
>compiler constant called PLAYBACK_INTERVAL). This time is then used for
>a timed wait on a condition with the mutex, that is a call to
>g_cond_timed_wait(). This means that the thread waits for the condition
>process_cond to be signalled or until the 5ms have elapsed.
>The g_cond_timed_wait() unlocks the mutex before the thread sleeps and
>locks it when it continues. 
(Continue reading)

Richard Shann | 2 Jan 2012 12:36
Favicon

Re: Real time playback in Denemo

On Sun, 2012-01-01 at 14:41 -0600, Jeremiah Benham wrote:
> Are we going to have a release before we start this?
I think we should. Playback should mark release 1.0 I think.
What housekeeping things are there outstanding before a release
candidate is created?

Richard

> 
> Jeremiah
> 
> Sent from my Samsung smartphone on AT&T
> 
> Richard Shann <richard.shann@...> wrote:
> 
> >I think the next big step for Denemo will be to get the playback working
> >in its own thread.
> >
> >Below are some ideas for how to do this, first there are some notes
> >which you can cut out if you already know how the soc code is working.
> >
> >8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 8>< 
> >I have studied the soc branch code and made the following notes:
> >
> >The playback works by using two threads, one is the
> >process_thread_func() of the backend chosen (I see alsabackend.c and
> >dummybackend.c so far) and the other is the queue_thread_func() in
> >audiointerface.c
> >
> >The process_thread_func() creates a mutex and then runs a loop:
(Continue reading)

Jeremiah Benham | 3 Jan 2012 07:13

Re: Real time playback in Denemo

On 01/02/2012 05:36 AM, Richard Shann wrote:
> On Sun, 2012-01-01 at 14:41 -0600, Jeremiah Benham wrote:
>> Are we going to have a release before we start this?
> I think we should. Playback should mark release 1.0 I think.
> What housekeeping things are there outstanding before a release
> candidate is created?

I am getting these warnings on startup. I don't know if you see it or not:
(denemo:8292): Gtk-CRITICAL **: gtk_menu_item_get_submenu: assertion 
`GTK_IS_MENU_ITEM (menu_item)' failed

(denemo:8292): Gtk-CRITICAL **: gtk_container_foreach: assertion 
`GTK_IS_CONTAINER (container)' failed

(denemo:8292): Gtk-CRITICAL **: gtk_menu_item_get_submenu: assertion 
`GTK_IS_MENU_ITEM (menu_item)' failed

(denemo:8292): Gtk-CRITICAL **: gtk_container_foreach: assertion 
`GTK_IS_CONTAINER (container)' failed

(denemo:8292): Gtk-CRITICAL **: gtk_container_foreach: assertion 
`GTK_IS_CONTAINER (container)' failed

(denemo:8292): Gtk-CRITICAL **: gtk_menu_shell_insert: assertion 
`GTK_IS_MENU_SHELL (menu_shell)' failed

Should we create scheme alternatives to the built-ins for dynamics? Some 
of these would require multiple glyphs FFF, ppp, etc...

It is not a big deal but the ornaments and articulations with the 
(Continue reading)

Richard Shann | 4 Jan 2012 12:19
Favicon

Re: Real time playback in Denemo

On Tue, 2012-01-03 at 00:13 -0600, Jeremiah Benham wrote:
> On 01/02/2012 05:36 AM, Richard Shann wrote:
> > On Sun, 2012-01-01 at 14:41 -0600, Jeremiah Benham wrote:
> >> Are we going to have a release before we start this?
> > I think we should. Playback should mark release 1.0 I think.
> > What housekeeping things are there outstanding before a release
> > candidate is created?
> 
> I am getting these warnings on startup. I don't know if you see it or not:
> (denemo:8292): Gtk-CRITICAL **: gtk_menu_item_get_submenu: assertion 
> `GTK_IS_MENU_ITEM (menu_item)' failed
> 
> (denemo:8292): Gtk-CRITICAL **: gtk_container_foreach: assertion 
> `GTK_IS_CONTAINER (container)' failed
> 
> (denemo:8292): Gtk-CRITICAL **: gtk_menu_item_get_submenu: assertion 
> `GTK_IS_MENU_ITEM (menu_item)' failed
> 
> (denemo:8292): Gtk-CRITICAL **: gtk_container_foreach: assertion 
> `GTK_IS_CONTAINER (container)' failed
> 
> (denemo:8292): Gtk-CRITICAL **: gtk_container_foreach: assertion 
> `GTK_IS_CONTAINER (container)' failed
> 
> (denemo:8292): Gtk-CRITICAL **: gtk_menu_shell_insert: assertion 
> `GTK_IS_MENU_SHELL (menu_shell)' failed
> 
When you removed the built-in commands you left them in the denemoui.xml
menu builder, which seems to have been the source of that.

(Continue reading)

Richard Shann | 4 Jan 2012 12:36
Favicon

Re: Real time playback in Denemo


> 
> hmm, yes I was noticing that myself recently - some things, like
> staccato need to stay with the notehead, other things not. Needs some
> more thought, and probably another override (sigh).

Actually, this was easily fixed. In git now.

Richard
Jeremiah Benham | 5 Jan 2012 16:27

Re: Real time playback in Denemo

On 01/04/2012 05:36 AM, Richard Shann wrote:
>> hmm, yes I was noticing that myself recently - some things, like
>> staccato need to stay with the notehead, other things not. Needs some
>> more thought, and probably another override (sigh).
> Actually, this was easily fixed. In git now.

Thanks. It looks good. I will create a branch 0.9.4. When would you like 
to release?

Jeremiah
>
> Richard
>
>
Richard Shann | 5 Jan 2012 19:08
Favicon

The SOC branch MIDI - in.

Hi Dominic,

Is there a way to tell if the user has an active MIDI in? The variable
Denemo.gui->input_source needs to be set if so. I have just checked code
which sets it when the user uses it, but it really needs to be set
already (so that the rhythm_entry thing works out of the box).

Richard
Richard Shann | 5 Jan 2012 20:23
Favicon

Re: Real time playback in Denemo

On Thu, 2012-01-05 at 09:27 -0600, Jeremiah Benham wrote:
> 
> Thanks. It looks good. I will create a branch 0.9.4. When would you
> like 
> to release? 
What happened to this topic?
> Should we create scheme alternatives to the built-ins for dynamics?
> Some 
> of these would require multiple glyphs FFF, ppp, etc...

are there still built-in dynamics somewhere there?

Other things we need
	feature list
	Change log update
	other things????
Also, this time, we must create the release somewhere other than on
ftp.gnu.org so that it can be downloaded and built on a clean machine
before getting mirrored around the world.

Richard
Richard Shann | 5 Jan 2012 21:22
Favicon

Re: Real time playback in Denemo

On Thu, 2012-01-05 at 09:27 -0600, Jeremiah Benham wrote:
> 
> Thanks. It looks good. I will create a branch 0.9.4. When would you
> like 
> to release? 
Another thing is that we need to bump the version of the .denemo format,
and, if possible, provide a script to convert old files as in this email

> find testdir/ -name "*.denemo" -print0 | xargs -0  load-and-save
> 

If we don't do this, we cannot reasonably drop the tangle of backward
compatibility code that litters importxml.c

Richard

Gmane