Compare commits

...

8 Commits
v0.1 ... master

Author SHA1 Message Date
2debad5744 - Add Master output audio ports
- Update .gitignore
2022-03-07 00:14:48 +01:00
f405ce33ad - add input midi channel selection 2022-03-06 18:54:56 +01:00
c067a43b27 Merge bsdf changes:
- fix segfault
- move options to top of gui
- make sample_table scrollable
2022-01-10 14:37:34 +01:00
17383c6a99 - Fix drumkit name parsing from drumkit.xml by adding <componentList> support
- Fix compile warning on compar_kit()
2021-11-09 11:00:02 +01:00
3d8e11423b Sort Drumkits in dropdown menu 2020-07-01 01:25:04 +02:00
3c08afc403 Implement multiple Output Port (32)
Remove drmr2.ttl
Add drmr2-mkttl to dynamicly generate drmr2.ttl
2020-06-08 13:11:01 +02:00
647b6f9ed9 Impact DrMr2 renaming in the code 2020-06-05 00:17:44 +02:00
26e9ac51f3 Rename drmr to drmr2! 2020-06-04 23:42:58 +02:00
13 changed files with 710 additions and 1089 deletions

10
.gitignore vendored
View File

@ -1,7 +1,9 @@
drmr.so *~
drmr_ui.xml drmr2.so
drmr_ui.so drmr2_ui.xml
drmr.lv2 drmr2_ui.so
drmr2.lv2
drmr2.ttl
build build
/logo.xcf /logo.xcf
/htest /htest

View File

