diff options
-rw-r--r-- | gtk2_ardour/audio_clock.cc | 16 | ||||
-rw-r--r-- | gtk2_ardour/audio_streamview.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/audio_streamview.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/crossfade_edit.cc | 18 | ||||
-rw-r--r-- | gtk2_ardour/icons/crossfade_in_default.svg | 162 | ||||
-rw-r--r-- | gtk2_ardour/icons/crossfade_out_default.svg | 163 | ||||
-rw-r--r-- | libs/ardour/ardour/audioplaylist.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/audioregion.h | 21 | ||||
-rw-r--r-- | libs/ardour/ardour/automation_event.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/crossfade.h | 31 | ||||
-rw-r--r-- | libs/ardour/ardour/midi_region.h | 16 | ||||
-rw-r--r-- | libs/ardour/ardour/region.h | 13 | ||||
-rw-r--r-- | libs/ardour/audio_playlist.cc | 19 | ||||
-rw-r--r-- | libs/ardour/audioregion.cc | 53 | ||||
-rw-r--r-- | libs/ardour/crossfade.cc | 86 | ||||
-rw-r--r-- | libs/ardour/midi_playlist.cc | 4 | ||||
-rw-r--r-- | libs/ardour/midi_region.cc | 15 | ||||
-rw-r--r-- | libs/ardour/playlist.cc | 7 | ||||
-rw-r--r-- | libs/ardour/region.cc | 24 |
19 files changed, 526 insertions, 134 deletions
diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index 8c24f42998..d0e6b9ad76 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -1818,18 +1818,12 @@ AudioClock::build_ops_menu () ops_menu = new Menu; MenuList& ops_items = ops_menu->items(); ops_menu->set_name ("ArdourContextMenu"); - - Menu *mode_menu = manage (new Menu); - MenuList& mode_items = mode_menu->items(); - mode_menu->set_name ("ArdourContextMenu"); - mode_items.push_back (MenuElem (_("Timecode"), bind (mem_fun(*this, &AudioClock::set_mode), SMPTE))); - mode_items.push_back (MenuElem (_("Bars:Beats"), bind (mem_fun(*this, &AudioClock::set_mode), BBT))); - mode_items.push_back (MenuElem (_("Minutes:Seconds"), bind (mem_fun(*this, &AudioClock::set_mode), MinSec))); - mode_items.push_back (MenuElem (_("Audio Frames"), bind (mem_fun(*this, &AudioClock::set_mode), Frames))); - mode_items.push_back (MenuElem (_("Off"), bind (mem_fun(*this, &AudioClock::set_mode), Off))); - - ops_items.push_back (MenuElem (_("Mode"), *mode_menu)); + ops_items.push_back (MenuElem (_("Timecode"), bind (mem_fun(*this, &AudioClock::set_mode), SMPTE))); + ops_items.push_back (MenuElem (_("Bars:Beats"), bind (mem_fun(*this, &AudioClock::set_mode), BBT))); + ops_items.push_back (MenuElem (_("Minutes:Seconds"), bind (mem_fun(*this, &AudioClock::set_mode), MinSec))); + ops_items.push_back (MenuElem (_("Audio Frames"), bind (mem_fun(*this, &AudioClock::set_mode), Frames))); + ops_items.push_back (MenuElem (_("Off"), bind (mem_fun(*this, &AudioClock::set_mode), Off))); } void diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc index 4ca3ad38b9..09510e8d42 100644 --- a/gtk2_ardour/audio_streamview.cc +++ b/gtk2_ardour/audio_streamview.cc @@ -348,9 +348,11 @@ AudioStreamView::add_crossfade (boost::shared_ptr<Crossfade> crossfade) } void -AudioStreamView::remove_crossfade (boost::shared_ptr<Crossfade> xfade) +AudioStreamView::remove_crossfade (boost::shared_ptr<Region> r) { - ENSURE_GUI_THREAD (bind (mem_fun (*this, &AudioStreamView::remove_crossfade), xfade)); + ENSURE_GUI_THREAD (bind (mem_fun (*this, &AudioStreamView::remove_crossfade), r)); + + boost::shared_ptr<Crossfade> xfade = boost::dynamic_pointer_cast<Crossfade> (r); for (list<CrossfadeView*>::iterator i = crossfade_views.begin(); i != crossfade_views.end(); ++i) { if ((*i)->crossfade == xfade) { diff --git a/gtk2_ardour/audio_streamview.h b/gtk2_ardour/audio_streamview.h index fc707e97e7..0f51889ca2 100644 --- a/gtk2_ardour/audio_streamview.h +++ b/gtk2_ardour/audio_streamview.h @@ -95,7 +95,7 @@ class AudioStreamView : public StreamView void add_crossfade (boost::shared_ptr<ARDOUR::Crossfade>); void add_crossfade_weak (boost::weak_ptr<ARDOUR::Crossfade>); - void remove_crossfade (boost::shared_ptr<ARDOUR::Crossfade>); + void remove_crossfade (boost::shared_ptr<ARDOUR::Region>); void color_handler (ColorID id, uint32_t val); diff --git a/gtk2_ardour/crossfade_edit.cc b/gtk2_ardour/crossfade_edit.cc index 26d61035ba..ae63f8c6fa 100644 --- a/gtk2_ardour/crossfade_edit.cc +++ b/gtk2_ardour/crossfade_edit.cc @@ -882,6 +882,15 @@ CrossfadeEditor::build_presets () p->push_back (PresetPoint (1, 1)); fade_in_presets->push_back (p); + p = new Preset ("crossfade_in_default"); + p->push_back (PresetPoint (0, 0)); + p->push_back (PresetPoint (0.1, 0.01)); + p->push_back (PresetPoint (0.2, 0.03)); + p->push_back (PresetPoint (0.8, 0.97)); + p->push_back (PresetPoint (0.9, 0.99)); + p->push_back (PresetPoint (1, 1)); + fade_in_presets->push_back (p); + /* FADE OUT */ // p = new Preset ("hiout.xpm"); @@ -932,6 +941,15 @@ CrossfadeEditor::build_presets () p->push_back (PresetPoint (0, 1)); p->push_back (PresetPoint (1, 0)); fade_out_presets->push_back (p); + + p = new Preset ("crossfade_out_default"); + p->push_back (PresetPoint (0, 1)); + p->push_back (PresetPoint (0.1, 0.99)); + p->push_back (PresetPoint (0.2, 0.97)); + p->push_back (PresetPoint (0.8, 0.03)); + p->push_back (PresetPoint (0.9, 0.01)); + p->push_back (PresetPoint (1, 0)); + fade_out_presets->push_back (p); } void diff --git a/gtk2_ardour/icons/crossfade_in_default.svg b/gtk2_ardour/icons/crossfade_in_default.svg new file mode 100644 index 0000000000..35e4080aeb --- /dev/null +++ b/gtk2_ardour/icons/crossfade_in_default.svg @@ -0,0 +1,162 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://web.resource.org/cc/" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="25" + height="25" + id="svg2226" + sodipodi:version="0.32" + inkscape:version="0.45.1" + version="1.0" + sodipodi:docbase="/home/markus/src/ardour-contrib" + sodipodi:docname="crossfade_in_default.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape" + inkscape:export-filename="/home/markus/src/ardour-contrib/stdin.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"> + <defs + id="defs2228"> + <filter + inkscape:collect="always" + x="-0.15679207" + width="1.3135841" + y="-0.15023329" + height="1.3004666" + id="filter5448"> + <feGaussianBlur + inkscape:collect="always" + stdDeviation="1.3122991" + id="feGaussianBlur5450" /> + </filter> + <filter + inkscape:collect="always" + id="filter5468"> + <feGaussianBlur + inkscape:collect="always" + stdDeviation="0.13459478" + id="feGaussianBlur5470" /> + </filter> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="1" + inkscape:cx="16" + inkscape:cy="16" + inkscape:current-layer="layer1" + showgrid="true" + inkscape:grid-bbox="true" + inkscape:document-units="px" + width="25px" + height="25px" + inkscape:object-points="false" + inkscape:grid-points="true" + inkscape:window-width="980" + inkscape:window-height="881" + inkscape:window-x="106" + inkscape:window-y="23" /> + <metadata + id="metadata2231"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + id="layer1" + inkscape:label="Layer 1" + inkscape:groupmode="layer"> + <g + id="g5304" + style="filter:url(#filter5448)"> + <path + inkscape:export-ydpi="90" + inkscape:export-xdpi="90" + inkscape:export-filename="/home/markus/src/ardour-contrib/stdin.png" + sodipodi:nodetypes="ccccc" + id="path3364" + d="M 22,23.446516 C 20.874493,23.446516 11,23.535819 4,23.535819 C 15,23.428852 4.4939054,4 18,4 C 19.525085,4 20.324302,4 22,4 C 22,7.3981402 22,21.74689 22,23.446516 z " + style="fill:#236c99;fill-opacity:1;fill-rule:evenodd;stroke:#236c99;stroke-width:0.11291049;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + inkscape:export-ydpi="90" + inkscape:export-xdpi="90" + inkscape:export-filename="/home/markus/src/ardour-contrib/stdin.png" + sodipodi:nodetypes="cssc" + id="path2234" + d="M 4,22.464181 C 11.694787,22.464181 9.1135021,13.428978 10.97521,7.9992932 C 11.774887,5.6670305 13.394313,4 17,4 C 19.446516,4 23,4 21,4" + style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#0bb6c2;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:0.78289473;stroke-miterlimit:4;stroke-dasharray:none" /> + </g> + <image + y="-159.8214" + x="52.168793" + id="image2369" + height="24" + width="24" + sodipodi:absref="/sw/ardour2/gtk2_ardour/icons/crossfade_out_transition.png" + xlink:href="/sw/ardour2/gtk2_ardour/icons/crossfade_out_transition.png" /> + <path + id="path2386" + d="M 48.844104,-105.43559 C 47.952303,-105.79544 47.594104,-109.03758 47.594104,-116.74965 C 47.594104,-128.64018 47.666281,-128.77331 54.112997,-128.77331 C 57.381124,-128.77331 57.54141,-128.57504 60.281209,-121.14358 C 61.828301,-116.94723 64.54001,-111.92741 66.307228,-109.98842 C 68.074446,-108.04944 69.285389,-106.08281 68.998211,-105.61815 C 68.448145,-104.72812 50.989316,-104.56998 48.844104,-105.43559 z " + style="fill:#c6c9c9" /> + <path + id="path2384" + d="M 48.594104,-116.8281 L 48.594104,-127.88289 L 53.144306,-127.5781 L 57.694508,-127.27331 L 60.106961,-120.35371 C 61.68993,-115.81332 63.805457,-112.1171 66.259707,-109.60371 L 70,-105.77331 L 59.297052,-105.77331 L 48.594104,-105.77331 L 48.594104,-116.8281 z " + style="fill:#a1ced5" /> + <path + id="path2382" + d="M 48.67522,-115.07138 C 48.455846,-126.84011 48.810632,-127.77331 53.50426,-127.77331 L 57.200438,-127.77331 L 59.485444,-120.67859 C 60.942082,-116.15588 63.049503,-112.16812 65.29864,-109.67859 L 68.826829,-105.77331 L 58.837685,-105.77331 L 48.848541,-105.77331 L 48.67522,-115.07138 z " + style="fill:#98bdce" /> + <path + id="path2380" + d="M 49.810272,-116.52331 L 50.094104,-127.27331 L 53.722845,-127.57644 C 57.174233,-127.86477 57.384535,-127.70394 58.025766,-124.28589 C 59.080364,-118.6644 62.054291,-112.57323 65.477502,-109.02331 L 68.6115,-105.77331 L 59.06897,-105.77331 L 49.526441,-105.77331 L 49.810272,-116.52331 z " + style="fill:#78a8c1" /> + <path + id="path2378" + d="M 50.594104,-116.77331 L 50.594104,-127.77331 L 53.875996,-127.77331 C 56.623432,-127.77331 57.190416,-127.38029 57.357627,-125.35992 C 57.896234,-118.85205 63.823165,-108.01431 67.676363,-106.4915 C 68.45612,-106.18334 64.931604,-105.89568 59.844104,-105.85225 L 50.594104,-105.77331 L 50.594104,-116.77331 z " + style="fill:#5499b2" /> + <path + id="path2376" + d="M 6.742252,-196.77331 L 6.742252,-207.77331 L 9.334845,-207.77331 C 10.760771,-207.77331 11.652862,-207.49873 11.317271,-207.16314 C 10.42623,-206.2721 14.96346,-194.31743 17.718929,-190.29609 C 19.018178,-188.39996 20.984103,-186.66792 22.087652,-186.44713 C 23.191201,-186.22633 20.189937,-185.98439 15.418178,-185.90949 L 6.742252,-185.77331 L 6.742252,-196.77331 z " + style="fill:#2e8aa7" /> + <path + id="path2374" + d="M 58.066461,-166.38315 C 58.666254,-166.6342 58.938947,-170.60468 58.747841,-176.3042 C 58.485958,-184.11458 58.689241,-185.80669 59.889433,-185.80669 C 60.69255,-185.80669 61.645316,-184.56919 62.006691,-183.05669 C 63.169516,-178.18981 68.993201,-166.87499 70.553939,-166.45029 C 71.385826,-166.22391 68.691461,-166.02202 64.566461,-166.00164 C 60.441461,-165.98126 57.516461,-166.15294 58.066461,-166.38315 z " + style="fill:#27709b" /> + <g + id="g5342" + transform="translate(-0.2315996,-0.714181)" + style="filter:url(#filter5468)"> + <path + inkscape:export-ydpi="90" + inkscape:export-xdpi="90" + inkscape:export-filename="/home/markus/src/ardour-contrib/stdin.png" + sodipodi:nodetypes="ccccc" + id="path5344" + d="M 22,23.446516 C 20.874493,23.446516 11,23.535819 4,23.535819 C 15,23.428852 4.4939054,4 18,4 C 19.525085,4 20.324302,4 22,4 C 22,7.3981402 22,21.74689 22,23.446516 z " + style="fill:#236c99;fill-opacity:1;fill-rule:evenodd;stroke:#236c99;stroke-width:0.11291049;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + inkscape:export-ydpi="90" + inkscape:export-xdpi="90" + inkscape:export-filename="/home/markus/src/ardour-contrib/stdin.png" + sodipodi:nodetypes="cssc" + id="path5346" + d="M 4,22.464181 C 11.694787,22.464181 9.1135021,13.428978 10.97521,7.9992932 C 11.774887,5.6670305 13.394313,4 17,4 C 19.446516,4 23,4 21,4" + style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#0bb6c2;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.78289472" /> + </g> + </g> +</svg> diff --git a/gtk2_ardour/icons/crossfade_out_default.svg b/gtk2_ardour/icons/crossfade_out_default.svg new file mode 100644 index 0000000000..d2852eee50 --- /dev/null +++ b/gtk2_ardour/icons/crossfade_out_default.svg @@ -0,0 +1,163 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://web.resource.org/cc/" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="25" + height="25" + id="svg2226" + sodipodi:version="0.32" + inkscape:version="0.45.1" + version="1.0" + sodipodi:docbase="/home/markus/src/ardour-contrib" + sodipodi:docname="crossfade_out_default.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape" + inkscape:export-filename="/home/markus/src/ardour-contrib/crossfade_out_default.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"> + <defs + id="defs2228"> + <filter + inkscape:collect="always" + x="-0.15679207" + width="1.3135841" + y="-0.15023329" + height="1.3004666" + id="filter5448"> + <feGaussianBlur + inkscape:collect="always" + stdDeviation="1.3122991" + id="feGaussianBlur5450" /> + </filter> + <filter + inkscape:collect="always" + id="filter5468"> + <feGaussianBlur + inkscape:collect="always" + stdDeviation="0.13459478" + id="feGaussianBlur5470" /> + </filter> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="1" + inkscape:cx="16" + inkscape:cy="16" + inkscape:current-layer="layer1" + showgrid="true" + inkscape:grid-bbox="true" + inkscape:document-units="px" + width="25px" + height="25px" + inkscape:object-points="false" + inkscape:grid-points="true" + inkscape:window-width="980" + inkscape:window-height="881" + inkscape:window-x="59" + inkscape:window-y="0" /> + <metadata + id="metadata2231"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + id="layer1" + inkscape:label="Layer 1" + inkscape:groupmode="layer"> + <g + id="g5304" + style="filter:url(#filter5448)" + transform="matrix(-1,0,0,1,25.355627,0)"> + <path + inkscape:export-ydpi="90" + inkscape:export-xdpi="90" + inkscape:export-filename="/home/markus/src/ardour-contrib/stdin.png" + sodipodi:nodetypes="ccccc" + id="path3364" + d="M 22,23.446516 C 20.874493,23.446516 11,23.535819 4,23.535819 C 15,23.428852 4.4939054,4 18,4 C 19.525085,4 20.324302,4 22,4 C 22,7.3981402 22,21.74689 22,23.446516 z " + style="fill:#236c99;fill-opacity:1;fill-rule:evenodd;stroke:#236c99;stroke-width:0.11291049;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + inkscape:export-ydpi="90" + inkscape:export-xdpi="90" + inkscape:export-filename="/home/markus/src/ardour-contrib/stdin.png" + sodipodi:nodetypes="cssc" + id="path2234" + d="M 4,22.464181 C 11.694787,22.464181 9.1135021,13.428978 10.97521,7.9992932 C 11.774887,5.6670305 13.394313,4 17,4 C 19.446516,4 23,4 21,4" + style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#0bb6c2;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.78289472" /> + </g> + <image + y="-159.8214" + x="52.168793" + id="image2369" + height="24" + width="24" + sodipodi:absref="/sw/ardour2/gtk2_ardour/icons/crossfade_out_transition.png" + xlink:href="/sw/ardour2/gtk2_ardour/icons/crossfade_out_transition.png" /> + <path + id="path2386" + d="M 48.844104,-105.43559 C 47.952303,-105.79544 47.594104,-109.03758 47.594104,-116.74965 C 47.594104,-128.64018 47.666281,-128.77331 54.112997,-128.77331 C 57.381124,-128.77331 57.54141,-128.57504 60.281209,-121.14358 C 61.828301,-116.94723 64.54001,-111.92741 66.307228,-109.98842 C 68.074446,-108.04944 69.285389,-106.08281 68.998211,-105.61815 C 68.448145,-104.72812 50.989316,-104.56998 48.844104,-105.43559 z " + style="fill:#c6c9c9" /> + <path + id="path2384" + d="M 48.594104,-116.8281 L 48.594104,-127.88289 L 53.144306,-127.5781 L 57.694508,-127.27331 L 60.106961,-120.35371 C 61.68993,-115.81332 63.805457,-112.1171 66.259707,-109.60371 L 70,-105.77331 L 59.297052,-105.77331 L 48.594104,-105.77331 L 48.594104,-116.8281 z " + style="fill:#a1ced5" /> + <path + id="path2382" + d="M 48.67522,-115.07138 C 48.455846,-126.84011 48.810632,-127.77331 53.50426,-127.77331 L 57.200438,-127.77331 L 59.485444,-120.67859 C 60.942082,-116.15588 63.049503,-112.16812 65.29864,-109.67859 L 68.826829,-105.77331 L 58.837685,-105.77331 L 48.848541,-105.77331 L 48.67522,-115.07138 z " + style="fill:#98bdce" /> + <path + id="path2380" + d="M 49.810272,-116.52331 L 50.094104,-127.27331 L 53.722845,-127.57644 C 57.174233,-127.86477 57.384535,-127.70394 58.025766,-124.28589 C 59.080364,-118.6644 62.054291,-112.57323 65.477502,-109.02331 L 68.6115,-105.77331 L 59.06897,-105.77331 L 49.526441,-105.77331 L 49.810272,-116.52331 z " + style="fill:#78a8c1" /> + <path + id="path2378" + d="M 50.594104,-116.77331 L 50.594104,-127.77331 L 53.875996,-127.77331 C 56.623432,-127.77331 57.190416,-127.38029 57.357627,-125.35992 C 57.896234,-118.85205 63.823165,-108.01431 67.676363,-106.4915 C 68.45612,-106.18334 64.931604,-105.89568 59.844104,-105.85225 L 50.594104,-105.77331 L 50.594104,-116.77331 z " + style="fill:#5499b2" /> + <path + id="path2376" + d="M 6.742252,-196.77331 L 6.742252,-207.77331 L 9.334845,-207.77331 C 10.760771,-207.77331 11.652862,-207.49873 11.317271,-207.16314 C 10.42623,-206.2721 14.96346,-194.31743 17.718929,-190.29609 C 19.018178,-188.39996 20.984103,-186.66792 22.087652,-186.44713 C 23.191201,-186.22633 20.189937,-185.98439 15.418178,-185.90949 L 6.742252,-185.77331 L 6.742252,-196.77331 z " + style="fill:#2e8aa7" /> + <path + id="path2374" + d="M 58.066461,-166.38315 C 58.666254,-166.6342 58.938947,-170.60468 58.747841,-176.3042 C 58.485958,-184.11458 58.689241,-185.80669 59.889433,-185.80669 C 60.69255,-185.80669 61.645316,-184.56919 62.006691,-183.05669 C 63.169516,-178.18981 68.993201,-166.87499 70.553939,-166.45029 C 71.385826,-166.22391 68.691461,-166.02202 64.566461,-166.00164 C 60.441461,-165.98126 57.516461,-166.15294 58.066461,-166.38315 z " + style="fill:#27709b" /> + <g + id="g5342" + transform="matrix(-1,0,0,1,25.587227,-0.714181)" + style="filter:url(#filter5468)"> + <path + inkscape:export-ydpi="90" + inkscape:export-xdpi="90" + inkscape:export-filename="/home/markus/src/ardour-contrib/stdin.png" + sodipodi:nodetypes="ccccc" + id="path5344" + d="M 22,23.446516 C 20.874493,23.446516 11,23.535819 4,23.535819 C 15,23.428852 4.4939054,4 18,4 C 19.525085,4 20.324302,4 22,4 C 22,7.3981402 22,21.74689 22,23.446516 z " + style="fill:#236c99;fill-opacity:1;fill-rule:evenodd;stroke:#236c99;stroke-width:0.11291049;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + inkscape:export-ydpi="90" + inkscape:export-xdpi="90" + inkscape:export-filename="/home/markus/src/ardour-contrib/stdin.png" + sodipodi:nodetypes="cssc" + id="path5346" + d="M 4,22.464181 C 11.694787,22.464181 9.1135021,13.428978 10.97521,7.9992932 C 11.774887,5.6670305 13.394313,4 17,4 C 19.446516,4 23,4 21,4" + style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#0bb6c2;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.78289472" /> + </g> + </g> +</svg> diff --git a/libs/ardour/ardour/audioplaylist.h b/libs/ardour/ardour/audioplaylist.h index 39f41d5d1c..4acbc9ad51 100644 --- a/libs/ardour/ardour/audioplaylist.h +++ b/libs/ardour/ardour/audioplaylist.h @@ -75,7 +75,7 @@ class AudioPlaylist : public ARDOUR::Playlist Crossfades _crossfades; Crossfades _pending_xfade_adds; - void crossfade_invalidated (boost::shared_ptr<Crossfade>); + void crossfade_invalidated (boost::shared_ptr<Region>); XMLNode& state (bool full_state); void dump () const; diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index ccc0d82f2a..f844d45ef1 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -77,14 +77,14 @@ class AudioRegion : public Region virtual nframes_t read_at (Sample *buf, Sample *mixdown_buf, float *gain_buf, nframes_t position, nframes_t cnt, - uint32_t chan_n = 0, - nframes_t read_frames = 0, - nframes_t skip_frames = 0) const; + uint32_t chan_n = 0) const; virtual nframes_t master_read_at (Sample *buf, Sample *mixdown_buf, float *gain_buf, nframes_t position, nframes_t cnt, uint32_t chan_n=0) const; + virtual nframes_t read_raw_internal (Sample*, nframes_t, nframes_t) const; + XMLNode& state (bool); int set_state (const XMLNode&); @@ -137,11 +137,11 @@ class AudioRegion : public Region AudioRegion (boost::shared_ptr<AudioSource>, nframes_t start, nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags); AudioRegion (SourceList &, nframes_t start, nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags); AudioRegion (boost::shared_ptr<const AudioRegion>, nframes_t start, nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags); - AudioRegion (boost::shared_ptr<const AudioRegion>); AudioRegion (boost::shared_ptr<AudioSource>, const XMLNode&); AudioRegion (SourceList &, const XMLNode&); private: + void init (); void set_default_fades (); void set_default_fade_in (); void set_default_fade_out (); @@ -150,10 +150,8 @@ class AudioRegion : public Region void recompute_gain_at_start (); nframes_t _read_at (const SourceList&, Sample *buf, Sample *mixdown_buffer, - float *gain_buffer, nframes_t position, nframes_t cnt, - uint32_t chan_n = 0, - nframes_t read_frames = 0, - nframes_t skip_frames = 0) const; + float *gain_buffer, nframes_t position, nframes_t cnt, + uint32_t chan_n = 0) const; void recompute_at_start (); void recompute_at_end (); @@ -174,6 +172,11 @@ class AudioRegion : public Region uint32_t _fade_out_disabled; protected: + /* default constructor for derived (compound) types */ + + AudioRegion (nframes_t, nframes_t, std::string name); + AudioRegion (boost::shared_ptr<const AudioRegion>); + int set_live_state (const XMLNode&, Change&, bool send); virtual bool verify_start (nframes_t); @@ -182,8 +185,6 @@ class AudioRegion : public Region virtual bool verify_length (nframes_t); /*virtual void recompute_at_start () = 0; virtual void recompute_at_end () = 0;*/ - - virtual nframes_t read_raw_internal (Sample*, nframes_t, nframes_t) const; }; } /* namespace ARDOUR */ diff --git a/libs/ardour/ardour/automation_event.h b/libs/ardour/ardour/automation_event.h index 007bad7259..5a9792c11d 100644 --- a/libs/ardour/ardour/automation_event.h +++ b/libs/ardour/ardour/automation_event.h @@ -199,7 +199,7 @@ class AutomationList : public PBD::StatefulDestructible std::pair<AutomationList::iterator,AutomationList::iterator> range; }; - LookupCache lookup_cache; + mutable LookupCache lookup_cache; AutoState _state; AutoStyle _style; diff --git a/libs/ardour/ardour/crossfade.h b/libs/ardour/ardour/crossfade.h index 7346e645fb..61a30f1c0f 100644 --- a/libs/ardour/ardour/crossfade.h +++ b/libs/ardour/ardour/crossfade.h @@ -23,7 +23,6 @@ #include <vector> #include <algorithm> #include <boost/shared_ptr.hpp> -#include <boost/enable_shared_from_this.hpp> #include <sigc++/signal.h> @@ -40,7 +39,7 @@ namespace ARDOUR { class AudioRegion; class Playlist; -class Crossfade : public PBD::StatefulDestructible, public boost::enable_shared_from_this<ARDOUR::Crossfade> +class Crossfade : public ARDOUR::AudioRegion { public: @@ -66,7 +65,7 @@ class Crossfade : public PBD::StatefulDestructible, public boost::enable_shared_ /* copy constructor to copy a crossfade with new regions. used (for example) when a playlist copy is made */ - Crossfade (const Crossfade &, boost::shared_ptr<ARDOUR::AudioRegion>, boost::shared_ptr<ARDOUR::AudioRegion>); + Crossfade (boost::shared_ptr<Crossfade>, boost::shared_ptr<ARDOUR::AudioRegion>, boost::shared_ptr<ARDOUR::AudioRegion>); /* the usual XML constructor */ @@ -82,10 +81,8 @@ class Crossfade : public PBD::StatefulDestructible, public boost::enable_shared_ boost::shared_ptr<ARDOUR::AudioRegion> out() const { return _out; } nframes_t read_at (Sample *buf, Sample *mixdown_buffer, - float *gain_buffer, nframes_t position, nframes_t cnt, - uint32_t chan_n, - nframes_t read_frames = 0, - nframes_t skip_frames = 0); + float *gain_buffer, nframes_t position, nframes_t cnt, + uint32_t chan_n) const; bool refresh (); @@ -105,13 +102,11 @@ class Crossfade : public PBD::StatefulDestructible, public boost::enable_shared_ return (_in == a && _out == b) || (_in == b && _out == a); } - nframes_t length() const { return _length; } nframes_t overlap_length() const; - nframes_t position() const { return _position; } void invalidate(); - sigc::signal<void,boost::shared_ptr<Crossfade> > Invalidated; + sigc::signal<void,boost::shared_ptr<Region> > Invalidated; sigc::signal<void,Change> StateChanged; bool covers (nframes_t frame) const { @@ -133,6 +128,11 @@ class Crossfade : public PBD::StatefulDestructible, public boost::enable_shared_ Curve& fade_out() { return _fade_out; } nframes_t set_length (nframes_t); + + bool is_dependent() const { return true; } + bool depends_on (boost::shared_ptr<Region> other) const { + return other == _in || other == _out; + } static nframes_t short_xfade_length() { return _short_xfade_length; } static void set_short_xfade_length (nframes_t n); @@ -151,14 +151,14 @@ class Crossfade : public PBD::StatefulDestructible, public boost::enable_shared_ bool _active; bool _in_update; OverlapType overlap_type; - nframes_t _length; - nframes_t _position; AnchorPoint _anchor_point; bool _follow_overlap; bool _fixed; int32_t layer_relation; - Curve _fade_in; - Curve _fade_out; + + + mutable Curve _fade_in; + mutable Curve _fade_out; static Sample* crossfade_buffer_out; static Sample* crossfade_buffer_in; @@ -166,6 +166,9 @@ class Crossfade : public PBD::StatefulDestructible, public boost::enable_shared_ void initialize (); int compute (boost::shared_ptr<ARDOUR::AudioRegion>, boost::shared_ptr<ARDOUR::AudioRegion>, CrossfadeModel); bool update (); + + protected: + nframes_t read_raw_internal (Sample*, nframes_t, nframes_t) const; }; diff --git a/libs/ardour/ardour/midi_region.h b/libs/ardour/ardour/midi_region.h index 200599541e..2b783a92a8 100644 --- a/libs/ardour/ardour/midi_region.h +++ b/libs/ardour/ardour/midi_region.h @@ -51,11 +51,9 @@ class MidiRegion : public Region boost::shared_ptr<MidiSource> midi_source (uint32_t n=0) const; nframes_t read_at (MidiRingBuffer& dst, - nframes_t position, - nframes_t dur, - uint32_t chan_n = 0, - nframes_t read_frames = 0, - nframes_t skip_frames = 0) const; + nframes_t position, + nframes_t dur, + uint32_t chan_n = 0) const; nframes_t master_read_at (MidiRingBuffer& dst, nframes_t position, @@ -85,11 +83,9 @@ class MidiRegion : public Region private: nframes_t _read_at (const SourceList&, MidiRingBuffer& dst, - nframes_t position, - nframes_t dur, - uint32_t chan_n = 0, - nframes_t read_frames = 0, - nframes_t skip_frames = 0) const; + nframes_t position, + nframes_t dur, + uint32_t chan_n = 0) const; void recompute_at_start (); void recompute_at_end (); diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index 64d4ee1d83..c3aac3dfa8 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -177,7 +177,9 @@ class Region : public PBD::StatefulDestructible, public boost::enable_shared_fro uint32_t n_channels() const { return _sources.size(); } std::vector<string> master_source_names(); - + + const SourceList& sources() const { return _sources; } + const SourceList& master_sources() const { return _master_sources; } /* serialization */ @@ -191,6 +193,9 @@ class Region : public PBD::StatefulDestructible, public boost::enable_shared_fro uint64_t last_layer_op() const { return _last_layer_op; } void set_last_layer_op (uint64_t when); + virtual bool is_dependent() const { return false; } + virtual bool depends_on (boost::shared_ptr<Region> other) const { return false; } + protected: friend class RegionFactory; @@ -204,6 +209,10 @@ class Region : public PBD::StatefulDestructible, public boost::enable_shared_fro Region (boost::shared_ptr<Source> src, const XMLNode&); Region (SourceList& srcs, const XMLNode&); + /* this one is for derived types of derived types */ + + Region (nframes_t start, nframes_t length, const string& name, DataType, layer_t = 0, Flag flags = DefaultFlags); + protected: XMLNode& get_short_state (); /* used only by Session */ @@ -221,9 +230,7 @@ class Region : public PBD::StatefulDestructible, public boost::enable_shared_fro virtual bool verify_length (nframes_t); virtual void recompute_at_start () = 0; virtual void recompute_at_end () = 0; - - PBD::ID _id; string _name; DataType _type; Flag _flags; diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc index 929101fe6d..246384689e 100644 --- a/libs/ardour/audio_playlist.cc +++ b/libs/ardour/audio_playlist.cc @@ -79,7 +79,7 @@ AudioPlaylist::AudioPlaylist (boost::shared_ptr<const AudioPlaylist> other, stri if ((*xfades)->out() == ar2) { boost::shared_ptr<AudioRegion>in = boost::dynamic_pointer_cast<AudioRegion>(*in_n); boost::shared_ptr<AudioRegion>out = boost::dynamic_pointer_cast<AudioRegion>(*out_n); - boost::shared_ptr<Crossfade> new_fade = boost::shared_ptr<Crossfade> (new Crossfade (*(*xfades), in, out)); + boost::shared_ptr<Crossfade> new_fade = boost::shared_ptr<Crossfade> (new Crossfade (*xfades, in, out)); add_crossfade(new_fade); break; } @@ -125,8 +125,6 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, nf { nframes_t ret = cnt; nframes_t end; - nframes_t read_frames; - nframes_t skip_frames; /* optimizing this memset() away involves a lot of conditionals that may well cause more of a hit due to cache misses @@ -151,8 +149,6 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, nf end = start + cnt - 1; - read_frames = 0; - skip_frames = 0; _read_data_count = 0; map<uint32_t,vector<boost::shared_ptr<Region> > > relevant_regions; @@ -191,7 +187,7 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, nf for (vector<boost::shared_ptr<Region> >::iterator i = r.begin(); i != r.end(); ++i) { boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion>(*i); assert(ar); - ar->read_at (buf, mixdown_buffer, gain_buffer, start, cnt, chan_n, read_frames, skip_frames); + ar->read_at (buf, mixdown_buffer, gain_buffer, start, cnt, chan_n); _read_data_count += ar->read_data_count(); } @@ -309,19 +305,19 @@ AudioPlaylist::finalize_split_region (boost::shared_ptr<Region> o, boost::shared if ((*x)->_in == orig) { if (! (*x)->covers(right->position())) { - fade = boost::shared_ptr<Crossfade> (new Crossfade (**x, left, (*x)->_out)); + fade = boost::shared_ptr<Crossfade> (new Crossfade (*x, left, (*x)->_out)); } else { // Overlap, the crossfade is copied on the left side of the right region instead - fade = boost::shared_ptr<Crossfade> (new Crossfade (**x, right, (*x)->_out)); + fade = boost::shared_ptr<Crossfade> (new Crossfade (*x, right, (*x)->_out)); } } if ((*x)->_out == orig) { if (! (*x)->covers(right->position())) { - fade = boost::shared_ptr<Crossfade> (new Crossfade (**x, (*x)->_in, right)); + fade = boost::shared_ptr<Crossfade> (new Crossfade (*x, (*x)->_in, right)); } else { // Overlap, the crossfade is copied on the right side of the left region instead - fade = boost::shared_ptr<Crossfade> (new Crossfade (**x, (*x)->_in, left)); + fade = boost::shared_ptr<Crossfade> (new Crossfade (*x, (*x)->_in, left)); } } @@ -478,9 +474,10 @@ void AudioPlaylist::notify_crossfade_added (boost::shared_ptr<Crossfade> x) } void -AudioPlaylist::crossfade_invalidated (boost::shared_ptr<Crossfade> xfade) +AudioPlaylist::crossfade_invalidated (boost::shared_ptr<Region> r) { Crossfades::iterator i; + boost::shared_ptr<Crossfade> xfade = boost::dynamic_pointer_cast<Crossfade> (r); xfade->in()->resume_fade_in (); xfade->out()->resume_fade_out (); diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index 09fe669867..55a1879726 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -59,6 +59,27 @@ Change AudioRegion::EnvelopeActiveChanged = ARDOUR::new_change(); Change AudioRegion::ScaleAmplitudeChanged = ARDOUR::new_change(); Change AudioRegion::EnvelopeChanged = ARDOUR::new_change(); +void +AudioRegion::init () +{ + _scale_amplitude = 1.0; + + set_default_fades (); + set_default_envelope (); + + listen_to_my_curves (); +} + +/* constructor for use by derived types only */ +AudioRegion::AudioRegion (nframes_t start, nframes_t length, string name) + : Region (start, length, name, DataType::AUDIO), + _fade_in (0.0, 2.0, 1.0, false), + _fade_out (0.0, 2.0, 1.0, false), + _envelope (0.0, 2.0, 1.0, false) +{ + init (); +} + /** Basic AudioRegion constructor (one channel) */ AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, nframes_t start, nframes_t length) : Region (src, start, length, PBD::basename_nosuffix(src->name()), DataType::AUDIO, 0, Region::Flag(Region::DefaultFlags|Region::External)), @@ -71,12 +92,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, nframes_t start, n afs->HeaderPositionOffsetChanged.connect (mem_fun (*this, &AudioRegion::source_offset_changed)); } - _scale_amplitude = 1.0; - - set_default_fades (); - set_default_envelope (); - - listen_to_my_curves (); + init (); } /* Basic AudioRegion constructor (one channel) */ @@ -91,12 +107,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, nframes_t start, n afs->HeaderPositionOffsetChanged.connect (mem_fun (*this, &AudioRegion::source_offset_changed)); } - _scale_amplitude = 1.0; - - set_default_fades (); - set_default_envelope (); - - listen_to_my_curves (); + init (); } /* Basic AudioRegion constructor (many channels) */ @@ -106,12 +117,7 @@ AudioRegion::AudioRegion (SourceList& srcs, nframes_t start, nframes_t length, c , _fade_out (0.0, 2.0, 1.0, false) , _envelope (0.0, 2.0, 1.0, false) { - _scale_amplitude = 1.0; - - set_default_fades (); - set_default_envelope (); - - listen_to_my_curves (); + init (); } @@ -308,24 +314,21 @@ AudioRegion::read_peaks (PeakData *buf, nframes_t npeaks, nframes_t offset, nfra } ARDOUR::nframes_t -AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, nframes_t position, - nframes_t cnt, - uint32_t chan_n, nframes_t read_frames, nframes_t skip_frames) const +AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, nframes_t position, nframes_t cnt, uint32_t chan_n) const { - return _read_at (_sources, buf, mixdown_buffer, gain_buffer, position, cnt, chan_n, read_frames, skip_frames); + return _read_at (_sources, buf, mixdown_buffer, gain_buffer, position, cnt, chan_n); } ARDOUR::nframes_t AudioRegion::master_read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, nframes_t position, nframes_t cnt, uint32_t chan_n) const { - return _read_at (_master_sources, buf, mixdown_buffer, gain_buffer, position, cnt, chan_n, 0, 0); + return _read_at (_master_sources, buf, mixdown_buffer, gain_buffer, position, cnt, chan_n); } ARDOUR::nframes_t AudioRegion::_read_at (const SourceList& srcs, Sample *buf, Sample *mixdown_buffer, float *gain_buffer, - nframes_t position, nframes_t cnt, - uint32_t chan_n, nframes_t read_frames, nframes_t skip_frames) const + nframes_t position, nframes_t cnt, uint32_t chan_n) const { // cerr << _name << "._read_at(" << position << ") - " << _position << endl; diff --git a/libs/ardour/crossfade.cc b/libs/ardour/crossfade.cc index f142d57628..847741832d 100644 --- a/libs/ardour/crossfade.cc +++ b/libs/ardour/crossfade.cc @@ -28,6 +28,7 @@ #include <ardour/playlist.h> #include <ardour/utils.h> #include <ardour/session.h> +#include <ardour/source.h> #include "i18n.h" #include <locale.h> @@ -76,26 +77,26 @@ Crossfade::Crossfade (boost::shared_ptr<AudioRegion> in, boost::shared_ptr<Audio nframes_t length, nframes_t position, AnchorPoint ap) - : _fade_in (0.0, 2.0, 1.0), // linear (gain coefficient) => -inf..+6dB + : AudioRegion (position, length, "foobar"), + _fade_in (0.0, 2.0, 1.0), // linear (gain coefficient) => -inf..+6dB _fade_out (0.0, 2.0, 1.0) // linear (gain coefficient) => -inf..+6dB + { _in = in; _out = out; - _length = length; - _position = position; _anchor_point = ap; - _follow_overlap = false; _active = Config->get_xfades_active (); _fixed = true; - + initialize (); } Crossfade::Crossfade (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioRegion> b, CrossfadeModel model, bool act) - : _fade_in (0.0, 2.0, 1.0), // linear (gain coefficient) => -inf..+6dB + : AudioRegion (0, 0, "foobar"), + _fade_in (0.0, 2.0, 1.0), // linear (gain coefficient) => -inf..+6dB _fade_out (0.0, 2.0, 1.0) // linear (gain coefficient) => -inf..+6dB { _in_update = false; @@ -108,11 +109,15 @@ Crossfade::Crossfade (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioR _active = act; initialize (); + + } Crossfade::Crossfade (const Playlist& playlist, XMLNode& node) - : _fade_in (0.0, 2.0, 1.0), // linear (gain coefficient) => -inf..+6dB - _fade_out (0.0, 2.0, 1.0) // linear (gain coefficient) => -inf..+6dB + : AudioRegion (0, 0, "foobar"), + _fade_in (0.0, 2.0, 1.0), // linear (gain coefficient) => -inf..+6dB + _fade_out (0.0, 2.0, 1.0) // linear (gain coefficient) => -inf..+6dB + { boost::shared_ptr<Region> r; XMLProperty* prop; @@ -162,17 +167,16 @@ Crossfade::Crossfade (const Playlist& playlist, XMLNode& node) } } -Crossfade::Crossfade (const Crossfade &orig, boost::shared_ptr<AudioRegion> newin, boost::shared_ptr<AudioRegion> newout) - : _fade_in(orig._fade_in), - _fade_out(orig._fade_out) +Crossfade::Crossfade (boost::shared_ptr<Crossfade> orig, boost::shared_ptr<AudioRegion> newin, boost::shared_ptr<AudioRegion> newout) + : AudioRegion (boost::dynamic_pointer_cast<const AudioRegion> (orig)), + _fade_in (orig->_fade_in), + _fade_out (orig->_fade_out) { - _active = orig._active; - _in_update = orig._in_update; - _length = orig._length; - _position = orig._position; - _anchor_point = orig._anchor_point; - _follow_overlap = orig._follow_overlap; - _fixed = orig._fixed; + _active = orig->_active; + _in_update = orig->_in_update; + _anchor_point = orig->_anchor_point; + _follow_overlap = orig->_follow_overlap; + _fixed = orig->_fixed; _in = newin; _out = newout; @@ -199,6 +203,13 @@ Crossfade::~Crossfade () void Crossfade::initialize () { + /* merge source lists from regions */ + + _sources = _in->sources(); + _sources.insert (_sources.end(), _out->sources().begin(), _out->sources().end()); + _master_sources = _in->master_sources(); + _master_sources.insert(_master_sources.end(), _out->master_sources().begin(), _out->master_sources().end()); + _in_update = false; _out->suspend_fade_out (); @@ -229,9 +240,26 @@ Crossfade::initialize () } nframes_t +Crossfade::read_raw_internal (Sample* buf, nframes_t start, nframes_t cnt) const +{ +#if 0 + Sample* mixdown = new Sample[cnt]; + float* gain = new float[cnt]; + nframes_t ret; + + ret = read_at (buf, mixdown, gain, start, cnt, chan_n, cnt); + + delete [] mixdown; + delete [] gain; + + return ret; +#endif + return cnt; +} + +nframes_t Crossfade::read_at (Sample *buf, Sample *mixdown_buffer, - float *gain_buffer, nframes_t start, nframes_t cnt, uint32_t chan_n, - nframes_t read_frames, nframes_t skip_frames) + float *gain_buffer, nframes_t start, nframes_t cnt, uint32_t chan_n) const { nframes_t offset; nframes_t to_write; @@ -266,8 +294,8 @@ Crossfade::read_at (Sample *buf, Sample *mixdown_buffer, offset = start - _position; - _out->read_at (crossfade_buffer_out, mixdown_buffer, gain_buffer, start, to_write, chan_n, read_frames, skip_frames); - _in->read_at (crossfade_buffer_in, mixdown_buffer, gain_buffer, start, to_write, chan_n, read_frames, skip_frames); + _out->read_at (crossfade_buffer_out, mixdown_buffer, gain_buffer, start, to_write, chan_n); + _in->read_at (crossfade_buffer_in, mixdown_buffer, gain_buffer, start, to_write, chan_n); float* fiv = new float[to_write]; float* fov = new float[to_write]; @@ -326,7 +354,7 @@ Crossfade::refresh () /* crossfades must be between non-muted regions */ if (_out->muted() || _in->muted()) { - Invalidated (shared_from_this()); + Invalidated (shared_from_this ()); return false; } @@ -335,14 +363,14 @@ Crossfade::refresh () int32_t new_layer_relation = (int32_t) (_in->layer() - _out->layer()); if (new_layer_relation * layer_relation < 0) { // different sign, layers rotated - Invalidated (shared_from_this()); + Invalidated (shared_from_this ()); return false; } OverlapType ot = _in->coverage (_out->first_frame(), _out->last_frame()); if (ot == OverlapNone) { - Invalidated (shared_from_this()); + Invalidated (shared_from_this ()); return false; } @@ -357,7 +385,7 @@ Crossfade::refresh () } catch (NoCrossfadeHere& err) { - Invalidated (shared_from_this()); + Invalidated (shared_from_this ()); return false; } @@ -365,7 +393,7 @@ Crossfade::refresh () } else { - Invalidated (shared_from_this()); + Invalidated (shared_from_this ()); return false; } @@ -395,7 +423,7 @@ Crossfade::update () } if (newlen == 0) { - Invalidated (shared_from_this()); + Invalidated (shared_from_this ()); return false; } @@ -856,5 +884,5 @@ Crossfade::set_short_xfade_length (nframes_t n) void Crossfade::invalidate () { - Invalidated (shared_from_this()); /* EMIT SIGNAL */ + Invalidated (shared_from_this ()); /* EMIT SIGNAL */ } diff --git a/libs/ardour/midi_playlist.cc b/libs/ardour/midi_playlist.cc index d1b2a58e82..2e36e34e43 100644 --- a/libs/ardour/midi_playlist.cc +++ b/libs/ardour/midi_playlist.cc @@ -130,8 +130,6 @@ MidiPlaylist::read (MidiRingBuffer& dst, nframes_t start, nframes_t ret = 0; nframes_t end = start + dur - 1; - //nframes_t read_frames = 0; - //nframes_t skip_frames = 0; //_read_data_count = 0; @@ -151,7 +149,7 @@ MidiPlaylist::read (MidiRingBuffer& dst, nframes_t start, for (vector<boost::shared_ptr<Region> >::iterator i = regs.begin(); i != regs.end(); ++i) { // FIXME: ensure time is monotonic here boost::shared_ptr<MidiRegion> mr = boost::dynamic_pointer_cast<MidiRegion>(*i); - mr->read_at (dst, start, dur, chan_n, 0, 0);// FIXME read_frames, skip_frames); + mr->read_at (dst, start, dur, chan_n); ret += mr->read_data_count(); } diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc index 78c238233e..16972c37eb 100644 --- a/libs/ardour/midi_region.cc +++ b/libs/ardour/midi_region.cc @@ -109,24 +109,19 @@ MidiRegion::~MidiRegion () } nframes_t -MidiRegion::read_at (MidiRingBuffer& out, nframes_t position, - nframes_t dur, - uint32_t chan_n, nframes_t read_frames, nframes_t skip_frames) const +MidiRegion::read_at (MidiRingBuffer& out, nframes_t position, nframes_t dur, uint32_t chan_n) const { - return _read_at (_sources, out, position, dur, chan_n, read_frames, skip_frames); + return _read_at (_sources, out, position, dur, chan_n); } nframes_t -MidiRegion::master_read_at (MidiRingBuffer& out, nframes_t position, - nframes_t dur, uint32_t chan_n) const +MidiRegion::master_read_at (MidiRingBuffer& out, nframes_t position, nframes_t dur, uint32_t chan_n) const { - return _read_at (_master_sources, out, position, dur, chan_n, 0, 0); + return _read_at (_master_sources, out, position, dur, chan_n); } nframes_t -MidiRegion::_read_at (const SourceList& srcs, MidiRingBuffer& dst, - nframes_t position, nframes_t dur, - uint32_t chan_n, nframes_t read_frames, nframes_t skip_frames) const +MidiRegion::_read_at (const SourceList& srcs, MidiRingBuffer& dst, nframes_t position, nframes_t dur, uint32_t chan_n) const { // cerr << _name << "._read_at(" << position << ") - " << _position << endl; diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 306f933f26..92e0503bb4 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -1598,12 +1598,17 @@ Playlist::relayer () /* we want to go through regions from desired lowest to desired highest layer, which depends on the layer model */ + RegionList copy = regions; + + /* sort according to the model */ + if (Config->get_layer_model() == MoveAddHigher || Config->get_layer_model() == AddHigher) { RegionSortByLastLayerOp cmp; copy.sort (cmp); } + for (RegionList::iterator i = copy.begin(); i != copy.end(); ++i) { /* find the lowest layer that this region can go on */ @@ -1636,7 +1641,7 @@ Playlist::relayer () layers[j].push_back (*i); } - /* set up the layer numbers in the regions */ + /* first pass: set up the layer numbers in the regions */ for (size_t j = 0; j < layers.size(); ++j) { for (RegionList::iterator i = layers[j].begin(); i != layers[j].end(); ++i) { (*i)->set_layer (j); diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 4e4b1c91af..8ac101282d 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -49,6 +49,27 @@ Change Region::LockChanged = ARDOUR::new_change (); Change Region::LayerChanged = ARDOUR::new_change (); Change Region::HiddenChanged = ARDOUR::new_change (); + +/* derived-from-derived constructor (no sources in constructor) */ +Region::Region (nframes_t start, nframes_t length, const string& name, DataType type, layer_t layer, Region::Flag flags) + : _name(name) + , _type(type) + , _flags(flags) + , _start(start) + , _length(length) + , _position(0) + , _sync_position(_start) + , _layer(layer) + , _first_edit(EditChangesNothing) + , _frozen(0) + , _read_data_count(0) + , _pending_changed(Change (0)) + , _last_layer_op(0) +{ + /* no sources at this point */ +} + + /** Basic Region constructor (single source) */ Region::Region (boost::shared_ptr<Source> src, nframes_t start, nframes_t length, const string& name, DataType type, layer_t layer, Region::Flag flags) : _name(name) @@ -67,6 +88,7 @@ Region::Region (boost::shared_ptr<Source> src, nframes_t start, nframes_t length { _sources.push_back (src); _master_sources.push_back (src); + src->GoingAway.connect (bind (mem_fun (*this, &Region::source_deleted), src)); assert(_sources.size() > 0); @@ -245,7 +267,6 @@ Region::Region (boost::shared_ptr<Source> src, const XMLNode& node) { _sources.push_back (src); - if (set_state (node)) { throw failed_constructor(); } @@ -909,7 +930,6 @@ Region::state (bool full_state) fe = X_("id"); break; default: /* should be unreachable but makes g++ happy */ - cerr << "Odd region property found\n"; fe = X_("nothing"); break; } |