newsAdvanced Gtk+ Sequencer - News: GCC builtin vector functions and a lock free soundcard buffer

 
 
Latest News
GSequencer v3.6.x release goals posted by jkraehemann, Fri 31 Jul 2020 10:17:04 AM UTC - 0 replies
GSequencer v3.4.x release goals posted by jkraehemann, Thu 11 Jun 2020 06:58:14 PM UTC - 0 replies
GSequencer v3.3.x replaced all recalls by ags-fx engine posted by jkraehemann, Wed 20 May 2020 07:25:15 AM UTC - 0 replies
Refactor GSequencer's recalls - the ags-fx engine posted by jkraehemann, Sun 03 May 2020 12:08:19 AM UTC - 0 replies
GSequencer v3.3.x release goals posted by jkraehemann, Fri 17 Apr 2020 12:36:11 PM UTC - 0 replies
[Submit News]
[97 news in archive]

GCC builtin vector functions and a lock free soundcard buffer

Item posted by Joël Krähemann <jkraehemann> on Mon 29 Jul 2019 03:36:31 PM UTC.

Yay, this was real fun!

The Advanced Gtk+ Sequencer libraries have got vector optimization.

Just checkout: ags_audio_buffer_util.h

There you find the defined vectors for common types:

typedef gint8 v8s8 __attribute__ ((vector_size(8 * sizeof(gint8))));
typedef gint16 v8s16 __attribute__ ((vector_size(8 * sizeof(gint16))));
typedef gint32 v8s32 __attribute__ ((vector_size(8 * sizeof(gint32))));
typedef gint64 v8s64 __attribute__ ((vector_size(8 * sizeof(gint64))));
typedef gfloat v8float __attribute__ ((vector_size(8 * sizeof(gfloat))));
typedef gdouble v8double __attribute__ ((vector_size(8 * sizeof(gdouble))));

You can now compute your buffers using vector mathematics. These vectors allow to process multiple integer or floats using SSE2 registers or floating point unit.

And the lock free soundcard buffer using pthread_mutex_trylock().

Checkout: ags_soundcard.h

The interface prototype is as following:

guint ags_soundcard_get_sub_block_count(AgsSoundcard *soundcard);

gboolean ags_soundcard_trylock_sub_block(AgsSoundcard *soundcard,
                                         void *buffer, guint sub_block);
void ags_soundcard_unlock_sub_block(AgsSoundcard *soundcard,
                                    void *buffer, guint sub_block);

Currently, only output soundcard implements above:

  • AgsDevout
  • AgsJackDevout
  • AgsPulseDevout
  • AgsCoreAudioDevout

It is used during final mixing using vectors, doing a lock free buffer during ags-play recall.

See here: ags_audio_signal.c


by Joël

No messages in GCC builtin vector functions and a lock free soundcard buffer

 

Back to the top


Powered by Savane 3.5