1 /*
2  * Copyright (C) 2019 Alexandros Theodotou <alex at zrythm dot org>
3  *
4  * This file is part of Zrythm
5  *
6  * Zrythm is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Affero General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Zrythm is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU Affero General Public License for more details.
15  *
16  * You should have received a copy of the GNU Affero General Public License
17  * along with Zrythm.  If not, see <https://www.gnu.org/licenses/>.
18  */
19 
20 #include "plugins/lv2_plugin.h"
21 #include "plugins/lv2/lv2_urid.h"
22 #include "plugins/plugin_manager.h"
23 #include "zix/sem.h"
24 #include "zrythm.h"
25 #include "zrythm_app.h"
26 
27 LV2_URID
lv2_urid_map_uri(LV2_URID_Map_Handle handle,const char * uri)28 lv2_urid_map_uri (
29   LV2_URID_Map_Handle handle,
30   const char*         uri)
31 {
32   zix_sem_wait (&PM_SYMAP_LOCK);
33   const LV2_URID id = symap_map (PM_SYMAP, uri);
34   zix_sem_post (&PM_SYMAP_LOCK);
35   return id;
36 }
37 
38 const char *
lv2_urid_unmap_uri(LV2_URID_Unmap_Handle handle,LV2_URID urid)39 lv2_urid_unmap_uri (
40   LV2_URID_Unmap_Handle handle,
41   LV2_URID              urid)
42 {
43   zix_sem_wait (&PM_SYMAP_LOCK);
44   const char* uri = symap_unmap (PM_SYMAP, urid);
45   zix_sem_post (&PM_SYMAP_LOCK);
46   return uri;
47 }
48 
49