@ -1,7 +1,7 @@
#CMake file for DrMr #CMake file for DrMr
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.6)
project (DrMr) project (DrMr2)
set(LV2_INSTALL_DIR lib/lv2 CACHE PATH "Specifies where the LV2 libraries should be installed") set(LV2_INSTALL_DIR lib/lv2 CACHE PATH "Specifies where the LV2 libraries should be installed")
set(CMAKE_C_FLAGS "-Wall") set(CMAKE_C_FLAGS "-Wall")
@ -23,35 +23,35 @@ link_directories (${LV2_LIBRARY_DIRS} ${EXPAT_LIBRARY_DIRS} ${SNDFILE_LIBRARY_DI
# config libraries # config libraries
add_library(drmr SHARED add_library(drmr2 SHARED
drmr.c drmr2.c
drmr_hydrogen.c drmr2_hydrogen.c
drmr.h drmr2.h
drmr_hydrogen.h drmr2_hydrogen.h
) )
add_library(drmr_ui SHARED add_library(drmr2_ui SHARED
drmr_ui.c drmr2_ui.c
drmr_hydrogen.c drmr2_hydrogen.c
nknob.c nknob.c
drmr_hydrogen.h drmr2_hydrogen.h
nknob.h nknob.h
) )
set_target_properties(drmr PROPERTIES PREFIX "") set_target_properties(drmr2 PROPERTIES PREFIX "")
set_target_properties(drmr_ui PROPERTIES PREFIX "") set_target_properties(drmr2_ui PROPERTIES PREFIX "")
set_target_properties(drmr_ui set_target_properties(drmr2_ui
PROPERTIES PROPERTIES
LINK_FLAGS "-Wl,-znodelete" LINK_FLAGS "-Wl,-znodelete"
) )
target_link_libraries(drmr ${LV2_LIBRARIES} ${SNDFILE_LIBRARIES} ${SAMPLERATE_LIBRARIES} ${EXPAT_LIBRARIES} m) target_link_libraries(drmr2 ${LV2_LIBRARIES} ${SNDFILE_LIBRARIES} ${SAMPLERATE_LIBRARIES} ${EXPAT_LIBRARIES} m)
target_link_libraries(drmr_ui ${LV2_LIBRARIES} ${GTK2_LIBRARIES} ${SNDFILE_LIBRARIES} ${SAMPLERATE_LIBRARIES} ${EXPAT_LIBRARIES} m) target_link_libraries(drmr2_ui ${LV2_LIBRARIES} ${GTK2_LIBRARIES} ${SNDFILE_LIBRARIES} ${SAMPLERATE_LIBRARIES} ${EXPAT_LIBRARIES} m)
add_definitions ( -DPIC ) add_definitions ( -DPIC )
set_target_properties (drmr set_target_properties (drmr2
PROPERTIES PROPERTIES
COMPILE_FLAGS "-std=gnu99" COMPILE_FLAGS "-std=gnu99"
) )
@ -63,21 +63,24 @@ if (NOT USE_NKNOB)
endif (NOT USE_NKNOB) endif (NOT USE_NKNOB)
if (SAMP_ZERO_POS GREATER "-1" AND SAMP_ZERO_POS LESS "4") if (SAMP_ZERO_POS GREATER "-1" AND SAMP_ZERO_POS LESS "4")
set (ui_compile_flags "${ui_compile_flags} -DDRMR_UI_ZERO_SAMP=${SAMP_ZERO_POS}") set (ui_compile_flags "${ui_compile_flags} -DDRMR2_UI_ZERO_SAMP=${SAMP_ZERO_POS}")
else (SAMP_ZERO_POS GREATER "-1" AND SAMP_ZERO_POS LESS "4") else (SAMP_ZERO_POS GREATER "-1" AND SAMP_ZERO_POS LESS "4")
message(WARNING "Invalid SAMP_ZERO_POS, defaulting to 0 \(top left\). Valid values are 0,1,2,3") message(WARNING "Invalid SAMP_ZERO_POS, defaulting to 0 \(top left\). Valid values are 0,1,2,3")
set (ui_compile_flags "${ui_compile_flags} -DDRMR_UI_ZERO_SAMP=0") set (ui_compile_flags "${ui_compile_flags} -DDRMR2_UI_ZERO_SAMP=0")
endif (SAMP_ZERO_POS GREATER "-1" AND SAMP_ZERO_POS LESS "4") endif (SAMP_ZERO_POS GREATER "-1" AND SAMP_ZERO_POS LESS "4")
set_target_properties (drmr_ui set_target_properties (drmr2_ui
PROPERTIES PROPERTIES
COMPILE_FLAGS ${ui_compile_flags} COMPILE_FLAGS ${ui_compile_flags}
) )
# drmr2.ttl generation
add_custom_command(TARGET drmr2 COMMAND ./drmr2-mkttl WORKING_DIRECTORY ..)
# Custom test commands # Custom test commands
add_executable ( htest add_executable ( htest
EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL
drmr_hydrogen.c drmr2_hydrogen.c
) )
add_executable ( knobt add_executable ( knobt
@ -98,11 +101,11 @@ set_target_properties ( knobt
) )
# config install # config install
install(TARGETS drmr drmr_ui install(TARGETS drmr2 drmr2_ui
LIBRARY LIBRARY
DESTINATION ${CMAKE_INSTALL_PREFIX}/${LV2_INSTALL_DIR}/drmr.lv2 DESTINATION ${CMAKE_INSTALL_PREFIX}/${LV2_INSTALL_DIR}/drmr2.lv2
) )
install (FILES manifest.ttl drmr.ttl knob.png led_on.png led_off.png install (FILES manifest.ttl drmr2.ttl knob.png led_on.png led_off.png
DESTINATION ${CMAKE_INSTALL_PREFIX}/${LV2_INSTALL_DIR}/drmr.lv2 DESTINATION ${CMAKE_INSTALL_PREFIX}/${LV2_INSTALL_DIR}/drmr2.lv2
) )

View File

@ -1,3 +1,13 @@
DrMr2
====
DrMr2 is a fork from DrMr, with additional patches comming from falkTX & PeterN.
The first aim is to let DrMR2 to be more flexible.
The first evolution implemented is the multiple output audio port (defaulted to 32).
DrMr DrMr
==== ====

897
drmr.ttl
View File

@ -1,897 +0,0 @@
@prefix lv2: <http://lv2plug.in/ns/lv2core#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix doap: <http://usefulinc.com/ns/doap#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix ui: <http://lv2plug.in/ns/extensions/ui#>.
@prefix atom: <http://lv2plug.in/ns/ext/atom#> .
@prefix urid: <http://lv2plug.in/ns/ext/urid#> .
<http://github.com/nicklan/drmr>
a lv2:InstrumentPlugin, lv2:Plugin;
lv2:binary <drmr.so>;
doap:name "DrMr Sampler";
doap:maintainer [
foaf:name "Nick Lanham" ;
foaf:homepage <http://github.com/nick/drmr/wiki> ;
foaf:mbox <nick@afternight.org>
] ;
doap:license <http://usefulinc.com/doap/licenses/gpl> ;
lv2:requiredFeature urid:map ;
ui:ui <http://github.com/nicklan/drmr#ui> ;
lv2:extensionData <http://lv2plug.in/ns/ext/state#interface> ;
lv2:port [
a lv2:InputPort , atom:AtomPort;
atom:bufferType atom:Sequence ;
atom:supports <http://lv2plug.in/ns/ext/midi#MidiEvent> ,
<http://lv2plug.in/ns/ext/atom#Resource> ;
lv2:index 0;
lv2:symbol "control";
lv2:name "Control";
],
[
a lv2:OutputPort , atom:AtomPort ;
atom:bufferType atom:Sequence ;
atom:supports <http://lv2plug.in/ns/ext/atom#Resource> ;
lv2:index 68 ;
lv2:symbol "core_events" ;
lv2:name "Core Events"
],
[
a lv2:AudioPort, lv2:OutputPort;
lv2:index 1;
lv2:symbol "left";
lv2:name "Left";
],
[
a lv2:AudioPort, lv2:OutputPort;
lv2:index 2;
lv2:symbol "right";
lv2:name "Right";
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 3;
lv2:symbol "base_note";
lv2:name "Midi Base Note";
lv2:minimum 21;
lv2:maximum 107;
lv2:default 36;
lv2:portProperty lv2:integer;
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 4;
lv2:symbol "gain_one";
lv2:name "Sample One Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 5;
lv2:symbol "gain_two";
lv2:name "Sample Two Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 6;
lv2:symbol "gain_three";
lv2:name "Sample Three Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 7;
lv2:symbol "gain_four";
lv2:name "Sample Four Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 8;
lv2:symbol "gain_five";
lv2:name "Sample Five Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 9;
lv2:symbol "gain_six";
lv2:name "Sample Six Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 10;
lv2:symbol "gain_seven";
lv2:name "Sample Seven Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 11;
lv2:symbol "gain_eight";
lv2:name "Sample Eight Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 12;
lv2:symbol "gain_nine";
lv2:name "Sample Nine Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 13;
lv2:symbol "gain_ten";
lv2:name "Sample Ten Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 14;
lv2:symbol "gain_eleven";
lv2:name "Sample Eleven Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 15;
lv2:symbol "gain_twelve";
lv2:name "Sample Twelve Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 16;
lv2:symbol "gain_thirteen";
lv2:name "Sample Thirteen Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 17;
lv2:symbol "gain_fourteen";
lv2:name "Sample Fourteen Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 18;
lv2:symbol "gain_fifteen";
lv2:name "Sample Fifteen Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 19;
lv2:symbol "gain_sixteen";
lv2:name "Sample Sixteen Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 20;
lv2:symbol "gain_seventeen";
lv2:name "Sample Seventeen Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 21;
lv2:symbol "gain_eighteen";
lv2:name "Sample Eighteen Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 22;
lv2:symbol "gain_nineteen";
lv2:name "Sample Nineteen Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 23;
lv2:symbol "gain_twenty";
lv2:name "Sample Twenty Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 24;
lv2:symbol "gain_twentyone";
lv2:name "Sample Twenty One Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 25;
lv2:symbol "gain_twentytwo";
lv2:name "Sample Twenty Two Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 26;
lv2:symbol "gain_twentythree";
lv2:name "Sample Twenty Three Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 27;
lv2:symbol "gain_twentyfour";
lv2:name "Sample Twenty Four Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 28;
lv2:symbol "gain_twentyfive";
lv2:name "Sample Twenty Five Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 29;
lv2:symbol "gain_twentysix";
lv2:name "Sample Twenty Six Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 30;
lv2:symbol "gain_twentyseven";
lv2:name "Sample Twenty Seven Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 31;
lv2:symbol "gain_twentyeight";
lv2:name "Sample Twenty Eight Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 32;
lv2:symbol "gain_twentynine";
lv2:name "Sample Twenty Nine Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 33;
lv2:symbol "gain_thirty";
lv2:name "Sample Thirty Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 34;
lv2:symbol "gain_thirtyone";
lv2:name "Sample Thirty One Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 35;
lv2:symbol "gain_thirtytwo";
lv2:name "Sample Thirty Two Gain";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -60.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 36;
lv2:symbol "pan_one";
lv2:name "Sample One Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 37;
lv2:symbol "pan_two";
lv2:name "Sample Two Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 38;
lv2:symbol "pan_three";
lv2:name "Sample Three Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 39;
lv2:symbol "pan_four";
lv2:name "Sample Four Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 40;
lv2:symbol "pan_five";
lv2:name "Sample Five Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 41;
lv2:symbol "pan_six";
lv2:name "Sample Six Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 42;
lv2:symbol "pan_seven";
lv2:name "Sample Seven Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 43;
lv2:symbol "pan_eight";
lv2:name "Sample Eight Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 44;
lv2:symbol "pan_nine";
lv2:name "Sample Nine Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 45;
lv2:symbol "pan_ten";
lv2:name "Sample Ten Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 46;
lv2:symbol "pan_eleven";
lv2:name "Sample Eleven Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 47;
lv2:symbol "pan_twelve";
lv2:name "Sample Twelve Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 48;
lv2:symbol "pan_thirteen";
lv2:name "Sample Thirteen Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 49;
lv2:symbol "pan_fourteen";
lv2:name "Sample Fourteen Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 50;
lv2:symbol "pan_fifteen";
lv2:name "Sample Fifteen Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 51;
lv2:symbol "pan_sixteen";
lv2:name "Sample Sixteen Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 52;
lv2:symbol "pan_seventeen";
lv2:name "Sample Seventeen Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -1.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 53;
lv2:symbol "pan_eighteen";
lv2:name "Sample Eighteen Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -1.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 54;
lv2:symbol "pan_nineteen";
lv2:name "Sample Nineteen Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -1.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 55;
lv2:symbol "pan_twenty";
lv2:name "Sample Twenty Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -1.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 56;
lv2:symbol "pan_twentyone";
lv2:name "Sample Twenty One Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -1.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 57;
lv2:symbol "pan_twentytwo";
lv2:name "Sample Twenty Two Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -1.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 58;
lv2:symbol "pan_twentythree";
lv2:name "Sample Twenty Three Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -1.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 59;
lv2:symbol "pan_twentyfour";
lv2:name "Sample Twenty Four Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -1.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 60;
lv2:symbol "pan_twentyfive";
lv2:name "Sample Twenty Five Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -1.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 61;
lv2:symbol "pan_twentysix";
lv2:name "Sample Twenty Six Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -1.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 62;
lv2:symbol "pan_twentyseven";
lv2:name "Sample Twenty Seven Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -1.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 63;
lv2:symbol "pan_twentyeight";
lv2:name "Sample Twenty Eight Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -1.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 64;
lv2:symbol "pan_twentynine";
lv2:name "Sample Twenty Nine Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -1.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 65;
lv2:symbol "pan_thirty";
lv2:name "Sample Thirty Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -1.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 66;
lv2:symbol "pan_thirtyone";
lv2:name "Sample Thirty One Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -1.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 67;
lv2:symbol "pan_thirtytwo";
lv2:name "Sample Thirty Two Pan";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;
].
<http://github.com/nicklan/drmr#ui>
a ui:GtkUI ;
ui:binary <drmr_ui.so> .

165
drmr2-mkttl Executable file
View File

@ -0,0 +1,165 @@
#!/bin/bash
out_file="drmr2.ttl"
outport_nb=32
add_port()
{
echo -e >>${out_file} " ["
case "$#"
in
"2")
printf >>${out_file} "$2" "${idx}"
;;
"3")
printf >>${out_file} "$2" "${idx}" "$3"
;;
"4")
printf >>${out_file} "$2" "${idx}" "$3" "$4"
;;
esac
echo -e >>${out_file} "\n ]$1"
idx=$((${idx} + 1))
}
>${out_file}
echo -n >>${out_file} '@prefix lv2: <http://lv2plug.in/ns/lv2core#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix doap: <http://usefulinc.com/ns/doap#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix ui: <http://lv2plug.in/ns/extensions/ui#>.
@prefix atom: <http://lv2plug.in/ns/ext/atom#>.
@prefix urid: <http://lv2plug.in/ns/ext/urid#>.
<http://github.com/AlkorZ3/drmr2>
a lv2:InstrumentPlugin, lv2:Plugin;
lv2:binary <drmr2.so>;
doap:name "DrMr2 Sampler";
doap:maintainer [
foaf:name "AlkorZ3";
foaf:homepage <http://github.com/AlkorZ3/drmr2/wiki>;
foaf:mbox <alkorz3@rx3.net>
] ;
doap:license <http://usefulinc.com/doap/licenses/gpl>;
lv2:requiredFeature urid:map;
ui:ui <http://github.com/AlkorZ3/drmr2#ui>;
lv2:extensionData <http://lv2plug.in/ns/ext/state#interface>;
lv2:port'
idx=0
add_port "," " a lv2:InputPort , atom:AtomPort;
atom:bufferType atom:Sequence ;
atom:supports <http://lv2plug.in/ns/ext/midi#MidiEvent>,
<http://lv2plug.in/ns/ext/atom#Resource>;
lv2:index %d;
lv2:symbol \"control\";
lv2:name \"Control\";"
add_port "," " a lv2:AudioPort, lv2:OutputPort;
lv2:index %d;
lv2:symbol \"master_out_1\";
lv2:name \"Master - Out 1\";"
add_port "," " a lv2:AudioPort, lv2:OutputPort;
lv2:index %d;
lv2:symbol \"master_out_2\";
lv2:name \"Master - Out 2\";"
out_id=0
while [[ "${out_id}" -lt "${outport_nb}" ]]
do
add_port "," " a lv2:AudioPort, lv2:OutputPort;
lv2:index %d;
lv2:symbol \"audio_%02d_out_1\";
lv2:name \"Audio %02d - Out 1\";" "${out_id}" "${out_id}"
add_port "," " a lv2:AudioPort, lv2:OutputPort;
lv2:index %d;
lv2:symbol \"audio_%02d_out_2\";
lv2:name \"Audio %02d - Out 2\";" "${out_id}" "${out_id}"
out_id=$((${out_id} + 1))
done
add_port "," " a lv2:ControlPort, lv2:InputPort;
lv2:index %d;
lv2:symbol \"base_note\";
lv2:name \"Midi Base Note\";
lv2:minimum 21;
lv2:maximum 107;
lv2:default 36;
lv2:portProperty lv2:integer;"
out_id=0
while [[ "${out_id}" -lt "32" ]]
do
add_port "," " a lv2:ControlPort, lv2:InputPort;
lv2:index %d;
lv2:symbol \"gain_%02d\";
lv2:name \"Sample Gain %02d\";
lv2:minimum -60.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label \"-inf\" ;
rdf:value -60.0;
]" "${out_id}" "${out_id}"
out_id=$((${out_id} + 1))
done
out_id=0
while [[ "${out_id}" -lt "32" ]]
do
add_port "," " a lv2:ControlPort, lv2:InputPort;
lv2:index %d;
lv2:symbol \"pan_%02d\";
lv2:name \"Sample Pan %02d\";
lv2:minimum -1.0;
lv2:maximum 1.0;
lv2:default 0.0;" "${out_id}" "${out_id}"
out_id=$((${out_id} + 1))
done
add_port "." " a lv2:OutputPort , atom:AtomPort ;
atom:bufferType atom:Sequence ;
atom:supports <http://lv2plug.in/ns/ext/atom#Resource> ;
lv2:index %d ;
lv2:symbol \"core_events\" ;
lv2:name \"Core Events\""
echo >>${out_file} '
<http://github.com/AlkorZ3/drmr2#ui>
a ui:GtkUI ;
ui:binary <drmr2_ui.so> .'

