示例#1
0
/////////////////////////////////////////////////////////////////////////////
// resets note stacks used for transposer/arpeggiator
/////////////////////////////////////////////////////////////////////////////
s32 SEQ_MIDI_IN_ResetTransArpStacks(void)
{
  int bus;
  for(bus=0; bus<SEQ_MIDI_IN_NUM_BUSSES; ++bus) {
    NOTESTACK_Init(&bus_notestack[bus][BUS_NOTESTACK_TRANSPOSER],
		   NOTESTACK_MODE_PUSH_TOP,
		   &bus_notestack_items[bus][BUS_NOTESTACK_TRANSPOSER][0],
		   SEQ_MIDI_IN_NOTESTACK_SIZE);

    NOTESTACK_Init(&bus_notestack[bus][BUS_NOTESTACK_ARP_SORTED],
		   NOTESTACK_MODE_SORT,
		   &bus_notestack_items[bus][BUS_NOTESTACK_ARP_SORTED][0],
		   SEQ_MIDI_IN_NOTESTACK_SIZE);

    NOTESTACK_Init(&bus_notestack[bus][BUS_NOTESTACK_ARP_UNSORTED],
		   NOTESTACK_MODE_PUSH_TOP,
		   &bus_notestack_items[bus][BUS_NOTESTACK_ARP_UNSORTED][0],
		   SEQ_MIDI_IN_NOTESTACK_SIZE);

    transposer_hold_note[bus] = 0x3c; // C-3

    int i;
    for(i=0; i<4; ++i)
      arp_sorted_hold[bus][i].ALL = arp_unsorted_hold[bus][i].ALL = 0;

    arp_sorted_hold[bus][0].note = arp_unsorted_hold[bus][0].note = 0x3c; // C-3
    arp_sorted_hold[bus][1].note = arp_unsorted_hold[bus][1].note = 0x40; // E-3
    arp_sorted_hold[bus][2].note = arp_unsorted_hold[bus][2].note = 0x43; // G-3
    arp_sorted_hold[bus][3].note = arp_unsorted_hold[bus][3].note = 0x48; // C-4
  }
    
  return 0; // no error
}
示例#2
0
/////////////////////////////////////////////////////////////////////////////
// resets note stacks used for patch changer
/////////////////////////////////////////////////////////////////////////////
s32 SEQ_MIDI_IN_ResetChangerStacks(void)
{
  int i;

  for(i=0; i<SECTION_CHANGER_NOTESTACK_NUM; ++i)
    NOTESTACK_Init(&section_changer_notestack[i],
		   NOTESTACK_MODE_PUSH_TOP,
		   &section_changer_notestack_items[i][0],
		   SEQ_MIDI_IN_SECTION_CHANGER_NOTESTACK_SIZE);

  for(i=0; i<PATCH_CHANGER_NOTESTACK_NUM; ++i)
    NOTESTACK_Init(&patch_changer_notestack[i],
		   NOTESTACK_MODE_PUSH_TOP,
		   &patch_changer_notestack_items[i][0],
		   SEQ_MIDI_IN_PATCH_CHANGER_NOTESTACK_SIZE);

  // following operation should be atomic!
  u8 track;
  seq_core_trk_t *t = &seq_core_trk[0];
  MIOS32_IRQ_Disable();
  for(track=0; track<SEQ_CORE_NUM_TRACKS; ++track, ++t)
    t->play_section = 0; // don't select section
  MIOS32_IRQ_Enable();

  return 0; // no error
}
示例#3
0
文件: seq.c 项目: gillspice/mios32
/////////////////////////////////////////////////////////////////////////////
// Initialisation
/////////////////////////////////////////////////////////////////////////////
s32 SEQ_Init(u32 mode)
{
  // initialize the Notestack
#if 0
  NOTESTACK_Init(&notestack, NOTESTACK_MODE_PUSH_TOP, &notestack_items[0], NOTESTACK_SIZE);
#else
  // for an arpeggiator we prefer sorted mode
  // activate hold mode as well. Stack will be cleared whenever no note is played anymore
  NOTESTACK_Init(&notestack, NOTESTACK_MODE_SORT_HOLD, &notestack_items[0], NOTESTACK_SIZE);
#endif

  // and the arp counter
  arp_counter = 0;

  // reset sequencer
  SEQ_Reset();

  // init BPM generator
  SEQ_BPM_Init(0);

  SEQ_BPM_PPQN_Set(384);
  SEQ_BPM_Set(120.0);

  return 0; // no error
}
示例#4
0
/////////////////////////////////////////////////////////////////////////////
// This hook is called after startup to initialize the application
/////////////////////////////////////////////////////////////////////////////
void APP_Init(void)
{
  // initialize all LEDs
  MIOS32_BOARD_LED_Init(0xffffffff);

  // create semaphores
  xSDCardSemaphore = xSemaphoreCreateRecursiveMutex();

  // initialize the Notestack
  NOTESTACK_Init(&notestack, NOTESTACK_MODE_PUSH_TOP, &notestack_items[0], NOTESTACK_SIZE);

  // init Synth
  SYNTH_Init(0);

  // initialize all J10 pins as inputs with internal Pull-Up
  int pin;
  for(pin=0; pin<8; ++pin)
    MIOS32_BOARD_J10_PinInit(pin, MIOS32_BOARD_PIN_MODE_INPUT_PU);

  // initialize Standard Control Surface
  SCS_Init(0);

  // initialize local SCS configuration
  SCS_CONFIG_Init(0);

  // initialize file system
  SYNTH_FILE_Init(0);

  // start task
  xTaskCreate(TASK_Periodic_1mS, (signed portCHAR *)"Periodic_1mS", configMINIMAL_STACK_SIZE, NULL, PRIORITY_TASK_PERIODIC_1MS, NULL);
  xTaskCreate(TASK_Period_1mS_LP, (signed portCHAR *)"1mS_LP", configMINIMAL_STACK_SIZE, NULL, PRIORITY_TASK_PERIOD_1mS_LP, NULL);
}
/////////////////////////////////////////////////////////////////////////////
// Notestack Handling
/////////////////////////////////////////////////////////////////////////////
void MbCvMidiVoice::notestackReset(void)
{
    NOTESTACK_Init(&midivoiceNotestack,
                   NOTESTACK_MODE_PUSH_TOP,
                   &midivoiceNotestackItems[0],
                   CV_SE_NOTESTACK_SIZE);
}
示例#6
0
/////////////////////////////////////////////////////////////////////////////
// This hook is called after startup to initialize the application
/////////////////////////////////////////////////////////////////////////////
void APP_Init(void)
{
  // initialize all LEDs
  MIOS32_BOARD_LED_Init(0xffffffff);

  // initialize the Notestack
  NOTESTACK_Init(&notestack, NOTESTACK_MODE_PUSH_TOP, &notestack_items[0], NOTESTACK_SIZE);

  // init Synth
  SYNTH_Init(0);

  // print first message
  print_msg = PRINT_MSG_INIT;
}
示例#7
0
/////////////////////////////////////////////////////////////////////////////
//! Called to reset all channels/notes (e.g. after session change)
/////////////////////////////////////////////////////////////////////////////
s32 MBNG_CV_ResetAllChannels(void)
{
  int cv;

  for(cv=0; cv<MBNG_PATCH_NUM_CV_CHANNELS; ++cv) {
    NOTESTACK_Init(&cv_notestack[cv],
                   NOTESTACK_MODE_PUSH_TOP,
                   &cv_notestack_items[cv][0],
                   NOTESTACK_SIZE);

    AOUT_PinSet(cv, 0x0000);
    AOUT_PinPitchSet(cv, 0x0000);
    AOUT_PinPitchRangeSet(cv, 2);
    AOUT_DigitalPinSet(cv, 0);

    cv_value[cv] = 0;
    cv_transpose_octave[cv] = 0;
    cv_transpose_semitones[cv] = 0;
  }

  return 0; // no error
}