| @@ -404,11 +404,7 @@ public: | |||||
| delete (LV2_Programs_Host*)features[lv2_feature_id_programs]->data; | delete (LV2_Programs_Host*)features[lv2_feature_id_programs]->data; | ||||
| if (features[lv2_feature_id_rtmempool] && features[lv2_feature_id_rtmempool]->data) | if (features[lv2_feature_id_rtmempool] && features[lv2_feature_id_rtmempool]->data) | ||||
| { | |||||
| const LV2_RtMemPool_Pool* const rtmempool = (const LV2_RtMemPool_Pool*)features[lv2_feature_id_rtmempool]->data; | |||||
| rtmempool_allocator_free(rtmempool); | |||||
| delete rtmempool; | |||||
| } | |||||
| delete (LV2_RtMemPool_Pool*)features[lv2_feature_id_rtmempool]->data; | |||||
| if (features[lv2_feature_id_state_make_path] && features[lv2_feature_id_state_make_path]->data) | if (features[lv2_feature_id_state_make_path] && features[lv2_feature_id_state_make_path]->data) | ||||
| delete (LV2_State_Make_Path*)features[lv2_feature_id_state_make_path]->data; | delete (LV2_State_Make_Path*)features[lv2_feature_id_state_make_path]->data; | ||||
| @@ -59,12 +59,13 @@ struct rtsafe_memory_pool | |||||
| static | static | ||||
| void | void | ||||
| rtsafe_memory_pool_sleepy(); | |||||
| rtsafe_memory_pool_sleepy( | |||||
| LV2_RtMemPool_Handle pool_handle); | |||||
| static | static | ||||
| bool | bool | ||||
| rtsafe_memory_pool_create( | rtsafe_memory_pool_create( | ||||
| LV2_RtMemPool_Handle pool_handle, | |||||
| LV2_RtMemPool_Handle * pool_handle_ptr, | |||||
| const char * pool_name, | const char * pool_name, | ||||
| size_t data_size, | size_t data_size, | ||||
| size_t min_preallocated, | size_t min_preallocated, | ||||
| @@ -86,7 +87,7 @@ rtsafe_memory_pool_create( | |||||
| (unsigned int)max_preallocated, | (unsigned int)max_preallocated, | ||||
| enforce_thread_safety ? "true" : "false"); | enforce_thread_safety ? "true" : "false"); | ||||
| pool_ptr = (struct rtsafe_memory_pool *)pool_handle; | |||||
| pool_ptr = malloc(sizeof(struct rtsafe_memory_pool)); | |||||
| if (pool_ptr == NULL) | if (pool_ptr == NULL) | ||||
| { | { | ||||
| return false; | return false; | ||||
| @@ -127,7 +128,8 @@ rtsafe_memory_pool_create( | |||||
| pool_ptr->used_size = 0; | pool_ptr->used_size = 0; | ||||
| rtsafe_memory_pool_sleepy(); | |||||
| rtsafe_memory_pool_sleepy((LV2_RtMemPool_Handle)pool_ptr); | |||||
| *pool_handle_ptr = (LV2_RtMemPool_Handle)pool_ptr; | |||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -186,6 +188,8 @@ rtsafe_memory_pool_destroy( | |||||
| assert(ret == 0); | assert(ret == 0); | ||||
| } | } | ||||
| free(pool_ptr); | |||||
| // unused variable | // unused variable | ||||
| (void)ret; | (void)ret; | ||||
| } | } | ||||
| @@ -373,31 +377,22 @@ rtsafe_memory_pool_allocate_sleepy( | |||||
| static | static | ||||
| bool | bool | ||||
| rtsafe_memory_pool_create2( | rtsafe_memory_pool_create2( | ||||
| LV2_RtMemPool_Handle pool_handle, | |||||
| LV2_RtMemPool_Handle * pool_handle_ptr, | |||||
| const char * pool_name, | const char * pool_name, | ||||
| size_t data_size, | size_t data_size, | ||||
| size_t min_preallocated, | size_t min_preallocated, | ||||
| size_t max_preallocated) | size_t max_preallocated) | ||||
| { | { | ||||
| return rtsafe_memory_pool_create(pool_handle, pool_name, data_size, min_preallocated, max_preallocated, false); | |||||
| return rtsafe_memory_pool_create(pool_handle_ptr, pool_name, data_size, min_preallocated, max_preallocated, false); | |||||
| } | } | ||||
| void | void | ||||
| rtmempool_allocator_init( | rtmempool_allocator_init( | ||||
| struct _LV2_RtMemPool_Pool * allocator_ptr) | struct _LV2_RtMemPool_Pool * allocator_ptr) | ||||
| { | { | ||||
| allocator_ptr->handle = (LV2_RtMemPool_Handle)malloc(sizeof(struct rtsafe_memory_pool)); | |||||
| allocator_ptr->create = rtsafe_memory_pool_create2; | allocator_ptr->create = rtsafe_memory_pool_create2; | ||||
| allocator_ptr->destroy = rtsafe_memory_pool_destroy; | allocator_ptr->destroy = rtsafe_memory_pool_destroy; | ||||
| allocator_ptr->allocate_atomic = rtsafe_memory_pool_allocate_atomic; | allocator_ptr->allocate_atomic = rtsafe_memory_pool_allocate_atomic; | ||||
| allocator_ptr->allocate_sleepy = rtsafe_memory_pool_allocate_sleepy; | allocator_ptr->allocate_sleepy = rtsafe_memory_pool_allocate_sleepy; | ||||
| allocator_ptr->deallocate = rtsafe_memory_pool_deallocate; | allocator_ptr->deallocate = rtsafe_memory_pool_deallocate; | ||||
| } | } | ||||
| void | |||||
| rtmempool_allocator_free( | |||||
| const struct _LV2_RtMemPool_Pool * allocator_ptr) | |||||
| { | |||||
| if (allocator_ptr->handle) | |||||
| free((struct rtsafe_memory_pool *)allocator_ptr->handle); | |||||
| } | |||||
| @@ -32,10 +32,6 @@ void | |||||
| rtmempool_allocator_init( | rtmempool_allocator_init( | ||||
| struct _LV2_RtMemPool_Pool * allocator_ptr); | struct _LV2_RtMemPool_Pool * allocator_ptr); | ||||
| void | |||||
| rtmempool_allocator_free( | |||||
| const struct _LV2_RtMemPool_Pool * allocator_ptr); | |||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| } /* extern "C" */ | } /* extern "C" */ | ||||
| #endif | #endif | ||||
| @@ -43,14 +43,6 @@ typedef void* LV2_RtMemPool_Handle; | |||||
| * LV2_Feature::data must be pointer to LV2_RtMemPool_Pool. | * LV2_Feature::data must be pointer to LV2_RtMemPool_Pool. | ||||
| */ | */ | ||||
| typedef struct _LV2_RtMemPool_Pool { | typedef struct _LV2_RtMemPool_Pool { | ||||
| /** | |||||
| * Opaque pointer to host data. | |||||
| * | |||||
| * This MUST be passed to methods in this struct whenever they are called. | |||||
| * Otherwise, it must not be interpreted in any way. | |||||
| */ | |||||
| LV2_RtMemPool_Handle handle; | |||||
| /** | /** | ||||
| * This function is called when plugin wants to create memory pool | * This function is called when plugin wants to create memory pool | ||||
| * | * | ||||
| @@ -61,9 +53,9 @@ typedef struct _LV2_RtMemPool_Pool { | |||||
| * @param min_preallocated min chunks preallocated | * @param min_preallocated min chunks preallocated | ||||
| * @param max_preallocated max chunks preallocated | * @param max_preallocated max chunks preallocated | ||||
| * | * | ||||
| * @return Success status | |||||
| * @return Success status, true if successful | |||||
| */ | */ | ||||
| bool (*create)(LV2_RtMemPool_Handle handle, | |||||
| bool (*create)(LV2_RtMemPool_Handle * handle_ptr, | |||||
| const char * pool_name, | const char * pool_name, | ||||
| size_t data_size, | size_t data_size, | ||||
| size_t min_preallocated, | size_t min_preallocated, | ||||
| @@ -608,7 +608,7 @@ class JackSettingsW(QDialog, ui_settings_jack.Ui_JackSettingsW): | |||||
| device_index = device_info[0].replace("device ", "") | device_index = device_info[0].replace("device ", "") | ||||
| device_name = device_info[1].split(" [")[0] | device_name = device_info[1].split(" [")[0] | ||||
| if (card_name != "Loopback"): | |||||
| if card_name != "Loopback": | |||||
| full_name = "hw:%s,%s [%s]" % (card_name, device_index, device_name) | full_name = "hw:%s,%s [%s]" % (card_name, device_index, device_name) | ||||
| alsa_dev_list.append(full_name) | alsa_dev_list.append(full_name) | ||||