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

 
 
Latest News
GSequencer version 3.10.5 released posted by jkraehemann, Sun 29 Aug 2021 07:41:14 AM UTC - 0 replies
implement VST3 C API Wrapper posted by jkraehemann, Tue 10 Aug 2021 12:53:03 PM UTC - 0 replies
refactored utility functions posted by jkraehemann, Tue 03 Aug 2021 06:26:38 AM UTC - 0 replies
GSequencer version 3.9.1 released posted by jkraehemann, Wed 30 Jun 2021 06:07:07 AM UTC - 0 replies
preparation for migration to Gtk4 posted by jkraehemann, Thu 18 Feb 2021 10:38:40 AM UTC - 0 replies
[Submit News]
[103 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.7