tap_rotspeak - cleanup

This commit is contained in:
8tab
2014-01-25 23:39:03 +01:00
parent 3dad5f2940
commit eb8fb3134a
3 changed files with 46 additions and 248 deletions

174
.gitignore vendored
View File

@@ -2,177 +2,3 @@
.*.sw?
*~
/CMakeLists.txt.user
.vimrc
*.so
*.a
*.cxx
*.cmake
*Makefile
*CMakeFiles
*CMakeCache.txt
# autogenerated files
bin2res
embedded_resources.h
install_manifest.txt
lmms
lmms.1.gz
lmms.rc
lmmsconfig.h
lmmsversion.h
plugins/audio_file_processor/embedded_resources.h
plugins/bass_booster/embedded_resources.h
plugins/bit_invader/embedded_resources.h
plugins/kicker/embedded_resources.h
plugins/ladspa_browser/embedded_resources.h
plugins/ladspa_effect/embedded_resources.h
plugins/lb302/embedded_resources.h
plugins/opl2/embedded_resources.h
plugins/organic/embedded_resources.h
plugins/papu/embedded_resources.h
plugins/patman/embedded_resources.h
plugins/peak_controller_effect/embedded_resources.h
plugins/sf2_player/embedded_resources.h
plugins/sf2_player/ui_patches_dialog.h
plugins/sid/embedded_resources.h
plugins/spectrum_analyzer/embedded_resources.h
plugins/stereo_enhancer/embedded_resources.h
plugins/stereo_matrix/embedded_resources.h
plugins/stk/mallets/embedded_resources.h
plugins/triple_oscillator/embedded_resources.h
plugins/vestige/embedded_resources.h
plugins/vibed/embedded_resources.h
plugins/vst_base/RemoteVstPlugin
plugins/vst_effect/embedded_resources.h
plugins/zynaddsubfx/RemoteZynAddSubFx
plugins/zynaddsubfx/embedded_resources.h
plugins/zynaddsubfx/fltk/FL/Enumerations.h
plugins/zynaddsubfx/fltk/FL/Fl.h
plugins/zynaddsubfx/fltk/FL/Fl_Adjuster.h
plugins/zynaddsubfx/fltk/FL/Fl_Bitmap.h
plugins/zynaddsubfx/fltk/FL/Fl_Box.h
plugins/zynaddsubfx/fltk/FL/Fl_Browser.h
plugins/zynaddsubfx/fltk/FL/Fl_Browser_.h
plugins/zynaddsubfx/fltk/FL/Fl_Button.h
plugins/zynaddsubfx/fltk/FL/Fl_Chart.h
plugins/zynaddsubfx/fltk/FL/Fl_Check_Browser.h
plugins/zynaddsubfx/fltk/FL/Fl_Check_Button.h
plugins/zynaddsubfx/fltk/FL/Fl_Choice.h
plugins/zynaddsubfx/fltk/FL/Fl_Clock.h
plugins/zynaddsubfx/fltk/FL/Fl_Color_Chooser.h
plugins/zynaddsubfx/fltk/FL/Fl_Counter.h
plugins/zynaddsubfx/fltk/FL/Fl_Device.h
plugins/zynaddsubfx/fltk/FL/Fl_Dial.h
plugins/zynaddsubfx/fltk/FL/Fl_Double_Window.h
plugins/zynaddsubfx/fltk/FL/Fl_Export.h
plugins/zynaddsubfx/fltk/FL/Fl_File_Browser.h
plugins/zynaddsubfx/fltk/FL/Fl_File_Chooser.h
plugins/zynaddsubfx/fltk/FL/Fl_File_Icon.h
plugins/zynaddsubfx/fltk/FL/Fl_File_Input.h
plugins/zynaddsubfx/fltk/FL/Fl_Fill_Dial.h
plugins/zynaddsubfx/fltk/FL/Fl_Fill_Slider.h
plugins/zynaddsubfx/fltk/FL/Fl_Float_Input.h
plugins/zynaddsubfx/fltk/FL/Fl_FormsBitmap.h
plugins/zynaddsubfx/fltk/FL/Fl_FormsPixmap.h
plugins/zynaddsubfx/fltk/FL/Fl_Free.h
plugins/zynaddsubfx/fltk/FL/Fl_Group.h
plugins/zynaddsubfx/fltk/FL/Fl_Help_Dialog.h
plugins/zynaddsubfx/fltk/FL/Fl_Help_View.h
plugins/zynaddsubfx/fltk/FL/Fl_Hold_Browser.h
plugins/zynaddsubfx/fltk/FL/Fl_Hor_Fill_Slider.h
plugins/zynaddsubfx/fltk/FL/Fl_Hor_Nice_Slider.h
plugins/zynaddsubfx/fltk/FL/Fl_Hor_Slider.h
plugins/zynaddsubfx/fltk/FL/Fl_Hor_Value_Slider.h
plugins/zynaddsubfx/fltk/FL/Fl_Image.h
plugins/zynaddsubfx/fltk/FL/Fl_Input.h
plugins/zynaddsubfx/fltk/FL/Fl_Input_.h
plugins/zynaddsubfx/fltk/FL/Fl_Input_Choice.h
plugins/zynaddsubfx/fltk/FL/Fl_Int_Input.h
plugins/zynaddsubfx/fltk/FL/Fl_Light_Button.h
plugins/zynaddsubfx/fltk/FL/Fl_Line_Dial.h
plugins/zynaddsubfx/fltk/FL/Fl_Menu.h
plugins/zynaddsubfx/fltk/FL/Fl_Menu_.h
plugins/zynaddsubfx/fltk/FL/Fl_Menu_Bar.h
plugins/zynaddsubfx/fltk/FL/Fl_Menu_Button.h
plugins/zynaddsubfx/fltk/FL/Fl_Menu_Item.h
plugins/zynaddsubfx/fltk/FL/Fl_Menu_Window.h
plugins/zynaddsubfx/fltk/FL/Fl_Multi_Browser.h
plugins/zynaddsubfx/fltk/FL/Fl_Multi_Label.h
plugins/zynaddsubfx/fltk/FL/Fl_Multiline_Input.h
plugins/zynaddsubfx/fltk/FL/Fl_Multiline_Output.h
plugins/zynaddsubfx/fltk/FL/Fl_Native_File_Chooser.h
plugins/zynaddsubfx/fltk/FL/Fl_Nice_Slider.h
plugins/zynaddsubfx/fltk/FL/Fl_Object.h
plugins/zynaddsubfx/fltk/FL/Fl_Output.h
plugins/zynaddsubfx/fltk/FL/Fl_Overlay_Window.h
plugins/zynaddsubfx/fltk/FL/Fl_Pack.h
plugins/zynaddsubfx/fltk/FL/Fl_Paged_Device.h
plugins/zynaddsubfx/fltk/FL/Fl_Pixmap.h
plugins/zynaddsubfx/fltk/FL/Fl_Plugin.h
plugins/zynaddsubfx/fltk/FL/Fl_Positioner.h
plugins/zynaddsubfx/fltk/FL/Fl_PostScript.h
plugins/zynaddsubfx/fltk/FL/Fl_Preferences.h
plugins/zynaddsubfx/fltk/FL/Fl_Printer.h
plugins/zynaddsubfx/fltk/FL/Fl_Progress.h
plugins/zynaddsubfx/fltk/FL/Fl_RGB_Image.h
plugins/zynaddsubfx/fltk/FL/Fl_Radio_Button.h
plugins/zynaddsubfx/fltk/FL/Fl_Radio_Light_Button.h
plugins/zynaddsubfx/fltk/FL/Fl_Radio_Round_Button.h
plugins/zynaddsubfx/fltk/FL/Fl_Repeat_Button.h
plugins/zynaddsubfx/fltk/FL/Fl_Return_Button.h
plugins/zynaddsubfx/fltk/FL/Fl_Roller.h
plugins/zynaddsubfx/fltk/FL/Fl_Round_Button.h
plugins/zynaddsubfx/fltk/FL/Fl_Round_Clock.h
plugins/zynaddsubfx/fltk/FL/Fl_Scroll.h
plugins/zynaddsubfx/fltk/FL/Fl_Scrollbar.h
plugins/zynaddsubfx/fltk/FL/Fl_Secret_Input.h
plugins/zynaddsubfx/fltk/FL/Fl_Select_Browser.h
plugins/zynaddsubfx/fltk/FL/Fl_Shared_Image.h
plugins/zynaddsubfx/fltk/FL/Fl_Simple_Counter.h
plugins/zynaddsubfx/fltk/FL/Fl_Single_Window.h
plugins/zynaddsubfx/fltk/FL/Fl_Slider.h
plugins/zynaddsubfx/fltk/FL/Fl_Spinner.h
plugins/zynaddsubfx/fltk/FL/Fl_Sys_Menu_Bar.h
plugins/zynaddsubfx/fltk/FL/Fl_Table.h
plugins/zynaddsubfx/fltk/FL/Fl_Table_Row.h
plugins/zynaddsubfx/fltk/FL/Fl_Tabs.h
plugins/zynaddsubfx/fltk/FL/Fl_Text_Buffer.h
plugins/zynaddsubfx/fltk/FL/Fl_Text_Display.h
plugins/zynaddsubfx/fltk/FL/Fl_Text_Editor.h
plugins/zynaddsubfx/fltk/FL/Fl_Tile.h
plugins/zynaddsubfx/fltk/FL/Fl_Tiled_Image.h
plugins/zynaddsubfx/fltk/FL/Fl_Timer.h
plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Button.h
plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Light_Button.h
plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Round_Button.h
plugins/zynaddsubfx/fltk/FL/Fl_Tooltip.h
plugins/zynaddsubfx/fltk/FL/Fl_Tree.h
plugins/zynaddsubfx/fltk/FL/Fl_Tree_Item.h
plugins/zynaddsubfx/fltk/FL/Fl_Tree_Item_Array.h
plugins/zynaddsubfx/fltk/FL/Fl_Tree_Prefs.h
plugins/zynaddsubfx/fltk/FL/Fl_Valuator.h
plugins/zynaddsubfx/fltk/FL/Fl_Value_Input.h
plugins/zynaddsubfx/fltk/FL/Fl_Value_Output.h
plugins/zynaddsubfx/fltk/FL/Fl_Value_Slider.h
plugins/zynaddsubfx/fltk/FL/Fl_Widget.h
plugins/zynaddsubfx/fltk/FL/Fl_Window.h
plugins/zynaddsubfx/fltk/FL/Fl_Wizard.h
plugins/zynaddsubfx/fltk/FL/Fl_XBM_Image.h
plugins/zynaddsubfx/fltk/FL/Fl_XPM_Image.h
plugins/zynaddsubfx/fltk/FL/filename.h
plugins/zynaddsubfx/fltk/FL/fl_ask.h
plugins/zynaddsubfx/fltk/FL/fl_draw.h
plugins/zynaddsubfx/fltk/FL/fl_message.h
plugins/zynaddsubfx/fltk/FL/fl_show_colormap.h
plugins/zynaddsubfx/fltk/FL/fl_show_input.h
plugins/zynaddsubfx/fltk/FL/mac.h
plugins/zynaddsubfx/fltk/FL/win32.h
plugins/zynaddsubfx/fltk/FL/x.h
plugins/zynaddsubfx/fltk/Fl
plugins/zynaddsubfx/fltk/config.h
plugins/zynaddsubfx/fltk/fltk-config
plugins/zynaddsubfx/zynaddsubfx.rc
ui_EffectSelectDialog.h
ui_about_dialog.h
ui_export_project.h

