Example #1
0
static void *Undo_Do_AudioEffect(
	struct Tracker_Windows *window,
	struct WBlocks *wblock,
	struct WTracks *wtrack,
	int realline,
	void *pointer
){

  struct Undo_AudioEffect *undo_ae=pointer;
  SoundPlugin *plugin = undo_ae->patch->patchdata;

  float new_value = plugin->savable_effect_values[undo_ae->effect_num];

  printf("Calling Undo_do for %d. Current value: %f. Now setting it back to %f\n",undo_ae->effect_num,new_value,undo_ae->value);

  PLAYER_lock();{
    PLUGIN_set_effect_value(plugin,
                            -1, 
                            undo_ae->effect_num, 
                            undo_ae->value, 
                            PLUGIN_STORED_TYPE,
                            PLUGIN_STORE_VALUE,
                            FX_single
                            );
  }PLAYER_unlock();

  GFX_update_instrument_widget(undo_ae->patch);

  undo_ae->value = new_value;

  return undo_ae;
}
Example #2
0
static void *Undo_Do_PatchVoice(
	struct Tracker_Windows *window,
	struct WBlocks *wblock,
	struct WTracks *wtrack,
	int realline,
	void *pointer
){

  struct Undo_PatchVoice *undo_ae=pointer;
  struct Patch *patch = undo_ae->patch;
  int voicenum = undo_ae->voicenum;

  struct PatchVoice new_patch_voice = patch->voices[voicenum];

printf("Calling Undo_do for %d. Old value: %d. Setting it to %d\n", voicenum,new_patch_voice.is_on,undo_ae->voice.is_on);
//if(new_patch_voice.is_on==undo_ae->voice.is_on)
//  abort();

  PLAYER_lock();
  {
    patch->voices[voicenum] = undo_ae->voice;
  }
  PLAYER_unlock();

  GFX_update_instrument_widget(undo_ae->patch);

  undo_ae->voice = new_patch_voice;

  return undo_ae;
}
Example #3
0
void EditorWidget::updateEditor(){
  if(ATOMIC_GET(is_starting_up)==true)
    return;

  {
    struct Patch *patch = ATOMIC_GET(atomic_must_redraw_instrument);
    if (patch!=NULL){
      ATOMIC_SET(atomic_must_redraw_instrument, NULL);
      GFX_update_instrument_widget(patch);//GFX_update_instrument_patch_gui(patch);
    }
  }
  

  transfer_atomic_must_redraws(window);
#if 0 //!defined(RELEASE)
  {
    int queue_size = GFX_get_op_queue_size(this->window);
    if (queue_size > 0 || this->window->must_calculate_coordinates==true || this->window->must_redraw==true || this->window->must_redraw_editor)
      printf("..Updating. Queue: %d. Update coordinates: %d. Redraw editor: %d. Redraw: %d\n",
             queue_size, this->window->must_calculate_coordinates, this->window->must_redraw_editor, this->window->must_redraw
             );
  }
#endif
  
  if (GFX_get_op_queue_size(this->window)>0)
    this->window->must_redraw = true;
    
  if (this->window->must_calculate_coordinates==true){
    this->window->must_redraw = true;
    this->window->must_calculate_coordinates=false;
  }

  if (this->window->must_redraw) {
    UpdateTrackerWindowCoordinates(window);
    UpdateWBlockCoordinates(this->window, this->window->wblock);
    GFX_UpdateUpperLeft(window, window->wblock);
    UpdateAllPianoRollHeaders(window, window->wblock);
    SEQUENCER_update();
    
    update();

    this->window->must_redraw_editor=true;
    this->window->must_redraw=false;
  }

  if (this->window->must_redraw_editor==true){
    GL_create(this->window, this->window->wblock);
    if (!is_playing())
      SEQUENCER_update();
    this->window->must_redraw_editor=false;
  }
}
Example #4
0
static bool set_new_sample(struct SoundPlugin *plugin, const wchar_t *filename, int instrument_number, int resampler_type){
  bool success=false;

  Data *data = NULL;
  Data *old_data = plugin->data;

  filename = OS_loading_get_resolved_file_path(filename);
  if (filename==NULL)
    goto exit;

  data = create_data(old_data->samplerate, plugin->data, filename, instrument_number, resampler_type);

  if(load_sample(data,filename,instrument_number)==false)
    goto exit;

  // Put loop_onoff into storage.
  PLUGIN_set_effect_value2(plugin, -1, EFF_LOOP_ONOFF, data->loop_onoff==true?1.0f:0.0f, PLUGIN_STORED_TYPE, PLUGIN_STORE_VALUE, FX_single, PLAYERLOCK_NOT_REQUIRED);

  if(SP_is_plugin_running(plugin)){

    PLAYER_lock();{  
      old_data->new_data = data;
    }PLAYER_unlock();

    if (PLAYER_is_running())
      RSEMAPHORE_wait(old_data->signal_from_RT,1);

  } else {

    plugin->data = data;

  }

  delete_data(old_data);

  update_peaks(plugin);

  volatile struct Patch *patch = plugin->patch;
  if(patch!=NULL)
    GFX_update_instrument_widget((struct Patch*)patch); // Update "loop" button.

  success = true;

 exit:
  if(success==false)
    free(data);

  return success;
}
Example #5
0
bool FLUIDSYNTH_set_new_preset(SoundPlugin *plugin, const wchar_t *sf2_file, int bank_num, int preset_num){
  Data *data = plugin->data;

  if(!STRING_equals2(sf2_file, data->filename)){

    Data *new_data = create_data(sf2_file, data->samplerate);
    if(new_data==NULL)
      return false;

    if(SP_is_plugin_running(plugin)){

      PLAYER_lock();{  // Hmm. lock for setting a variable type that is atomic on all target platforms?
        data->new_data = new_data;
      }PLAYER_unlock();
      
      RSEMAPHORE_wait(data->signal_from_RT,1);

    } else{

      plugin->data = new_data;

    }

    delete_data(data);
    data = new_data;
  }

  data->bank_num = bank_num;
  data->preset_num = preset_num;

  fluid_synth_bank_select(data->synth,0,bank_num);
  fluid_synth_program_change(data->synth,0,preset_num);

  if(plugin->patch != NULL)
    GFX_update_instrument_widget(plugin->patch);

  return true;
}
Example #6
0
static void *Undo_Do_Sample(
	struct Tracker_Windows *window,
	struct WBlocks *wblock,
	struct WTracks *wtrack,
	int realline,
	void *pointer
){

  struct Undo_Sample *undo_ae=pointer;
  SoundPlugin *plugin = undo_ae->patch->patchdata;

  hash_t *new_state = HASH_create(3);
  plugin->type->create_state(plugin, new_state);

  //printf("Calling Undo_do for %d. Current value: %f. Now setting it back to %f\n",undo_ae->effect_num,new_value,undo_ae->value);

  plugin->type->recreate_from_state(plugin, undo_ae->state);

  GFX_update_instrument_widget(undo_ae->patch);

  undo_ae->state = new_state;

  return undo_ae;
}
Example #7
0
void GFX_update_current_instrument_widget(void){
  GFX_update_instrument_widget(g_currpatch);
}