View File

@ -1,5 +1,5 @@
/* drmr.c /* drmr2.c
* LV2 DrMr plugin * LV2 DrMr2 plugin
* Copyright 2012 Nick Lanham <nick@afternight.org> * Copyright 2012 Nick Lanham <nick@afternight.org>
* *
* Public License v3. source code is available at * Public License v3. source code is available at
@ -19,8 +19,8 @@
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include "drmr.h" #include "drmr2.h"
#include "drmr_hydrogen.h" #include "drmr2_hydrogen.h"
#define REQ_BUF_SIZE 10 #define REQ_BUF_SIZE 10
#define VELOCITY_MAX 127 #define VELOCITY_MAX 127
@ -65,6 +65,10 @@ static void* load_thread(void* arg) {
return 0; return 0;
} }
static LV2_Handle static LV2_Handle
instantiate(const LV2_Descriptor* descriptor, instantiate(const LV2_Descriptor* descriptor,
double rate, double rate,
@ -80,6 +84,7 @@ instantiate(const LV2_Descriptor* descriptor,
drmr->rate = rate; drmr->rate = rate;
drmr->ignore_velocity = false; drmr->ignore_velocity = false;
drmr->ignore_note_off = true; drmr->ignore_note_off = true;
drmr->channel_nb = 0;
#ifdef DRMR_UI_ZERO_SAMP #ifdef DRMR_UI_ZERO_SAMP
drmr->zero_position = DRMR_UI_ZERO_SAMP; drmr->zero_position = DRMR_UI_ZERO_SAMP;
@ -121,8 +126,11 @@ instantiate(const LV2_Descriptor* descriptor,
drmr->request_buf = malloc(REQ_BUF_SIZE*sizeof(char*)); drmr->request_buf = malloc(REQ_BUF_SIZE*sizeof(char*));
memset(drmr->request_buf,0,REQ_BUF_SIZE*sizeof(char*)); memset(drmr->request_buf,0,REQ_BUF_SIZE*sizeof(char*));
drmr->left = malloc(32*sizeof(float*));
drmr->right = malloc(32*sizeof(float*));
drmr->gains = malloc(32*sizeof(float*)); drmr->gains = malloc(32*sizeof(float*));
drmr->pans = malloc(32*sizeof(float*)); drmr->pans = malloc(32*sizeof(float*));
for(i = 0;i<32;i++) { for(i = 0;i<32;i++) {
drmr->gains[i] = NULL; drmr->gains[i] = NULL;
drmr->pans[i] = NULL; drmr->pans[i] = NULL;
@ -131,41 +139,72 @@ instantiate(const LV2_Descriptor* descriptor,
return (LV2_Handle)drmr; return (LV2_Handle)drmr;
} }
static void static void
connect_port(LV2_Handle instance, connect_port(LV2_Handle instance,
uint32_t port, uint32_t port,
void* data) { void* data)
{
DrMr* drmr = (DrMr*)instance; DrMr* drmr = (DrMr*)instance;
DrMrPortIndex port_index = (DrMrPortIndex)port; DrMrPortIndex port_index = (DrMrPortIndex)port;
switch (port_index) {
switch (port_index)
{
case DRMR_CONTROL: case DRMR_CONTROL:
drmr->control_port = (LV2_Atom_Sequence*)data; drmr->control_port = (LV2_Atom_Sequence*)data;
break; break;
case DRMR_CORE_EVENT: case DRMR_CORE_EVENT:
drmr->core_event_port = (LV2_Atom_Sequence*)data; drmr->core_event_port = (LV2_Atom_Sequence*)data;
break; break;
case DRMR_LEFT:
drmr->left = (float*)data;
break;
case DRMR_RIGHT:
drmr->right = (float*)data;
break;
case DRMR_BASENOTE: case DRMR_BASENOTE:
if (data) drmr->baseNote = (float*)data; if (data) drmr->baseNote = (float*)data;
default:
break; break;
}
if (port_index >= DRMR_GAIN_ONE && port_index <= DRMR_GAIN_THIRTYTWO) { default:
if( port_index == DRMR_MASTER_LEFT)
{
drmr->master_right = (float*)data;
}
else if( port_index == DRMR_MASTER_RIGHT)
{
drmr->master_left = (float*)data;
}
else if( port_index >= DRMR_LEFT_00 && port_index <= DRMR_RIGHT_31)
{
int outoff = (port_index - DRMR_LEFT_00) / 2;
if( ( port_index - DRMR_LEFT_00) % 2)
{
drmr->right[outoff] = (float*)data;
}
else
{
drmr->left[outoff] = (float*)data;
}
}
else if( port_index >= DRMR_GAIN_ONE && port_index <= DRMR_GAIN_THIRTYTWO)
{
int goff = port_index - DRMR_GAIN_ONE; int goff = port_index - DRMR_GAIN_ONE;
drmr->gains[goff] = (float*)data; drmr->gains[goff] = (float*)data;
} }
else if( port_index >= DRMR_PAN_ONE && port_index <= DRMR_PAN_THIRTYTWO)
if (port_index >= DRMR_PAN_ONE && port_index <= DRMR_PAN_THIRTYTWO) { {
int poff = port_index - DRMR_PAN_ONE; int poff = port_index - DRMR_PAN_ONE;
drmr->pans[poff] = (float*)data; drmr->pans[poff] = (float*)data;
} }
break;
} }
}
static inline LV2_Atom *build_update_message(DrMr *drmr) { static inline LV2_Atom *build_update_message(DrMr *drmr) {
LV2_Atom_Forge_Frame set_frame; LV2_Atom_Forge_Frame set_frame;
@ -179,6 +218,10 @@ static inline LV2_Atom *build_update_message(DrMr *drmr) {
return msg; return msg;
} }
static inline LV2_Atom *build_state_message(DrMr *drmr) { static inline LV2_Atom *build_state_message(DrMr *drmr) {
LV2_Atom_Forge_Frame set_frame; LV2_Atom_Forge_Frame set_frame;
LV2_Atom* msg = (LV2_Atom*)lv2_atom_forge_resource LV2_Atom* msg = (LV2_Atom*)lv2_atom_forge_resource
@ -191,12 +234,18 @@ static inline LV2_Atom *build_state_message(DrMr *drmr) {
lv2_atom_forge_bool(&drmr->forge, drmr->ignore_velocity?true:false); lv2_atom_forge_bool(&drmr->forge, drmr->ignore_velocity?true:false);
lv2_atom_forge_property_head(&drmr->forge, drmr->uris.note_off_toggle,0); lv2_atom_forge_property_head(&drmr->forge, drmr->uris.note_off_toggle,0);
lv2_atom_forge_bool(&drmr->forge, drmr->ignore_note_off?true:false); lv2_atom_forge_bool(&drmr->forge, drmr->ignore_note_off?true:false);
lv2_atom_forge_property_head(&drmr->forge, drmr->uris.channel_nb,0);
lv2_atom_forge_int(&drmr->forge, drmr->channel_nb);
lv2_atom_forge_property_head(&drmr->forge, drmr->uris.zero_position,0); lv2_atom_forge_property_head(&drmr->forge, drmr->uris.zero_position,0);
lv2_atom_forge_int(&drmr->forge, drmr->zero_position); lv2_atom_forge_int(&drmr->forge, drmr->zero_position);
lv2_atom_forge_pop(&drmr->forge,&set_frame); lv2_atom_forge_pop(&drmr->forge,&set_frame);
return msg; return msg;
} }
static inline LV2_Atom *build_midi_info_message(DrMr *drmr, uint8_t *data) { static inline LV2_Atom *build_midi_info_message(DrMr *drmr, uint8_t *data) {
LV2_Atom_Forge_Frame set_frame; LV2_Atom_Forge_Frame set_frame;
LV2_Atom* msg = (LV2_Atom*)lv2_atom_forge_resource LV2_Atom* msg = (LV2_Atom*)lv2_atom_forge_resource
@ -207,6 +256,10 @@ static inline LV2_Atom *build_midi_info_message(DrMr *drmr, uint8_t *data) {
return msg; return msg;
} }
static inline void layer_to_sample(drmr_sample *sample, float gain) { static inline void layer_to_sample(drmr_sample *sample, float gain) {
int i; int i;
float mapped_gain = (1-(gain/GAIN_MIN)); float mapped_gain = (1-(gain/GAIN_MIN));
@ -229,12 +282,20 @@ static inline void layer_to_sample(drmr_sample *sample, float gain) {
sample->data = sample->layers[0].data; sample->data = sample->layers[0].data;
} }
static inline void trigger_sample(DrMr *drmr, int nn, uint8_t* const data, uint32_t offset) { static inline void trigger_sample(DrMr *drmr, int nn, uint8_t* const data, uint32_t offset) {
// need to mutex this to avoid getting the samples array // need to mutex this to avoid getting the samples array
// changed after the check that the midi-note is valid // changed after the check that the midi-note is valid
pthread_mutex_lock(&drmr->load_mutex); pthread_mutex_lock(&drmr->load_mutex);
if (nn >= 0 && nn < drmr->num_samples) { if (nn >= 0 && nn < drmr->num_samples) {
if (drmr->samples[nn].layer_count > 0) { if (drmr->samples[nn].layer_count > 0) {
// drmr currently has 32 hard-coded gains so just use the last gain
// to prevent a segfault
int gain_idx = nn < 32 ? nn : 31;
layer_to_sample(drmr->samples+nn,*(drmr->gains[gain_idx]));
layer_to_sample(drmr->samples+nn,*(drmr->gains[nn])); layer_to_sample(drmr->samples+nn,*(drmr->gains[nn]));
if (drmr->samples[nn].limit == 0) if (drmr->samples[nn].limit == 0)
fprintf(stderr,"Failed to find layer at: %i for %f\n",nn,*drmr->gains[nn]); fprintf(stderr,"Failed to find layer at: %i for %f\n",nn,*drmr->gains[nn]);
@ -251,6 +312,10 @@ static inline void trigger_sample(DrMr *drmr, int nn, uint8_t* const data, uint3
pthread_mutex_unlock(&drmr->load_mutex); pthread_mutex_unlock(&drmr->load_mutex);
} }
static inline void untrigger_sample(DrMr *drmr, int nn, uint32_t offset) { static inline void untrigger_sample(DrMr *drmr, int nn, uint32_t offset) {
pthread_mutex_lock(&drmr->load_mutex); pthread_mutex_lock(&drmr->load_mutex);
if (nn >= 0 && nn < drmr->num_samples) { if (nn >= 0 && nn < drmr->num_samples) {
@ -265,13 +330,17 @@ static inline void untrigger_sample(DrMr *drmr, int nn, uint32_t offset) {
pthread_mutex_unlock(&drmr->load_mutex); pthread_mutex_unlock(&drmr->load_mutex);
} }
#define DB3SCALE -0.8317830986718104f #define DB3SCALE -0.8317830986718104f
#define DB3SCALEPO 1.8317830986718104f #define DB3SCALEPO 1.8317830986718104f
// taken from lv2 example amp plugin // taken from lv2 example amp plugin
#define DB_CO(g) ((g) > GAIN_MIN ? powf(10.0f, (g) * 0.05f) : 0.0f) #define DB_CO(g) ((g) > GAIN_MIN ? powf(10.0f, (g) * 0.05f) : 0.0f)
static void run(LV2_Handle instance, uint32_t n_samples) { static void run(LV2_Handle instance, uint32_t n_samples) {
int i,baseNote; int i, j, baseNote;
DrMr* drmr = (DrMr*)instance; DrMr* drmr = (DrMr*)instance;
baseNote = (int)floorf(*(drmr->baseNote)); baseNote = (int)floorf(*(drmr->baseNote));
@ -288,26 +357,39 @@ static void run(LV2_Handle instance, uint32_t n_samples) {
uint8_t nn; uint8_t nn;
uint8_t* const data = (uint8_t* const)(ev + 1); uint8_t* const data = (uint8_t* const)(ev + 1);
uint32_t offset = (ev->time.frames > 0 && ev->time.frames < n_samples) ? ev->time.frames : 0; uint32_t offset = (ev->time.frames > 0 && ev->time.frames < n_samples) ? ev->time.frames : 0;
//int channel = *data & 15; int channel = *data & 15;
switch ((*data) >> 4) {
if( ( drmr->channel_nb == 0) || ( channel == ( drmr->channel_nb - 1)))
{
switch ((*data) >> 4)
{
case 8: case 8:
if (!drmr->ignore_note_off) { {
if (!drmr->ignore_note_off)
{
nn = data[1]; nn = data[1];
nn-=baseNote; nn-=baseNote;
untrigger_sample(drmr,nn,offset); untrigger_sample(drmr,nn,offset);
} }
break; break;
case 9: { }
case 9:
{
nn = data[1]; nn = data[1];
nn-=baseNote; nn-=baseNote;
trigger_sample(drmr,nn,data,offset); trigger_sample(drmr,nn,data,offset);
break; break;
} }
default: default:
{
//printf("Unhandeled status: %i\n",(*data)>>4); //printf("Unhandeled status: %i\n",(*data)>>4);
break; break;
} }
} }
}
}
else if (ev->body.type == drmr->uris.atom_resource) { else if (ev->body.type == drmr->uris.atom_resource) {
const LV2_Atom_Object *obj = (LV2_Atom_Object*)&ev->body; const LV2_Atom_Object *obj = (LV2_Atom_Object*)&ev->body;
if (obj->body.otype == drmr->uris.ui_msg) { if (obj->body.otype == drmr->uris.ui_msg) {
@ -315,12 +397,14 @@ static void run(LV2_Handle instance, uint32_t n_samples) {
const LV2_Atom* trigger = NULL; const LV2_Atom* trigger = NULL;
const LV2_Atom* ignvel = NULL; const LV2_Atom* ignvel = NULL;
const LV2_Atom* ignno = NULL; const LV2_Atom* ignno = NULL;
const LV2_Atom* channel_nb = NULL;
const LV2_Atom* zerop = NULL; const LV2_Atom* zerop = NULL;
lv2_atom_object_get(obj, lv2_atom_object_get(obj,
drmr->uris.kit_path, &path, drmr->uris.kit_path, &path,
drmr->uris.sample_trigger, &trigger, drmr->uris.sample_trigger, &trigger,
drmr->uris.velocity_toggle, &ignvel, drmr->uris.velocity_toggle, &ignvel,
drmr->uris.note_off_toggle, &ignno, drmr->uris.note_off_toggle, &ignno,
drmr->uris.channel_nb, &channel_nb,
drmr->uris.zero_position, &zerop, drmr->uris.zero_position, &zerop,
0); 0);
if (path) { if (path) {
@ -346,6 +430,8 @@ static void run(LV2_Handle instance, uint32_t n_samples) {
drmr->ignore_velocity = ((const LV2_Atom_Bool*)ignvel)->body; drmr->ignore_velocity = ((const LV2_Atom_Bool*)ignvel)->body;
if (ignno) if (ignno)
drmr->ignore_note_off = ((const LV2_Atom_Bool*)ignno)->body; drmr->ignore_note_off = ((const LV2_Atom_Bool*)ignno)->body;
if (channel_nb)
drmr->channel_nb = ((const LV2_Atom_Int*)channel_nb)->body;
if (zerop) if (zerop)
drmr->zero_position = ((const LV2_Atom_Int*)zerop)->body; drmr->zero_position = ((const LV2_Atom_Int*)zerop)->body;
} else if (obj->body.otype == drmr->uris.get_state) { } else if (obj->body.otype == drmr->uris.get_state) {
@ -371,59 +457,95 @@ static void run(LV2_Handle instance, uint32_t n_samples) {
lv2_atom_forge_pop(&drmr->forge, &seq_frame); lv2_atom_forge_pop(&drmr->forge, &seq_frame);
for(i = 0;i<n_samples;i++) { pthread_mutex_lock(&drmr->load_mutex);
drmr->left[i] = 0.0f;
drmr->right[i] = 0.0f; for( j = 0; j<n_samples; j++)
{
drmr->master_left[j] = 0.0f;
drmr->master_right[j] = 0.0f;
} }
pthread_mutex_lock(&drmr->load_mutex); for (i = 0;i < drmr->num_samples;i++)
for (i = 0;i < drmr->num_samples;i++) { {
int pos,lim; int pos,lim;
drmr_sample* cs = drmr->samples+i; drmr_sample* cs = drmr->samples+i;
if ((cs->active || cs->dataoffset) && (cs->limit > 0)) {
if ((cs->active || cs->dataoffset) && (cs->limit > 0))
{
float coef_right, coef_left; float coef_right, coef_left;
if (i < 32) { if (i < 32)
{
float gain = DB_CO(*(drmr->gains[i])); float gain = DB_CO(*(drmr->gains[i]));
float pan_right = ((*drmr->pans[i])+1)/2.0f; float pan_right = ((*drmr->pans[i])+1)/2.0f;
float pan_left = 1-pan_right; float pan_left = 1-pan_right;
coef_right = (pan_right * (DB3SCALE * pan_right + DB3SCALEPO))*gain*cs->velocity; coef_right = (pan_right * (DB3SCALE * pan_right + DB3SCALEPO))*gain*cs->velocity;
coef_left = (pan_left * (DB3SCALE * pan_left + DB3SCALEPO))*gain*cs->velocity; coef_left = (pan_left * (DB3SCALE * pan_left + DB3SCALEPO))*gain*cs->velocity;
} }
else { else
{
coef_right = coef_left = 1.0f; coef_right = coef_left = 1.0f;
} }
int datastart, dataend; int datastart, dataend;
if (cs->active) { if (cs->active)
{
datastart = cs->dataoffset; datastart = cs->dataoffset;
dataend = n_samples; dataend = n_samples;
} else { }
else
{
datastart = 0; datastart = 0;
dataend = cs->dataoffset; dataend = cs->dataoffset;
} }
cs->dataoffset = 0; cs->dataoffset = 0;
if (cs->info->channels == 1) { // play mono sample for( j = 0; j<n_samples; j++)
{
drmr->left[i][j] = 0.0f;
drmr->right[i][j] = 0.0f;
}
if (cs->info->channels == 1)
{ // play mono sample
lim = (n_samples < (cs->limit - cs->offset)?n_samples:(cs->limit-cs->offset)); lim = (n_samples < (cs->limit - cs->offset)?n_samples:(cs->limit-cs->offset));
for (pos = datastart; pos < lim && pos < dataend; pos++) {
drmr->left[pos] += cs->data[cs->offset]*coef_left; for (pos = datastart; pos < lim && pos < dataend; pos++)
drmr->right[pos] += cs->data[cs->offset]*coef_right; {
drmr->master_left[pos] += cs->data[cs->offset]*coef_left;
drmr->left[i][pos] += cs->data[cs->offset]*coef_left;
drmr->master_right[pos] += cs->data[cs->offset]*coef_right;
drmr->right[i][pos] += cs->data[cs->offset]*coef_right;
cs->offset++; cs->offset++;
} }
} else { // play stereo sample }
else
{ // play stereo sample
lim = (cs->limit-cs->offset)/cs->info->channels; lim = (cs->limit-cs->offset)/cs->info->channels;
if (lim > n_samples) lim = n_samples; if (lim > n_samples) lim = n_samples;
for (pos = datastart; pos < lim && pos < dataend; pos++) { for (pos = datastart; pos < lim && pos < dataend; pos++)
drmr->left[pos] += cs->data[cs->offset++]*coef_left; {
drmr->right[pos] += cs->data[cs->offset++]*coef_right; drmr->master_left[pos] += cs->data[cs->offset]*coef_left;
drmr->left[i][pos] += cs->data[cs->offset++]*coef_left;
drmr->master_right[pos] += cs->data[cs->offset]*coef_right;
drmr->right[i][pos] += cs->data[cs->offset++]*coef_right;
} }
} }
if (cs->offset >= cs->limit) cs->active = 0; if (cs->offset >= cs->limit) cs->active = 0;
} }
} }
pthread_mutex_unlock(&drmr->load_mutex); pthread_mutex_unlock(&drmr->load_mutex);
} }
static void cleanup(LV2_Handle instance) { static void cleanup(LV2_Handle instance) {
DrMr* drmr = (DrMr*)instance; DrMr* drmr = (DrMr*)instance;
pthread_cancel(drmr->load_thread); pthread_cancel(drmr->load_thread);
@ -434,6 +556,10 @@ static void cleanup(LV2_Handle instance) {
free(instance); free(instance);
} }
static LV2_State_Status static LV2_State_Status
save_state(LV2_Handle instance, save_state(LV2_Handle instance,
LV2_State_Store_Function store, LV2_State_Store_Function store,
@ -487,6 +613,14 @@ save_state(LV2_Handle instance,
LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE); LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE);
if (stat) return stat; if (stat) return stat;
stat = store(handle,
drmr->uris.channel_nb,
&drmr->channel_nb,
sizeof(int),
drmr->uris.int_urid,
LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE);
if (stat) return stat;
stat = store(handle, stat = store(handle,
drmr->uris.zero_position, drmr->uris.zero_position,
&drmr->zero_position, &drmr->zero_position,
@ -496,6 +630,10 @@ save_state(LV2_Handle instance,
return stat; return stat;
} }
static LV2_State_Status static LV2_State_Status
restore_state(LV2_Handle instance, restore_state(LV2_Handle instance,
LV2_State_Retrieve_Function retrieve, LV2_State_Retrieve_Function retrieve,
@ -550,6 +688,11 @@ restore_state(LV2_Handle instance,
if (ignore_note_off) if (ignore_note_off)
drmr->ignore_note_off = *ignore_note_off?true:false; drmr->ignore_note_off = *ignore_note_off?true:false;
const int* channel_nb =
retrieve(handle, drmr->uris.channel_nb, &size, &type, &fgs);
if (channel_nb)
drmr->channel_nb = *channel_nb;
const int* zero_position = const int* zero_position =
retrieve(handle, drmr->uris.zero_position, &size, &type, &fgs); retrieve(handle, drmr->uris.zero_position, &size, &type, &fgs);
if (zero_position) if (zero_position)
@ -559,12 +702,20 @@ restore_state(LV2_Handle instance,
} }
static const void* extension_data(const char* uri) { static const void* extension_data(const char* uri) {
static const LV2_State_Interface state_iface = { save_state, restore_state }; static const LV2_State_Interface state_iface = { save_state, restore_state };
if (!strcmp(uri, LV2_STATE__interface)) return &state_iface; if (!strcmp(uri, LV2_STATE__interface)) return &state_iface;
return NULL; return NULL;
} }
static const LV2_Descriptor descriptor = { static const LV2_Descriptor descriptor = {
DRMR_URI, DRMR_URI,
instantiate, instantiate,
@ -576,6 +727,10 @@ static const LV2_Descriptor descriptor = {
extension_data extension_data
}; };
LV2_SYMBOL_EXPORT LV2_SYMBOL_EXPORT
const LV2_Descriptor* const LV2_Descriptor*
lv2_descriptor(uint32_t index) lv2_descriptor(uint32_t index)

View File

@ -1,5 +1,5 @@
/* drmr.h /* drmr2.h
* LV2 DrMr plugin * LV2 DrMr2 plugin
* Copyright 2012 Nick Lanham <nick@afternight.org> * Copyright 2012 Nick Lanham <nick@afternight.org>
* *
* Public License v3. source code is available at * Public License v3. source code is available at
@ -66,14 +66,78 @@ typedef struct {
// lv2 stuff // lv2 stuff
#define DRMR_URI "http://github.com/nicklan/drmr" #define DRMR_URI "http://github.com/AlkorZ3/drmr2"
#define GAIN_MIN -60.0f #define GAIN_MIN -60.0f
#define GAIN_MAX 6.0f #define GAIN_MAX 6.0f
typedef enum { typedef enum {
DRMR_CONTROL = 0, DRMR_CONTROL = 0,
DRMR_LEFT, DRMR_MASTER_LEFT,
DRMR_RIGHT, DRMR_MASTER_RIGHT,
DRMR_LEFT_00,
DRMR_RIGHT_00,
DRMR_LEFT_01,
DRMR_RIGHT_01,
DRMR_LEFT_02,
DRMR_RIGHT_02,
DRMR_LEFT_03,
DRMR_RIGHT_03,
DRMR_LEFT_04,
DRMR_RIGHT_04,
DRMR_LEFT_05,
DRMR_RIGHT_05,
DRMR_LEFT_06,
DRMR_RIGHT_06,
DRMR_LEFT_07,
DRMR_RIGHT_07,
DRMR_LEFT_08,
DRMR_RIGHT_08,
DRMR_LEFT_09,
DRMR_RIGHT_09,
DRMR_LEFT_10,
DRMR_RIGHT_10,
DRMR_LEFT_11,
DRMR_RIGHT_11,
DRMR_LEFT_12,
DRMR_RIGHT_12,
DRMR_LEFT_13,
DRMR_RIGHT_13,
DRMR_LEFT_14,
DRMR_RIGHT_14,
DRMR_LEFT_15,
DRMR_RIGHT_15,
DRMR_LEFT_16,
DRMR_RIGHT_16,
DRMR_LEFT_17,
DRMR_RIGHT_17,
DRMR_LEFT_18,
DRMR_RIGHT_18,
DRMR_LEFT_19,
DRMR_RIGHT_19,
DRMR_LEFT_20,
DRMR_RIGHT_20,
DRMR_LEFT_21,
DRMR_RIGHT_21,
DRMR_LEFT_22,
DRMR_RIGHT_22,
DRMR_LEFT_23,
DRMR_RIGHT_23,
DRMR_LEFT_24,
DRMR_RIGHT_24,
DRMR_LEFT_25,
DRMR_RIGHT_25,
DRMR_LEFT_26,
DRMR_RIGHT_26,
DRMR_LEFT_27,
DRMR_RIGHT_27,
DRMR_LEFT_28,
DRMR_RIGHT_28,
DRMR_LEFT_29,
DRMR_RIGHT_29,
DRMR_LEFT_30,
DRMR_RIGHT_30,
DRMR_LEFT_31,
DRMR_RIGHT_31,
DRMR_BASENOTE, DRMR_BASENOTE,
DRMR_GAIN_ONE, DRMR_GAIN_ONE,
DRMR_GAIN_TWO, DRMR_GAIN_TWO,
@ -157,21 +221,26 @@ typedef struct {
LV2_URID sample_trigger; LV2_URID sample_trigger;
LV2_URID velocity_toggle; LV2_URID velocity_toggle;
LV2_URID note_off_toggle; LV2_URID note_off_toggle;
LV2_URID channel_nb;
LV2_URID zero_position; LV2_URID zero_position;
} drmr_uris; } drmr_uris;
typedef struct { typedef struct {
// Ports // Ports
float* left; float* master_left;
float* right; float* master_right;
float** left;
float** right;
LV2_Atom_Sequence *control_port; LV2_Atom_Sequence *control_port;
LV2_Atom_Sequence *core_event_port; LV2_Atom_Sequence *core_event_port;
LV2_Atom_Forge forge; LV2_Atom_Forge forge;
// params // params
int channel;
bool ignore_velocity; bool ignore_velocity;
bool ignore_note_off; bool ignore_note_off;
int channel_nb;
int zero_position; int zero_position;
float** gains; float** gains;
float** pans; float** pans;
@ -231,6 +300,9 @@ void map_drmr_uris(LV2_URID_Map *map,
uris->note_off_toggle = uris->note_off_toggle =
map->map(map->handle, map->map(map->handle,
DRMR_URI "#noteofftoggle"); DRMR_URI "#noteofftoggle");
uris->channel_nb =
map->map(map->handle,
DRMR_URI "#channelnb");
uris->zero_position = uris->zero_position =
map->map(map->handle, map->map(map->handle,
DRMR_URI "#zeroposition"); DRMR_URI "#zeroposition");

View File

@ -1,5 +1,5 @@
/* drmr_hydrogen.c /* drmr2_hydrogen.c
* LV2 DrMr plugin * LV2 DrMr2 plugin
* Copyright 2012 Nick Lanham <nick@afternight.org> * Copyright 2012 Nick Lanham <nick@afternight.org>
* *
* Public License v3. source code is available at * Public License v3. source code is available at
@ -27,8 +27,8 @@
#include <math.h> #include <math.h>
#include "samplerate.h" #include "samplerate.h"
#include "drmr.h" #include "drmr2.h"
#include "drmr_hydrogen.h" #include "drmr2_hydrogen.h"
#include "expat.h" #include "expat.h"
/* Below is a list of the locations that DrMr will /* Below is a list of the locations that DrMr will
@ -46,7 +46,7 @@ static char* default_drumkit_locations[] = {
"/usr/local/share/hydrogen/data/drumkits/", "/usr/local/share/hydrogen/data/drumkits/",
"/usr/share/drmr/drumkits/", "/usr/share/drmr/drumkits/",
"~/.hydrogen/data/drumkits/", "~/.hydrogen/data/drumkits/",
"~/.drmr/drumkits/", "~/.drmr2/drumkits/",
NULL NULL
}; };
@ -87,6 +87,7 @@ struct kit_info {
struct hp_info { struct hp_info {
char scan_only; char scan_only;
char in_info; char in_info;
char in_component_list;
char in_instrument_list; char in_instrument_list;
char in_instrument; char in_instrument;
char in_layer; char in_layer;
@ -105,6 +106,12 @@ startElement(void *userData, const char *name, const char **atts)
struct hp_info* info = (struct hp_info*)userData; struct hp_info* info = (struct hp_info*)userData;
info->cur_off = 0; info->cur_off = 0;
if (info->in_info) { if (info->in_info) {
if (!info->in_component_list) {
if (!strcmp(name,"componentList")) {
info->in_component_list = 1;
}
else
{
if (info->in_instrument) { if (info->in_instrument) {
if (!strcmp(name,"layer") && !info->scan_only) { if (!strcmp(name,"layer") && !info->scan_only) {
info->in_layer = 1; info->in_layer = 1;
@ -122,6 +129,8 @@ startElement(void *userData, const char *name, const char **atts)
if (!strcmp(name,"instrumentList")) if (!strcmp(name,"instrumentList"))
info->in_instrument_list = 1; info->in_instrument_list = 1;
} }
}
}
} else { } else {
if (!strcmp(name,"drumkit_info")) if (!strcmp(name,"drumkit_info"))
info->in_info = 1; info->in_info = 1;
@ -135,7 +144,7 @@ endElement(void *userData, const char *name)
if (info->cur_off == MAX_CHAR_DATA) info->cur_off--; if (info->cur_off == MAX_CHAR_DATA) info->cur_off--;
info->cur_buf[info->cur_off]='\0'; info->cur_buf[info->cur_off]='\0';
if (info->in_info && !info->in_instrument_list && !strcmp(name,"name")) if (info->in_info && !info->in_component_list && !info->in_instrument_list && !strcmp(name,"name"))
info->kit_info->name = strdup(info->cur_buf); info->kit_info->name = strdup(info->cur_buf);
if (info->scan_only && info->in_info && !info->in_instrument_list && !strcmp(name,"info")) if (info->scan_only && info->in_info && !info->in_instrument_list && !strcmp(name,"info"))
info->kit_info->desc = strdup(info->cur_buf); info->kit_info->desc = strdup(info->cur_buf);
@ -187,6 +196,7 @@ endElement(void *userData, const char *name)
info->cur_instrument = NULL; info->cur_instrument = NULL;
info->in_instrument = 0; info->in_instrument = 0;
} }
if (info->in_component_list && !strcmp(name,"componentList")) info->in_component_list = 0;
if (info->in_instrument_list && !strcmp(name,"instrumentList")) info->in_instrument_list = 0; if (info->in_instrument_list && !strcmp(name,"instrumentList")) info->in_instrument_list = 0;
if (info->in_info && !strcmp(name,"drumkit_info")) info->in_info = 0; if (info->in_info && !strcmp(name,"drumkit_info")) info->in_info = 0;
} }
@ -230,6 +240,15 @@ static char* expand_path(char* path, char* buf) {
return buf; return buf;
} }
static int compar_kit(const void *p1, const void *p2)
{
return (int) strcmp( (* (scanned_kit **) p1)->name, (* (scanned_kit **) p2)->name);
}
kits* scan_kits() { kits* scan_kits() {
DIR* dp; DIR* dp;
FILE* file; FILE* file;
@ -339,22 +358,37 @@ kits* scan_kits() {
ret->num_kits = cp; ret->num_kits = cp;
ret->kits = malloc(cp*sizeof(scanned_kit)); ret->kits = malloc(cp*sizeof(scanned_kit));
scanned_kit **sort_tab = (scanned_kit **)malloc( cp * sizeof(scanned_kit *));
cur_k = scanned_kits; cur_k = scanned_kits;
cp = 0; cp = 0;
while(cur_k) { while(cur_k)
ret->kits[cp].name = cur_k->skit->name; {
ret->kits[cp].desc = cur_k->skit->desc; sort_tab[cp] = cur_k->skit;
ret->kits[cp].path = cur_k->skit->path;
ret->kits[cp].samples = cur_k->skit->samples;
ret->kits[cp].sample_names = cur_k->skit->sample_names;
cp++;
free(cur_k->skit);
cur_k = cur_k->next; cur_k = cur_k->next;
// free each node as we go along // free each node as we go along
free(scanned_kits); free(scanned_kits);
scanned_kits = cur_k; scanned_kits = cur_k;
cp++;
} }
qsort( sort_tab, ret->num_kits, sizeof(scanned_kit *), compar_kit);
for( cp=0; cp < ret->num_kits; cp++)
{
ret->kits[cp].name = (sort_tab[cp])->name;
ret->kits[cp].desc = (sort_tab[cp])->desc;
ret->kits[cp].path = (sort_tab[cp])->path;
ret->kits[cp].samples = (sort_tab[cp])->samples;
ret->kits[cp].sample_names = (sort_tab[cp])->sample_names;
free(sort_tab[cp]);
}
free(sort_tab);
return ret; return ret;
} }

View File

@ -1,5 +1,5 @@
/* drmr_hydrogen.h /* drmr2_hydrogen.h
* LV2 DrMr plugin * LV2 DrMr2 plugin
* Copyright 2012 Nick Lanham <nick@afternight.org> * Copyright 2012 Nick Lanham <nick@afternight.org>
* *
* Public License v3. source code is available at * Public License v3. source code is available at

View File

@ -1,5 +1,5 @@
/* drmr.c /* drmr2.c
* LV2 DrMr plugin * LV2 DrMr2 plugin
* Copyright 2012 Nick Lanham <nick@afternight.org> * Copyright 2012 Nick Lanham <nick@afternight.org>
* *
* Public License v3. source code is available at * Public License v3. source code is available at
@ -20,8 +20,8 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <gdk/gdk.h> #include <gdk/gdk.h>
#include "drmr.h" #include "drmr2.h"
#include "drmr_hydrogen.h" #include "drmr2_hydrogen.h"
#include "nknob.h" #include "nknob.h"
#include "lv2/lv2plug.in/ns/ext/atom/atom.h" #include "lv2/lv2plug.in/ns/ext/atom/atom.h"
@ -30,7 +30,7 @@
#include "lv2/lv2plug.in/ns/ext/urid/urid.h" #include "lv2/lv2plug.in/ns/ext/urid/urid.h"
#include "lv2/lv2plug.in/ns/extensions/ui/ui.h" #include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
#define DRMR_UI_URI "http://github.com/nicklan/drmr#ui" #define DRMR_UI_URI "http://github.com/AlkorZ3/drmr2#ui"
#define NO_KIT_STRING "[No Current Kit]" #define NO_KIT_STRING "[No Current Kit]"
typedef struct { typedef struct {
@ -51,13 +51,16 @@ typedef struct {
GtkListStore *kit_store; GtkListStore *kit_store;
GtkWidget** gain_sliders; GtkWidget** gain_sliders;
GtkWidget** pan_sliders; GtkWidget** pan_sliders;
GtkWidget** notify_leds;
GtkWidget *channel_combo_box, *position_combo_box, *velocity_checkbox, *note_off_checkbox;
GtkScrolledWindow *sample_view;
float *gain_vals,*pan_vals; float *gain_vals,*pan_vals;
GtkWidget** notify_leds;
GtkWidget *position_combo_box, *velocity_checkbox, *note_off_checkbox;
gchar *bundle_path; gchar *bundle_path;
int channel;
int cols; int cols;
int startSamp; int startSamp;
@ -358,9 +361,7 @@ static gboolean kit_callback(gpointer data) {
gain_sliders = malloc(samples*sizeof(GtkWidget*)); gain_sliders = malloc(samples*sizeof(GtkWidget*));
pan_sliders = malloc(samples*sizeof(GtkWidget*)); pan_sliders = malloc(samples*sizeof(GtkWidget*));
fill_sample_table(ui,samples,ui->kits->kits[ui->kitReq].sample_names,notify_leds,gain_sliders,pan_sliders); fill_sample_table(ui,samples,ui->kits->kits[ui->kitReq].sample_names,notify_leds,gain_sliders,pan_sliders);
gtk_box_pack_start(GTK_BOX(ui->drmr_widget),GTK_WIDGET(ui->sample_table), gtk_scrolled_window_add_with_viewport(ui->sample_view, GTK_WIDGET(ui->sample_table));
true,true,5);
gtk_box_reorder_child(GTK_BOX(ui->drmr_widget),GTK_WIDGET(ui->sample_table),1);
gtk_widget_show_all(GTK_WIDGET(ui->sample_table)); gtk_widget_show_all(GTK_WIDGET(ui->sample_table));
ui->samples = samples; ui->samples = samples;
ui->notify_leds = notify_leds; ui->notify_leds = notify_leds;
@ -417,10 +418,63 @@ static void kit_combobox_changed(GtkComboBox* box, gpointer data) {
} }
} }
static void channel_data(DrMrUi *ui, gpointer data) {
lv2_atom_forge_property_head(&ui->forge, ui->uris.channel_nb,0);
lv2_atom_forge_int(&ui->forge, GPOINTER_TO_INT(data));
}
static void channel_combobox_changed(GtkComboBox* box, gpointer data) {
DrMrUi* ui = (DrMrUi*)data;
gint channel = gtk_combo_box_get_active (GTK_COMBO_BOX(box));
printf( "Channel Change: [%d]\n", channel);
if (channel != ui->channel) {
ui->channel = channel;
ui->forceUpdate = true;
kit_callback(ui);
send_ui_msg(ui,&channel_data,GINT_TO_POINTER(channel));
}
}
static GtkWidget *create_channel_combo(void)
{
GtkWidget *combo;
GtkListStore *list_store;
GtkCellRenderer *cell;
GtkTreeIter iter;
int i;
char label[8];
list_store = gtk_list_store_new(1, G_TYPE_STRING);
gtk_list_store_append(list_store, &iter);
gtk_list_store_set (list_store, &iter, 0, "Omni", -1);
for( i = 1; i <= 16; i++) {
sprintf( label, "%02d", i);
gtk_list_store_append(list_store, &iter);
gtk_list_store_set (list_store, &iter, 0, label, -1);
}
combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(list_store));
gtk_combo_box_set_active(GTK_COMBO_BOX(combo),0);
g_object_unref(list_store);
cell = gtk_cell_renderer_text_new();
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), cell, TRUE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), cell, "text", 0, NULL);
return combo;
}
static void position_data(DrMrUi *ui, gpointer data) { static void position_data(DrMrUi *ui, gpointer data) {
lv2_atom_forge_property_head(&ui->forge, ui->uris.zero_position,0); lv2_atom_forge_property_head(&ui->forge, ui->uris.zero_position,0);
lv2_atom_forge_int(&ui->forge, GPOINTER_TO_INT(data)); lv2_atom_forge_int(&ui->forge, GPOINTER_TO_INT(data));
} }
static void position_combobox_changed(GtkComboBox* box, gpointer data) { static void position_combobox_changed(GtkComboBox* box, gpointer data) {
DrMrUi* ui = (DrMrUi*)data; DrMrUi* ui = (DrMrUi*)data;
gint ss = gtk_combo_box_get_active (GTK_COMBO_BOX(box)); gint ss = gtk_combo_box_get_active (GTK_COMBO_BOX(box));
@ -458,7 +512,6 @@ static GtkWidget *create_position_combo(void)
gtk_combo_box_set_active(GTK_COMBO_BOX(combo),0); gtk_combo_box_set_active(GTK_COMBO_BOX(combo),0);
#endif #endif
g_object_unref(list_store); g_object_unref(list_store);
cell = gtk_cell_renderer_text_new(); cell = gtk_cell_renderer_text_new();
@ -510,7 +563,7 @@ static void build_drmr_ui(DrMrUi* ui) {
GtkWidget *drmr_ui_widget; GtkWidget *drmr_ui_widget;
GtkWidget *opts_hbox1, *opts_hbox2, GtkWidget *opts_hbox1, *opts_hbox2,
*kit_combo_box, *kit_label, *no_kit_label, *kit_combo_box, *kit_label, *no_kit_label,
*base_label, *base_spin, *position_label; *base_label, *base_spin, *channel_label, *position_label, *sample_view;
GtkCellRenderer *cell_rend; GtkCellRenderer *cell_rend;
GtkAdjustment *base_adj; GtkAdjustment *base_adj;
@ -551,6 +604,9 @@ static void build_drmr_ui(DrMrUi* ui) {
5.0,0.0)); // page adj/size 5.0,0.0)); // page adj/size
base_spin = gtk_spin_button_new(base_adj, 1.0, 0); base_spin = gtk_spin_button_new(base_adj, 1.0, 0);
channel_label = gtk_label_new("Midi Channel: ");
ui->channel_combo_box = create_channel_combo();
position_label = gtk_label_new("Sample Zero Position: "); position_label = gtk_label_new("Sample Zero Position: ");
ui->position_combo_box = create_position_combo(); ui->position_combo_box = create_position_combo();
@ -568,6 +624,10 @@ static void build_drmr_ui(DrMrUi* ui) {
gtk_box_pack_start(GTK_BOX(opts_hbox1),base_spin, gtk_box_pack_start(GTK_BOX(opts_hbox1),base_spin,
true,true,0); true,true,0);
gtk_box_pack_start(GTK_BOX(opts_hbox2),channel_label,
false,false,15);
gtk_box_pack_start(GTK_BOX(opts_hbox2),ui->channel_combo_box,
false,false,0);
gtk_box_pack_start(GTK_BOX(opts_hbox2),position_label, gtk_box_pack_start(GTK_BOX(opts_hbox2),position_label,
false,false,15); false,false,15);
gtk_box_pack_start(GTK_BOX(opts_hbox2),ui->position_combo_box, gtk_box_pack_start(GTK_BOX(opts_hbox2),ui->position_combo_box,
@ -579,14 +639,20 @@ static void build_drmr_ui(DrMrUi* ui) {
gtk_box_pack_start(GTK_BOX(drmr_ui_widget),GTK_WIDGET(ui->current_kit_label), gtk_box_pack_start(GTK_BOX(drmr_ui_widget),GTK_WIDGET(ui->current_kit_label),
false,false,5); false,false,5);
gtk_box_pack_start(GTK_BOX(drmr_ui_widget),gtk_hseparator_new(),
false,false,5);
gtk_box_pack_start(GTK_BOX(drmr_ui_widget),opts_hbox1, gtk_box_pack_start(GTK_BOX(drmr_ui_widget),opts_hbox1,
false,false,5); false,false,5);
gtk_box_pack_start(GTK_BOX(drmr_ui_widget),opts_hbox2, gtk_box_pack_start(GTK_BOX(drmr_ui_widget),opts_hbox2,
false,false,5); false,false,5);
gtk_box_pack_start(GTK_BOX(drmr_ui_widget),gtk_hseparator_new(),
false,false,5);
sample_view = gtk_scrolled_window_new(NULL, NULL);
gtk_widget_set_size_request(sample_view, -1, 300);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sample_view),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_box_pack_start(GTK_BOX(drmr_ui_widget), sample_view,
true, true, 5);
ui->drmr_widget = drmr_ui_widget; ui->drmr_widget = drmr_ui_widget;
ui->sample_table = NULL; ui->sample_table = NULL;
@ -594,9 +660,11 @@ static void build_drmr_ui(DrMrUi* ui) {
ui->base_label = GTK_LABEL(base_label); ui->base_label = GTK_LABEL(base_label);
ui->base_spin = GTK_SPIN_BUTTON(base_spin); ui->base_spin = GTK_SPIN_BUTTON(base_spin);
ui->no_kit_label = no_kit_label; ui->no_kit_label = no_kit_label;
ui->sample_view = GTK_SCROLLED_WINDOW(sample_view);
g_signal_connect(G_OBJECT(kit_combo_box),"changed",G_CALLBACK(kit_combobox_changed),ui); g_signal_connect(G_OBJECT(kit_combo_box),"changed",G_CALLBACK(kit_combobox_changed),ui);
g_signal_connect(G_OBJECT(base_spin),"value-changed",G_CALLBACK(base_changed),ui); g_signal_connect(G_OBJECT(base_spin),"value-changed",G_CALLBACK(base_changed),ui);
g_signal_connect(G_OBJECT(ui->channel_combo_box),"changed",G_CALLBACK(channel_combobox_changed),ui);
g_signal_connect(G_OBJECT(ui->position_combo_box),"changed",G_CALLBACK(position_combobox_changed),ui); g_signal_connect(G_OBJECT(ui->position_combo_box),"changed",G_CALLBACK(position_combobox_changed),ui);
g_signal_connect(G_OBJECT(ui->velocity_checkbox),"toggled",G_CALLBACK(ignore_velocity_toggled),ui); g_signal_connect(G_OBJECT(ui->velocity_checkbox),"toggled",G_CALLBACK(ignore_velocity_toggled),ui);
g_signal_connect(G_OBJECT(ui->note_off_checkbox),"toggled",G_CALLBACK(ignore_note_off_toggled),ui); g_signal_connect(G_OBJECT(ui->note_off_checkbox),"toggled",G_CALLBACK(ignore_note_off_toggled),ui);
@ -726,14 +794,18 @@ port_event(LV2UI_Handle handle,
if (!strncmp(kitpath, "file://", 7)) if (!strncmp(kitpath, "file://", 7))
kitpath += 7; kitpath += 7;
char *realp = realpath(kitpath,NULL); char *realp = realpath(kitpath,NULL);
// fprintf(stderr, "KitPath: [%s] RealPath: [%s]\n", kitpath, realp);
if (!realp) { if (!realp) {
fprintf(stderr,"Passed a path I can't resolve, bailing out\n"); fprintf(stderr,"Passed a path I can't resolve, bailing out\n");
return; return;
} }
int i; int i;
for(i = 0;i < ui->kits->num_kits;i++) for(i = 0;i < ui->kits->num_kits;i++)
{
// fprintf(stderr, "CheckPath: [%s] / [%s]\n", ui->kits->kits[i].path, realp);
if (!strcmp(ui->kits->kits[i].path,realp)) if (!strcmp(ui->kits->kits[i].path,realp))
break; break;
}
if (i < ui->kits->num_kits) { if (i < ui->kits->num_kits) {
ui->kitReq = i; ui->kitReq = i;
g_idle_add(kit_callback,ui); g_idle_add(kit_callback,ui);
@ -744,10 +816,12 @@ port_event(LV2UI_Handle handle,
if (obj->body.otype == ui->uris.get_state) { // read out extra state info if (obj->body.otype == ui->uris.get_state) { // read out extra state info
const LV2_Atom* ignvel = NULL; const LV2_Atom* ignvel = NULL;
const LV2_Atom* ignno = NULL; const LV2_Atom* ignno = NULL;
const LV2_Atom* channel_nb = NULL;
const LV2_Atom* zerop = NULL; const LV2_Atom* zerop = NULL;
lv2_atom_object_get(obj, lv2_atom_object_get(obj,
ui->uris.velocity_toggle, &ignvel, ui->uris.velocity_toggle, &ignvel,
ui->uris.note_off_toggle, &ignno, ui->uris.note_off_toggle, &ignno,
ui->uris.channel_nb, &channel_nb,
ui->uris.zero_position, &zerop, ui->uris.zero_position, &zerop,
0); 0);
if (ignvel) if (ignvel)
@ -756,6 +830,9 @@ port_event(LV2UI_Handle handle,
if (ignno) if (ignno)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ui->note_off_checkbox), gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ui->note_off_checkbox),
((const LV2_Atom_Bool*)ignno)->body); ((const LV2_Atom_Bool*)ignno)->body);
if (channel_nb)
gtk_combo_box_set_active(GTK_COMBO_BOX(ui->channel_combo_box),
((const LV2_Atom_Int*)channel_nb)->body);
if (zerop) if (zerop)
gtk_combo_box_set_active(GTK_COMBO_BOX(ui->position_combo_box), gtk_combo_box_set_active(GTK_COMBO_BOX(ui->position_combo_box),
((const LV2_Atom_Int*)zerop)->body); ((const LV2_Atom_Int*)zerop)->body);

View File

@ -1,5 +1,5 @@
@prefix lv2: <http://lv2plug.in/ns/lv2core#>. @prefix lv2: <http://lv2plug.in/ns/lv2core#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
<http://github.com/nicklan/drmr> <http://github.com/AlkorZ3/drmr2>
a lv2:Plugin; a lv2:Plugin;
rdfs:seeAlso <drmr.ttl>. rdfs:seeAlso <drmr2.ttl>.

View File

@ -1,12 +1,12 @@
/* nknob.c /* nknob.c
* LV2 DrMr plugin * LV2 DrMr2 plugin
* Copyright 2012 Nick Lanham <nick@afternight.org> * Copyright 2012 Nick Lanham <nick@afternight.org>
* *
* NKnob - A simplified version of phatknob that just is a new gui * NKnob - A simplified version of phatknob that just is a new gui
* over a GtkRange (i.e. it can be used exactly like a * over a GtkRange (i.e. it can be used exactly like a
* GtkRange from the outside) * GtkRange from the outside)
* *
* In addition, this knob makes the drmr_ui.so module memory resident * In addition, this knob makes the drmr2_ui.so module memory resident
* so it can avoid attempting to re-load itself when shown/hidden in * so it can avoid attempting to re-load itself when shown/hidden in
* a ui. * a ui.
* *

View File

@ -1,5 +1,5 @@
/* nknob.h /* nknob.h
* LV2 DrMr plugin * LV2 DrMr2 plugin
* Copyright 2012 Nick Lanham <nick@afternight.org> * Copyright 2012 Nick Lanham <nick@afternight.org>
* *
* NKnob - A simplified version of phatknob that just is a new gui * NKnob - A simplified version of phatknob that just is a new gui