View File

@@ -332,7 +332,7 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/lmms.rc.in ${CMAKE_BINARY_DIR}/lmms.rc)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/plugins/zynaddsubfx/zynaddsubfx.rc.in ${CMAKE_BINARY_DIR}/plugins/zynaddsubfx/zynaddsubfx.rc)
# set compiler flags
SET(WERROR_FLAGS "-Wall -Werror -Werror=unused-function -Wno-strict-overflow")
SET(WERROR_FLAGS "-Wall -Werror -Werror=unused-function -Wno-sign-compare -Wno-strict-overflow")
SET(CMAKE_C_FLAGS "-O2 -g ${WERROR_FLAGS} ${CMAKE_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "-O2 -g -fno-exceptions ${WERROR_FLAGS} ${CMAKE_CXX_FLAGS}")
set(CMAKE_C_FLAGS_DEBUG "-DLMMS_DEBUG")

View File

@@ -116,6 +116,7 @@ typedef struct {
} RotSpkr;
void cleanup_RotSpkr(LADSPA_Handle Instance);
/* Construct a new plugin instance. */
LADSPA_Handle
@@ -124,7 +125,7 @@ instantiate_RotSpkr(const LADSPA_Descriptor * Descriptor,
LADSPA_Handle * ptr;
if ((ptr = malloc(sizeof(RotSpkr))) != NULL) {
if ((ptr = calloc(1, sizeof(RotSpkr))) != NULL) {
RotSpkr* rotSpeak = (RotSpkr*)ptr;
rotSpeak->sample_rate = sample_rate;
rotSpeak->run_adding_gain = 1.0;
@@ -132,14 +133,13 @@ instantiate_RotSpkr(const LADSPA_Descriptor * Descriptor,
if ((rotSpeak->ringbuffer_h_L =
calloc(2 * PM_DEPTH, sizeof(LADSPA_Data))) == NULL)
{
free(ptr);
cleanup_RotSpkr((LADSPA_Handle)rotSpeak);
return NULL;
}
if ((((RotSpkr *)ptr)->ringbuffer_h_R =
if ((rotSpeak->ringbuffer_h_R =
calloc(2 * PM_DEPTH, sizeof(LADSPA_Data))) == NULL)
{
free(rotSpeak->ringbuffer_h_L);
free(ptr);
cleanup_RotSpkr((LADSPA_Handle)rotSpeak);
return NULL;
}
rotSpeak->buflen_h_L = ceil(0.3f * sample_rate / M_PI);
@@ -150,18 +150,13 @@ instantiate_RotSpkr(const LADSPA_Descriptor * Descriptor,
if ((rotSpeak->ringbuffer_b_L =
calloc(2 * PM_DEPTH, sizeof(LADSPA_Data))) == NULL)
{
free(rotSpeak->ringbuffer_h_L);
free(rotSpeak->ringbuffer_h_R);
free(ptr);
cleanup_RotSpkr((LADSPA_Handle)rotSpeak);
return NULL;
}
if ((rotSpeak->ringbuffer_b_R =
calloc(2 * PM_DEPTH, sizeof(LADSPA_Data))) == NULL)
{
free(rotSpeak->ringbuffer_h_L);
free(rotSpeak->ringbuffer_h_R);
free(rotSpeak->ringbuffer_b_L);
free(ptr);
cleanup_RotSpkr((LADSPA_Handle)rotSpeak);
return NULL;
}
rotSpeak->buflen_b_L = ceil(0.3f * sample_rate / M_PI);
@@ -171,74 +166,35 @@ instantiate_RotSpkr(const LADSPA_Descriptor * Descriptor,
if ((rotSpeak->eq_filter_L = calloc(1, sizeof(biquad))) == NULL)
{
free(rotSpeak->ringbuffer_h_L);
free(rotSpeak->ringbuffer_h_R);
free(rotSpeak->ringbuffer_b_L);
free(rotSpeak->ringbuffer_b_R);
free(ptr);
cleanup_RotSpkr((LADSPA_Handle)rotSpeak);
return NULL;
}
if ((rotSpeak->lp_filter_L = calloc(1, sizeof(biquad))) == NULL)
{
free(rotSpeak->ringbuffer_h_L);
free(rotSpeak->ringbuffer_h_R);
free(rotSpeak->ringbuffer_b_L);
free(rotSpeak->ringbuffer_b_R);
free(rotSpeak->eq_filter_L);
free(ptr);
cleanup_RotSpkr((LADSPA_Handle)rotSpeak);
return NULL;
}
if ((rotSpeak->hp_filter_L = calloc(1, sizeof(biquad))) == NULL)
{
free(rotSpeak->ringbuffer_h_L);
free(rotSpeak->ringbuffer_h_R);
free(rotSpeak->ringbuffer_b_L);
free(rotSpeak->ringbuffer_b_R);
free(rotSpeak->eq_filter_L);
free(rotSpeak->lp_filter_L);
free(ptr);
cleanup_RotSpkr((LADSPA_Handle)rotSpeak);
return NULL;
}
if ((rotSpeak->eq_filter_R = calloc(1, sizeof(biquad))) == NULL)
{
free(rotSpeak->ringbuffer_h_L);
free(rotSpeak->ringbuffer_h_R);
free(rotSpeak->ringbuffer_b_L);
free(rotSpeak->ringbuffer_b_R);
free(rotSpeak->eq_filter_L);
free(rotSpeak->lp_filter_L);
free(rotSpeak->hp_filter_L);
free(ptr);
cleanup_RotSpkr((LADSPA_Handle)rotSpeak);
return NULL;
}
if ((rotSpeak->lp_filter_R = calloc(1, sizeof(biquad))) == NULL)
{
free(rotSpeak->ringbuffer_h_L);
free(rotSpeak->ringbuffer_h_R);
free(rotSpeak->ringbuffer_b_L);
free(rotSpeak->ringbuffer_b_R);
free(rotSpeak->eq_filter_L);
free(rotSpeak->lp_filter_L);
free(rotSpeak->hp_filter_L);
free(rotSpeak->eq_filter_R);
free(ptr);
cleanup_RotSpkr((LADSPA_Handle)rotSpeak);
return NULL;
}
if ((rotSpeak->hp_filter_R = calloc(1, sizeof(biquad))) == NULL)
{
free(rotSpeak->ringbuffer_h_L);
free(rotSpeak->ringbuffer_h_R);
free(rotSpeak->ringbuffer_b_L);
free(rotSpeak->ringbuffer_b_R);
free(rotSpeak->eq_filter_L);
free(rotSpeak->lp_filter_L);
free(rotSpeak->hp_filter_L);
free(rotSpeak->eq_filter_R);
free(rotSpeak->lp_filter_R);
free(ptr);
cleanup_RotSpkr((LADSPA_Handle)rotSpeak);
return NULL;
}
}
return ptr;
}
@@ -246,6 +202,7 @@ instantiate_RotSpkr(const LADSPA_Descriptor * Descriptor,
return NULL;
}
void
activate_RotSpkr(LADSPA_Handle Instance) {
@@ -627,23 +584,38 @@ run_adding_RotSpkr(LADSPA_Handle Instance,
/* Throw away an RotSpkr effect instance. */
void
/*
Throw away an RotSpkr effect instance.
This function should be called only when RotSpkr was allocated with calloc.
*/
void
cleanup_RotSpkr(LADSPA_Handle Instance) {
RotSpkr * ptr = (RotSpkr *)Instance;
free(ptr->ringbuffer_h_L);
free(ptr->ringbuffer_h_R);
free(ptr->ringbuffer_b_L);
free(ptr->ringbuffer_b_R);
free(ptr->eq_filter_L);
free(ptr->eq_filter_R);
free(ptr->lp_filter_L);
free(ptr->lp_filter_R);
free(ptr->hp_filter_L);
free(ptr->hp_filter_R);
free(Instance);
RotSpkr * ptr = (RotSpkr *)Instance;
if (!ptr)
return;
if (ptr->ringbuffer_h_L)
free(ptr->ringbuffer_h_L);
if (ptr->ringbuffer_h_R)
free(ptr->ringbuffer_h_R);
if (ptr->ringbuffer_b_L)
free(ptr->ringbuffer_b_L);
if (ptr->ringbuffer_b_R)
free(ptr->ringbuffer_b_R);
if (ptr->eq_filter_L)
free(ptr->eq_filter_L);
if (ptr->eq_filter_R)
free(ptr->eq_filter_R);
if (ptr->lp_filter_L)
free(ptr->lp_filter_L);
if (ptr->lp_filter_R)
free(ptr->lp_filter_R);
if (ptr->hp_filter_L)
free(ptr->hp_filter_L);
if (ptr->hp_filter_R)
free(ptr->hp_filter_R);
if (Instance)
free(Instance);
}