- else
- empty_transfer_count = 0;
-
- trigger_offset = 0;
- if(trigger_stage >= 0)
- {
- for(i = 0; i < cur_buflen; i++)
- {
- if((cur_buf[i] & trigger_mask[trigger_stage]) == trigger_value[trigger_stage])
- {
- /* match on this trigger stage */
- trigger_buffer[trigger_stage] = cur_buf[i];
- trigger_stage++;
- if(trigger_stage == NUM_TRIGGER_STAGES || trigger_mask[trigger_stage] == 0)
- {
- /* match on all trigger stages, we're done */
- trigger_offset = i+1;
-
- /* TODO: send pre-trigger buffer to session bus */
-
- /* tell the frontend we hit the trigger here */
- packet.type = DF_TRIGGER;
- packet.length = 0;
- session_bus(user_data, &packet);
-
- /* send the samples that triggered it, since we're skipping past them */
- packet.type = DF_LOGIC8;
- packet.length = trigger_stage;
- packet.payload = trigger_buffer;
- session_bus(user_data, &packet);
- break;
-
- trigger_stage = TRIGGER_FIRED;
- }
- }
- else if(trigger_stage > 0)
- {
- /* we had a match before, but not in the next sample. however, we may
- * have a match on this stage in the next bit -- trigger on 0001 will
- * fail on seeing 00001, so we need to go back to stage 0 -- but at
- * the next sample from the one that matched originally, which the
- * counter increment at the end of the loop takes care of.
+ return;
+ } else {
+ empty_transfer_count = 0;
+ }
+
+ trigger_offset = 0;
+ if (fx2->trigger_stage >= 0) {
+ for (i = 0; i < cur_buflen; i++) {
+
+ if ((cur_buf[i] & fx2->trigger_mask[fx2->trigger_stage]) == fx2->trigger_value[fx2->trigger_stage]) {
+ /* Match on this trigger stage. */
+ fx2->trigger_buffer[fx2->trigger_stage] = cur_buf[i];
+ fx2->trigger_stage++;
+
+ if (fx2->trigger_stage == NUM_TRIGGER_STAGES || fx2->trigger_mask[fx2->trigger_stage] == 0) {
+ /* Match on all trigger stages, we're done. */
+ trigger_offset = i + 1;
+
+ /*
+ * TODO: Send pre-trigger buffer to session bus.
+ * Tell the frontend we hit the trigger here.
+ */
+ packet.type = SR_DF_TRIGGER;
+ packet.payload = NULL;
+ sr_session_bus(fx2->session_data, &packet);
+
+ /*
+ * Send the samples that triggered it, since we're
+ * skipping past them.