[SCM] gsequencer/master: added missing patch to Bug#857948
jkraehemann-guest at users.alioth.debian.org
jkraehemann-guest at users.alioth.debian.org
Thu Mar 16 16:06:28 UTC 2017
The following commit has been merged in the master branch:
commit 2ea63c4ab92e8b4c9de53642bfe2b0e8f68e9526
Author: Joël Krähemann <jkraehemann-guest at users.alioth.debian.org>
Date: Thu Mar 16 17:03:15 2017 +0100
added missing patch to Bug#857948
diff --git a/debian/patches/fix-copy-pattern-channel-run.patch b/debian/patches/fix-copy-pattern-channel-run.patch
deleted file mode 100644
index 3cd905c..0000000
--- a/debian/patches/fix-copy-pattern-channel-run.patch
+++ /dev/null
@@ -1,108 +0,0 @@
-Description: This patch includes generic mutex usage improvements. Mutices
- protect memory and execution stacks of concurrent access. Such data-races
- occur spurious and may end in crashing the application by SIGINT.
-Author: Joël Krähmann <jkraehemann at gmail.com>
-Applied-Upstream: 0.7.122.x, http://git.savannah.gnu.org/cgit/gsequencer.git
-Last-Update: 2017-01-31
---- a/ags/audio/recall/ags_copy_pattern_channel_run.c
-+++ b/ags/audio/recall/ags_copy_pattern_channel_run.c
-@@ -364,7 +364,7 @@
- gdouble delay, guint attack,
- AgsCopyPatternChannelRun *copy_pattern_channel_run)
- {
-- AgsChannel *output, *source;
-+ AgsChannel *source;
- AgsPattern *pattern;
- AgsCopyPatternAudio *copy_pattern_audio;
- AgsCopyPatternAudioRun *copy_pattern_audio_run;
-@@ -380,7 +380,8 @@
-
- pthread_mutex_t *application_mutex;
- pthread_mutex_t *pattern_mutex;
--
-+ pthread_mutex_t *source_mutex;
-+
- if(delay != 0.0){
- return;
- }
-@@ -440,34 +441,66 @@
-
- /* */
- if(current_bit){
-+ AgsChannel *link;
- AgsRecycling *recycling;
-+ AgsRecycling *end_recycling;
- AgsAudioSignal *audio_signal;
-
- gdouble delay;
- guint attack;
-
-+ pthread_mutex_t *link_mutex;
-+
- // g_message("ags_copy_pattern_channel_run_sequencer_alloc_callback - playing channel: %u; playing pattern: %u\0",
- // AGS_RECALL_CHANNEL(copy_pattern_channel)->source->line,
- // copy_pattern_audio_run->count_beats_audio_run->sequencer_counter);
-
- /* get source */
- source = AGS_RECALL_CHANNEL(copy_pattern_channel)->source;
-+
-+ pthread_mutex_lock(application_mutex);
-+
-+ source_mutex = ags_mutex_manager_lookup(mutex_manager,
-+ (GObject *) source);
-+
-+ pthread_mutex_unlock(application_mutex);
-+
-+ /* source fields */
-+ pthread_mutex_lock(source_mutex);
-+
-+ link = source->link;
-
-- /* create new audio signals */
- recycling = source->first_recycling;
-+
-+ if(recycling != NULL){
-+ end_recycling = source->last_recycling->next;
-+ }
-
-- //TODO:JK: unclear
-+ pthread_mutex_unlock(source_mutex);
-
-+ /* link */
-+ if(link != NULL){
-+ pthread_mutex_lock(application_mutex);
-+
-+ link_mutex = ags_mutex_manager_lookup(mutex_manager,
-+ (GObject *) link);
-+
-+ pthread_mutex_unlock(application_mutex);
-+ }
-+
-+ /* create audio signals */
- if(recycling != NULL){
- AgsRecallID *child_recall_id;
-
-- while(recycling != source->last_recycling->next){
-- if(source->link == NULL){
-+ while(recycling != end_recycling){
-+ if(link == NULL){
- child_recall_id = AGS_RECALL(copy_pattern_channel_run)->recall_id;
- }else{
- GList *list;
-
-- list = source->link->recall_id;
-+ pthread_mutex_lock(link_mutex);
-+
-+ list = link->recall_id;
-
- while(list != NULL){
- if(AGS_RECALL_ID(list->data)->recycling_context->parent == AGS_RECALL(copy_pattern_channel_run)->recall_id->recycling_context){
-@@ -481,6 +514,8 @@
- if(list == NULL){
- child_recall_id = NULL;
- }
-+
-+ pthread_mutex_unlock(link_mutex);
- }
-
- audio_signal = ags_audio_signal_new(AGS_RECALL(copy_pattern_audio)->soundcard,
diff --git a/debian/patches/fix-count-beats-audio-run.patch b/debian/patches/fix-count-beats-audio-run.patch
deleted file mode 100644
index c93b12b..0000000
--- a/debian/patches/fix-count-beats-audio-run.patch
+++ /dev/null
@@ -1,126 +0,0 @@
-Description: This patch includes generic mutex usage improvements. Mutices
- protect memory and execution stacks of concurrent access. Such data-races
- occur spurious and may end in crashing the application by SIGINT.
-Author: Joël Krähmann <jkraehemann at gmail.com>
-Applied-Upstream: 0.7.122.x, http://git.savannah.gnu.org/cgit/gsequencer.git
-Last-Update: 2017-01-31
---- a/ags/audio/recall/ags_count_beats_audio_run.c
-+++ b/ags/audio/recall/ags_count_beats_audio_run.c
-@@ -1446,38 +1446,87 @@
- }else{
- if(count_beats_audio_run->sequencer_counter >= (guint) loop_end - 1.0){
- AgsAudio *audio;
-+
-+ AgsMutexManager *mutex_manager;
-+
- GList *playback;
-
-+ pthread_mutex_t *application_mutex;
-+ pthread_mutex_t *audio_mutex;
-+
-+ audio = AGS_RECALL_AUDIO_RUN(count_beats_audio_run)->recall_audio->audio;
-+
-+ mutex_manager = ags_mutex_manager_get_instance();
-+ application_mutex = ags_mutex_manager_get_application_mutex(mutex_manager);
-+
-+ /* lookup audio mutex */
-+ pthread_mutex_lock(application_mutex);
-+
-+ audio_mutex = ags_mutex_manager_lookup(mutex_manager,
-+ audio);
-+
-+ pthread_mutex_unlock(application_mutex);
-+
-+ /* reset sequencer counter */
- count_beats_audio_run->sequencer_counter = 0;
-
-- audio = AGS_RECALL_AUDIO_RUN(count_beats_audio_run)->recall_audio->audio;
-+ /* get playback */
-+ pthread_mutex_lock(audio_mutex);
-+
- playback = AGS_PLAYBACK_DOMAIN(audio->playback_domain)->playback;
-
-+ pthread_mutex_unlock(audio_mutex);
-+
- /* emit stop signals */
- ags_count_beats_audio_run_sequencer_stop(count_beats_audio_run,
- FALSE);
-
- /* set done flag in soundcard play */
- while(playback != NULL){
-- if(AGS_PLAYBACK(playback->data)->recall_id[1] != NULL &&
-- AGS_PLAYBACK(playback->data)->recall_id[1]->recycling_context == AGS_RECALL(count_beats_audio_run)->recall_id->recycling_context){
-- AgsChannel *channel;
-+ AgsChannel *channel;
-+ AgsRecyclingContext *recycling_context;
-+
-+ pthread_mutex_lock(audio_mutex);
-+
-+ channel = audio->output;
-+
-+ if(AGS_PLAYBACK(playback->data)->recall_id[1] != NULL){
-+ recycling_context = AGS_PLAYBACK(playback->data)->recall_id[1]->recycling_context;
-+ }else{
-+ recycling_context = NULL;
-+ }
-+
-+ pthread_mutex_unlock(audio_mutex);
-+
-+ if(recycling_context == AGS_RECALL(count_beats_audio_run)->recall_id->recycling_context){
- AgsStreamChannelRun *stream_channel_run;
-+
- GList *list;
- GList *recall_recycling_list, *recall_audio_signal_list;
-+
- gboolean found;
-
-+ pthread_mutex_t *channel_mutex;
-+
- // AGS_PLAYBACK(playback->data)->flags |= AGS_PLAYBACK_DONE;
-
-+ /* lookup channel mutex */
-+ pthread_mutex_lock(application_mutex);
-+
-+ channel_mutex = ags_mutex_manager_lookup(mutex_manager,
-+ channel);
-+
-+ pthread_mutex_unlock(application_mutex);
-+
- /* check if to stop audio processing */
-- channel = audio->output;
- found = FALSE;
-
-+ pthread_mutex_lock(channel_mutex);
-+
- list = channel->play;
--
- list = ags_recall_find_type_with_recycling_context(list,
- AGS_TYPE_STREAM_CHANNEL_RUN,
-- (GObject *) AGS_RECALL(count_beats_audio_run)->recall_id->recycling_context);
-+ (GObject *) recycling_context);
-
- if(list != NULL){
- stream_channel_run = AGS_STREAM_CHANNEL_RUN(list->data);
-@@ -1500,6 +1549,8 @@
- }
- }
-
-+ pthread_mutex_unlock(channel_mutex);
-+
- /* stop audio processing*/
- if(!found){
- ags_count_beats_audio_run_stop(count_beats_audio_run,
-@@ -1509,7 +1560,12 @@
- break;
- }
-
-- playback = playback->next;
-+ /* iterate playback */
-+ pthread_mutex_lock(audio_mutex);
-+
-+ playback = playback->next;
-+
-+ pthread_mutex_unlock(audio_mutex);
- }
-
- return;
diff --git a/debian/patches/fix-delay-audio-run.patch b/debian/patches/fix-delay-audio-run.patch
deleted file mode 100644
index 31e02dd..0000000
--- a/debian/patches/fix-delay-audio-run.patch
+++ /dev/null
@@ -1,131 +0,0 @@
-Description: This patch includes generic mutex usage improvements. Mutices
- protect memory and execution stacks of concurrent access. Such data-races
- occur spurious and may end in crashing the application by SIGINT.
- There are minor code changes included fulfilled during code enhancement.
-Author: Joël Krähmann <jkraehemann at gmail.com>
-Applied-Upstream: 0.7.122.x, http://git.savannah.gnu.org/cgit/gsequencer.git
-Last-Update: 2017-01-31
---- a/ags/audio/recall/ags_delay_audio_run.c
-+++ b/ags/audio/recall/ags_delay_audio_run.c
-@@ -26,6 +26,8 @@
- #include <ags/object/ags_soundcard.h>
- #include <ags/object/ags_plugin.h>
-
-+#include <ags/thread/ags_mutex_manager.h>
-+
- #include <ags/file/ags_file_stock.h>
- #include <ags/file/ags_file_id_ref.h>
- #include <ags/file/ags_file_lookup.h>
-@@ -441,16 +443,24 @@
- AgsDelayAudio *delay_audio;
- AgsDelayAudioRun *delay_audio_run;
-
-+ AgsMutexManager *mutex_manager;
-+
- gdouble notation_delay, sequencer_delay;
-+ gdouble delay;
-+ guint attack;
-
- GValue value = { 0, };
-
-+ pthread_mutex_t *application_mutex;
-+ pthread_mutex_t *soundcard_mutex;
-+
- AGS_RECALL_CLASS(ags_delay_audio_run_parent_class)->run_pre(recall);
-
- // g_message("ags_delay_audio_run_run_pre()\0");
-
- delay_audio_run = AGS_DELAY_AUDIO_RUN(recall);
-
-+ /* check done */
- if((AGS_RECALL_PERSISTENT & (recall->flags)) == 0 &&
- delay_audio_run->dependency_ref == 0){
- delay_audio_run->notation_counter = 0;
-@@ -463,6 +473,17 @@
-
- delay_audio = AGS_DELAY_AUDIO(AGS_RECALL_AUDIO_RUN(delay_audio_run)->recall_audio);
-
-+ mutex_manager = ags_mutex_manager_get_instance();
-+ application_mutex = ags_mutex_manager_get_application_mutex(mutex_manager);
-+
-+ /* lookup soundcard mutex */
-+ pthread_mutex_lock(application_mutex);
-+
-+ soundcard_mutex = ags_mutex_manager_lookup(mutex_manager,
-+ recall->soundcard);
-+
-+ pthread_mutex_unlock(application_mutex);
-+
- /* read notation-delay port */
- g_value_init(&value, G_TYPE_DOUBLE);
-
-@@ -489,22 +510,22 @@
- }else{
- delay_audio_run->sequencer_counter += 1;
- }
-+
-+ /* delay and attack */
-+ pthread_mutex_lock(soundcard_mutex);
-+
-+ attack = ags_soundcard_get_attack(AGS_SOUNDCARD(recall->soundcard));
-+
-+ pthread_mutex_unlock(soundcard_mutex);
-+
-+ delay = 0.0;
-
-+ /* notation */
- if(delay_audio_run->notation_counter == 0){
- guint run_order;
-- gdouble delay;
-- guint attack;
-
- run_order = 0; //NOTE:JK: old hide_ref style
-
-- /* delay and attack */
-- //TODO:JK: unclear
-- attack = ags_soundcard_get_attack(AGS_SOUNDCARD(recall->soundcard));
--
-- delay = 0.0; // soundcard->delay[((soundcard->tic_counter + 1 == AGS_NOTATION_TICS_PER_BEAT) ?
-- // 0:
-- // soundcard->tic_counter + 1)];
--
- // g_message("ags_delay_audio_run_run_pre@%llu: alloc notation[%u]\0",
- // delay_audio_run,
- // run_order);
-@@ -521,8 +542,6 @@
- delay, attack);
- }else{
- guint run_order;
-- gdouble delay;
-- guint attack;
-
- run_order = 0;
-
-@@ -541,17 +560,9 @@
- delay, attack);
- }
-
-+ /* sequencer */
- if(delay_audio_run->sequencer_counter == 0){
- guint run_order;
-- gdouble delay;
-- guint attack;
--
-- /* delay and attack */
-- //TODO:JK: unclear
-- attack = ags_soundcard_get_attack(AGS_SOUNDCARD(recall->soundcard));
-- delay = 0.0; // soundcard->delay[((soundcard->tic_counter + 1 == AGS_NOTATION_TICS_PER_BEAT) ?
-- // 0:
-- // soundcard->tic_counter + 1)];
-
- run_order = 0;
-
-@@ -572,8 +583,6 @@
- delay, attack);
- }else{
- guint run_order;
-- gdouble delay;
-- guint attack;
-
- run_order = 0;
-
diff --git a/debian/patches/fix-missing-mutices.diff b/debian/patches/fix-missing-mutices.diff
index 6ee476e..28c0e20 100644
--- a/debian/patches/fix-missing-mutices.diff
+++ b/debian/patches/fix-missing-mutices.diff
@@ -344,3 +344,208 @@
}
audio_signal = ags_audio_signal_new(AGS_RECALL(copy_pattern_audio)->soundcard,
+--- a/ags/audio/recall/ags_record_midi_audio_run.c
++++ b/ags/audio/recall/ags_record_midi_audio_run.c
+@@ -87,7 +87,7 @@
+ * @section_id:
+ * @include: ags/audio/recall/ags_record_midi_audio_run.h
+ *
+- * The #AgsRecordMidiAudioRun class record midi.
++ * The #AgsRecordMidiAudioRun does record midi.
+ */
+
+ enum{
+@@ -610,7 +610,7 @@
+ AgsRecallID *recall_id,
+ guint *n_params, GParameter *parameter)
+ {
+- AgsRecordMidiAudioRun *copy, *record_midi_audio_run;
++ AgsRecordMidiAudioRun *copy;
+
+ copy = AGS_RECORD_MIDI_AUDIO_RUN(AGS_RECALL_CLASS(ags_record_midi_audio_run_parent_class)->duplicate(recall,
+ recall_id,
+@@ -687,8 +687,10 @@
+
+ glong division, tempo, bpm;
+ guint notation_counter;
++ gboolean reverse_mapping;
+ gboolean pattern_mode;
+ gboolean playback, record;
++ guint midi_channel;
+ guint audio_start_mapping;
+ guint midi_start_mapping, midi_end_mapping;
+ guint input_pads;
+@@ -703,22 +705,15 @@
+ pthread_mutex_t *audio_mutex;
+ pthread_mutex_t *channel_mutex;
+
++ /* */
++ mutex_manager = ags_mutex_manager_get_instance();
++ application_mutex = ags_mutex_manager_get_application_mutex(mutex_manager);
++
++ /* get defaults */
+ record_midi_audio_run = AGS_RECORD_MIDI_AUDIO_RUN(recall);
+ record_midi_audio = AGS_RECORD_MIDI_AUDIO(AGS_RECALL_AUDIO_RUN(recall)->recall_audio);
+
+- delay_audio_run = record_midi_audio_run->delay_audio_run;
+- count_beats_audio_run = AGS_COUNT_BEATS_AUDIO_RUN(record_midi_audio_run->count_beats_audio_run);
+-
+ audio = AGS_RECALL_AUDIO(record_midi_audio)->audio;
+- sequencer = audio->sequencer;
+-
+- if(sequencer == NULL){
+- return;
+- }
+-
+- /* */
+- mutex_manager = ags_mutex_manager_get_instance();
+- application_mutex = ags_mutex_manager_get_application_mutex(mutex_manager);
+
+ /* get audio mutex */
+ pthread_mutex_lock(application_mutex);
+@@ -728,10 +723,29 @@
+
+ pthread_mutex_unlock(application_mutex);
+
++ /* */
++ pthread_mutex_lock(audio_mutex);
++
++ delay_audio_run = record_midi_audio_run->delay_audio_run;
++ count_beats_audio_run = AGS_COUNT_BEATS_AUDIO_RUN(record_midi_audio_run->count_beats_audio_run);
++
++ sequencer = audio->sequencer;
++
++ pthread_mutex_unlock(audio_mutex);
++
++ if(sequencer == NULL){
++ return;
++ }
++
+ /* get audio fields */
+ pthread_mutex_lock(audio_mutex);
+
++ reverse_mapping = ((AGS_AUDIO_REVERSE_MAPPING & (audio->flags)) != 0) ? TRUE: FALSE;
++
+ pattern_mode = ((AGS_AUDIO_PATTERN_MODE & (audio->flags)) != 0) ? TRUE: FALSE;
++
++ midi_channel = audio->midi_channel;
++
+ audio_start_mapping = audio->audio_start_mapping;
+
+ midi_start_mapping = audio->midi_start_mapping;
+@@ -785,10 +799,10 @@
+ notation = NULL;
+ }
+
+- pthread_mutex_unlock(audio_mutex);
+-
+ /* */
+ notation_counter = count_beats_audio_run->notation_counter;
++
++ pthread_mutex_unlock(audio_mutex);
+
+ /* get mode */
+ g_value_init(&value,
+@@ -852,18 +866,20 @@
+ AgsNote *current_note;
+
+ /* key on - check within mapping */
+- if(audio->midi_channel == (0x0f & midi_iter[0])){
++ if(midi_channel == (0x0f & midi_iter[0])){
+ if(midi_start_mapping <= (0x7f & midi_iter[1]) &&
+- (((AGS_AUDIO_REVERSE_MAPPING & (audio->flags)) != 0 &&
++ ((reverse_mapping &&
+ input_pads - ((0x7f & midi_iter[1]) - midi_start_mapping) - 1 > 0) ||
+- ((AGS_AUDIO_REVERSE_MAPPING & (audio->flags)) == 0 &&
++ (!reverse_mapping &&
+ (0x7f & midi_iter[1]) - midi_start_mapping < midi_end_mapping))){
+ current_note = NULL;
+ note = record_midi_audio_run->note;
+
++ pthread_mutex_lock(audio_mutex);
++
+ while(note != NULL){
+ /* check current notes */
+- if((AGS_AUDIO_REVERSE_MAPPING & (audio->flags)) != 0){
++ if(reverse_mapping){
+ if(AGS_NOTE(note->data)->y == input_pads - ((0x7f & midi_iter[1]) - midi_start_mapping) - 1){
+ current_note = note->data;
+
+@@ -879,7 +895,9 @@
+
+ note = note->next;
+ }
+-
++
++ pthread_mutex_unlock(audio_mutex);
++
+ /* add note */
+ if(current_note == NULL){
+ if((0x7f & (midi_iter[2])) != 0){
+@@ -888,7 +906,7 @@
+ current_note->x[0] = notation_counter;
+ current_note->x[1] = notation_counter + 1;
+
+- if((AGS_AUDIO_REVERSE_MAPPING & (audio->flags)) != 0){
++ if(reverse_mapping){
+ current_note->y = input_pads - ((0x7f & midi_iter[1]) - midi_start_mapping) - 1;
+ }else{
+ current_note->y = (0x7f & midi_iter[1]) - midi_start_mapping;
+@@ -946,10 +964,12 @@
+ /* key off - find matching note */
+ current_note = NULL;
+ note = record_midi_audio_run->note;
+-
++
++ pthread_mutex_lock(audio_mutex);
++
+ while(note != NULL){
+ /* check current notes */
+- if((AGS_AUDIO_REVERSE_MAPPING & (audio->flags)) != 0){
++ if(reverse_mapping){
+ if(AGS_NOTE(note->data)->y == input_pads - ((0x7f & midi_iter[1]) - midi_start_mapping) - 1){
+ current_note = note->data;
+
+@@ -965,7 +985,9 @@
+
+ note = note->next;
+ }
+-
++
++ pthread_mutex_unlock(audio_mutex);
++
+ /* remove current note */
+ if(current_note != NULL){
+ pthread_mutex_lock(audio_mutex);
+@@ -992,9 +1014,11 @@
+ current_note = NULL;
+ note = record_midi_audio_run->note;
+
++ pthread_mutex_lock(audio_mutex);
++
+ while(note != NULL){
+ /* check current notes */
+- if((AGS_AUDIO_REVERSE_MAPPING & (audio->flags)) != 0){
++ if(reverse_mapping){
+ if(AGS_NOTE(note->data)->y == input_pads - ((0x7f & midi_iter[1]) - midi_start_mapping) - 1){
+ current_note = note->data;
+
+@@ -1010,7 +1034,9 @@
+
+ note = note->next;
+ }
+-
++
++ pthread_mutex_unlock(audio_mutex);
++
+ /* feed note */
+ if(current_note != NULL){
+ current_note->x[1] = notation_counter + 1;
+@@ -1116,6 +1142,7 @@
+ }
+ }
+
++ /* call parent */
+ AGS_RECALL_CLASS(ags_record_midi_audio_run_parent_class)->run_pre(recall);
+ }
+
diff --git a/debian/patches/fix-record-midi-audio-run.patch b/debian/patches/fix-record-midi-audio-run.patch
deleted file mode 100644
index 3bb28d7..0000000
--- a/debian/patches/fix-record-midi-audio-run.patch
+++ /dev/null
@@ -1,211 +0,0 @@
-Description: This patch is considered critical since it fixes missing mutices.
- You have to protect structure against concurrent access by a mutex in order
- to avoid data-races.
-Author: Joël Krähmann <jkraehemann at gmail.com>
-Applied-Upstream: 0.7.122.x, http://git.savannah.gnu.org/cgit/gsequencer.git
-Last-Update: 2017-02-05
---- a/ags/audio/recall/ags_record_midi_audio_run.c
-+++ b/ags/audio/recall/ags_record_midi_audio_run.c
-@@ -87,7 +87,7 @@
- * @section_id:
- * @include: ags/audio/recall/ags_record_midi_audio_run.h
- *
-- * The #AgsRecordMidiAudioRun class record midi.
-+ * The #AgsRecordMidiAudioRun does record midi.
- */
-
- enum{
-@@ -610,7 +610,7 @@
- AgsRecallID *recall_id,
- guint *n_params, GParameter *parameter)
- {
-- AgsRecordMidiAudioRun *copy, *record_midi_audio_run;
-+ AgsRecordMidiAudioRun *copy;
-
- copy = AGS_RECORD_MIDI_AUDIO_RUN(AGS_RECALL_CLASS(ags_record_midi_audio_run_parent_class)->duplicate(recall,
- recall_id,
-@@ -687,8 +687,10 @@
-
- glong division, tempo, bpm;
- guint notation_counter;
-+ gboolean reverse_mapping;
- gboolean pattern_mode;
- gboolean playback, record;
-+ guint midi_channel;
- guint audio_start_mapping;
- guint midi_start_mapping, midi_end_mapping;
- guint input_pads;
-@@ -703,22 +705,15 @@
- pthread_mutex_t *audio_mutex;
- pthread_mutex_t *channel_mutex;
-
-+ /* */
-+ mutex_manager = ags_mutex_manager_get_instance();
-+ application_mutex = ags_mutex_manager_get_application_mutex(mutex_manager);
-+
-+ /* get defaults */
- record_midi_audio_run = AGS_RECORD_MIDI_AUDIO_RUN(recall);
- record_midi_audio = AGS_RECORD_MIDI_AUDIO(AGS_RECALL_AUDIO_RUN(recall)->recall_audio);
-
-- delay_audio_run = record_midi_audio_run->delay_audio_run;
-- count_beats_audio_run = AGS_COUNT_BEATS_AUDIO_RUN(record_midi_audio_run->count_beats_audio_run);
--
- audio = AGS_RECALL_AUDIO(record_midi_audio)->audio;
-- sequencer = audio->sequencer;
--
-- if(sequencer == NULL){
-- return;
-- }
--
-- /* */
-- mutex_manager = ags_mutex_manager_get_instance();
-- application_mutex = ags_mutex_manager_get_application_mutex(mutex_manager);
-
- /* get audio mutex */
- pthread_mutex_lock(application_mutex);
-@@ -728,10 +723,29 @@
-
- pthread_mutex_unlock(application_mutex);
-
-+ /* */
-+ pthread_mutex_lock(audio_mutex);
-+
-+ delay_audio_run = record_midi_audio_run->delay_audio_run;
-+ count_beats_audio_run = AGS_COUNT_BEATS_AUDIO_RUN(record_midi_audio_run->count_beats_audio_run);
-+
-+ sequencer = audio->sequencer;
-+
-+ pthread_mutex_unlock(audio_mutex);
-+
-+ if(sequencer == NULL){
-+ return;
-+ }
-+
- /* get audio fields */
- pthread_mutex_lock(audio_mutex);
-
-+ reverse_mapping = ((AGS_AUDIO_REVERSE_MAPPING & (audio->flags)) != 0) ? TRUE: FALSE;
-+
- pattern_mode = ((AGS_AUDIO_PATTERN_MODE & (audio->flags)) != 0) ? TRUE: FALSE;
-+
-+ midi_channel = audio->midi_channel;
-+
- audio_start_mapping = audio->audio_start_mapping;
-
- midi_start_mapping = audio->midi_start_mapping;
-@@ -785,10 +799,10 @@
- notation = NULL;
- }
-
-- pthread_mutex_unlock(audio_mutex);
--
- /* */
- notation_counter = count_beats_audio_run->notation_counter;
-+
-+ pthread_mutex_unlock(audio_mutex);
-
- /* get mode */
- g_value_init(&value,
-@@ -852,18 +866,20 @@
- AgsNote *current_note;
-
- /* key on - check within mapping */
-- if(audio->midi_channel == (0x0f & midi_iter[0])){
-+ if(midi_channel == (0x0f & midi_iter[0])){
- if(midi_start_mapping <= (0x7f & midi_iter[1]) &&
-- (((AGS_AUDIO_REVERSE_MAPPING & (audio->flags)) != 0 &&
-+ ((reverse_mapping &&
- input_pads - ((0x7f & midi_iter[1]) - midi_start_mapping) - 1 > 0) ||
-- ((AGS_AUDIO_REVERSE_MAPPING & (audio->flags)) == 0 &&
-+ (!reverse_mapping &&
- (0x7f & midi_iter[1]) - midi_start_mapping < midi_end_mapping))){
- current_note = NULL;
- note = record_midi_audio_run->note;
-
-+ pthread_mutex_lock(audio_mutex);
-+
- while(note != NULL){
- /* check current notes */
-- if((AGS_AUDIO_REVERSE_MAPPING & (audio->flags)) != 0){
-+ if(reverse_mapping){
- if(AGS_NOTE(note->data)->y == input_pads - ((0x7f & midi_iter[1]) - midi_start_mapping) - 1){
- current_note = note->data;
-
-@@ -879,7 +895,9 @@
-
- note = note->next;
- }
--
-+
-+ pthread_mutex_unlock(audio_mutex);
-+
- /* add note */
- if(current_note == NULL){
- if((0x7f & (midi_iter[2])) != 0){
-@@ -888,7 +906,7 @@
- current_note->x[0] = notation_counter;
- current_note->x[1] = notation_counter + 1;
-
-- if((AGS_AUDIO_REVERSE_MAPPING & (audio->flags)) != 0){
-+ if(reverse_mapping){
- current_note->y = input_pads - ((0x7f & midi_iter[1]) - midi_start_mapping) - 1;
- }else{
- current_note->y = (0x7f & midi_iter[1]) - midi_start_mapping;
-@@ -946,10 +964,12 @@
- /* key off - find matching note */
- current_note = NULL;
- note = record_midi_audio_run->note;
--
-+
-+ pthread_mutex_lock(audio_mutex);
-+
- while(note != NULL){
- /* check current notes */
-- if((AGS_AUDIO_REVERSE_MAPPING & (audio->flags)) != 0){
-+ if(reverse_mapping){
- if(AGS_NOTE(note->data)->y == input_pads - ((0x7f & midi_iter[1]) - midi_start_mapping) - 1){
- current_note = note->data;
-
-@@ -965,7 +985,9 @@
-
- note = note->next;
- }
--
-+
-+ pthread_mutex_unlock(audio_mutex);
-+
- /* remove current note */
- if(current_note != NULL){
- pthread_mutex_lock(audio_mutex);
-@@ -992,9 +1014,11 @@
- current_note = NULL;
- note = record_midi_audio_run->note;
-
-+ pthread_mutex_lock(audio_mutex);
-+
- while(note != NULL){
- /* check current notes */
-- if((AGS_AUDIO_REVERSE_MAPPING & (audio->flags)) != 0){
-+ if(reverse_mapping){
- if(AGS_NOTE(note->data)->y == input_pads - ((0x7f & midi_iter[1]) - midi_start_mapping) - 1){
- current_note = note->data;
-
-@@ -1010,7 +1034,9 @@
-
- note = note->next;
- }
--
-+
-+ pthread_mutex_unlock(audio_mutex);
-+
- /* feed note */
- if(current_note != NULL){
- current_note->x[1] = notation_counter + 1;
-@@ -1116,6 +1142,7 @@
- }
- }
-
-+ /* call parent */
- AGS_RECALL_CLASS(ags_record_midi_audio_run_parent_class)->run_pre(recall);
- }
-
--
gsequencer packaging
More information about the pkg-multimedia-commits
mailing list