[beast/devel] ALL: revert accidental removal of newlines
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast/devel] ALL: revert accidental removal of newlines
- Date: Wed, 1 May 2013 17:49:31 +0000 (UTC)
commit d98d740f9052fbb4c326bad36326124f53674189
Merge: 07b4a85 998bd85
Author: Tim Janik <timj gnu org>
Date: Mon Apr 15 04:27:17 2013 +0200
ALL: revert accidental removal of newlines
Fix commit 4e9c9795133299ba04c0969f3d43c7c9a8f7bd54 from 2012-12-23
which removed thausands of newlines but was meant to only strip
trailing whitesapces.
beast-gtk/bstapp.cc | 83 +++++++
beast-gtk/bstapp.hh | 20 ++
beast-gtk/bstasciipixbuf.cc | 23 ++
beast-gtk/bstasciipixbuf.hh | 8 +
beast-gtk/bstauxdialogs.cc | 23 ++
beast-gtk/bstauxdialogs.hh | 6 +
beast-gtk/bstbseutils.cc | 5 +
beast-gtk/bstbseutils.hh | 3 +
beast-gtk/bstbuseditor.cc | 19 ++
beast-gtk/bstbuseditor.hh | 9 +
beast-gtk/bstbusmixer.cc | 20 ++
beast-gtk/bstbusmixer.hh | 9 +
beast-gtk/bstbusview.cc | 15 ++
beast-gtk/bstbusview.hh | 9 +
beast-gtk/bstcanvaslink.cc | 58 +++++
beast-gtk/bstcanvaslink.hh | 18 ++
beast-gtk/bstcanvassource.cc | 122 +++++++++
beast-gtk/bstcanvassource.hh | 14 +
beast-gtk/bstcluehunter.cc | 117 +++++++++
beast-gtk/bstcluehunter.hh | 21 ++
beast-gtk/bstdbmeter.cc | 102 ++++++++
beast-gtk/bstdbmeter.hh | 9 +
beast-gtk/bstdial.cc | 110 +++++++++
beast-gtk/bstdial.hh | 20 ++
beast-gtk/bsteffectview.cc | 56 +++++
beast-gtk/bsteffectview.hh | 16 ++
beast-gtk/bsteventroll.cc | 101 ++++++++
beast-gtk/bsteventroll.hh | 18 ++
beast-gtk/bsteventrollctrl.cc | 72 ++++++
beast-gtk/bsteventrollctrl.hh | 8 +
beast-gtk/bstfiledialog.cc | 108 ++++++++
beast-gtk/bstfiledialog.hh | 13 +
beast-gtk/bstgconfig.cc | 41 +++
beast-gtk/bstgconfig.hh | 9 +
beast-gtk/bstgrowbar.cc | 21 ++
beast-gtk/bstgrowbar.hh | 11 +
beast-gtk/bstitemseqdialog.cc | 46 ++++
beast-gtk/bstitemseqdialog.hh | 11 +
beast-gtk/bstitemview.cc | 56 +++++
beast-gtk/bstitemview.hh | 16 ++
beast-gtk/bstkeybindings.cc | 45 ++++
beast-gtk/bstkeybindings.hh | 8 +
beast-gtk/bstknob.cc | 118 +++++++++
beast-gtk/bstknob.hh | 14 +
beast-gtk/bstlogadjustment.cc | 36 +++
beast-gtk/bstlogadjustment.hh | 11 +
beast-gtk/bstmain.cc | 21 ++
beast-gtk/bstmenus.cc | 65 +++++
beast-gtk/bstmenus.hh | 11 +
beast-gtk/bstmsgabsorb.cc | 34 +++
beast-gtk/bstmsgabsorb.hh | 7 +
beast-gtk/bstparam-automation.cc | 10 +
beast-gtk/bstparam-choice.cc | 10 +
beast-gtk/bstparam-color-spinner.cc | 8 +
beast-gtk/bstparam-item-seq.cc | 6 +
beast-gtk/bstparam-note-sequence.cc | 4 +
beast-gtk/bstparam-note-spinner.cc | 6 +
beast-gtk/bstparam-proxy.cc | 12 +
beast-gtk/bstparam-scale.cc | 5 +
beast-gtk/bstparam-searchpath.cc | 10 +
beast-gtk/bstparam-time.cc | 4 +
beast-gtk/bstparam.cc | 44 ++++
beast-gtk/bstparam.hh | 15 ++
beast-gtk/bstparamview.cc | 50 ++++
beast-gtk/bstparamview.hh | 14 +
beast-gtk/bstpartdialog.cc | 46 ++++
beast-gtk/bstpartdialog.hh | 10 +
beast-gtk/bstpartview.cc | 20 ++
beast-gtk/bstpartview.hh | 9 +
beast-gtk/bstpatterncolumns.cc | 48 ++++
beast-gtk/bstpatterncolumns.hh | 7 +
beast-gtk/bstpatternctrl.cc | 22 ++
beast-gtk/bstpatternctrl.hh | 7 +
beast-gtk/bstpatternview.cc | 104 ++++++++
beast-gtk/bstpatternview.hh | 19 ++
beast-gtk/bstpianoroll.cc | 131 ++++++++++
beast-gtk/bstpianoroll.hh | 19 ++
beast-gtk/bstpianorollctrl.cc | 78 ++++++
beast-gtk/bstpianorollctrl.hh | 8 +
beast-gtk/bstplayback.cc | 29 +++
beast-gtk/bstplayback.hh | 11 +
beast-gtk/bstplaylist.cc | 82 ++++++
beast-gtk/bstplaylist.hh | 14 +
beast-gtk/bstpreferences.cc | 67 +++++
beast-gtk/bstpreferences.hh | 15 ++
beast-gtk/bstprocbrowser.cc | 42 ++++
beast-gtk/bstprocbrowser.hh | 16 ++
beast-gtk/bstprocedure.cc | 90 +++++++
beast-gtk/bstprocedure.hh | 14 +
beast-gtk/bstprofiler.hh | 6 +
beast-gtk/bstprojectctrl.cc | 24 ++
beast-gtk/bstprojectctrl.hh | 10 +
beast-gtk/bstqsampler.cc | 166 +++++++++++++
beast-gtk/bstqsampler.hh | 21 ++
beast-gtk/bstrackeditor-covers.cc | 20 ++
beast-gtk/bstrackeditor.cc | 41 +++
beast-gtk/bstrackeditor.hh | 13 +
beast-gtk/bstrackitem.cc | 26 ++
beast-gtk/bstrackitem.hh | 11 +
beast-gtk/bstracktable.cc | 125 ++++++++++
beast-gtk/bstracktable.hh | 15 ++
beast-gtk/bstrackview.cc | 32 +++
beast-gtk/bstrackview.hh | 10 +
beast-gtk/bstrecords.idl | 6 +
beast-gtk/bstrtest.cc | 33 +++
beast-gtk/bstsampleeditor.cc | 72 ++++++
beast-gtk/bstsampleeditor.hh | 15 ++
beast-gtk/bstscrollgraph.cc | 54 ++++
beast-gtk/bstscrollgraph.hh | 7 +
beast-gtk/bstsegment.cc | 15 ++
beast-gtk/bstsegment.hh | 8 +
beast-gtk/bstsequence.cc | 43 ++++
beast-gtk/bstsequence.hh | 14 +
beast-gtk/bstservermonitor.cc | 19 ++
beast-gtk/bstservermonitor.hh | 14 +
beast-gtk/bstskinconfig.cc | 38 +++
beast-gtk/bstskinconfig.hh | 9 +
beast-gtk/bstsnetrouter.cc | 114 +++++++++
beast-gtk/bstsnetrouter.hh | 16 ++
beast-gtk/bstsnifferscope.cc | 31 +++
beast-gtk/bstsnifferscope.hh | 8 +
beast-gtk/bstsplash.cc | 61 +++++
beast-gtk/bstsplash.hh | 15 ++
beast-gtk/bststest.cc | 96 +++++++
beast-gtk/bstsupershell.cc | 33 +++
beast-gtk/bstsupershell.hh | 9 +
beast-gtk/bsttrackroll.cc | 127 ++++++++++
beast-gtk/bsttrackroll.hh | 20 ++
beast-gtk/bsttrackrollctrl.cc | 51 ++++
beast-gtk/bsttrackrollctrl.hh | 9 +
beast-gtk/bsttracksynthdialog.cc | 43 ++++
beast-gtk/bsttracksynthdialog.hh | 12 +
beast-gtk/bsttrackview.cc | 68 +++++
beast-gtk/bsttrackview.hh | 11 +
beast-gtk/bsttreestores.cc | 48 ++++
beast-gtk/bsttreestores.hh | 11 +
beast-gtk/bstusermessage.cc | 28 ++
beast-gtk/bstusermessage.hh | 4 +
beast-gtk/bstutils.cc | 131 ++++++++++
beast-gtk/bstutils.hh | 13 +
beast-gtk/bstwaveeditor.cc | 77 ++++++
beast-gtk/bstwaveeditor.hh | 15 ++
beast-gtk/bstwaveview.cc | 25 ++
beast-gtk/bstwaveview.hh | 10 +
beast-gtk/bstxframe.cc | 57 +++++
beast-gtk/bstxframe.hh | 12 +
beast-gtk/bstxkb.cc | 24 ++
beast-gtk/bstxkb.hh | 11 +
beast-gtk/bstzoomedwindow.cc | 46 ++++
beast-gtk/bstzoomedwindow.hh | 14 +
beast-gtk/gxk/glewidgets.c | 285 +++++++++++++++++++++
beast-gtk/gxk/glewidgets.h | 56 +++++
beast-gtk/gxk/gxk.hh | 3 +
beast-gtk/gxk/gxkaction.cc | 76 ++++++
beast-gtk/gxk/gxkaction.hh | 14 +
beast-gtk/gxk/gxkassortment.cc | 50 ++++
beast-gtk/gxk/gxkassortment.hh | 9 +
beast-gtk/gxk/gxkauxwidgets.cc | 37 +++
beast-gtk/gxk/gxkauxwidgets.hh | 12 +
beast-gtk/gxk/gxkcanvas.cc | 32 +++
beast-gtk/gxk/gxkcanvas.hh | 6 +
beast-gtk/gxk/gxkcellrendererpopup.cc | 45 ++++
beast-gtk/gxk/gxkcellrendererpopup.hh | 16 ++
beast-gtk/gxk/gxkdialog.cc | 88 +++++++
beast-gtk/gxk/gxkdialog.hh | 16 ++
beast-gtk/gxk/gxkglobals.cc | 9 +
beast-gtk/gxk/gxkglobals.hh | 20 ++
beast-gtk/gxk/gxkimagecache.cc | 12 +
beast-gtk/gxk/gxkimagecache.hh | 8 +
beast-gtk/gxk/gxkled.cc | 36 +++
beast-gtk/gxk/gxkled.hh | 11 +
beast-gtk/gxk/gxklistwrapper.cc | 94 +++++++
beast-gtk/gxk/gxklistwrapper.hh | 12 +
beast-gtk/gxk/gxklogadjustment.cc | 56 +++++
beast-gtk/gxk/gxklogadjustment.hh | 13 +
beast-gtk/gxk/gxkmenubutton.cc | 32 +++
beast-gtk/gxk/gxkmenubutton.hh | 6 +
beast-gtk/gxk/gxknotebook.cc | 25 ++
beast-gtk/gxk/gxknotebook.hh | 9 +
beast-gtk/gxk/gxkparam-entry.cc | 4 +
beast-gtk/gxk/gxkparam-label.cc | 4 +
beast-gtk/gxk/gxkparam-scale.cc | 5 +
beast-gtk/gxk/gxkparam-spinner.cc | 4 +
beast-gtk/gxk/gxkparam-toggle.cc | 6 +
beast-gtk/gxk/gxkparam.cc | 88 +++++++
beast-gtk/gxk/gxkparam.hh | 16 ++
beast-gtk/gxk/gxkpolygon.cc | 32 +++
beast-gtk/gxk/gxkpolygon.hh | 9 +
beast-gtk/gxk/gxkrackcovers.cc | 17 ++
beast-gtk/gxk/gxkrackeditor.cc | 38 +++
beast-gtk/gxk/gxkrackeditor.hh | 10 +
beast-gtk/gxk/gxkrackitem.cc | 40 +++
beast-gtk/gxk/gxkrackitem.hh | 10 +
beast-gtk/gxk/gxkracktable.cc | 73 ++++++
beast-gtk/gxk/gxkracktable.hh | 11 +
beast-gtk/gxk/gxkradget.cc | 125 ++++++++++
beast-gtk/gxk/gxkradget.hh | 11 +
beast-gtk/gxk/gxkradgetfactory.cc | 45 ++++
beast-gtk/gxk/gxkradgetfactory.hh | 15 ++
beast-gtk/gxk/gxkscrollcanvas.cc | 154 ++++++++++++
beast-gtk/gxk/gxkscrollcanvas.hh | 9 +
beast-gtk/gxk/gxksimplelabel.cc | 53 ++++
beast-gtk/gxk/gxksimplelabel.hh | 8 +
beast-gtk/gxk/gxkspline.cc | 13 +
beast-gtk/gxk/gxkspline.hh | 7 +
beast-gtk/gxk/gxkstatusbar.cc | 44 ++++
beast-gtk/gxk/gxkstatusbar.hh | 10 +
beast-gtk/gxk/gxkstock.cc | 49 ++++
beast-gtk/gxk/gxkstock.hh | 12 +
beast-gtk/gxk/gxktest.cc | 38 +++
beast-gtk/gxk/gxktexttools.cc | 185 ++++++++++++++
beast-gtk/gxk/gxktexttools.hh | 11 +
beast-gtk/gxk/gxkutils.cc | 300 +++++++++++++++++++++++
beast-gtk/gxk/gxkutils.hh | 28 ++
beast-gtk/gxk/splinetest.cc | 8 +
beast-gtk/testgui.cc | 14 +
beast-gtk/tsmview.cc | 13 +
bse/bseautodoc.cc | 49 ++++
bse/bsebiquadfilter.cc | 41 +++
bse/bsebiquadfilter.hh | 9 +
bse/bseblockutils.cc | 23 ++
bse/bseblockutils.hh | 17 ++
bse/bsebus.cc | 62 +++++
bse/bsebus.hh | 9 +
bse/bsebus.proc | 28 ++
bse/bsebusmodule.cc | 4 +
bse/bsebusmodule.idl | 1 +
bse/bsecategories.cc | 53 ++++
bse/bsecategories.hh | 10 +
bse/bsecategories.proc | 23 ++
bse/bsecompat.cc | 4 +
bse/bsecompat.hh | 8 +
bse/bseconstant.cc | 33 +++
bse/bseconstant.hh | 6 +
bse/bseconstvalues.cc | 2 +
bse/bseconstvalues.hh | 23 ++
bse/bsecontainer.cc | 224 +++++++++++++++++
bse/bsecontainer.hh | 12 +
bse/bsecontainer.proc | 15 ++
bse/bsecontextmerger.cc | 30 +++
bse/bsecontextmerger.hh | 3 +
bse/bsecsynth.cc | 18 ++
bse/bsecsynth.hh | 5 +
bse/bsecsynth.proc | 4 +
bse/bsecxxarg.cc | 6 +
bse/bsecxxarg.hh | 9 +
bse/bsecxxbase.cc | 47 ++++
bse/bsecxxbase.hh | 18 ++
bse/bsecxxclosure.cc | 9 +
bse/bsecxxclosure.hh | 6 +
bse/bsecxxmodule.cc | 46 ++++
bse/bsecxxmodule.hh | 11 +
bse/bsecxxplugin.cc | 4 +
bse/bsecxxplugin.hh | 19 ++
bse/bsecxxutils.cc | 3 +
bse/bsecxxutils.hh | 15 ++
bse/bsecxxvalue.cc | 16 ++
bse/bsecxxvalue.hh | 8 +
bse/bsedatahandle-fir.cc | 51 ++++
bse/bsedatahandle-resample.cc | 57 +++++
bse/bsedatapocket.cc | 109 ++++++++
bse/bsedatapocket.hh | 9 +
bse/bsedatapocket.proc | 57 +++++
bse/bsedefs.hh | 11 +
bse/bsedevice.cc | 36 +++
bse/bsedevice.hh | 10 +
bse/bseeditablesample.cc | 35 +++
bse/bseeditablesample.hh | 4 +
bse/bseeditablesample.proc | 22 ++
bse/bseengine.cc | 116 +++++++++
bse/bseengine.hh | 11 +
bse/bseenginemaster.cc | 74 ++++++
bse/bseenginenode.hh | 10 +
bse/bseengineschedule.cc | 66 +++++
bse/bseengineschedule.hh | 7 +
bse/bseengineutils.cc | 62 +++++
bse/bseengineutils.hh | 11 +
bse/bseenums.cc | 15 ++
bse/bseenums.hh | 11 +
bse/bseenums.proc | 13 +
bse/bseexports.hh | 20 ++
bse/bsefilter-ellf.cc | 74 ++++++
bse/bsefilter.cc | 4 +
bse/bsefilter.hh | 8 +
bse/bsegconfig.cc | 9 +
bse/bsegconfig.hh | 5 +
bse/bsegenclosures.hh | 18 ++
bse/bseglobals.cc | 18 ++
bse/bseglobals.hh | 12 +
bse/bseglue.cc | 112 +++++++++
bse/bseglue.hh | 10 +
bse/bseieee754.hh | 25 ++
bse/bseincluder.hh | 5 +
bse/bseinfo.cc | 10 +
bse/bseinstrument.hh | 16 ++
bse/bseinstrumentinput.cc | 22 ++
bse/bseinstrumentinput.hh | 5 +
bse/bseinstrumentoutput.cc | 22 ++
bse/bseinstrumentoutput.hh | 5 +
bse/bseitem.cc | 162 ++++++++++++
bse/bseitem.hh | 13 +
bse/bseitem.proc | 114 +++++++++
bse/bsejanitor.cc | 73 ++++++
bse/bsejanitor.hh | 8 +
bse/bsejanitor.proc | 64 +++++
bse/bseladspa.cc | 43 ++++
bse/bseladspa.hh | 7 +
bse/bseladspamodule.cc | 39 +++
bse/bseladspamodule.hh | 8 +
bse/bseloader-aiff.cc | 32 +++
bse/bseloader-bsewave.cc | 40 +++
bse/bseloader-guspatch.cc | 74 ++++++
bse/bseloader-mad.cc | 22 ++
bse/bseloader-oggvorbis.cc | 22 ++
bse/bseloader-wav.cc | 38 +++
bse/bseloader.cc | 61 +++++
bse/bseloader.hh | 15 ++
bse/bsemain.cc | 13 +
bse/bsemain.hh | 1 +
bse/bsemath.cc | 28 ++
bse/bsemath.hh | 24 ++
bse/bsemathsignal.cc | 60 +++++
bse/bsemathsignal.hh | 78 ++++++
bse/bsemidicontroller.cc | 42 ++++
bse/bsemidicontroller.hh | 7 +
bse/bsemididecoder.cc | 20 ++
bse/bsemididecoder.hh | 8 +
bse/bsemididevice-null.cc | 6 +
bse/bsemididevice-null.hh | 3 +
bse/bsemididevice-oss.cc | 18 ++
bse/bsemididevice-oss.hh | 4 +
bse/bsemididevice.cc | 19 ++
bse/bsemididevice.hh | 3 +
bse/bsemidievent.cc | 33 +++
bse/bsemidievent.hh | 14 +
bse/bsemidifile.cc | 10 +
bse/bsemidifile.hh | 6 +
bse/bsemidiinput.cc | 42 ++++
bse/bsemidiinput.hh | 7 +
bse/bsemidinotifier.cc | 24 ++
bse/bsemidinotifier.hh | 4 +
bse/bsemidinotifier.proc | 7 +
bse/bsemidireceiver.cc | 171 +++++++++++++
bse/bsemidireceiver.hh | 4 +
bse/bsemidisynth.cc | 48 ++++
bse/bsemidisynth.hh | 3 +
bse/bsemidivoice.cc | 58 +++++
bse/bsemidivoice.hh | 7 +
bse/bsenote.cc | 29 +++
bse/bsenote.hh | 11 +
bse/bseobject.cc | 108 ++++++++
bse/bseobject.hh | 12 +
bse/bseparam.cc | 17 ++
bse/bseparam.hh | 13 +
bse/bseparasite.cc | 59 +++++
bse/bseparasite.hh | 7 +
bse/bseparasite.proc | 5 +
bse/bsepart.cc | 178 ++++++++++++++
bse/bsepart.hh | 10 +
bse/bsepart.proc | 129 ++++++++++
bse/bsepattern.hh | 28 ++
bse/bsepatterngroup.hh | 15 ++
bse/bsepcmdevice-null.cc | 12 +
bse/bsepcmdevice-null.hh | 5 +
bse/bsepcmdevice-oss.cc | 52 ++++
bse/bsepcmdevice-oss.hh | 5 +
bse/bsepcmdevice.cc | 21 ++
bse/bsepcmdevice.hh | 10 +
bse/bsepcminput.cc | 40 +++
bse/bsepcminput.hh | 6 +
bse/bsepcmmodule.cc | 33 +++
bse/bsepcmoutput.cc | 40 +++
bse/bsepcmoutput.hh | 10 +
bse/bsepcmwriter.cc | 3 +
bse/bsepcmwriter.hh | 8 +
bse/bseplugin.cc | 55 ++++
bse/bseplugin.hh | 5 +
bse/bseprobe.cc | 18 ++
bse/bseprobe.idl | 1 +
bse/bseprocedure.cc | 64 +++++
bse/bseprocedure.hh | 18 ++
bse/bseprocedure.proc | 44 ++++
bse/bseprocidl.cc | 55 ++++
bse/bseproject.cc | 134 ++++++++++
bse/bseproject.hh | 9 +
bse/bseproject.proc | 154 ++++++++++++
bse/bsequery.cc | 32 +++
bse/bseresampler.cc | 22 ++
bse/bseresampler.hh | 12 +
bse/bseresamplerimpl.hh | 40 +++
bse/bsescripthelper.cc | 33 +++
bse/bsescripthelper.hh | 8 +
bse/bsescripthelper.proc | 8 +
bse/bsesequencer.cc | 2 +
bse/bseserver.cc | 122 +++++++++
bse/bseserver.hh | 1 +
bse/bseserver.proc | 76 ++++++
bse/bsesnet.cc | 147 +++++++++++
bse/bsesnet.hh | 8 +
bse/bsesnet.proc | 22 ++
bse/bsesnooper.cc | 33 +++
bse/bsesnooper.hh | 3 +
bse/bsesong.cc | 84 +++++++
bse/bsesong.hh | 7 +
bse/bsesong.proc | 63 +++++
bse/bsesource.cc | 248 +++++++++++++++++++
bse/bsesource.hh | 9 +
bse/bsesource.proc | 111 +++++++++
bse/bsestandardosc.cc | 51 ++++
bse/bsestandardosc.hh | 2 +
bse/bsestandardsynths.cc | 15 ++
bse/bsestandardsynths.hh | 8 +
bse/bsestorage.cc | 67 +++++
bse/bsestorage.hh | 20 ++
bse/bsesubiport.cc | 45 ++++
bse/bsesuboport.cc | 45 ++++
bse/bsesubsynth.cc | 66 +++++
bse/bsesubsynth.hh | 3 +
bse/bsesuper.cc | 27 ++
bse/bsesuper.hh | 3 +
bse/bsetrack.cc | 108 ++++++++
bse/bsetrack.hh | 5 +
bse/bsetrack.proc | 47 ++++
bse/bsetype.cc | 51 ++++
bse/bsetype.hh | 21 ++
bse/bseundostack.cc | 47 ++++
bse/bseundostack.hh | 11 +
bse/bseutils.cc | 50 ++++
bse/bseutils.hh | 14 +
bse/bsewave.cc | 79 ++++++
bse/bsewave.hh | 6 +
bse/bsewave.proc | 25 ++
bse/bsewaveosc.cc | 57 +++++
bse/bsewaveosc.hh | 7 +
bse/bsewaveosc.proc | 12 +
bse/bsewaverepo.cc | 33 +++
bse/bsewaverepo.hh | 5 +
bse/bsewaverepo.proc | 21 ++
bse/gsl-fftconf.sh | 14 +-
bse/gslcommon.cc | 14 +
bse/gslcommon.hh | 4 +
bse/gsldatacache.cc | 19 ++
bse/gsldatacache.hh | 9 +
bse/gsldatahandle-mad.cc | 92 +++++++
bse/gsldatahandle-mad.hh | 5 +
bse/gsldatahandle-vorbis.cc | 62 +++++
bse/gsldatahandle-vorbis.hh | 7 +
bse/gsldatahandle.cc | 168 +++++++++++++
bse/gsldatahandle.hh | 24 ++
bse/gsldatautils.cc | 112 +++++++++
bse/gsldatautils.hh | 38 +++
bse/gsldefs.hh | 12 +
bse/gslfft.hh | 14 +
bse/gslfilehash.cc | 25 ++
bse/gslfilehash.hh | 12 +
bse/gslfilter.cc | 188 ++++++++++++++
bse/gslfilter.hh | 34 +++
bse/gslincluder.hh | 8 +
bse/gslmagic.cc | 82 ++++++
bse/gslmagic.hh | 13 +
bse/gsloscillator-aux.cc | 14 +
bse/gsloscillator.cc | 26 ++
bse/gsloscillator.hh | 11 +
bse/gslosctable.cc | 63 +++++
bse/gslosctable.hh | 13 +
bse/gslvorbis-cutter.cc | 25 ++
bse/gslvorbis-cutter.hh | 6 +
bse/gslvorbis-enc.cc | 60 +++++
bse/gslvorbis-enc.hh | 8 +
bse/gslwavechunk.cc | 60 +++++
bse/gslwavechunk.hh | 13 +
bse/gslwaveosc-aux.cc | 13 +
bse/gslwaveosc.cc | 34 +++
bse/gslwaveosc.hh | 16 ++
bse/ladspa.hh | 120 +++++++++
bse/tests/blocktests.cc | 26 ++
bse/tests/filtertest.cc | 20 ++
bse/tests/firhandle.cc | 44 ++++
bse/tests/loophandle.cc | 27 ++
bse/tests/misctests.cc | 7 +
bse/tests/resamplehandle.cc | 52 ++++
bse/tests/subnormals-aux.cc | 5 +
bse/tests/testcxx.cc | 10 +
bse/tests/testfft.cc | 39 +++
drivers/bse-portaudio/bsepcmdevice-portaudio.cc | 37 +++
drivers/bsemididevice-alsa.cc | 15 ++
drivers/bsepcmdevice-alsa.cc | 32 +++
launchers/beaststart.c | 2 +
launchers/bseshstart.c | 2 +
launchers/suidmain.c | 14 +
launchers/suidmain.h | 4 +
library/scripts/mixer-splitup-by-track.scm | 7 +
library/scripts/modules2grid.scm | 2 +
library/scripts/part-harmonic-transposer.scm | 22 ++
library/scripts/progressor-example.scm | 3 +
library/scripts/record-midi.scm | 2 +
library/scripts/song-parts-operations.scm | 6 +
plugins/artscompressor.cc | 17 ++
plugins/artscompressor.idl | 2 +
plugins/bseadder.cc | 36 +++
plugins/bseadder.hh | 8 +
plugins/bseamplifier.cc | 9 +
plugins/bseamplifier.idl | 1 +
plugins/bseatandistort.cc | 31 +++
plugins/bseatandistort.hh | 8 +
plugins/bsebalance.cc | 4 +
plugins/bsebalance.idl | 1 +
plugins/bseblockutils.cc | 10 +
plugins/bsecontribsampleandhold.cc | 9 +
plugins/bsefirfilter.c | 56 +++++
plugins/bsefirfilter.hh | 12 +
plugins/bseiirfilter.cc | 41 +++
plugins/bsemixer.cc | 37 +++
plugins/bsemixer.hh | 4 +
plugins/bsemult.cc | 18 ++
plugins/bsemult.hh | 10 +
plugins/bsenoise.cc | 14 +
plugins/bsenoise.idl | 1 +
plugins/bsequantizer.cc | 2 +
plugins/bsequantizer.idl | 1 +
plugins/bsesequencer.cc | 49 ++++
plugins/bsesequencer.hh | 8 +
plugins/bsesimpleadsr-aux.cc | 6 +
plugins/bsesimpleadsr.cc | 40 +++
plugins/bsesimpleadsr.hh | 5 +
plugins/bsesummation.cc | 4 +
plugins/bsesummation.idl | 1 +
plugins/davbassfilter.cc | 6 +
plugins/davbassfilter.idl | 2 +
plugins/davcanyondelay.cc | 44 ++++
plugins/davcanyondelay.hh | 4 +
plugins/davchorus.cc | 11 +
plugins/davchorus.idl | 1 +
plugins/davguitar.c | 89 +++++++
plugins/davguitar.hh | 3 +
plugins/davorgan.cc | 10 +
plugins/davorgan.idl | 1 +
plugins/davsyndrum.cc | 39 +++
plugins/davsyndrum.hh | 6 +
plugins/davxtalstrings.cc | 52 ++++
plugins/davxtalstrings.hh | 4 +
plugins/evaluator/bseevaluator.cc | 17 ++
plugins/evaluator/bseevaluator.idl | 2 +
plugins/evaluator/compiler.cc | 20 ++
plugins/evaluator/compiler.hh | 8 +
plugins/evaluator/cpu.cc | 18 ++
plugins/evaluator/cpu.hh | 10 +
plugins/evaluator/evaluateexpr.cc | 10 +
plugins/evaluator/instruction.cc | 7 +
plugins/evaluator/instruction.hh | 14 +
plugins/evaluator/symbols.hh | 12 +
plugins/evaluator/token.hh | 11 +
plugins/freeverb/bsefreeverb.cc | 34 +++
plugins/freeverb/bsefreeverb.hh | 3 +
plugins/freeverb/bsefreeverbcpp.hh | 8 +
plugins/freeverb/denormals.hh | 4 +
plugins/freeverb/tuning.hh | 6 +
plugins/icons/adsr.c | 3 +
plugins/icons/any.c | 2 +
plugins/icons/atan.c | 3 +
plugins/icons/canyon.c | 3 +
plugins/icons/drum.c | 3 +
plugins/icons/filter.c | 3 +
plugins/icons/genosc.c | 2 +
plugins/icons/mixer.c | 3 +
plugins/icons/multiply.c | 3 +
plugins/icons/noise.c | 3 +
plugins/icons/organ.c | 3 +
plugins/icons/osc.c | 2 +
plugins/icons/pipe.c | 2 +
plugins/icons/reverb.c | 3 +
plugins/icons/sequencer.c | 3 +
plugins/icons/sine.c | 2 +
plugins/icons/speaker.c | 2 +
plugins/icons/strings.c | 3 +
plugins/icons/sub.c | 3 +
plugins/icons/sum.c | 3 +
plugins/standardguspatchenvelope.cc | 41 +++
plugins/standardsaturator.cc | 5 +
plugins/standardsaturator.idl | 1 +
r+d-files/bse-ellf.c | 241 ++++++++++++++++++
r+d-files/transpose_freq.scm | 3 +
sfi/gbsearcharray.hh | 35 +++
sfi/glib-extra.cc | 119 +++++++++
sfi/glib-extra.hh | 40 +++
sfi/sfi.hh | 2 +
sfi/sficomport.cc | 54 ++++
sfi/sficomport.hh | 4 +
sfi/sficomwire.cc | 131 ++++++++++
sfi/sficomwire.hh | 25 ++
sfi/sficxx.cc | 6 +
sfi/sficxx.hh | 20 ++
sfi/sfidl-cbase.cc | 89 +++++++
sfi/sfidl-cbase.hh | 28 ++
sfi/sfidl-clientc.cc | 43 ++++
sfi/sfidl-clientc.hh | 9 +
sfi/sfidl-clientcxx.cc | 78 ++++++
sfi/sfidl-clientcxx.hh | 13 +
sfi/sfidl-corec.cc | 72 ++++++
sfi/sfidl-corecxx.cc | 69 ++++++
sfi/sfidl-cxxbase.cc | 10 +
sfi/sfidl-cxxbase.hh | 7 +
sfi/sfidl-factory.cc | 6 +
sfi/sfidl-factory.hh | 11 +
sfi/sfidl-generator.cc | 37 +++
sfi/sfidl-generator.hh | 18 ++
sfi/sfidl-hostc.cc | 46 ++++
sfi/sfidl-hostc.hh | 9 +
sfi/sfidl-namespace.cc | 22 ++
sfi/sfidl-namespace.hh | 12 +
sfi/sfidl-options.cc | 32 +++
sfi/sfidl-options.hh | 9 +
sfi/sfidl-parser.cc | 235 ++++++++++++++++++
sfi/sfidl-parser.hh | 59 +++++
sfi/sfidl-typelist.cc | 10 +
sfi/sfidl.cc | 11 +
sfi/sfifilecrawler.cc | 49 ++++
sfi/sfifilecrawler.hh | 12 +
sfi/sfiglue.cc | 111 +++++++++
sfi/sfiglue.hh | 23 ++
sfi/sfigluecodec.cc | 125 ++++++++++
sfi/sfigluecodec.hh | 15 ++
sfi/sfiglueproxy.cc | 107 ++++++++
sfi/sfiglueproxy.hh | 12 +
sfi/sfimemory.cc | 7 +
sfi/sfimemory.hh | 6 +
sfi/sfinote.cc | 23 ++
sfi/sfinote.hh | 17 ++
sfi/sfiparams.cc | 192 +++++++++++++++
sfi/sfiparams.hh | 29 +++
sfi/sfiprimitives.cc | 171 +++++++++++++
sfi/sfiprimitives.hh | 13 +
sfi/sfiring.cc | 99 ++++++++
sfi/sfiring.hh | 12 +
sfi/sfiserial.cc | 34 +++
sfi/sfiserial.hh | 12 +
sfi/sfistore.cc | 119 +++++++++
sfi/sfistore.hh | 14 +
sfi/sfitime.cc | 55 ++++
sfi/sfitime.hh | 11 +
sfi/sfitypes.cc | 26 ++
sfi/sfitypes.hh | 11 +
sfi/sfiustore.cc | 45 ++++
sfi/sfiustore.hh | 15 ++
sfi/sfivalues.cc | 116 +++++++++
sfi/sfivalues.hh | 23 ++
sfi/sfivmarshal.cc | 10 +
sfi/sfivmarshal.hh | 10 +
sfi/sfiwrapper.cc | 1 +
sfi/tests/misctests.cc | 15 ++
sfi/tests/ring.cc | 17 ++
sfi/tests/testidl.idl | 3 +
sfi/tests/testsfidl.cc | 5 +
shell/bsescm.cc | 8 +
shell/bsescminterp.cc | 141 +++++++++++
shell/bsescminterp.hh | 10 +
tests/audio/bse2wav.scm | 6 +
tests/bse/cxxbinding.cc | 15 ++
tests/bse/filtertest.cc | 38 +++
tests/bse/testplugin.cc | 8 +
tests/bse/testplugin.idl | 2 +
tests/filecheck/checkproject.scm | 3 +
tests/latency/bselatencytest.cc | 19 ++
tests/latency/bselatencytest.idl | 1 +
tests/latency/bseplay.scm | 1 +
tests/testresampler.cc | 55 ++++
tests/testresamplerq.cc | 23 ++
tools/bsefcompare.cc | 111 +++++++++
tools/bsefextract.cc | 223 +++++++++++++++++
tools/bseloopfuncs.cc | 84 +++++++
tools/bseloopfuncs.hh | 9 +
tools/bsewavetool.cc | 138 +++++++++++
tools/bsewavetool.hh | 3 +
tools/bwtwave.cc | 32 +++
tools/bwtwave.hh | 6 +
tools/cutvorbis.cc | 9 +
tools/magictest.cc | 5 +
tools/mathtool.cc | 56 +++++
tools/scripts/noteplaytest.scm | 5 +
tools/scripts/waveloadtest.scm | 5 +
tools/sfiutils.cc | 48 ++++
tools/sfiutils.hh | 11 +
topconfig.h | 2 +
683 files changed, 21916 insertions(+), 7 deletions(-)
---
diff --cc beast-gtk/bstapp.cc
index 9764b26,80cfdd0..6492e69
--- a/beast-gtk/bstapp.cc
+++ b/beast-gtk/bstapp.cc
@@@ -199,7 -213,9 +207,9 @@@ bst_app_init (BstApp *self
GtkWidget *widget = GTK_WIDGET (self);
BseCategorySeq *cseq;
GxkActionList *al1, *al2;
+
self->cookie = g_strdup ("");
-
++
g_object_set (self,
"name", "BEAST-Application",
"allow_shrink", TRUE,
@@@ -209,6 -225,7 +219,7 @@@
bst_app_register (self);
self->box = gxk_radget_create ("beast", "application-box", NULL);
gtk_container_add (GTK_CONTAINER (GXK_DIALOG (self)->vbox), (GtkWidget*) self->box);
-
++
/* publish widget specific actions */
gxk_widget_publish_actions (self, "file-open", G_N_ELEMENTS (file_open_actions), file_open_actions,
NULL, app_action_check, app_action_exec);
@@@ -275,6 -292,7 +286,7 @@@
al1 = skin_entries_create (self);
gxk_action_list_sort (al1);
gxk_widget_publish_action_list (widget, "skin-options", al1);
-
++
/* setup playback controls */
self->pcontrols = (GtkWidget*) g_object_new (BST_TYPE_PROJECT_CTRL, NULL);
gxk_radget_add (self->box, "control-area", self->pcontrols);
@@@ -293,6 -313,7 +307,7 @@@
NULL));
gxk_radget_add (self->box, "export-area-file-entry", gxk_param_create_editor (self->wave_file, NULL));
gxk_param_update (self->wave_file);
-
++
/* setup the main notebook */
self->notebook = (GtkNotebook*) gxk_radget_find (self->box, "main-notebook");
gxk_nullify_in_object (self, &self->notebook);
@@@ -304,13 -326,16 +320,16 @@@ static voi
bst_app_destroy (GtkObject *object)
{
BstApp *self = BST_APP (object);
-
++
if (self->wave_file)
{
gxk_param_destroy (self->wave_file);
self->wave_file = NULL;
}
-
++
if (self->rack_dialog)
gtk_widget_destroy (self->rack_dialog);
-
++
if (self->project)
{
if (self->pcontrols)
@@@ -323,10 -348,14 +342,14 @@@
bse_item_unuse (self->project);
self->project = 0;
}
+
if (self->ppages)
gxk_assortment_dispose (self->ppages);
+
bst_app_unregister (self);
-
++
GTK_OBJECT_CLASS (bst_app_parent_class)->destroy (object);
-
++
if (!bst_app_class->apps && bst_app_class->seen_apps)
{
bst_app_class->seen_apps = FALSE;
@@@ -337,6 -367,7 +361,7 @@@ static voi
bst_app_finalize (GObject *object)
{
BstApp *self = BST_APP (object);
-
++
if (self->project)
{
bse_proxy_disconnect (self->project,
@@@ -353,14 -384,18 +378,18 @@@
self->ppages = NULL;
}
g_free (self->cookie);
-
++
G_OBJECT_CLASS (bst_app_parent_class)->finalize (object);
}
+
BstApp*
bst_app_new (SfiProxy project)
{
g_return_val_if_fail (BSE_IS_PROJECT (project), NULL);
-
++
BstApp *self = (BstApp*) g_object_new (BST_TYPE_APP, NULL);
gxk_dialog_set_sizes (GXK_DIALOG (self), 500, 400, 950, 800);
+
self->project = project;
bse_item_use (self->project);
bse_proxy_connect (self->project,
@@@ -372,20 -407,27 +401,27 @@@
bst_window_sync_title_to_proxy (GXK_DIALOG (self), self->project, "%s");
if (self->pcontrols)
bst_project_ctrl_set_project (BST_PROJECT_CTRL (self->pcontrols), self->project);
-
++
bst_app_reload_pages (self);
-
++
/* update menu entries
*/
gxk_widget_update_actions (self);
-
++
return self;
}
+
BstApp*
bst_app_find (SfiProxy project)
{
GSList *slist;
-
++
g_return_val_if_fail (BSE_IS_PROJECT (project), NULL);
-
++
for (slist = bst_app_class->apps; slist; slist = slist->next)
{
BstApp *app = (BstApp*) slist->data;
-
++
if (app->project == project)
return app;
}
@@@ -501,6 -550,7 +544,7 @@@ static voi
bst_app_reload_pages (BstApp *self)
{
g_return_if_fail (BST_IS_APP (self));
-
++
GtkWidget *old_focus = GTK_WINDOW (self)->focus_widget;
if (old_focus)
gtk_widget_ref (old_focus);
@@@ -599,7 -655,9 +649,9 @@@ static voi
rebuild_super_shell (BstSuperShell *super_shell)
{
SfiProxy proxy;
-
++
g_return_if_fail (BST_IS_SUPER_SHELL (super_shell));
-
++
proxy = super_shell->super;
bse_item_use (proxy);
bst_super_shell_set_super (super_shell, 0);
@@@ -743,6 -812,7 +806,7 @@@ bst_app_run_script_proc (gpointer data
BseCategory *cat = bse_category_from_id (category_id);
SfiProxy super = bst_app_get_current_super (self);
const gchar *song = "", *wave_repo = "", *snet = "", *csynth = "";
-
++
if (BSE_IS_SONG (super))
song = "song";
else if (BSE_IS_WAVE_REPO (super))
@@@ -753,6 -823,7 +817,7 @@@
if (BSE_IS_CSYNTH (super))
csynth = "custom-synth";
}
-
++
bst_procedure_exec_auto (cat->type,
"project", SFI_TYPE_PROXY, self->project,
song, SFI_TYPE_PROXY, super,
@@@ -775,7 -848,9 +842,9 @@@ app_action_exec (gpointer data
BstApp *self = BST_APP (data);
const gchar *docs_url = NULL, *docs_title = "";
GtkWidget *widget = GTK_WIDGET (self);
-
++
gxk_status_window_push (widget);
-
++
switch (action)
{
SfiProxy proxy;
@@@ -785,6 -860,7 +854,7 @@@
if (bst_app_class)
{
GSList *slist, *free_slist = g_slist_copy (bst_app_class->apps);
-
++
for (slist = free_slist; slist; slist = slist->next)
gxk_toplevel_delete ((GtkWidget*) slist->data);
g_slist_free (free_slist);
@@@ -798,9 -874,11 +868,11 @@@
{
SfiProxy project = bse_server_use_new_project (BSE_SERVER, "Untitled.bse");
BstApp *new_app;
-
++
bse_project_get_wave_repo (project);
new_app = bst_app_new (project);
bse_item_unuse (project);
-
++
gxk_idle_show_widget (GTK_WIDGET (new_app));
}
break;
@@@ -875,6 -953,7 +947,7 @@@
BstRackEditor *ed = (BstRackEditor*) g_object_new (BST_TYPE_RACK_EDITOR,
"visible", TRUE,
NULL);
-
++
self->rack_editor = (GtkWidget*) g_object_connect (ed, "swapped_signal::destroy",
g_nullify_pointer, &self->rack_editor, NULL);
bst_rack_editor_set_rack_view (ed, bse_project_get_data_pocket (self->project,
"BEAST-Rack-View"));
self->rack_dialog = (GtkWidget*) gxk_dialog_new (&self->rack_dialog,
@@@ -915,6 -994,7 +988,7 @@@
if (!bst_proc_browser)
{
GtkWidget *widget;
-
++
widget = bst_proc_browser_new ();
gtk_widget_show (widget);
bst_proc_browser = gxk_dialog_new (&bst_proc_browser,
@@@ -1043,9 -1126,12 +1117,12 @@@
g_assert_not_reached ();
break;
}
-
++
gxk_status_window_pop ();
-
++
gxk_widget_update_actions_downwards (self);
}
+
static gboolean
app_action_check (gpointer data,
gulong action,
@@@ -1145,9 -1234,14 +1223,14 @@@ bst_app_class_init (BstAppClass *klass
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
++
bst_app_class = klass;
-
++
gobject_class->finalize = bst_app_finalize;
+
object_class->destroy = bst_app_destroy;
-
++
widget_class->delete_event = bst_app_handle_delete_event;
-
++
klass->apps = NULL;
}
diff --cc beast-gtk/bstasciipixbuf.cc
index 1f90856,1046ae0..5e8d528
--- a/beast-gtk/bstasciipixbuf.cc
+++ b/beast-gtk/bstasciipixbuf.cc
@@@ -56,8 -68,10 +68,10 @@@ bst_ascii_pixbuf_new (gchar character
g_object_unref (tmp_pixbuf);
}
bst_ascii_pixbuf_unref ();
-
++
return pixbuf;
}
+
void
bst_ascii_pixbuf_unref (void)
{
diff --cc beast-gtk/bstbseutils.cc
index 5107d6f,7bbdc7a..8dd0d92
--- a/beast-gtk/bstbseutils.cc
+++ b/beast-gtk/bstbseutils.cc
@@@ -64,5 -67,7 +67,7 @@@ bst_procedure_get_title (const gchar *p
}
return NULL;
}
+
+
/* --- generated code --- */
-#include "bstgenbseapi.cc"
+#include "bstoldbseapi.cc"
diff --cc beast-gtk/bstbusmixer.cc
index 386c440,7dd8d30..a5e90f9
--- a/beast-gtk/bstbusmixer.cc
+++ b/beast-gtk/bstbusmixer.cc
@@@ -73,11 -83,15 +83,15 @@@ GtkWidget
bst_bus_mixer_new (SfiProxy song)
{
GtkWidget *bus_mixer;
-
++
g_return_val_if_fail (BSE_IS_SONG (song), NULL);
-
++
bus_mixer = gtk_widget_new (BST_TYPE_BUS_MIXER, NULL);
bst_item_view_set_container (BST_ITEM_VIEW (bus_mixer), song);
-
++
return bus_mixer;
}
+
static void
bus_mixer_item_added (SfiProxy container,
SfiProxy item,
diff --cc beast-gtk/bstbusview.cc
index dbc05ea,0d3139d..204a682
--- a/beast-gtk/bstbusview.cc
+++ b/beast-gtk/bstbusview.cc
@@@ -21,8 -28,10 +28,10 @@@ static voi
bst_bus_view_class_init (BstBusViewClass *klass)
{
BstItemViewClass *item_view_class = BST_ITEM_VIEW_CLASS (klass);
-
++
item_view_class->item_type = "BseBus";
}
+
static void
bst_bus_view_init (BstBusView *self)
{
@@@ -43,11 -53,15 +53,15 @@@ GtkWidget
bst_bus_view_new (SfiProxy song)
{
GtkWidget *bus_view;
-
++
g_return_val_if_fail (BSE_IS_SONG (song), NULL);
-
++
bus_view = gtk_widget_new (BST_TYPE_BUS_VIEW, NULL);
bst_item_view_set_container (BST_ITEM_VIEW (bus_view), song);
-
++
return bus_view;
}
+
static void
bus_view_action_exec (gpointer data,
gulong action)
diff --cc beast-gtk/bstcanvaslink.cc
index a51ba49,0c63ded..c89c3dc
--- a/beast-gtk/bstcanvaslink.cc
+++ b/beast-gtk/bstcanvaslink.cc
@@@ -33,17 -41,23 +41,23 @@@ bst_canvas_link_destroy (GtkObject *obj
{
BstCanvasLink *clink = BST_CANVAS_LINK (object);
GnomeCanvasGroup *group = GNOME_CANVAS_GROUP (object);
-
++
while (group->item_list)
gtk_object_destroy ((GtkObject*) group->item_list->data);
-
++
bst_canvas_link_set_ocsource (clink, NULL, 0);
bst_canvas_link_set_icsource (clink, NULL, 0);
-
++
GTK_OBJECT_CLASS (bst_canvas_link_parent_class)->destroy (object);
}
+
GnomeCanvasItem*
bst_canvas_link_new (GnomeCanvasGroup *group)
{
GnomeCanvasItem *item;
-
++
g_return_val_if_fail (GNOME_IS_CANVAS_GROUP (group), NULL);
-
++
item = gnome_canvas_item_new (group,
BST_TYPE_CANVAS_LINK,
NULL);
@@@ -134,6 -158,7 +158,7 @@@ voi
bst_canvas_link_popup_view (BstCanvasLink *clink)
{
g_return_if_fail (BST_IS_CANVAS_LINK (clink));
-
++
if (!clink->link_view)
clink->link_view = (GtkWidget*) gxk_dialog_new (&clink->link_view,
GTK_OBJECT (clink),
@@@ -171,6 -201,7 +201,7 @@@ bst_canvas_link_set_ocsource (BstCanvas
g_return_if_fail (BST_IS_CANVAS_LINK (clink));
if (ocsource)
g_return_if_fail (BST_CANVAS_SOURCE (ocsource));
-
++
if (clink->ocsource)
{
if (clink->ocsource->source) /* source may be destroyed already */
@@@ -204,6 -236,7 +236,7 @@@ bst_canvas_link_set_icsource (BstCanvas
g_return_if_fail (BST_IS_CANVAS_LINK (clink));
if (icsource)
g_return_if_fail (BST_CANVAS_SOURCE (icsource));
-
++
if (clink->icsource)
{
if (clink->icsource->source) /* source may be destroyed already */
@@@ -338,6 -374,7 +374,7 @@@ bst_canvas_link_adjust_tags (BstCanvasL
{
GnomeCanvasPoints *gpoints;
gdouble x1, y1, x2, y2, *points;
-
++
if (!clink->line)
return;
gtk_object_get (GTK_OBJECT (clink->line), "points", &gpoints, NULL);
@@@ -366,33 -404,41 +404,41 @@@
"x2", x2,
"y2", y2,
NULL);
-
++
gnome_canvas_points_free (gpoints);
}
+
static void
bst_canvas_link_adjust_arrow (BstCanvasLink *clink)
{
GnomeCanvasPoints *gpoints;
gdouble dx, dy, l, x, y, px, py, cos_theta, sin_theta, *points;
-
++
if (!clink->line)
return;
gtk_object_get (GTK_OBJECT (clink->line), "points", &gpoints, NULL);
if (!gpoints)
gpoints = gnome_canvas_points_new0 (2);
points = gpoints->coords;
-
++
dx = points[0] - points[2];
dy = points[1] - points[3];
l = sqrt (dx * dx + dy * dy);
x = (points[2] + points[0]) / 2;
y = (points[3] + points[1]) / 2;
-
++
gnome_canvas_points_free (gpoints);
-
++
sin_theta = l ? dy / l : 0;
cos_theta = l ? dx / l : 0;
px = x - ARROW_LENGTH / 2.0 * cos_theta;
py = y - ARROW_LENGTH / 2.0 * sin_theta;
x += ARROW_LENGTH / 2.0 * cos_theta;
y += ARROW_LENGTH / 2.0 * sin_theta;
-
++
gpoints = gnome_canvas_points_new (4);
points = gpoints->coords;
-
++
*(points++) = px;
*(points++) = py;
*(points++) = x - ARROW_WIDTH * sin_theta;
@@@ -434,6 -484,7 +480,7 @@@ bst_canvas_link_event (GnomeCanvasItem
&clink->end_move_dy);
}
clink->in_move = TRUE;
-
++
fleur = gdk_cursor_new (GDK_FLEUR);
gnome_canvas_item_grab (item,
GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
@@@ -447,6 -498,7 +494,7 @@@
if (clink->in_move && clink->ocsource)
{
gdouble x = event->motion.x, y = event->motion.y;
-
++
gnome_canvas_item_w2i (GNOME_CANVAS_ITEM (clink->ocsource), &x, &y);
gnome_canvas_item_move (GNOME_CANVAS_ITEM (clink->ocsource),
x - clink->start_move_dx,
@@@ -457,6 -509,7 +505,7 @@@
if (clink->in_move && clink->icsource)
{
gdouble x = event->motion.x, y = event->motion.y;
-
++
gnome_canvas_item_w2i (GNOME_CANVAS_ITEM (clink->icsource), &x, &y);
gnome_canvas_item_move (GNOME_CANVAS_ITEM (clink->icsource),
x - clink->end_move_dx,
@@@ -476,10 -529,13 +525,13 @@@
default:
break;
}
-
++
if (!handled && GNOME_CANVAS_ITEM_CLASS (bst_canvas_link_parent_class)->event)
handled |= GNOME_CANVAS_ITEM_CLASS (bst_canvas_link_parent_class)->event (item, event);
-
++
return handled;
}
+
static gboolean
bst_canvas_link_child_event (GnomeCanvasItem *item,
GdkEvent *event)
@@@ -487,7 -543,9 +539,9 @@@
BstCanvasLink *clink;
GtkWidget *widget = GTK_WIDGET (item->canvas);
gboolean handled = FALSE;
-
++
clink = BST_CANVAS_LINK (item);
+
switch (event->type)
{
case GDK_ENTER_NOTIFY:
@@@ -526,17 -584,21 +580,21 @@@
default:
break;
}
-
++
return handled;
}
+
static void
bst_canvas_link_class_init (BstCanvasLinkClass *klass)
{
GtkObjectClass *object_class;
GnomeCanvasItemClass *canvas_item_class;
GnomeCanvasGroupClass *canvas_group_class;
-
++
object_class = GTK_OBJECT_CLASS (klass);
canvas_item_class = GNOME_CANVAS_ITEM_CLASS (klass);
canvas_group_class = GNOME_CANVAS_GROUP_CLASS (klass);
-
++
object_class->destroy = bst_canvas_link_destroy;
canvas_item_class->event = bst_canvas_link_event;
}
diff --cc beast-gtk/bstcanvassource.cc
index 68556db,97bd39d..e4fb96d
--- a/beast-gtk/bstcanvassource.cc
+++ b/beast-gtk/bstcanvassource.cc
@@@ -55,6 -66,7 +66,7 @@@ static voi
bst_canvas_source_init (BstCanvasSource *csource)
{
GtkObject *object = GTK_OBJECT (csource);
-
++
csource->source = 0;
csource->params_dialog = NULL;
csource->source_info = NULL;
@@@ -210,11 -246,15 +246,15 @@@ bst_canvas_source_new (GnomeCanvasGrou
"swapped_signal::property-notify::pos-y", source_pos_changed, csource,
"swapped_signal::icon-changed", source_icon_changed, csource,
NULL);
+
canvas_source_set_position (csource);
bst_canvas_source_build (csource);
-
++
GNOME_CANVAS_NOTIFY (item);
-
++
return item;
}
+
void
bst_canvas_source_update_links (BstCanvasSource *csource)
{
@@@ -352,6 -412,7 +412,7 @@@ csource_info_update (BstCanvasSource *c
string = bse_item_get_type_authors (csource->source);
if (string && string[0])
gxk_scroll_text_aprintf (text, "\nAuthors: %s\n", string);
-
++
/* license */
string = bse_item_get_type_license (csource->source);
if (string && string[0])
@@@ -430,7 -503,9 +503,9 @@@ bst_canvas_source_ichannel_pos (BstCanv
gdouble *y_p)
{
gdouble x = 0, y = 0;
-
++
g_return_if_fail (BST_IS_CANVAS_SOURCE (csource));
-
++
x = ICHANNEL_X (csource) + CHANNEL_WIDTH (csource) / 2;
if (csource->source)
y = CHANNEL_HEIGHT (csource) / bse_source_n_ichannels (csource->source);
@@@ -449,7 -525,9 +525,9 @@@ bst_canvas_source_ochannel_pos (BstCanv
gdouble *y_p)
{
gdouble x, y;
-
++
g_return_if_fail (BST_IS_CANVAS_SOURCE (csource));
-
++
x = OCHANNEL_X (csource) + CHANNEL_WIDTH (csource) / 2;
if (csource->source)
y = CHANNEL_HEIGHT (csource) / bse_source_n_ochannels (csource->source);
@@@ -667,7 -769,9 +769,9 @@@ bst_canvas_source_build_async (gpointe
{
BstCanvasSource *csource = BST_CANVAS_SOURCE (item);
GnomeCanvasGroup *group = GNOME_CANVAS_GROUP (csource);
-
++
/* keep in mind, that creation order affects stacking */
+
/* add input and output channel items */
if (!csource->built_ichannels)
{
@@@ -706,6 -811,7 +811,7 @@@
source_icon_changed (csource);
return TRUE;
}
-
++
if (!csource->text)
{
/* add text item, invoke name_changed callback to setup the text value */
@@@ -808,6 -918,7 +918,7 @@@ bst_canvas_source_event (GnomeCanvasIte
{
BstCanvasSource *csource = BST_CANVAS_SOURCE (item);
gboolean handled = FALSE;
-
++
switch (event->type)
{
case GDK_BUTTON_PRESS:
@@@ -834,6 -945,7 +945,7 @@@
if (csource->in_move)
{
gdouble x = event->motion.x, y = event->motion.y;
-
++
gnome_canvas_item_w2i (item, &x, &y);
gnome_canvas_item_move (item, x - csource->move_dx, y - csource->move_dy);
GNOME_CANVAS_NOTIFY (item);
@@@ -879,10 -992,13 +992,13 @@@
default:
break;
}
-
++
if (!handled && GNOME_CANVAS_ITEM_CLASS (bst_canvas_source_parent_class)->event)
handled = GNOME_CANVAS_ITEM_CLASS (bst_canvas_source_parent_class)->event (item, event);
-
++
return handled;
}
+
static gboolean
bst_canvas_source_child_event (BstCanvasSource *csource,
GdkEvent *event,
@@@ -891,7 -1007,9 +1007,9 @@@
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (csource);
GtkWidget *widget = GTK_WIDGET (item->canvas);
gboolean handled = FALSE;
-
++
csource = BST_CANVAS_SOURCE (item);
+
switch (event->type)
{
case GDK_ENTER_NOTIFY:
@@@ -924,14 -1042,17 +1042,17 @@@
default:
break;
}
-
++
return handled;
}
+
static void
bst_canvas_source_class_init (BstCanvasSourceClass *klass)
{
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GnomeCanvasItemClass *canvas_item_class = GNOME_CANVAS_ITEM_CLASS (klass);
/* GnomeCanvasGroupClass *canvas_group_class = GNOME_CANVAS_GROUP_CLASS (klass); */
-
++
object_class->destroy = bst_canvas_source_destroy;
canvas_item_class->event = bst_canvas_source_event;
klass->update_links = NULL;
diff --cc beast-gtk/bstcluehunter.cc
index ab45547,017d45c..44b6fb7
--- a/beast-gtk/bstcluehunter.cc
+++ b/beast-gtk/bstcluehunter.cc
@@@ -59,6 -69,7 +69,7 @@@ GtkTyp
bst_clue_hunter_get_type (void)
{
static GtkType clue_hunter_type = 0;
-
++
if (!clue_hunter_type)
{
GtkTypeInfo clue_hunter_info =
@@@ -82,13 -94,18 +94,18 @@@ bst_clue_hunter_class_init (BstClueHunt
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
bst_clue_hunter_class = klass;
parent_class = (GtkWindowClass*) g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = bst_clue_hunter_set_property;
gobject_class->get_property = bst_clue_hunter_get_property;
gobject_class->finalize = bst_clue_hunter_finalize;
+
object_class->destroy = bst_clue_hunter_destroy;
-
++
widget_class->event = bst_clue_hunter_event;
-
++
klass->activate = bst_clue_hunter_do_activate;
klass->popup = bst_clue_hunter_do_popup;
klass->popdown = bst_clue_hunter_do_popdown;
@@@ -153,6 -173,7 +173,7 @@@ bst_clue_hunter_init (BstClueHunter *se
{
GtkWidget *parent;
GtkCList *clist;
-
++
self->popped_up = FALSE;
self->completion_tag = FALSE;
self->pattern_matching = TRUE;
@@@ -258,10 -288,13 +288,13 @@@ bst_clue_hunter_destroy (GtkObject *obj
if (self->clist)
g_object_unref (self->clist);
self->clist = NULL;
-
++
if (self->entry)
bst_clue_hunter_set_entry (self, NULL);
+
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
+
static void
bst_clue_hunter_finalize (GObject *object)
{
@@@ -269,8 -303,10 +303,10 @@@
if (self->align_widget)
g_object_unref (self->align_widget);
g_free (self->cstring);
-
++
G_OBJECT_CLASS (parent_class)->finalize (object);
}
+
static gint
bst_clue_hunter_clist_click (BstClueHunter *self,
GdkEvent *event,
@@@ -400,6 -456,7 +456,7 @@@ bst_clue_hunter_entry_key_press (BstClu
GtkEntry *entry)
{
gboolean handled = FALSE;
-
++
if ((event->keyval == GDK_Tab || event->keyval == GDK_ISO_Left_Tab) &&
!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK)))
{
@@@ -484,8 -547,10 +547,10 @@@ bst_clue_hunter_add_string (BstClueHunt
const gchar *string)
{
gchar **text;
-
++
g_return_if_fail (BST_IS_CLUE_HUNTER (self));
g_return_if_fail (string != NULL);
+
text = g_new0 (gchar*, self->clist->columns);
text[self->clist_column] = (gchar*) string;
gtk_clist_insert (self->clist, 0, text);
@@@ -497,8 -563,10 +563,10 @@@ bst_clue_hunter_remove_string (BstClueH
{
GList *list;
guint n = 0;
-
++
g_return_if_fail (BST_IS_CLUE_HUNTER (self));
g_return_if_fail (string != NULL);
+
for (list = self->clist->row_list; list; list = list->next)
{
GtkCListRow *clist_row = (GtkCListRow*) list->data;
@@@ -518,6 -588,7 +588,7 @@@ bst_clue_hunter_remove_matches (BstClue
GPatternSpec *pspec;
GList *list;
guint n = 0;
-
++
g_return_if_fail (BST_IS_CLUE_HUNTER (self));
if (!pattern)
pattern = "*";
@@@ -543,15 -618,20 +618,20 @@@ string_list_intersect (guint max_len
{
gchar *completion;
guint l = 0;
-
++
if (!strings || !max_len)
return NULL;
-
++
completion = g_new (gchar, max_len + 1);
-
++
while (l < max_len)
{
gchar *s = (gchar*) strings->data;
GSList *slist;
-
++
s += l;
completion[l] = *s;
-
++
for (slist = strings->next; slist; slist = slist->next)
{
s = (char*) slist->data;
@@@ -564,8 -644,10 +644,10 @@@
l++;
}
completion[l] = 0;
-
++
return g_renew (gchar, completion, completion[0] ? l + 1 : 0);
}
+
gchar*
bst_clue_hunter_try_complete (BstClueHunter *self)
{
@@@ -573,10 -655,13 +655,13 @@@
gchar *completion;
GSList *strings = NULL;
guint max_len = 0, n = 0;
-
++
g_return_val_if_fail (BST_IS_CLUE_HUNTER (self), NULL);
+
for (list = self->clist->row_list; list; list = list->next)
{
GtkCListRow *clist_row = (GtkCListRow*) list->data;
-
++
if (g_list_find (self->clist->selection, GINT_TO_POINTER (n)))
{
gchar *ctext = clist_row->cell[self->clist_column].u.text;
@@@ -587,10 -673,13 +673,13 @@@
}
n++;
}
+
completion = string_list_intersect (max_len, strings);
g_slist_free (strings);
-
++
return completion;
}
+
void
bst_clue_hunter_poll_refresh (BstClueHunter *self)
{
@@@ -768,6 -879,7 +879,7 @@@ bst_clue_hunter_do_select_on (BstClueHu
{
guint n = 0;
gboolean check_visibility = TRUE;
-
++
for (list = self->clist->row_list; list; list = list->next)
{
GtkCListRow *clist_row = (GtkCListRow*) list->data;
@@@ -833,6 -947,7 +947,7 @@@ bst_clue_hunter_event (GtkWidget *widge
else
handled = gtk_widget_event (GTK_WIDGET (self->entry), event);
break;
-
++
case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
if (event->button.window == self->clist->clist_window)
@@@ -865,6 -980,7 +980,7 @@@
if (ev_widget == widget && event->type == GDK_BUTTON_PRESS)
{
gint w, h;
-
++
gdk_window_get_size (widget->window, &w, &h);
if (event->button.x > w || event->button.y > h ||
event->button.x < 0 || event->button.y < 0)
@@@ -886,5 -1002,6 +1002,6 @@@
default:
break;
}
-
++
return handled;
}
diff --cc beast-gtk/bstdbmeter.cc
index 6fcf3fc,9486ea5..663bcd6
--- a/beast-gtk/bstdbmeter.cc
+++ b/beast-gtk/bstdbmeter.cc
@@@ -493,6 -524,7 +524,7 @@@ bst_db_labeling_expose (GtkWidget
gdk_draw_line (widget->window, widget->style->black_gc, widget->allocation.x +
widget->allocation.width-1, widget->allocation.y,
widget->allocation.x, widget->allocation.y + widget->allocation.height-1);
}
-
++
GdkGC *dark_gc = widget->style->light_gc[widget->state];
GdkGC *line_gc = widget->style->fg_gc[widget->state];
GdkGC *light_gc = widget->style->dark_gc[widget->state];
@@@ -618,8 -650,10 +650,10 @@@
/* vline bar */
if (draw_longitudinal)
db_labeling_draw_vline (self, line_gc, allocation->x, allocation->y, dbsetup->offset, dbsetup->length,
longitudinal_pos);
-
++
return FALSE;
}
+
void
bst_db_labeling_setup (BstDBLabeling *self,
BstDBSetup *db_setup)
@@@ -694,13 -732,17 +732,17 @@@ bst_db_labeling_class_init (BstDBLabeli
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
++
gobject_class->set_property = bst_db_labeling_set_property;
gobject_class->get_property = bst_db_labeling_get_property;
gobject_class->finalize = bst_db_labeling_finalize;
-
++
object_class->destroy = bst_db_labeling_destroy;
-
++
widget_class->size_request = bst_db_labeling_size_request;
widget_class->size_allocate = bst_db_labeling_size_allocate;
widget_class->expose_event = bst_db_labeling_expose;
-
++
g_object_class_install_property (gobject_class, PROP_DRAW_VALUES,
g_param_spec_boolean ("draw-values", _("Draw Values"), _("Adjust whether
to draw dB values instead of lines"),
FALSE, G_PARAM_READWRITE));
@@@ -964,15 -1028,19 +1028,19 @@@ bst_db_beam_class_init (BstDBBeamClass
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
++
gobject_class->set_property = bst_db_beam_set_property;
gobject_class->get_property = bst_db_beam_get_property;
gobject_class->finalize = bst_db_beam_finalize;
-
++
object_class->destroy = bst_db_beam_destroy;
-
++
widget_class->size_request = bst_db_beam_size_request;
widget_class->size_allocate = bst_db_beam_size_allocate;
widget_class->realize = bst_db_beam_realize;
widget_class->unrealize = bst_db_beam_unrealize;
widget_class->expose_event = bst_db_beam_expose;
-
++
g_object_class_install_property (gobject_class, PROP_ORIENTATION,
g_param_spec_enum ("orientation", _("Orientation"), _("Choose horizontal
or vertical orientation"),
GTK_TYPE_ORIENTATION, GTK_ORIENTATION_VERTICAL,
G_PARAM_READWRITE));
@@@ -1434,11 -1532,15 +1532,15 @@@ bst_db_meter_class_init (BstDBMeterClas
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
++
gobject_class->set_property = bst_db_meter_set_property;
gobject_class->get_property = bst_db_meter_get_property;
gobject_class->finalize = bst_db_meter_finalize;
-
++
object_class->destroy = bst_db_meter_destroy;
+
widget_class->size_allocate = bst_db_meter_size_allocate;
+
g_object_class_install_property (gobject_class, PROP_ORIENTATION,
g_param_spec_enum ("orientation", _("Orientation"), _("Choose horizontal
or vertical orientation"),
GTK_TYPE_ORIENTATION, GTK_ORIENTATION_VERTICAL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
diff --cc beast-gtk/bstdial.cc
index d016ac4,91b4828..016decc
--- a/beast-gtk/bstdial.cc
+++ b/beast-gtk/bstdial.cc
@@@ -39,6 -44,7 +44,7 @@@ GtkTyp
bst_dial_get_type (void)
{
static GtkType dial_type = 0;
-
++
if (!dial_type)
{
GtkTypeInfo dial_info =
@@@ -52,17 -58,23 +58,23 @@@
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
-
++
dial_type = gtk_type_unique (GTK_TYPE_WIDGET, &dial_info);
}
-
++
return dial_type;
}
+
static void
bst_dial_class_init (BstDialClass *klass)
{
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
parent_class = (GtkWidgetClass*) g_type_class_peek_parent (klass);
-
++
object_class->destroy = bst_dial_destroy;
-
++
widget_class->size_request = bst_dial_size_request;
widget_class->size_allocate = bst_dial_size_allocate;
widget_class->realize = bst_dial_realize;
@@@ -89,20 -103,26 +103,26 @@@ static voi
bst_dial_destroy (GtkObject *object)
{
BstDial *dial;
-
++
g_return_if_fail (BST_IS_DIAL (object));
-
++
dial = BST_DIAL (object);
+
bst_dial_set_align_widget (dial, 0, 0, 0);
+
if (dial->timer)
{
gtk_timeout_remove (dial->timer);
dial->timer = 0;
}
-
++
if (dial->adjustment)
{
gtk_signal_disconnect_by_data (dial->adjustment, dial);
gtk_object_unref (dial->adjustment);
dial->adjustment = NULL;
}
-
++
/* chain parent class' handler */
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
@@@ -159,7 -186,9 +186,9 @@@ bst_dial_realize (GtkWidget *widget
// BstDial *dial = BST_DIAL (widget);
GdkWindowAttr attributes;
gint attributes_mask;
-
++
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
++
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = widget->allocation.width;
@@@ -172,12 -201,16 +201,16 @@@
GDK_POINTER_MOTION_HINT_MASK);
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
-
++
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gdk_window_set_user_data (widget->window, widget);
-
++
widget->style = gtk_style_attach (widget->style, widget->window);
-
++
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
}
+
static gint
bst_dial_expose (GtkWidget *widget,
GdkEventExpose *event)
@@@ -254,8 -293,10 +293,10 @@@ bst_dial_paint (BstDial *dial
theta = M_PI - (i * M_PI / ((double) n_steps));
s = sin (theta);
c = cos (theta);
-
++
/* draw every nth tick with doubled length */
tick_length = (i % thick_step == 0) ? pointer_width : pointer_width / 2;
-
++
/* draw the ticks as a polygon to get proper shading */
points[0].x = xc + c * (radius - tick_length);
points[0].y = yc - s * (radius - tick_length);
@@@ -271,6 -312,7 +312,7 @@@
else
gdk_draw_polygon (widget->window, widget->style->black_gc, FALSE, points, 2);
}
-
++
/* draw the pointer
*/
s = sin (dial->angle);
@@@ -308,43 -352,57 +352,57 @@@ bst_dial_button_press (GtkWidget *
if (!dial->button)
{
dial->button = event->button;
-
++
bst_dial_mouse_update (dial, event->x, event->y);
}
+
return TRUE;
}
+
static gint
bst_dial_motion_notify (GtkWidget *widget,
GdkEventMotion *event)
{
BstDial *dial = BST_DIAL (widget);
-
++
if (dial->button != 0 && event->window == widget->window)
{
if (event->is_hint)
gdk_window_get_pointer (widget->window, NULL, NULL, NULL);
-
++
bst_dial_mouse_update (dial, event->x, event->y);
}
-
++
return TRUE;
}
+
static gint
bst_dial_button_release (GtkWidget *widget,
GdkEventButton *event)
{
BstDial *dial = BST_DIAL (widget);
-
++
if (dial->button == event->button)
{
GtkAdjustment *adjustment = GTK_ADJUSTMENT (dial->adjustment);
+
bst_dial_mouse_update (dial, event->x, event->y);
+
dial->button = 0;
-
++
if (dial->timer)
{
gtk_timeout_remove (dial->timer);
dial->timer = 0;
}
-
++
if (dial->old_value != adjustment->value)
gtk_adjustment_value_changed (GTK_ADJUSTMENT (dial->adjustment));
}
-
++
return TRUE;
}
+
static void
bst_dial_mouse_update (BstDial *dial,
gint x,
@@@ -354,9 -412,12 +412,12 @@@
GtkWidget *widget;
gint xc, yc;
gdouble angle;
-
++
g_return_if_fail (BST_IS_DIAL (dial));
-
++
widget = GTK_WIDGET (dial);
adjustment = GTK_ADJUSTMENT (dial->adjustment);
+
/* figure the arc's center */
xc = widget->allocation.width / 2;
yc = (widget->allocation.height - dial->radius) / 2 + dial->radius;
@@@ -374,6 -437,7 +437,7 @@@
/* compute new adjustment value, translated to its lower...upper range */
adjustment->value = (adjustment->lower +
(1.0 - angle / M_PI) * (adjustment->upper - adjustment->lower -
adjustment->page_size));
-
++
/* if the adjustment value changed:
* - for continuous updates: emit the GtkAdjustment::value_changed signal
* - for delayed updates: install a timer to emit the changed signal, if
@@@ -391,6 -455,7 +455,7 @@@
/* restart timer, so the delay interval starts from scratch */
if (dial->timer)
gtk_timeout_remove (dial->timer);
-
++
dial->timer = gtk_timeout_add (SCROLL_DELAY_LENGTH,
bst_dial_timer,
dial);
@@@ -406,39 -473,55 +473,55 @@@ static gboolea
bst_dial_timer (gpointer data)
{
BstDial *dial;
-
++
GDK_THREADS_ENTER ();
+
dial = BST_DIAL (data);
+
gtk_adjustment_value_changed (GTK_ADJUSTMENT (dial->adjustment));
+
dial->timer = 0;
-
++
GDK_THREADS_LEAVE ();
+
return FALSE;
}
+
GtkWidget*
bst_dial_new (GtkAdjustment *adjustment)
{
GtkWidget *dial;
-
++
if (adjustment)
g_return_val_if_fail (GTK_IS_ADJUSTMENT (adjustment), NULL);
else
adjustment = (GtkAdjustment*) gtk_adjustment_new (0.0, 0.0, 250.0, 0.0, 0.0, 0.0);
-
++
dial = gtk_widget_new (BST_TYPE_DIAL, NULL);
-
++
bst_dial_set_adjustment (BST_DIAL (dial), adjustment);
-
++
return dial;
}
+
GtkAdjustment*
bst_dial_get_adjustment (BstDial *dial)
{
g_return_val_if_fail (BST_IS_DIAL (dial), NULL);
-
++
return GTK_ADJUSTMENT (dial->adjustment);
}
+
void
bst_dial_set_update_policy (BstDial *dial,
GtkUpdateType policy)
{
g_return_if_fail (BST_IS_DIAL (dial));
-
++
if (dial->update_policy != policy)
{
dial->update_policy = policy;
-
++
/* remove a pending timer if necessary */
if (dial->timer)
{
@@@ -457,14 -542,18 +542,18 @@@ bst_dial_set_adjustment (BstDial
{
g_return_if_fail (BST_IS_DIAL (dial));
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
-
++
if (dial->adjustment)
{
gtk_signal_disconnect_by_data (dial->adjustment, dial);
gtk_object_unref (dial->adjustment);
}
-
++
dial->adjustment = GTK_OBJECT (adjustment);
-
++
gtk_object_ref (dial->adjustment);
gtk_object_sink (dial->adjustment);
-
++
gtk_signal_connect (dial->adjustment,
"changed",
GTK_SIGNAL_FUNC (bst_dial_adjustment_changed),
@@@ -473,20 -562,26 +562,26 @@@
"value_changed",
GTK_SIGNAL_FUNC (bst_dial_adjustment_value_changed),
dial);
-
++
dial->old_value = adjustment->value;
dial->old_lower = adjustment->lower;
dial->old_upper = adjustment->upper;
dial->old_page_size = adjustment->page_size;
-
++
bst_dial_update (dial);
}
+
static void
bst_dial_adjustment_changed (GtkAdjustment *adjustment,
gpointer data)
{
BstDial *dial;
-
++
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
g_return_if_fail (data != NULL);
-
++
dial = BST_DIAL (data);
-
++
if (dial->old_value != adjustment->value ||
dial->old_lower != adjustment->lower ||
dial->old_upper != adjustment->upper ||
@@@ -504,9 -601,12 +601,12 @@@ bst_dial_adjustment_value_changed (GtkA
gpointer data)
{
BstDial *dial;
-
++
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
g_return_if_fail (data != NULL);
-
++
dial = BST_DIAL (data);
-
++
if (dial->old_value != adjustment->value)
{
dial->old_value = adjustment->value;
@@@ -519,10 -621,14 +621,14 @@@ bst_dial_update (BstDial *dial
GtkAdjustment *adjustment;
GtkWidget *widget;
gdouble new_value;
-
++
g_return_if_fail (BST_IS_DIAL (dial));
-
++
widget = GTK_WIDGET (dial);
adjustment = GTK_ADJUSTMENT (dial->adjustment);
-
++
new_value = CLAMP (adjustment->value, adjustment->lower, adjustment->upper - adjustment->page_size);
+
if (new_value != adjustment->value)
{
if (0)
@@@ -531,10 -637,13 +637,13 @@@
adjustment->value = new_value;
gtk_adjustment_value_changed (GTK_ADJUSTMENT (dial->adjustment));
}
-
++
dial->angle = (M_PI - M_PI * (adjustment->value - adjustment->lower) /
(adjustment->upper - adjustment->page_size - adjustment->lower));
-
++
gtk_widget_queue_draw (widget);
}
+
void
bst_dial_set_align_widget (BstDial *dial,
GtkWidget *widget,
diff --cc beast-gtk/bstdial.hh
index 96072cb,8e1a4a0..4fd02ef
--- a/beast-gtk/bstdial.hh
+++ b/beast-gtk/bstdial.hh
@@@ -17,26 -24,34 +24,34 @@@ typedef struct _BstDialClass BstDialCla
struct _BstDial
{
GtkWidget parent_object;
-
++
/* The update policy: GTK_UPDATE_CONTINUOUS,
* GTK_UPDATE_DISCONTINUOUS or GTK_UPDATE_DELAYED
*/
GtkUpdateType update_policy;
-
++
GtkWidget *align_widget;
guint align_width : 1;
-
++
/* The button currently pressed or 0 if none */
guint8 button;
-
++
/* Dimensions of dial components */
gint radius;
gint pointer_width;
-
++
/* ID of update timer for delayed updates, or 0 if none */
guint timer;
-
++
/* Current angle of the pointer */
gdouble angle;
-
++
/* Old values from GtkAdjustment, stored so we know when something changed */
gdouble old_value;
gdouble old_lower;
gdouble old_upper;
gdouble old_page_size;
-
++
/* The adjustment object that stores the data for this dial */
GtkObject *adjustment;
};
@@@ -44,6 -59,8 +59,8 @@@ struct _BstDialClas
{
GtkWidgetClass parent_class;
};
-
++
+
GtkType bst_dial_get_type (void);
GtkWidget* bst_dial_new (GtkAdjustment *adjustment);
void bst_dial_set_adjustment (BstDial *dial,
diff --cc beast-gtk/bsteffectview.cc
index 81f8cf8,fb039bf..abe549a
--- a/beast-gtk/bsteffectview.cc
+++ b/beast-gtk/bsteffectview.cc
@@@ -23,6 -31,7 +31,7 @@@ GtkTyp
bst_effect_view_get_type (void)
{
static GtkType effect_view_type = 0;
-
++
if (!effect_view_type)
{
GtkTypeInfo effect_view_info =
@@@ -36,25 -45,34 +45,34 @@@
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
-
++
effect_view_type = gtk_type_unique (GTK_TYPE_ALIGNMENT, &effect_view_info);
}
-
++
return effect_view_type;
}
+
static void
bst_effect_view_class_init (BstEffectViewClass *klass)
{
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
-
++
bst_effect_view_class = klass;
parent_class = gtk_type_class (GTK_TYPE_ALIGNMENT);
-
++
G_OBJECT_CLASS (klass)->finalize = bst_effect_view_finalize;
+
object_class->destroy = bst_effect_view_destroy;
-
++
klass->default_param_view_height = 60;
}
+
static void
bst_effect_view_init (BstEffectView *effect_view)
{
GtkWidget *alist_box, *pbox, *bbox, *sc_win;
GtkCList *clist;
-
++
/* setup containers */
effect_view->paned = gtk_widget_new (GTK_TYPE_HPANED,
"visible", TRUE,
@@@ -91,6 -109,7 +109,7 @@@
"yalign", 0.5,
NULL),
FALSE, TRUE, 0);
-
++
/* setup lists */
sc_win = gtk_widget_new (GTK_TYPE_SCROLLED_WINDOW,
"visible", TRUE,
@@@ -144,6 -163,7 +163,7 @@@
gtk_clist_set_column_auto_resize (clist, 0, TRUE);
gtk_clist_column_titles_show (clist);
gtk_clist_column_titles_passive (clist);
-
++
/* setup param view */
effect_view->param_view = bst_param_view_new (0);
gtk_widget_set (effect_view->param_view,
@@@ -153,6 -173,7 +173,7 @@@
NULL);
gtk_widget_ref (effect_view->param_view);
bst_param_view_set_mask (BST_PARAM_VIEW (effect_view->param_view), BSE_TYPE_EFFECT, 0, NULL, NULL);
-
++
/* setup buttons */
effect_view->add_button = g_object_connect (gtk_widget_new (GTK_TYPE_BUTTON,
"visible", TRUE,
@@@ -172,6 -193,7 +193,7 @@@
"swapped_signal::clicked", remove_effect, effect_view,
NULL);
gtk_widget_ref (effect_view->remove_button);
-
++
effect_view->pattern = NULL;
effect_view->channel = 0;
effect_view->row = 0;
@@@ -180,9 -203,12 +203,12 @@@ static voi
bst_effect_view_destroy (GtkObject *object)
{
BstEffectView *effect_view = BST_EFFECT_VIEW (object);
-
++
bst_effect_view_set_note (effect_view, NULL, 0, 0);
-
++
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
+
static void
bst_effect_view_finalize (GObject *object)
{
@@@ -200,10 -230,14 +230,14 @@@ GtkWidget
bst_effect_view_new (BseSong *song)
{
GtkWidget *effect_view;
-
++
g_return_val_if_fail (BSE_IS_SONG (song), NULL);
-
++
effect_view = gtk_widget_new (BST_TYPE_EFFECT_VIEW, NULL);
-
++
return effect_view;
}
+
void
bst_effect_view_set_note (BstEffectView *effect_view,
BsePattern *pattern,
@@@ -259,6 -298,7 +298,7 @@@ update_effect_lists (BstEffectView *eff
if (aclist && pclist)
{
guint i, n_effects = 0, ptype = ~0;
-
++
if (!aclist->selection)
{
BseCategory *cats;
@@@ -270,6 -311,7 +311,7 @@@
{
gchar *name = cats[i].category + cats[i].mindex + 1;
gint clist_row = gtk_clist_insert (aclist, 0, &name);
-
++
gtk_clist_set_row_data (aclist, clist_row, (gpointer) cats[i].type);
}
g_free (cats);
diff --cc beast-gtk/bsteventroll.cc
index 1fc7d2c,c83ffd8..6fdee38
--- a/beast-gtk/bsteventroll.cc
+++ b/beast-gtk/bsteventroll.cc
@@@ -81,6 -94,7 +94,7 @@@ bst_event_roll_init (BstEventRoll *self
self->selection_tick = 0;
self->selection_duration = 0;
bst_event_roll_hsetup (self, 384, 4, 800 * 384, 1);
-
++
bst_ascii_pixbuf_ref ();
gxk_scroll_canvas_set_canvas_cursor (GXK_SCROLL_CANVAS (self), GDK_LEFT_PTR);
gxk_scroll_canvas_set_left_panel_cursor (GXK_SCROLL_CANVAS (self), GDK_HAND2);
@@@ -89,9 -104,12 +104,12 @@@ static voi
bst_event_roll_destroy (GtkObject *object)
{
BstEventRoll *self = BST_EVENT_ROLL (object);
+
bst_event_roll_set_proxy (self, 0);
-
++
GTK_OBJECT_CLASS (bst_event_roll_parent_class)->destroy (object);
}
+
static void
bst_event_roll_dispose (GObject *object)
{
@@@ -579,11 -661,13 +661,13 @@@ bst_event_roll_set_view_selection (BstE
guint duration)
{
g_return_if_fail (BST_IS_EVENT_ROLL (self));
-
++
if (!duration) /* invalid selection */
{
tick = 0;
duration = 0;
}
-
++
if (self->selection_duration && duration)
{
/* if at least one corner of the old an the new selection
@@@ -701,10 -794,14 +794,14 @@@ bst_event_roll_class_init (BstEventRoll
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
GxkScrollCanvasClass *scroll_canvas_class = GXK_SCROLL_CANVAS_CLASS (klass);
+
gobject_class->dispose = bst_event_roll_dispose;
gobject_class->finalize = bst_event_roll_finalize;
+
object_class->destroy = bst_event_roll_destroy;
-
++
widget_class->realize = bst_event_roll_realize;
+
container_class->add = bst_event_roll_add;
container_class->remove = bst_event_roll_remove;
container_class->forall = bst_event_roll_forall;
@@@ -715,9 -813,12 +813,12 @@@
scroll_canvas_class->draw_left_panel = event_roll_draw_vpanel;
scroll_canvas_class->draw_canvas = event_roll_draw_canvas;
scroll_canvas_class->handle_drag = event_roll_handle_drag;
-
++
bst_skin_config_add_notify ((BstSkinConfigNotify) event_roll_class_setup_skin, klass);
event_roll_class_setup_skin (klass);
+
klass->canvas_clicked = NULL;
-
++
signal_canvas_drag = g_signal_new ("canvas-drag", G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (BstEventRollClass, canvas_drag),
NULL, NULL,
diff --cc beast-gtk/bsteventrollctrl.cc
index 1a45b07,f4b7cbf..c2b22a8
--- a/beast-gtk/bsteventrollctrl.cc
+++ b/beast-gtk/bsteventrollctrl.cc
@@@ -70,11 -82,14 +82,14 @@@ bst_event_roll_controller_new (BstEvent
GxkActionGroup *canvas_rtools)
{
BstEventRollController *self;
-
++
g_return_val_if_fail (BST_IS_EVENT_ROLL (eroll), NULL);
g_return_val_if_fail (quant_rtools && canvas_rtools, NULL);
+
self = g_new0 (BstEventRollController, 1);
self->eroll = eroll;
self->ref_count = 1;
-
++
self->ref_count++;
g_signal_connect_data (eroll, "canvas-drag",
G_CALLBACK (controller_canvas_drag),
@@@ -91,21 -106,27 +106,27 @@@
"swapped_signal::changed", controller_reset_canvas_cursor, self,
NULL);
controller_reset_canvas_cursor (self);
-
++
return self;
}
+
BstEventRollController*
bst_event_roll_controller_ref (BstEventRollController *self)
{
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (self->ref_count >= 1, NULL);
-
++
self->ref_count++;
-
++
return self;
}
+
void
bst_event_roll_controller_unref (BstEventRollController *self)
{
g_return_if_fail (self != NULL);
g_return_if_fail (self->ref_count >= 1);
-
++
self->ref_count--;
if (!self->ref_count)
{
@@@ -235,7 -260,9 +260,9 @@@ bst_event_roll_controller_clear (BstEve
BsePartControlSeq *cseq;
SfiProxy proxy;
guint i;
-
++
g_return_if_fail (self != NULL);
-
++
proxy = self->eroll->proxy;
cseq = bse_part_list_selected_controls (proxy, CONTROL_TYPE (self));
bse_item_group_undo (proxy, "Clear Selection");
@@@ -252,7 -280,9 +280,9 @@@ bst_event_roll_controller_cut (BstEvent
BsePartControlSeq *cseq;
SfiProxy proxy;
guint i;
-
++
g_return_if_fail (self != NULL);
-
++
proxy = self->eroll->proxy;
cseq = bse_part_list_selected_controls (proxy, CONTROL_TYPE (self));
bse_item_group_undo (proxy, "Cut Selection");
@@@ -269,7 -300,9 +300,9 @@@ bst_event_roll_controller_copy (BstEven
{
BsePartControlSeq *cseq;
SfiProxy proxy;
-
++
g_return_val_if_fail (self != NULL, FALSE);
-
++
proxy = self->eroll->proxy;
cseq = bse_part_list_selected_controls (proxy, CONTROL_TYPE (self));
bst_event_roll_controller_set_clipboard (cseq);
@@@ -280,7 -314,9 +314,9 @@@ bst_event_roll_controller_paste (BstEve
{
BsePartControlSeq *cseq;
SfiProxy proxy;
-
++
g_return_if_fail (self != NULL);
-
++
proxy = self->eroll->proxy;
cseq = bst_event_roll_controller_get_clipboard ();
if (cseq)
@@@ -402,6 -445,7 +445,7 @@@ move_group_motion (BstEventRollControll
{
SfiProxy part = self->eroll->proxy;
gint i, new_tick, delta_tick;
-
++
new_tick = bst_event_roll_controller_quantize (self, drag->current_tick);
delta_tick = self->obj_tick;
delta_tick -= new_tick;
@@@ -428,11 -473,13 +473,13 @@@ move_motion (BstEventRollController *se
{
SfiProxy part = self->eroll->proxy;
gint new_tick;
-
++
if (self->sel_cseq)
{
move_group_motion (self, drag);
return;
}
-
++
new_tick = bst_event_roll_controller_quantize (self, drag->current_tick);
if (new_tick != self->obj_tick)
{
@@@ -476,6 -526,7 +526,7 @@@ align_motion (BstEventRollController *s
SfiProxy part = self->eroll->proxy;
guint tick, duration, i;
BsePartControlSeq *cseq;
-
++
bse_item_group_undo (part, "Align Control Events");
bst_event_roll_segment_tick_range (self->eroll, &tick, &duration);
cseq = bse_part_list_controls (part, tick, duration, CONTROL_TYPE (self));
@@@ -551,6 -607,7 +607,7 @@@ resize_motion (BstEventRollController *
BstEventRollDrag *drag)
{
SfiProxy part = self->eroll->proxy;
-
++
/* apply new control event size */
if (drag->current_value != self->obj_value)
{
@@@ -598,6 -659,7 +659,7 @@@ select_motion (BstEventRollController *
SfiProxy part = self->eroll->proxy;
guint start_tick = MIN (drag->start_tick, drag->current_tick);
guint end_tick = MAX (drag->start_tick, drag->current_tick);
-
++
bst_event_roll_set_view_selection (drag->eroll, start_tick, end_tick - start_tick);
if (drag->type == GXK_DRAG_DONE)
{
@@@ -638,7 -704,9 +704,9 @@@ controller_canvas_drag (BstEventRollCon
{ BST_COMMON_ROLL_TOOL_SELECT, select_start, select_motion, select_abort, },
};
guint i;
-
++
// g_printerr ("canvas drag event, tick=%d (valid=%d) value=%f", drag->current_tick, drag->current_valid,
drag->current_value);
+
if (drag->type == GXK_DRAG_START)
{
BstCommonRollTool tool = BST_COMMON_ROLL_TOOL_NONE;
@@@ -684,6 -753,7 +753,7 @@@
if (self->sel_cseq)
g_warning ("leaking old drag selection (%p)", self->sel_cseq);
self->sel_cseq = NULL;
-
++
/* find drag tool */
tool = event_canvas_button_tool (self, drag->button, self->obj_id > 0);
for (i = 0; i < G_N_ELEMENTS (tool_table); i++)
@@@ -720,6 -791,7 +791,7 @@@ controller_vpanel_drag (BstEventRollCon
BstEventRollDrag *drag)
{
// g_printerr ("vpanel drag event, tick=%d (valid=%d) value=%f", drag->current_tick, drag->current_valid,
drag->current_value);
-
++
if (drag->type == GXK_DRAG_START ||
drag->type == GXK_DRAG_MOTION)
drag->state = GXK_DRAG_CONTINUE;
diff --cc beast-gtk/bstfiledialog.cc
index cb2b1a4,7913b3c..bfb3736
--- a/beast-gtk/bstfiledialog.cc
+++ b/beast-gtk/bstfiledialog.cc
@@@ -15,13 -20,16 +20,16 @@@ static voi
bst_file_dialog_class_init (BstFileDialogClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
++
gobject_class->finalize = bst_file_dialog_finalize;
}
+
static void
tree_viewable_changed (BstFileDialog *self)
{
gboolean viewable = gxk_widget_viewable (GTK_WIDGET (self->tview));
gboolean tvisible = GTK_WIDGET_VISIBLE (gtk_widget_get_toplevel (GTK_WIDGET (self->tview)));
-
++
if (viewable && !self->using_file_store)
{
self->using_file_store = TRUE;
@@@ -40,7 -49,9 +49,9 @@@ bst_file_dialog_init (BstFileDialog *se
GtkTreeModel *smodel;
GtkWidget *bbox, *vbox;
GtkWidget *main_box = GXK_DIALOG (self)->vbox;
-
++
self->ignore_activate = TRUE;
-
++
/* configure self */
g_object_set (self,
"flags", (GXK_DIALOG_HIDE_ON_DELETE |
@@@ -248,7 -277,9 +277,9 @@@ bst_file_dialog_set_mode (BstFileDialo
SfiProxy proxy)
{
GtkWindow *window = GTK_WINDOW (self);
-
++
g_return_if_fail (BST_IS_FILE_DIALOG (self));
+
gtk_widget_hide (GTK_WIDGET (self));
gtk_widget_hide (self->osave);
self->mode = mode;
@@@ -627,14 -713,17 +713,17 @@@ bst_file_dialog_popup_save_instrument (
{
BstFileDialog *self = bst_file_dialog_global_instrument ();
GtkWidget *widget = GTK_WIDGET (self);
-
++
bst_file_dialog_set_mode (self, parent_widget,
BST_FILE_DIALOG_SAVE_INSTRUMENT,
_("Save Instrument"), project);
self->super = super;
/* show dialog */
gxk_widget_showraise (widget);
-
++
return widget;
}
+
static gboolean
bst_file_dialog_save_instrument (BstFileDialog *self,
const gchar *file_name)
@@@ -668,8 -763,10 +763,10 @@@ bst_file_dialog_load_wave (BstFileDialo
bst_status_eprintf (error, _("Loading wave `%s'"), file_name);
if (error)
sfi_error (_("Failed to load wave file \"%s\": %s"), file_name, bse_error_blurb (error));
-
++
return TRUE;
}
+
GtkWidget*
bst_file_dialog_create (void)
{
@@@ -721,7 -822,9 +822,9 @@@ bst_file_dialog_set_handler (BstFileDia
GDestroyNotify destroy)
{
BstFileDialogData *data = g_new0 (BstFileDialogData, 1);
+
g_return_if_fail (GTK_WIDGET_VISIBLE (self));
-
++
data->handler = handler;
data->data = handler_data;
data->destroy = destroy;
diff --cc beast-gtk/bstfiledialog.hh
index 00effdf,4ccf7cd..93fc348
--- a/beast-gtk/bstfiledialog.hh
+++ b/beast-gtk/bstfiledialog.hh
@@@ -101,13 -111,16 +111,16 @@@ void bst_file_dialog_set_han
BstFileDialogHandler handler,
gpointer handler_data,
GDestroyNotify destroy);
+
G_END_DECLS
+
// == Flags Enumeration Operators in C++ ==
#ifdef __cplusplus
-inline BstFileDialogMode operator& (BstFileDialogMode s1, BstFileDialogMode s2) { return
BstFileDialogMode (s1 & (long long unsigned) s2); }
-inline BstFileDialogMode& operator&= (BstFileDialogMode &s1, BstFileDialogMode s2) { s1 = s1 & s2; return
s1; }
-inline BstFileDialogMode operator| (BstFileDialogMode s1, BstFileDialogMode s2) { return
BstFileDialogMode (s1 | (long long unsigned) s2); }
-inline BstFileDialogMode& operator|= (BstFileDialogMode &s1, BstFileDialogMode s2) { s1 = s1 | s2; return
s1; }
-inline BstFileDialogMode operator~ (BstFileDialogMode s1) { return BstFileDialogMode
(~(long long unsigned) s1); }
+constexpr BstFileDialogMode operator& (BstFileDialogMode s1, BstFileDialogMode s2) { return
BstFileDialogMode (s1 & (long long unsigned) s2); }
+inline BstFileDialogMode& operator&= (BstFileDialogMode &s1, BstFileDialogMode s2) { s1 = s1 & s2;
return s1; }
+constexpr BstFileDialogMode operator| (BstFileDialogMode s1, BstFileDialogMode s2) { return
BstFileDialogMode (s1 | (long long unsigned) s2); }
+inline BstFileDialogMode& operator|= (BstFileDialogMode &s1, BstFileDialogMode s2) { s1 = s1 | s2;
return s1; }
+constexpr BstFileDialogMode operator~ (BstFileDialogMode s1) { return
BstFileDialogMode (~(long long unsigned) s1); }
#endif // __cplusplus
+
#endif /* __BST_FILE_DIALOG_H__ */
diff --cc beast-gtk/bstitemseqdialog.cc
index 244a2bf,ab90f53..eb835c5
--- a/beast-gtk/bstitemseqdialog.cc
+++ b/beast-gtk/bstitemseqdialog.cc
@@@ -56,7 -66,9 +66,9 @@@ bst_item_seq_dialog_setup (BstItemSeqDi
SfiProxy proxy)
{
GtkWindow *window = GTK_WINDOW (self);
-
++
g_return_if_fail (BST_IS_ITEM_SEQ_DIALOG (self));
-
++
GxkFreeFunc selected_cleanup = self->selected_cleanup;
self->selected_callback = NULL;
self->selected_cleanup = NULL;
@@@ -274,6 -312,7 +312,7 @@@ bst_item_seq_dialog_init (BstItemSeqDia
GXK_DIALOG_MODAL),
NULL);
gxk_dialog_set_sizes (GXK_DIALOG (self), 550, 300, 600, 320);
-
++
/* dialog contents */
GxkRadget *radget = gxk_radget_create ("beast", "item-seq-box", NULL);
gxk_dialog_set_child (GXK_DIALOG (self), (GtkWidget*) radget);
@@@ -298,6 -338,7 +338,7 @@@
NULL, NULL, G_CONNECT_SWAPPED);
/* make row connections */
g_signal_connect_object (tview, "row_activated", G_CALLBACK (gtk_button_clicked), gxk_radget_find
(radget, "button-add"), G_CONNECT_SWAPPED);
-
++
/* item store and selection setup */
self->item_store = bst_item_seq_store_new (FALSE);
tview = (GtkTreeView*) gxk_radget_find (radget, "item-view");
@@@ -334,6 -378,8 +378,8 @@@ bst_item_seq_dialog_class_init (BstItem
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
++
gobject_class->finalize = bst_item_seq_dialog_finalize;
+
widget_class->delete_event = bst_item_seq_dialog_delete_event;
}
diff --cc beast-gtk/bstitemview.cc
index a530350,3263d5a..e18fb75
--- a/beast-gtk/bstitemview.cc
+++ b/beast-gtk/bstitemview.cc
@@@ -18,13 -23,19 +23,19 @@@ bst_item_view_class_init (BstItemViewCl
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
-
++
gobject_class->finalize = bst_item_view_finalize;
+
object_class->destroy = bst_item_view_destroy;
-
++
klass->item_type = NULL;
-
++
klass->listen_on = item_view_listen_on;
klass->unlisten_on = item_view_unlisten_on;
+
klass->set_container = item_view_set_container;
}
+
static void
bst_item_view_init (BstItemView *self)
{
@@@ -34,9 -46,12 +46,12 @@@ static voi
bst_item_view_destroy (GtkObject *object)
{
BstItemView *self = BST_ITEM_VIEW (object);
+
bst_item_view_set_container (self, 0);
-
++
GTK_OBJECT_CLASS (bst_item_view_parent_class)->destroy (object);
}
+
static void
bst_item_view_finalize (GObject *object)
{
@@@ -125,6 -155,7 +155,7 @@@ bst_item_view_set_tree (BstItemView *se
g_object_connect (gtk_tree_view_get_selection (self->tree),
"swapped_object_signal::changed", pview_selection_changed, self,
NULL);
-
++
/* adapt param view */
pview_selection_changed (self);
}
@@@ -147,6 -183,7 +183,7 @@@ bst_item_view_complete_tree (BstItemVie
gtk_tree_selection_set_mode (tsel, GTK_SELECTION_BROWSE);
gxk_tree_selection_force_browse (tsel, smodel);
g_object_unref (smodel);
-
++
/* add list view columns */
gxk_tree_view_add_text_column (self->tree, BST_PROXY_STORE_SEQID, "S",
0.0, _("ID"), NULL,
diff --cc beast-gtk/bstkeybindings.cc
index a7e9828,1f39c8b..d854c21
--- a/beast-gtk/bstkeybindings.cc
+++ b/beast-gtk/bstkeybindings.cc
@@@ -377,6 -394,7 +394,7 @@@ bst_key_binding_box (const gcha
g_object_set_long (self, "editable", editable != FALSE);
gxk_widget_publish_actions (self, "key-bindings-actions", G_N_ELEMENTS (key_bindings_actions),
key_bindings_actions,
NULL, key_bindings_check_action, key_bindings_exec_action);
-
++
/* binding list */
lwrapper = gxk_list_wrapper_new (N_BCOLS,
G_TYPE_STRING, /* BCOL_KEY */
@@@ -387,6 -405,7 +405,7 @@@
G_CALLBACK (key_binding_fill_binding_value),
self, G_CONNECT_SWAPPED);
gxk_list_wrapper_notify_append (lwrapper, kbinding->n_keys);
-
++
/* binding view setup */
tview = (GtkTreeView*) gxk_radget_find (self, "binding-tree-view");
gtk_tree_view_set_model (tview, GTK_TREE_MODEL (lwrapper));
@@@ -403,6 -422,7 +422,7 @@@
gxk_tree_view_add_text_column (tview, BCOL_PARAM, "S", 0.0, _("Parameter"),
_("Parameter to pass to functions upon activation"),
editable ? (void*) key_binding_binding_param_edited : NULL, self,
G_CONNECT_SWAPPED);
-
++
/* function list */
lwrapper = gxk_list_wrapper_new (N_FCOLS,
G_TYPE_STRING, /* FCOL_NAME */
diff --cc beast-gtk/bstknob.cc
index e76d145,b228671..2a9acf1
--- a/beast-gtk/bstknob.cc
+++ b/beast-gtk/bstknob.cc
@@@ -35,6 -44,7 +44,7 @@@ bst_knob_destroy (GtkObject *object
gtk_timeout_remove (knob->timer);
knob->timer = 0;
}
-
++
if (knob->adjustment)
{
gtk_object_unref (knob->adjustment);
@@@ -45,6 -56,7 +56,7 @@@
g_object_unref (knob->pixbuf);
knob->pixbuf = NULL;
}
-
++
/* chain parent class' handler */
GTK_OBJECT_CLASS (bst_knob_parent_class)->destroy (object);
}
@@@ -140,6 -175,7 +175,7 @@@ bst_knob_paint (BstKnob *knob
gint pointer_width = 3;
gint line_width = 1;
GdkPoint points[5];
-
++
/* compute center */
xc = widget->allocation.width / 2 + widget->allocation.x + knob->xofs;
yc = widget->allocation.height / 2 + widget->allocation.y + knob->yofs;
@@@ -167,6 -206,8 +206,8 @@@
xc + c * radius - dw, yc - s * radius - dw,
2 * dw, 2 * dw,
0.0 * 64, 360. * 64);
-
++
+
if (0)
{
points[0].x = xc + s * pointer_width + 0.5;
@@@ -179,6 -220,7 +220,7 @@@
points[3].y = points[0].y - s * radius + 0.5;
points[4].x = points[0].x;
points[4].y = points[0].y;
-
++
gdk_gc_set_line_attributes (gc, line_width, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
gdk_draw_polygon (widget->window, gc, TRUE, points, 5);
gdk_gc_set_line_attributes (gc, 0, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
@@@ -209,34 -255,45 +255,45 @@@ bst_knob_motion_notify (GtkWidget
GdkEventMotion *event)
{
BstKnob *knob = BST_KNOB (widget);
-
++
if (knob->button != 0 && event->window == knob->iwindow)
{
if (event->is_hint)
gdk_window_get_pointer (widget->window, NULL, NULL, NULL);
-
++
bst_knob_mouse_update (knob, event->x, event->y, knob->button == 1 ? MOUSE_MOVE : MOUSE_JUMP);
}
-
++
return TRUE;
}
+
static gint
bst_knob_button_release (GtkWidget *widget,
GdkEventButton *event)
{
BstKnob *knob = BST_KNOB (widget);
-
++
if (knob->button == event->button)
{
GtkAdjustment *adjustment = GTK_ADJUSTMENT (knob->adjustment);
+
bst_knob_mouse_update (knob, event->x, event->y, knob->button == 1 ? MOUSE_MOVE : MOUSE_JUMP);
+
knob->button = 0;
-
++
if (knob->timer)
{
gtk_timeout_remove (knob->timer);
knob->timer = 0;
}
-
++
if (knob->old_value != adjustment->value)
gtk_adjustment_value_changed (GTK_ADJUSTMENT (knob->adjustment));
}
-
++
return TRUE;
}
+
static double /* expresses arc2 relative to arc1 */
arc_diff (double arc1,
double arc2)
@@@ -270,11 -331,14 +331,14 @@@ bst_knob_mouse_update (BstKnob *knob
GtkWidget *widget = GTK_WIDGET (knob);
gdouble angle, diff, dist, sensitivity = 0.001;
gint xc, yc;
-
++
/* figure the arc's center */
xc = widget->allocation.width / 2;
yc = widget->allocation.height / 2;
-
++
/* calculate the angle of the pointer */
angle = atan2 (yc - y, x - xc);
-
++
switch (mode)
{
gdouble sdiff, ediff;
@@@ -304,10 -368,13 +368,13 @@@
knob->angle_range = angle / knob->arc_dist;
break;
}
-
++
/* constrained to the valid area of the arc */
knob->angle_range = CLAMP (knob->angle_range, 0, 1.0);
-
++
/* compute new adjustment value, translated to its lower...upper range */
adjustment->value = adjustment->lower + knob->angle_range * (adjustment->upper - adjustment->page_size -
adjustment->lower);
-
++
/* if the adjustment value changed:
* - for continuous updates: emit the GtkAdjustment::value_changed signal
* - for delayed updates: install a timer to emit the changed signal, if
@@@ -325,10 -392,12 +392,12 @@@
/* restart timer, so the delay interval starts from scratch */
if (knob->timer)
gtk_timeout_remove (knob->timer);
-
++
knob->timer = gtk_timeout_add (SCROLL_DELAY_LENGTH,
bst_knob_timer,
knob);
}
-
++
/* immediately update the widget, so the GUI is responsive and
* not delayed like the ::value_changed signal
*/
@@@ -340,39 -410,55 +410,55 @@@ static gboolea
bst_knob_timer (gpointer data)
{
BstKnob *knob;
-
++
GDK_THREADS_ENTER ();
-
++
knob = BST_KNOB (data);
-
++
gtk_adjustment_value_changed (GTK_ADJUSTMENT (knob->adjustment));
-
++
knob->timer = 0;
-
++
GDK_THREADS_LEAVE ();
-
++
return FALSE;
}
+
GtkWidget*
bst_knob_new (GtkAdjustment *adjustment)
{
GtkWidget *knob;
-
++
if (adjustment)
g_return_val_if_fail (GTK_IS_ADJUSTMENT (adjustment), NULL);
else
adjustment = (GtkAdjustment*) gtk_adjustment_new (0.0, 0.0, 250.0, 0.0, 0.0, 0.0);
-
++
knob = gtk_widget_new (BST_TYPE_KNOB, NULL);
-
++
bst_knob_set_adjustment (BST_KNOB (knob), adjustment);
-
++
return knob;
}
+
GtkAdjustment*
bst_knob_get_adjustment (BstKnob *knob)
{
g_return_val_if_fail (BST_IS_KNOB (knob), NULL);
-
++
return GTK_ADJUSTMENT (knob->adjustment);
}
+
void
bst_knob_set_update_policy (BstKnob *knob,
GtkUpdateType policy)
{
g_return_if_fail (BST_IS_KNOB (knob));
-
++
if (knob->update_policy != policy)
{
knob->update_policy = policy;
-
++
/* remove a pending timer if necessary */
if (knob->timer)
{
@@@ -391,14 -479,18 +479,18 @@@ bst_knob_set_adjustment (BstKnob *
{
g_return_if_fail (BST_IS_KNOB (knob));
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
-
++
if (knob->adjustment)
{
gtk_signal_disconnect_by_data (knob->adjustment, knob);
gtk_object_unref (knob->adjustment);
}
-
++
knob->adjustment = GTK_OBJECT (adjustment);
-
++
gtk_object_ref (knob->adjustment);
gtk_object_sink (knob->adjustment);
-
++
gtk_signal_connect (knob->adjustment,
"changed",
GTK_SIGNAL_FUNC (bst_knob_adjustment_changed),
@@@ -407,20 -499,26 +499,26 @@@
"value_changed",
GTK_SIGNAL_FUNC (bst_knob_adjustment_value_changed),
knob);
-
++
knob->old_value = adjustment->value;
knob->old_lower = adjustment->lower;
knob->old_upper = adjustment->upper;
knob->old_page_size = adjustment->page_size;
-
++
bst_knob_update (knob);
}
+
static void
bst_knob_adjustment_changed (GtkAdjustment *adjustment,
gpointer data)
{
BstKnob *knob;
-
++
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
g_return_if_fail (data != NULL);
-
++
knob = BST_KNOB (data);
-
++
if (knob->old_value != adjustment->value ||
knob->old_lower != adjustment->lower ||
knob->old_upper != adjustment->upper ||
@@@ -438,9 -538,12 +538,12 @@@ bst_knob_adjustment_value_changed (GtkA
gpointer data)
{
BstKnob *knob;
-
++
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
g_return_if_fail (data != NULL);
-
++
knob = BST_KNOB (data);
-
++
if (knob->old_value != adjustment->value)
{
knob->old_value = adjustment->value;
@@@ -453,10 -558,14 +558,14 @@@ bst_knob_update (BstKnob *knob
GtkAdjustment *adjustment;
GtkWidget *widget;
gdouble new_value;
-
++
g_return_if_fail (BST_IS_KNOB (knob));
-
++
widget = GTK_WIDGET (knob);
adjustment = GTK_ADJUSTMENT (knob->adjustment);
-
++
new_value = CLAMP (adjustment->value, adjustment->lower, adjustment->upper - adjustment->page_size);
+
if (new_value != adjustment->value)
{
if (0)
@@@ -465,10 -574,13 +574,13 @@@
adjustment->value = new_value;
gtk_adjustment_value_changed (GTK_ADJUSTMENT (knob->adjustment));
}
-
++
knob->angle_range = ((adjustment->value - adjustment->lower) /
(adjustment->upper - adjustment->page_size - adjustment->lower));
-
++
gtk_widget_queue_draw (widget);
}
+
static void
bst_knob_init (BstKnob *knob)
{
@@@ -500,7 -615,9 +615,9 @@@ bst_knob_class_init (BstKnobClass *klas
{
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
object_class->destroy = bst_knob_destroy;
-
++
widget_class->size_request = bst_knob_size_request;
widget_class->size_allocate = bst_knob_size_allocate;
widget_class->realize = bst_knob_realize;
diff --cc beast-gtk/bstknob.hh
index 99db1b2,966ccae..b84f614
--- a/beast-gtk/bstknob.hh
+++ b/beast-gtk/bstknob.hh
@@@ -21,23 -26,30 +26,30 @@@ struct _BstKno
* GTK_UPDATE_DISCONTINUOUS or GTK_UPDATE_DELAYED
*/
GtkUpdateType update_policy;
-
++
/* The button currently pressed or 0 if none */
guint8 button;
-
++
/* Dimensions of knob components */
gfloat furrow_radius, dot_radius, xofs, yofs;
gfloat arc_start, arc_dist;
+
/* ID of update timer for delayed updates, or 0 if none */
guint timer;
-
++
/* Current angle of the pointer */
gdouble angle_range;
+
/* user input */
gfloat pangle;
gfloat px, py;
-
++
/* Old values from GtkAdjustment, stored so we know when something changed */
gdouble old_value;
gdouble old_lower;
gdouble old_upper;
gdouble old_page_size;
-
++
/* The adjustment object that stores the data for this knob */
GtkObject *adjustment;
GdkWindow *iwindow;
@@@ -47,6 -59,7 +59,7 @@@ struct _BstKnobClas
{
GtkImageClass parent_class;
};
-
++
/* --- public methods --- */
GType bst_knob_get_type (void);
GtkWidget* bst_knob_new (GtkAdjustment *adjustment);
diff --cc beast-gtk/bstlogadjustment.cc
index 16671af,719a84b..687a8e0
--- a/beast-gtk/bstlogadjustment.cc
+++ b/beast-gtk/bstlogadjustment.cc
@@@ -50,11 -65,15 +65,15 @@@ GtkAdjustment
bst_log_adjustment_from_adj (GtkAdjustment *client)
{
BstLogAdjustment *ladj;
+
g_return_val_if_fail (GTK_IS_ADJUSTMENT (client), NULL);
+
ladj = (BstLogAdjustment*) g_object_new (BST_TYPE_LOG_ADJUSTMENT, NULL);
bst_log_adjustment_set_client (ladj, client);
-
++
return GTK_ADJUSTMENT (ladj);
}
+
void
bst_log_adjustment_set_client (BstLogAdjustment *ladj,
GtkAdjustment *client)
@@@ -107,6 -132,7 +132,7 @@@ bst_log_adjustment_changed (GtkAdjustme
{
BstLogAdjustment *ladj = BST_LOG_ADJUSTMENT (adj);
GtkAdjustment *client = ladj->client;
-
++
if (client && !ladj->block_client)
{
ladj->block_client++;
@@@ -119,6 -146,7 +146,7 @@@ bst_log_adjustment_value_changed (GtkAd
{
BstLogAdjustment *ladj = BST_LOG_ADJUSTMENT (adj);
GtkAdjustment *client = ladj->client;
-
++
adj->value = CLAMP (adj->value, adj->lower, adj->upper);
if (client && !ladj->block_client)
{
@@@ -165,6 -200,7 +200,7 @@@ ladj_client_value_changed (BstLogAdjust
g_printerr ("ladj: client-value-changed: [%f %f] %g CLIENT: [%f %f] %g\n",
adj->lower, adj->upper, adj->value,
client->lower, client->upper, client->value);
-
++
if (!ladj->block_client)
{
ladj->block_client++;
diff --cc beast-gtk/bstmain.cc
index 78e970a,e9f82b4..f16bc4f
--- a/beast-gtk/bstmain.cc
+++ b/beast-gtk/bstmain.cc
@@@ -113,6 -136,7 +115,7 @@@ main (int argc
_bst_gconfig_init ();
_bst_skin_config_init ();
_bst_msg_absorb_config_init ();
-
++
/* parse rc file */
bst_splash_update_item (beast_splash, _("RC Files"));
bst_preferences_load_rc_files();
@@@ -127,11 -152,11 +131,12 @@@
bst_splash_set_animation (beast_splash, anim);
g_object_unref (anim);
}
+
/* start BSE core and connect */
bst_splash_update_item (beast_splash, _("BSE Core"));
- bse_init_async (&argc, &argv, "BEAST", config);
- sfi_glue_context_push (bse_init_glue_context ("BEAST"));
+ Bse::String bseoptions = Bse::string_printf ("debug-extensions=%d", bst_debug_extensions);
+ Bse::init_async (&argc, argv, "BEAST", Bse::string_split (bseoptions, ":"));
+ sfi_glue_context_push (Bse::init_glue_context ("BEAST", bst_main_loop_wakeup));
source = g_source_simple (GDK_PRIORITY_EVENTS, // G_PRIORITY_HIGH - 100,
(GSourcePending) sfi_glue_context_pending,
(GSourceDispatch) sfi_glue_context_dispatch,
@@@ -216,9 -251,10 +230,10 @@@
bst_splash_update_entity (beast_splash, _("Loading..."));
BstApp *app = NULL;
gboolean merge_with_last = FALSE;
- for (i = 1; i < argc; i++)
+ for (int i = 1; i < argc; i++)
{
bst_splash_update ();
+
/* parse non-file args */
if (strcmp (argv[i], "--merge") == 0)
{
@@@ -301,6 -324,7 +318,7 @@@
if (!app)
{
SfiProxy project = bse_server_use_new_project (BSE_SERVER, "Untitled.bse");
-
++
bse_project_get_wave_repo (project);
app = bst_app_new (project);
bse_item_unuse (project);
@@@ -372,6 -400,7 +391,7 @@@
GDK_THREADS_LEAVE ();
}
GDK_THREADS_ENTER ();
-
++
/* save BSE configuration */
if (update_rc_files && !bst_preferences_saved())
{
diff --cc beast-gtk/bstmenus.cc
index 127a296,afeb4b0..e90276c
--- a/beast-gtk/bstmenus.cc
+++ b/beast-gtk/bstmenus.cc
@@@ -23,21 -29,26 +29,26 @@@ bst_choice_alloc (BstChoiceFlags type
BseIcon *icon)
{
BstChoice *choice = g_new (BstChoice, 1);
-
++
choice->type_and_flags = type;
choice->icon_stock_id = icon_stock_id;
choice->bse_icon = icon ? bse_icon_copy_shallow (icon) : NULL;
choice->name = choice_name;
choice->p_id = choice_id;
-
++
return choice;
}
+
static void
menu_choice_activate (GtkWidget *item,
gpointer data)
{
gpointer udata = gtk_object_get_user_data (GTK_OBJECT (item));
-
++
if (GTK_IS_MENU (current_popup_menu))
{
gtk_object_set_data (GTK_OBJECT (current_popup_menu), "BstChoice", udata);
-
++
if (modal_loop_quit_on_menu_item_activate)
modal_loop_running = FALSE;
}
@@@ -46,12 -57,14 +57,14 @@@
while (GTK_IS_MENU (item->parent))
{
GtkWidget *tmp;
-
++
item = item->parent;
tmp = gtk_menu_get_attach_widget (GTK_MENU (item));
if (GTK_IS_MENU_ITEM (tmp))
item = tmp;
}
g_assert (GTK_IS_MENU (item));
-
++
gtk_object_set_data (GTK_OBJECT (item), "BstChoice", udata);
}
}
@@@ -60,9 -74,12 +74,12 @@@ button_choice_activate (GtkWidget *item
gpointer data)
{
GtkWidget *window = gtk_widget_get_ancestor (item, GTK_TYPE_WINDOW);
-
++
gtk_object_set_data (GTK_OBJECT (window), "BstChoice", data);
-
++
gtk_widget_hide (window);
}
+
static void
check_modal_quit (GtkWidget *item)
{
@@@ -74,6 -92,7 +92,7 @@@ menu_item_add_activator (GtkWidget *wid
gpointer function)
{
GtkWidget *menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget));
-
++
if (GTK_IS_CONTAINER (menu))
gtk_container_forall (GTK_CONTAINER (menu), menu_item_add_activator, NULL);
else
@@@ -94,10 -115,13 +115,13 @@@ bst_choice_menu_add_choice_and_free (Gt
{
guint choice_type, choice_flags;
GtkWidget *item;
-
++
g_return_if_fail (GTK_IS_MENU (menu));
g_return_if_fail (choice != NULL);
-
++
choice_type = choice->type_and_flags & BST_CHOICE_TYPE_MASK;
choice_flags = choice->type_and_flags & BST_CHOICE_FLAG_MASK;
-
++
item = gtk_widget_new (GTK_TYPE_IMAGE_MENU_ITEM,
"visible", TRUE,
"sensitive", !((choice_flags & BST_CHOICE_FLAG_INSENSITIVE) ||
@@@ -113,6 -137,7 +137,7 @@@
if (choice->name)
{
GtkWidget *any;
-
++
if (choice->icon_stock_id)
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
gxk_stock_image (choice->icon_stock_id, GXK_ICON_SIZE_MENU));
@@@ -135,7 -161,9 +161,9 @@@ bst_choice_menu_set_item_sensitive (Gtk
{
GtkMenuShell *shell;
GList *list;
-
++
g_return_if_fail (GTK_IS_MENU (menu));
-
++
shell = GTK_MENU_SHELL (menu);
for (list = shell->children; list; list = list->next)
{
@@@ -169,9 -200,12 +200,12 @@@ bst_choice_menu_createv (const gchar *m
bst_choice_menu_add_choice_and_free (menu, choice);
choice = va_arg (args, BstChoice*);
}
-
++
va_end (args);
-
++
return menu;
}
+
GtkWidget*
bst_choice_dialog_createv (BstChoice *first_choice,
...)
@@@ -179,7 -213,9 +213,9 @@@
BstChoice *choice;
GtkWidget *vbox, *dialog;
va_list args;
-
++
g_return_val_if_fail (first_choice != NULL, NULL);
-
++
/* text portions
*/
vbox = gtk_widget_new (GTK_TYPE_VBOX,
@@@ -192,6 -228,7 +228,7 @@@
{
guint choice_type = choice->type_and_flags & BST_CHOICE_TYPE_MASK;
guint choice_flags = choice->type_and_flags & BST_CHOICE_FLAG_MASK;
-
++
switch (choice_type)
{
GtkWidget *any;
@@@ -232,6 -271,7 +271,7 @@@
{
guint choice_type = choice->type_and_flags & BST_CHOICE_TYPE_MASK;
guint choice_flags = choice->type_and_flags & BST_CHOICE_FLAG_MASK;
-
++
switch (choice_type)
{
GtkWidget *any;
@@@ -247,17 -287,22 +287,22 @@@
gtk_widget_set_sensitive (any, FALSE);
break;
}
-
++
free_choice (choice);
-
++
choice = va_arg (args, BstChoice*);
}
while (choice);
va_end (args);
-
++
return dialog;
}
+
void
bst_choice_destroy (GtkWidget *choice)
{
g_return_if_fail (GTK_IS_CONTAINER (choice));
-
++
gtk_widget_destroy (choice);
gtk_widget_unref (choice);
}
@@@ -265,13 -311,17 +311,17 @@@ gboolea
bst_choice_selectable (GtkWidget *widget)
{
gboolean selectable = FALSE;
-
++
g_return_val_if_fail (GTK_IS_CONTAINER (widget), FALSE);
-
++
if (GTK_IS_MENU (widget))
{
GList *list, *children = gtk_container_children (GTK_CONTAINER (widget));
-
++
for (list = children; list; list = list->next)
{
GtkBin *bin = (GtkBin*) list->data;
-
++
if (GTK_WIDGET_IS_SENSITIVE (bin) && GTK_WIDGET_VISIBLE (bin) && bin->child)
{
selectable = TRUE;
@@@ -283,9 -333,11 +333,11 @@@
else if (GXK_IS_DIALOG (widget))
{
GList *list, *children = gtk_container_children (GTK_CONTAINER (GXK_DIALOG (widget)->hbox));
-
++
for (list = children; list; list = list->next)
{
GtkBin *bin = (GtkBin*) list->data;
-
++
if (GTK_IS_BUTTON (bin) && GTK_WIDGET_IS_SENSITIVE (bin) && GTK_WIDGET_VISIBLE (bin))
{
selectable = TRUE;
@@@ -294,18 -346,23 +346,23 @@@
}
g_list_free (children);
}
-
++
return selectable;
}
+
guint
bst_choice_modal (GtkWidget *choice,
guint mouse_button,
guint32 time)
{
gpointer data = GUINT_TO_POINTER (0);
-
++
if (GTK_IS_MENU (choice))
{
GtkMenu *menu = GTK_MENU (choice);
-
++
gtk_object_set_data (GTK_OBJECT (menu), "BstChoice", data);
-
++
if (bst_choice_selectable (choice))
{
modal_loop_quit_on_menu_item_activate = TRUE;
@@@ -321,14 -378,17 +378,17 @@@
current_popup_menu = NULL;
modal_loop_quit_on_menu_item_activate = FALSE;
}
-
++
data = gtk_object_get_data (GTK_OBJECT (menu), "BstChoice");
}
else if (GXK_IS_DIALOG (choice))
{
gtk_object_set_data (GTK_OBJECT (choice), "BstChoice", data);
-
++
if (bst_choice_selectable (choice))
{
gtk_widget_show (choice);
-
++
while (GTK_WIDGET_VISIBLE (choice))
{
GDK_THREADS_LEAVE ();
@@@ -336,16 -396,21 +396,21 @@@
GDK_THREADS_ENTER ();
}
}
-
++
data = gtk_object_get_data (GTK_OBJECT (choice), "BstChoice");
}
-
++
return GPOINTER_TO_UINT (data);
}
+
guint
bst_choice_get_last (GtkWidget *widget)
{
gpointer data = gtk_object_get_data (GTK_OBJECT (widget), "BstChoice");
-
++
return GPOINTER_TO_UINT (data);
}
+
/* Accelerator recommendations:
*
{ "/File/New", "<Control>N", },
diff --cc beast-gtk/bstmenus.hh
index b99d014,ee7984b..053ce12
--- a/beast-gtk/bstmenus.hh
+++ b/beast-gtk/bstmenus.hh
@@@ -62,13 -70,16 +70,16 @@@ BstChoice* bst_choice_allo
gpointer choice_id,
const gchar *icon_stock_id,
BseIcon *bse_icon);
+
G_END_DECLS
+
// == Flags Enumeration Operators in C++ ==
#ifdef __cplusplus
-inline BstChoiceFlags operator& (BstChoiceFlags s1, BstChoiceFlags s2) { return BstChoiceFlags (s1 &
(long long unsigned) s2); }
-inline BstChoiceFlags& operator&= (BstChoiceFlags &s1, BstChoiceFlags s2) { s1 = s1 & s2; return s1; }
-inline BstChoiceFlags operator| (BstChoiceFlags s1, BstChoiceFlags s2) { return BstChoiceFlags (s1 |
(long long unsigned) s2); }
-inline BstChoiceFlags& operator|= (BstChoiceFlags &s1, BstChoiceFlags s2) { s1 = s1 | s2; return s1; }
-inline BstChoiceFlags operator~ (BstChoiceFlags s1) { return BstChoiceFlags (~(long
long unsigned) s1); }
+constexpr BstChoiceFlags operator& (BstChoiceFlags s1, BstChoiceFlags s2) { return BstChoiceFlags (s1 &
(long long unsigned) s2); }
+inline BstChoiceFlags& operator&= (BstChoiceFlags &s1, BstChoiceFlags s2) { s1 = s1 & s2; return s1; }
+constexpr BstChoiceFlags operator| (BstChoiceFlags s1, BstChoiceFlags s2) { return BstChoiceFlags (s1 |
(long long unsigned) s2); }
+inline BstChoiceFlags& operator|= (BstChoiceFlags &s1, BstChoiceFlags s2) { s1 = s1 | s2; return s1; }
+constexpr BstChoiceFlags operator~ (BstChoiceFlags s1) { return BstChoiceFlags
(~(long long unsigned) s1); }
#endif // __cplusplus
+
#endif /* __BST_MENUS_H__ */
diff --cc beast-gtk/bstparam.cc
index 2b3c069,c536ebf..688272c
--- a/beast-gtk/bstparam.cc
+++ b/beast-gtk/bstparam.cc
@@@ -69,16 -77,21 +77,21 @@@ bst_param_create_gmask_intern (GxkPara
BstGMask *gmask;
gboolean expand_action;
gchar *tooltip;
-
++
g_return_val_if_fail (GXK_IS_PARAM (param), NULL);
g_return_val_if_fail (GTK_IS_CONTAINER (parent), NULL);
-
++
gxk_param_set_sizes (param_size_group, BST_GCONFIG (size_group_input_fields) ?
¶m_editor_homogeneous_sizes : NULL);
group = sfi_pspec_get_group (param->pspec);
parent = param_get_gmask_container (parent, group ? g_quark_from_string (group) : 0);
-
++
action = gxk_param_create_editor (param, editor_name);
-
++
xframe = (GtkWidget*) g_object_new (BST_TYPE_XFRAME, "cover", action, NULL);
g_object_connect (xframe,
"swapped_signal::button_check", bst_param_xframe_check_button, param,
NULL);
-
++
if (GTK_IS_TOGGLE_BUTTON (action))
{
/* if there's a prompt widget inside the button already, sneak in xframe */
@@@ -131,6 -145,7 +145,7 @@@
g_message ("failed to create scale/dial widget for parameter \"%s\" of type `%s'",
param->pspec->name, g_type_name (G_PARAM_SPEC_VALUE_TYPE (param->pspec)));
}
-
++
tooltip = gxk_param_dup_tooltip (param);
bst_gmask_set_tip (gmask, tooltip);
g_free (tooltip);
@@@ -277,6 -307,7 +307,7 @@@ bst_param_set_proxy (GxkParam *param
{
g_return_if_fail (GXK_IS_PARAM (param));
g_return_if_fail (param->binding == &proxy_binding);
-
++
proxy_binding_destroy (param);
param->bdata[0].v_long = proxy;
if (proxy)
@@@ -291,6 -323,7 +323,7 @@@ SfiProx
bst_param_get_proxy (GxkParam *param)
{
g_return_val_if_fail (GXK_IS_PARAM (param), 0);
-
++
if (param->binding == &proxy_binding)
return param->bdata[0].v_long;
return 0;
diff --cc beast-gtk/bstparamview.cc
index 207de3e,88d541b..13c90f9
--- a/beast-gtk/bstparamview.cc
+++ b/beast-gtk/bstparamview.cc
@@@ -93,6 -125,7 +125,7 @@@ bst_param_view_set_item (BstParamView *
"any_signal", param_view_reset_item, self,
NULL);
self->item = 0;
-
++
for (slist = self->params; slist; slist = slist->next)
bst_param_set_proxy ((GxkParam*) slist->data, 0);
}
@@@ -101,8 -136,10 +136,10 @@@
bse_proxy_connect (self->item,
"swapped_signal::release", param_view_reset_item, self,
NULL);
-
++
bst_param_view_rebuild (self);
}
+
void
bst_param_view_set_mask (BstParamView *param_view,
const gchar *first_base_type,
@@@ -144,8 -187,11 +187,11 @@@ bst_param_view_rebuild (BstParamView *s
GSList *slist;
gint border_width = 5;
guint i, n;
-
++
g_return_if_fail (BST_IS_PARAM_VIEW (self));
+
bst_param_view_destroy_contents (self);
+
pbox = GTK_BOX (self);
if (!self->item)
return;
@@@ -202,6 -251,7 +251,7 @@@
GtkWidget *scwin = gxk_scrolled_window_create (gcontainer, GTK_SHADOW_NONE, 1, 0.8);
gtk_container_add (GTK_CONTAINER (self), scwin);
}
-
++
/* refresh parameter fields */
for (slist = self->params; slist; slist = slist->next)
gxk_param_update ((GxkParam*) slist->data);
diff --cc beast-gtk/bstpartdialog.cc
index e1a2e86,f221896..ff78e90
--- a/beast-gtk/bstpartdialog.cc
+++ b/beast-gtk/bstpartdialog.cc
@@@ -51,14 -56,19 +56,19 @@@ static const GxkStockAction piano_clear
{ N_("_Clear Undo"), NULL, NULL,
ACTION_CLEAR_UNDO, BST_STOCK_CLEAR_UNDO, },
};
-
++
+
/* --- functions --- */
G_DEFINE_TYPE (BstPartDialog, bst_part_dialog, GXK_TYPE_DIALOG);
+
static void
bst_part_dialog_class_init (BstPartDialogClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
++
gobject_class->finalize = bst_part_dialog_finalize;
}
+
static void
hzoom_changed (BstPartDialog *self,
GtkAdjustment *adjustment)
@@@ -103,6 -117,7 +117,7 @@@ bst_part_dialog_init (BstPartDialog *se
"flags", GXK_DIALOG_STATUS_BAR,
NULL);
gxk_dialog_set_sizes (GXK_DIALOG (self), 640, 400, 1005, 650);
-
++
/* radget-complete GUI */
radget = gxk_radget_create ("beast", "piano-roll-box", NULL);
gtk_container_add (GTK_CONTAINER (GXK_DIALOG (self)->vbox), (GtkWidget*) radget);
@@@ -220,11 -247,15 +247,15 @@@ static voi
bst_part_dialog_finalize (GObject *object)
{
BstPartDialog *self = BST_PART_DIALOG (object);
+
bst_part_dialog_set_proxy (self, 0);
+
bst_piano_roll_controller_unref (self->pctrl);
bst_event_roll_controller_unref (self->ectrl);
-
++
G_OBJECT_CLASS (bst_part_dialog_parent_class)->finalize (object);
}
+
void
bst_part_dialog_set_proxy (BstPartDialog *self,
SfiProxy part)
diff --cc beast-gtk/bstpatterncolumns.hh
index 34411e0,97a5c7d..22fe0f1
--- a/beast-gtk/bstpatterncolumns.hh
+++ b/beast-gtk/bstpatterncolumns.hh
@@@ -142,18 -147,22 +147,20 @@@ BstPatternColumn* bst_pattern_column_cr
gint num,
BstPatternLFlags lflags);
gboolean bst_pattern_column_has_notes (BstPatternColumn *column);
+
G_END_DECLS
+
// == Flags Enumeration Operators in C++ ==
#ifdef __cplusplus
-inline BstPatternLFlags operator& (BstPatternLFlags s1, BstPatternLFlags s2) { return BstPatternLFlags
(s1 & (long long unsigned) s2); }
-inline BstPatternLFlags& operator&= (BstPatternLFlags &s1, BstPatternLFlags s2) { s1 = s1 & s2; return s1; }
-inline BstPatternLFlags operator| (BstPatternLFlags s1, BstPatternLFlags s2) { return BstPatternLFlags
(s1 | (long long unsigned) s2); }
-inline BstPatternLFlags& operator|= (BstPatternLFlags &s1, BstPatternLFlags s2) { s1 = s1 | s2; return s1; }
-inline BstPatternLFlags operator~ (BstPatternLFlags s1) { return BstPatternLFlags
(~(long long unsigned) s1); }
-
-inline BstPatternFunction operator& (BstPatternFunction s1, BstPatternFunction s2) { return
BstPatternFunction (s1 & (long long unsigned) s2); }
-inline BstPatternFunction& operator&= (BstPatternFunction &s1, BstPatternFunction s2) { s1 = s1 & s2;
return s1; }
-inline BstPatternFunction operator| (BstPatternFunction s1, BstPatternFunction s2) { return
BstPatternFunction (s1 | (long long unsigned) s2); }
-inline BstPatternFunction& operator|= (BstPatternFunction &s1, BstPatternFunction s2) { s1 = s1 | s2;
return s1; }
-inline BstPatternFunction operator~ (BstPatternFunction s1) { return
BstPatternFunction (~(long long unsigned) s1); }
+constexpr BstPatternLFlags operator& (BstPatternLFlags s1, BstPatternLFlags s2) { return
BstPatternLFlags (s1 & (long long unsigned) s2); }
+inline BstPatternLFlags& operator&= (BstPatternLFlags &s1, BstPatternLFlags s2) { s1 = s1 & s2; return
s1; }
+constexpr BstPatternLFlags operator| (BstPatternLFlags s1, BstPatternLFlags s2) { return
BstPatternLFlags (s1 | (long long unsigned) s2); }
+inline BstPatternLFlags& operator|= (BstPatternLFlags &s1, BstPatternLFlags s2) { s1 = s1 | s2; return
s1; }
+constexpr BstPatternLFlags operator~ (BstPatternLFlags s1) { return
BstPatternLFlags (~(long long unsigned) s1); }
+constexpr BstPatternFunction operator& (BstPatternFunction s1, BstPatternFunction s2) { return
BstPatternFunction (s1 & (long long unsigned) s2); }
+inline BstPatternFunction& operator&= (BstPatternFunction &s1, BstPatternFunction s2) { s1 = s1 & s2;
return s1; }
+constexpr BstPatternFunction operator| (BstPatternFunction s1, BstPatternFunction s2) { return
BstPatternFunction (s1 | (long long unsigned) s2); }
+inline BstPatternFunction& operator|= (BstPatternFunction &s1, BstPatternFunction s2) { s1 = s1 | s2;
return s1; }
+constexpr BstPatternFunction operator~ (BstPatternFunction s1) { return
BstPatternFunction (~(long long unsigned) s1); }
#endif // __cplusplus
-
#endif /* __BST_PATTERN_COLUMNS_H__ */
diff --cc beast-gtk/bstpatternctrl.cc
index 7c04718,510f86f..c9103bd
--- a/beast-gtk/bstpatternctrl.cc
+++ b/beast-gtk/bstpatternctrl.cc
@@@ -90,7 -96,9 +96,9 @@@ bst_pattern_controller_new (BstPatternV
GxkActionGroup *quant_rtools)
{
BstPatternController *self;
-
++
g_return_val_if_fail (BST_IS_PATTERN_VIEW (pview), NULL);
-
++
self = g_new0 (BstPatternController, 1);
self->vraster = gxk_param_new_value (sfi_pspec_choice ("vertical-raster", _("VZoom"),
_("The tick/note length per line"),
@@@ -120,6 -128,7 +128,7 @@@
pattern_controller_row_shading_notify, self);
self->pview = pview;
self->ref_count = 1;
-
++
self->ref_count++;
g_signal_connect_data (pview, "key-press-event",
G_CALLBACK (pattern_controller_key_press),
@@@ -128,6 -137,7 +137,7 @@@
self->quant_rtools = quant_rtools ? (GxkActionGroup*) g_object_ref (quant_rtools) : NULL;
pattern_controller_vraster_notify (self, NULL);
pattern_controller_row_shading_notify (self, NULL);
-
++
gxk_scroll_canvas_set_canvas_cursor (GXK_SCROLL_CANVAS (pview), GDK_XTERM);
return self;
}
@@@ -136,14 -147,18 +147,18 @@@ bst_pattern_controller_ref (BstPatternC
{
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (self->ref_count >= 1, NULL);
-
++
self->ref_count++;
-
++
return self;
}
+
void
bst_pattern_controller_unref (BstPatternController *self)
{
g_return_if_fail (self != NULL);
g_return_if_fail (self->ref_count >= 1);
-
++
self->ref_count--;
if (!self->ref_count)
{
@@@ -367,12 -385,13 +385,13 @@@ struct ConstKeyBindingItem
static BstKeyBindingItem*
BstKeyBindingItem_from_ConstKeyBindingItem (const ConstKeyBindingItem *ckb)
{
- BIRNET_STATIC_ASSERT (sizeof (ConstKeyBindingItem) == sizeof (BstKeyBindingItem));
- BIRNET_STATIC_ASSERT (offsetof (ConstKeyBindingItem, key_name) == offsetof (BstKeyBindingItem, key_name));
- BIRNET_STATIC_ASSERT (offsetof (ConstKeyBindingItem, func_name) == offsetof (BstKeyBindingItem,
func_name));
- BIRNET_STATIC_ASSERT (offsetof (ConstKeyBindingItem, func_param) == offsetof (BstKeyBindingItem,
func_param));
+ RAPICORN_STATIC_ASSERT (sizeof (ConstKeyBindingItem) == sizeof (BstKeyBindingItem));
+ RAPICORN_STATIC_ASSERT (offsetof (ConstKeyBindingItem, key_name) == offsetof (BstKeyBindingItem,
key_name));
+ RAPICORN_STATIC_ASSERT (offsetof (ConstKeyBindingItem, func_name) == offsetof (BstKeyBindingItem,
func_name));
+ RAPICORN_STATIC_ASSERT (offsetof (ConstKeyBindingItem, func_param) == offsetof (BstKeyBindingItem,
func_param));
return (BstKeyBindingItem*) ckb;
}
+
BstKeyBinding*
bst_pattern_controller_default_generic_keys (void)
{
diff --cc beast-gtk/bstpatternview.cc
index a682acf,d85452a..e39f498
--- a/beast-gtk/bstpatternview.cc
+++ b/beast-gtk/bstpatternview.cc
@@@ -71,6 -83,7 +83,7 @@@ static voi
bst_pattern_view_init (BstPatternView *self)
{
GxkScrollCanvas *scc = GXK_SCROLL_CANVAS (self);
-
++
self->row_height = 1;
self->tpt = 384 * 4;
self->max_ticks = 1;
@@@ -90,9 -104,12 +104,12 @@@ static voi
bst_pattern_view_dispose (GObject *object)
{
BstPatternView *self = BST_PATTERN_VIEW (object);
-
++
bst_pattern_view_set_proxy (self, 0);
-
++
G_OBJECT_CLASS (bst_pattern_view_parent_class)->dispose (object);
}
+
static void
bst_pattern_view_destroy_columns (BstPatternView *self)
{
@@@ -121,10 -139,13 +139,13 @@@ static voi
bst_pattern_view_finalize (GObject *object)
{
BstPatternView *self = BST_PATTERN_VIEW (object);
+
bst_pattern_view_set_proxy (self, 0);
bst_pattern_view_destroy_columns (self);
-
++
G_OBJECT_CLASS (bst_pattern_view_parent_class)->finalize (object);
}
+
static void
pattern_view_update (BstPatternView *self,
guint tick,
@@@ -159,6 -183,7 +183,7 @@@ bst_pattern_view_set_proxy (BstPatternV
g_return_if_fail (BSE_IS_PART (proxy));
g_return_if_fail (bse_item_get_project (proxy) != 0);
}
-
++
if (self->proxy)
{
bse_proxy_disconnect (self->proxy,
@@@ -384,6 -426,7 +426,7 @@@ coord_to_tick (BstPatternView *self
gboolean extended_bound)
{
guint tick;
-
++
y += Y_OFFSET (self);
tick = pixels_to_ticks (self, y);
if (extended_bound)
@@@ -404,8 -449,10 +449,10 @@@ coord_check_crossing (BstPatternView *s
guint ntick = coord_to_tick (self, y, FALSE);
guint xtick = coord_to_tick (self, y, TRUE);
guint nq = 0, xq = 0;
-
++
/* catch _at_ tick boundary as well */
xtick += 1;
-
++
switch (crossing)
{
case CROSSING_TACT4:
@@@ -417,6 -464,7 +464,7 @@@
xq = xtick / self->tpt;
break;
}
-
++
return nq != xq;
}
#endif
@@@ -515,6 -569,7 +569,7 @@@ bst_pattern_view_draw_canvas (GxkScroll
// gint line_width = 0; /* line widths != 0 interfere with dash-settings on some X servers */
GXK_SCROLL_CANVAS_CLASS (bst_pattern_view_parent_class)->draw_canvas (scc, drawable, area);
gdk_window_get_size (CANVAS (self), &width, &height);
-
++
GdkGC *gcs[BST_PATTERN_COLUMN_GC_LAST] = { NULL, };
gcs[BST_PATTERN_COLUMN_GC_TEXT0] = COLOR_GC_TEXT0 (self);
gcs[BST_PATTERN_COLUMN_GC_TEXT1] = COLOR_GC_TEXT1 (self);
@@@ -543,6 -600,7 +600,7 @@@ bst_pattern_view_overlap_grow_hpanel_ar
GdkRectangle *area)
{
gint i, x = area->x, xbound = x + area->width;
-
++
/* grow hpanel exposes by surrounding tacts */
i = coord_to_tick (self, x, FALSE);
i /= self->tpt;
@@@ -555,6 -613,7 +613,7 @@@
i += 2; /* fudge 1 tact to the right (+1 for round-off) */
i *= self->tpt;
xbound = tick_to_coord (self, i);
-
++
area->x = x;
area->width = xbound - area->x;
}
@@@ -572,6 -632,7 +632,7 @@@ bst_pattern_view_draw_hpanel (GxkScroll
gint i, width, height;
gdk_window_get_size (drawable, &width, &height);
bst_pattern_view_overlap_grow_hpanel_area (self, area);
-
++
/* tact numbers */
for (i = area->x; i < area->x + area->width; i++)
{
@@@ -581,11 -642,14 +642,14 @@@
if (coord_check_crossing (self, i, CROSSING_TACT4))
{
guint next_pixel, tact4 = coord_to_tick (self, i, TRUE) + 1;
-
++
tact4 /= (self->tpt * 4);
next_pixel = tick_to_coord (self, (tact4 + 1) * (self->tpt * 4));
-
++
g_snprintf (buffer, 64, "%u", tact4 + 1);
pango_layout_set_text (PLAYOUT_HPANEL (self), buffer, -1);
pango_layout_get_pixel_extents (PLAYOUT_HPANEL (self), NULL, &rect);
-
++
/* draw this tact if there's enough space */
if (i + rect.width / 2 < (i + next_pixel) / 2)
gdk_draw_layout (drawable, draw_gc,
@@@ -595,14 -659,17 +659,17 @@@
else if (self->draw_tact_grid && coord_check_crossing (self, i, CROSSING_TACT))
{
guint next_pixel, tact = coord_to_tick (self, i, TRUE) + 1;
-
++
tact /= self->tpt;
next_pixel = tick_to_coord (self, (tact + 1) * self->tpt);
tact = tact % 4 + 1;
if (tact == 1444)
continue; /* would draw on top of tact4 number */
-
++
g_snprintf (buffer, 64, ":%u", tact % 4 + 1);
pango_layout_set_text (PLAYOUT_HPANEL (self), buffer, -1);
pango_layout_get_pixel_extents (PLAYOUT_HPANEL (self), NULL, &rect);
-
++
/* draw this tact if there's enough space */
if (i + rect.width < (i + next_pixel) / 2) /* don't half width, leave some more space */
gdk_draw_layout (drawable, draw_gc,
@@@ -741,6 -814,7 +814,7 @@@ pattern_view_update_adjustments (GxkScr
gboolean vadj)
{
BstPatternView *self = BST_PATTERN_VIEW (scc);
-
++
if (hadj)
{
scc->hadjustment->upper = scc->layout.canvas_width;
@@@ -964,6 -1051,7 +1051,7 @@@ bst_pattern_view_set_marker (BstPattern
guint count;
g_return_if_fail (mark_index > 0);
mark_index += CUSTOM_MARKER_OFFSET;
-
++
marker = gxk_scroll_canvas_lookup_marker (scc, mark_index, &count);
if (!marker && !mtype)
return;
@@@ -982,7 -1070,9 +1070,9 @@@
}
return;
}
-
++
g_return_if_fail (count == 2);
-
++
marker[0].coords.y = position;
marker[1].coords.y = position;
if (marker[0].mtype != mtype || !marker[0].pixmap)
@@@ -1007,6 -1098,7 +1098,7 @@@ bst_pattern_view_set_pixmarker (BstPatt
GxkScrollMarker *marker;
guint count;
g_return_if_fail (mark_index > 0 && mark_index < CUSTOM_MARKER_OFFSET);
-
++
marker = gxk_scroll_canvas_lookup_marker (scc, mark_index, &count);
if (!marker && !mtype)
return;
@@@ -1024,7 -1116,9 +1116,9 @@@
}
return;
}
-
++
g_return_if_fail (count == 1);
+
if (marker->mtype == mtype && marker->windowp == &CANVAS (self) &&
marker->extends.width == width && marker->extends.height == height)
gxk_scroll_canvas_move_marker (scc, marker, x, y);
@@@ -1093,9 -1191,12 +1191,12 @@@ bst_pattern_view_class_init (BstPattern
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GxkScrollCanvasClass *scroll_canvas_class = GXK_SCROLL_CANVAS_CLASS (klass);
-
++
gobject_class->finalize = bst_pattern_view_finalize;
gobject_class->dispose = bst_pattern_view_dispose;
+
widget_class->realize = pattern_view_realize;
+
scroll_canvas_class->hscrollable = TRUE;
scroll_canvas_class->vscrollable = TRUE;
scroll_canvas_class->get_layout = pattern_view_get_layout;
@@@ -1109,8 -1210,10 +1210,10 @@@
scroll_canvas_class->handle_drag = pattern_view_handle_drag;
scroll_canvas_class->image_tint = gdk_color_from_rgb (0x00ffffff);
scroll_canvas_class->image_saturation = 0;
+
klass->drag = NULL;
klass->clicked = NULL;
-
++
signal_drag = g_signal_new ("drag", G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (BstPatternViewClass, drag),
NULL, NULL,
diff --cc beast-gtk/bstpianoroll.cc
index 1ea10fa,59e4556..98219d1
--- a/beast-gtk/bstpianoroll.cc
+++ b/beast-gtk/bstpianoroll.cc
@@@ -125,7 -134,9 +134,9 @@@ static voi
bst_piano_roll_init (BstPianoRoll *self)
{
GxkScrollCanvas *scc = GXK_SCROLL_CANVAS (self);
-
++
GTK_WIDGET_SET_FLAGS (self, GTK_CAN_FOCUS);
-
++
self->proxy = 0;
self->vzoom = KEY_DEFAULT_VPIXELS;
self->ppqn = 384; /* default Parts (clock ticks) Per Quarter Note */
@@@ -145,35 -156,48 +156,48 @@@
self->selection_min_note = 0;
self->selection_max_note = 0;
bst_piano_roll_hsetup (self, 384, 4, 800 * 384, 1);
-
++
bst_ascii_pixbuf_ref ();
}
+
static void
bst_piano_roll_destroy (GtkObject *object)
{
BstPianoRoll *self = BST_PIANO_ROLL (object);
-
++
bst_piano_roll_set_proxy (self, 0);
-
++
GTK_OBJECT_CLASS (bst_piano_roll_parent_class)->destroy (object);
}
+
static void
bst_piano_roll_dispose (GObject *object)
{
BstPianoRoll *self = BST_PIANO_ROLL (object);
-
++
bst_piano_roll_set_proxy (self, 0);
-
++
G_OBJECT_CLASS (bst_piano_roll_parent_class)->dispose (object);
}
+
static void
bst_piano_roll_finalize (GObject *object)
{
BstPianoRoll *self = BST_PIANO_ROLL (object);
-
++
bst_piano_roll_set_proxy (self, 0);
-
++
bst_ascii_pixbuf_unref ();
-
++
G_OBJECT_CLASS (bst_piano_roll_parent_class)->finalize (object);
}
+
static void
bst_piano_roll_map (GtkWidget *widget)
{
BstPianoRoll *self = BST_PIANO_ROLL (widget);
GxkScrollCanvas *scc = GXK_SCROLL_CANVAS (self);
-
++
/* initially center the vscrollbar */
if (self->proxy)
gtk_adjustment_set_value (scc->vadjustment,
@@@ -187,11 -213,15 +213,15 @@@ bst_piano_roll_set_vzoom (BstPianoRoll
gfloat vzoom)
{
g_return_val_if_fail (BST_IS_PIANO_ROLL (self), 0);
-
++
self->vzoom = vzoom; // * KEY_DEFAULT_VPIXELS;
self->vzoom = CLAMP (self->vzoom, 1, 16);
-
++
gtk_widget_queue_resize (GTK_WIDGET (self));
-
++
return self->vzoom;
}
+
static void
piano_roll_get_layout (GxkScrollCanvas *scc,
GxkScrollCanvasLayout *layout)
@@@ -212,7 -243,9 +243,9 @@@ ticks_to_pixels (BstPianoRoll *self
{
gdouble ppqn = self->ppqn;
gdouble tpixels = QNOTE_HPIXELS;
-
++
/* compute pixel span of a tick range */
-
++
tpixels *= self->hzoom / ppqn * ticks;
if (ticks)
tpixels = MAX (tpixels, 1);
@@@ -244,11 -282,13 +282,13 @@@ coord_to_tick (BstPianoRoll *self
gboolean right_bound)
{
guint tick;
-
++
x += X_OFFSET (self);
tick = pixels_to_ticks (self, x);
if (right_bound)
{
guint tick2 = pixels_to_ticks (self, x + 1);
-
++
if (tick2 > tick)
tick = tick2 - 1;
}
@@@ -265,8 -307,10 +307,10 @@@ coord_check_crossing (BstPianoRoll *sel
guint ltick = coord_to_tick (self, x, FALSE);
guint rtick = coord_to_tick (self, x, TRUE);
guint lq = 0, rq = 0;
-
++
/* catch _at_ tick boundary as well */
rtick += 1;
-
++
switch (crossing)
{
case CROSSING_TACT:
@@@ -282,8 -326,10 +326,10 @@@
rq = rtick * 4 / self->ppqn;
break;
}
-
++
return lq != rq;
}
+
#define DRAW_NONE (0)
#define DRAW_START (1)
#define DRAW_MIDDLE (2)
@@@ -309,6 -357,7 +357,7 @@@ note_to_pixels (BstPianoRoll *self
{
gint octave, ythickness = 1, z = self->vzoom, h = NOTE_HEIGHT (self), semitone = SFI_NOTE_SEMITONE (note);
gint oheight = OCTAVE_HEIGHT (self), y, zz = z + z, offs = 0, height = h;
-
++
switch (semitone)
{
case 10: offs += zz + h;
@@@ -329,17 -378,21 +378,21 @@@
octave = N_OCTAVES (self) - 1 - SFI_NOTE_OCTAVE (note) + MIN_OCTAVE (self);
y = octave * oheight;
y += oheight - offs - h;
-
++
/* spacing out by a bit looks nicer */
if (z >= 4)
{
height += ythickness;
}
-
++
if (height_p)
*height_p = height;
if (ces_fes_height_p)
*ces_fes_height_p = (semitone == 0 || semitone == 4 || semitone == 5 || semitone == 11) ? z : 0;
-
++
return y;
}
+
static gint
note_to_coord (BstPianoRoll *self,
gint note,
@@@ -356,6 -410,7 +410,7 @@@ coord_to_note (BstPianoRoll *self
gint ythickness = 1, i, z = self->vzoom, h = NOTE_HEIGHT (self);
gint end_shift, start_shift, black_shift = 0;
gint oheight = OCTAVE_HEIGHT (self), kheight = 2 * z + h;
-
++
y += Y_OFFSET (self);
info->octave = y / oheight;
i = y - info->octave * oheight;
@@@ -364,6 -419,7 +419,7 @@@
info->key_frac = i - info->key * kheight;
i = info->key_frac;
info->octave = N_OCTAVES (self) - 1 - info->octave + MIN_OCTAVE (self);
-
++
/* figure black notes */
end_shift = i >= z + h;
start_shift = i < z; /* + ythickness; */
@@@ -391,6 -447,7 +447,7 @@@
black_shift = start_shift;
break;
}
-
++
/* pixel layout and note numbers:
* Iz|h|zIz|h|zIz|h|zIz|h|zIz|h|zIz|h|zIz|h|zI
* I 0 |#1#|2|#3#|4 I 5|#6#|7|#8#|9|#10|11 I
@@@ -400,6 -457,7 +457,7 @@@
* +--0--+--1--+--2--+--3--+--4--+--5--+--6--+
* i=key_fraction, increases to right --->
*/
-
++
/* figure draw states */
if (i < ythickness)
info->wstate = DRAW_START;
@@@ -417,6 -475,7 +475,7 @@@
info->bstate = DRAW_END;
else
info->bstate = DRAW_MIDDLE;
-
++
/* behaviour fixup, ignore black note borders */
if (black_shift && info->bstate == DRAW_START)
{
@@@ -430,6 -489,7 +489,7 @@@
}
else
info->bmatch = TRUE;
-
++
/* validate note */
if (y < 0 || /* we calc junk in this case, flag invalidity */
info->octave > MAX_OCTAVE (self) ||
@@@ -452,8 -512,10 +512,10 @@@
info->valid_semitone = info->semitone;
info->valid = TRUE;
}
-
++
return info->bmatch != 0;
}
+
static void
piano_roll_allocate_marker (BstPianoRoll *self,
GxkScrollMarker *marker)
@@@ -542,6 -609,7 +609,7 @@@ bst_piano_roll_draw_vpanel (GxkScrollCa
gint width, height;
gdk_window_get_size (drawable, &width, &height);
bst_piano_roll_overlap_grow_vpanel_area (self, area);
-
++
/* draw vertical frame lines */
gdk_draw_line (drawable, dark_gc, start_x + white_x - 1, area->y, start_x + white_x - 1, area->y +
area->height - 1);
gdk_draw_line (drawable, light_gc, start_x, area->y, start_x, area->y + area->height - 1);
@@@ -550,6 -619,7 +619,7 @@@
{
gint x = black_x + 1;
NoteInfo info;
-
++
coord_to_note (self, y, &info);
switch (info.bstate)
{
@@@ -576,6 -646,7 +646,7 @@@
gint pbheight, ypos, ythickness = 1, overlap = 1;
gint pbwidth = white_x - black_x + overlap;
GdkPixbuf *pixbuf;
-
++
pbheight = OCTAVE_HEIGHT (self) / 7;
pbwidth /= 2;
ypos = y - pbheight + ythickness;
@@@ -625,6 -698,7 +698,7 @@@ bst_piano_roll_draw_canvas (GxkScrollCa
if (self->selection_duration)
{
gint x1, x2, y1, y2, h;
-
++
x1 = tick_to_coord (self, self->selection_tick);
x2 = tick_to_coord (self, self->selection_tick + self->selection_duration);
y1 = note_to_coord (self, self->selection_max_note, &h, NULL);
@@@ -688,6 -763,7 +763,7 @@@
{
GdkGC *draw_gc = COLOR_GC_MBAR (self);
guint8 dash[3] = { 2, 2, 0 };
-
++
gdk_gc_set_line_attributes (draw_gc, line_width, GDK_LINE_ON_OFF_DASH, GDK_CAP_BUTT,
GDK_JOIN_MITER);
dlen = dash[0] + dash[1];
gdk_gc_set_dashes (draw_gc, (X_OFFSET (self) + area->x + 1) % dlen, (gint8*) dash, 2);
@@@ -698,6 -774,7 +774,7 @@@
{
GdkGC *draw_gc = COLOR_GC_HGRID (self);
guint8 dash[3] = { 1, 1, 0 };
-
++
gdk_gc_set_line_attributes (draw_gc, line_width, GDK_LINE_ON_OFF_DASH, GDK_CAP_BUTT,
GDK_JOIN_MITER);
dlen = dash[0] + dash[1];
gdk_gc_set_dashes (draw_gc, (X_OFFSET (self) + area->x + 1) % dlen, (gint8*) dash, 2);
@@@ -719,6 -797,7 +797,7 @@@
GdkGC *xdark_gc, *xlight_gc, *xnote_gc;
gint x1, x2, y1, y2, height;
gboolean selected = pnote->selected;
-
++
selected |= (pnote->tick >= self->selection_tick &&
pnote->tick < self->selection_tick + self->selection_duration &&
pnote->note >= self->selection_min_note &&
@@@ -737,6 -816,7 +816,7 @@@
}
x1 = tick_to_coord (self, start);
x2 = tick_to_coord (self, end);
-
++
y1 = note_to_coord (self, pnote->note, &height, NULL);
y2 = y1 + height - 1;
gdk_draw_line (drawable, xdark_gc, x1, y2, x2, y2);
@@@ -757,6 -838,7 +838,7 @@@ bst_piano_roll_overlap_grow_hpanel_are
GdkRectangle *area)
{
gint i, x = area->x, xbound = x + area->width;
-
++
/* grow hpanel exposes by surrounding tacts */
i = coord_to_tick (self, x, FALSE);
i /= self->ppqn * self->qnpt;
@@@ -769,6 -851,7 +851,7 @@@
i += 2; /* fudge 1 tact to the right (+1 for round-off) */
i *= self->ppqn * self->qnpt;
xbound = tick_to_coord (self, i);
-
++
area->x = x;
area->width = xbound - area->x;
}
@@@ -784,6 -868,7 +868,7 @@@ bst_piano_roll_draw_hpanel (GxkScrollCa
int width, height;
gdk_window_get_size (drawable, &width, &height);
bst_piano_roll_overlap_grow_hpanel_area (self, area);
-
++
/* draw tact/note numbers */
gdk_gc_set_clip_rectangle (draw_gc, area);
for (int i = area->x; i < area->x + area->width; i++)
@@@ -794,8 -879,10 +879,10 @@@
if (coord_check_crossing (self, i, CROSSING_TACT))
{
int next_pixel, tact = coord_to_tick (self, i, TRUE) + 1;
-
++
tact /= (self->ppqn * self->qnpt);
next_pixel = tick_to_coord (self, (tact + 1) * (self->ppqn * self->qnpt));
-
++
g_snprintf (buffer, 64, "%u", tact + 1);
pango_layout_set_text (PLAYOUT_HPANEL (self), buffer, -1);
pango_layout_get_pixel_extents (PLAYOUT_HPANEL (self), NULL, &rect);
@@@ -817,6 -907,7 +907,7 @@@
g_snprintf (buffer, 64, ":%u", qn);
pango_layout_set_text (PLAYOUT_HPANEL (self), buffer, -1);
pango_layout_get_pixel_extents (PLAYOUT_HPANEL (self), NULL, &rect);
-
++
/* draw this tact if there's enough space */
if (i + rect.width < (i + next_pixel) / 2) /* don't half width, leave some more space */
gdk_draw_layout (drawable, draw_gc,
@@@ -837,6 -929,7 +929,7 @@@ piano_roll_queue_expose (BstPianoRoll *
gint x2 = tick_to_coord (self, tick_end);
gint height, cfheight, y1 = note_to_coord (self, note, &height, &cfheight);
GdkRectangle area;
-
++
area.x = x1;
area.width = x2 - x1;
area.x -= 3; /* add fudge */
@@@ -887,6 -982,7 +982,7 @@@ piano_roll_update_adjustments (GxkScrol
gboolean vadj)
{
BstPianoRoll *self = BST_PIANO_ROLL (scc);
-
++
if (hadj)
{
/* allow free boundary adjustments by the user between last_tick and 1e+9 ticks and pixels.
@@@ -933,6 -1032,7 +1032,7 @@@ bst_piano_roll_hsetup (BstPianoRoll *se
self->qnpt = CLAMP (qnpt, 3, 4);
self->max_ticks = MAX (max_ticks, 1);
self->hzoom = CLAMP (hzoom, 0.01, 100);
-
++
if (old_ppqn != self->ppqn ||
old_qnpt != self->qnpt ||
old_hzoom != self->hzoom)
@@@ -956,13 -1057,16 +1057,16 @@@ bst_piano_roll_set_hzoom (BstPianoRoll
{
GxkScrollCanvas *scc = GXK_SCROLL_CANVAS (self);
g_return_val_if_fail (BST_IS_PIANO_ROLL (self), 0);
-
++
bst_piano_roll_hsetup (self, self->ppqn, self->qnpt, self->max_ticks, hzoom);
guint i;
/* readjust markers */
for (i = 0; i < scc->n_markers; i++)
piano_roll_allocate_marker (self, scc->markers + i);
-
++
return self->hzoom;
}
+
static void
piano_roll_handle_drag (GxkScrollCanvas *scc,
GxkScrollCanvasDrag *scc_drag,
@@@ -1098,6 -1208,7 +1208,7 @@@ bst_piano_roll_set_proxy (BstPianoRoll
g_return_if_fail (BSE_IS_ITEM (proxy));
g_return_if_fail (bse_item_get_project (proxy) != 0);
}
-
++
if (self->proxy)
{
if (self->song)
@@@ -1168,6 -1281,7 +1281,7 @@@ bst_piano_roll_set_view_selection (BstP
gint max_note)
{
g_return_if_fail (BST_IS_PIANO_ROLL (self));
-
++
if (min_note > max_note || !duration) /* invalid selection */
{
tick = 0;
@@@ -1175,6 -1289,7 +1289,7 @@@
min_note = 0;
max_note = 0;
}
-
++
if (self->selection_duration && duration)
{
/* if at least one corner of the old an the new selection
@@@ -1250,7 -1367,9 +1367,9 @@@ bst_piano_roll_get_paste_pos (BstPianoR
{
guint tick, semitone;
gint octave;
-
++
g_return_if_fail (BST_IS_PIANO_ROLL (self));
-
++
if (GTK_WIDGET_DRAWABLE (self))
{
NoteInfo info;
@@@ -1323,10 -1447,14 +1447,14 @@@ bst_piano_roll_class_init (BstPianoRoll
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GxkScrollCanvasClass *scroll_canvas_class = GXK_SCROLL_CANVAS_CLASS (klass);
-
++
gobject_class->dispose = bst_piano_roll_dispose;
gobject_class->finalize = bst_piano_roll_finalize;
-
++
object_class->destroy = bst_piano_roll_destroy;
+
widget_class->map = bst_piano_roll_map;
+
scroll_canvas_class->hscrollable = TRUE;
scroll_canvas_class->vscrollable = TRUE;
scroll_canvas_class->get_layout = piano_roll_get_layout;
@@@ -1338,9 -1466,12 +1466,12 @@@
scroll_canvas_class->update_adjustments = piano_roll_update_adjustments;
scroll_canvas_class->adjustment_changed = piano_roll_adjustment_changed;
scroll_canvas_class->handle_drag = piano_roll_handle_drag;
+
bst_skin_config_add_notify ((BstSkinConfigNotify) piano_roll_class_setup_skin, klass);
piano_roll_class_setup_skin (klass);
-
++
klass->canvas_clicked = NULL;
-
++
signal_canvas_drag = g_signal_new ("canvas-drag", G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (BstPianoRollClass, canvas_drag),
NULL, NULL,
diff --cc beast-gtk/bstpianoroll.hh
index 625b087,9e6c9e7..f37f3e9
--- a/beast-gtk/bstpianoroll.hh
+++ b/beast-gtk/bstpianoroll.hh
@@@ -97,5 -113,8 +113,8 @@@ void bst_piano_roll_set_marke
guint mark_index,
guint position,
BstPianoRollMarkerType mtype);
+
-
++
G_END_DECLS
+
#endif /* __BST_PIANO_ROLL_H__ */
diff --cc beast-gtk/bstplaylist.cc
index 1ebdb84,3e5bd90..b9f733d
--- a/beast-gtk/bstplaylist.cc
+++ b/beast-gtk/bstplaylist.cc
@@@ -75,6 -89,7 +89,7 @@@ GtkTyp
bst_play_list_get_type (void)
{
static GtkType play_list_type = 0;
-
++
if (!play_list_type)
{
GtkTypeInfo play_list_info =
@@@ -88,10 -103,13 +103,13 @@@
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
-
++
play_list_type = gtk_type_unique (GTK_TYPE_VPANED, &play_list_info);
}
-
++
return play_list_type;
}
+
static void
bst_play_list_class_init (BstPlayListClass *klass)
{
@@@ -178,6 -204,8 +204,8 @@@ bst_play_list_init (BstPlayList *plist
"signal::drag_data_received", group_list_drag_data_received, plist,
"signal::drag_drop", group_list_drag_drop, plist,
NULL);
-
-
++
++
/* build insertion spots and drag_windows
*/
if (!drag_windows_ref_count)
@@@ -242,24 -277,29 +277,29 @@@ bst_play_list_destroy (GtkObject *objec
{
g_object_unref (plist->size_group);
plist->size_group = NULL;
-
++
/* destroy drag_windows
*/
drag_windows_ref_count -= 1;
if (!drag_windows_ref_count)
{
GtkWidget *drag_widget;
-
++
drag_widget = bst_play_list_drop_spot_pattern_group;
bst_play_list_drop_spot_pattern_group = NULL;
gtk_widget_destroy (drag_widget);
gtk_widget_unref (drag_widget);
-
++
drag_widget = bst_play_list_drop_spot_pattern;
bst_play_list_drop_spot_pattern = NULL;
gtk_widget_destroy (drag_widget);
gtk_widget_unref (drag_widget);
-
++
drag_widget = bst_play_list_drag_window_pattern_icon;
bst_play_list_drag_window_pattern_icon = NULL;
gtk_widget_destroy (drag_widget);
gtk_widget_unref (drag_widget);
-
++
drag_widget = bst_play_list_drag_window_pattern_group_icon;
bst_play_list_drag_window_pattern_group_icon = NULL;
gtk_widget_destroy (drag_widget);
@@@ -350,10 -407,13 +407,13 @@@ group_list_drag_data_received (GtkWidge
g_return_if_fail (selection_data->type == atom_beast_pattern_group_pointer);
g_return_if_fail (selection_data->format == 8);
g_return_if_fail (selection_data->length == sizeof (gpointer));
+
action = context->actions & context->suggested_action;
g_return_if_fail ((action & (GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK)) != 0);
-
++
drag_contents = *((gpointer*) selection_data->data);
g_return_if_fail (BSE_IS_PATTERN_GROUP (drag_contents));
+
position = bst_container_get_insertion_position (GTK_CONTAINER (group_list),
FALSE, y,
bst_play_list_drop_spot_pattern_group, NULL);
@@@ -465,8 -544,11 +544,11 @@@ GtkWidget
bst_play_list_new (BseSong *song)
{
GtkWidget *play_list;
-
++
g_return_val_if_fail (BSE_IS_SONG (song), NULL);
-
++
play_list = gtk_widget_new (BST_TYPE_PLAY_LIST, NULL);
bst_play_list_set_song (BST_PLAY_LIST (play_list), song);
-
++
return play_list;
}
diff --cc beast-gtk/bstpreferences.cc
index 71922c2,c83c69a..d04c22d
--- a/beast-gtk/bstpreferences.cc
+++ b/beast-gtk/bstpreferences.cc
@@@ -28,6 -33,7 +33,7 @@@ bst_preferences_init (BstPreferences *s
GParamSpec *pspec;
GtkWidget *pchild;
SfiRec *rec;
-
++
self->notebook = (GtkNotebook*) g_object_new (GXK_TYPE_NOTEBOOK,
"visible", TRUE,
"parent", self,
@@@ -37,10 -43,12 +43,12 @@@
"border_width", 5,
NULL);
gxk_nullify_in_object (self, &self->notebook);
-
++
pspec = bst_gconfig_pspec ();
self->rec_gconfig = bst_gconfig_to_rec (bst_gconfig_get_global ());
pchild = bst_preferences_build_rec_editor (self->rec_gconfig, sfi_pspec_get_rec_fields (pspec),
&self->params_gconfig);
gxk_notebook_append (self->notebook, pchild, "BEAST", FALSE);
-
++
kbinding = bst_pattern_controller_piano_keys();
iseq = bst_key_binding_get_item_seq (kbinding);
self->box_piano_keys = bst_key_binding_box (kbinding->binding_name, kbinding->n_funcs, kbinding->funcs,
TRUE);
@@@ -56,10 -66,12 +66,12 @@@
self->box_msg_absorb_config = bst_msg_absorb_config_box();
bst_msg_absorb_config_box_set (self->box_msg_absorb_config, bst_msg_absorb_config_get_global());
gxk_notebook_append (self->notebook, self->box_msg_absorb_config, _("Messages"), FALSE);
-
++
pspec = bst_skin_config_pspec ();
self->rec_skin = bst_skin_config_to_rec (bst_skin_config_get_global ());
pchild = bst_preferences_build_rec_editor (self->rec_skin, sfi_pspec_get_rec_fields (pspec),
&self->params_skin);
gxk_notebook_append (self->notebook, pchild, _("Skin"), FALSE);
-
++
pspec = bse_proxy_get_pspec (BSE_SERVER, "bse-preferences");
self->bsepspec = g_param_spec_ref (pspec);
bse_proxy_get (BSE_SERVER, "bse-preferences", &rec, NULL);
@@@ -71,6 -84,7 +84,7 @@@ static voi
bst_preferences_destroy (GtkObject *object)
{
BstPreferences *self = BST_PREFERENCES (object);
-
++
if (self->rec_gconfig)
{
sfi_rec_unref (self->rec_gconfig);
@@@ -78,6 -92,7 +92,7 @@@
}
sfi_ring_free (self->params_gconfig);
self->params_gconfig = NULL;
-
++
if (self->rec_skin)
{
sfi_rec_unref (self->rec_skin);
@@@ -85,6 -100,7 +100,7 @@@
}
sfi_ring_free (self->params_skin);
self->params_skin = NULL;
-
++
if (self->bsepspec)
{
g_param_spec_unref (self->bsepspec);
@@@ -97,8 -113,10 +113,10 @@@
}
sfi_ring_free (self->bseparams);
self->bseparams = NULL;
-
++
GTK_OBJECT_CLASS (bst_preferences_parent_class)->destroy (object);
}
+
static GtkWidget*
bst_preferences_build_rec_editor (SfiRec *rec,
SfiRecFields fields,
@@@ -106,7 -124,9 +124,9 @@@
{
SfiRing *ring, *params = NULL;
guint i;
-
++
g_return_val_if_fail (rec != NULL, NULL);
-
++
GtkWidget *vbox = (GtkWidget*) g_object_new (GTK_TYPE_VBOX,
"visible", TRUE,
"homogeneous", FALSE,
@@@ -147,7 -170,9 +170,9 @@@ bst_preferences_revert (BstPreferences
BstKeyBindingItemSeq *iseq;
BstKeyBinding *kbinding;
SfiRec *rec, *crec;
-
++
g_return_if_fail (BST_IS_PREFERENCES (self));
-
++
rec = bst_gconfig_to_rec (bst_gconfig_get_global ());
crec = sfi_rec_copy_deep (rec);
sfi_rec_unref (rec);
@@@ -200,19 -238,24 +238,24 @@@ bst_preferences_default_revert (BstPref
sfi_rec_validate (rec, sfi_pspec_get_rec_fields (bst_skin_config_pspec ()));
sfi_rec_swap_fields (self->rec_skin, rec);
sfi_rec_unref (rec);
-
++
rec = sfi_rec_new ();
sfi_rec_validate (rec, sfi_pspec_get_rec_fields (self->bsepspec));
sfi_rec_swap_fields (self->bserec, rec);
sfi_rec_unref (rec);
-
++
bst_preferences_update_params (self);
}
+
void
bst_preferences_apply (BstPreferences *self)
{
BstKeyBindingItemSeq *iseq;
BstKeyBinding *kbinding;
g_return_if_fail (BST_IS_PREFERENCES (self));
-
++
bst_gconfig_apply (self->rec_gconfig);
+
kbinding = bst_pattern_controller_piano_keys();
iseq = bst_key_binding_box_get (self->box_piano_keys);
bst_key_binding_set_item_seq (kbinding, iseq);
@@@ -225,10 -270,14 +270,14 @@@
SfiSeq *seq = bst_msg_absorb_string_seq_to_seq (mass);
bst_msg_absorb_config_apply (seq);
sfi_seq_unref (seq);
-
++
bst_skin_config_apply (self->rec_skin, NULL);
+
bse_proxy_set (BSE_SERVER, "bse-preferences", self->bserec, NULL);
+
bst_preferences_revert (self);
}
+
void
bst_preferences_load_rc_files (void)
{
@@@ -262,8 -317,11 +317,11 @@@ bst_preferences_save (BstPreferences *s
BseErrorType error = BseErrorType (0);
gchar *file_name;
GSList *slist = NULL;
+
g_return_if_fail (BST_IS_PREFERENCES (self));
-
++
bse_server_save_preferences (BSE_SERVER);
-
++
file_name = BST_STRDUP_RC_FILE ();
error = bst_rc_dump (file_name);
if (error)
@@@ -290,9 -352,11 +352,11 @@@ bst_preferences_create_buttons (BstPref
GxkDialog *dialog)
{
GtkWidget *widget;
-
++
g_return_if_fail (BST_IS_PREFERENCES (self));
g_return_if_fail (GXK_IS_DIALOG (dialog));
g_return_if_fail (self->apply == NULL);
-
++
/* Apply
*/
self->apply = gxk_dialog_default_action (dialog, BST_STOCK_APPLY, NULL, NULL);
@@@ -305,14 -369,17 +369,17 @@@
"Apply and save the preference values. Some values may only take effect after "
"restart while others can be locked against modifcation during "
"playback.");
-
++
/* Revert
*/
widget = gxk_dialog_action_swapped (dialog, BST_STOCK_REVERT, (void*) bst_preferences_revert, self);
gxk_widget_set_tooltip (widget, "Revert dialog changes to the currently active values.");
-
++
/* Default Revert
*/
widget = gxk_dialog_action_swapped (dialog, BST_STOCK_DEFAULT_REVERT, (void*)
bst_preferences_default_revert, self);
gxk_widget_set_tooltip (widget, "Revert to hardcoded default values (factory settings).");
-
++
/* Close
*/
widget = (GtkWidget*) gxk_dialog_action (dialog, BST_STOCK_DISMISS, (void*) gxk_toplevel_delete, NULL);
diff --cc beast-gtk/bstprocbrowser.cc
index bc2861e,33a8c6e..2a51297
--- a/beast-gtk/bstprocbrowser.cc
+++ b/beast-gtk/bstprocbrowser.cc
@@@ -186,6 -223,7 +223,7 @@@ bst_proc_browser_execute (BstProcBrowse
}
else
g_printerr ("no-such-procedure: %s \n", argv[0]);
-
++
// g_printerr ("return: %d\n", bsw_server_exec_proc (BSE_SERVER, argv[0], argv[1]));
g_strfreev (argv);
}
diff --cc beast-gtk/bstprocbrowser.hh
index 585c3a7,3df6e9e..8021084
--- a/beast-gtk/bstprocbrowser.hh
+++ b/beast-gtk/bstprocbrowser.hh
@@@ -18,11 -24,15 +24,15 @@@ typedef struct _BstProcBrowserClass Bst
struct _BstProcBrowser
{
GtkVBox parent_object;
+
GtkWidget *hbox;
+
guint n_cats;
BseCategory *cats;
-
++
GxkListWrapper *proc_list;
GtkEntry *entry;
+
/* buttons */
GtkWidget *execute;
};
diff --cc beast-gtk/bstprocedure.cc
index 2ef48f4,b00888c..e2030ba
--- a/beast-gtk/bstprocedure.cc
+++ b/beast-gtk/bstprocedure.cc
@@@ -18,6 -24,7 +24,7 @@@ GtkTyp
bst_procedure_shell_get_type (void)
{
static GtkType procedure_shell_type = 0;
-
++
if (!procedure_shell_type)
{
GtkTypeInfo procedure_shell_info =
@@@ -31,21 -38,29 +38,29 @@@
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
-
++
procedure_shell_type = gtk_type_unique (GTK_TYPE_VBOX, &procedure_shell_info);
}
-
++
return procedure_shell_type;
}
+
static void
bst_procedure_shell_class_init (BstProcedureShellClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
+
parent_class = g_type_class_peek_parent (klass);
-
++
quark_output_params = g_quark_from_static_string ("Output Parameters");
quark_input_params = g_quark_from_static_string ("Input Parameters");
-
++
gobject_class->finalize = bst_procedure_shell_finalize;
+
object_class->destroy = bst_procedure_shell_destroy;
}
+
static void
bst_procedure_shell_init (BstProcedureShell *self)
{
@@@ -70,33 -87,44 +87,44 @@@ static voi
bst_procedure_shell_destroy (GtkObject *object)
{
BstProcedureShell *self = BST_PROCEDURE_SHELL (object);
-
++
if (self->in_execution)
g_warning (G_STRLOC ": destroying procedure shell during execution");
-
++
bst_procedure_shell_set_proc (self, NULL);
-
++
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
+
static void
bst_procedure_shell_finalize (GObject *object)
{
BstProcedureShell *self = BST_PROCEDURE_SHELL (object);
-
++
bst_procedure_shell_set_proc (self, NULL);
sfi_rec_unref (self->prec);
self->prec = NULL;
-
++
G_OBJECT_CLASS (parent_class)->finalize (object);
}
+
GtkWidget*
bst_procedure_shell_new (SfiGlueProc *proc)
{
GtkWidget *widget;
-
++
widget = gtk_widget_new (BST_TYPE_PROCEDURE_SHELL, NULL);
bst_procedure_shell_set_proc (BST_PROCEDURE_SHELL (widget), proc);
-
++
return widget;
}
+
void
bst_procedure_shell_set_proc (BstProcedureShell *self,
SfiGlueProc *proc)
{
g_return_if_fail (BST_IS_PROCEDURE_SHELL (self));
-
++
if (proc != self->proc)
{
bst_procedure_shell_destroy_contents (self);
@@@ -115,12 -144,17 +144,17 @@@ bst_procedure_shell_rebuild (BstProcedu
GtkWidget *param_box;
SfiRing *ring, *pspecs = NULL;
guint i;
-
++
g_return_if_fail (BST_IS_PROCEDURE_SHELL (self));
-
++
sfi_rec_clear (self->prec);
bst_procedure_shell_destroy_contents (self);
-
++
if (!self->proc)
return;
-
++
proc = self->proc;
-
++
/* main container
*/
param_box = GTK_WIDGET (self);
@@@ -129,6 -163,7 +163,7 @@@
"spacing", 0,
"border_width", 5,
NULL);
-
++
/* put procedure title */
const gchar *string = bst_procedure_get_title (proc->name);
if (!string)
@@@ -142,6 -177,7 +177,7 @@@
FALSE,
TRUE,
0);
-
++
/* put description
*/
if (proc->help)
@@@ -161,6 -197,7 +197,7 @@@
"child", gxk_scroll_text_create (GXK_SCROLL_TEXT_WIDGET_LOOK, proc->help),
NULL);
}
-
++
/* parameter fields
*/
for (i = 0; i < proc->n_params; i++)
@@@ -176,6 -213,7 +213,7 @@@
self->params = sfi_ring_append (self->params, param);
}
sfi_ring_free (pspecs);
-
++
/* initialize parameter values
*/
bst_procedure_shell_reset (self);
@@@ -184,7 -223,9 +223,9 @@@ voi
bst_procedure_shell_update (BstProcedureShell *self)
{
SfiRing *ring;
+
g_return_if_fail (BST_IS_PROCEDURE_SHELL (self));
-
++
for (ring = self->params; ring; ring = sfi_ring_walk (ring, self->params))
gxk_param_update ((GxkParam*) ring->data);
}
@@@ -206,8 -250,10 +250,10 @@@ bst_procedure_shell_execute (BstProcedu
g_return_if_fail (BST_IS_PROCEDURE_SHELL (self));
g_return_if_fail (self->proc != NULL);
g_return_if_fail (self->in_execution == FALSE);
-
++
widget = GTK_WIDGET (self);
gtk_widget_ref (widget);
+
/* update parameter record */
for (ring = self->params; ring; ring = sfi_ring_walk (ring, self->params))
gxk_param_apply_value ((GxkParam*) ring->data);
@@@ -269,7 -326,9 +326,9 @@@ voi
bst_procedure_shell_unpreset (BstProcedureShell *self)
{
SfiRing *ring;
-
++
g_return_if_fail (BST_IS_PROCEDURE_SHELL (self));
-
++
for (ring = self->params; ring; ring = sfi_ring_walk (ring, self->params))
{
GxkParam *param = (GxkParam*) ring->data;
@@@ -303,7 -364,9 +364,9 @@@ bst_procedure_shell_preset (BstProcedur
g_return_val_if_fail (self->proc != NULL, 0);
g_return_val_if_fail (name != NULL, 0);
g_return_val_if_fail (G_IS_VALUE (value), 0);
-
++
proc = self->proc;
-
++
/* ok, this is the really interesting part!
* we try to unificate the preset parameter with the procedure's
* input parameters. if we find a name match and type conversion
@@@ -343,14 -408,17 +408,17 @@@
}
/* update parameters from record */
bst_procedure_shell_update (self);
-
++
return FALSE;
}
+
BstProcedureShell*
bst_procedure_shell_global (void)
{
if (!global_proc_shell)
{
GtkWidget *dialog;
-
++
global_proc_shell = (BstProcedureShell*) bst_procedure_shell_new (NULL);
g_object_ref (global_proc_shell);
gtk_object_sink (GTK_OBJECT (global_proc_shell));
@@@ -358,8 -426,10 +426,10 @@@
GXK_DIALOG_STATUS_BAR | GXK_DIALOG_HIDE_ON_DELETE |
GXK_DIALOG_MODAL, // | GXK_DIALOG_WINDOW_GROUP,
_("Start Procedure"), NULL);
gxk_dialog_set_sizes (GXK_DIALOG (dialog), -1, -1, 320, -1);
-
++
gtk_container_add (GTK_CONTAINER (GXK_DIALOG (dialog)->vbox), GTK_WIDGET (global_proc_shell));
gtk_widget_show (GTK_WIDGET (global_proc_shell));
+
/* actions */
gxk_dialog_default_action_swapped (GXK_DIALOG (dialog),
BST_STOCK_EXECUTE, (void*) bst_procedure_shell_execute,
global_proc_shell);
diff --cc beast-gtk/bstprocedure.hh
index f2d4360,a6dac7b..088ff6c
--- a/beast-gtk/bstprocedure.hh
+++ b/beast-gtk/bstprocedure.hh
@@@ -16,10 -21,13 +21,13 @@@ typedef struct _BstProcedureShellClas
struct _BstProcedureShell
{
GtkVBox parent_object;
-
++
SfiGlueProc *proc;
SfiRec *prec;
+
guint n_preset_params;
SfiRing *params; /* n_in_params + n_out_params params */
-
++
guint in_modal_selection : 1;
guint in_execution : 1;
guint hide_dialog_on_exec : 1;
diff --cc beast-gtk/bstprojectctrl.cc
index 3ea8aa7,dd27a39..ae9ec2e
--- a/beast-gtk/bstprojectctrl.cc
+++ b/beast-gtk/bstprojectctrl.cc
@@@ -116,6 -133,7 +133,7 @@@ bst_project_ctrl_init (BstProjectCtrl *
NULL);
gtk_box_pack_start (GTK_BOX (box), self->rew, FALSE, FALSE, spaceing);
gxk_nullify_in_object (self, &self->rew);
-
++
/* Play */
self->play = (GtkWidget*) g_object_new (GTK_TYPE_BUTTON,
"child", gxk_polygon_new (&gxk_polygon_play),
@@@ -124,6 -142,7 +142,7 @@@
g_object_connect (self->play, "swapped_signal::clicked", bst_project_ctrl_play, self, NULL);
gtk_box_pack_start (GTK_BOX (box), self->play, FALSE, FALSE, spaceing);
gxk_nullify_in_object (self, &self->play);
-
++
/* Pause */
self->pause = (GtkWidget*) g_object_new (GTK_TYPE_BUTTON,
"child", gxk_polygon_new (&gxk_polygon_pause),
@@@ -132,6 -151,7 +151,7 @@@
NULL);
gtk_box_pack_start (GTK_BOX (box), self->pause, FALSE, FALSE, spaceing);
gxk_nullify_in_object (self, &self->pause);
-
++
/* Forward */
self->fwd = (GtkWidget*) g_object_new (GTK_TYPE_BUTTON,
"child", gxk_polygon_new (&gxk_polygon_forward),
@@@ -140,8 -160,11 +160,11 @@@
NULL);
gtk_box_pack_start (GTK_BOX (box), self->fwd, FALSE, FALSE, spaceing);
gxk_nullify_in_object (self, &self->fwd);
-
++
gtk_widget_show_all (box);
}
+
+
static void
bst_project_ctrl_class_init (BstProjectCtrlClass *klass)
{
diff --cc beast-gtk/bstqsampler.cc
index d1b2797,91f1560..6067c83
--- a/beast-gtk/bstqsampler.cc
+++ b/beast-gtk/bstqsampler.cc
@@@ -59,7 -70,9 +70,9 @@@ bst_qsampler_class_init (BstQSamplerCla
gobject_class->finalize = bst_qsampler_finalize;
gobject_class->set_property = bst_qsampler_set_property;
gobject_class->get_property = bst_qsampler_get_property;
-
++
object_class->destroy = bst_qsampler_destroy;
+
widget_class->realize = bst_qsampler_realize;
widget_class->size_request = bst_qsampler_size_request;
widget_class->size_allocate = bst_qsampler_size_allocate;
@@@ -124,7 -144,9 +144,9 @@@ bst_qsampler_size_allocate (GtkWidge
GtkAllocation *allocation)
{
BstQSampler *qsampler = BST_QSAMPLER (widget);
-
++
GTK_WIDGET_CLASS (bst_qsampler_parent_class)->size_allocate (widget, allocation);
+
if (GTK_WIDGET_REALIZED (widget))
gdk_window_move_resize (qsampler->canvas,
widget->style->xthickness,
@@@ -237,6 -271,7 +271,7 @@@ bst_qsampler_expose (GtkWidget *wi
GdkEventExpose *event)
{
BstQSampler *qsampler = BST_QSAMPLER (widget);
-
++
if (GTK_WIDGET_DRAWABLE (qsampler))
{
qsampler->expose_frame |= event->window == widget->window;
@@@ -584,6 -676,7 +676,7 @@@ bst_qsampler_copy_area (BstQSampler *qs
guint to)
{
guint length = MAX (from, to);
-
++
if (GTK_WIDGET_DRAWABLE (qsampler) && length < qsampler->n_pixels)
gdk_window_scroll (qsampler->canvas, from - to, 0);
else
@@@ -673,6 -775,8 +775,8 @@@ bst_qsampler_draw_peak (BstQSampler *qs
gfloat middle_value = (value + mvalue) / 2;
gfloat next_middle_value = (next_value + next_mvalue) / 2;
gint x = offset, y;
-
-
++
++
switch (qsampler->draw_mode)
{
gint yb, yn;
@@@ -712,6 -816,7 +816,7 @@@
gint cur_min = mpeak, cur_max = peak;
gint y1, y2;
gfloat min_value, max_value;
-
++
y1 = cur_max;
y2 = cur_max;
if (last_min > cur_max)
@@@ -726,6 -831,7 +831,7 @@@
if (cur_min > next_max)
y2 = (next_max + cur_min) / 2;
cur_min = MIN (cur_min, MIN (y1, y2));
-
++
min_value = ((gfloat) cur_min) / 32768.;
max_value = ((gfloat) cur_max) / 32768.;
y1 = low - (max_value + 1) * range;
@@@ -757,6 -864,7 +864,7 @@@ bst_qsampler_fetch_gcs (BstQSampler *qs
{
GtkWidget *widget = (GtkWidget*) qsampler;
GdkGC *back_gc, *fore_gc = NULL;
-
++
if (GTK_WIDGET_IS_SENSITIVE (widget) && !(peak_type & BST_QSAMPLER_SKIP))
{
back_gc = widget->style->base_gc[GTK_STATE_NORMAL];
@@@ -821,12 -931,14 +931,14 @@@ bst_qsampler_redraw (BstQSampler *qsamp
gint ythickness = widget->style->ythickness;
gint hi = 0, low = MAX (widget->allocation.height - 2 * ythickness, hi);
guint peak_type = 0, i, bound;
-
++
if (qsampler->expose_frame)
gtk_draw_shadow (widget->style, widget->window,
GTK_STATE_NORMAL, GTK_SHADOW_IN,
0, 0,
widget->allocation.width, widget->allocation.height);
qsampler->expose_frame = FALSE;
-
++
i = 0;
do
{
@@@ -849,6 -963,7 +963,7 @@@
for (bound = i + 1; bound < qsampler->n_pixels; bound++)
{
GdkGC *tmp_fore_gc, *tmp_back_gc;
-
++
peak_type = qsampler->peaks[bound].type;
if (!(peak_type & BST_QSAMPLER_NEEDS_DRAW) ||
(!draw_dirty && (peak_type & BST_QSAMPLER_DIRTY)))
@@@ -1171,22 -1330,25 +1330,24 @@@ qsampler_esample_filler (gpointe
BstQSampler *qsampler)
{
ESampleFiller *fill = (ESampleFiller*) data;
- SfiFBlock *fblock;
-
+ BseFloatSeq *fseq;
voffset = voffset * fill->n_channels + fill->nth_channel;
- fblock = bse_editable_sample_collect_stats (fill->esample,
- voffset,
- offset_scale * fill->n_channels,
- block_size * fill->n_channels,
- fill->n_channels,
- n_values);
+ fseq = bse_editable_sample_collect_stats (fill->esample,
+ voffset,
+ offset_scale * fill->n_channels,
+ block_size * fill->n_channels,
+ fill->n_channels,
+ n_values);
uint i;
- for (i = 0; i < fblock->n_values / 2; i++)
+ for (i = 0; i < fseq->n_values / 2; i++)
{
- values[i].min = fblock->values[i * 2] * 32767.9;
- values[i].max = fblock->values[i * 2 + 1] * 32767.9;
+ values[i].min = fseq->values[i * 2] * 32767.9;
+ values[i].max = fseq->values[i * 2 + 1] * 32767.9;
}
+
return i;
}
+
static void
free_esample_filler (gpointer data)
{
diff --cc beast-gtk/bstqsampler.hh
index 3f2bcdf,24b56b1..873e75f
--- a/beast-gtk/bstqsampler.hh
+++ b/beast-gtk/bstqsampler.hh
@@@ -43,12 -50,13 +50,13 @@@ typedef enu
BST_QSAMPLER_DIRTY = 1 << 7
} BstQSamplerType;
#ifdef __cplusplus
-inline BstQSamplerType operator& (BstQSamplerType s1, BstQSamplerType s2) { return BstQSamplerType (s1 &
(long long unsigned) s2); }
-inline BstQSamplerType& operator&= (BstQSamplerType &s1, BstQSamplerType s2) { s1 = s1 & s2; return s1; }
-inline BstQSamplerType operator| (BstQSamplerType s1, BstQSamplerType s2) { return BstQSamplerType (s1 |
(long long unsigned) s2); }
-inline BstQSamplerType& operator|= (BstQSamplerType &s1, BstQSamplerType s2) { s1 = s1 | s2; return s1; }
-inline BstQSamplerType operator~ (BstQSamplerType s1) { return BstQSamplerType (~(long
long unsigned) s1); }
+constexpr BstQSamplerType operator& (BstQSamplerType s1, BstQSamplerType s2) { return BstQSamplerType
(s1 & (long long unsigned) s2); }
+inline BstQSamplerType& operator&= (BstQSamplerType &s1, BstQSamplerType s2) { s1 = s1 & s2; return s1; }
+constexpr BstQSamplerType operator| (BstQSamplerType s1, BstQSamplerType s2) { return BstQSamplerType
(s1 | (long long unsigned) s2); }
+inline BstQSamplerType& operator|= (BstQSamplerType &s1, BstQSamplerType s2) { s1 = s1 | s2; return s1; }
+constexpr BstQSamplerType operator~ (BstQSamplerType s1) { return BstQSamplerType
(~(long long unsigned) s1); }
#endif // __cplusplus
+
typedef enum
{
BST_QSAMPLER_DRAW_CRANGE,
diff --cc beast-gtk/bstrackeditor.cc
index 27933a6,4adaf2c..202ef1e
--- a/beast-gtk/bstrackeditor.cc
+++ b/beast-gtk/bstrackeditor.cc
@@@ -43,10 -55,14 +55,14 @@@ static voi
bst_rack_editor_class_init (BstRackEditorClass *klass)
{
GtkObjectClass *object_class;
+
object_class = GTK_OBJECT_CLASS (klass);
-
++
parent_class = g_type_class_peek_parent (klass);
+
object_class->destroy = bst_rack_editor_destroy;
}
+
static void
toggle_edit_mode (BstRackEditor *ed)
{
@@@ -111,6 -134,7 +134,7 @@@ bst_rack_editor_destroy (GtkObject *obj
gtk_widget_destroy ((GtkWidget*) slist->data);
g_slist_free_1 (slist);
}
-
++
/* chain parent class' handler */
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
diff --cc beast-gtk/bstrackitem.cc
index d1c0be1,901108f..6d06951
--- a/beast-gtk/bstrackitem.cc
+++ b/beast-gtk/bstrackitem.cc
@@@ -37,10 -44,14 +44,14 @@@ rack_item_class_init (BstRackItemClass
{
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GxkRackItemClass *xitem_class = GXK_RACK_ITEM_CLASS (klass);
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
object_class->destroy = rack_item_destroy;
-
++
xitem_class->button_press = rack_item_button_press;
}
+
static void
rack_item_init (BstRackItem *self)
{
@@@ -53,18 -65,22 +65,22 @@@ static voi
rack_item_destroy (GtkObject *object)
{
BstRackItem *self = BST_RACK_ITEM (object);
-
++
if (self->param)
{
gxk_param_destroy (self->param);
self->param = NULL;
}
-
++
bst_rack_item_set_parasite (self, 0, NULL);
-
++
if (self->choice)
{
bst_choice_destroy (self->choice);
self->controller_choice = NULL;
self->choice = NULL;
}
-
++
/* chain parent class' handler */
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
@@@ -90,15 -108,18 +108,18 @@@ rack_item_parasite_changed (BstRackIte
GParamSpec *pspec = NULL;
SfiProxy proxy = 0;
const gchar *controller, *name;
-
++
controller = bse_data_pocket_get_string (self->pocket, self->entry, "property-controller");
name = bse_data_pocket_get_string (self->pocket, self->entry, "property-name");
proxy = bse_data_pocket_get_object (self->pocket, self->entry, "property-object");
if (proxy && name)
pspec = bse_proxy_get_pspec (proxy, name);
bst_rack_item_set_proxy (self, pspec ? proxy : 0, pspec, controller);
-
++
if (self->bparam)
{
BstRackChildInfo info;
-
++
info.col = bse_data_pocket_get_int (self->pocket, self->entry, "property-x");
info.row = bse_data_pocket_get_int (self->pocket, self->entry, "property-y");
info.hspan = bse_data_pocket_get_int (self->pocket, self->entry, "property-hspan");
@@@ -124,6 -147,7 +147,7 @@@ bst_rack_item_set_parasite (BstRackIte
const gchar *path)
{
g_return_if_fail (BST_IS_RACK_ITEM (self));
-
++
if (self->proxy)
{
bse_proxy_disconnect (self->proxy,
@@@ -153,6 -178,7 +178,7 @@@ rack_item_button_press (GxkRackItem
{
gboolean can_clone = self->pocket && self->bparam && self->proxy && self->pspec;
guint id;
-
++
if (!self->choice)
{
self->controller_choice = create_controller_menu ();
diff --cc beast-gtk/bstrackitem.hh
index 2f0c683,deab9dc..6dbd7e5
--- a/beast-gtk/bstrackitem.hh
+++ b/beast-gtk/bstrackitem.hh
@@@ -17,12 -21,15 +21,15 @@@ typedef struct
SfiProxy proxy;
const gchar *path;
SfiRec *rec;
-
++
guint block_updates;
GtkWidget *controller_choice;
GtkWidget *choice;
-
++
/* pocket data */
GParamSpec *pspec;
gchar *ctype;
-
++
GxkParam *param;
} BstRackItem;
typedef struct _GxkRackItemClass BstRackItemClass;
diff --cc beast-gtk/bstracktable.cc
index 5bcf0d3,70b4169..960eb48
--- a/beast-gtk/bstracktable.cc
+++ b/beast-gtk/bstracktable.cc
@@@ -94,10 -105,15 +105,15 @@@ bst_rack_table_class_init (BstRackTable
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
-
++
parent_class = g_type_class_peek_parent (klass);
+
quark_rack_info = g_quark_from_static_string ("BstRackChildInfo");
-
++
gobject_class->finalize = bst_rack_table_finalize;
+
object_class->destroy = bst_rack_table_destroy;
-
++
widget_class->style_set = bst_rack_table_style_set;
widget_class->size_request = bst_rack_table_size_request;
widget_class->size_allocate = bst_rack_table_size_allocate;
@@@ -169,7 -197,9 +197,9 @@@ bst_rack_table_realize (GtkWidget *widg
BstRackTable *rtable = BST_RACK_TABLE (widget);
GdkWindowAttr attributes;
gint attributes_mask;
-
++
GTK_WIDGET_CLASS (parent_class)->realize (widget);
-
++
attributes.window_type = GDK_WINDOW_CHILD;
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
@@@ -212,6 -247,7 +247,7 @@@ bst_rack_table_size_request (GtkWidge
GtkTable *table = GTK_TABLE (rtable);
GList *list;
guint i, j;
-
++
for (list = table->children; list; list = list->next)
{
GtkTableChild *child = (GtkTableChild*) list->data;
@@@ -237,10 -276,14 +276,14 @@@ bst_rack_table_size_allocate (GtkWidge
{
BstRackTable *rtable = BST_RACK_TABLE (widget);
GtkTable *table = GTK_TABLE (rtable);
+
GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
+
bst_rtable_update_child_map (rtable);
+
rtable->cell_width = table->cols[0].allocation;
rtable->cell_height = table->rows[0].allocation;
-
++
if (GTK_WIDGET_REALIZED (rtable))
{
gdk_window_move_resize (rtable->iwindow,
@@@ -253,6 -297,7 +297,7 @@@ static voi
bst_rack_table_unrealize (GtkWidget *widget)
{
BstRackTable *rtable = BST_RACK_TABLE (widget);
-
++
gdk_window_set_user_data (rtable->iwindow, NULL);
gdk_window_destroy (rtable->iwindow);
rtable->iwindow = NULL;
@@@ -262,7 -309,9 +309,9 @@@ static voi
bst_rack_table_map (GtkWidget *widget)
{
BstRackTable *rtable = BST_RACK_TABLE (widget);
-
++
GTK_WIDGET_CLASS (parent_class)->map (widget);
-
++
if (rtable->edit_mode)
gdk_window_show (rtable->iwindow);
}
@@@ -270,10 -320,14 +320,14 @@@ static voi
bst_rack_table_unmap (GtkWidget *widget)
{
BstRackTable *rtable = BST_RACK_TABLE (widget);
-
++
rtable_abort_drag (rtable, GDK_CURRENT_TIME);
+
GTK_WIDGET_CLASS (parent_class)->unmap (widget);
-
++
gdk_window_hide (rtable->iwindow);
}
+
static void
widget_reparent (GtkWidget *child,
GtkWidget *parent)
@@@ -295,6 -352,7 +352,7 @@@ bst_rack_table_button_press (GtkWidge
{
bool was_dragging = rtable->in_drag;
uint h, v;
-
++
if (bst_rack_table_iwindow_translate (rtable, event->x, event->y, &h, &v))
rtable->child = bst_rack_table_find_child (rtable, h, v);
rtable->in_drag = rtable->child != NULL;
@@@ -364,6 -425,7 +425,7 @@@ bst_rack_table_motion_notify (GtkWidge
{
BstRackTable *rtable = BST_RACK_TABLE (widget);
GtkTable *table = GTK_TABLE (rtable);
-
++
if (rtable->in_drag)
{
guint h, v;
@@@ -401,8 -467,10 +467,10 @@@
rtable->drag_info.vspan);
}
}
-
++
return TRUE;
}
+
static void
rtable_abort_drag (BstRackTable *rtable,
guint32 etime)
@@@ -521,6 -599,7 +599,7 @@@ bst_rack_table_expose (GtkWidget *
{
BstRackTable *rtable = BST_RACK_TABLE (widget);
GtkTable *table = GTK_TABLE (rtable);
-
++
if (rtable->edit_mode)
{
uint h1 = rtable->drag_info.col, h2 = h1 + rtable->drag_info.hspan;
@@@ -559,9 -640,12 +640,12 @@@
x += bx;
}
}
+
GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
-
++
return FALSE;
}
+
static void
bst_rack_table_add (GtkContainer *container,
GtkWidget *child)
@@@ -677,14 -775,17 +775,17 @@@ bst_rack_table_find_child (BstRackTabl
#endif
}
}
-
++
return NULL;
}
+
static void
bst_rtable_update_child_map (BstRackTable *rtable)
{
GtkTable *table = GTK_TABLE (rtable);
guint32 *bits;
guint i, j, n = 0;
-
++
rtable->map_cols = table->ncols;
rtable->map_rows = table->nrows;
g_free (rtable->child_map);
@@@ -720,7 -824,9 +824,9 @@@ bst_rack_table_check_cell (BstRackTabl
guint row)
{
GtkTable *table;
-
++
g_return_val_if_fail (BST_IS_RACK_TABLE (rtable), FALSE);
+
table = GTK_TABLE (rtable);
if (col >= table->ncols || row >= table->nrows)
return FALSE;
@@@ -737,7 -846,9 +846,9 @@@ bst_rack_table_expand_rect (BstRackTabl
{
GtkTable *table;
guint i, j, f;
-
++
g_return_val_if_fail (BST_IS_RACK_TABLE (rtable), FALSE);
+
table = GTK_TABLE (rtable);
if (col + 1 >= table->ncols || row + 1 >= table->nrows ||
bst_rack_table_check_cell (rtable, col, row))
diff --cc beast-gtk/bstrackview.cc
index d1cc3c2,e3adeb8..0a7c873
--- a/beast-gtk/bstrackview.cc
+++ b/beast-gtk/bstrackview.cc
@@@ -56,10 -65,14 +65,14 @@@ rack_view_class_init (BstRackViewClass
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->finalize = rack_view_finalize;
+
object_class->destroy = rack_view_destroy;
}
+
static void
toggle_edit_mode (GtkToggleButton *tb,
BstRackView *self)
@@@ -94,16 -109,22 +109,22 @@@ static voi
rack_view_destroy (GtkObject *object)
{
BstRackView *self = BST_RACK_VIEW (object);
-
++
bst_rack_view_set_item (self, 0);
-
++
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
+
static void
rack_view_finalize (GObject *object)
{
BstRackView *self = BST_RACK_VIEW (object);
-
++
bst_rack_view_set_item (self, 0);
-
++
G_OBJECT_CLASS (parent_class)->finalize (object);
}
+
GtkWidget*
bst_rack_view_new (SfiProxy item)
{
@@@ -140,8 -164,10 +164,10 @@@ bst_rack_view_set_item (BstRackView *se
g_return_if_fail (BST_IS_RACK_VIEW (self));
if (item)
g_return_if_fail (BSE_IS_ITEM (item));
-
++
if (item == self->item)
return;
-
++
if (self->item)
{
bse_proxy_disconnect (self->item,
@@@ -156,13 -182,16 +182,16 @@@
"swapped_signal::release", rack_view_reset_item, self,
"swapped_signal::parasites-added::/beast-rack-view/", rack_view_parasites_added,
self,
NULL);
-
++
bst_rack_view_rebuild (self);
}
+
void
bst_rack_view_rebuild (BstRackView *self)
{
GtkWidget *toggle;
g_return_if_fail (BST_IS_RACK_VIEW (self));
-
++
gtk_container_foreach (GTK_CONTAINER (self->rack_table), (GtkCallback) gtk_widget_destroy, NULL);
toggle = (GtkWidget*) gxk_radget_find (self, "edit-toggle");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), FALSE);
diff --cc beast-gtk/bstrecords.idl
index 20d4791,18d23a8..cb315a3
--- a/beast-gtk/bstrecords.idl
+++ b/beast-gtk/bstrecords.idl
@@@ -1,7 -1,8 +1,8 @@@
// Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
+
namespace Bst {
/*
-choice Test1 {
+enum Test1 {
FOO1,
FOO2,
};
@@@ -10,80 -11,86 +11,81 @@@ record Test2
};
*/
using namespace Sfi;
-
Const STORAGE = ":r:w:S:";
Const STANDARD = STORAGE "G:";
-
-choice Direction {
- UP = (_("Up"), _("Move upwards")),
- LEFT = (_("Left"), _("Move to the left")),
- RIGHT = (_("Right"), _("Move to the right")),
- DOWN = (_("Down"), _("Move downwards"))
+enum Direction {
+ UP = Enum (_("Up"), _("Move upwards")),
+ LEFT = Enum (_("Left"), _("Move to the left")),
+ RIGHT = Enum (_("Right"), _("Move to the right")),
+ DOWN = Enum (_("Down"), _("Move downwards"))
};
-
-choice FFTSize {
- FFT_SIZE_2 = (_("2 Value FFT Window"), _("A 2 value FFT window corresponds to a spectrum with 2
frequency peaks")),
- FFT_SIZE_4 = (_("4 Value FFT Window"), _("A 4 value FFT window corresponds to a spectrum with 3
frequency peaks")),
- FFT_SIZE_8 = (_("8 Value FFT Window"), _("A 8 value FFT window corresponds to a spectrum with 5
frequency peaks")),
- FFT_SIZE_16 = (_("16 Value FFT Window"), _("A 16 value FFT window corresponds to a spectrum with 9
frequency peaks")),
- FFT_SIZE_32 = (_("32 Value FFT Window"), _("A 32 value FFT window corresponds to a spectrum with 17
frequency peaks")),
- FFT_SIZE_64 = (_("64 Value FFT Window"), _("A 64 value FFT window corresponds to a spectrum with 33
frequency peaks")),
- FFT_SIZE_128 = (_("128 Value FFT Window"), _("A 128 value FFT window corresponds to a spectrum with 65
frequency peaks")),
- FFT_SIZE_256 = (_("256 Value FFT Window"), _("A 256 value FFT window corresponds to a spectrum with 129
frequency peaks")),
- FFT_SIZE_512 = (_("512 Value FFT Window"), _("A 512 value FFT window corresponds to a spectrum with 257
frequency peaks")),
- FFT_SIZE_1024 = (_("1024 Value FFT Window"), _("A 1024 value FFT window corresponds to a spectrum with
513 frequency peaks")),
- FFT_SIZE_2048 = (_("2048 Value FFT Window"), _("A 2048 value FFT window corresponds to a spectrum with
1025 frequency peaks")),
- FFT_SIZE_4096 = (_("4096 Value FFT Window"), _("A 4096 value FFT window corresponds to a spectrum with
2049 frequency peaks")),
- FFT_SIZE_8192 = (_("8192 Value FFT Window"), _("A 8192 value FFT window corresponds to a spectrum with
4097 frequency peaks")),
- FFT_SIZE_16384 = (_("16384 Value FFT Window"), _("A 16384 value FFT window corresponds to a spectrum with
8193 frequency peaks")),
- FFT_SIZE_32768 = (_("32768 Value FFT Window"), _("A 32768 value FFT window corresponds to a spectrum with
16385 frequency peaks")),
- FFT_SIZE_65536 = (_("65536 Value FFT Window"), _("A 65536 value FFT window corresponds to a spectrum with
32769 frequency peaks")),
+enum FFTSize {
+ FFT_SIZE_2 = Enum (_("2 Value FFT Window"), _("A 2 value FFT window corresponds to a spectrum with 2
frequency peaks")),
+ FFT_SIZE_4 = Enum (_("4 Value FFT Window"), _("A 4 value FFT window corresponds to a spectrum with 3
frequency peaks")),
+ FFT_SIZE_8 = Enum (_("8 Value FFT Window"), _("A 8 value FFT window corresponds to a spectrum with 5
frequency peaks")),
+ FFT_SIZE_16 = Enum (_("16 Value FFT Window"), _("A 16 value FFT window corresponds to a spectrum with
9 frequency peaks")),
+ FFT_SIZE_32 = Enum (_("32 Value FFT Window"), _("A 32 value FFT window corresponds to a spectrum with
17 frequency peaks")),
+ FFT_SIZE_64 = Enum (_("64 Value FFT Window"), _("A 64 value FFT window corresponds to a spectrum with
33 frequency peaks")),
+ FFT_SIZE_128 = Enum (_("128 Value FFT Window"), _("A 128 value FFT window corresponds to a spectrum
with 65 frequency peaks")),
+ FFT_SIZE_256 = Enum (_("256 Value FFT Window"), _("A 256 value FFT window corresponds to a spectrum
with 129 frequency peaks")),
+ FFT_SIZE_512 = Enum (_("512 Value FFT Window"), _("A 512 value FFT window corresponds to a spectrum
with 257 frequency peaks")),
+ FFT_SIZE_1024 = Enum (_("1024 Value FFT Window"), _("A 1024 value FFT window corresponds to a spectrum
with 513 frequency peaks")),
+ FFT_SIZE_2048 = Enum (_("2048 Value FFT Window"), _("A 2048 value FFT window corresponds to a spectrum
with 1025 frequency peaks")),
+ FFT_SIZE_4096 = Enum (_("4096 Value FFT Window"), _("A 4096 value FFT window corresponds to a spectrum
with 2049 frequency peaks")),
+ FFT_SIZE_8192 = Enum (_("8192 Value FFT Window"), _("A 8192 value FFT window corresponds to a spectrum
with 4097 frequency peaks")),
+ FFT_SIZE_16384 = Enum (_("16384 Value FFT Window"), _("A 16384 value FFT window corresponds to a spectrum
with 8193 frequency peaks")),
+ FFT_SIZE_32768 = Enum (_("32768 Value FFT Window"), _("A 32768 value FFT window corresponds to a spectrum
with 16385 frequency peaks")),
+ FFT_SIZE_65536 = Enum (_("65536 Value FFT Window"), _("A 65536 value FFT window corresponds to a spectrum
with 32769 frequency peaks")),
};
-
-choice NoteLength {
- NOTE_LENGTH_NONE = (Neutral, _("None"), _("Unspecified length")),
- NOTE_LENGTH_1 = (_("1/1"), _("Whole note")),
- NOTE_LENGTH_2 = (_("1/2"), _("Half note")),
- NOTE_LENGTH_4 = (_("1/4"), _("Quarter note")),
- NOTE_LENGTH_8 = (_("1/8"), _("Eighths note")),
- NOTE_LENGTH_16 = (_("1/16"), _("Sixteenth note")),
- NOTE_LENGTH_32 = (_("1/32"), _("Thirty-secondth note")),
- NOTE_LENGTH_64 = (_("1/64"), _("Sixty-fourth note")),
- NOTE_LENGTH_128 = (_("1/128"), _("Hundred twenty-eighth note")),
- NOTE_LENGTH_1P = (_("1/1."), _("Dotted whole note")),
- NOTE_LENGTH_2P = (_("1/2."), _("Dotted half note")),
- NOTE_LENGTH_4P = (_("1/4."), _("Dotted quarter note")),
- NOTE_LENGTH_8P = (_("1/8."), _("Dotted eighths note")),
- NOTE_LENGTH_16P = (_("1/16."), _("Dotted sixteenth note")),
- NOTE_LENGTH_32P = (_("1/32."), _("Dotted thirty-secondth note")),
- NOTE_LENGTH_64P = (_("1/64."), _("Dotted sixty-fourth note")),
- NOTE_LENGTH_128P = (_("1/128."),_("Dotted hundred twenty-eighth note")),
- NOTE_LENGTH_1T = (_("1/1T"), _("Triplet whole note")),
- NOTE_LENGTH_2T = (_("1/2T"), _("Triplet half note")),
- NOTE_LENGTH_4T = (_("1/4T"), _("Triplet quarter note")),
- NOTE_LENGTH_8T = (_("1/8T"), _("Triplet eighths note")),
- NOTE_LENGTH_16T = (_("1/16T"), _("Triplet sixteenth note")),
- NOTE_LENGTH_32T = (_("1/32T"), _("Triplet thirty-secondth note")),
- NOTE_LENGTH_64T = (_("1/64T"), _("Triplet sixty-fourth note")),
- NOTE_LENGTH_128T = (_("1/128T"),_("Triplet hundred twenty-eighth note")),
+enum NoteLength {
+ NOTE_LENGTH_NONE = Enum (0, _("None"), _("Unspecified length")),
+ NOTE_LENGTH_1 = Enum (_("1/1"), _("Whole note")),
+ NOTE_LENGTH_2 = Enum (_("1/2"), _("Half note")),
+ NOTE_LENGTH_4 = Enum (_("1/4"), _("Quarter note")),
+ NOTE_LENGTH_8 = Enum (_("1/8"), _("Eighths note")),
+ NOTE_LENGTH_16 = Enum (_("1/16"), _("Sixteenth note")),
+ NOTE_LENGTH_32 = Enum (_("1/32"), _("Thirty-secondth note")),
+ NOTE_LENGTH_64 = Enum (_("1/64"), _("Sixty-fourth note")),
+ NOTE_LENGTH_128 = Enum (_("1/128"), _("Hundred twenty-eighth note")),
+ NOTE_LENGTH_1P = Enum (_("1/1."), _("Dotted whole note")),
+ NOTE_LENGTH_2P = Enum (_("1/2."), _("Dotted half note")),
+ NOTE_LENGTH_4P = Enum (_("1/4."), _("Dotted quarter note")),
+ NOTE_LENGTH_8P = Enum (_("1/8."), _("Dotted eighths note")),
+ NOTE_LENGTH_16P = Enum (_("1/16."), _("Dotted sixteenth note")),
+ NOTE_LENGTH_32P = Enum (_("1/32."), _("Dotted thirty-secondth note")),
+ NOTE_LENGTH_64P = Enum (_("1/64."), _("Dotted sixty-fourth note")),
+ NOTE_LENGTH_128P = Enum (_("1/128."),_("Dotted hundred twenty-eighth note")),
+ NOTE_LENGTH_1T = Enum (_("1/1T"), _("Triplet whole note")),
+ NOTE_LENGTH_2T = Enum (_("1/2T"), _("Triplet half note")),
+ NOTE_LENGTH_4T = Enum (_("1/4T"), _("Triplet quarter note")),
+ NOTE_LENGTH_8T = Enum (_("1/8T"), _("Triplet eighths note")),
+ NOTE_LENGTH_16T = Enum (_("1/16T"), _("Triplet sixteenth note")),
+ NOTE_LENGTH_32T = Enum (_("1/32T"), _("Triplet thirty-secondth note")),
+ NOTE_LENGTH_64T = Enum (_("1/64T"), _("Triplet sixty-fourth note")),
+ NOTE_LENGTH_128T = Enum (_("1/128T"),_("Triplet hundred twenty-eighth note")),
};
-
-choice RowShading {
- ROW_SHADING_NONE = (Neutral, _("None")),
- ROW_SHADING_2 = (_("2"), _("Every second row")),
- ROW_SHADING_4 = (_("4"), _("Every fourth row")),
- ROW_SHADING_8 = (_("8"), _("Every eighth row")),
- ROW_SHADING_16 = (_("16"), _("Every sixteenth row")),
- ROW_SHADING_2_4 = (_("2 & 4"), _("Every second and fourth row")),
- ROW_SHADING_4_8 = (_("4 & 8"), _("Every fourth and eighth row")),
- ROW_SHADING_4_12 = (_("4 & 12"), _("Every fourth and twelfth row")),
- ROW_SHADING_4_16 = (_("4 & 16"), _("Every fourth and sixteenth row")),
- ROW_SHADING_8_16 = (_("8 & 16"), _("Every eighth and sixteenth row")),
- ROW_SHADING_3 = (_("3"), _("Every third row")),
- ROW_SHADING_6 = (_("6"), _("Every sixth row")),
- ROW_SHADING_12 = (_("12"), _("Every twelfth row")),
- ROW_SHADING_3_6 = (_("3 & 6"), _("Every third and sixth row")),
- ROW_SHADING_3_12 = (_("3 & 12"), _("Every third and twelfth row")),
- ROW_SHADING_6_12 = (_("6 & 12"), _("Every sixth and twelfth row")),
+enum RowShading {
+ ROW_SHADING_NONE = Enum (0, _("None")),
+ ROW_SHADING_2 = Enum (_("2"), _("Every second row")),
+ ROW_SHADING_4 = Enum (_("4"), _("Every fourth row")),
+ ROW_SHADING_8 = Enum (_("8"), _("Every eighth row")),
+ ROW_SHADING_16 = Enum (_("16"), _("Every sixteenth row")),
+ ROW_SHADING_2_4 = Enum (_("2 & 4"), _("Every second and fourth row")),
+ ROW_SHADING_4_8 = Enum (_("4 & 8"), _("Every fourth and eighth row")),
+ ROW_SHADING_4_12 = Enum (_("4 & 12"), _("Every fourth and twelfth row")),
+ ROW_SHADING_4_16 = Enum (_("4 & 16"), _("Every fourth and sixteenth row")),
+ ROW_SHADING_8_16 = Enum (_("8 & 16"), _("Every eighth and sixteenth row")),
+ ROW_SHADING_3 = Enum (_("3"), _("Every third row")),
+ ROW_SHADING_6 = Enum (_("6"), _("Every sixth row")),
+ ROW_SHADING_12 = Enum (_("12"), _("Every twelfth row")),
+ ROW_SHADING_3_6 = Enum (_("3 & 6"), _("Every third and sixth row")),
+ ROW_SHADING_3_12 = Enum (_("3 & 12"), _("Every third and twelfth row")),
+ ROW_SHADING_6_12 = Enum (_("6 & 12"), _("Every sixth and twelfth row")),
};
+
/* BEAST Global Config */
record GConfig {
- String rc_version = (NULL, _("Release counter"), NULL, STORAGE);
+ String rc_version = ("", _("Release counter"), "", STORAGE);
group "Synthesis Networks" {
Int snet_font_size = (_("Font Size"), _("Font size in pixels for labels displayed in
synthesis networks"),
10, 1, 48, 2, STANDARD);
@@@ -107,40 -114,42 +109,42 @@@
FALSE, STANDARD);
};
};
+
/* skin config */
record SkinConfig {
- String skin_name = (_("Skin Name"), _("Name for the current skin configuration (used for skin
selections)."), NULL, STANDARD);
+ String skin_name = (_("Skin Name"), _("Name for the current skin configuration (used for skin
selections)."), "", STANDARD);
group "Pattern Editor" {
- String pattern_image = (_("Background Image"), _("Background image used by the pattern editor."),
NULL, STANDARD ":filename:image");
+ String pattern_image = (_("Background Image"), _("Background image used by the pattern editor."),
"", STANDARD ":filename:image");
Real pattern_shade = (_("Image shade"), _("Percentage of background image pixel to blend over
background color."), 2.5, 0, 100, 5, STANDARD ":scale");
- Int pattern_color = (_("Background Color"), NULL, 0xf5f3ed, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
- Int pattern_scolor1 = (_("Background Shade 1"), NULL, 0xd3d1cb, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
- Int pattern_scolor2 = (_("Background Shade 2"), NULL, 0xe0ded8, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
- Int pattern_text0 = (_("Empty Field Color"), NULL, 0x303030, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
- Int pattern_text1 = (_("Text Color"), NULL, 0x000000, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
- Int pattern_vbar1 = (_("Vertical Bar Color"), NULL, 0x7f7f7f, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
+ Int pattern_color = (_("Background Color"), "", 0xf5f3ed, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
+ Int pattern_scolor1 = (_("Background Shade 1"), "", 0xd3d1cb, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
+ Int pattern_scolor2 = (_("Background Shade 2"), "", 0xe0ded8, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
+ Int pattern_text0 = (_("Empty Field Color"), "", 0x303030, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
+ Int pattern_text1 = (_("Text Color"), "", 0x000000, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
+ Int pattern_vbar1 = (_("Vertical Bar Color"), "", 0x7f7f7f, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
};
group "Piano Roll" {
- String piano_image = (_("Background Image"), _("Background image used by the piano-roll
editor."), NULL, STANDARD ":filename:image");
+ String piano_image = (_("Background Image"), _("Background image used by the piano-roll
editor."), "", STANDARD ":filename:image");
Real piano_shade = (_("Image shade"), _("Percentage of background image pixel to blend over
background color."), 2.5, 0, 100, 5, STANDARD ":scale");
- Int piano_color = (_("Background Color"), NULL, 0xf5f3ed, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
- Int piano_hbar = (_("Horizontal Bar Color"), NULL, 0x7f7f7f, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
- Int piano_vbar = (_("Vertical Bar Color"), NULL, 0x7f7f7f, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
- Int piano_hgrid = (_("Horizontal Grid Color"), NULL, 0xbfbfbf, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
- Int piano_vgrid = (_("Vertical Grid Color"), NULL, 0xbfbfbf, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
- Int piano_mbar = (_("Middle Bar Color"), NULL, 0xa0a0a0, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
+ Int piano_color = (_("Background Color"), "", 0xf5f3ed, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
+ Int piano_hbar = (_("Horizontal Bar Color"), "", 0x7f7f7f, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
+ Int piano_vbar = (_("Vertical Bar Color"), "", 0x7f7f7f, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
+ Int piano_hgrid = (_("Horizontal Grid Color"), "", 0xbfbfbf, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
+ Int piano_vgrid = (_("Vertical Grid Color"), "", 0xbfbfbf, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
+ Int piano_mbar = (_("Middle Bar Color"), "", 0xa0a0a0, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
};
group "Control Events" {
- String controls_image = (_("Background Image"), _("Background image used by the control events
editor."), NULL, STANDARD ":filename:image");
+ String controls_image = (_("Background Image"), _("Background image used by the control events
editor."), "", STANDARD ":filename:image");
Real controls_shade = (_("Image shade"), _("Percentage of background image pixel to blend over
background color."), 2.5, 0, 100, 5, STANDARD ":scale");
- Int controls_color = (_("Background Color"), NULL, 0xf5f3ed, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
- Int controls_hbar = (_("Horizontal Bar Color"), NULL, 0x7f7f7f, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
- Int controls_mbar = (_("Middle Bar Color"), NULL, 0xa0a0a0, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
- Int controls_positive = (_("Positive Value Color"), NULL, 0x0000ff, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
- Int controls_zero = (_("Zero Value Color"), NULL, 0xff0000, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
- Int controls_negative = (_("Negative Value Color"), NULL, 0x0000ff, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
+ Int controls_color = (_("Background Color"), "", 0xf5f3ed, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
+ Int controls_hbar = (_("Horizontal Bar Color"), "", 0x7f7f7f, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
+ Int controls_mbar = (_("Middle Bar Color"), "", 0xa0a0a0, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
+ Int controls_positive = (_("Positive Value Color"), "", 0x0000ff, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
+ Int controls_zero = (_("Zero Value Color"), "", 0xff0000, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
+ Int controls_negative = (_("Negative Value Color"), "", 0x0000ff, 0, 0xffffff, 0x010101, STANDARD
":rgb:hex");
};
};
+
/* message filter */
record MsgAbsorbString {
String version;
@@@ -150,11 -159,12 +154,12 @@@
sequence MsgAbsorbStringSeq {
MsgAbsorbString strings;
};
+
/* pattern editor key bindings */
record KeyBindingItem {
- String key_name = (NULL, NULL, NULL, STANDARD);
- String func_name = (NULL, NULL, NULL, STANDARD);
- Real func_param = (NULL, NULL, 0, -1e37, 1e30, 100, STANDARD ":scale");
+ String key_name = ("", "", "", STANDARD);
+ String func_name = ("", "", "", STANDARD);
+ Real func_param = ("", "", 0, -1e37, 1e30, 100, STANDARD ":scale");
};
sequence KeyBindingItemSeq {
KeyBindingItem items;
diff --cc beast-gtk/bstrtest.cc
index ddbd313,f4965a8..732cc25
--- a/beast-gtk/bstrtest.cc
+++ b/beast-gtk/bstrtest.cc
@@@ -176,7 -198,9 +198,9 @@@ main (int argc
{
GtkWidget *window, *vbox, *hbox, *rtable, *dial, *button, *scale, *frame;
gpointer adjustment;
-
++
gtk_init (&argc, &argv);
+
window = g_object_new (GTK_TYPE_WINDOW, NULL);
g_object_connect (window,
"signal::destroy", gtk_main_quit, NULL,
@@@ -195,6 -219,7 +219,7 @@@
"border_width", 10,
NULL);
gtk_table_resize (GTK_TABLE (rtable), 40, 60);
-
++
frame = g_object_new (GTK_TYPE_FRAME,
"visible", TRUE,
"child", g_object_new (GTK_TYPE_LABEL,
@@@ -220,6 -246,7 +246,7 @@@
"label", "v37____u",
"parent", rtable,
NULL);
-
++
button = g_object_connect (g_object_new (GTK_TYPE_BUTTON,
"label", "Edit",
"parent", hbox,
@@@ -238,6 -267,7 +267,7 @@@
NULL),
NULL);
bst_dial_set_adjustment (BST_DIAL (dial), adjustment);
-
++
frame = g_object_new (GTK_TYPE_FRAME,
"visible", TRUE,
"shadow_type", GTK_SHADOW_ETCHED_OUT,
@@@ -261,5 -293,6 +293,6 @@@
add_plates (rtable);
gtk_widget_show (window);
gtk_main ();
-
++
return 0;
}
diff --cc beast-gtk/bstsampleeditor.cc
index 31dd185,7f5230f..e73fcf3
--- a/beast-gtk/bstsampleeditor.cc
+++ b/beast-gtk/bstsampleeditor.cc
@@@ -29,6 -38,7 +38,7 @@@ GtkTyp
bst_sample_editor_get_type (void)
{
static GtkType sample_editor_type = 0;
-
++
if (!sample_editor_type)
{
GtkTypeInfo sample_editor_info =
@@@ -42,17 -52,22 +52,22 @@@
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
-
++
sample_editor_type = gtk_type_unique (GTK_TYPE_VBOX, &sample_editor_info);
}
-
++
return sample_editor_type;
}
+
static void
bst_sample_editor_class_init (BstSampleEditorClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
// GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
++
parent_class = g_type_class_peek_parent (klass);
+
gobject_class->set_property = bst_sample_editor_set_property;
gobject_class->get_property = bst_sample_editor_get_property;
gobject_class->finalize = bst_sample_editor_finalize;
@@@ -143,11 -174,15 +174,15 @@@ GtkWidget
bst_sample_editor_new (SfiProxy sample)
{
GtkWidget *widget;
-
++
widget = gtk_widget_new (BST_TYPE_SAMPLE_EDITOR, "sample", sample, NULL);
-
++
return widget;
}
+
#define QSAMPLER_SELECTION_TIMEOUT (33)
static gulong qsampler_selection_timeout_id = 0;
+
static void
qsampler_set_selection (BstQSampler *qsampler,
gint m1,
@@@ -312,9 -371,11 +371,11 @@@ adjustments_changed (BstSampleEditor *e
GtkAdjustment *adjustment)
{
guint i;
-
++
for (i = 0; i < editor->n_channels; i++)
{
BstQSampler *qsampler = editor->qsampler[i];
-
++
if (adjustment == editor->zoom_adjustment)
bst_qsampler_set_zoom (qsampler, adjustment->value);
else if (adjustment == editor->vscale_adjustment)
@@@ -327,12 -389,15 +389,15 @@@ bst_sample_editor_rebuild (BstSampleEdi
GtkWidget *qsampler_parent, *sbar, *entry, *mask_parent, *any;
gpointer gmask;
guint i;
-
++
g_return_if_fail (BST_IS_SAMPLE_EDITOR (editor));
-
++
gtk_container_foreach (GTK_CONTAINER (editor), (GtkCallback) gtk_widget_destroy, NULL);
g_free (editor->qsampler);
editor->qsampler = NULL;
if (!editor->esample)
return;
-
++
qsampler_parent = gtk_widget_new (GTK_TYPE_VBOX,
"visible", TRUE,
"spacing", 1,
@@@ -340,6 -405,8 +405,8 @@@
"border_width", 0,
NULL);
editor->qsampler = g_renew (BstQSampler*, editor->qsampler, editor->n_channels);
-
-
++
++
/* setup qsampler widgets
*/
sbar = gtk_widget_new (GTK_TYPE_HSCROLLBAR,
@@@ -375,6 -442,8 +442,8 @@@
bst_qsampler_set_source_from_esample (qsampler, editor->esample, i);
}
gtk_box_pack_start (GTK_BOX (qsampler_parent), sbar, FALSE, TRUE, 0);
-
-
++
++
/* setup qsampler zoom and vscale
*/
mask_parent = bst_gmask_container_create (5, TRUE);
diff --cc beast-gtk/bstsampleeditor.hh
index d65e338,d37a446..06ebf3f
--- a/beast-gtk/bstsampleeditor.hh
+++ b/beast-gtk/bstsampleeditor.hh
@@@ -26,8 -34,10 +34,10 @@@ struct _BstSampleEdito
GtkAdjustment *vscale_adjustment;
GtkEntry *sstart;
GtkEntry *send;
-
++
BstQSampler **qsampler;
GtkWidget *popup;
+
BstPlayBackHandle *play_back;
};
struct _BstSampleEditorClass
diff --cc beast-gtk/bstscrollgraph.cc
index 0af51c1,b00f7f8..f9fff7f
--- a/beast-gtk/bstscrollgraph.cc
+++ b/beast-gtk/bstscrollgraph.cc
@@@ -493,7 -538,9 +538,9 @@@ bst_scrollgraph_class_init (BstScrollgr
gobject_class->set_property = bst_scrollgraph_set_property;
gobject_class->get_property = bst_scrollgraph_get_property;
gobject_class->finalize = bst_scrollgraph_finalize;
+
object_class->destroy = bst_scrollgraph_destroy;
-
++
widget_class->size_request = bst_scrollgraph_size_request;
widget_class->size_allocate = bst_scrollgraph_size_allocate;
widget_class->realize = bst_scrollgraph_realize;
diff --cc beast-gtk/bstsequence.cc
index e3f4739,6a5b8b1..475b905
--- a/beast-gtk/bstsequence.cc
+++ b/beast-gtk/bstsequence.cc
@@@ -23,7 -31,9 +31,9 @@@ bst_sequence_class_init (BstSequenceCla
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
-
++
gobject_class->finalize = bst_sequence_finalize;
+
seq_changed_signal = gtk_signal_new ("seq-changed",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
@@@ -147,6 -177,7 +177,7 @@@ darea_expose_event (BstSequence *seq
for (j = 0; j < seq->n_rows; j++)
{
gboolean ncheck = sdata->notes->notes[i] == (seq->n_rows - 1 - j) + sdata->offset;
-
++
if (ncheck)
gdk_draw_rectangle (drawable, hl_gc, TRUE,
i * nwidth + 0.5, j * row_height + 0.5,
@@@ -155,8 -186,10 +186,10 @@@
i * nwidth + 0.5, j * row_height + 0.5,
nwidth, row_height);
}
-
++
return TRUE;
}
+
static gint
darea_button_event (BstSequence *seq,
GdkEventButton *event)
@@@ -171,11 -205,13 +205,13 @@@
gint width, height, maxx, maxy;
gfloat nwidth, row_height;
gint dx, dy;
-
++
gdk_window_get_size (widget->window, &width, &height);
maxx = width - 1;
maxy = height - 1;
row_height = maxy / (gfloat) seq->n_rows;
nwidth = maxx / (gfloat) sdata->notes->n_notes;
-
++
dx = event->x / nwidth;
dy = event->y / row_height;
dy = seq->n_rows - 1 - CLAMP (dy, 0, seq->n_rows - 1);
@@@ -199,8 -236,10 +236,10 @@@
g_signal_emit (seq, seq_changed_signal, 0);
gtk_widget_queue_draw (widget);
}
-
++
return TRUE;
}
+
static gint
darea_motion_event (BstSequence *seq,
GdkEventMotion *event)
@@@ -233,5 -275,6 +275,6 @@@
g_signal_emit (seq, seq_changed_signal, 0);
gtk_widget_queue_draw (widget);
}
-
++
return TRUE;
}
diff --cc beast-gtk/bstservermonitor.cc
index d6b8699,c66cd4e..1d391ca
--- a/beast-gtk/bstservermonitor.cc
+++ b/beast-gtk/bstservermonitor.cc
@@@ -11,6 -17,7 +17,7 @@@ GtkTyp
bst_server_monitor_get_type (void)
{
static GtkType server_monitor_type = 0;
-
++
if (!server_monitor_type)
{
GtkTypeInfo server_monitor_info =
@@@ -24,10 -31,13 +31,13 @@@
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
-
++
server_monitor_type = gtk_type_unique (GTK_TYPE_VBOX, &server_monitor_info);
}
-
++
return server_monitor_type;
}
+
static void
bst_server_monitor_class_init (BstServerMonitorClass *klass)
{
@@@ -49,16 -63,21 +63,21 @@@ static voi
bst_server_monitor_finalize (GObject *object)
{
/* BstServerMonitor *smon = BST_SERVER_MONITOR (object); */
-
++
G_OBJECT_CLASS (parent_class)->finalize (object);
}
+
void
bst_server_monitor_rebuild (BstServerMonitor *smon)
{
g_return_if_fail (BST_IS_SERVER_MONITOR (smon));
-
++
bst_server_monitor_update (smon);
}
+
void
bst_server_monitor_update (BstServerMonitor *smon)
{
g_return_if_fail (BST_IS_SERVER_MONITOR (smon));
-
++
}
diff --cc beast-gtk/bstservermonitor.hh
index 538cf10,d54c54d..c5b9811
--- a/beast-gtk/bstservermonitor.hh
+++ b/beast-gtk/bstservermonitor.hh
@@@ -18,7 -25,9 +25,9 @@@ typedef struct _BstServerMonitorClass B
struct _BstServerMonitor
{
GtkVBox parent_object;
-
++
SfiProxy server;
-
++
GtkWidget *param_view;
};
struct _BstServerMonitorClass
diff --cc beast-gtk/bstskinconfig.cc
index 1766929,7305a19..75a7d5c
--- a/beast-gtk/bstskinconfig.cc
+++ b/beast-gtk/bstskinconfig.cc
@@@ -113,7 -126,9 +126,9 @@@ bst_skin_config_apply (SfiRec *rec
{
SfiRec *vrec;
BstSkinConfig *skin_config;
-
++
g_return_if_fail (rec != NULL);
+
vrec = sfi_rec_copy_deep (rec);
sfi_rec_validate (vrec, sfi_pspec_get_rec_fields (pspec_skin_config));
if (skin_file)
diff --cc beast-gtk/bstskinconfig.hh
index a1cb649,37c424f..244e1c4
--- a/beast-gtk/bstskinconfig.hh
+++ b/beast-gtk/bstskinconfig.hh
@@@ -22,5 -28,8 +28,8 @@@ const gchar* bst_skin_config_rcfil
const gchar* bst_skin_config_dirname (void);
BseErrorType bst_skin_dump (const gchar *file_name);
BseErrorType bst_skin_parse (const gchar *file_name);
-
-
++
++
G_END_DECLS
+
#endif /* __BST_SKIN_CONFIG_H__ */
diff --cc beast-gtk/bstsnetrouter.cc
index be816b7,6d2e2db..1a94a11
--- a/beast-gtk/bstsnetrouter.cc
+++ b/beast-gtk/bstsnetrouter.cc
@@@ -92,23 -109,31 +109,31 @@@ static voi
bst_snet_router_destroy (GtkObject *object)
{
BstSNetRouter *self = BST_SNET_ROUTER (object);
-
++
bst_snet_router_reset_tool (self);
bst_snet_router_destroy_contents (self);
bst_snet_router_set_snet (self, 0);
+
gxk_action_group_dispose (self->canvas_tool);
gxk_action_group_dispose (self->channel_toggle);
+
if (self->palette)
gtk_widget_destroy (self->palette);
-
++
GTK_OBJECT_CLASS (bst_snet_router_parent_class)->destroy (object);
}
+
static void
bst_snet_router_finalize (GObject *object)
{
BstSNetRouter *self = BST_SNET_ROUTER (object);
-
++
g_object_unref (self->canvas_tool);
g_object_unref (self->channel_toggle);
+
G_OBJECT_CLASS (bst_snet_router_parent_class)->finalize (object);
}
+
static void
bst_snet_router_update_links (BstSNetRouter *self,
BstCanvasSource *csource)
@@@ -216,13 -248,17 +248,17 @@@ GtkWidget
bst_snet_router_new (SfiProxy snet)
{
GtkWidget *router;
-
++
g_return_val_if_fail (BSE_IS_SNET (snet), NULL);
-
++
router = gtk_widget_new (BST_TYPE_SNET_ROUTER,
"aa", BST_SNET_ANTI_ALIASED,
NULL);
bst_snet_router_set_snet (BST_SNET_ROUTER (router), snet);
-
++
return router;
}
+
static void
bst_snet_router_item_added (BstSNetRouter *self,
SfiProxy item,
@@@ -230,8 -266,10 +266,10 @@@
{
GnomeCanvas *canvas = GNOME_CANVAS (self);
GnomeCanvasItem *csource;
+
if (!BSE_IS_SOURCE (item))
return;
-
++
csource = bst_canvas_source_new (GNOME_CANVAS_GROUP (canvas->root), item);
bst_canvas_source_set_channel_hints (BST_CANVAS_SOURCE (csource), CHANNEL_HINTS (self));
g_object_connect (csource,
@@@ -248,6 -287,7 +287,7 @@@ bst_snet_router_set_snet (BstSNetRoute
g_return_if_fail (BST_IS_SNET_ROUTER (self));
if (snet)
g_return_if_fail (BSE_IS_SNET (snet));
-
++
if (self->snet)
{
bst_snet_router_destroy_contents (self);
@@@ -264,6 -304,7 +304,7 @@@
bse_proxy_connect (self->snet,
"swapped_signal::item_added", bst_snet_router_item_added, self,
NULL);
-
++
bst_snet_router_update (self);
bst_snet_router_adjust_region (self);
#if 0
@@@ -297,10 -341,14 +341,14 @@@ bst_snet_router_update (BstSNetRouter *
BseItemSeq *iseq;
GSList *slist, *csources = NULL;
guint i;
-
++
g_return_if_fail (BST_IS_SNET_ROUTER (self));
-
++
canvas = GNOME_CANVAS (self);
+
/* destroy all canvas sources */
bst_snet_router_destroy_contents (self);
-
++
if (0)
{
/* add canvas source for the snet itself */
@@@ -311,11 -359,13 +359,13 @@@
NULL);
csources = g_slist_prepend (csources, csource);
}
-
++
/* walk all child sources */
iseq = bse_container_list_children (self->snet);
for (i = 0; i < iseq->n_items; i++)
{
SfiProxy item = iseq->items[i];
-
++
if (BSE_IS_SOURCE (item))
{
GnomeCanvasItem *csource = bst_canvas_source_new (GNOME_CANVAS_GROUP (canvas->root), item);
@@@ -326,10 -376,12 +376,12 @@@
csources = g_slist_prepend (csources, csource);
}
}
-
++
/* update all links */
for (slist = csources; slist; slist = slist->next)
bst_canvas_source_update_links (BST_CANVAS_SOURCE (slist->data));
g_slist_free (csources);
-
++
/* queue update cause ellipse-rect is broken */
gnome_canvas_FIXME_hard_update (canvas);
}
@@@ -357,6 -417,7 +417,7 @@@ bst_snet_router_adjust_zoom (BstSNetRou
bse_parasite_set_floats (router->snet, "BstRouterZoom", 1, &zoom);
#endif
}
-
++
if (!d)
{
d = g_new (gdouble, 1);
@@@ -376,11 -438,15 +438,15 @@@ bst_snet_router_adjust_region (BstSNetR
GtkLayout *layout;
GnomeCanvas *canvas;
gdouble x1, y1, x2, y2;
-
++
g_return_if_fail (BST_IS_SNET_ROUTER (router));
-
++
canvas = GNOME_CANVAS (router);
layout = GTK_LAYOUT (router);
+
/* sigh, queue a hard update to get pending bounds recalculated */
gnome_canvas_FIXME_hard_update (canvas);
+
/* recompute everything, now. then we can use the new root bounds
* to adjust the scrolling region
*/
@@@ -434,6 -508,7 +508,7 @@@ update_tmp_line (BstSNetRouter *self
else
{
GnomeCanvasPoints *gpoints = NULL;
-
++
gtk_object_get (GTK_OBJECT (self->tmp_line), "points", &gpoints, NULL);
if (gpoints)
{
@@@ -457,19 -533,25 +533,25 @@@ static voi
bst_router_tool_changed (BstSNetRouter *self)
{
GnomeCanvas *canvas = GNOME_CANVAS (self);
-
++
update_tmp_line (self);
-
++
if (GTK_WIDGET_REALIZED (canvas))
{
GdkCursor *cursor;
-
++
if (ROUTER_TOOL (self) == ROUTER_TOOL_CREATE_LINK)
cursor = gdk_cursor_new (GDK_TCROSS);
else if (ROUTER_TOOL (self))
cursor = gdk_cursor_new (GDK_UL_ANGLE);
else
cursor = NULL;
-
++
gdk_window_set_cursor (GTK_WIDGET (canvas)->window, cursor);
-
++
if (cursor)
gdk_cursor_destroy (cursor);
-
++
gxk_status_clear ();
}
}
@@@ -479,12 -562,14 +562,14 @@@ bst_snet_router_root_event (BstSNetRout
{
GnomeCanvas *canvas = GNOME_CANVAS (self);
gboolean handled = FALSE;
-
++
if (event->type == GDK_BUTTON_PRESS || event->type == GDK_BUTTON_RELEASE)
{
BstCanvasSource *csource = bst_canvas_source_at (canvas, event->button.x, event->button.y);
BstCanvasLink *clink = bst_canvas_link_at (canvas, event->button.x, event->button.y);
guint ochannel = ~0, ichannel = ~0;
gboolean at_channel;
-
++
if (!csource && clink)
csource = bst_canvas_link_csource_at (clink, event->button.x, event->button.y);
if (csource)
@@@ -505,6 -592,7 +590,7 @@@
else if (csource && at_channel) /* i/o link */
{
GnomeCanvasPoints *gpoints = gnome_canvas_points_new (2);
-
++
self->drag_channel = self->drag_is_input ? ichannel : ochannel;
self->drag_csource = csource;
(self->drag_is_input ?
@@@ -641,6 -730,7 +727,7 @@@
{
GtkWidget *choice;
guint i;
-
++
choice = bst_choice_menu_createv ("<BEAST-SNetRouter>/LinkPopup",
BST_CHOICE_TITLE (_("Module link")),
BST_CHOICE_SEPERATOR,
@@@ -677,6 -768,7 +765,7 @@@ bst_snet_router_event (GtkWidget *widge
BstSNetRouter *self = BST_SNET_ROUTER (widget);
GnomeCanvas *canvas = GNOME_CANVAS (self);
gboolean handled = FALSE;
-
++
switch (event->type)
{
case GDK_BUTTON_PRESS:
@@@ -686,10 -778,12 +775,12 @@@
{
BseErrorType error;
BseCategory *cat = bse_category_from_id (ROUTER_TOOL (self));
-
++
handled = TRUE;
gnome_canvas_window_to_world (canvas,
event->button.x, event->button.y,
&self->world_x, &self->world_y);
-
++
error = bse_snet_can_create_source (self->snet, cat->type);
if (!error)
{
@@@ -900,6 -1010,7 +1001,7 @@@ bst_snet_router_init (BstSNetRoute
GxkActionList *al1, *al2, *canvas_modules, *toolbar_modules, *palette_modules;
BseCategorySeq *cseq;
guint i, n;
-
++
self->palette = NULL;
self->adjustment = NULL;
self->snet = 0;
@@@ -920,6 -1032,7 +1023,7 @@@
g_object_connect (canvas->root,
"swapped_signal::event", bst_snet_router_root_event, self,
NULL);
-
++
self->adjustment = (GtkAdjustment*) gtk_adjustment_new (1.0, 0.20, 5.00, 0.05, 0.50, 0 /* 0.50 - spin
buttons needs 0 */);
g_object_connect (self->adjustment,
"swapped_signal::value_changed", bst_snet_router_adjust_zoom, self,
@@@ -941,6 -1056,7 +1047,7 @@@
gxk_widget_publish_actions (self, "router-toolbar-actions",
G_N_ELEMENTS (router_toolbar_actions), router_toolbar_actions,
NULL, NULL, snet_router_action_exec);
-
++
/* construct module type action lists */
canvas_modules = gxk_action_list_create_grouped (self->canvas_tool);
palette_modules = gxk_action_list_create_grouped (self->canvas_tool);
@@@ -983,14 -1099,13 +1090,15 @@@
if (strncmp (cat->type, "BseLadspaModule_", 16) == 0)
stock_fallback = BST_STOCK_LADSPA;
const gchar *stock_id;
-
++
if (cat->icon)
{
- bst_stock_register_icon (cat->category, cat->icon->bytes_per_pixel,
- cat->icon->width, cat->icon->height,
- cat->icon->width * cat->icon->bytes_per_pixel,
- cat->icon->pixels->bytes);
+ BseIcon *icon = cat->icon;
+ g_assert (icon->width * icon->height == int (icon->pixel_seq->n_pixels));
+ bst_stock_register_icon (cat->category, 4,
+ icon->width, icon->height,
+ icon->width * 4,
+ (guchar*) icon->pixel_seq->pixels);
stock_id = cat->category;
}
else
@@@ -1024,11 -1141,15 +1134,15 @@@ bst_snet_router_class_init (BstSNetRout
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
bst_snet_router_class = klass;
-
++
gobject_class->finalize = bst_snet_router_finalize;
object_class->destroy = bst_snet_router_destroy;
-
++
widget_class->event = bst_snet_router_event;
widget_class->button_press_event = bst_snet_router_button_press;
+
klass->popup_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<BstSnetRouter>", NULL);
gtk_accel_group_lock (klass->popup_factory->accel_group);
}
diff --cc beast-gtk/bstsnifferscope.cc
index 87b90ae,7f008d9..8cb7dac
--- a/beast-gtk/bstsnifferscope.cc
+++ b/beast-gtk/bstsnifferscope.cc
@@@ -152,8 -173,10 +173,10 @@@ bst_sniffer_scope_expose (GtkWidge
gdk_draw_hline (window, light_gc, allocation->x, allocation->y, allocation->width);
if (bgcol >= 0) /* paint above hline outline */
gdk_draw_vline (window, widget->style->bg_gc[GTK_STATE_NORMAL], bgcol, allocation->y,
allocation->height);
-
++
return FALSE;
}
+
static void
sniffer_scope_shift (BstSnifferScope *self)
{
diff --cc beast-gtk/bstsplash.cc
index 1223f98,426e987..cd897d1
--- a/beast-gtk/bstsplash.cc
+++ b/beast-gtk/bstsplash.cc
@@@ -23,6 -29,7 +29,7 @@@ GtkTyp
bst_splash_get_type (void)
{
static GtkType splash_type = 0;
-
++
if (!splash_type)
{
GtkTypeInfo splash_info =
@@@ -36,17 -43,23 +43,23 @@@
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
-
++
splash_type = gtk_type_unique (GTK_TYPE_WINDOW, &splash_info);
}
-
++
return splash_type;
}
+
static void
bst_splash_class_init (BstSplashClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->finalize = bst_splash_finalize;
-
++
widget_class->delete_event = bst_splash_delete_event;
widget_class->key_press_event = bst_splash_key_press_event;
widget_class->button_press_event = bst_splash_button_press;
@@@ -71,6 -87,7 +87,7 @@@ bst_splash_init (BstSplash *self
"parent", window,
NULL);
gxk_nullify_in_object (self, &self->vbox);
-
++
/* splash vbox */
self->splash_box = (GtkWidget*) g_object_new (GTK_TYPE_VBOX,
"visible", TRUE,
@@@ -116,8 -137,10 +137,10 @@@ static voi
bst_splash_finalize (GObject *object)
{
// BstSplash *splash = BST_SPLASH (object);
-
++
G_OBJECT_CLASS (parent_class)->finalize (object);
}
+
static gboolean
bst_splash_delete_event (GtkWidget *widget,
GdkEventAny *event)
@@@ -188,6 -223,7 +223,7 @@@ bst_splash_new (const gchar *role
guint max_items)
{
GtkWidget *splash = (GtkWidget*) g_object_new (BST_TYPE_SPLASH, NULL);
-
++
/* set title and role */
gtk_window_set_role (GTK_WINDOW (splash), role);
gtk_window_set_title (GTK_WINDOW (splash), role);
@@@ -236,7 -278,9 +278,9 @@@ bst_splash_update_entity (GtkWidget *
BstSplash *self;
va_list args;
gchar *text;
-
++
g_return_if_fail (BST_IS_SPLASH (widget));
-
++
self = BST_SPLASH (widget);
va_start (args, format);
text = g_strdup_vprintf (format, args);
@@@ -253,7 -299,9 +299,9 @@@ bst_splash_update_item (GtkWidget *wi
BstSplash *self;
va_list args;
gchar *text;
-
++
g_return_if_fail (BST_IS_SPLASH (widget));
-
++
self = BST_SPLASH (widget);
va_start (args, format);
text = g_strdup_vprintf (format, args);
@@@ -286,10 -338,13 +338,13 @@@ bst_splash_set_text (GtkWidget *widge
BstSplash *self;
va_list args;
gchar *text;
-
++
g_return_if_fail (BST_IS_SPLASH (widget));
-
++
va_start (args, format);
text = g_strdup_vprintf (format, args);
va_end (args);
-
++
self = BST_SPLASH (widget);
gtk_container_foreach (GTK_CONTAINER (self->splash_box), (GtkCallback) gtk_widget_destroy, NULL);
if (text)
diff --cc beast-gtk/bststest.cc
index 46de364,3fd86f1..4427ade
--- a/beast-gtk/bststest.cc
+++ b/beast-gtk/bststest.cc
@@@ -142,8 -167,10 +167,10 @@@ selection_to_loop (BstQSampler *qsample
{
gint m1 = bst_qsampler_get_mark_offset (qsampler, 1);
gint m2 = bst_qsampler_get_mark_offset (qsampler, 2);
+
if (m2 < 0 || m1 < 0)
return;
-
++
if (m2 < m1)
{
gint t = m2;
@@@ -233,6 -271,7 +271,7 @@@ qsampler_set_handle (BstQSampler *qsa
GslDataHandle *handle)
{
GslDataCache *dcache = gsl_data_cache_new (handle, 1);
-
++
gsl_data_cache_open (dcache);
bst_qsampler_set_source (qsampler, gsl_data_handle_length (dcache->dhandle),
qsampler_dcache_filler, dcache, (GDestroyNotify) gsl_data_cache_close);
@@@ -249,8 -291,10 +291,10 @@@ set_loop (BstQSampler *qsampler
{
gint m1 = bst_qsampler_get_mark_offset (qsampler, 3);
gint m2 = bst_qsampler_get_mark_offset (qsampler, 4);
+
if (m2 < 0 || m1 < 0)
return;
-
++
if (m2 < m1)
{
gint t = m2;
@@@ -317,6 -373,7 +373,7 @@@ find (WaveView *view
GslLong start, end;
GslLong length = gsl_data_handle_length (view->handle);
GslLoopSpec loop_spec = { 0, length / 3, 44100.0/15., length / 3.5 };
-
++
gsl_data_find_tailmatch (view->handle, &loop_spec, &start, &end);
qsampler_set_selection (view->qsampler, start, end, 2);
selection_to_loop (view->qsampler);
@@@ -349,13 -411,16 +411,16 @@@ findx (
GslLong length = gsl_data_handle_length (shandle);
GslLong l, start = 0, end = 0, lsize = gsl_data_handle_length (shandle) / 2;
gdouble score = 0, least = GSL_MAXLONG;
-
++
gsl_data_cache_unref (dcache);
gsl_data_handle_open (shandle);
-
++
while (lsize)
{
for (l = 0; l < length - lsize; l++)
{
GslDataHandle *dhandle = gsl_data_handle_new_looped (shandle, l, l + lsize);
-
++
gsl_data_handle_open (dhandle);
score = score_loop (shandle, dhandle);
gsl_data_handle_close (dhandle);
@@@ -388,6 -455,7 +455,7 @@@ main (int argc
};
WaveView *view, *first_view = NULL;
guint i;
-
++
g_thread_init (NULL);
g_type_init ();
birnet_init (&argc, &argv, NULL);
@@@ -396,8 -464,10 +464,10 @@@
gtk_init (&argc, &argv);
gxk_init ();
_bst_init_utils ();
-
++
if (argc < 2)
g_error ("need filenames");
+
vbox = gtk_widget_new (GTK_TYPE_VBOX,
"visible", TRUE,
"border_width", 10,
@@@ -442,6 -515,7 +515,7 @@@
"signal::value_changed", adjust_zoom, view->qsampler,
NULL);
gtk_box_pack_start (GTK_BOX (vbox), spin, FALSE, TRUE, 0);
-
++
spin = gtk_spin_button_new (GTK_ADJUSTMENT (gtk_adjustment_new (100, 1e-16, 1e+16, 1, 10, 0)), 0, 5);
gtk_widget_set (spin,
"visible", TRUE,
@@@ -452,6 -526,7 +526,7 @@@
"signal::value_changed", adjust_vscale, view->qsampler,
NULL);
gtk_box_pack_start (GTK_BOX (vbox), spin, FALSE, TRUE, 0);
-
++
hbox = gtk_widget_new (GTK_TYPE_HBOX,
"visible", TRUE,
"border_width", 10,
@@@ -515,6 -598,7 +598,7 @@@
NULL),
"signal::destroy", gtk_main_quit, NULL,
NULL);
-
++
button = g_object_new (GTK_TYPE_BUTTON,
"visible", TRUE,
"label", _("Mark Signal (Head)"),
@@@ -533,9 -618,13 +618,13 @@@
g_object_connect (GTK_OBJECT (button),
"swapped_signal::clicked", mark_signalt, view,
NULL);
-
-
++
++
gtk_main ();
-
++
return 0;
}
+
#if 0 /* test code */
static void
plist_fill_value (gpointer da_NULL,
diff --cc beast-gtk/bstsupershell.cc
index 75e6f0d,7e717c1..5f06742
--- a/beast-gtk/bstsupershell.cc
+++ b/beast-gtk/bstsupershell.cc
@@@ -93,10 -111,13 +111,13 @@@ static voi
bst_super_shell_destroy (GtkObject *object)
{
BstSuperShell *self = BST_SUPER_SHELL (object);
+
if (self->super)
bst_super_shell_set_super (self, 0);
-
++
GTK_OBJECT_CLASS (bst_super_shell_parent_class)->destroy (object);
}
+
static void
bst_super_shell_finalize (GObject *object)
{
@@@ -110,6 -133,7 +133,7 @@@ bst_super_shell_set_super (BstSuperShel
g_return_if_fail (BST_IS_SUPER_SHELL (self));
if (super)
g_return_if_fail (BSE_IS_SUPER (super));
-
++
if (super != self->super)
{
if (self->super)
diff --cc beast-gtk/bsttrackroll.cc
index be3280c,cc22b01..82fcae1
--- a/beast-gtk/bsttrackroll.cc
+++ b/beast-gtk/bsttrackroll.cc
@@@ -53,6 -63,7 +63,7 @@@ static voi
bst_track_roll_init (BstTrackRoll *self)
{
GxkScrollCanvas *scc = GXK_SCROLL_CANVAS (self);
-
++
self->tpt = 384 * 4;
self->max_ticks = 1;
self->hzoom = 1;
@@@ -80,14 -93,18 +93,18 @@@ bst_track_roll_destroy (GtkObject *obje
g_free (self->scopes);
self->scopes = NULL;
self->n_scopes = 0;
-
++
GTK_OBJECT_CLASS (bst_track_roll_parent_class)->destroy (object);
}
+
static void
bst_track_roll_finalize (GObject *object)
{
BstTrackRoll *self = BST_TRACK_ROLL (object);
guint i;
-
++
bst_track_roll_setup (self, NULL, 0);
+
if (self->scope_update)
{
g_source_remove (self->scope_update);
@@@ -96,8 -114,10 +114,10 @@@
for (i = 0; i < self->n_scopes; i++)
gtk_widget_unparent (self->scopes[i]);
g_free (self->scopes);
-
++
G_OBJECT_CLASS (bst_track_roll_parent_class)->finalize (object);
}
+
static void
track_roll_forall (GtkContainer *container,
gboolean include_internals,
@@@ -399,8 -456,10 +456,10 @@@ track_roll_idle_update_scopes (gpointe
BstTrackRoll *self = BST_TRACK_ROLL (data);
GSList *scope_list = NULL;
guint i;
+
GDK_THREADS_ENTER ();
self->scope_update = 0;
-
++
/* save existing scopes */
for (i = 0; i < self->n_scopes; i++)
scope_list = g_slist_prepend (scope_list, self->scopes[i]);
@@@ -443,6 -505,7 +505,7 @@@
GtkWidget *child = (GtkWidget*) g_slist_pop_head (&scope_list);
gtk_widget_unparent (child);
}
-
++
/* allocate scopes 'n stuff */
gxk_scroll_canvas_reallocate (GXK_SCROLL_CANVAS (self));
/* work around spurious redraw problems */
@@@ -606,6 -685,7 +685,7 @@@ bst_track_roll_draw_hpanel (GxkScrollCa
gint i, width, height;
gdk_window_get_size (drawable, &width, &height);
bst_track_roll_overlap_grow_hpanel_area (self, area);
-
++
/* tact numbers */
for (i = area->x; i < area->x + area->width; i++)
{
@@@ -1060,8 -1180,11 +1180,11 @@@ bst_track_roll_class_init (BstTrackRoll
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
GxkScrollCanvasClass *scroll_canvas_class = GXK_SCROLL_CANVAS_CLASS (klass);
-
++
gobject_class->finalize = bst_track_roll_finalize;
+
object_class->destroy = bst_track_roll_destroy;
-
++
widget_class->realize = bst_track_roll_realize;
widget_class->unrealize = bst_track_roll_unrealize;
widget_class->button_press_event = bst_track_roll_button_press;
@@@ -1081,8 -1206,10 +1206,10 @@@
scroll_canvas_class->handle_drag = track_roll_handle_drag;
scroll_canvas_class->image_tint = gdk_color_from_rgb (0x00ffffff);
scroll_canvas_class->image_saturation = 0;
-
++
klass->drag = NULL;
klass->clicked = NULL;
-
++
signal_select_row = g_signal_new ("select-row", G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (BstTrackRollClass, select_row),
NULL, NULL,
diff --cc beast-gtk/bsttrackroll.hh
index 9ee0f2c,b42cf31..be4ef3b
--- a/beast-gtk/bsttrackroll.hh
+++ b/beast-gtk/bsttrackroll.hh
@@@ -44,6 -52,7 +52,7 @@@ struct _BstTrackRol
guint n_scopes; /* does not always reflect number of rows */
GtkWidget **scopes;
guint scope_update;
-
++
/* horizontal layout */
guint tpt; /* ticks (parts) per tact */
guint max_ticks;
diff --cc beast-gtk/bsttrackrollctrl.cc
index a521bc7,8d8f147..591304b
--- a/beast-gtk/bsttrackrollctrl.cc
+++ b/beast-gtk/bsttrackrollctrl.cc
@@@ -620,6 -669,7 +669,7 @@@ controller_drag (BstTrackRollControlle
self->obj_duration = tpart ? tpart->duration : 0;
self->xoffset = 0;
self->tick_bound = 0;
-
++
/* find drag tool */
if (self->obj_part) /* have object */
tool = obj_tool;
diff --cc beast-gtk/bsttracksynthdialog.cc
index 0279227,29a3be3..dcad9d9
--- a/beast-gtk/bsttracksynthdialog.cc
+++ b/beast-gtk/bsttracksynthdialog.cc
@@@ -17,15 -22,19 +22,19 @@@ bst_track_synth_dialog_class_init (BstT
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
++
gobject_class->finalize = bst_track_synth_dialog_finalize;
-
++
widget_class->delete_event = bst_track_synth_dialog_delete_event;
}
+
static void
bst_track_synth_dialog_init (BstTrackSynthDialog *self)
{
GtkTreeSelection *tsel;
GtkTreeModel *smodel;
GtkWidget *main_box = GXK_DIALOG (self)->vbox;
-
++
/* configure self */
g_object_set (self,
"flags", (GXK_DIALOG_HIDE_ON_DELETE |
@@@ -34,6 -43,7 +43,7 @@@
GXK_DIALOG_MODAL),
NULL);
gxk_dialog_set_sizes (GXK_DIALOG (self), 550, 300, 600, 320);
-
++
/* notebook */
self->notebook = (GtkNotebook*) g_object_new (GXK_TYPE_NOTEBOOK,
"visible", TRUE,
@@@ -48,6 -58,7 +58,7 @@@
"parent", main_box,
"enable_popup", FALSE,
NULL);
-
++
/* synth list */
self->spage = (GtkWidget*) g_object_new (GTK_TYPE_SCROLLED_WINDOW,
"visible", TRUE,
@@@ -57,6 -68,7 +68,7 @@@
"shadow_type", GTK_SHADOW_IN,
NULL);
gxk_notebook_append (self->notebook, self->spage, "synth", TRUE);
-
++
/* synth selection store and tree */
self->pstore = bst_item_seq_store_new (TRUE);
smodel = gtk_tree_model_sort_new_with_model (self->pstore);
@@@ -72,6 -84,7 +84,7 @@@
tsel = gtk_tree_view_get_selection (self->tview);
gtk_tree_selection_set_mode (tsel, GTK_SELECTION_BROWSE);
gxk_tree_selection_force_browse (tsel, smodel);
-
++
/* synth selection tree columns */
if (BST_DVL_HINTS)
gxk_tree_view_add_text_column (self->tview, BST_PROXY_STORE_SEQID, "S",
@@@ -87,13 -100,16 +100,16 @@@
gxk_tree_view_add_text_column (self->tview, BST_PROXY_STORE_TYPE, "",
0.0, "Type", NULL,
NULL, NULL, G_CONNECT_SWAPPED);
-
++
/* wave repo view */
self->wpage = (GtkWidget*) g_object_new (BST_TYPE_WAVE_VIEW, "visible", TRUE, NULL);
gxk_notebook_append (self->notebook, self->wpage, "wave", TRUE);
bst_wave_view_set_editable (BST_WAVE_VIEW (self->wpage), FALSE);
-
++
/* provide buttons */
self->ok = gxk_dialog_default_action_swapped (GXK_DIALOG (self), BST_STOCK_OK, (void*)
bst_track_synth_dialog_activate, self);
gxk_dialog_action (GXK_DIALOG (self), BST_STOCK_CANCEL, (void*) gxk_toplevel_delete, (GtkWidget*) self);
-
++
/* make row connections */
g_signal_connect_object (self->tview, "row_activated", G_CALLBACK (gtk_button_clicked), self->ok,
G_CONNECT_SWAPPED);
g_signal_connect_object (BST_ITEM_VIEW (self->wpage)->tree, "row_activated",
@@@ -103,7 -120,9 +120,9 @@@ static voi
bst_track_synth_dialog_finalize (GObject *object)
{
BstTrackSynthDialog *self = BST_TRACK_SYNTH_DIALOG (object);
-
++
bst_track_synth_dialog_setup (self, NULL, NULL, 0);
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (bst_track_synth_dialog_parent_class)->finalize (object);
}
@@@ -141,23 -163,30 +163,30 @@@ bst_track_synth_dialog_setup (BstTrackS
SfiProxy proxy)
{
GtkWindow *window = GTK_WINDOW (self);
-
++
g_return_if_fail (BST_IS_TRACK_SYNTH_DIALOG (self));
+
self->selected_callback = NULL;
GxkFreeFunc selected_cleanup = self->selected_cleanup;
self->selected_callback = NULL;
self->selected_cleanup = NULL;
if (selected_cleanup)
selected_cleanup (self->selected_data);
+
gtk_widget_hide (GTK_WIDGET (self));
-
++
/* reset proxy handling */
bst_window_sync_title_to_proxy (self, proxy, title);
-
++
/* cleanup connections to old parent_window */
if (self->parent_window)
g_signal_handlers_disconnect_by_func (self->parent_window, (void*) parent_window_destroyed, self);
if (window->group)
gtk_window_group_remove_window (window->group, window);
gtk_window_set_transient_for (window, NULL);
-
++
self->parent_window = parent_widget ? (GtkWindow*) gtk_widget_get_ancestor ((GtkWidget*) parent_widget,
GTK_TYPE_WINDOW) : NULL;
-
++
/* setup connections to new parent_window */
if (self->parent_window)
{
@@@ -168,6 -197,7 +197,7 @@@
G_CALLBACK (parent_window_destroyed),
self, G_CONNECT_SWAPPED);
}
-
++
/* allow activation */
self->ignore_activate = FALSE;
gxk_notebook_set_current_page_widget (self->notebook, self->spage);
@@@ -213,14 -249,17 +249,17 @@@ bst_track_synth_dialog_popup (gpointe
self->selected_data = selected_data;
self->selected_cleanup = selected_cleanup;
gxk_widget_showraise (widget);
-
++
return widget;
}
+
void
bst_track_synth_dialog_set (BstTrackSynthDialog *self,
BseItemSeq *iseq,
SfiProxy wrepo)
{
g_return_if_fail (BST_IS_TRACK_SYNTH_DIALOG (self));
-
++
bst_item_view_set_container (BST_ITEM_VIEW (self->wpage), wrepo);
bst_item_seq_store_set (self->pstore, iseq);
g_object_set (self->wpage, "visible", wrepo != 0, NULL);
@@@ -230,8 -270,10 +270,10 @@@ static voi
bst_track_synth_dialog_activate (BstTrackSynthDialog *self)
{
SfiProxy proxy = 0;
-
++
if (self->ignore_activate)
return;
-
++
if (self->tview && gxk_widget_viewable (GTK_WIDGET (self->tview)))
{
GtkTreeIter siter;
@@@ -248,6 -290,7 +290,7 @@@
}
else if (self->wpage)
proxy = bst_item_view_get_current (BST_ITEM_VIEW (self->wpage));
-
++
/* ignore_activate guards against multiple clicks */
self->ignore_activate = TRUE;
/* notify and done */
diff --cc beast-gtk/bsttrackview.cc
index 40ac496,b699fc8..89d6c32
--- a/beast-gtk/bsttrackview.cc
+++ b/beast-gtk/bsttrackview.cc
@@@ -53,29 -62,40 +62,40 @@@ bst_track_view_class_init (BstTrackView
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
BstItemViewClass *item_view_class = BST_ITEM_VIEW_CLASS (klass);
-
++
gobject_class->finalize = bst_track_view_finalize;
-
++
item_view_class->set_container = track_view_set_container;
item_view_class->listen_on = track_view_listen_on;
item_view_class->unlisten_on = track_view_unlisten_on;
-
++
item_view_class->item_type = "BseTrack";
}
+
static void
bst_track_view_finalize (GObject *object)
{
BstTrackView *self = BST_TRACK_VIEW (object);
-
++
if (self->tctrl)
bst_track_roll_controller_unref (self->tctrl);
-
++
G_OBJECT_CLASS (bst_track_view_parent_class)->finalize (object);
}
+
GtkWidget*
bst_track_view_new (SfiProxy song)
{
GtkWidget *track_view;
-
++
g_return_val_if_fail (BSE_IS_SONG (song), NULL);
-
++
track_view = gtk_widget_new (BST_TYPE_TRACK_VIEW, NULL);
bst_item_view_set_container (BST_ITEM_VIEW (track_view), song);
-
++
return track_view;
}
+
static void
track_view_hzoom_changed (BstTrackView *self,
GtkAdjustment *adjustment)
@@@ -153,6 -175,7 +175,7 @@@ track_view_synth_edited (BstTrackView *
const gchar *text)
{
g_return_if_fail (BST_IS_TRACK_VIEW (self));
-
++
if (strpath)
{
gint row = gxk_tree_spath_index0 (strpath);
@@@ -186,6 -210,7 +210,7 @@@ track_view_post_synth_edited (BstTrackV
const gchar *text)
{
g_return_if_fail (BST_IS_TRACK_VIEW (self));
-
++
if (strpath)
{
gint row = gxk_tree_spath_index0 (strpath);
@@@ -238,6 -267,7 +267,7 @@@ track_view_synth_popup (BstTrackVie
GxkCellRendererPopup *pcell)
{
g_return_if_fail (BST_IS_TRACK_VIEW (self));
-
++
if (strpath)
{
gint row = gxk_tree_spath_index0 (strpath);
@@@ -265,6 -296,7 +296,7 @@@ track_view_post_synth_popup (BstTrackVi
GxkCellRendererPopup *pcell)
{
g_return_if_fail (BST_IS_TRACK_VIEW (self));
-
++
if (strpath)
{
gint row = gxk_tree_spath_index0 (strpath);
@@@ -315,6 -351,7 +351,7 @@@ track_view_outputs_popup (BstTrackVie
GxkCellRendererPopup *pcell)
{
g_return_if_fail (BST_IS_TRACK_VIEW (self));
-
++
if (strpath)
{
gint row = gxk_tree_spath_index0 (strpath);
@@@ -339,6 -377,7 +377,7 @@@ track_view_mute_toggled (BstTrackVie
GtkCellRendererToggle *tcell)
{
g_return_if_fail (BST_IS_TRACK_VIEW (self));
-
++
if (strpath)
{
gint row = gxk_tree_spath_index0 (strpath);
@@@ -359,6 -399,7 +399,7 @@@ track_view_voice_edited (BstTrackView *
const gchar *text)
{
g_return_if_fail (BST_IS_TRACK_VIEW (self));
-
++
if (strpath)
{
gint row = gxk_tree_spath_index0 (strpath);
@@@ -377,6 -419,7 +419,7 @@@ track_view_midi_channel_edited (BstTrac
const gchar *text)
{
g_return_if_fail (BST_IS_TRACK_VIEW (self));
-
++
if (strpath)
{
gint row = gxk_tree_spath_index0 (strpath);
@@@ -439,11 -487,13 +487,13 @@@ bst_track_view_init (BstTrackView *self
GtkTreeModel *smodel;
GxkListWrapper *lwrapper;
GxkRadget *radget;
-
++
/* create GUI */
gxk_widget_publish_actions (self, "track-view-actions",
G_N_ELEMENTS (track_view_actions), track_view_actions,
NULL, track_view_action_check, track_view_action_exec);
radget = gxk_radget_complete (GTK_WIDGET (self), "beast", "track-view", NULL);
-
++
/* item list model */
lwrapper = gxk_list_wrapper_new (N_COLS,
G_TYPE_STRING, /* COL_SEQID */
@@@ -461,10 -511,12 +511,12 @@@
G_CALLBACK (track_view_fill_value),
iview, G_CONNECT_SWAPPED);
g_object_unref (lwrapper);
-
++
/* scrollbars */
treehs = (GtkWidget*) gxk_radget_find (radget, "tree-hscrollbar");
trackgb = (GtkWidget*) gxk_radget_find (radget, "track-hgrow-bar");
vscroll = (GtkWidget*) gxk_radget_find (radget, "tree-vscrollbar");
-
++
/* tree view (track list) */
tview = (GtkTreeView*) gxk_radget_find (radget, "tree-view");
gtk_tree_view_set_model (tview, smodel);
@@@ -475,6 -527,7 +527,7 @@@
gtk_tree_selection_set_mode (tsel, GTK_SELECTION_BROWSE);
gxk_tree_selection_force_browse (tsel, smodel);
g_object_unref (smodel);
-
++
/* track roll */
self->troll = (BstTrackRoll*) g_object_new (BST_TYPE_TRACK_ROLL,
"visible", TRUE,
@@@ -485,6 -538,7 +538,7 @@@
gxk_scroll_canvas_set_vadjustment (GXK_SCROLL_CANVAS (self->troll), gtk_range_get_adjustment (GTK_RANGE
(vscroll)));
bst_track_roll_set_track_callback (self->troll, self, get_track);
track_view_marks_changed (self);
-
++
/* link track roll to tree view and list model */
g_signal_connect_object (tsel, "changed",
G_CALLBACK (bst_track_roll_reselect),
@@@ -498,17 -552,20 +552,20 @@@
g_signal_connect_object (iview->wlist, "row-change",
G_CALLBACK (bst_track_roll_abort_edit),
self->troll, G_CONNECT_SWAPPED);
-
++
/* track roll controller */
self->tctrl = bst_track_roll_controller_new (self->troll);
bst_track_roll_controller_set_song (self->tctrl, iview->container);
gxk_widget_publish_action_list (self, "tctrl-canvas-tools", bst_track_roll_controller_canvas_actions
(self->tctrl));
gxk_widget_publish_action_list (self, "tctrl-hpanel-tools", bst_track_roll_controller_hpanel_actions
(self->tctrl));
gxk_widget_publish_action_list (self, "tctrl-quant-tools", bst_track_roll_controller_quant_actions
(self->tctrl));
-
++
/* add repeat toggle */
self->repeat_toggle = (GtkWidget*) gxk_radget_find (radget, "repeat-toggle");
gxk_nullify_in_object (self, &self->repeat_toggle);
g_object_connect (self->repeat_toggle, "swapped_signal::toggled", track_view_repeat_toggled, self, NULL);
track_view_repeat_changed (self);
-
++
/* add zoom spinner */
adjustment = gtk_adjustment_new (50, 1, 100, 1, 5, 0);
g_object_connect (adjustment,
@@@ -521,6 -578,7 +578,7 @@@
"digits", 0,
"width_request", 2 * gxk_size_width (GXK_ICON_SIZE_TOOLBAR),
NULL));
-
++
/* add list view columns */
if (BST_DVL_HINTS)
gxk_tree_view_add_text_column (iview->tree, COL_SEQID, "S",
@@@ -640,6 -705,7 +705,7 @@@ track_view_action_exec (gpointer data
BstTrackView *self = BST_TRACK_VIEW (data);
BstItemView *item_view = BST_ITEM_VIEW (self);
SfiProxy song = item_view->container;
-
++
switch (action)
{
SfiProxy item;
@@@ -677,6 -744,7 +744,7 @@@ track_view_action_check (gpointer data
{
BstTrackView *self = BST_TRACK_VIEW (data);
BstItemView *item_view = BST_ITEM_VIEW (self);
-
++
switch (action)
{
SfiProxy item;
diff --cc beast-gtk/bsttreestores.cc
index 224a3b7,23b29a7..a02f7e2
--- a/beast-gtk/bsttreestores.cc
+++ b/beast-gtk/bsttreestores.cc
@@@ -141,7 -145,9 +145,9 @@@ bst_file_store_update_list (GtkTreeMode
GtkTreeStore *store = GTK_TREE_STORE (model);
SfiFileCrawler *crawler = sfi_file_crawler_new ();
glong l;
-
++
g_return_if_fail (search_path != NULL);
-
++
sfi_file_crawler_add_search_path (crawler, search_path, filter);
g_object_set_data_full ((GObject*) store, "file-crawler", crawler, (GDestroyNotify)
sfi_file_crawler_destroy);
l = g_timeout_add_full (G_PRIORITY_LOW + 100, 0,
diff --cc beast-gtk/bstusermessage.cc
index 46654ff,0b15c59..94c685a
--- a/beast-gtk/bstusermessage.cc
+++ b/beast-gtk/bstusermessage.cc
@@@ -96,6 -90,7 +96,8 @@@ toggle_update_filter (GtkWidget *toggle
if (config_check && bst_msg_absorb_config_adjust (config_check, GTK_TOGGLE_BUTTON (toggle)->active, TRUE))
bst_msg_absorb_config_save();
}
+
++
static gchar*
adapt_message_spacing (const gchar *head,
const gchar *message,
@@@ -271,6 -270,7 +277,7 @@@ bst_msg_dialog_janitor_update (GxkDialo
const gchar *action = bse_janitor_get_action (janitor, i);
const gchar *name = bse_janitor_get_action_name (janitor, i);
const gchar *blurb = bse_janitor_get_action_blurb (janitor, i);
-
++
if (action)
{
GtkWidget *button = gxk_dialog_action_multi (dialog, name,
@@@ -498,6 -523,7 +514,8 @@@ message_fill_from_script (BstMessag
msg->n_msg_bits = 0;
msg->msg_bits = NULL;
}
+
++
static void
message_free_from_script (BstMessage *msg)
{
@@@ -568,6 -598,7 +590,7 @@@ static voi
janitor_window_deleted (GxkDialog *dialog)
{
SfiProxy janitor = (SfiProxy) g_object_get_data (G_OBJECT (dialog), "user-data");
-
++
bse_proxy_disconnect (janitor,
"any_signal", janitor_actions_changed, dialog,
"any_signal", janitor_progress, dialog,
@@@ -583,6 -615,7 +607,7 @@@ create_janitor_dialog (SfiProxy janitor
GXK_DIALOG_STATUS_BAR, // | GXK_DIALOG_WINDOW_GROUP,
NULL, NULL);
gxk_dialog_set_sizes (dialog, -1, -1, 512, -1);
-
++
g_object_set_data (G_OBJECT (dialog), "user-data", (gpointer) janitor);
bse_proxy_connect (janitor,
"swapped-object-signal::action-changed", janitor_actions_changed, dialog,
diff --cc beast-gtk/bstusermessage.hh
index ddb325e,0fb57f1..02a8557
--- a/beast-gtk/bstusermessage.hh
+++ b/beast-gtk/bstusermessage.hh
@@@ -72,10 -81,13 +74,12 @@@ BstMsgBit* bst_msg_bit_create_ch
#define BST_MSG_CHOICE(id, name, stock_icon) bst_msg_bit_create_choice (id, name, stock_icon, "C")
/* choice */
#define BST_MSG_CHOICE_D(id, name, stock_icon) bst_msg_bit_create_choice (id, name, stock_icon, "D")
/* default */
#define BST_MSG_CHOICE_S(id, name, sticn, sens) bst_msg_bit_create_choice (id, name, sticn, (sens) ? "" :
"I") /* insensitive */
-#define BST_MSG_DIALOG(lvl, ...) ({ BstMsgType __mt = lvl; uint __result = 0;
\
- if (sfi_msg_check (SfiMsgType (__mt))) {
\
- BstMsgBit *__ba[] = { __VA_ARGS__ };
\
- __result = bst_message_dialog_display
(BIRNET_LOG_DOMAIN, \
- __mt, BIRNET_ARRAY_SIZE (__ba), __ba); }
\
+#define BST_MSG_DIALOG(lvl, ...) ({ BstMsgType __mt = lvl; uint __result = 0;
\
+ BstMsgBit *__ba[] = { __VA_ARGS__ };
\
+ __result = bst_message_dialog_display ("BEAST", \
+ __mt, RAPICORN_ARRAY_SIZE (__ba), __ba);
\
__result; })
+
G_END_DECLS
+
#endif /* __BST_USER_MESSAGE_H__ */
diff --cc beast-gtk/bstutils.cc
index 6be12ad,2383fbf..7f4a086
--- a/beast-gtk/bstutils.cc
+++ b/beast-gtk/bstutils.cc
@@@ -48,6 -56,7 +49,7 @@@ _bst_init_utils (void
for (i = 0; i < sizeof (builtin_info) / sizeof (builtin_info[0]); i++)
{
GType type_id = 0;
-
++
if (builtin_info[i].parent == G_TYPE_ENUM)
type_id = g_enum_register_static (builtin_info[i].type_name, (const GEnumValue*)
builtin_info[i].pointer1);
else if (builtin_info[i].parent == G_TYPE_FLAGS)
@@@ -58,14 -67,18 +60,18 @@@
*builtin_info[i].type_id = type_id;
}
}
-
++
/* initialize IDL types */
_bst_init_idl ();
-
++
/* initialize stock icons (included above) */
{
/* generated stock icons */
#include "beast-gtk/icons/bst-stock-gen.cc"
-
++
gxk_stock_register_icons (G_N_ELEMENTS (stock_icons), stock_icons);
}
-
++
/* initialize stock actions */
{
static const GxkStockItem stock_items[] = {
@@@ -142,6 -160,7 +153,7 @@@ bst_stock_register_icon (const gcha
{
g_return_if_fail (bytes_per_pixel == 3 || bytes_per_pixel == 4);
g_return_if_fail (width > 0 && height > 0 && rowstride >= width * bytes_per_pixel);
-
++
if (!gtk_icon_factory_lookup (stock_icon_factory, stock_id))
{
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_data ((guchar*) g_memdup (pixels, rowstride * height),
@@@ -164,9 -184,11 +176,11 @@@ bst_status_eprintf (BseErrorType error
{
gchar *buffer;
va_list args;
-
++
va_start (args, message_fmt);
buffer = g_strdup_vprintf (message_fmt, args);
va_end (args);
-
++
if (error)
gxk_status_set (GXK_STATUS_ERROR, buffer, bse_error_blurb (error));
else
@@@ -197,6 -223,7 +215,7 @@@ sync_title (TitleSync *tsync
{
const gchar *name = bse_item_get_name (tsync->proxy);
gchar *s;
-
++
s = g_strconcat (tsync->title1, name ? name : "<NULL>", tsync->title2, NULL);
g_object_set (tsync->window, "title", s, NULL);
g_free (s);
@@@ -205,6 -233,7 +225,7 @@@ static voi
free_title_sync (gpointer data)
{
TitleSync *tsync = (TitleSync*) data;
-
++
bse_proxy_disconnect (tsync->proxy,
"any_signal", sync_title, tsync,
NULL);
@@@ -461,14 -504,13 +496,15 @@@ bst_action_list_add_cat (GxkActionLis
gpointer user_data)
{
const gchar *p, *stock_id;
+
if (cat->icon)
{
- bst_stock_register_icon (cat->category, cat->icon->bytes_per_pixel,
- cat->icon->width, cat->icon->height,
- cat->icon->width * cat->icon->bytes_per_pixel,
- cat->icon->pixels->bytes);
+ BseIcon *icon = cat->icon;
+ g_assert (icon->width * icon->height == int (icon->pixel_seq->n_pixels));
+ bst_stock_register_icon (cat->category, 4,
+ icon->width, icon->height,
+ icon->width * 4,
+ (guchar*) icon->pixel_seq->pixels);
stock_id = cat->category;
}
else
@@@ -530,6 -581,7 +575,7 @@@ static voi
gmask_destroy (gpointer data)
{
GMask *gmask = (GMask*) data;
-
++
if (gmask->parent)
g_object_unref (gmask->parent);
if (gmask->prompt)
@@@ -549,20 -602,26 +596,26 @@@ gmask_form (GtkWidget *parent
BstGMaskPack gpack)
{
GMask *gmask;
-
++
g_return_val_if_fail (GTK_IS_TABLE (parent), NULL);
g_return_val_if_fail (GTK_IS_WIDGET (action), NULL);
-
++
if (!gmask_quark)
gmask_quark = g_quark_from_static_string ("GMask");
-
++
gmask = GMASK_GET (action);
g_return_val_if_fail (gmask == NULL, NULL);
-
++
gmask = g_new0 (GMask, 1);
g_object_set_qdata_full (G_OBJECT (action), gmask_quark, gmask, gmask_destroy);
gmask->parent = (GtkWidget*) g_object_ref (parent);
gtk_object_sink (GTK_OBJECT (parent));
gmask->action = action;
gmask->gpack = gpack;
-
++
return action;
}
+
/**
* @param border_width Border width of this GUI mask
* @param dislodge_columns Provide expandable space between columns
@@@ -587,8 -646,10 +640,10 @@@ bst_gmask_container_create (guint bo
NULL);
if (dislodge_columns)
g_object_set_data (G_OBJECT (container), "GMask-dislodge", GUINT_TO_POINTER (TRUE));
-
++
return container;
}
+
/**
* @param gmask_container container created with bst_gmask_container_create()
* @param action valid GtkWidget
@@@ -634,9 -696,11 +690,11 @@@ bst_gmask_set_tip (BstGMask *mask
const gchar *tip_text)
{
GMask *gmask;
-
++
g_return_if_fail (GTK_IS_WIDGET (mask));
gmask = GMASK_GET (mask);
g_return_if_fail (gmask != NULL);
-
++
g_free (gmask->tip);
gmask->tip = g_strdup (tip_text);
}
@@@ -651,10 -716,12 +710,12 @@@ bst_gmask_set_prompt (BstGMask *mask
gpointer widget)
{
GMask *gmask;
-
++
g_return_if_fail (GTK_IS_WIDGET (mask));
gmask = GMASK_GET (mask);
g_return_if_fail (gmask != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
-
++
if (gmask->prompt)
g_object_unref (gmask->prompt);
gmask->prompt = (GtkWidget*) g_object_ref (widget);
@@@ -671,10 -739,12 +733,12 @@@ bst_gmask_set_aux1 (BstGMask *mask
gpointer widget)
{
GMask *gmask;
-
++
g_return_if_fail (GTK_IS_WIDGET (mask));
gmask = GMASK_GET (mask);
g_return_if_fail (gmask != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
-
++
if (gmask->aux1)
g_object_unref (gmask->aux1);
gmask->aux1 = (GtkWidget*) g_object_ref (widget);
@@@ -693,10 -764,12 +758,12 @@@ bst_gmask_set_aux2 (BstGMask *mask
gpointer widget)
{
GMask *gmask;
-
++
g_return_if_fail (GTK_IS_WIDGET (mask));
gmask = GMASK_GET (mask);
g_return_if_fail (gmask != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
-
++
if (gmask->aux2)
g_object_unref (gmask->aux2);
gmask->aux2 = (GtkWidget*) g_object_ref (widget);
@@@ -713,10 -787,12 +781,12 @@@ bst_gmask_set_aux3 (BstGMask *mask
gpointer widget)
{
GMask *gmask;
-
++
g_return_if_fail (GTK_IS_WIDGET (mask));
gmask = GMASK_GET (mask);
g_return_if_fail (gmask != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
-
++
if (gmask->aux3)
g_object_unref (gmask->aux3);
gmask->aux3 = (GtkWidget*) g_object_ref (widget);
@@@ -734,11 -811,14 +805,14 @@@ bst_gmask_set_column (BstGMask *mask
guint column)
{
GMask *gmask;
-
++
g_return_if_fail (GTK_IS_WIDGET (mask));
gmask = GMASK_GET (mask);
g_return_if_fail (gmask != NULL);
-
++
gmask->column = column;
}
+
/**
* @param mask valid BstGMask
* @return the requested GtkWidget or NULL
@@@ -749,11 -829,14 +823,14 @@@ GtkWidget
bst_gmask_get_prompt (BstGMask *mask)
{
GMask *gmask;
-
++
g_return_val_if_fail (GTK_IS_WIDGET (mask), NULL);
gmask = GMASK_GET (mask);
g_return_val_if_fail (gmask != NULL, NULL);
-
++
return gmask->prompt;
}
+
/**
* @param mask valid BstGMask
* @return the requested GtkWidget or NULL
@@@ -764,11 -847,14 +841,14 @@@ GtkWidget
bst_gmask_get_aux1 (BstGMask *mask)
{
GMask *gmask;
-
++
g_return_val_if_fail (GTK_IS_WIDGET (mask), NULL);
gmask = GMASK_GET (mask);
g_return_val_if_fail (gmask != NULL, NULL);
-
++
return gmask->aux1;
}
+
/**
* @param mask valid BstGMask
* @return the requested GtkWidget or NULL
@@@ -779,11 -865,14 +859,14 @@@ GtkWidget
bst_gmask_get_aux2 (BstGMask *mask)
{
GMask *gmask;
-
++
g_return_val_if_fail (GTK_IS_WIDGET (mask), NULL);
gmask = GMASK_GET (mask);
g_return_val_if_fail (gmask != NULL, NULL);
-
++
return gmask->aux2;
}
+
/**
* @param mask valid BstGMask
* @return the requested GtkWidget or NULL
@@@ -794,11 -883,14 +877,14 @@@ GtkWidget
bst_gmask_get_aux3 (BstGMask *mask)
{
GMask *gmask;
-
++
g_return_val_if_fail (GTK_IS_WIDGET (mask), NULL);
gmask = GMASK_GET (mask);
g_return_val_if_fail (gmask != NULL, NULL);
-
++
return gmask->aux3;
}
+
/**
* @param mask valid BstGMask
* @return the requested GtkWidget or NULL
@@@ -809,11 -901,14 +895,14 @@@ GtkWidget
bst_gmask_get_action (BstGMask *mask)
{
GMask *gmask;
-
++
g_return_val_if_fail (GTK_IS_WIDGET (mask), NULL);
gmask = GMASK_GET (mask);
g_return_val_if_fail (gmask != NULL, NULL);
-
++
return gmask->action;
}
+
/**
* @param mask valid BstGMask
* @param func foreach function as: void func(GtkWidget*, gpointer data);
@@@ -829,10 -924,12 +918,12 @@@ bst_gmask_foreach (BstGMask *mask
{
GMask *gmask;
GtkCallback callback = GtkCallback (func);
-
++
g_return_if_fail (GTK_IS_WIDGET (mask));
gmask = GMASK_GET (mask);
g_return_if_fail (gmask != NULL);
g_return_if_fail (func != NULL);
-
++
if (gmask->prompt)
callback (gmask->prompt, data);
if (gmask->aux1)
@@@ -849,6 -947,7 +941,7 @@@ get_toplevel_and_set_tip (GtkWidget *
const gchar *tip)
{
GtkWidget *last;
-
++
if (!widget)
return NULL;
else if (!tip)
@@@ -879,6 -979,7 +973,7 @@@ table_max_bottom_row (GtkTable *table
{
guint max_bottom = 0;
GList *list;
-
++
for (list = table->children; list; list = list->next)
{
GtkTableChild *child = (GtkTableChild*) list->data;
@@@ -903,9 -1006,11 +1000,11 @@@ bst_gmask_pack (BstGMask *mask
gboolean dummy_aux2 = FALSE;
guint row, n, c, dislodge_columns;
GMask *gmask;
-
++
g_return_if_fail (GTK_IS_WIDGET (mask));
gmask = GMASK_GET (mask);
g_return_if_fail (gmask != NULL);
-
++
/* GUI mask layout:
* row: |Prompt|Aux1| Aux2 |Aux3| PreAction#Action#PostAction|
* FILL: allocate all possible (Pre/Post)Action space to the action widget
@@@ -913,6 -1018,7 +1012,7 @@@
* BIG: allocate maximum (left extendeded) possible space to Action
* Aux2 expands automatically
*/
-
++
/* retrieve children and set tips */
prompt = get_toplevel_and_set_tip (gmask->prompt, gmask->tip);
aux1 = get_toplevel_and_set_tip (gmask->aux1, gmask->tip);
@@@ -921,11 -1027,13 +1021,13 @@@
action = get_toplevel_and_set_tip (gmask->action, gmask->tip);
dislodge_columns = g_object_get_data (G_OBJECT (gmask->parent), "GMask-dislodge") != NULL;
table = GTK_TABLE (gmask->parent);
-
++
/* ensure expansion happens outside of columns */
if (dislodge_columns)
{
gchar *dummy_name = g_strdup_printf ("GMask-dummy-dislodge-%u", MAX (gmask->column, 1) - 1);
GtkWidget *dislodge = (GtkWidget*) g_object_get_data (G_OBJECT (table), dummy_name);
-
++
if (!dislodge)
{
dislodge = (GtkWidget*) g_object_new (GTK_TYPE_ALIGNMENT, "visible", TRUE, NULL);
@@@ -935,6 -1043,7 +1037,7 @@@
}
g_free (dummy_name);
}
-
++
/* pack gmask children, options: GTK_EXPAND, GTK_SHRINK, GTK_FILL */
gboolean span_multi_columns = aux2 && gmask->gpack == BST_GMASK_MULTI_SPAN;
c = span_multi_columns ? 0 : 6 * gmask->column;
@@@ -1066,8 -1178,11 +1172,11 @@@ bst_gmask_quick (GtkWidget *gmask_con
bst_gmask_set_tip (mask, tip_text);
bst_gmask_set_column (mask, column);
bst_gmask_pack (mask);
-
++
return mask;
}
+
+
/* --- named children --- */
static GQuark quark_container_named_children = 0;
typedef struct {
@@@ -1077,6 -1192,7 +1186,7 @@@ static voi
nchildren_free (gpointer data)
{
NChildren *children = (NChildren*) data;
-
++
g_datalist_clear (&children->qdata);
g_free (children);
}
@@@ -1091,13 -1207,16 +1201,16 @@@ bst_container_set_named_child (GtkWidge
GtkWidget *child)
{
NChildren *children;
-
++
g_return_if_fail (GTK_IS_CONTAINER (container));
g_return_if_fail (qname > 0);
g_return_if_fail (GTK_IS_WIDGET (child));
if (child)
g_return_if_fail (gtk_widget_is_ancestor (child, container));
-
++
if (!quark_container_named_children)
quark_container_named_children = g_quark_from_static_string ("BstContainer-named_children");
-
++
children = (NChildren*) g_object_get_qdata (G_OBJECT (container), quark_container_named_children);
if (!children)
{
@@@ -1116,12 -1236,15 +1230,15 @@@ bst_container_get_named_child (GtkWidge
GQuark qname)
{
NChildren *children;
-
++
g_return_val_if_fail (GTK_IS_CONTAINER (container), NULL);
g_return_val_if_fail (qname > 0, NULL);
-
++
children = quark_container_named_children ? (NChildren*) g_object_get_qdata (G_OBJECT (container),
quark_container_named_children) : NULL;
if (children)
{
GtkWidget *child = (GtkWidget*) g_datalist_id_get_data (&children->qdata, qname);
-
++
if (child && !gtk_widget_is_ancestor (child, container))
{
/* got removed meanwhile */
@@@ -1139,8 -1263,10 +1257,10 @@@ bst_xpm_view_create (const gchar **xpm
GtkWidget *pix;
GdkPixmap *pixmap;
GdkBitmap *mask;
-
++
g_return_val_if_fail (xpm != NULL, NULL);
g_return_val_if_fail (GTK_IS_WIDGET (colormap_widget), NULL);
-
++
pixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, gtk_widget_get_colormap (colormap_widget),
&mask, NULL, (gchar**) xpm);
pix = gtk_pixmap_new (pixmap, mask);
@@@ -1258,7 -1389,9 +1383,9 @@@ bst_file_scan_find_key (const gchar *fi
const gchar *value_prefix)
{
SfiRStore *rstore;
-
++
g_return_val_if_fail (file != NULL, NULL);
-
++
rstore = sfi_rstore_new_open (file);
if (rstore)
{
diff --cc beast-gtk/bstwaveeditor.cc
index 4906f41,5ec464d..a181637
--- a/beast-gtk/bstwaveeditor.cc
+++ b/beast-gtk/bstwaveeditor.cc
@@@ -53,6 -63,7 +63,7 @@@ GtkTyp
bst_wave_editor_get_type (void)
{
static GtkType wave_editor_type = 0;
-
++
if (!wave_editor_type)
{
GtkTypeInfo wave_editor_info =
@@@ -66,28 -77,37 +77,37 @@@
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
-
++
wave_editor_type = gtk_type_unique (GTK_TYPE_VBOX, &wave_editor_info);
}
-
++
return wave_editor_type;
}
+
static void
bst_wave_editor_class_init (BstWaveEditorClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
// GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
++
parent_class = g_type_class_peek_parent (klass);
+
gobject_class->finalize = bst_wave_editor_finalize;
+
object_class->destroy = bst_wave_editor_destroy;
}
+
static void
bst_wave_editor_init (BstWaveEditor *self)
{
GtkTreeSelection *tsel;
GtkWidget *any, *paned;
gpointer gmask;
-
++
/* setup main container */
self->main_vbox = GTK_WIDGET (self);
+
/* wave chunk list model */
self->chunk_wrapper = gxk_list_wrapper_new (N_COLS,
G_TYPE_STRING, /* COL_OSC_FREQ */
@@@ -493,12 -552,15 +552,15 @@@ GtkWidget
bst_wave_editor_new (SfiProxy wave)
{
GtkWidget *widget;
-
++
widget = gtk_widget_new (BST_TYPE_WAVE_EDITOR,
"visible", TRUE,
NULL);
bst_wave_editor_set_wave (BST_WAVE_EDITOR (widget), wave);
-
++
return widget;
}
+
static void
tree_selection_changed (BstWaveEditor *self,
GtkTreeSelection *tsel)
@@@ -519,6 -584,7 +584,7 @@@
mix_freq = g_strtod (mix_str, NULL);
g_free (osc_str);
g_free (mix_str);
-
++
esample = bse_wave_use_editable (self->wave, gxk_list_wrapper_get_index (self->chunk_wrapper, &iter));
bst_wave_editor_set_esample (self, esample);
bse_item_unuse (esample);
diff --cc beast-gtk/bstwaveview.cc
index 67cfb97,0cfc07a..6451287
--- a/beast-gtk/bstwaveview.cc
+++ b/beast-gtk/bstwaveview.cc
@@@ -55,11 -65,15 +65,15 @@@ GtkWidget
bst_wave_view_new (SfiProxy wrepo)
{
GtkWidget *wave_view;
-
++
g_return_val_if_fail (BSE_IS_WAVE_REPO (wrepo), NULL);
-
++
wave_view = gtk_widget_new (BST_TYPE_WAVE_VIEW, NULL);
bst_item_view_set_container (BST_ITEM_VIEW (wave_view), wrepo);
+
return wave_view;
}
+
static void
popup_wave_dialog (BstWaveView *wave_view)
{
diff --cc beast-gtk/bstxframe.cc
index 6f428c1,648a01d..c20cb50
--- a/beast-gtk/bstxframe.cc
+++ b/beast-gtk/bstxframe.cc
@@@ -46,6 -56,7 +56,7 @@@ bst_xframe_class_init (BstXFrameClass *
gobject_class->set_property = bst_xframe_set_property;
gobject_class->get_property = bst_xframe_get_property;
object_class->destroy = bst_xframe_destroy;
-
++
widget_class->size_allocate = bst_xframe_size_allocate;
widget_class->realize = bst_xframe_realize;
widget_class->unrealize = bst_xframe_unrealize;
@@@ -162,7 -188,9 +188,9 @@@ bst_xframe_realize (GtkWidget *widget
BstXFrame *xframe = BST_XFRAME (widget);
GdkWindowAttr attributes;
gint attributes_mask;
-
++
GTK_WIDGET_CLASS (bst_xframe_parent_class)->realize (widget);
+
attributes.window_type = GDK_WINDOW_CHILD;
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
@@@ -236,6 -282,7 +282,7 @@@ bst_xframe_enter_notify (GtkWidge
GdkEventCrossing *event)
{
BstXFrame *xframe = BST_XFRAME (widget);
-
++
if (GTK_WIDGET_IS_SENSITIVE (widget) &&
(!GTK_BIN (widget)->child || GTK_WIDGET_IS_SENSITIVE (GTK_BIN (widget)->child)))
{
diff --cc beast-gtk/bstxframe.hh
index a0bac01,6859428..d017905
--- a/beast-gtk/bstxframe.hh
+++ b/beast-gtk/bstxframe.hh
@@@ -30,6 -37,8 +37,8 @@@ struct _BstXFrameClas
gboolean (*button_check) (BstXFrame *xframe,
guint button);
};
-
++
+
GType bst_xframe_get_type (void);
void bst_xframe_set_cover_widget (BstXFrame *xframe,
GtkWidget *widget,
diff --cc beast-gtk/bstxkb.cc
index fb4af7d,82fddb5..ddca529
--- a/beast-gtk/bstxkb.cc
+++ b/beast-gtk/bstxkb.cc
@@@ -79,6 -96,7 +96,7 @@@ voi
bst_xkb_dump (void)
{
g_return_if_fail (bst_xkb_desc != NULL);
-
++
g_message ("XKB: keycodes: %s types: %s "
"symbols: %s phys_symbols: %s "
"geo-name: %s",
@@@ -87,6 -105,7 +105,7 @@@
bst_xkb_desc->names->symbols ? XGetAtomName (bst_xkb_display, bst_xkb_desc->names->symbols) :
"<>",
bst_xkb_desc->names->phys_symbols ? XGetAtomName (bst_xkb_display,
bst_xkb_desc->names->phys_symbols) : "<>",
bst_xkb_desc->geom->name ? XGetAtomName (bst_xkb_display, bst_xkb_desc->geom->name) : "<>");
-
++
/* Tim Janik <timj gtk org>:
* keycodes: xfree86 types: complete
* symbols: en_US(pc102)_de(nodeadkeys) phys_symbols: en_US(pc102)_de(nodeadkeys)
diff --cc beast-gtk/bstzoomedwindow.cc
index dbe33c9,74d2a0a..5934023
--- a/beast-gtk/bstzoomedwindow.cc
+++ b/beast-gtk/bstzoomedwindow.cc
@@@ -36,6 -45,7 +45,7 @@@ GtkTyp
bst_zoomed_window_get_type (void)
{
static GtkType zoomed_window_type = 0;
-
++
if (!zoomed_window_type)
{
GtkTypeInfo zoomed_window_info =
@@@ -49,26 -59,36 +59,36 @@@
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
-
++
zoomed_window_type = gtk_type_unique (GTK_TYPE_SCROLLED_WINDOW, &zoomed_window_info);
}
-
++
return zoomed_window_type;
}
+
static void
bst_zoomed_window_class_init (BstZoomedWindowClass *klass)
{
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
-
++
bst_zoomed_window_class = klass;
parent_class = g_type_class_peek_parent (klass);
-
++
G_OBJECT_CLASS (object_class)->finalize = bst_zoomed_window_finalize;
+
object_class->destroy = bst_zoomed_window_destroy;
-
++
widget_class->map = bst_zoomed_window_map;
widget_class->unmap = bst_zoomed_window_unmap;
widget_class->size_request = bst_zoomed_window_size_request;
widget_class->size_allocate = bst_zoomed_window_size_allocate;
-
++
container_class->forall = bst_zoomed_window_forall;
-
++
klass->zoom = NULL;
+
zoomed_window_signals[SIGNAL_ZOOM] =
gtk_signal_new ("zoom",
GTK_RUN_LAST,
@@@ -85,6 -107,7 +107,7 @@@ bst_zoomed_window_init (BstZoomedWindo
/* default construct */
gtk_scrolled_window_set_hadjustment (scrolled_window, NULL);
gtk_scrolled_window_set_vadjustment (scrolled_window, NULL);
-
++
gtk_widget_push_composite_child ();
zoomed_window->toggle_button = gtk_widget_new (GTK_TYPE_TOGGLE_BUTTON,
"visible", TRUE,
@@@ -117,8 -146,10 +146,10 @@@ static voi
bst_zoomed_window_map (GtkWidget *widget)
{
BstZoomedWindow *zoomed_window = BST_ZOOMED_WINDOW (widget);
-
++
/* chain parent class handler to map self and children */
GTK_WIDGET_CLASS (parent_class)->map (widget);
-
++
if (zoomed_window->toggle_button &&
GTK_WIDGET_VISIBLE (zoomed_window->toggle_button) &&
!GTK_WIDGET_MAPPED (zoomed_window->toggle_button))
@@@ -128,8 -160,10 +160,10 @@@ static voi
bst_zoomed_window_unmap (GtkWidget *widget)
{
BstZoomedWindow *zoomed_window = BST_ZOOMED_WINDOW (widget);
-
++
/* chain parent class handler to unmap self and children */
GTK_WIDGET_CLASS (parent_class)->unmap (widget);
-
++
if (zoomed_window->toggle_button &&
GTK_WIDGET_MAPPED (zoomed_window->toggle_button))
gtk_widget_unmap (zoomed_window->toggle_button);
@@@ -158,10 -198,12 +198,12 @@@ bst_zoomed_window_size_allocate (GtkWid
scrolled_window->vscrollbar && GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar))
{
GtkAllocation child_allocation;
-
++
child_allocation.x = scrolled_window->vscrollbar->allocation.x;
child_allocation.y = scrolled_window->hscrollbar->allocation.y;
child_allocation.width = scrolled_window->vscrollbar->allocation.width;
child_allocation.height = scrolled_window->hscrollbar->allocation.height;
-
++
gtk_widget_size_allocate (zoomed_window->toggle_button, &child_allocation);
gtk_widget_show (zoomed_window->toggle_button);
}
diff --cc beast-gtk/gxk/glewidgets.c
index 2734f5a,8bb6262..f3702b2
--- a/beast-gtk/gxk/glewidgets.c
+++ b/beast-gtk/gxk/glewidgets.c
@@@ -85,6 -95,7 +95,7 @@@ GtkTyp
gtk_wrap_box_get_type (void)
{
static GtkType wrap_box_type = 0;
-
++
if (!wrap_box_type)
{
static const GtkTypeInfo wrap_box_info =
@@@ -98,32 -109,42 +109,42 @@@
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
-
++
wrap_box_type = gtk_type_unique (GTK_TYPE_CONTAINER, &wrap_box_info);
}
-
++
return wrap_box_type;
}
+
static void
gtk_wrap_box_class_init (GtkWrapBoxClass *klass)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
-
++
object_class = GTK_OBJECT_CLASS (klass);
widget_class = GTK_WIDGET_CLASS (klass);
container_class = GTK_CONTAINER_CLASS (klass);
-
++
parent_gtkwrapbox_class = g_type_class_peek_parent (klass);
-
++
object_class->set_arg = gtk_wrap_box_set_arg;
object_class->get_arg = gtk_wrap_box_get_arg;
-
++
widget_class->map = gtk_wrap_box_map;
widget_class->unmap = gtk_wrap_box_unmap;
widget_class->expose_event = gtk_wrap_box_expose;
-
++
container_class->add = gtk_wrap_box_add;
container_class->remove = gtk_wrap_box_remove;
container_class->forall = gtk_wrap_box_forall;
container_class->child_type = gtk_wrap_box_child_type;
container_class->set_child_property = gtk_wrap_box_set_child_property;
container_class->get_child_property = gtk_wrap_box_get_child_property;
+
klass->rlist_line_children = NULL;
-
++
gtk_object_add_arg_type ("GtkWrapBox::homogeneous",
GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG__gtkwrapbox_HOMOGENEOUS);
gtk_object_add_arg_type ("GtkWrapBox::justify",
@@@ -169,6 -192,7 +192,7 @@@ static voi
gtk_wrap_box_init (GtkWrapBox *wbox)
{
GTK_WIDGET_SET_FLAGS (wbox, GTK_NO_WINDOW);
-
++
wbox->homogeneous = FALSE;
wbox->hspacing = 0;
wbox->vspacing = 0;
@@@ -185,6 -210,7 +210,7 @@@ gtk_wrap_box_set_arg (GtkObject *object
guint arg_id)
{
GtkWrapBox *wbox = GTK_WRAP_BOX (object);
-
++
switch (arg_id)
{
case ARG__gtkwrapbox_HOMOGENEOUS:
@@@ -221,6 -248,7 +248,7 @@@ gtk_wrap_box_get_arg (GtkObject *object
{
GtkWrapBox *wbox = GTK_WRAP_BOX (object);
GtkWidget *widget = GTK_WIDGET (object);
-
++
switch (arg_id)
{
case ARG__gtkwrapbox_HOMOGENEOUS:
@@@ -262,8 -291,10 +291,10 @@@ gtk_wrap_box_set_child_property (GtkCon
{
GtkWrapBox *wbox = GTK_WRAP_BOX (container);
gboolean hexpand = FALSE, hfill = FALSE, vexpand = FALSE, vfill = FALSE, wrapped = FALSE;
-
++
if (property_id != CHILD_PROP_POSITION)
gtk_wrap_box_query_child_packing (wbox, child, &hexpand, &hfill, &vexpand, &vfill, &wrapped);
-
++
switch (property_id)
{
case CHILD_PROP_POSITION:
@@@ -313,8 -345,10 +345,10 @@@ gtk_wrap_box_get_child_property (GtkCon
{
GtkWrapBox *wbox = GTK_WRAP_BOX (container);
gboolean hexpand = FALSE, hfill = FALSE, vexpand = FALSE, vfill = FALSE, wrapped = FALSE;
-
++
if (property_id != CHILD_PROP_POSITION)
gtk_wrap_box_query_child_packing (wbox, child, &hexpand, &hfill, &vexpand, &vfill, &wrapped);
-
++
switch (property_id)
{
GtkWrapBoxChild *child_info;
@@@ -359,6 -395,7 +395,7 @@@ gtk_wrap_box_set_homogeneous (GtkWrapBo
gboolean homogeneous)
{
g_return_if_fail (GTK_IS_WRAP_BOX (wbox));
-
++
homogeneous = homogeneous != FALSE;
if (wbox->homogeneous != homogeneous)
{
@@@ -371,6 -409,7 +409,7 @@@ gtk_wrap_box_set_hspacing (GtkWrapBox *
guint hspacing)
{
g_return_if_fail (GTK_IS_WRAP_BOX (wbox));
-
++
if (wbox->hspacing != hspacing)
{
wbox->hspacing = hspacing;
@@@ -382,6 -422,7 +422,7 @@@ gtk_wrap_box_set_vspacing (GtkWrapBox *
guint vspacing)
{
g_return_if_fail (GTK_IS_WRAP_BOX (wbox));
-
++
if (wbox->vspacing != vspacing)
{
wbox->vspacing = vspacing;
@@@ -394,6 -436,7 +436,7 @@@ gtk_wrap_box_set_justify (GtkWrapBo
{
g_return_if_fail (GTK_IS_WRAP_BOX (wbox));
g_return_if_fail (justify <= GTK_JUSTIFY_FILL);
-
++
if (wbox->justify != justify)
{
wbox->justify = justify;
@@@ -406,6 -450,7 +450,7 @@@ gtk_wrap_box_set_line_justify (GtkWrapB
{
g_return_if_fail (GTK_IS_WRAP_BOX (wbox));
g_return_if_fail (line_justify <= GTK_JUSTIFY_FILL);
-
++
if (wbox->line_justify != line_justify)
{
wbox->line_justify = line_justify;
@@@ -417,7 -463,9 +463,9 @@@ gtk_wrap_box_set_aspect_ratio (GtkWrapB
gfloat aspect_ratio)
{
g_return_if_fail (GTK_IS_WRAP_BOX (wbox));
-
++
aspect_ratio = CLAMP (aspect_ratio, 1.0 / 256.0, 256.0);
-
++
if (wbox->aspect_ratio != aspect_ratio)
{
wbox->aspect_ratio = aspect_ratio;
@@@ -447,9 -498,11 +498,11 @@@ gtk_wrap_box_pack_wrapped (GtkWrapBox *
gboolean wrapped)
{
GtkWrapBoxChild *child_info;
-
++
g_return_if_fail (GTK_IS_WRAP_BOX (wbox));
g_return_if_fail (GTK_IS_WIDGET (child));
g_return_if_fail (child->parent == NULL);
-
++
child_info = g_new (GtkWrapBoxChild, 1);
child_info->widget = child;
child_info->hexpand = hexpand ? TRUE : FALSE;
@@@ -461,6 -514,7 +514,7 @@@
if (wbox->children)
{
GtkWrapBoxChild *last = wbox->children;
-
++
while (last->next)
last = last->next;
last->next = child_info;
@@@ -468,13 -522,17 +522,17 @@@
else
wbox->children = child_info;
wbox->n_children++;
-
++
gtk_widget_set_parent (child, GTK_WIDGET (wbox));
-
++
if (GTK_WIDGET_REALIZED (wbox))
gtk_widget_realize (child);
-
++
if (GTK_WIDGET_VISIBLE (wbox) && GTK_WIDGET_VISIBLE (child))
{
if (GTK_WIDGET_MAPPED (wbox))
gtk_widget_map (child);
-
++
gtk_widget_queue_resize (child);
}
}
@@@ -484,18 -543,23 +543,23 @@@ gtk_wrap_box_reorder_child (GtkWrapBox
gint position)
{
GtkWrapBoxChild *child_info, *last = NULL;
-
++
g_return_if_fail (GTK_IS_WRAP_BOX (wbox));
g_return_if_fail (GTK_IS_WIDGET (child));
-
++
for (child_info = wbox->children; child_info; last = child_info, child_info = last->next)
if (child_info->widget == child)
break;
-
++
if (child_info && wbox->children->next)
{
GtkWrapBoxChild *tmp;
-
++
if (last)
last->next = child_info->next;
else
wbox->children = child_info->next;
-
++
last = NULL;
tmp = wbox->children;
while (position && tmp->next)
@@@ -504,6 -568,7 +568,7 @@@
last = tmp;
tmp = last->next;
}
-
++
if (position)
{
tmp->next = child_info;
@@@ -517,6 -582,7 +582,7 @@@
else
wbox->children = child_info;
}
-
++
if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (wbox))
gtk_widget_queue_resize (child);
}
@@@ -531,11 -598,14 +598,14 @@@ gtk_wrap_box_query_child_packing (GtkWr
gboolean *wrapped)
{
GtkWrapBoxChild *child_info;
-
++
g_return_if_fail (GTK_IS_WRAP_BOX (wbox));
g_return_if_fail (GTK_IS_WIDGET (child));
-
++
for (child_info = wbox->children; child_info; child_info = child_info->next)
if (child_info->widget == child)
break;
-
++
if (child_info)
{
if (hexpand)
@@@ -560,8 -631,10 +631,10 @@@ gtk_wrap_box_set_child_packing (GtkWrap
gboolean wrapped)
{
GtkWrapBoxChild *child_info;
-
++
g_return_if_fail (GTK_IS_WRAP_BOX (wbox));
g_return_if_fail (GTK_IS_WIDGET (child));
-
++
hexpand = hexpand != FALSE;
hfill = hfill != FALSE;
vexpand = vexpand != FALSE;
@@@ -570,6 -644,7 +644,7 @@@
for (child_info = wbox->children; child_info; child_info = child_info->next)
if (child_info->widget == child)
break;
-
++
if (child_info &&
(child_info->hexpand != hexpand || child_info->vexpand != vexpand ||
child_info->hfill != hfill || child_info->vfill != vfill ||
@@@ -580,6 -655,7 +655,7 @@@
child_info->vexpand = vexpand;
child_info->vfill = vfill;
child_info->wrapped = wrapped;
-
++
if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (wbox))
gtk_widget_queue_resize (child);
}
@@@ -629,7 -714,9 +714,9 @@@ gtk_wrap_box_map (GtkWidget *widget
{
GtkWrapBox *wbox = GTK_WRAP_BOX (widget);
GtkWrapBoxChild *child;
-
++
GTK_WIDGET_SET_FLAGS (wbox, GTK_MAPPED);
-
++
for (child = wbox->children; child; child = child->next)
if (GTK_WIDGET_VISIBLE (child->widget) &&
!GTK_WIDGET_MAPPED (child->widget))
@@@ -640,7 -728,9 +728,9 @@@ gtk_wrap_box_unmap (GtkWidget *widget
{
GtkWrapBox *wbox = GTK_WRAP_BOX (widget);
GtkWrapBoxChild *child;
-
++
GTK_WIDGET_UNSET_FLAGS (wbox, GTK_MAPPED);
-
++
for (child = wbox->children; child; child = child->next)
if (GTK_WIDGET_VISIBLE (child->widget) &&
GTK_WIDGET_MAPPED (child->widget))
@@@ -664,24 -757,30 +757,30 @@@ gtk_wrap_box_remove (GtkContainer *cont
{
GtkWrapBox *wbox = GTK_WRAP_BOX (container);
GtkWrapBoxChild *child, *last = NULL;
-
++
child = wbox->children;
while (child)
{
if (child->widget == widget)
{
gboolean was_visible;
-
++
was_visible = GTK_WIDGET_VISIBLE (widget);
gtk_widget_unparent (widget);
-
++
if (last)
last->next = child->next;
else
wbox->children = child->next;
g_free (child);
wbox->n_children--;
-
++
if (was_visible)
gtk_widget_queue_resize (GTK_WIDGET (container));
-
++
break;
}
-
++
last = child;
child = last->next;
}
@@@ -694,11 -794,14 +794,14 @@@ gtk_wrap_box_forall (GtkContainer *cont
{
GtkWrapBox *wbox = GTK_WRAP_BOX (container);
GtkWrapBoxChild *child;
-
++
child = wbox->children;
while (child)
{
GtkWidget *widget = child->widget;
-
++
child = child->next;
-
++
callback (widget, callback_data);
}
}
@@@ -744,6 -853,7 +853,7 @@@ GtkTyp
gtk_hwrap_box_get_type (void)
{
static GtkType hwrap_box_type = 0;
-
++
if (!hwrap_box_type)
{
static const GtkTypeInfo hwrap_box_info =
@@@ -757,10 -867,13 +867,13 @@@
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
-
++
hwrap_box_type = gtk_type_unique (GTK_TYPE_WRAP_BOX, &hwrap_box_info);
}
-
++
return hwrap_box_type;
}
+
static void
gtk_hwrap_box_class_init (GtkHWrapBoxClass *klass)
{
@@@ -768,15 -881,20 +881,20 @@@
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
GtkWrapBoxClass *wrap_box_class;
-
++
object_class = GTK_OBJECT_CLASS (klass);
widget_class = GTK_WIDGET_CLASS (klass);
container_class = GTK_CONTAINER_CLASS (klass);
wrap_box_class = GTK_WRAP_BOX_CLASS (klass);
-
++
parent_gtkhwrapbox_class = gtk_type_class (GTK_TYPE_WRAP_BOX);
-
++
widget_class->size_request = gtk_hwrap_box_size_request;
widget_class->size_allocate = gtk_hwrap_box_size_allocate;
+
wrap_box_class->rlist_line_children = reverse_list_row_children;
}
+
static void
gtk_hwrap_box_init (GtkHWrapBox *hwbox)
{
@@@ -799,6 -922,7 +922,7 @@@ get_gtkhwrapbox_child_requisition (GtkW
if (wbox->homogeneous)
{
GtkHWrapBox *hwbox = GTK_HWRAP_BOX (wbox);
-
++
child_requisition->width = hwbox->max_child_width;
child_requisition->height = hwbox->max_child_height;
}
@@@ -813,23 -938,29 +938,29 @@@ _gtk_hwrap_box_size_request (GtkWidge
GtkWrapBox *wbox = GTK_WRAP_BOX (widget);
GtkWrapBoxChild *child;
guint area = 0;
-
++
g_return_if_fail (requisition != NULL);
-
++
/*<h2v-off>*/
requisition->width = 0;
requisition->height = 0;
this->max_child_width = 0;
this->max_child_height = 0;
-
++
for (child = wbox->children; child; child = child->next)
if (GTK_WIDGET_VISIBLE (child->widget))
{
GtkRequisition child_requisition;
-
++
gtk_widget_size_request (child->widget, &child_requisition);
-
++
area += child_requisition.width * child_requisition.height;
this->max_child_width = MAX (this->max_child_width, child_requisition.width);
this->max_child_height = MAX (this->max_child_height, child_requisition.height);
}
if (wbox->homogeneous)
area = this->max_child_width * this->max_child_height * wbox->n_children;
-
++
if (area)
{
requisition->width = sqrt (area * wbox->aspect_ratio);
@@@ -840,6 -971,7 +971,7 @@@
requisition->width = 0;
requisition->height = 0;
}
-
++
requisition->width += GTK_CONTAINER (wbox)->border_width * 2;
requisition->height += GTK_CONTAINER (wbox)->border_width * 2;
/*<h2v-on>*/
@@@ -885,10 -1022,13 +1022,13 @@@ get_gtkhwrapbox_layout_size (GtkHWrapBo
total_height += (n_rows ? wbox->vspacing : 0) + row_height;
n_rows++;
}
+
if (*width_inc > this->max_child_width)
*width_inc = 0;
-
++
return MAX (total_height, 1);
}
+
static void
gtk_hwrap_box_size_request (GtkWidget *widget,
GtkRequisition *requisition)
@@@ -898,7 -1038,9 +1038,9 @@@
GtkWrapBoxChild *child;
gfloat ratio_dist, layout_width = 0;
guint row_inc = 0;
-
++
g_return_if_fail (requisition != NULL);
-
++
requisition->width = 0;
requisition->height = 0;
this->max_child_width = 0;
@@@ -908,7 -1051,9 +1051,9 @@@
if (GTK_WIDGET_VISIBLE (child->widget))
{
GtkRequisition child_requisition;
-
++
gtk_widget_size_request (child->widget, &child_requisition);
+
this->max_child_width = MAX (this->max_child_width, child_requisition.width);
this->max_child_height = MAX (this->max_child_height, child_requisition.height);
}
@@@ -929,6 -1076,7 +1076,7 @@@
requisition->width = layout_width;
requisition->height = layout_height;
}
-
++
/* g_print ("ratio for width %d height %d = %f\n",
(gint) layout_width,
(gint) layout_height,
@@@ -953,17 -1103,21 +1103,21 @@@ reverse_list_row_children (GtkWrapBo
GSList *slist = NULL;
guint width = 0, row_width = area->width;
GtkWrapBoxChild *child = *child_p;
-
++
*max_child_size = 0;
*expand_line = FALSE;
-
++
while (child && !GTK_WIDGET_VISIBLE (child->widget))
{
*child_p = child->next;
child = *child_p;
}
-
++
if (child)
{
GtkRequisition child_requisition;
guint n = 1;
-
++
get_gtkhwrapbox_child_requisition (wbox, child->widget, &child_requisition);
width += child_requisition.width;
*max_child_size = MAX (*max_child_size, child_requisition.height);
@@@ -971,6 -1125,7 +1125,7 @@@
slist = g_slist_prepend (slist, child);
*child_p = child->next;
child = *child_p;
-
++
while (child && n < wbox->child_limit)
{
if (GTK_WIDGET_VISIBLE (child->widget))
@@@ -989,8 -1144,10 +1144,10 @@@
child = *child_p;
}
}
-
++
return slist;
}
+
static void
layout_row (GtkWrapBox *wbox,
GtkAllocation *area,
@@@ -1003,22 -1160,27 +1160,27 @@@
gint total_width = 0;
gfloat x, width, extra;
GtkAllocation child_allocation;
-
++
for (slist = children; slist; slist = slist->next)
{
GtkWrapBoxChild *child = slist->data;
GtkRequisition child_requisition;
-
++
n_children++;
if (child->hexpand)
n_expand_children++;
-
++
get_gtkhwrapbox_child_requisition (wbox, child->widget, &child_requisition);
total_width += child_requisition.width;
}
-
++
width = MAX (1, area->width - (n_children - 1) * wbox->hspacing);
if (width > total_width)
extra = width - total_width;
else
extra = 0;
have_expand_children = n_expand_children && extra;
-
++
x = area->x;
if (wbox->homogeneous)
{
@@@ -1058,10 -1220,12 +1220,12 @@@
extra = 0;
}
}
-
++
n_children = 0;
for (slist = children; slist; slist = slist->next)
{
GtkWrapBoxChild *child = slist->data;
-
++
child_allocation.x = x;
child_allocation.y = area->y;
if (wbox->homogeneous)
@@@ -1073,7 -1237,9 +1237,9 @@@
else
{
GtkRequisition child_requisition;
-
++
get_gtkhwrapbox_child_requisition (wbox, child->widget, &child_requisition);
-
++
if (child_requisition.height >= area->height)
child_allocation.height = area->height;
else
@@@ -1086,12 -1252,14 +1252,14 @@@
else if (wbox->line_justify == GTK_JUSTIFY_BOTTOM)
child_allocation.y += area->height - child_requisition.height;
}
-
++
if (have_expand_children)
{
child_allocation.width = child_requisition.width;
if (child->hexpand || wbox->justify == GTK_JUSTIFY_FILL)
{
guint space;
-
++
n_expand_children--;
space = extra * n_expand_children;
space = width - space;
@@@ -1116,6 -1284,7 +1284,7 @@@
area->width - child_allocation.x + area->x);
}
}
-
++
x += child_allocation.width + wbox->hspacing;
gtk_widget_size_allocate (child->widget, &child_allocation);
n_children++;
@@@ -1141,6 -1312,7 +1312,7 @@@ layout_rows (GtkWrapBox *wbox
guint total_height = 0, n_expand_lines = 0, n_lines = 0;
gfloat shrink_height;
guint children_per_line;
-
++
next_child = wbox->children;
slist = GTK_WRAP_BOX_GET_CLASS (wbox)->rlist_line_children (wbox,
&next_child,
@@@ -1152,6 -1325,7 +1325,7 @@@
while (slist)
{
Line_gtkhwrapbox_ *line = g_new (Line_gtkhwrapbox_, 1);
-
++
line->children = slist;
line->min_size = min_height;
total_height += min_height;
@@@ -1161,6 -1335,7 +1335,7 @@@
line->next = line_list;
line_list = line;
n_lines++;
-
++
slist = GTK_WRAP_BOX_GET_CLASS (wbox)->rlist_line_children (wbox,
&next_child,
area,
@@@ -1168,14 -1343,17 +1343,17 @@@
&vexpand);
slist = g_slist_reverse (slist);
}
-
++
if (total_height > area->height)
shrink_height = total_height - area->height;
else
shrink_height = 0;
-
++
if (1) /* reverse lines and shrink */
{
Line_gtkhwrapbox_ *prev = NULL, *last = NULL;
gfloat n_shrink_lines = n_lines;
-
++
while (line_list)
{
Line_gtkhwrapbox_ *tmp = line_list->next;
@@@ -1202,12 -1383,15 +1383,15 @@@
}
line_list = last;
}
-
++
if (n_lines)
{
Line_gtkhwrapbox_ *line;
gfloat y, height, extra = 0;
-
++
height = area->height;
height = MAX (n_lines, height - (n_lines - 1) * wbox->vspacing);
-
++
if (wbox->homogeneous)
height /= ((gdouble) n_lines);
else if (n_expand_lines)
@@@ -1217,12 -1401,14 +1401,14 @@@
}
else
height = 0;
-
++
y = area->y;
line = line_list;
while (line)
{
GtkAllocation row_allocation;
Line_gtkhwrapbox_ *next_line = line->next;
-
++
row_allocation.x = area->x;
row_allocation.width = area->width;
if (wbox->homogeneous)
@@@ -1230,10 -1416,13 +1416,13 @@@
else
{
row_allocation.height = line->min_size;
-
++
if (line->expand)
row_allocation.height += extra;
}
-
++
row_allocation.y = y;
-
++
y += row_allocation.height + wbox->vspacing;
layout_row (wbox,
&row_allocation,
@@@ -1253,17 -1444,20 +1444,20 @@@ gtk_hwrap_box_size_allocate (GtkWidge
GtkWrapBox *wbox = GTK_WRAP_BOX (widget);
GtkAllocation area;
gint border = GTK_CONTAINER (wbox)->border_width; /*<h2v-skip>*/
-
++
widget->allocation = *allocation;
area.x = allocation->x + border;
area.y = allocation->y + border;
area.width = MAX (1, (gint) allocation->width - border * 2);
area.height = MAX (1, (gint) allocation->height - border * 2);
-
++
/*<h2v-off>*/
/* g_print ("got: width %d, height %d\n",
allocation->width,
allocation->height);
*/
/*<h2v-on>*/
-
++
layout_rows (wbox, &area);
}
/* GTK - The GIMP Toolkit
@@@ -1308,6 -1508,7 +1508,7 @@@ GtkTyp
gtk_vwrap_box_get_type (void)
{
static GtkType vwrap_box_type = 0;
-
++
if (!vwrap_box_type)
{
static const GtkTypeInfo vwrap_box_info =
@@@ -1321,10 -1522,13 +1522,13 @@@
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
-
++
vwrap_box_type = gtk_type_unique (GTK_TYPE_WRAP_BOX, &vwrap_box_info);
}
-
++
return vwrap_box_type;
}
+
static void
gtk_vwrap_box_class_init (GtkVWrapBoxClass *klass)
{
@@@ -1332,15 -1536,20 +1536,20 @@@
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
GtkWrapBoxClass *wrap_box_class;
-
++
object_class = GTK_OBJECT_CLASS (klass);
widget_class = GTK_WIDGET_CLASS (klass);
container_class = GTK_CONTAINER_CLASS (klass);
wrap_box_class = GTK_WRAP_BOX_CLASS (klass);
-
++
parent_gtkvwrapbox_class = gtk_type_class (GTK_TYPE_WRAP_BOX);
-
++
widget_class->size_request = gtk_vwrap_box_size_request;
widget_class->size_allocate = gtk_vwrap_box_size_allocate;
+
wrap_box_class->rlist_line_children = reverse_list_col_children;
}
+
static void
gtk_vwrap_box_init (GtkVWrapBox *vwbox)
{
@@@ -1363,6 -1577,7 +1577,7 @@@ get_gtkvwrapbox_child_requisition (GtkW
if (wbox->homogeneous)
{
GtkVWrapBox *vwbox = GTK_VWRAP_BOX (wbox);
-
++
child_requisition->height = vwbox->max_child_height;
child_requisition->width = vwbox->max_child_width;
}
@@@ -1377,23 -1593,29 +1593,29 @@@ _gtk_vwrap_box_size_request (GtkWidge
GtkWrapBox *wbox = GTK_WRAP_BOX (widget);
GtkWrapBoxChild *child;
guint area = 0;
-
++
g_return_if_fail (requisition != NULL);
-
++
/*<h2v-off>*/
requisition->width = 0;
requisition->height = 0;
this->max_child_width = 0;
this->max_child_height = 0;
-
++
for (child = wbox->children; child; child = child->next)
if (GTK_WIDGET_VISIBLE (child->widget))
{
GtkRequisition child_requisition;
-
++
gtk_widget_size_request (child->widget, &child_requisition);
-
++
area += child_requisition.width * child_requisition.height;
this->max_child_width = MAX (this->max_child_width, child_requisition.width);
this->max_child_height = MAX (this->max_child_height, child_requisition.height);
}
if (wbox->homogeneous)
area = this->max_child_width * this->max_child_height * wbox->n_children;
-
++
if (area)
{
requisition->width = sqrt (area * wbox->aspect_ratio);
@@@ -1404,6 -1626,7 +1626,7 @@@
requisition->width = 0;
requisition->height = 0;
}
-
++
requisition->width += GTK_CONTAINER (wbox)->border_width * 2;
requisition->height += GTK_CONTAINER (wbox)->border_width * 2;
/*<h2v-on>*/
@@@ -1449,10 -1677,13 +1677,13 @@@ get_gtkvwrapbox_layout_size (GtkVWrapBo
total_width += (n_cols ? wbox->hspacing : 0) + col_width;
n_cols++;
}
+
if (*height_inc > this->max_child_height)
*height_inc = 0;
-
++
return MAX (total_width, 1);
}
+
static void
gtk_vwrap_box_size_request (GtkWidget *widget,
GtkRequisition *requisition)
@@@ -1462,7 -1693,9 +1693,9 @@@
GtkWrapBoxChild *child;
gfloat ratio_dist, layout_height = 0;
guint col_inc = 0;
-
++
g_return_if_fail (requisition != NULL);
-
++
requisition->height = 0;
requisition->width = 0;
this->max_child_height = 0;
@@@ -1472,7 -1706,9 +1706,9 @@@
if (GTK_WIDGET_VISIBLE (child->widget))
{
GtkRequisition child_requisition;
-
++
gtk_widget_size_request (child->widget, &child_requisition);
+
this->max_child_height = MAX (this->max_child_height, child_requisition.height);
this->max_child_width = MAX (this->max_child_width, child_requisition.width);
}
@@@ -1493,6 -1731,7 +1731,7 @@@
requisition->height = layout_height;
requisition->width = layout_width;
}
-
++
/* g_print ("ratio for height %d width %d = %f\n",
(gint) layout_height,
(gint) layout_width,
@@@ -1517,17 -1758,21 +1758,21 @@@ reverse_list_col_children (GtkWrapBo
GSList *slist = NULL;
guint height = 0, col_height = area->height;
GtkWrapBoxChild *child = *child_p;
-
++
*max_child_size = 0;
*expand_line = FALSE;
-
++
while (child && !GTK_WIDGET_VISIBLE (child->widget))
{
*child_p = child->next;
child = *child_p;
}
-
++
if (child)
{
GtkRequisition child_requisition;
guint n = 1;
-
++
get_gtkvwrapbox_child_requisition (wbox, child->widget, &child_requisition);
height += child_requisition.height;
*max_child_size = MAX (*max_child_size, child_requisition.width);
@@@ -1535,6 -1780,7 +1780,7 @@@
slist = g_slist_prepend (slist, child);
*child_p = child->next;
child = *child_p;
-
++
while (child && n < wbox->child_limit)
{
if (GTK_WIDGET_VISIBLE (child->widget))
@@@ -1553,8 -1799,10 +1799,10 @@@
child = *child_p;
}
}
-
++
return slist;
}
+
static void
layout_col (GtkWrapBox *wbox,
GtkAllocation *area,
@@@ -1567,22 -1815,27 +1815,27 @@@
gint total_height = 0;
gfloat y, height, extra;
GtkAllocation child_allocation;
-
++
for (slist = children; slist; slist = slist->next)
{
GtkWrapBoxChild *child = slist->data;
GtkRequisition child_requisition;
-
++
n_children++;
if (child->vexpand)
n_expand_children++;
-
++
get_gtkvwrapbox_child_requisition (wbox, child->widget, &child_requisition);
total_height += child_requisition.height;
}
-
++
height = MAX (1, area->height - (n_children - 1) * wbox->vspacing);
if (height > total_height)
extra = height - total_height;
else
extra = 0;
have_expand_children = n_expand_children && extra;
-
++
y = area->y;
if (wbox->homogeneous)
{
@@@ -1622,10 -1875,12 +1875,12 @@@
extra = 0;
}
}
-
++
n_children = 0;
for (slist = children; slist; slist = slist->next)
{
GtkWrapBoxChild *child = slist->data;
-
++
child_allocation.y = y;
child_allocation.x = area->x;
if (wbox->homogeneous)
@@@ -1637,7 -1892,9 +1892,9 @@@
else
{
GtkRequisition child_requisition;
-
++
get_gtkvwrapbox_child_requisition (wbox, child->widget, &child_requisition);
-
++
if (child_requisition.width >= area->width)
child_allocation.width = area->width;
else
@@@ -1650,12 -1907,14 +1907,14 @@@
else if (wbox->line_justify == GTK_JUSTIFY_BOTTOM)
child_allocation.x += area->width - child_requisition.width;
}
-
++
if (have_expand_children)
{
child_allocation.height = child_requisition.height;
if (child->vexpand || wbox->justify == GTK_JUSTIFY_FILL)
{
guint space;
-
++
n_expand_children--;
space = extra * n_expand_children;
space = height - space;
@@@ -1680,6 -1939,7 +1939,7 @@@
area->height - child_allocation.y + area->y);
}
}
-
++
y += child_allocation.height + wbox->vspacing;
gtk_widget_size_allocate (child->widget, &child_allocation);
n_children++;
@@@ -1705,6 -1967,7 +1967,7 @@@ layout_cols (GtkWrapBox *wbox
guint total_width = 0, n_expand_lines = 0, n_lines = 0;
gfloat shrink_width;
guint children_per_line;
-
++
next_child = wbox->children;
slist = GTK_WRAP_BOX_GET_CLASS (wbox)->rlist_line_children (wbox,
&next_child,
@@@ -1716,6 -1980,7 +1980,7 @@@
while (slist)
{
Line_gtkvwrapbox_ *line = g_new (Line_gtkvwrapbox_, 1);
-
++
line->children = slist;
line->min_size = min_width;
total_width += min_width;
@@@ -1725,6 -1990,7 +1990,7 @@@
line->next = line_list;
line_list = line;
n_lines++;
-
++
slist = GTK_WRAP_BOX_GET_CLASS (wbox)->rlist_line_children (wbox,
&next_child,
area,
@@@ -1732,14 -1998,17 +1998,17 @@@
&hexpand);
slist = g_slist_reverse (slist);
}
-
++
if (total_width > area->width)
shrink_width = total_width - area->width;
else
shrink_width = 0;
-
++
if (1) /* reverse lines and shrink */
{
Line_gtkvwrapbox_ *prev = NULL, *last = NULL;
gfloat n_shrink_lines = n_lines;
-
++
while (line_list)
{
Line_gtkvwrapbox_ *tmp = line_list->next;
@@@ -1766,12 -2038,15 +2038,15 @@@
}
line_list = last;
}
-
++
if (n_lines)
{
Line_gtkvwrapbox_ *line;
gfloat x, width, extra = 0;
-
++
width = area->width;
width = MAX (n_lines, width - (n_lines - 1) * wbox->hspacing);
-
++
if (wbox->homogeneous)
width /= ((gdouble) n_lines);
else if (n_expand_lines)
@@@ -1781,12 -2056,14 +2056,14 @@@
}
else
width = 0;
-
++
x = area->x;
line = line_list;
while (line)
{
GtkAllocation col_allocation;
Line_gtkvwrapbox_ *next_line = line->next;
-
++
col_allocation.y = area->y;
col_allocation.height = area->height;
if (wbox->homogeneous)
@@@ -1794,10 -2071,13 +2071,13 @@@
else
{
col_allocation.width = line->min_size;
-
++
if (line->expand)
col_allocation.width += extra;
}
-
++
col_allocation.x = x;
-
++
x += col_allocation.width + wbox->hspacing;
layout_col (wbox,
&col_allocation,
@@@ -1817,16 -2099,19 +2099,19 @@@ gtk_vwrap_box_size_allocate (GtkWidge
GtkWrapBox *wbox = GTK_WRAP_BOX (widget);
GtkAllocation area;
gint border = GTK_CONTAINER (wbox)->border_width; /*<h2v-skip>*/
-
++
widget->allocation = *allocation;
area.y = allocation->y + border;
area.x = allocation->x + border;
area.height = MAX (1, (gint) allocation->height - border * 2);
area.width = MAX (1, (gint) allocation->width - border * 2);
-
++
/*<h2v-off>*/
/* g_print ("got: width %d, height %d\n",
allocation->width,
allocation->height);
*/
/*<h2v-on>*/
-
++
layout_cols (wbox, &area);
}
diff --cc beast-gtk/gxk/glewidgets.h
index 49fb940,663b5f7..0812841
--- a/beast-gtk/gxk/glewidgets.h
+++ b/beast-gtk/gxk/glewidgets.h
@@@ -47,6 -57,7 +57,7 @@@ typedef struct _GtkWrapBoxChild GtkWrap
struct _GtkWrapBox
{
GtkContainer container;
-
++
guint homogeneous : 1;
guint justify : 4;
guint line_justify : 4;
@@@ -74,6 -86,7 +86,7 @@@ struct _GtkWrapBoxChil
guint vexpand : 1;
guint vfill : 1;
guint wrapped : 1;
-
++
GtkWrapBoxChild *next;
};
#define GTK_JUSTIFY_TOP GTK_JUSTIFY_LEFT
@@@ -169,6 -199,7 +199,7 @@@ typedef struct _GtkHWrapBoxClass GtkHWr
struct _GtkHWrapBox
{
GtkWrapBox parent_widget;
-
++
/*<h2v-off>*/
guint max_child_width;
guint max_child_height;
@@@ -226,6 -274,7 +274,7 @@@ typedef struct _GtkVWrapBoxClass GtkVWr
struct _GtkVWrapBox
{
GtkWrapBox parent_widget;
-
++
/*<h2v-off>*/
guint max_child_width;
guint max_child_height;
diff --cc beast-gtk/gxk/gxkaction.cc
index ca2b473,f739ef0..766c40a
--- a/beast-gtk/gxk/gxkaction.cc
+++ b/beast-gtk/gxk/gxkaction.cc
@@@ -427,6 -467,7 +467,7 @@@ window_remove_action_link (ActionLink *
{
GtkWidget *window = alink->toplevel;
g_return_if_fail (GTK_IS_WIDGET (alink->toplevel));
-
++
ActionLink *last = NULL, *anode = (ActionLink*) g_object_get_qdata ((GObject*) window,
quark_action_links);
for (; anode; last = anode, anode = last->next)
if (anode == alink)
diff --cc beast-gtk/gxk/gxkcanvas.cc
index 03ac179,0df98cb..6446a8f
--- a/beast-gtk/gxk/gxkcanvas.cc
+++ b/beast-gtk/gxk/gxkcanvas.cc
@@@ -7,15 -9,19 +9,19 @@@ gnome_canvas_points_new0 (guint num_poi
{
GnomeCanvasPoints *points;
guint i;
-
++
g_return_val_if_fail (num_points > 1, NULL);
-
++
points = gnome_canvas_points_new (num_points);
for (i = 0; i < num_points; i++)
{
points->coords[i] = 0;
points->coords[i + num_points] = 0;
}
-
++
return points;
}
+
GnomeCanvasPoints*
gnome_canvas_points_newv (guint num_points,
...)
@@@ -23,14 -29,18 +29,18 @@@
GnomeCanvasPoints *points;
guint i;
va_list args;
-
++
g_return_val_if_fail (num_points > 1, NULL);
-
++
va_start (args, num_points);
points = gnome_canvas_points_new (num_points);
for (i = 0; i < num_points * 2; i++)
points->coords[i] = va_arg (args, gdouble);
va_end (args);
-
++
return points;
}
+
GnomeCanvasItem*
gnome_canvas_typed_item_at (GnomeCanvas *canvas,
GtkType item_type,
@@@ -38,12 -48,16 +48,16 @@@
gdouble world_y)
{
GnomeCanvasItem *item;
-
++
g_return_val_if_fail (GNOME_IS_CANVAS (canvas), NULL);
-
++
item = gnome_canvas_get_item_at (canvas, world_x, world_y);
while (item && !g_type_is_a (GTK_OBJECT_TYPE (item), item_type))
item = item->parent;
-
++
return item && g_type_is_a (GTK_OBJECT_TYPE (item), item_type) ? item : NULL;
}
+
gboolean
gnome_canvas_item_check_undisposed (GnomeCanvasItem *item)
{
@@@ -66,11 -81,13 +81,13 @@@ guin
gnome_canvas_item_get_stacking (GnomeCanvasItem *item)
{
g_return_val_if_fail (GNOME_IS_CANVAS_ITEM (item), 0);
-
++
if (item->parent)
{
GnomeCanvasGroup *parent = GNOME_CANVAS_GROUP (item->parent);
GList *list;
guint pos = 0;
-
++
for (list = parent->item_list; list; list = list->next)
{
if (list->data == item)
@@@ -78,8 -95,10 +95,10 @@@
pos++;
}
}
-
++
return 0;
}
+
void
gnome_canvas_item_keep_between (GnomeCanvasItem *between,
GnomeCanvasItem *item1,
@@@ -88,11 -107,13 +107,13 @@@
g_return_if_fail (GNOME_IS_CANVAS_ITEM (between));
g_return_if_fail (GNOME_IS_CANVAS_ITEM (item1));
g_return_if_fail (GNOME_IS_CANVAS_ITEM (item2));
-
++
if (between->parent && item1->parent && item2->parent)
{
if (item1->parent == between->parent && item2->parent == between->parent)
{
guint n, i, z;
-
++
n = gnome_canvas_item_get_stacking (item1);
i = gnome_canvas_item_get_stacking (item2);
z = gnome_canvas_item_get_stacking (between);
@@@ -114,11 -136,13 +136,13 @@@ gnome_canvas_item_keep_above (GnomeCanv
g_return_if_fail (GNOME_IS_CANVAS_ITEM (above));
g_return_if_fail (GNOME_IS_CANVAS_ITEM (item1));
g_return_if_fail (GNOME_IS_CANVAS_ITEM (item2));
-
++
if (above->parent && item1->parent && item2->parent)
{
if (item1->parent == above->parent && item2->parent == above->parent)
{
guint n, i, z;
-
++
n = gnome_canvas_item_get_stacking (item1);
i = gnome_canvas_item_get_stacking (item2);
z = gnome_canvas_item_get_stacking (above);
@@@ -190,8 -220,10 +220,10 @@@ gnome_canvas_FIXME_hard_update (GnomeCa
{
return;
g_return_if_fail (GNOME_IS_CANVAS (canvas));
-
++
/* _first_ recalc bounds of already queued items */
gnome_canvas_update_now (canvas);
-
++
/* just requeueing an update doesn't suffice for rect-ellipses,
* re-translating the root-item is good enough though.
*/
diff --cc beast-gtk/gxk/gxkcellrendererpopup.cc
index 5719628,0083c67..1d5f687
--- a/beast-gtk/gxk/gxkcellrendererpopup.cc
+++ b/beast-gtk/gxk/gxkcellrendererpopup.cc
@@@ -59,6 -68,7 +68,7 @@@ GTyp
gxk_cell_renderer_popup_get_type (void)
{
static GType type = 0;
-
++
if (!type)
{
static const GTypeInfo type_info = {
@@@ -72,6 -82,7 +82,7 @@@
0, /* n_preallocs */
(GInstanceInitFunc) gxk_cell_renderer_popup_init,
};
-
++
type = g_type_register_static (GTK_TYPE_CELL_RENDERER_TEXT,
"GxkCellRendererPopup",
&type_info, GTypeFlags (0));
@@@ -83,12 -95,16 +95,16 @@@ gxk_cell_renderer_popup_class_init (Gxk
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass);
+
parent_class = g_type_class_peek_parent (klass);
+
object_class->get_property = gxk_cell_renderer_popup_get_property;
object_class->set_property = gxk_cell_renderer_popup_set_property;
-
++
cell_class->get_size = gxk_cell_renderer_popup_get_size;
cell_class->render = gxk_cell_renderer_popup_render;
cell_class->start_editing = gxk_cell_renderer_popup_start_editing;
-
++
g_object_class_install_property (object_class,
PROP_TEXT_EDITING,
g_param_spec_boolean ("text-editing", "Text Editing", "Whether the text is
directly editable",
@@@ -127,6 -145,7 +145,7 @@@ gxk_cell_renderer_popup_set_property (G
GParamSpec *pspec)
{
GxkCellRendererPopup *self = GXK_CELL_RENDERER_POPUP (object);
-
++
switch (param_id)
{
case PROP_TEXT_EDITING:
@@@ -150,6 -170,7 +170,7 @@@ gxk_cell_renderer_popup_get_property (G
GParamSpec *pspec)
{
GxkCellRendererPopup *self = GXK_CELL_RENDERER_POPUP (object);
-
++
switch (param_id)
{
case PROP_TEXT_EDITING:
@@@ -455,6 -499,7 +499,7 @@@ GTyp
gxk_proxy_editable_get_type (void)
{
static GType type = 0;
-
++
if (!type)
{
static const GTypeInfo type_info = {
diff --cc beast-gtk/gxk/gxkdialog.cc
index d4e7a78,05edc92..490f46b
--- a/beast-gtk/gxk/gxkdialog.cc
+++ b/beast-gtk/gxk/gxkdialog.cc
@@@ -23,11 -33,13 +33,13 @@@ static voi
gxk_dialog_init (GxkDialog *self)
{
GtkWindow *window = GTK_WINDOW (self);
-
++
self->flags = GxkDialogFlags (0);
self->pointer_loc = NULL;
self->alive_object = NULL;
gtk_window_set_role (window, G_OBJECT_TYPE_NAME (self));
gxk_dialog_set_title (self, DEFAULT_TITLE);
-
++
/* main box */
self->mbox = (GtkWidget*) g_object_new (GTK_TYPE_VBOX,
"visible", TRUE,
@@@ -44,10 -57,12 +57,12 @@@
"parent", self->mbox,
NULL);
gxk_nullify_in_object (self, &self->vbox);
-
++
/* status bar */
self->status_bar = gxk_status_bar_create ();
gxk_nullify_in_object (self, &self->status_bar);
gtk_box_pack_end (GTK_BOX (self->mbox), self->status_bar, FALSE, FALSE, 0);
-
++
/* button box */
self->hbox = (GtkWidget*) g_object_new (GTK_TYPE_HBOX,
"visible", FALSE,
@@@ -57,6 -72,7 +72,7 @@@
NULL);
gxk_nullify_in_object (self, &self->hbox);
gtk_box_pack_end (GTK_BOX (self->mbox), self->hbox, FALSE, TRUE, 0);
-
++
/* separator */
self->sep = (GtkWidget*) g_object_new (GTK_TYPE_HSEPARATOR,
"visible", FALSE,
@@@ -71,6 -88,7 +88,7 @@@ gxk_dialog_set_property (GObject *
GParamSpec *pspec)
{
GxkDialog *self = GXK_DIALOG (object);
-
++
switch (prop_id)
{
GtkWindow *window;
@@@ -150,6 -169,7 +169,7 @@@ gxk_dialog_get_property (GObject *o
GParamSpec *pspec)
{
GxkDialog *dialog = GXK_DIALOG (object);
-
++
switch (prop_id)
{
case PROP_FLAGS:
@@@ -412,6 -462,7 +462,7 @@@ static voi
gxk_dialog_show (GtkWidget *widget)
{
GxkDialog *self = GXK_DIALOG (widget);
-
++
if (self->flags & GXK_DIALOG_POPUP_POS)
g_object_set (self, "window_position", GTK_WIN_POS_MOUSE, NULL);
else
@@@ -437,8 -494,11 +494,11 @@@ static voi
gxk_dialog_hide (GtkWidget *widget)
{
GxkDialog *self = GXK_DIALOG (widget);
-
++
GTK_WIDGET_CLASS (gxk_dialog_parent_class)->hide (widget);
+
gxk_widget_viewable_changed (widget);
+
if (!(self->flags & GXK_DIALOG_PRESERVE_STATE))
gxk_idle_unrealize_widget (widget);
}
@@@ -602,7 -687,9 +687,9 @@@ gxk_dialog_class_init (GxkDialogClass *
gobject_class->finalize = gxk_dialog_finalize;
gobject_class->set_property = gxk_dialog_set_property;
gobject_class->get_property = gxk_dialog_get_property;
-
++
object_class->destroy = gxk_dialog_destroy;
+
widget_class->show = gxk_dialog_show;
widget_class->hide = gxk_dialog_hide;
widget_class->key_press_event = gxk_dialog_key_press_event;
diff --cc beast-gtk/gxk/gxkdialog.hh
index c8f31b2,6114f80..298d529
--- a/beast-gtk/gxk/gxkdialog.hh
+++ b/beast-gtk/gxk/gxkdialog.hh
@@@ -98,18 -111,21 +111,21 @@@ GtkWidget* gxk_dialog_action_multi (Gx
gpointer data,
const gchar *icon_stock_id,
GxkDialogMultiFlags multi_mode);
+
G_END_DECLS
+
// == Flags Enumeration Operators in C++ ==
#ifdef __cplusplus
-inline GxkDialogFlags operator& (GxkDialogFlags s1, GxkDialogFlags s2) { return GxkDialogFlags (s1 &
(long long unsigned) s2); }
-inline GxkDialogFlags& operator&= (GxkDialogFlags &s1, GxkDialogFlags s2) { s1 = s1 & s2; return s1; }
-inline GxkDialogFlags operator| (GxkDialogFlags s1, GxkDialogFlags s2) { return GxkDialogFlags (s1 |
(long long unsigned) s2); }
-inline GxkDialogFlags& operator|= (GxkDialogFlags &s1, GxkDialogFlags s2) { s1 = s1 | s2; return s1; }
-inline GxkDialogFlags operator~ (GxkDialogFlags s1) { return GxkDialogFlags (~(long
long unsigned) s1); }
-inline GxkDialogMultiFlags operator& (GxkDialogMultiFlags s1, GxkDialogMultiFlags s2) { return
GxkDialogMultiFlags (s1 & (long long unsigned) s2); }
-inline GxkDialogMultiFlags& operator&= (GxkDialogMultiFlags &s1, GxkDialogMultiFlags s2) { s1 = s1 & s2;
return s1; }
-inline GxkDialogMultiFlags operator| (GxkDialogMultiFlags s1, GxkDialogMultiFlags s2) { return
GxkDialogMultiFlags (s1 | (long long unsigned) s2); }
-inline GxkDialogMultiFlags& operator|= (GxkDialogMultiFlags &s1, GxkDialogMultiFlags s2) { s1 = s1 | s2;
return s1; }
-inline GxkDialogMultiFlags operator~ (GxkDialogMultiFlags s1) { return
GxkDialogMultiFlags (~(long long unsigned) s1); }
+constexpr GxkDialogFlags operator& (GxkDialogFlags s1, GxkDialogFlags s2) { return GxkDialogFlags (s1 &
(long long unsigned) s2); }
+inline GxkDialogFlags& operator&= (GxkDialogFlags &s1, GxkDialogFlags s2) { s1 = s1 & s2; return s1; }
+constexpr GxkDialogFlags operator| (GxkDialogFlags s1, GxkDialogFlags s2) { return GxkDialogFlags (s1 |
(long long unsigned) s2); }
+inline GxkDialogFlags& operator|= (GxkDialogFlags &s1, GxkDialogFlags s2) { s1 = s1 | s2; return s1; }
+constexpr GxkDialogFlags operator~ (GxkDialogFlags s1) { return GxkDialogFlags
(~(long long unsigned) s1); }
+constexpr GxkDialogMultiFlags operator& (GxkDialogMultiFlags s1, GxkDialogMultiFlags s2) { return
GxkDialogMultiFlags (s1 & (long long unsigned) s2); }
+inline GxkDialogMultiFlags& operator&= (GxkDialogMultiFlags &s1, GxkDialogMultiFlags s2) { s1 = s1 & s2;
return s1; }
+constexpr GxkDialogMultiFlags operator| (GxkDialogMultiFlags s1, GxkDialogMultiFlags s2) { return
GxkDialogMultiFlags (s1 | (long long unsigned) s2); }
+inline GxkDialogMultiFlags& operator|= (GxkDialogMultiFlags &s1, GxkDialogMultiFlags s2) { s1 = s1 | s2;
return s1; }
+constexpr GxkDialogMultiFlags operator~ (GxkDialogMultiFlags s1) { return
GxkDialogMultiFlags (~(long long unsigned) s1); }
#endif // __cplusplus
+
#endif /* __GXK_DIALOG_H__ */
diff --cc beast-gtk/gxk/gxkglobals.hh
index 0a09c2e,02dd49d..3ff845a
--- a/beast-gtk/gxk/gxkglobals.hh
+++ b/beast-gtk/gxk/gxkglobals.hh
@@@ -37,28 -54,35 +54,31 @@@ void gxk_init_stock (void)
void gxk_init_actions (void);
void gxk_init_assortments (void);
void gxk_init_radget_types (void);
+
+
G_END_DECLS
+
// == Flags Enumeration Operators in C++ ==
#ifdef __cplusplus
-inline GdkEventMask operator& (GdkEventMask s1, GdkEventMask s2) { return GdkEventMask (s1 & (long long
unsigned) s2); }
-inline GdkEventMask& operator&= (GdkEventMask &s1, GdkEventMask s2) { s1 = s1 & s2; return s1; }
-inline GdkEventMask operator| (GdkEventMask s1, GdkEventMask s2) { return GdkEventMask (s1 | (long long
unsigned) s2); }
-inline GdkEventMask& operator|= (GdkEventMask &s1, GdkEventMask s2) { s1 = s1 | s2; return s1; }
-inline GdkEventMask operator~ (GdkEventMask s1) { return GdkEventMask (~(long long
unsigned) s1); }
-
-inline GdkModifierType operator& (GdkModifierType s1, GdkModifierType s2) { return GdkModifierType (s1 &
(long long unsigned) s2); }
-inline GdkModifierType& operator&= (GdkModifierType &s1, GdkModifierType s2) { s1 = s1 & s2; return s1; }
-inline GdkModifierType operator| (GdkModifierType s1, GdkModifierType s2) { return GdkModifierType (s1 |
(long long unsigned) s2); }
-inline GdkModifierType& operator|= (GdkModifierType &s1, GdkModifierType s2) { s1 = s1 | s2; return s1; }
-inline GdkModifierType operator~ (GdkModifierType s1) { return GdkModifierType (~(long
long unsigned) s1); }
-
-inline GdkWindowHints operator& (GdkWindowHints s1, GdkWindowHints s2) { return GdkWindowHints (s1 &
(long long unsigned) s2); }
-inline GdkWindowHints& operator&= (GdkWindowHints &s1, GdkWindowHints s2) { s1 = s1 & s2; return s1; }
-inline GdkWindowHints operator| (GdkWindowHints s1, GdkWindowHints s2) { return GdkWindowHints (s1 |
(long long unsigned) s2); }
-inline GdkWindowHints& operator|= (GdkWindowHints &s1, GdkWindowHints s2) { s1 = s1 | s2; return s1; }
-inline GdkWindowHints operator~ (GdkWindowHints s1) { return GdkWindowHints (~(long long
unsigned) s1); }
-
-inline GtkAttachOptions operator& (GtkAttachOptions s1, GtkAttachOptions s2) { return GtkAttachOptions
(s1 & (long long unsigned) s2); }
-inline GtkAttachOptions& operator&= (GtkAttachOptions &s1, GtkAttachOptions s2) { s1 = s1 & s2; return s1; }
-inline GtkAttachOptions operator| (GtkAttachOptions s1, GtkAttachOptions s2) { return GtkAttachOptions
(s1 | (long long unsigned) s2); }
-inline GtkAttachOptions& operator|= (GtkAttachOptions &s1, GtkAttachOptions s2) { s1 = s1 | s2; return s1; }
-inline GtkAttachOptions operator~ (GtkAttachOptions s1) { return GtkAttachOptions
(~(long long unsigned) s1); }
+constexpr GdkEventMask operator& (GdkEventMask s1, GdkEventMask s2) { return GdkEventMask (s1 & (long
long unsigned) s2); }
+inline GdkEventMask& operator&= (GdkEventMask &s1, GdkEventMask s2) { s1 = s1 & s2; return s1; }
+constexpr GdkEventMask operator| (GdkEventMask s1, GdkEventMask s2) { return GdkEventMask (s1 | (long
long unsigned) s2); }
+inline GdkEventMask& operator|= (GdkEventMask &s1, GdkEventMask s2) { s1 = s1 | s2; return s1; }
+constexpr GdkEventMask operator~ (GdkEventMask s1) { return GdkEventMask (~(long long
unsigned) s1); }
+constexpr GdkModifierType operator& (GdkModifierType s1, GdkModifierType s2) { return GdkModifierType
(s1 & (long long unsigned) s2); }
+inline GdkModifierType& operator&= (GdkModifierType &s1, GdkModifierType s2) { s1 = s1 & s2; return s1; }
+constexpr GdkModifierType operator| (GdkModifierType s1, GdkModifierType s2) { return GdkModifierType
(s1 | (long long unsigned) s2); }
+inline GdkModifierType& operator|= (GdkModifierType &s1, GdkModifierType s2) { s1 = s1 | s2; return s1; }
+constexpr GdkModifierType operator~ (GdkModifierType s1) { return GdkModifierType
(~(long long unsigned) s1); }
+constexpr GdkWindowHints operator& (GdkWindowHints s1, GdkWindowHints s2) { return GdkWindowHints (s1 &
(long long unsigned) s2); }
+inline GdkWindowHints& operator&= (GdkWindowHints &s1, GdkWindowHints s2) { s1 = s1 & s2; return s1; }
+constexpr GdkWindowHints operator| (GdkWindowHints s1, GdkWindowHints s2) { return GdkWindowHints (s1 |
(long long unsigned) s2); }
+inline GdkWindowHints& operator|= (GdkWindowHints &s1, GdkWindowHints s2) { s1 = s1 | s2; return s1; }
+constexpr GdkWindowHints operator~ (GdkWindowHints s1) { return GdkWindowHints (~(long
long unsigned) s1); }
+constexpr GtkAttachOptions operator& (GtkAttachOptions s1, GtkAttachOptions s2) { return
GtkAttachOptions (s1 & (long long unsigned) s2); }
+inline GtkAttachOptions& operator&= (GtkAttachOptions &s1, GtkAttachOptions s2) { s1 = s1 & s2; return
s1; }
+constexpr GtkAttachOptions operator| (GtkAttachOptions s1, GtkAttachOptions s2) { return
GtkAttachOptions (s1 | (long long unsigned) s2); }
+inline GtkAttachOptions& operator|= (GtkAttachOptions &s1, GtkAttachOptions s2) { s1 = s1 | s2; return
s1; }
+constexpr GtkAttachOptions operator~ (GtkAttachOptions s1) { return GtkAttachOptions
(~(long long unsigned) s1); }
#endif // __cplusplus
-
#endif /* __GXK_GLOBALS_H__ */
diff --cc beast-gtk/gxk/gxkled.cc
index 5c9c50b,f2be9da..d91264b
--- a/beast-gtk/gxk/gxkled.cc
+++ b/beast-gtk/gxk/gxkled.cc
@@@ -38,6 -46,7 +46,7 @@@ gxk_led_get_type (void
0, /* n_preallocs */
(GInstanceInitFunc) gxk_led_init,
};
-
++
type = g_type_register_static (GTK_TYPE_WIDGET,
"GxkLed",
&type_info, GTypeFlags (0));
@@@ -49,8 -59,11 +59,11 @@@ gxk_led_class_init (GxkLedClass *klass
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->finalize = gxk_led_finalize;
-
++
widget_class->size_request = gxk_led_size_request;
widget_class->size_allocate = gxk_led_size_allocate;
widget_class->state_changed = gxk_led_state_changed;
@@@ -70,10 -85,13 +85,13 @@@ static voi
gxk_led_finalize (GObject *object)
{
GxkLed *self = GXK_LED (object);
-
++
if (self->pixbuf)
g_object_unref (self->pixbuf);
-
++
G_OBJECT_CLASS (parent_class)->finalize (object);
}
+
/**
* @param color rgb color
*
@@@ -136,6 -161,7 +161,7 @@@ gxk_led_size_request (GtkWidget *w
{
GxkLed *self = GXK_LED (widget);
GdkPixbuf *pixbuf = self->pixbuf;
-
++
requisition->width = 0;
requisition->height = 0;
if (pixbuf)
@@@ -148,6 -175,7 +175,7 @@@ static voi
gxk_led_resize (GxkLed *self)
{
/* GtkWidget *widget = GTK_WIDGET (self); */
-
++
if (self->pixbuf)
g_object_unref (self->pixbuf);
self->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
@@@ -179,6 -209,7 +209,7 @@@ gxk_led_rerender (GxkLed *self
gint x, y;
gdouble xc, yc, radius = self->radius;
gdouble lx, ly, lr;
-
++
/* center */
xc = width / 2;
yc = height / 2;
@@@ -198,10 -229,13 +229,13 @@@
pixels[y * rowstride + x * 4 + 2] = la * b;
pixels[y * rowstride + x * 4 + 3] = a * 0xff;
}
+
if (!GTK_WIDGET_IS_SENSITIVE (self))
gdk_pixbuf_saturate_and_pixelate (pixbuf, pixbuf, 0.8, TRUE);
-
++
gtk_widget_queue_draw (GTK_WIDGET (self));
}
+
static gboolean
gxk_led_expose (GtkWidget *widget,
GdkEventExpose *event)
@@@ -209,6 -243,7 +243,7 @@@
GxkLed *self = GXK_LED (widget);
GdkRectangle rect, area = event->area;
GdkPixbuf *pixbuf = self->pixbuf;
-
++
if (0)
gdk_draw_rectangle (widget->window,
widget->style->black_gc,
@@@ -217,6 -252,7 +252,7 @@@
widget->allocation.y,
widget->allocation.width,
widget->allocation.height);
-
++
if (pixbuf && gdk_rectangle_intersect (&area, &widget->allocation, &area))
{
gdouble radius = self->radius;
diff --cc beast-gtk/gxk/gxklistwrapper.cc
index b593d8b,a3e188f..5f4ecb0
--- a/beast-gtk/gxk/gxklistwrapper.cc
+++ b/beast-gtk/gxk/gxklistwrapper.cc
@@@ -33,6 -42,7 +42,7 @@@ GTyp
gxk_list_wrapper_get_type (void)
{
static GType type = 0;
-
++
if (!type)
{
static const GTypeInfo type_info = {
@@@ -51,6 -61,7 +61,7 @@@
(GInterfaceFinalizeFunc) NULL,
NULL, /* interface_data */
};
-
++
type = g_type_register_static (G_TYPE_OBJECT, "GxkListWrapper", &type_info, GTypeFlags (0));
g_type_add_interface_static (type, GTK_TYPE_TREE_MODEL, &iface_info);
}
@@@ -60,10 -72,13 +72,13 @@@ static voi
gxk_list_wrapper_class_init (GxkListWrapperClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
object_class->set_property = gxk_list_wrapper_set_property;
object_class->get_property = gxk_list_wrapper_get_property;
object_class->finalize = gxk_list_wrapper_finalize;
-
++
g_object_class_install_property (object_class,
PROP_N_COLS,
g_param_spec_uint ("n_cols", _("Number of Columns"), NULL,
@@@ -76,6 -91,7 +91,7 @@@
PROP_N_ROWS,
g_param_spec_uint ("n_rows", _("Number of Rows"), NULL,
0, G_MAXINT, 0, GParamFlags (G_PARAM_READWRITE)));
-
++
signal_fill_value = g_signal_new ("fill-value",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
@@@ -320,7 -388,9 +388,9 @@@ gxk_list_wrapper_init_tree_model_iface
iface->iter_has_child = gxk_list_wrapper_iter_has_child;
iface->iter_n_children = gxk_list_wrapper_iter_n_children;
iface->iter_nth_child = gxk_list_wrapper_iter_nth_child;
-
++
}
+
void
gxk_list_wrapper_notify_insert (GxkListWrapper *self,
guint nth_row)
@@@ -394,6 -481,7 +481,7 @@@ gxk_list_wrapper_notify_append (GxkList
guint n_rows)
{
g_return_if_fail (GXK_IS_LIST_WRAPPER (self));
-
++
g_object_freeze_notify (G_OBJECT (self));
g_signal_emit (self, signal_row_change, 0, -1);
while (n_rows--)
diff --cc beast-gtk/gxk/gxklogadjustment.cc
index cb927f1,4c8f8a7..c8a5289
--- a/beast-gtk/gxk/gxklogadjustment.cc
+++ b/beast-gtk/gxk/gxklogadjustment.cc
@@@ -53,6 -60,7 +60,7 @@@ adapter_adjustment_changed (GtkAdjustme
{
GxkAdapterAdjustment *self = GXK_ADAPTER_ADJUSTMENT (adj);
GtkAdjustment *client = self->client;
-
++
if (client && !self->block_client)
{
self->block_client++;
@@@ -65,6 -74,7 +74,7 @@@ adapter_adjustment_value_changed (GtkAd
{
GxkAdapterAdjustment *self = GXK_ADAPTER_ADJUSTMENT (adj);
GtkAdjustment *client = self->client;
-
++
adj->value = CLAMP (adj->value, adj->lower, adj->upper);
if (client && !self->block_client)
{
@@@ -118,6 -130,7 +130,7 @@@ adapter_adjustment_client_value_change
{
GtkAdjustment *adj = GTK_ADJUSTMENT (self);
GtkAdjustment *client = self->client;
-
++
if (client)
{
adj->value = adapter_adjustment_convert (self, GXK_ADAPTER_ADJUSTMENT_CONVERT_FROM_CLIENT,
client->value);
@@@ -143,6 -157,7 +157,7 @@@ gxk_adapter_adjustment_set_client (GxkA
g_return_if_fail (GTK_IS_ADJUSTMENT (client));
if (client)
g_object_ref (client);
-
++
if (self->client)
{
g_signal_handlers_disconnect_by_func (self->client, (void*) adapter_adjustment_adjust_ranges, self);
@@@ -159,6 -174,7 +174,7 @@@
NULL);
adapter_adjustment_adjust_ranges (self);
}
-
++
if (client)
g_object_unref (client);
}
@@@ -187,8 -205,11 +205,11 @@@ gxk_adapter_adjustment_class_init (GxkA
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GtkAdjustmentClass *adjustment_class = GTK_ADJUSTMENT_CLASS (klass);
-
++
gobject_class->finalize = adapter_adjustment_finalize;
-
++
object_class->destroy = adapter_adjustment_destroy;
-
++
adjustment_class->changed = adapter_adjustment_changed;
adjustment_class->value_changed = adapter_adjustment_value_changed;
}
@@@ -229,8 -254,11 +254,11 @@@ log_adjustment_class_init (GxkLogAdjust
{
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GtkAdjustmentClass *adjustment_class = GTK_ADJUSTMENT_CLASS (klass);
-
++
ladj_parent_class = g_type_class_peek_parent (klass);
-
++
object_class->destroy = log_adjustment_destroy;
-
++
adjustment_class->changed = log_adjustment_changed;
adjustment_class->value_changed = log_adjustment_value_changed;
}
@@@ -257,7 -289,9 +289,9 @@@ static voi
log_adjustment_destroy (GtkObject *object)
{
GxkLogAdjustment *self = GXK_LOG_ADJUSTMENT (object);
-
++
gxk_log_adjustment_set_client (self, NULL);
-
++
/* chain parent class handler */
GTK_OBJECT_CLASS (ladj_parent_class)->destroy (object);
}
@@@ -265,11 -300,15 +300,15 @@@ GtkAdjustment
gxk_log_adjustment_from_adj (GtkAdjustment *client)
{
GxkLogAdjustment *self;
-
++
g_return_val_if_fail (GTK_IS_ADJUSTMENT (client), NULL);
-
++
self = (GxkLogAdjustment*) g_object_new (GXK_TYPE_LOG_ADJUSTMENT, NULL);
gxk_log_adjustment_set_client (self, client);
-
++
return GTK_ADJUSTMENT (self);
}
+
void
gxk_log_adjustment_set_client (GxkLogAdjustment *self,
GtkAdjustment *client)
@@@ -277,6 -316,7 +316,7 @@@
g_return_if_fail (GXK_IS_LOG_ADJUSTMENT (self));
if (client)
g_return_if_fail (GTK_IS_ADJUSTMENT (client));
-
++
g_object_ref (self);
if (self->client)
{
@@@ -303,9 -344,11 +344,11 @@@ gxk_log_adjustment_setup (GxkLogAdjustm
gdouble n_steps)
{
GtkAdjustment *adj;
-
++
g_return_if_fail (GXK_IS_LOG_ADJUSTMENT (self));
g_return_if_fail (n_steps > 0);
g_return_if_fail (base > 0);
-
++
adj = GTK_ADJUSTMENT (self);
self->center = center;
self->n_steps = n_steps;
@@@ -313,6 -356,7 +356,7 @@@
self->base_ln = log (self->base);
self->ulimit = pow (self->base, self->n_steps);
self->llimit = 1.0 / self->ulimit;
-
++
adj->value = self->center;
log_adjustment_adjust_ranges (self);
gtk_adjustment_value_changed (adj);
@@@ -322,6 -367,7 +367,7 @@@ log_adjustment_changed (GtkAdjustment *
{
GxkLogAdjustment *self = GXK_LOG_ADJUSTMENT (adj);
GtkAdjustment *client = self->client;
-
++
if (client && !self->block_client)
{
self->block_client++;
@@@ -334,6 -381,7 +381,7 @@@ log_adjustment_value_changed (GtkAdjust
{
GxkLogAdjustment *self = GXK_LOG_ADJUSTMENT (adj);
GtkAdjustment *client = self->client;
-
++
adj->value = CLAMP (adj->value, adj->lower, adj->upper);
if (client && !self->block_client)
{
@@@ -347,11 -396,13 +396,13 @@@ static voi
log_adjustment_adjust_ranges (GxkLogAdjustment *self)
{
GtkAdjustment *adj = GTK_ADJUSTMENT (self);
-
++
adj->upper = self->n_steps;
adj->lower = -self->n_steps;
adj->page_increment = (adj->upper - adj->lower) / (2.0 * self->n_steps);
adj->step_increment = adj->page_increment / 100.0;
adj->page_size = 0;
-
++
if (0)
{
GtkAdjustment *client = self->client;
@@@ -361,6 -412,7 +412,7 @@@
self->center,
client ? client->lower : -99.777, client ? client->upper : -99.777);
}
-
++
if (!self->block_client)
{
self->block_client++;
@@@ -373,13 -426,16 +426,16 @@@ log_adjustment_client_value_changed (Gx
{
GtkAdjustment *adj = GTK_ADJUSTMENT (self);
GtkAdjustment *client = self->client;
-
++
if (client)
adj->value = call_log (self, client->value / self->center);
adj->value = CLAMP (adj->value, adj->lower, adj->upper);
-
++
if (0)
g_printerr ("ladj: client-value-changed: [%f %f] %g CLIENT: [%f %f] %g\n",
adj->lower, adj->upper, adj->value,
client->lower, client->upper, client->value);
-
++
if (!self->block_client)
{
self->block_client++;
diff --cc beast-gtk/gxk/gxklogadjustment.hh
index ef0ddd1,d61ae26..515c05b
--- a/beast-gtk/gxk/gxklogadjustment.hh
+++ b/beast-gtk/gxk/gxklogadjustment.hh
@@@ -27,8 -31,10 +31,10 @@@ typedef gdouble (*GxkAdapterAdjustmentF
struct _GxkAdapterAdjustment
{
GtkAdjustment parent_instance;
-
++
guint block_client;
GtkAdjustment *client;
-
++
GxkAdapterAdjustmentFunc conv_func;
gpointer data;
GDestroyNotify destroy;
@@@ -62,11 -71,13 +71,13 @@@ typedef struct _GxkLogAdjustmentClass G
struct _GxkLogAdjustment
{
GtkAdjustment parent_instance;
-
++
/* settings */
gdouble center;
gdouble n_steps;
gdouble base;
GtkAdjustment *client;
-
++
guint block_client;
gdouble base_ln;
gdouble llimit;
diff --cc beast-gtk/gxk/gxknotebook.cc
index d856514,a055584..e8e643c
--- a/beast-gtk/gxk/gxknotebook.cc
+++ b/beast-gtk/gxk/gxknotebook.cc
@@@ -245,13 -264,19 +264,19 @@@ gxk_notebook_class_init (GxkNotebookCla
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkNotebookClass *notebook_class = GTK_NOTEBOOK_CLASS (klass);
-
++
quark_page_data = g_quark_from_static_string ("gxk-notebook-page-data");
+
gobject_class->finalize = gxk_notebook_finalize;
gobject_class->set_property = gxk_notebook_set_property;
gobject_class->get_property = gxk_notebook_get_property;
-
++
object_class->destroy = gxk_notebook_destroy;
-
++
widget_class->hierarchy_changed = gxk_notebook_hierarchy_changed;
+
notebook_class->switch_page = gxk_notebook_switch_page;
+
g_object_class_install_property (G_OBJECT_CLASS (object_class),
PROP_ASSORTMENT,
g_param_spec_string ("assortment", NULL, NULL,
diff --cc beast-gtk/gxk/gxkparam.cc
index 3f65168,7a93b41..0bead69
--- a/beast-gtk/gxk/gxkparam.cc
+++ b/beast-gtk/gxk/gxkparam.cc
@@@ -96,7 -103,9 +103,9 @@@ gxk_param_update (GxkParam *param
{
GSList *slist;
gboolean updating;
-
++
g_return_if_fail (GXK_IS_PARAM (param));
-
++
updating = param->updating;
param->updating = TRUE;
if (param->binding->get_value)
@@@ -281,8 -304,10 +304,10 @@@ gxk_param_destroy (GxkParam *param
{
g_return_if_fail (GXK_IS_PARAM (param));
g_return_if_fail (param->binding != NULL);
+
while (param->grouping)
gxk_param_stop_grouping (param);
-
++
while (param->objects)
{
GObject *object = (GObject*) param->objects->data;
@@@ -603,6 -659,7 +659,7 @@@ param_score_editor (const GxkParamEdito
g_printerr ("%s mismatch\n", type_mismatch ? "type" : "option");
return 0;
}
-
++
guint rating = 0;
rating |= 256 - type_distance;
rating <<= 1;
@@@ -615,6 -672,7 +672,7 @@@
rating += 128 + editor->features.rating; /* rating is signed, 8bit */
rating <<= 8;
rating += bonus; /* bonus is provided for overcomming additional mismatch possibilities */
-
++
if (annotate)
g_printerr ("%d\n", rating);
return rating;
@@@ -809,6 -882,7 +882,7 @@@ gxk_param_entry_key_press (GtkEntry
{
GtkEditable *editable = GTK_EDITABLE (entry);
gboolean intercept = FALSE;
-
++
if (event->state & GDK_MOD1_MASK)
switch (event->keyval)
{
@@@ -914,6 -995,7 +995,7 @@@ gxk_param_get_adjustment_with_stepping
if (GTK_IS_ADJUSTMENT (slist->data) &&
g_object_get_data ((GObject*) slist->data, "gxk-param-func") ==
gxk_param_get_adjustment_with_stepping)
return (GtkAdjustment*) slist->data;
-
++
#define EXTRACT_FIELDS(p,T,mi,ma,df) { T *t = (T*) p; mi = t->minimum; ma = t->maximum; df =
t->default_value; }
if (G_IS_PARAM_SPEC_CHAR (pspec))
{
diff --cc beast-gtk/gxk/gxkpolygon.cc
index 73c20cf,3d970f6..20af15a
--- a/beast-gtk/gxk/gxkpolygon.cc
+++ b/beast-gtk/gxk/gxkpolygon.cc
@@@ -31,6 -39,7 +39,7 @@@ gxk_polygon_get_type (void
0, /* n_preallocs */
(GInstanceInitFunc) gxk_polygon_init,
};
-
++
type = g_type_register_static (GTK_TYPE_WIDGET,
"GxkPolygon",
&type_info, GTypeFlags (0));
@@@ -42,8 -52,11 +52,11 @@@ gxk_polygon_class_init (GxkPolygonClas
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->finalize = gxk_polygon_finalize;
-
++
widget_class->size_request = gxk_polygon_size_request;
widget_class->expose_event = gxk_polygon_expose;
}
@@@ -61,10 -76,13 +76,13 @@@ static voi
gxk_polygon_finalize (GObject *object)
{
GxkPolygon *self = GXK_POLYGON (object);
-
++
g_free (self->lines);
g_free (self->arcs);
-
++
G_OBJECT_CLASS (parent_class)->finalize (object);
}
+
/**
* @param polygon_graph set of lines and arcs
*
@@@ -93,6 -112,7 +112,7 @@@ gxk_polygon_set_lines (GxkPolygon *
g_return_if_fail (GXK_IS_POLYGON (self));
if (n_lines)
g_return_if_fail (lines != NULL);
-
++
g_free (self->lines);
self->n_lines = n_lines;
self->lines = (GxkPolygonLine*) g_memdup (lines, sizeof (lines[0]) * n_lines);
@@@ -114,6 -135,7 +135,7 @@@ gxk_polygon_set_arcs (GxkPolygon *se
g_return_if_fail (GXK_IS_POLYGON (self));
if (n_arcs)
g_return_if_fail (arcs != NULL);
-
++
g_free (self->arcs);
self->n_arcs = n_arcs;
self->arcs = (GxkPolygonArc*) g_memdup (arcs, sizeof (arcs[0]) * n_arcs);
@@@ -156,6 -180,7 +180,7 @@@ gxk_polygon_set_length (GxkPolygon *sel
guint length)
{
g_return_if_fail (GXK_IS_POLYGON (self));
-
++
self->request_length = length;
gtk_widget_queue_resize (GTK_WIDGET (self));
}
@@@ -245,6 -273,7 +273,7 @@@ gxk_polygon_expose (GtkWidget *wid
guint n, pass, draw_lines, draw_arcs;
width -= 2;
height -= 2;
-
++
if (0)
gdk_draw_rectangle (widget->window,
widget->style->white_gc,
diff --cc beast-gtk/gxk/gxkrackcovers.cc
index acd7916,ff3e47b..45d6d67
--- a/beast-gtk/gxk/gxkrackcovers.cc
+++ b/beast-gtk/gxk/gxkrackcovers.cc
@@@ -26,30 -27,39 +27,39 @@@ rack_cover_create (GtkWidget *rtable
GdkPixmap *pixmap;
GdkBitmap *mask;
GtkWidget *pix;
-
++
pixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, gtk_widget_get_colormap (rtable), &mask, NULL,
(gchar**) rivet_xpm);
pix = gtk_pixmap_new (pixmap, mask);
gtk_widget_show (pix);
gtk_table_attach (table, pix, 0, 1, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
-
++
pixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, gtk_widget_get_colormap (rtable), &mask, NULL,
(gchar**) rivet_xpm);
pix = gtk_pixmap_new (pixmap, mask);
gtk_widget_show (pix);
gtk_table_attach (table, pix, 2, 3, 2, 3, GTK_SHRINK, GTK_SHRINK, 0, 0);
-
++
pixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, gtk_widget_get_colormap (rtable), &mask, NULL,
(gchar**) rivet_xpm);
pix = gtk_pixmap_new (pixmap, mask);
gtk_widget_show (pix);
gtk_table_attach (table, pix, 0, 1, 2, 3, GTK_SHRINK, GTK_SHRINK, 0, 0);
-
++
pixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, gtk_widget_get_colormap (rtable), &mask, NULL,
(gchar**) rivet_xpm);
pix = gtk_pixmap_new (pixmap, mask);
gtk_widget_show (pix);
gtk_table_attach (table, pix, 2, 3, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
-
++
gdk_pixmap_unref (pixmap);
gdk_pixmap_unref (mask);
-
++
pix = (GtkWidget*) g_object_new (GTK_TYPE_ALIGNMENT, "visible", TRUE, NULL);
gtk_table_attach (table, pix, 1, 2, 1, 2, GTK_EXPAND, GTK_EXPAND, 0, 0);
+
g_object_ref (cover);
gtk_object_sink (GTK_OBJECT (cover));
-
++
return cover;
}
+
static void
rack_cover_grow_area_horizontal (GxkRackTable *rtable,
guint col,
@@@ -59,6 -69,7 +69,7 @@@
{
GtkTable *table = GTK_TABLE (rtable);
guint i, j;
-
++
for (i = 1; col + i < table->ncols; i++)
if (gxk_rack_table_check_cell (rtable, col + i, row))
break;
@@@ -77,6 -89,7 +89,7 @@@ rack_cover_grow_area_vertical (GxkRackT
{
GtkTable *table = GTK_TABLE (rtable);
guint i, j;
-
++
for (j = 1; row + j < table->nrows; j++)
if (gxk_rack_table_check_cell (rtable, col, row + j))
break;
@@@ -94,6 -108,7 +108,7 @@@ rack_cover_add_plates (GxkRackTable *rt
guint i, j;
guint k, l, m, n;
GSList *plate_list = NULL;
-
++
if (0)
{
/* grab the first free cell and start growing a cover from it.
@@@ -106,11 -121,13 +121,13 @@@
{
rack_cover_grow_area_vertical (rtable, i, j, &k, &l);
rack_cover_grow_area_horizontal (rtable, i, j, &m, &n);
-
++
if (m * n > k * l)
{
k = m;
l = n;
}
-
++
cover = rack_cover_create (GTK_WIDGET (rtable));
plate_list = g_slist_prepend (plate_list, cover);
gxk_rack_table_attach (rtable, cover, i, j, k, l);
diff --cc beast-gtk/gxk/gxkrackeditor.cc
index b1fd617,60ec08d..c4c2900
--- a/beast-gtk/gxk/gxkrackeditor.cc
+++ b/beast-gtk/gxk/gxkrackeditor.cc
@@@ -588,7 -621,9 +621,9 @@@ gxk_rack_table_expand_rect (GxkRackTabl
{
GtkTable *table;
guint i, j, f;
-
++
g_return_val_if_fail (GXK_IS_RACK_TABLE (self), FALSE);
-
++
gxk_rack_table_update_child_map (self);
table = GTK_TABLE (self);
if (col >= table->ncols || row >= table->nrows ||
@@@ -608,6 -645,7 +645,7 @@@
last_row_break:
*hspan = i;
*vspan = j;
-
++
/* expand vertically */
for (j = j; row + j < table->nrows; j++)
if (g_bit_matrix_peek (self->child_map, col, row + j))
diff --cc beast-gtk/gxk/gxkrackitem.cc
index 90de7f8,d04f600..1366a6f
--- a/beast-gtk/gxk/gxkrackitem.cc
+++ b/beast-gtk/gxk/gxkrackitem.cc
@@@ -22,6 -27,7 +27,7 @@@ GTyp
gxk_rack_item_get_type (void)
{
static GType type = 0;
-
++
if (!type)
{
static const GTypeInfo type_info = {
@@@ -35,25 -41,34 +41,34 @@@
0, /* n_preallocs */
(GInstanceInitFunc) gxk_rack_item_init,
};
-
++
type = g_type_register_static (GTK_TYPE_FRAME,
"GxkRackItem",
&type_info, GTypeFlags (0));
}
-
++
return type;
}
+
static void
gxk_rack_item_class_init (GxkRackItemClass *klass)
{
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
object_class->destroy = gxk_rack_item_destroy;
-
++
widget_class->parent_set = gxk_rack_item_parent_set;
widget_class->size_allocate = gxk_rack_item_size_allocate;
+
container_class->add = gxk_rack_item_add;
container_class->remove = gxk_rack_item_remove;
+
klass->button_press = gxk_rack_item_button_press;
-
++
g_signal_new ("button-press",
G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
@@@ -77,6 -94,7 +94,7 @@@ static voi
gxk_rack_item_destroy (GtkObject *object)
{
// GxkRackItem *self = GXK_RACK_ITEM (object);
-
++
/* chain parent class' handler */
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
@@@ -124,6 -147,7 +147,7 @@@ gxk_rack_item_parent_set (GtkWidget *wi
}
else if (GXK_IS_RACK_TABLE (previous_parent))
g_object_disconnect (previous_parent, "any_signal", update_frame, self, NULL);
-
++
/* chain parent class' handler */
if (GTK_WIDGET_CLASS (parent_class)->parent_set)
GTK_WIDGET_CLASS (parent_class)->parent_set (widget, previous_parent);
diff --cc beast-gtk/gxk/gxkrackitem.hh
index d8ef5a8,c2c3439..5c97197
--- a/beast-gtk/gxk/gxkrackitem.hh
+++ b/beast-gtk/gxk/gxkrackitem.hh
@@@ -23,6 -28,7 +28,7 @@@ struct _GxkRackIte
struct _GxkRackItemClass
{
GtkFrameClass parent_class;
-
++
void (*button_press) (GxkRackItem *item,
GdkEventButton *event);
};
diff --cc beast-gtk/gxk/gxkracktable.cc
index bde9395,219fc4e..494565f
--- a/beast-gtk/gxk/gxkracktable.cc
+++ b/beast-gtk/gxk/gxkracktable.cc
@@@ -74,9 -84,13 +84,13 @@@ gxk_rack_table_class_init (GxkRackTable
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->finalize = gxk_rack_table_finalize;
-
++
object_class->destroy = gxk_rack_table_destroy;
-
++
widget_class->style_set = gxk_rack_table_style_set;
widget_class->size_request = gxk_rack_table_size_request;
widget_class->size_allocate = gxk_rack_table_size_allocate;
@@@ -89,8 -103,10 +103,10 @@@
widget_class->leave_notify_event = (gboolean (*) (GtkWidget*, GdkEventCrossing*))
gxk_rack_table_handle_leave_notify;
widget_class->button_release_event = (gboolean (*) (GtkWidget*, GdkEventButton*))
gxk_rack_table_handle_button_release;
widget_class->expose_event = gxk_rack_table_expose;
-
++
container_class->add = gxk_rack_table_add;
container_class->remove = gxk_rack_table_remove;
-
++
signal_edit_mode_changed = g_signal_new ("edit-mode-changed",
G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_FIRST,
@@@ -121,20 -139,27 +139,27 @@@ static voi
gxk_rack_table_destroy (GtkObject *object)
{
GxkRackTable *self = GXK_RACK_TABLE (object);
-
++
if (self->editor)
gxk_rack_table_destroy_editor (self);
gxk_rack_table_uncover (self);
-
++
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
+
static void
gxk_rack_table_finalize (GObject *object)
{
GxkRackTable *self = GXK_RACK_TABLE (object);
+
while (self->covers)
g_object_unref (g_slist_pop_head (&self->covers));
+
g_bit_matrix_free (self->child_map);
-
++
G_OBJECT_CLASS (parent_class)->finalize (object);
}
+
static void
gxk_rack_table_style_set (GtkWidget *widget,
GtkStyle *previous_style)
@@@ -142,9 -167,11 +167,11 @@@
GxkRackTable *self = GXK_RACK_TABLE (widget);
GdkFont *font = gtk_style_get_font (widget->style);
guint i, x = 0;
-
++
for (i = 0; i < 256; i++)
{
guint width = gdk_char_width (font, i);
-
++
x = MAX (x, width);
}
self->cell_request_width = x;
@@@ -164,13 -192,16 +192,16 @@@ gxk_rack_table_size_request (GtkWidge
GtkTable *table = GTK_TABLE (self);
GList *list;
guint i, j;
-
++
gxk_rack_table_invalidate_child_map (self); /* we get here when re-attaching children */
for (list = table->children; list; list = list->next)
{
GtkTableChild *child = (GtkTableChild*) list->data;
-
++
if (GTK_WIDGET_VISIBLE (child->widget))
gtk_widget_size_request (child->widget, NULL);
}
-
++
requisition->width = GTK_CONTAINER (self)->border_width * 2;
requisition->height = GTK_CONTAINER (self)->border_width * 2;
for (i = 0; i < table->ncols; i++)
@@@ -190,10 -222,14 +222,14 @@@ gxk_rack_table_size_allocate (GtkWidge
{
GxkRackTable *self = GXK_RACK_TABLE (widget);
GtkTable *table = GTK_TABLE (self);
-
++
GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
-
++
gxk_rack_table_invalidate_child_map (self);
-
++
self->cell_width = table->cols[0].allocation;
self->cell_height = table->rows[0].allocation;
+
if (self->editor)
gxk_rack_table_adjust_editor (self);
}
@@@ -232,13 -272,16 +272,16 @@@ gxk_rack_table_draw_area (GxkRackTable
GtkWidget *widget = GTK_WIDGET (self);
GtkTable *table = GTK_TABLE (self);
guint i, x, y, width, height, hcell2 = hcell1 + hspan, vcell2 = vcell1 + vspan;
-
++
g_return_if_fail (hspan > 0 && hcell2 <= table->ncols);
g_return_if_fail (vspan > 0 && vcell2 <= table->nrows);
-
++
x = GTK_CONTAINER (widget)->border_width + widget->allocation.x;
width = 0;
for (i = 0; i < hcell2; i++)
{
guint bound = table->cols[i].allocation + table->cols[i].spacing;
-
++
if (i < hcell1)
x += bound;
else
@@@ -249,11 -292,13 +292,13 @@@
for (i = 0; i < vcell2; i++)
{
guint bound = table->rows[i].allocation + table->rows[i].spacing;
-
++
if (i < vcell1)
y += bound;
else
height += bound;
}
-
++
switch (action)
{
GdkGC *bg_gc, *dark_gc, *light_gc;
@@@ -319,6 -366,7 +366,7 @@@ gxk_rack_table_expose (GtkWidget *
{
GxkRackTable *self = GXK_RACK_TABLE (widget);
GtkTable *table = GTK_TABLE (self);
-
++
if (self->editor && event->window == widget->window)
{
int i, j, x = GTK_CONTAINER (self)->border_width + GTK_WIDGET (self)->allocation.x, bx = 0;
@@@ -357,9 -407,12 +407,12 @@@
x += bx;
}
}
-
++
GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
-
++
return FALSE;
}
+
void
gxk_rack_table_attach (GxkRackTable *self,
GtkWidget *child,
@@@ -453,7 -508,9 +508,9 @@@ gxk_rack_table_remove (GtkContainer *co
GtkWidget *child)
{
GxkRackTable *self = GXK_RACK_TABLE (container);
-
++
gxk_rack_table_invalidate_child_map (self);
-
++
/* chain parent class' handler */
GTK_CONTAINER_CLASS (parent_class)->remove (container, child);
}
@@@ -481,6 -540,7 +540,7 @@@ gxk_rack_table_translate (GxkRackTabl
}
if (i >= table->ncols)
*hcell = table->ncols;
-
++
y -= GTK_CONTAINER (self)->border_width;
*vcell = 0;
for (i = 0; i < table->nrows; i++)
@@@ -495,8 -555,10 +555,10 @@@
}
if (i >= table->nrows)
*vcell = table->nrows;
-
++
return x >= 0 && *hcell < table->ncols && y >= 0 && *vcell < table->nrows;
}
+
GtkWidget*
gxk_rack_table_find_child (GxkRackTable *self,
gint x,
@@@ -561,9 -626,11 +626,11 @@@ gxk_rack_table_find_cell_child (GxkRack
{
GtkTable *table = GTK_TABLE (self);
GList *list;
-
++
for (list = table->children; list; list = list->next)
{
GtkTableChild *child = (GtkTableChild*) list->data;
-
++
if (hcell >= child->left_attach && hcell < child->right_attach &&
vcell >= child->top_attach && vcell < child->bottom_attach)
{
@@@ -575,8 -642,10 +642,10 @@@
return child->widget;
}
}
-
++
return NULL;
}
+
void
gxk_rack_table_invalidate_child_map (GxkRackTable *self)
{
diff --cc beast-gtk/gxk/gxkracktable.hh
index fde29dd,9abc717..b392fc9
--- a/beast-gtk/gxk/gxkracktable.hh
+++ b/beast-gtk/gxk/gxkracktable.hh
@@@ -64,5 -72,8 +72,8 @@@ void gxk_rack_table_attac
guint vspan);
void gxk_rack_table_cover_up (GxkRackTable *self);
void gxk_rack_table_uncover (GxkRackTable *self);
-
++
+
G_END_DECLS
+
#endif /* __GXK_RACK_TABLE_H__ */
diff --cc beast-gtk/gxk/gxkradget.cc
index 6229c5b,7d1fcef..e12b138
--- a/beast-gtk/gxk/gxkradget.cc
+++ b/beast-gtk/gxk/gxkradget.cc
@@@ -1684,10 -1763,13 +1763,13 @@@ gxk_radget_find (GxkRadget *radget
const gchar *name)
{
const gchar *next, *c = name;
-
++
g_return_val_if_fail (radget != NULL, NULL);
g_return_val_if_fail (name != NULL, NULL);
-
++
if (!GTK_IS_WIDGET (radget))
return NULL;
-
++
next = strchr (c, '.');
while (radget && next)
{
@@@ -1812,9 -1901,11 +1901,11 @@@ gxk_radget_define_type (GTyp
{
const gchar *attribute_names[1] = { NULL };
const gchar *attribute_values[1] = { NULL };
-
++
g_return_if_fail (!G_TYPE_IS_ABSTRACT (type));
g_return_if_fail (G_TYPE_IS_OBJECT (type));
g_return_if_fail (g_type_get_qdata (type, quark_radget_type) == NULL);
-
++
g_type_set_qdata (type, quark_radget_type, (gpointer) ggtype);
radget_define_type (type, g_type_name (type), attribute_names, attribute_values, NULL);
}
@@@ -1919,9 -2018,11 +2018,11 @@@ gxk_radget_define_widget_type (GType ty
const gchar *attribute_names[G_N_ELEMENTS (widget_def) + G_N_ELEMENTS (container_def) + 1];
const gchar *attribute_values[G_N_ELEMENTS (widget_def) + G_N_ELEMENTS (container_def) + 1];
guint i, j = 0;
-
++
g_return_if_fail (!G_TYPE_IS_ABSTRACT (type));
g_return_if_fail (g_type_is_a (type, GTK_TYPE_WIDGET));
g_return_if_fail (g_type_get_qdata (type, quark_radget_type) == NULL);
-
++
g_type_set_qdata (type, quark_radget_type, (gpointer) &widget_info);
for (i = 0; i < G_N_ELEMENTS (widget_def); i++)
{
diff --cc beast-gtk/gxk/gxkradgetfactory.cc
index c35be95,c61a438..59f5093
--- a/beast-gtk/gxk/gxkradgetfactory.cc
+++ b/beast-gtk/gxk/gxkradgetfactory.cc
@@@ -119,6 -128,7 +128,7 @@@ static voi
gxk_radget_factory_finalize (GObject *object)
{
GxkRadgetFactory *self = GXK_RADGET_FACTORY (object);
-
++
g_assert (self->window == NULL);
g_datalist_clear (&self->branch_widgets);
g_free (self->action_root);
@@@ -134,7 -144,9 +144,9 @@@
GxkFactoryBranch *b = (GxkFactoryBranch*) g_slist_pop_head (&self->branches);
g_object_unref (b);
}
-
++
g_return_if_fail (self->timer == 0);
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (gxk_radget_factory_parent_class)->finalize (object);
}
@@@ -373,8 -394,10 +394,10 @@@ gxk_radget_factory_attach (GxkRadgetFac
GxkRadget *radget)
{
GSList *slist;
-
++
g_return_if_fail (self->radget == NULL);
g_return_if_fail (GTK_IS_WIDGET (radget));
-
++
g_object_ref (self);
slist = (GSList*) g_object_steal_qdata ((GObject*) radget, quark_radget_factory_hook);
slist = g_slist_prepend (slist, self);
@@@ -390,7 -414,9 +414,9 @@@ static voi
gxk_radget_factory_class_init (GxkRadgetFactoryClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
++
quark_radget_factory_hook = g_quark_from_static_string ("GxkRadgetFactory-hook");
-
++
gobject_class->set_property = gxk_radget_factory_set_property;
gobject_class->get_property = gxk_radget_factory_get_property;
gobject_class->finalize = gxk_radget_factory_finalize;
diff --cc beast-gtk/gxk/gxkscrollcanvas.cc
index d6d3067,16e8cf7..3a0191f
--- a/beast-gtk/gxk/gxkscrollcanvas.cc
+++ b/beast-gtk/gxk/gxkscrollcanvas.cc
@@@ -108,6 -118,7 +118,7 @@@ static voi
gxk_scroll_canvas_init (GxkScrollCanvas *self)
{
GtkWidget *widget = GTK_WIDGET (self);
-
++
GTK_WIDGET_UNSET_FLAGS (self, GTK_NO_WINDOW);
gtk_widget_set_double_buffered (widget, FALSE);
gtk_widget_set_redraw_on_allocate (widget, TRUE);
@@@ -126,13 -140,17 +140,17 @@@ static voi
scroll_canvas_destroy (GtkObject *object)
{
GxkScrollCanvas *self = GXK_SCROLL_CANVAS (object);
-
++
if (self->scroll_timer)
g_source_remove (self->scroll_timer);
self->scroll_timer = 0;
+
gxk_scroll_canvas_set_hadjustment (self, NULL);
gxk_scroll_canvas_set_vadjustment (self, NULL);
-
++
GTK_OBJECT_CLASS (gxk_scroll_canvas_parent_class)->destroy (object);
}
+
static void
scroll_canvas_finalize (GObject *object)
{
@@@ -148,6 -168,7 +168,7 @@@
g_free (self->pango_layouts);
self->pango_layouts = NULL;
self->n_pango_layouts = 0;
-
++
if (self->scroll_timer)
g_source_remove (self->scroll_timer);
self->scroll_timer = 0;
@@@ -170,6 -195,7 +195,7 @@@ gxk_scroll_canvas_set_hadjustment (GxkS
g_return_if_fail (GXK_IS_SCROLL_CANVAS (self));
if (adjustment)
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
-
++
if (self->hadjustment)
{
g_object_disconnect (self->hadjustment,
@@@ -179,8 -205,10 +205,10 @@@
g_object_unref (self->hadjustment);
self->hadjustment = NULL;
}
-
++
if (!adjustment)
adjustment = (GtkAdjustment*) g_object_new (GTK_TYPE_ADJUSTMENT, NULL);
-
++
self->hadjustment = (GtkAdjustment*) g_object_ref (adjustment);
gtk_object_sink (GTK_OBJECT (adjustment));
g_object_connect (self->hadjustment,
@@@ -195,6 -224,7 +224,7 @@@ gxk_scroll_canvas_set_vadjustment (GxkS
g_return_if_fail (GXK_IS_SCROLL_CANVAS (self));
if (adjustment)
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
-
++
if (self->vadjustment)
{
g_object_disconnect (self->vadjustment,
@@@ -204,8 -234,10 +234,10 @@@
g_object_unref (self->vadjustment);
self->vadjustment = NULL;
}
-
++
if (!adjustment)
adjustment = (GtkAdjustment*) g_object_new (GTK_TYPE_ADJUSTMENT, NULL);
-
++
self->vadjustment = (GtkAdjustment*) g_object_ref (adjustment);
gtk_object_sink (GTK_OBJECT (adjustment));
g_object_connect (self->vadjustment,
@@@ -465,12 -512,15 +512,15 @@@ scroll_canvas_realize (GtkWidget *widge
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
GDK_BUTTON_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK);
panel_events &= ~(GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK);
+
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
++
attributes.window_type = GDK_WINDOW_CHILD;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
++
/* widget->window */
attributes.x = widget->allocation.x + BORDER_WIDTH (self);
attributes.y = widget->allocation.y + BORDER_WIDTH (self);
@@@ -592,6 -657,7 +657,7 @@@ scroll_canvas_unrealize (GtkWidget *wid
g_object_unref (self->pango_layouts[i]);
self->pango_layouts[i] = NULL;
}
-
++
/* unrealize markers */
for (i = 0; i < self->n_markers; i++)
scroll_canvas_unrealize_marker (self, self->markers + i, FALSE);
@@@ -791,8 -870,10 +870,10 @@@ scroll_canvas_expose (GtkWidget *w
GxkScrollCanvasClass *klass = GXK_SCROLL_CANVAS_GET_CLASS (self);
GdkRectangle *areas;
gint j, n_areas;
-
++
if (!GTK_WIDGET_DRAWABLE (widget))
return FALSE;
-
++
if (event->region)
gdk_region_get_rectangles (event->region, &areas, &n_areas);
else
@@@ -1147,6 -1245,7 +1245,7 @@@ scroll_canvas_update_adjustments (GxkSc
GxkScrollCanvasClass *klass = GXK_SCROLL_CANVAS_GET_CLASS (self);
gdouble hv = self->hadjustment->value;
gdouble vv = self->vadjustment->value;
-
++
if (hadj && klass->hscrollable)
{
self->hadjustment->lower = MAX (self->hadjustment->lower, 0);
@@@ -1661,8 -1809,11 +1809,11 @@@ gxk_scroll_canvas_class_init (GxkScroll
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
// GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
-
++
gobject_class->finalize = scroll_canvas_finalize;
-
++
object_class->destroy = scroll_canvas_destroy;
-
++
widget_class->size_request = scroll_canvas_size_request;
widget_class->size_allocate = scroll_canvas_size_allocate;
widget_class->realize = scroll_canvas_realize;
@@@ -1706,6 -1858,7 +1858,7 @@@
klass->draw_right_panel = scroll_canvas_draw_panel;
klass->draw_bottom_panel = scroll_canvas_draw_panel;
klass->handle_drag = (void (*) (GxkScrollCanvas*, GxkScrollCanvasDrag*, GdkEvent*)) dummy_handler;
-
++
widget_class->set_scroll_adjustments_signal =
gtk_signal_new ("set_scroll_adjustments",
GTK_RUN_LAST,
diff --cc beast-gtk/gxk/gxksimplelabel.cc
index 8611649,37a6437..de066ee
--- a/beast-gtk/gxk/gxksimplelabel.cc
+++ b/beast-gtk/gxk/gxksimplelabel.cc
@@@ -78,11 -84,15 +84,15 @@@ simple_label_class_init (GxkSimpleLabel
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = simple_label_set_property;
gobject_class->get_property = simple_label_get_property;
gobject_class->finalize = simple_label_finalize;
-
++
object_class->destroy = simple_label_destroy;
-
++
widget_class->size_request = simple_label_size_request;
widget_class->style_set = simple_label_style_set;
widget_class->direction_changed = simple_label_direction_changed;
@@@ -90,6 -100,7 +100,7 @@@
widget_class->hierarchy_changed = simple_label_hierarchy_changed;
widget_class->screen_changed = simple_label_screen_changed;
widget_class->mnemonic_activate = simple_label_mnemonic_activate;
-
++
g_object_class_install_property (gobject_class,
PROP_LABEL,
g_param_spec_string ("label", _("Label"), _("The text of the label"),
@@@ -131,6 -143,7 +143,7 @@@ simple_label_init (GxkSimpleLabel *self
{
GTK_WIDGET_SET_FLAGS (self, GTK_NO_WINDOW);
gtk_widget_show (GTK_WIDGET (self));
-
++
self->jtype = GTK_JUSTIFY_LEFT;
self->layout = NULL;
self->text = g_strdup ("");
@@@ -205,7 -220,9 +220,9 @@@ simple_label_get_property (GObject
GParamSpec *pspec)
{
GxkSimpleLabel *label;
-
++
label = GXK_SIMPLE_LABEL (object);
-
++
switch (prop_id)
{
case PROP_LABEL:
@@@ -257,6 -277,7 +277,7 @@@ simple_label_mnemonic_activate (GtkWidg
GtkWidget *parent = widget->parent;
if (GXK_SIMPLE_LABEL (widget)->mnemonic_widget)
return gtk_widget_mnemonic_activate (GXK_SIMPLE_LABEL (widget)->mnemonic_widget, group_cycling);
-
++
/* Try to find the widget to activate by traversing the
* widget's ancestry.
*/
@@@ -278,6 -299,7 +299,7 @@@
}
parent = parent->parent;
}
-
++
/* barf if there was nothing to activate */
g_warning ("Couldn't find a target for a mnemonic activation.");
gdk_display_beep (gtk_widget_get_display (widget));
@@@ -324,6 -350,7 +350,7 @@@ label_mnemonic_widget_weak_notify (gpoi
GObject *where_the_object_was)
{
GxkSimpleLabel *label = (GxkSimpleLabel*) data;
-
++
label->mnemonic_widget = NULL;
g_object_notify (G_OBJECT (label), "mnemonic_widget");
}
@@@ -334,6 -362,7 +362,7 @@@ gxk_simple_label_set_mnemonic_widget (G
g_return_if_fail (GXK_IS_SIMPLE_LABEL (self));
if (widget)
g_return_if_fail (GTK_IS_WIDGET (widget));
-
++
if (self->mnemonic_widget)
g_object_weak_unref (G_OBJECT (self->mnemonic_widget),
label_mnemonic_widget_weak_notify,
@@@ -353,7 -383,9 +383,9 @@@ simple_label_pattern_to_attrs (GxkSimpl
const char *p = self->text;
const char *q = pattern;
PangoAttrList *attrs;
-
++
attrs = pango_attr_list_new ();
-
++
while (1)
{
while (*p && *q && *q != '_')
@@@ -367,18 -399,22 +399,22 @@@
p = g_utf8_next_char (p);
q++;
}
-
++
if (p > start)
{
PangoAttribute *attr = pango_attr_underline_new (PANGO_UNDERLINE_LOW);
attr->start_index = start - self->text;
attr->end_index = p - self->text;
-
++
pango_attr_list_insert (attrs, attr);
}
else
break;
}
-
++
return attrs;
}
+
static void
simple_label_set_pattern_internal (GxkSimpleLabel *self,
const gchar *pattern)
@@@ -399,6 -436,7 +436,7 @@@ simple_label_set_uline_text_internal (G
gchar *pattern_dest = pattern;
const gchar *src = str;
gboolean underscore = FALSE;
-
++
/* Split text into the base text and a separate pattern
* of underscores.
*/
@@@ -444,12 -482,15 +482,15 @@@
}
*dest = 0;
*pattern_dest = 0;
-
++
g_free (self->text);
self->text = new_str;
simple_label_set_pattern_internal (self, pattern);
g_free (pattern);
-
++
self->mnemonic_keyval = accel_key;
}
+
static void
gxk_simple_label_recalculate (GxkSimpleLabel *self)
{
@@@ -550,6 -596,7 +596,7 @@@ simple_label_size_request (GtkWidge
{
GxkSimpleLabel *self = GXK_SIMPLE_LABEL (widget);
PangoRectangle logical_rect;
-
++
if (self->layout)
{
g_object_unref (self->layout);
@@@ -590,6 -640,7 +640,7 @@@ get_layout_location (GxkSimpleLabel *se
pango_layout_get_extents (self->layout, NULL, &logical_rect);
gint rwidth = MIN (widget->requisition.width, PANGO_PIXELS (logical_rect.width));
gint rheight = MIN (widget->requisition.height, PANGO_PIXELS (logical_rect.height));
-
++
x = widget->allocation.x + xpad + GTK_MISC (self)->xalign * MAX (label_allocation_width (self) - rwidth,
0);
y = widget->allocation.y + ypad + GTK_MISC (self)->yalign * MAX (label_allocation_height (self) -
rheight, 0);
*xp = x;
@@@ -600,6 -652,7 +652,7 @@@ simple_label_expose (GtkWidget *wi
GdkEventExpose *event)
{
GxkSimpleLabel *self = GXK_SIMPLE_LABEL (widget);
-
++
label_ensure_layout (self);
if (self->needs_cutting)
{
diff --cc beast-gtk/gxk/gxksimplelabel.hh
index b74e305,7c5db78..6eb842b
--- a/beast-gtk/gxk/gxksimplelabel.hh
+++ b/beast-gtk/gxk/gxksimplelabel.hh
@@@ -9,8 -12,10 +12,10 @@@ G_BEGIN_DECL
#define GXK_IS_SIMPLE_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXK_TYPE_SIMPLE_LABEL))
#define GXK_IS_SIMPLE_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXK_TYPE_SIMPLE_LABEL))
#define GXK_SIMPLE_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXK_TYPE_SIMPLE_LABEL,
GxkSimpleLabelClass))
+
typedef struct {
GtkMisc parent_instance;
-
++
gchar *label;
guint8 jtype;
guint use_underline : 1;
diff --cc beast-gtk/gxk/gxkstatusbar.cc
index 18a0816,9f27ad1..ee962d9
--- a/beast-gtk/gxk/gxkstatusbar.cc
+++ b/beast-gtk/gxk/gxkstatusbar.cc
@@@ -37,6 -46,7 +46,7 @@@ static voi
sbar_free (gpointer data)
{
GxkStatusBar *sbar = (GxkStatusBar*) data;
-
++
status_bar_remove_timer (sbar);
g_object_unref (sbar->pbar);
g_object_unref (sbar->message);
@@@ -54,8 -65,10 +65,10 @@@ gxk_status_bar_create (void
{
GtkWidget *obox, *hbox;
GxkStatusBar *sbar = g_new0 (GxkStatusBar, 1);
-
++
if (!quark_status_bar)
quark_status_bar = g_quark_from_static_string ("GxkStatusBar");
-
++
sbar->sbar = (GtkWidget*) g_object_new (GTK_TYPE_FRAME,
"visible", FALSE,
"shadow", GTK_SHADOW_OUT,
@@@ -79,6 -92,7 +92,7 @@@
gtk_progress_set_format_string (sbar->prog, "%p %%");
gtk_progress_set_show_text (sbar->prog, TRUE);
gtk_box_pack_start (GTK_BOX (obox), GTK_WIDGET (sbar->pbar), FALSE, TRUE, 0);
-
++
hbox = (GtkWidget*) g_object_new (GTK_TYPE_HBOX,
"visible", TRUE,
"homogeneous", FALSE,
@@@ -97,6 -111,7 +111,7 @@@
"xalign", 1.0,
NULL);
gtk_box_pack_end (GTK_BOX (hbox), GTK_WIDGET (sbar->status), FALSE, TRUE, GTK_STYLE_THICKNESS
(hbox->style, y));
-
++
g_object_ref (sbar->pbar);
g_object_ref (sbar->message);
g_object_ref (sbar->status);
@@@ -104,8 -119,10 +119,10 @@@
sbar->timer_id = 0;
status_bar_queue_clear (sbar, 0);
g_object_set_qdata_full (G_OBJECT (sbar->sbar), quark_status_bar, sbar, sbar_free);
-
++
return sbar->sbar;
}
+
static gboolean
status_bar_clear_handler (gpointer data)
{
@@@ -114,13 -132,16 +132,16 @@@
sbar->timer_id = 0;
status_bar_set (sbar, GXK_STATUS_IDLE, NULL, NULL);
GDK_THREADS_LEAVE ();
-
++
return FALSE;
}
+
static void
status_bar_queue_clear (GxkStatusBar *sbar,
guint msecs)
{
status_bar_remove_timer (sbar);
-
++
if (!msecs)
status_bar_set (sbar, GXK_STATUS_IDLE, NULL, NULL);
else
@@@ -133,6 -155,7 +155,7 @@@ voi
gxk_status_clear (void)
{
GxkStatusBar *sbar = status_bar_get_current ();
-
++
if (sbar)
status_bar_queue_clear (sbar, 0);
}
@@@ -147,10 -171,12 +171,12 @@@ status_bar_set (GxkStatusBar *sbar
gfloat fraction = 0;
gboolean activity_pulse = FALSE;
gboolean beep = FALSE; /* flag beeps for errors */
-
++
if (PERC_CMP (percentage, GXK_STATUS_IDLE_HINT) && !sbar->is_idle)
return; /* don't override existing status */
if (!message) /* clear */
percentage = GXK_STATUS_IDLE;
-
++
sbar->is_idle = FALSE;
if (PERC_CMP (percentage, GXK_STATUS_IDLE))
{
@@@ -234,6 -261,7 +261,7 @@@ gxk_status_set (gfloat percentage
const gchar *status_msg)
{
GxkStatusBar *sbar = status_bar_get_current ();
-
++
if (sbar)
status_bar_set (sbar, percentage, message, status_msg);
}
@@@ -252,13 -281,16 +281,16 @@@ gxk_status_printf (gfloat percent
...)
{
GxkStatusBar *sbar = status_bar_get_current ();
-
++
if (sbar)
{
gchar *buffer;
va_list args;
-
++
va_start (args, message_fmt);
buffer = g_strdup_vprintf (message_fmt, args);
va_end (args);
-
++
status_bar_set (sbar, percentage, buffer, status_msg);
g_free (buffer);
}
@@@ -276,10 -309,12 +309,12 @@@ gxk_status_errnoprintf (gint li
...)
{
GxkStatusBar *sbar = status_bar_get_current ();
-
++
if (sbar)
{
gchar *buffer;
va_list args;
-
++
va_start (args, message_fmt);
buffer = g_strdup_vprintf (message_fmt, args);
va_end (args);
@@@ -302,6 -339,7 +339,7 @@@ gxk_status_window_push (gpointer widget
g_return_if_fail (GTK_IS_WIDGET (widget));
widget = gtk_widget_get_toplevel ((GtkWidget*) widget);
g_return_if_fail (GTK_IS_WINDOW (widget) == TRUE);
-
++
gtk_widget_ref ((GtkWidget*) widget);
status_window_stack = g_slist_prepend (status_window_stack, widget);
}
@@@ -313,6 -352,7 +352,7 @@@ voi
gxk_status_window_pop (void)
{
g_return_if_fail (status_window_stack != NULL);
-
++
gtk_widget_unref ((GtkWidget*) status_window_stack->data);
status_window_stack = g_slist_remove (status_window_stack, status_window_stack->data);
}
@@@ -321,12 -362,15 +362,15 @@@ status_bar_get_current (void
{
GxkDialog *dialog;
GSList *slist;
-
++
for (slist = status_window_stack; slist; slist = slist->next)
{
dialog = GXK_DIALOG (slist->data);
-
++
if (dialog->status_bar && GTK_WIDGET_DRAWABLE (dialog->status_bar))
return (GxkStatusBar*) g_object_get_qdata (G_OBJECT (dialog->status_bar), quark_status_bar);
}
dialog = gxk_dialog_get_status_window ();
-
++
return dialog ? (GxkStatusBar*) g_object_get_qdata (G_OBJECT (dialog->status_bar), quark_status_bar) :
NULL;
}
diff --cc beast-gtk/gxk/gxktest.cc
index 55e8e4e,d1a558a..fdb076d
--- a/beast-gtk/gxk/gxktest.cc
+++ b/beast-gtk/gxk/gxktest.cc
@@@ -43,17 -53,22 +53,22 @@@ main (int argc
GtkWidget *led, *polygon1, *polygon2, *polygon, *box, *box2;
GxkPolygonArc arcs[64];
guint i;
-
++
/* GLib's thread and object systems */
g_thread_init (NULL);
g_type_init ();
-
++
/* initialize Gtk+ and go into threading mode */
gtk_init (&argc, &argv);
g_set_prgname ("GxkTest"); /* overriding Gdk's program name */
GDK_THREADS_ENTER ();
-
++
/* initialize Gtk+ Extension Kit */
gxk_init ();
+
scroll_canvas_test ();
rack_test ();
+
/* test polygons */
{
GxkPolygonLine lines[] = {
@@@ -73,6 -88,7 +88,7 @@@
GxkPolygonGraph graph = { G_N_ELEMENTS (lines), lines, 0, NULL };
polygon1 = (GtkWidget*) gxk_polygon_new (&graph);
}
-
++
{
GxkPolygonLine lines[] = {
{ 0.0, 0.9, 0.5, 0.5 }, /* \ */
@@@ -95,6 -111,7 +111,7 @@@
arcs[i++] = (GxkPolygonArc) { 0.5, 0.5, 0.3, 0.3, 0, +360 }; /* O */
arcs[i++] = (GxkPolygonArc) { 0.5, 0.5, 0.1, 0.1, 0, -360 }; /* o */
gxk_polygon_set_arcs (GXK_POLYGON (polygon2), i, arcs);
-
++
box = (GtkWidget*) g_object_new (GTK_TYPE_VBOX,
"visible", TRUE,
NULL);
@@@ -104,26 -121,37 +121,37 @@@
"visible", TRUE,
NULL);
gtk_box_pack_start (GTK_BOX (box), box2, FALSE, FALSE, 5);
+
polygon = (GtkWidget*) gxk_polygon_new (&gxk_polygon_power);
gtk_box_pack_start (GTK_BOX (box2), polygon, FALSE, FALSE, 5);
-
++
polygon = (GtkWidget*) gxk_polygon_new (&gxk_polygon_stop);
gtk_box_pack_start (GTK_BOX (box2), polygon, FALSE, FALSE, 5);
+
polygon = (GtkWidget*) gxk_polygon_new (&gxk_polygon_first);
gtk_box_pack_start (GTK_BOX (box2), polygon, FALSE, FALSE, 5);
+
polygon = (GtkWidget*) gxk_polygon_new (&gxk_polygon_previous);
gtk_box_pack_start (GTK_BOX (box2), polygon, FALSE, FALSE, 5);
-
++
polygon = (GtkWidget*) gxk_polygon_new (&gxk_polygon_rewind);
gtk_box_pack_start (GTK_BOX (box2), polygon, FALSE, FALSE, 5);
-
++
polygon = (GtkWidget*) gxk_polygon_new (&gxk_polygon_play);
gtk_box_pack_start (GTK_BOX (box2), polygon, FALSE, FALSE, 5);
-
++
polygon = (GtkWidget*) gxk_polygon_new (&gxk_polygon_pause);
gtk_box_pack_start (GTK_BOX (box2), polygon, FALSE, FALSE, 5);
-
++
polygon = (GtkWidget*) gxk_polygon_new (&gxk_polygon_forward);
gtk_box_pack_start (GTK_BOX (box2), polygon, FALSE, FALSE, 5);
-
++
polygon = (GtkWidget*) gxk_polygon_new (&gxk_polygon_next);
gtk_box_pack_start (GTK_BOX (box2), polygon, FALSE, FALSE, 5);
+
polygon = (GtkWidget*) gxk_polygon_new (&gxk_polygon_last);
gtk_box_pack_start (GTK_BOX (box2), polygon, FALSE, FALSE, 5);
-
++
{
GxkPolygonLine lines[] = {
{ 0.25, 0.25, 0.75, 0.25 }, /* right */
@@@ -136,6 -164,7 +164,7 @@@
}
// gxk_polygon_set_length (GXK_POLYGON (polygon), 21);
gtk_box_pack_start (GTK_BOX (box2), polygon, FALSE, FALSE, 5);
-
++
led = (GtkWidget*) gxk_led_new (0x13f4e5);
gtk_box_pack_start (GTK_BOX (box), led, TRUE, TRUE, 5);
g_object_new (GTK_TYPE_WINDOW,
diff --cc beast-gtk/gxk/gxktexttools.cc
index 74049ab,6c2244a..7261ed4
--- a/beast-gtk/gxk/gxktexttools.cc
+++ b/beast-gtk/gxk/gxktexttools.cc
@@@ -472,6 -514,7 +514,7 @@@ tsm_start_element (GMarkupParseContex
GError **error)
{
TsmData *md = (TsmData*) user_data;
-
++
if (strcmp (element_name, "tagdef") == 0)
{
guint i;
@@@ -648,6 -692,7 +692,7 @@@ tsm_end_element (GMarkupParseContext *c
GError **error)
{
TsmData *md = (TsmData*) user_data;
-
++
if (strcmp (element_name, "tagdef") == 0)
{
}
@@@ -725,8 -771,10 +771,10 @@@ tsm_text (GMarkupParseContext *context
gchar *string = g_new (gchar, text_len + 1), *dest = string;
const TsmLevel *ml = tsm_peek_level (md);
guint i;
-
++
if (0)
gtk_text_buffer_insert_at_cursor (md->tbuffer, text, text_len);
-
++
for (i = 0; i < text_len; i++)
switch (text[i])
{
@@@ -792,8 -843,10 +843,10 @@@ gxk_text_buffer_insert (GtkTextBuffer *
GtkTextMark *start_mark;
GtkTextTag *tag;
gchar *name;
-
++
gtk_text_buffer_get_iter_at_mark (tbuffer, &start_iter, gtk_text_buffer_get_insert (tbuffer));
start_mark = gtk_text_buffer_create_mark (tbuffer, NULL, &start_iter, TRUE);
-
++
if (!parse_tsm)
{
GError *error = NULL;
@@@ -830,15 -883,18 +883,18 @@@
guint icon_square_sizes[] = { 8, 10, 12, 14, 16, 18, 20, 24, 32, 48, 56, 64, 96 };
static guint n_icon_sizes = G_N_ELEMENTS (icon_square_sizes);
guint n;
-
++
/* ensure certain icon sizes */
for (n = 0; n < n_icon_sizes; n++)
{
name = g_strdup_printf ("%ux%u", icon_square_sizes[n], icon_square_sizes[n]);
-
++
if (gtk_icon_size_from_name (name) == GTK_ICON_SIZE_INVALID)
gtk_icon_size_register (name, icon_square_sizes[n], icon_square_sizes[n]);
g_free (name);
}
n_icon_sizes = 0;
-
++
md.tbuffer = tbuffer;
md.tagns = gtk_text_tag_table_get_size (ttable); /* unique tag namespace */
md.lc = ' ';
@@@ -848,6 -904,7 +904,7 @@@
md.after_newline = TRUE;
md.style = NULL;
context = g_markup_parse_context_new (&tsm_parser, GMarkupParseFlags (0), &md, NULL);
-
++
n = read_callback (callback_data, data_buffer, &error);
while (n)
{
@@@ -870,6 -927,7 +927,7 @@@
if (md.style)
g_object_unref (md.style);
}
-
++
name = g_strdup_printf ("gxk-text-tools-indent-%u", indent);
tag = gtk_text_tag_table_lookup (ttable, name);
if (!tag)
@@@ -887,6 -945,7 +945,7 @@@
g_object_unref (tag);
}
g_free (name);
-
++
gtk_text_buffer_get_iter_at_mark (tbuffer, &start_iter, start_mark);
gtk_text_buffer_delete_mark (tbuffer, start_mark);
gtk_text_buffer_get_iter_at_mark (tbuffer, &end_iter, gtk_text_buffer_get_insert (tbuffer));
@@@ -898,6 -958,7 +958,7 @@@ static_read_callback (gpointer data
GError **error)
{
guint i, *ip = (guint*) data;
-
++
i = *ip;
*ip = 0;
return i;
@@@ -912,6 -974,7 +974,7 @@@ gxk_text_buffer_append_from_string (Gtk
g_return_if_fail (GTK_IS_TEXT_BUFFER (tbuffer));
if (text_length)
g_return_if_fail (text != NULL);
-
++
gxk_text_buffer_cursor_to_end (tbuffer);
if (!text_length)
return;
@@@ -924,6 -989,7 +989,7 @@@ fd_read_callback (gpointer data
GError **error)
{
gint l, *fdp = (gint*) data;
-
++
do
l = read (*fdp, buffer, FILE_READ_BUFFER_SIZE);
while (l < 0 && errno == EINTR);
@@@ -938,9 -1005,12 +1005,12 @@@ gxk_text_buffer_append_from_file (GtkTe
const gchar *file_name)
{
gint fd;
-
++
g_return_if_fail (GTK_IS_TEXT_BUFFER (tbuffer));
g_return_if_fail (file_name != NULL);
-
++
gxk_text_buffer_cursor_to_end (tbuffer);
-
++
fd = open (file_name, O_RDONLY);
if (fd >= 0)
{
@@@ -955,7 -1026,9 +1026,9 @@@ voi
gxk_text_buffer_cursor_to_start (GtkTextBuffer *tbuffer)
{
GtkTextIter iter;
-
++
g_return_if_fail (GTK_IS_TEXT_BUFFER (tbuffer));
-
++
gtk_text_buffer_get_start_iter (tbuffer, &iter);
gtk_text_buffer_place_cursor (tbuffer, &iter);
}
@@@ -963,7 -1037,9 +1037,9 @@@ voi
gxk_text_buffer_cursor_to_end (GtkTextBuffer *tbuffer)
{
GtkTextIter iter;
-
++
g_return_if_fail (GTK_IS_TEXT_BUFFER (tbuffer));
-
++
gtk_text_buffer_get_end_iter (tbuffer, &iter);
gtk_text_buffer_place_cursor (tbuffer, &iter);
}
@@@ -1263,6 -1364,7 +1364,7 @@@ gxk_scroll_text_create (GxkScrollTextFl
}
else
g_signal_connect_swapped (tbuffer, "custom-activate", G_CALLBACK (navigate_urls), sctext);
-
++
if (flags & GXK_SCROLL_TEXT_EDITABLE)
g_object_set (widget,
"editable", TRUE,
@@@ -1296,9 -1398,12 +1398,12 @@@
}
if (flags & GXK_SCROLL_TEXT_WIDGET_BG)
gxk_widget_modify_base_as_bg (widget);
+
gxk_scroll_text_append (sctext, string);
-
++
return sctext;
}
+
GtkWidget*
gxk_scroll_text_create_for (GxkScrollTextFlags flags,
GtkWidget *parent)
@@@ -1384,7 -1499,9 +1499,9 @@@ gxk_scroll_text_append (GtkWidget *sc
{
GtkTextView *tview;
GtkTextBuffer *tbuffer;
-
++
g_return_if_fail (GXK_IS_SCROLL_TEXT (sctext));
+
tview = gxk_scroll_text_get_text_view (sctext);
tbuffer = gtk_text_view_get_buffer (tview);
gxk_text_view_cursor_busy (tview);
@@@ -1407,7 -1525,9 +1525,9 @@@ gxk_scroll_text_append_tsm (GtkWidge
{
GtkTextView *tview;
GtkTextBuffer *tbuffer;
-
++
g_return_if_fail (GXK_IS_SCROLL_TEXT (sctext));
+
tview = gxk_scroll_text_get_text_view (sctext);
tbuffer = gtk_text_view_get_buffer (tview);
gxk_text_view_cursor_busy (tview);
@@@ -1479,6 -1607,7 +1607,7 @@@ gxk_scroll_text_aprintf (GtkWidget *s
{
va_list args;
gchar *buffer;
-
++
va_start (args, text_fmt);
buffer = g_strdup_vprintf (text_fmt, args);
va_end (args);
@@@ -1884,12 -2046,16 +2046,16 @@@ gxk_scroll_text_display (GtkWidget *s
const gchar *uri)
{
TextNavigation *tnav;
-
++
g_return_if_fail (GXK_IS_SCROLL_TEXT (sctext));
g_return_if_fail (uri != NULL);
-
++
tnav = navigation_from_sctext (sctext);
navigation_set_url (tnav, uri, -1);
+
scroll_text_reload (sctext);
}
+
/**
* @param sctext a scroll text widget as returned from gxk_scroll_text_create()
* @param uri resource locator
diff --cc beast-gtk/gxk/gxktexttools.hh
index 8da5633,bbf3a6b..0d975ac
--- a/beast-gtk/gxk/gxktexttools.hh
+++ b/beast-gtk/gxk/gxktexttools.hh
@@@ -80,13 -87,17 +87,17 @@@ void gxk_text_register_textget_handl
gpointer user_data);
void gxk_text_buffer_add_textgets_to_view (GtkTextBuffer *tbuffer,
GtkTextView *tview);
+
+
G_END_DECLS
+
// == Flags Enumeration Operators in C++ ==
#ifdef __cplusplus
-inline GxkScrollTextFlags operator& (GxkScrollTextFlags s1, GxkScrollTextFlags s2) { return
GxkScrollTextFlags (s1 & (long long unsigned) s2); }
-inline GxkScrollTextFlags& operator&= (GxkScrollTextFlags &s1, GxkScrollTextFlags s2) { s1 = s1 & s2;
return s1; }
-inline GxkScrollTextFlags operator| (GxkScrollTextFlags s1, GxkScrollTextFlags s2) { return
GxkScrollTextFlags (s1 | (long long unsigned) s2); }
-inline GxkScrollTextFlags& operator|= (GxkScrollTextFlags &s1, GxkScrollTextFlags s2) { s1 = s1 | s2;
return s1; }
-inline GxkScrollTextFlags operator~ (GxkScrollTextFlags s1) { return GxkScrollTextFlags
(~(long long unsigned) s1); }
+constexpr GxkScrollTextFlags operator& (GxkScrollTextFlags s1, GxkScrollTextFlags s2) { return
GxkScrollTextFlags (s1 & (long long unsigned) s2); }
+inline GxkScrollTextFlags& operator&= (GxkScrollTextFlags &s1, GxkScrollTextFlags s2) { s1 = s1 & s2;
return s1; }
+constexpr GxkScrollTextFlags operator| (GxkScrollTextFlags s1, GxkScrollTextFlags s2) { return
GxkScrollTextFlags (s1 | (long long unsigned) s2); }
+inline GxkScrollTextFlags& operator|= (GxkScrollTextFlags &s1, GxkScrollTextFlags s2) { s1 = s1 | s2;
return s1; }
+constexpr GxkScrollTextFlags operator~ (GxkScrollTextFlags s1) { return
GxkScrollTextFlags (~(long long unsigned) s1); }
#endif // __cplusplus
+
#endif /* __GXK_TEXT_TOOLS_H__ */
diff --cc beast-gtk/gxk/gxkutils.cc
index 5bd8cf0,f854681..0e35a98
--- a/beast-gtk/gxk/gxkutils.cc
+++ b/beast-gtk/gxk/gxkutils.cc
@@@ -68,6 -80,7 +80,7 @@@ gxk_init_utils (void
{
/* type registrations */
gxk_type_register_generated (G_N_ELEMENTS (generated_type_entries), generated_type_entries);
-
++
/* Gtk+ patchups */
signal_viewable_changed = g_signal_newv ("viewable-changed",
G_TYPE_FROM_CLASS (gtk_type_class (GTK_TYPE_WIDGET)),
@@@ -85,6 -98,7 +98,7 @@@
G_TYPE_NONE, 0, NULL);
GtkWidgetClass *widget_class = (GtkWidgetClass*) gtk_type_class (GTK_TYPE_WIDGET);
widget_class->can_activate_accel = gxk_widget_real_can_activate_accel;
-
++
/* patch up scrolling+focus behaviour */
g_type_class_unref (g_type_class_ref (GTK_TYPE_CONTAINER)); /* create static class */
g_signal_add_emission_hook (g_signal_lookup ("set-focus-child", GTK_TYPE_CONTAINER), 0,
@@@ -322,8 -356,10 +356,10 @@@ voi
gxk_widget_viewable_changed (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
-
++
g_signal_emit (widget, signal_viewable_changed, 0);
}
+
static void
gxk_traverse_viewable_changed (GtkWidget *widget,
gpointer data)
@@@ -348,8 -385,10 +385,10 @@@ voi
gxk_widget_attached_hierarchy_changed (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
-
++
g_signal_emit (widget, signal_attached_hierarchy_changed, 0);
}
+
static void
widget_propagate_hierarchy_changed_to_attached (GtkWidget *widget)
{
@@@ -399,6 -442,7 +442,7 @@@ gxk_window_set_cursor_type (GdkWindo
GdkCursorType cursor)
{
g_return_if_fail (GDK_IS_WINDOW (window));
-
++
if (cursor >= GDK_LAST_CURSOR || cursor < 0)
gdk_window_set_cursor (window, NULL);
else
@@@ -1100,6 -1213,7 +1213,7 @@@ voi
gxk_widget_modify_as_title (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
-
++
if (!gxk_signal_handler_exists (widget, "realize", G_CALLBACK (widget_modify_style), NULL))
{
g_object_set_int (widget, "gxk-style-modify-type", STYLE_MODIFY_FG_AS_SENSITIVE);
@@@ -2451,6 -2666,7 +2666,7 @@@ requisition_to_aux_info (GtkWidge
double *xyscale = (double*) data;
guint width = requisition->width;
guint height = requisition->height;
-
++
/* patch up requisition since gtk tends to allocate the viewport with the
* requested size minus vscrollbar->width or minus hscrollbar->height.
*/
@@@ -2469,6 -2685,7 +2685,7 @@@
height += requisition.height;
}
}
-
++
/* we constrain the requisition to a fraction of the screen size */
width = MIN (width, gdk_screen_width () * xyscale[0]);
height = MIN (height, gdk_screen_height () * xyscale[1]);
diff --cc beast-gtk/gxk/splinetest.cc
index 29e5a6f,e621714..6aeb7fe
--- a/beast-gtk/gxk/splinetest.cc
+++ b/beast-gtk/gxk/splinetest.cc
@@@ -51,9 -55,12 +55,12 @@@ main (int argc
gtk_init (&argc, &argv);
g_set_prgname ("splinetest"); /* overriding Gdk's program name */
GDK_THREADS_ENTER ();
-
++
/* initialize Gtk+ Extension Kit */
gxk_init ();
+
/* usage: splinetest <variant123> <nsteps> */
+
gint variant = 0, steps = 10;
if (argc > 1)
variant = atoi (argv[1]);
diff --cc beast-gtk/testgui.cc
index 15a3bdb,7d1b8b1..cd0ce7d
--- a/beast-gtk/testgui.cc
+++ b/beast-gtk/testgui.cc
@@@ -11,6 -12,8 +12,8 @@@ gboolean bst_developer_hint
gboolean bst_debug_extensions = FALSE;
gboolean bst_main_loop_running = TRUE;
void beast_show_about_box (void) {}
-
++
+
/* --- functions --- */
static gboolean
change_beam_value (gpointer data)
@@@ -35,6 -39,7 +39,7 @@@ create_db_meter (GtkOrientation orient
GtkWidget *widget = bst_db_meter_new (orientation, 0);
BstDBMeter *self = BST_DB_METER (widget);
BstDBBeam *dbbeam;
-
++
bst_db_meter_create_dashes (self, GTK_JUSTIFY_RIGHT, 2);
bst_db_meter_create_scale (self, 2);
bst_db_meter_create_dashes (self, GTK_JUSTIFY_FILL, 2);
diff --cc bse/bseautodoc.cc
index b656ead,51876a2..77165df
--- a/bse/bseautodoc.cc
+++ b/bse/bseautodoc.cc
@@@ -196,7 -214,9 +214,9 @@@ show_procdoc (void
{
BseCategorySeq *cseq;
guint i;
-
++
g_print ("functions = (\n");
+
cseq = bse_categories_match_typed ("*", BSE_TYPE_PROCEDURE);
for (i = 0; i < cseq->n_cats; i++)
{
@@@ -206,6 -226,7 +226,7 @@@
gchar *cname = g_type_name_to_cname (cseq->cats[i]->type);
gchar *sname = g_type_name_to_sname (cseq->cats[i]->type);
guint j;
-
++
g_print ("{\n");
g_print (" 'name': '%s',\n", cname);
g_print (" 'aliases': [ ('%s', 'scheme'), ], # aliases\n", sname);
@@@ -224,8 -246,10 +246,10 @@@
}
else if (pclass->n_out_pspecs > 1)
g_print (" 'return': ('RETURNS', 'MultiReturn', '', '', ('%s', '', 0), ),\n", _("This procedure
has multiple return values."));
+
if (blurb)
g_print (" 'description': (%s, '', 0),\n", qescape (blurb));
-
++
/* procedures/%s:0 is a lame substitute for the real file/line location */
if (bse_type_get_file (type))
{
@@@ -242,6 -266,7 +266,7 @@@
}
else
g_print (" 'location': ('procedures/%s', 0),\n", cseq->cats[i]->type);
-
++
g_print ("},\n");
g_type_class_unref (pclass);
g_free (cname);
@@@ -255,7 -281,9 +281,9 @@@ show_structdoc (void
{
GType *children;
guint i;
-
++
g_print ("structures = (\n");
+
children = g_type_children (G_TYPE_BOXED, NULL);
for (i = 0; children[i]; i++)
{
@@@ -271,6 -300,7 +300,7 @@@
const gchar *cstring;
SfiRing *ring, *pspecs = NULL;
guint j;
-
++
g_print ("{\n");
g_print (" 'name': '%s',\n", name);
g_print (" 'hint': '%s',\n", dname);
@@@ -281,6 -312,7 +312,7 @@@
pspecs = sfi_ring_append (pspecs, rfields.fields[j]);
if (element)
pspecs = sfi_ring_append (pspecs, element);
-
++
if (element)
{
GParamSpec *pspec = (GParamSpec*) pspecs->data;
@@@ -316,8 -349,10 +349,10 @@@
g_string_append (full_description, " ");
g_string_append (full_description, cstring);
}
-
++
if (full_description->str[0])
g_print (" 'description': (%s, '', 0),\n", qescape (full_description->str));
-
++
/* structures/%s:0 is a lame substitute for the real file/line location */
if (bse_type_get_file (type))
{
@@@ -334,8 -369,10 +369,10 @@@
}
else
g_print (" 'location': ('structures/%s', 0),\n", g_type_name (type));
-
++
g_print ("},\n");
g_string_free (full_description, TRUE);
-
++
g_free (cname);
g_free (sname);
sfi_ring_free (pspecs);
@@@ -483,8 -529,10 +529,10 @@@ help (const gchar *name
fprintf (stderr, " -s include scripts\n");
fprintf (stderr, " -h show help\n");
fprintf (stderr, " --seealso <link> add a SEE ALSO section link\n");
-
++
return arg != NULL;
}
+
int
main (gint argc,
gchar *argv[])
diff --cc bse/bsebiquadfilter.cc
index 8a710a5,4436d19..93944bf
--- a/bse/bsebiquadfilter.cc
+++ b/bse/bsebiquadfilter.cc
@@@ -40,11 -46,13 +44,13 @@@ static void bse_biquad_filter_update
static gpointer parent_class = NULL;
static const GTypeInfo type_info_biquad_filter = {
sizeof (BseBiquadFilterClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_biquad_filter_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseBiquadFilter),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_biquad_filter_init,
@@@ -54,17 -64,20 +62,20 @@@ BSE_BUILTIN_TYPE (BseBiquadFilter
{
static const GTypeInfo type_info = {
sizeof (BseBiquadFilterClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_biquad_filter_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseBiquadFilter),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_biquad_filter_init,
};
#include "./icons/biquad.c"
GType type;
-
++
type = bse_type_register_static (BSE_TYPE_SOURCE,
"BseBiquadFilter",
"BseBiquadFilter - an infinite impulse "
@@@ -85,10 -99,14 +97,14 @@@ bse_biquad_filter_class_init (BseBiquad
BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
guint channel_id;
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = bse_biquad_filter_set_property;
gobject_class->get_property = bse_biquad_filter_get_property;
-
++
source_class->context_create = bse_biquad_filter_context_create;
-
++
bse_object_class_add_param (object_class, _("Filter"),
PROP_FILTER_TYPE,
bse_param_spec_genum ("filter_type", _("Filter Type"), _("The filter design
type"),
@@@ -151,6 -169,7 +167,7 @@@
_("Strength of gain modulation"),
0.0, 0.0, 100.0, 5.0,
SFI_PARAM_STANDARD ":scale"));
-
++
channel_id = bse_source_class_add_ichannel (source_class, "audio-in", _("Audio In"), _("Unfiltered Audio
Signal"));
g_assert (channel_id == BSE_BIQUAD_FILTER_ICHANNEL_AUDIO);
channel_id = bse_source_class_add_ichannel (source_class, "freq-in", _("Freq In"), _("Center Frequency
Input"));
@@@ -182,6 -203,7 +201,7 @@@ bse_biquad_filter_set_property (GObjec
GParamSpec *pspec)
{
BseBiquadFilter *self = BSE_BIQUAD_FILTER (object);
-
++
switch (param_id)
{
case PROP_FILTER_TYPE:
@@@ -236,6 -259,7 +257,7 @@@ bse_biquad_filter_get_property (GObjec
GParamSpec *pspec)
{
BseBiquadFilter *self = BSE_BIQUAD_FILTER (object);
-
++
switch (param_id)
{
case PROP_FILTER_TYPE:
@@@ -285,6 -311,7 +309,7 @@@ biquad_filter_access (BseModule *module
{
FilterModule *fmod = (FilterModule*) module->user_data;
const FilterModule *cfg = (const FilterModule*) data;
-
++
fmod->fm = cfg->fm;
fmod->config = cfg->config;
fmod->base_freq = cfg->base_freq;
@@@ -299,6 -327,7 +325,7 @@@ bse_biquad_filter_update_modules (BseBi
{
FilterModule *cfg = g_new0 (FilterModule, 1);
gfloat nyquist_freq = 0.5 * bse_engine_sample_freq ();
-
++
cfg->base_freq = MIN (self->freq, nyquist_freq);
cfg->gain = self->gain;
cfg->gain_strength = self->gain_strength;
@@@ -340,6 -374,7 +368,7 @@@ biquad_filter_reset (BseModule *module
{
FilterModule *fmod = (FilterModule*) module->user_data;
gfloat nyquist_freq = 0.5 * bse_engine_sample_freq ();
-
++
gsl_biquad_config_setup (&fmod->config, fmod->base_freq / nyquist_freq, fmod->gain, 0);
gsl_biquad_filter_config (&fmod->biquad, &fmod->config, TRUE);
}
@@@ -352,6 -388,7 +382,7 @@@ biquad_filter_process (BseModule *modul
gfloat *sig_out = BSE_MODULE_OBUFFER (module, BSE_BIQUAD_FILTER_OCHANNEL_AUDIO);
gfloat *bound = sig_out + n_values;
gboolean sig_out_as_freq = TRUE;
-
++
if (BSE_MODULE_ISTREAM (module, BSE_BIQUAD_FILTER_ICHANNEL_FREQ).connected &&
BSE_MODULE_ISTREAM (module, BSE_BIQUAD_FILTER_ICHANNEL_FREQ_MOD).connected)
bse_frequency_modulator (&fmod->fm,
@@@ -373,6 -410,7 +404,7 @@@
sig_out);
else
sig_out_as_freq = FALSE;
-
++
if (BSE_MODULE_ISTREAM (module, BSE_BIQUAD_FILTER_ICHANNEL_GAIN_MOD).connected && sig_out_as_freq)
{
const gfloat *gain_in = BSE_MODULE_IBUFFER (module, BSE_BIQUAD_FILTER_ICHANNEL_GAIN_MOD);
@@@ -383,6 -421,7 +415,7 @@@
do
{
guint n = MIN (bound - sig_out, bse_engine_control_raster ());
-
++
if (UNLIKELY (BSE_SIGNAL_FREQ_CHANGED (*sig_out, last_freq)))
{
last_freq = *sig_out;
@@@ -416,6 -455,7 +449,7 @@@
do
{
guint n = MIN (bound - sig_out, bse_engine_control_raster ());
-
++
if (UNLIKELY (BSE_SIGNAL_FREQ_CHANGED (*sig_out, last_freq)))
{
last_freq = *sig_out;
@@@ -436,6 -476,7 +470,7 @@@
do
{
guint n = MIN (bound - sig_out, bse_engine_control_raster ());
-
++
if (UNLIKELY (BSE_SIGNAL_GAIN_CHANGED (*gain_in, last_gain)))
{
last_gain = *gain_in;
@@@ -471,6 -513,7 +507,7 @@@ bse_biquad_filter_context_create (BseSo
FilterModule *fmod = g_new0 (FilterModule, 1);
gfloat nyquist_freq = 0.5 * bse_engine_sample_freq ();
BseModule *module;
-
++
fmod->base_freq = MIN (self->freq, nyquist_freq);
fmod->gain = self->gain;
fmod->gain_strength = self->gain_strength;
@@@ -481,11 -524,15 +518,15 @@@
fmod->fm.fine_tune = 0;
gsl_biquad_config_init (&fmod->config, GslBiquadType (self->filter_type), GslBiquadNormalize
(self->norm_type));
gsl_biquad_config_setup (&fmod->config, fmod->base_freq / nyquist_freq, fmod->gain, 0);
-
++
module = bse_module_new (&biquad_filter_class, fmod);
-
++
/* setup module i/o streams with BseSource i/o channels */
bse_source_set_context_module (source, context_handle, module);
-
++
/* commit module to engine */
bse_trans_add (trans, bse_job_integrate (module));
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_create (source, context_handle, trans);
}
diff --cc bse/bseblockutils.hh
index 44492fd,4ee67bc..d36418e
--- a/bse/bseblockutils.hh
+++ b/bse/bseblockutils.hh
@@@ -116,6 -118,9 +120,9 @@@ public
BseResampler2Precision precision) { return
singleton->create_resampler2 (mode, precision); }
static inline
bool test_resampler2 (bool verbose) { return
singleton->test_resampler2 (verbose); }
+
+
-
++
class Impl {
protected:
virtual ~Impl ();
@@@ -179,56 -186,64 +188,64 @@@ Block::fill (guint n_values
guint32 *values,
guint32 value)
{
- BIRNET_STATIC_ASSERT (sizeof (wchar_t) == 4);
+ RAPICORN_STATIC_ASSERT (sizeof (wchar_t) == 4);
wmemset ((wchar_t*) values, value, n_values);
}
+
inline void
Block::copy (guint n_values,
guint32 *values,
const guint32 *ivalues)
{
- BIRNET_STATIC_ASSERT (sizeof (wchar_t) == 4);
+ RAPICORN_STATIC_ASSERT (sizeof (wchar_t) == 4);
wmemcpy ((wchar_t*) values, (const wchar_t*) ivalues, n_values);
}
+
inline void
Block::copy (guint n_values,
gfloat *values,
const gfloat *ivalues)
{
- BIRNET_STATIC_ASSERT (sizeof (float) == 4);
- BIRNET_STATIC_ASSERT (sizeof (wchar_t) == 4);
+ RAPICORN_STATIC_ASSERT (sizeof (float) == 4);
+ RAPICORN_STATIC_ASSERT (sizeof (wchar_t) == 4);
wmemcpy ((wchar_t*) values, (const wchar_t*) ivalues, n_values);
}
+
} // Bse
#endif /* __cplusplus */
+
/* --- C implementation bits --- */
G_BEGIN_DECLS
+
static inline void
bse_block_fill_uint32 (guint n_values,
guint32 *values,
guint32 vuint32)
{
- BIRNET_STATIC_ASSERT (sizeof (wchar_t) == 4);
+ RAPICORN_STATIC_ASSERT (sizeof (wchar_t) == 4);
wmemset ((wchar_t*) values, vuint32, n_values);
}
+
static inline void
bse_block_fill_float (guint n_values,
float *values,
const float value)
{
- BIRNET_STATIC_ASSERT (sizeof (float) == 4);
+ RAPICORN_STATIC_ASSERT (sizeof (float) == 4);
const union { float f; guint32 vuint32; } u = { value };
- BIRNET_STATIC_ASSERT (sizeof (wchar_t) == 4);
+ RAPICORN_STATIC_ASSERT (sizeof (wchar_t) == 4);
wmemset ((wchar_t*) values, u.vuint32, n_values);
}
+
static inline void
bse_block_copy_uint32 (guint n_values,
guint32 *values,
const guint32 *ivalues)
{
- BIRNET_STATIC_ASSERT (sizeof (wchar_t) == 4);
+ RAPICORN_STATIC_ASSERT (sizeof (wchar_t) == 4);
wmemcpy ((wchar_t*) values, (const wchar_t*) ivalues, n_values);
}
+
static inline void
bse_block_copy_float (guint n_values,
gfloat *values,
diff --cc bse/bsebus.cc
index f95e9e5,ac4a611..6d43aed
--- a/bse/bsebus.cc
+++ b/bse/bsebus.cc
@@@ -459,14 -485,19 +485,19 @@@ bse_bus_set_parent (BseItem *item
{
BseBus *self = BSE_BUS (item);
self->solo_muted = FALSE;
+
if (item->parent)
bse_object_unproxy_notifies (item->parent, self, "notify::outputs");
+
/* chain parent class' handler */
BSE_ITEM_CLASS (bus_parent_class)->set_parent (item, parent);
+
if (item->parent)
bse_object_proxy_notifies (item->parent, self, "notify::outputs");
+
while (self->inputs)
bse_bus_disconnect (self, BSE_ITEM (self->inputs->data));
-
++
if (self->summation)
{
BseItem *sitem = BSE_ITEM (self->summation);
@@@ -780,22 -834,28 +834,28 @@@ bse_bus_class_init (BseBusClass *klass
BseItemClass *item_class = BSE_ITEM_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
guint channel_id;
-
++
bus_parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = bse_bus_set_property;
gobject_class->get_property = bse_bus_get_property;
gobject_class->dispose = bse_bus_dispose;
gobject_class->finalize = bse_bus_finalize;
-
++
object_class->editable_property = bse_bus_editable_property;
object_class->store_private = bus_store_private;
object_class->restore_start = bus_restore_start;
object_class->restore_private = bus_restore_private;
object_class->restore_finish = bus_restore_finish;
+
item_class->set_parent = bse_bus_set_parent;
item_class->get_candidates = bse_bus_get_candidates;
-
++
source_class->prepare = bse_bus_prepare;
source_class->context_create = bse_bus_context_create;
source_class->context_connect = bse_bus_context_connect;
source_class->reset = bse_bus_reset;
-
++
bse_object_class_add_param (object_class, _("Adjustments"), PROP_MUTE,
sfi_pspec_bool ("mute", _("Mute"), _("Mute: turn off the bus volume"), FALSE,
SFI_PARAM_STANDARD ":skip-default"));
bse_object_class_add_param (object_class, _("Adjustments"), PROP_SOLO,
diff --cc bse/bsebus.hh
index 9003f45,4993eb3..52e98d5
--- a/bse/bsebus.hh
+++ b/bse/bsebus.hh
@@@ -10,8 -13,12 +13,10 @@@ G_BEGIN_DECL
#define BSE_IS_BUS(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BSE_TYPE_BUS))
#define BSE_IS_BUS_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), BSE_TYPE_BUS))
#define BSE_BUS_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BSE_TYPE_BUS, BseBusClass))
+
+
/* --- BseBus source --- */
-struct _BseBus
-{
- BseSubSynth parent_object;
+struct BseBus : BseSubSynth {
SfiRing *inputs;
double left_volume;
double right_volume;
diff --cc bse/bsebus.proc
index 5209930,b3f2607..5f17f57
--- a/bse/bsebus.proc
+++ b/bse/bsebus.proc
@@@ -127,10 -148,13 +148,13 @@@ BODY (BseProcedureClass *proc
if (!error)
bse_item_push_undo_proc (self, "connect-bus", bus);
}
-
++
/* set output parameters */
g_value_set_enum (out_values++, error);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseBus, ensure-output) {
HELP = _("Ensure that a bus has an output connection.");
IN = bse_param_spec_object ("bus", NULL, NULL, BSE_TYPE_BUS, SFI_PARAM_STANDARD);
@@@ -160,7 -186,9 +186,9 @@@ BODY (BseProcedureClass *proc
bse_item_push_undo_proc (master, "disconnect-bus", self);
}
}
+
/* set output parameters */
g_value_set_enum (out_values++, error);
-
++
return BSE_ERROR_NONE;
}
diff --cc bse/bsebusmodule.idl
index ce9fd03,414a165..9355c56
--- a/bse/bsebusmodule.idl
+++ b/bse/bsebusmodule.idl
@@@ -13,8 -17,9 +13,9 @@@ interface BusModule : Effect
group _("Volume") {
// Real volume1 = DBVolume (_("Left"), _("Volume adjustment of left channel"), 0, -96, +24,
STANDARD);
// Real volume2 = DBVolume (_("Right"), _("Volume adjustment of right channel"), 0, -96, +24,
STANDARD);
- Real volume1 = (NULL, NULL, 1, 0, 1000, 10, STANDARD); /* volume factor */
- Real volume2 = (NULL, NULL, 1, 0, 1000, 10, STANDARD); /* volume factor */
+ Real volume1 = SfiReal ("", "", 1, 0, 1000, 10, STANDARD); /* volume factor */
+ Real volume2 = SfiReal ("", "", 1, 0, 1000, 10, STANDARD); /* volume factor */
};
};
+
};
diff --cc bse/bsecategories.cc
index ec02112,21f331a..5d68531
--- a/bse/bsecategories.cc
+++ b/bse/bsecategories.cc
@@@ -31,11 -42,14 +42,14 @@@ static inline CEntry
centry_find (GQuark quark)
{
CEntry *centry;
-
++
for (centry = cat_entries; centry; centry = centry->next)
if (centry->category == quark)
return centry;
-
++
return NULL;
}
+
static inline guint
category_strip_toplevels (const gchar *category,
GType type)
@@@ -51,6 -65,7 +65,7 @@@
{ 6, "/Proc/", },
};
guint l = strlen (category);
-
++
if (l > 10 && strncmp (category, "/Methods/", 8) == 0)
{
const gchar *p = category + 8;
@@@ -74,14 -91,17 +91,17 @@@
strncmp (category, scripts[i].prefix, scripts[i].length) == 0)
return scripts[i].length;
}
-
++
return 0;
}
+
static guint
leaf_index (const gchar *string)
{
gboolean in_quote = FALSE;
guint pos = 0;
const gchar *p;
-
++
for (p = string; *p; p++)
switch (*p)
{
@@@ -100,6 -121,7 +121,7 @@@ centry_new (const gchar *caller
CEntry *centry;
GQuark quark;
guint mindex;
-
++
mindex = category_strip_toplevels (category, type);
if (!mindex)
{
@@@ -112,9 -134,11 +134,11 @@@
g_warning ("%s(): unable to add category duplicate `%s'", caller, category);
return NULL;
}
-
++
if (!g_trash_stack_peek (&free_entries))
{
CEntry *limit;
-
++
centry = g_new (CEntry, CATEGORIES_PRE_ALLOC);
limit = centry + CATEGORIES_PRE_ALLOC - 1;
while (centry < limit)
@@@ -122,6 -146,7 +146,7 @@@
}
else
centry = (CEntry*) g_trash_stack_pop (&free_entries);
-
++
centry->next = cat_entries;
cat_entries = centry;
centry->category_id = global_category_id++;
@@@ -129,9 -154,12 +154,12 @@@
centry->mindex = mindex - 1;
centry->lindex = leaf_index (category);
centry->category = g_quark_from_string (category);
-
++
cats_need_sort = TRUE;
-
++
return centry;
}
+
static void
check_type (GType type)
{
@@@ -189,8 -224,10 +222,10 @@@ cats_sort (void
{
GSList *slist, *clist = NULL;
CEntry *centry, *last;
-
++
if (!cats_need_sort)
return;
-
++
for (centry = cat_entries; centry; centry = centry->next)
clist = g_slist_prepend (clist, centry);
clist = g_slist_sort (clist, centries_strorder);
@@@ -203,8 -240,10 +238,10 @@@
}
cat_entries = centry;
g_slist_free (clist);
-
++
cats_need_sort = FALSE;
}
+
static inline BseCategorySeq*
categories_match (const gchar *pattern,
GType base_type,
@@@ -241,17 -285,23 +283,23 @@@ bse_categories_match (const gchar
gpointer data)
{
g_return_val_if_fail (pattern != NULL, NULL);
-
++
cats_sort ();
-
++
return categories_match (pattern, 0, check, data);
}
+
BseCategorySeq*
bse_categories_match_typed (const gchar *pattern,
GType base_type)
{
g_return_val_if_fail (pattern != NULL, NULL);
-
++
cats_sort ();
-
++
return categories_match (pattern, base_type, NULL, NULL);
}
+
BseCategorySeq*
bse_categories_from_type (GType type)
{
diff --cc bse/bsecategories.proc
index 18d5b65,f6429de..7ec7e4e
--- a/bse/bsecategories.proc
+++ b/bse/bsecategories.proc
@@@ -22,17 -26,22 +26,22 @@@ BODY (BseProcedureClass *proc
const char *type_name = sfi_value_get_string (in_values++);
GType type = type_name ? g_type_from_name (type_name) : 0;
BseCategorySeq *cseq = NULL;
-
++
/* check parameters */
if (!pattern)
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
if (type)
cseq = bse_categories_match_typed (pattern, type);
if (!cseq)
cseq = bse_category_seq_new ();
-
++
/* set output parameters */
bse_value_take_boxed (out_values++, cseq);
-
++
return BSE_ERROR_NONE;
}
+
PROCEDURE (bse-categories-match, "Categories/Match") {
HELP = "List BSE categories according to a pattern match.";
IN = sfi_pspec_string ("pattern", "Pattern", "Pattern to match category, supports '*' and '?'
wildcards.",
@@@ -46,16 -55,21 +55,21 @@@ BODY (BseProcedureClass *proc
/* extract parameter values */
const char *pattern = sfi_value_get_string (in_values++);
BseCategorySeq *cseq = NULL;
-
++
/* check parameters */
if (!pattern)
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
cseq = bse_categories_match_typed (pattern, 0);
if (!cseq)
cseq = bse_category_seq_new ();
-
++
/* set output parameters */
bse_value_take_boxed (out_values++, cseq);
-
++
return BSE_ERROR_NONE;
}
+
PROCEDURE (bse-category-from-id, "Categories/From ID") {
HELP = "Find a BSE category from it's unique ID.";
IN = sfi_pspec_int ("category_id", "Category ID", NULL,
@@@ -69,11 -83,15 +83,15 @@@ BODY (BseProcedureClass *proc
/* extract parameter values */
guint id = sfi_value_get_int (in_values++);
BseCategory *cat;
+
cat = bse_category_from_id (id);
-
++
/* set output parameters */
bse_value_take_boxed (out_values++, cat);
-
++
return BSE_ERROR_NONE;
}
+
static gboolean
categories_check_method (BseCategory *cat,
gpointer data)
@@@ -108,13 -127,17 +127,17 @@@ BODY (BseProcedureClass *proc
const char *type_name = sfi_value_get_string (in_values++);
GType type = type_name ? g_type_from_name (type_name) : 0;
BseCategorySeq *cseq = NULL;
-
++
/* check parameters */
if (!pattern)
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
cseq = bse_categories_match (pattern, BSE_TYPE_PROCEDURE, categories_check_method, &type);
if (!cseq)
cseq = bse_category_seq_new ();
-
++
/* set output parameters */
bse_value_take_boxed (out_values++, cseq);
-
++
return BSE_ERROR_NONE;
}
diff --cc bse/bseconstant.cc
index af48c58,2569066..214c048
--- a/bse/bseconstant.cc
+++ b/bse/bseconstant.cc
@@@ -36,25 -46,30 +46,30 @@@ BSE_BUILTIN_TYPE (BseConstant
{
static const GTypeInfo type_info = {
sizeof (BseConstantClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_constant_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseConstant),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_constant_init,
};
#include "./icons/const.c"
GType type_id;
-
++
type_id = bse_type_register_static (BSE_TYPE_SOURCE,
"BseConstant",
"This module provides constant signal outputs",
__FILE__, __LINE__,
&type_info);
bse_categories_register_stock_module (N_("/Other Sources/Constant"), type_id, const_pixstream);
-
++
return type_id;
}
+
static void
bse_constant_class_init (BseConstantClass *klass)
{
@@@ -62,15 -77,20 +77,20 @@@
BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
guint ochannel, i;
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = bse_constant_set_property;
gobject_class->get_property = bse_constant_get_property;
-
++
source_class->context_create = bse_constant_context_create;
-
++
for (i = 1; i <= BSE_CONSTANT_N_OUTPUTS; i++)
{
gchar *ident, *label, *blurb, *group = g_strdup_printf (_("Constant Output %u"), i);
-
++
ident = g_strdup_printf ("value_%u", i);
- label = g_strdup_printf (_("Value [float]"));
+ label = g_strdup_printf ("%s", _("Value [float]"));
bse_object_class_add_param (object_class, group, PARAM_VALUE + (i - 1) * 3,
sfi_pspec_real (ident, label, _("Constant signal value"),
1.0, -1.0, 1.0, 0.01,
@@@ -111,6 -132,7 +132,7 @@@ static voi
bse_constant_init (BseConstant *constant)
{
guint i;
-
++
for (i = 0; i < BSE_CONSTANT_N_OUTPUTS; i++)
constant->constants[i] = 1.0;
}
@@@ -121,6 -144,7 +144,7 @@@ bse_constant_set_property (GObjec
GParamSpec *pspec)
{
BseConstant *self = BSE_CONSTANT (object);
-
++
switch (param_id)
{
guint indx, n;
@@@ -178,6 -203,7 +203,7 @@@ bse_constant_get_property (GObject
GParamSpec *pspec)
{
BseConstant *self = BSE_CONSTANT (object);
-
++
switch (param_id)
{
guint indx, n;
@@@ -243,13 -280,18 +271,18 @@@ bse_constant_context_create (BseSource
};
ConstantModule *constant = g_new0 (ConstantModule, 1);
BseModule *module;
-
++
module = bse_module_new (&constant_class, constant);
-
++
/* setup module i/o streams with BseSource i/o channels */
bse_source_set_context_module (source, context_handle, module);
-
++
/* commit module to engine */
bse_trans_add (trans, bse_job_integrate (module));
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_create (source, context_handle, trans);
-
++
/* update (initialize) module data */
bse_constant_update_modules (BSE_CONSTANT (source), trans);
}
diff --cc bse/bsecontainer.cc
index 260d582,1e6fc3f..cdcea6e
--- a/bse/bsecontainer.cc
+++ b/bse/bsecontainer.cc
@@@ -59,15 -69,18 +69,18 @@@ BSE_BUILTIN_TYPE (BseContainer
{
static const GTypeInfo container_info = {
sizeof (BseContainerClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_container_class_init,
(GClassFinalizeFunc) bse_container_class_finalize,
NULL /* class_data */,
-
++
sizeof (BseContainer),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_container_init,
};
-
++
return bse_type_register_abstract (BSE_TYPE_SOURCE,
"BseContainer",
"Base type to manage BSE items",
@@@ -81,19 -95,24 +95,24 @@@ bse_container_class_init (BseContainerC
BseObjectClass *object_class;
BseItemClass *item_class;
BseSourceClass *source_class;
-
++
parent_class = (GTypeClass*) g_type_class_peek_parent (klass);
gobject_class = G_OBJECT_CLASS (klass);
object_class = BSE_OBJECT_CLASS (klass);
item_class = BSE_ITEM_CLASS (klass);
source_class = BSE_SOURCE_CLASS (klass);
-
++
quark_cross_links = g_quark_from_static_string ("BseContainerCrossLinks");
-
++
gobject_class->dispose = bse_container_dispose;
gobject_class->finalize = bse_container_finalize;
-
++
source_class->prepare = bse_container_prepare;
source_class->context_create = bse_container_context_create;
source_class->context_connect = bse_container_context_connect;
source_class->context_dismiss = bse_container_context_dismiss;
source_class->reset = bse_container_reset;
-
++
klass->add_item = bse_container_do_add_item;
klass->remove_item = bse_container_do_remove_item;
klass->forall_items = NULL;
@@@ -101,6 -120,7 +120,7 @@@
klass->retrieve_child = bse_container_real_retrieve_child;
klass->context_children = container_context_children;
klass->release_children = container_release_children;
-
++
container_signals[SIGNAL_ITEM_ADDED] = bse_object_class_add_signal (object_class, "item_added",
G_TYPE_NONE, 1, BSE_TYPE_ITEM);
container_signals[SIGNAL_ITEM_REMOVE] = bse_object_class_add_signal (object_class, "item_remove",
@@@ -125,12 -149,15 +149,15 @@@ static voi
bse_container_dispose (GObject *gobject)
{
BseContainer *container = BSE_CONTAINER (gobject);
-
++
if (!BSE_ITEM (container)->use_count)
{
BSE_CONTAINER_GET_CLASS (container)->release_children (container);
-
++
/* remove any existing cross-links (with notification) */
g_object_set_qdata (G_OBJECT (container), quark_cross_links, NULL);
}
-
++
/* chain parent class' dispose handler */
G_OBJECT_CLASS (parent_class)->dispose (gobject);
}
@@@ -138,13 -166,16 +166,16 @@@ static voi
bse_container_finalize (GObject *gobject)
{
BseContainer *container = BSE_CONTAINER (gobject);
-
++
if (container->n_items)
g_warning ("%s: finalize handlers missed to remove %u items from %s",
G_STRLOC,
container->n_items,
BSE_OBJECT_TYPE_NAME (container));
-
++
/* chain parent class' finalize handler */
G_OBJECT_CLASS (parent_class)->finalize (gobject);
-
++
/* gobject->finalize() clears the datalist, which may cause this
* container to end up in the containers_cross_changes list again,
* so we make sure it is removed *after* the datalist has been
@@@ -160,12 -192,16 +192,16 @@@ bse_container_do_add_item (BseContaine
g_object_ref (item);
container->n_items += 1;
bse_item_set_parent (item, BSE_ITEM (container));
-
++
if (BSE_IS_SOURCE (item) && BSE_SOURCE_PREPARED (container))
{
BseTrans *trans = bse_trans_open ();
guint *cids, n, c;
-
++
g_return_if_fail (BSE_SOURCE_PREPARED (item) == FALSE);
-
++
bse_source_prepare (BSE_SOURCE (item));
-
++
/* create and connect item contexts */
cids = bse_source_context_ids (BSE_SOURCE (container), &n);
for (c = 0; c < n; c++)
@@@ -238,6 -285,7 +285,7 @@@ bse_container_new_child_bname (BseConta
{
gpointer child;
va_list var_args;
-
++
g_return_val_if_fail (BSE_IS_CONTAINER (container), NULL);
g_return_val_if_fail (g_type_is_a (child_type, BSE_TYPE_ITEM), NULL);
g_return_val_if_fail (!G_TYPE_IS_ABSTRACT (child_type), NULL);
@@@ -249,20 -298,25 +298,25 @@@
g_object_set (child, "uname", NULL, NULL); /* no undo */
bse_container_add_item (container, BSE_ITEM (child));
g_object_unref (child);
-
++
return child;
}
+
static void
bse_container_do_remove_item (BseContainer *container,
BseItem *item)
{
BseItem *ancestor = BSE_ITEM (container);
-
++
do
{
bse_container_uncross_descendant (BSE_CONTAINER (ancestor), item);
ancestor = ancestor->parent;
}
while (ancestor);
-
++
container->n_items -= 1;
-
++
if (BSE_IS_SOURCE (item))
{
/* detach item from rest of the world */
@@@ -272,15 -326,19 +326,19 @@@
if (BSE_SOURCE_PREPARED (container))
{
g_return_if_fail (BSE_SOURCE_PREPARED (item) == TRUE);
-
++
bse_source_reset (BSE_SOURCE (item));
}
}
-
++
/* reset parent *after* uncrossing, so "release" notification
* on item operates on sane object trees
*/
bse_item_set_parent (item, NULL);
-
++
g_object_unref (item);
}
+
void
bse_container_remove_item (BseContainer *container,
BseItem *item)
@@@ -288,16 -346,19 +346,19 @@@
gboolean finalizing_container;
BseUndoStack *ustack;
guint seqid;
-
++
g_return_if_fail (BSE_IS_CONTAINER (container));
g_return_if_fail (BSE_IS_ITEM (item));
g_return_if_fail (item->parent == BSE_ITEM (container));
g_return_if_fail (BSE_CONTAINER_GET_CLASS (container)->remove_item != NULL); /* paranoid */
-
++
finalizing_container = G_OBJECT (container)->ref_count == 0;
if (!finalizing_container)
g_object_ref (container);
g_object_ref (item);
ustack = bse_item_undo_open (container, "remove-child-noundo");
bse_undo_stack_ignore_steps (ustack);
-
++
seqid = bse_container_get_item_seqid (container, item);
g_object_freeze_notify (G_OBJECT (container));
g_object_freeze_notify (G_OBJECT (item));
@@@ -306,6 -367,7 +367,7 @@@
BSE_CONTAINER_GET_CLASS (container)->remove_item (container, item);
g_object_thaw_notify (G_OBJECT (item));
g_object_thaw_notify (G_OBJECT (container));
-
++
bse_undo_stack_unignore_steps (ustack);
bse_item_undo_close (ustack);
g_object_unref (item);
@@@ -319,9 -382,11 +382,11 @@@ bse_container_forall_items (BseContaine
{
g_return_if_fail (BSE_IS_CONTAINER (container));
g_return_if_fail (func != NULL);
-
++
if (container->n_items)
{
g_return_if_fail (BSE_CONTAINER_GET_CLASS (container)->forall_items != NULL); /* paranoid */
-
++
BSE_CONTAINER_GET_CLASS (container)->forall_items (container, func, data);
}
}
@@@ -330,29 -396,39 +396,39 @@@ list_items (BseItem *item
gpointer data)
{
BseItemSeq *iseq = (BseItemSeq*) data;
-
++
bse_item_seq_append (iseq, item);
-
++
return TRUE;
}
+
BseItemSeq*
bse_container_list_children (BseContainer *container)
{
BseItemSeq *iseq;
-
++
g_return_val_if_fail (BSE_IS_CONTAINER (container), NULL);
-
++
iseq = bse_item_seq_new ();
if (container->n_items)
{
g_return_val_if_fail (BSE_CONTAINER_GET_CLASS (container)->forall_items != NULL, NULL); /* paranoid */
-
++
BSE_CONTAINER_GET_CLASS (container)->forall_items (container, list_items, iseq);
}
-
++
return iseq;
}
+
static gboolean
count_item_seqid (BseItem *item,
gpointer data_p)
{
void **data = (void**) data_p;
-
++
if (G_OBJECT_TYPE (item) == (GType) data[2])
data[0] = GUINT_TO_POINTER (GPOINTER_TO_UINT (data[0]) + 1);
-
++
if (item == data[1])
{
data[1] = NULL;
@@@ -368,14 -445,19 +445,19 @@@ bse_container_get_item_seqid (BseContai
g_return_val_if_fail (BSE_IS_CONTAINER (container), 0);
g_return_val_if_fail (BSE_IS_ITEM (item), 0);
g_return_val_if_fail (item->parent == BSE_ITEM (container), 0);
-
++
if (container->n_items)
{
gpointer data[3];
-
++
g_return_val_if_fail (BSE_CONTAINER_GET_CLASS (container)->forall_items != NULL, 0); /* paranoid */
-
++
data[0] = GUINT_TO_POINTER (0);
data[1] = item;
data[2] = (gpointer) G_OBJECT_TYPE (item);
-
++
BSE_CONTAINER_GET_CLASS (container)->forall_items (container, count_item_seqid, data);
-
++
return data[1] == NULL ? GPOINTER_TO_UINT (data[0]) : 0;
}
else
@@@ -386,6 -469,7 +469,7 @@@ find_nth_item (BseItem *item
gpointer data_p)
{
void **data = (void**) data_p;
-
++
if (G_OBJECT_TYPE (item) == (GType) data[2])
{
data[0] = GUINT_TO_POINTER (GPOINTER_TO_UINT (data[0]) - 1);
@@@ -405,14 -490,19 +490,19 @@@ bse_container_get_item (BseContainer *c
g_return_val_if_fail (BSE_IS_CONTAINER (container), NULL);
g_return_val_if_fail (seqid > 0, NULL);
g_return_val_if_fail (g_type_is_a (item_type, BSE_TYPE_ITEM), NULL);
-
++
if (container->n_items)
{
gpointer data[3];
-
++
g_return_val_if_fail (BSE_CONTAINER_GET_CLASS (container)->forall_items != NULL, NULL); /* paranoid */
-
++
data[0] = GUINT_TO_POINTER (seqid);
data[1] = NULL;
data[2] = (gpointer) item_type;
-
++
BSE_CONTAINER_GET_CLASS (container)->forall_items (container, find_nth_item, data);
-
++
return BSE_ITEM (data[1]);
}
else
@@@ -434,6 -526,7 +526,7 @@@ bse_container_store_children (BseContai
{
g_return_if_fail (BSE_IS_CONTAINER (container));
g_return_if_fail (BSE_IS_STORAGE (storage));
-
++
g_object_ref (container);
bse_container_forall_items (container, store_forall, storage);
g_object_unref (container);
@@@ -459,6 -556,7 +556,7 @@@ find_unamed_item (BseItem *item
{
void **data = (void**) data_p;
gchar *uname = (char*) data[1];
-
++
if (bse_string_equals (BSE_OBJECT_UNAME (item), uname))
{
data[0] = item;
@@@ -471,13 -570,18 +570,18 @@@ bse_container_lookup_item (BseContaine
const gchar *uname)
{
gpointer data[2] = { NULL, };
-
++
g_return_val_if_fail (BSE_IS_CONTAINER (container), NULL);
g_return_val_if_fail (uname != NULL, NULL);
-
++
/* FIXME: better use a hashtable here */
-
++
data[1] = (gpointer) uname;
bse_container_forall_items (container, find_unamed_item, data);
-
++
return BSE_ITEM (data[0]);
}
+
static BseItem*
bse_container_real_retrieve_child (BseContainer *container,
GType child_type,
@@@ -494,8 -599,10 +599,10 @@@ bse_container_retrieve_child (BseContai
BseItem *item = NULL;
gchar *type_name, *uname;
GType type;
-
++
g_return_val_if_fail (BSE_IS_CONTAINER (container), NULL);
g_return_val_if_fail (type_uname != NULL, NULL);
-
++
/* type_uname syntax:
* <TYPE> [ <::> <UNAME> ]
* examples:
@@@ -506,6 -613,7 +613,7 @@@
* to have unique names (enforced in bse_container_add_item()
* and bse_item_do_set_uname()).
*/
-
++
type_name = g_strdup (type_uname);
uname = strchr (type_name, ':');
if (uname)
@@@ -522,21 -630,27 +630,27 @@@
if (g_type_is_a (type, BSE_TYPE_ITEM))
item = BSE_CONTAINER_GET_CLASS (container)->retrieve_child (container, type, uname);
g_free (type_name);
-
++
return item;
}
+
BseItem*
bse_container_resolve_upath (BseContainer *container,
const gchar *upath)
{
const gchar *next_uname;
-
++
g_return_val_if_fail (BSE_IS_CONTAINER (container), NULL);
g_return_val_if_fail (upath != NULL, NULL);
-
++
/* upaths consist of colon seperated unames from the item's ancestry */
-
++
next_uname = strchr (upath, ':');
if (next_uname)
{
gchar *uname = g_strndup (upath, next_uname - upath);
BseItem *item = bse_container_lookup_item (container, uname);
-
++
g_free (uname);
if (BSE_IS_CONTAINER (item))
return bse_container_resolve_upath (BSE_CONTAINER (item), next_uname + 1);
@@@ -554,10 -669,12 +669,12 @@@ bse_container_make_upath (BseContainer
GSList *slist, *ulist = NULL;
gchar *path, *p;
guint n;
-
++
g_return_val_if_fail (BSE_IS_CONTAINER (container), NULL);
g_return_val_if_fail (BSE_IS_ITEM (item), NULL);
self_item = BSE_ITEM (container);
g_return_val_if_fail (bse_item_has_ancestor (item, self_item), NULL); /* item != self_item */
-
++
n = 0;
for (; item != self_item; item = item->parent)
{
@@@ -574,22 -691,29 +691,29 @@@
*p++ = ':';
}
g_slist_free (ulist);
-
++
return path;
}
+
static gboolean
notify_cross_changes (gpointer data)
{
BSE_THREADS_ENTER ();
-
++
while (containers_cross_changes)
{
BseContainer *container = BSE_CONTAINER (containers_cross_changes->data);
-
++
containers_cross_changes = g_slist_remove_all (containers_cross_changes, container);
// g_signal_emit (container, container_signals[SIGNAL_CROSS_CHANGES], 0);
}
containers_cross_changes_handler = 0;
-
++
BSE_THREADS_LEAVE ();
-
++
return FALSE;
}
+
static inline void
container_queue_cross_changes (BseContainer *container)
{
@@@ -627,9 -753,11 +753,11 @@@ uncross_link_R (BseContainerCrossLinks
unode.owner = clinks->cross_links[n].owner;
unode.link = clinks->cross_links[n].link;
unode.uncross = clinks->cross_links[n].uncross;
-
++
clinks->n_cross_links--;
if (n < clinks->n_cross_links)
clinks->cross_links[n] = clinks->cross_links[clinks->n_cross_links];
-
++
if (notify)
{
/* record recursion */
@@@ -645,8 -774,10 +774,10 @@@ static voi
destroy_clinks (gpointer data)
{
BseContainerCrossLinks *clinks = (BseContainerCrossLinks*) data;
-
++
if (clinks->n_cross_links)
container_queue_cross_changes (clinks->container);
-
++
while (clinks->n_cross_links)
uncross_link_R (clinks, clinks->n_cross_links - 1, TRUE);
g_free (clinks);
@@@ -671,15 -805,18 +805,18 @@@ _bse_container_cross_link (BseContaine
{
BseContainerCrossLinks *clinks;
guint i;
-
++
/* prerequisites:
* - container == bse_item_common_ancestor (owner, link)
* - container != owner || container != link
* + implies: owner != link
*/
-
++
g_return_if_fail (BSE_IS_CONTAINER (container));
g_return_if_fail (BSE_IS_ITEM (owner));
g_return_if_fail (BSE_IS_ITEM (link));
g_return_if_fail (uncross != NULL);
-
++
clinks = container_get_clinks (container);
if (!clinks)
{
@@@ -692,6 -829,7 +829,7 @@@
else
{
BseContainerCrossLinks *old_loc = clinks;
-
++
i = clinks->n_cross_links++;
clinks = (BseContainerCrossLinks*) g_realloc (clinks, sizeof (BseContainerCrossLinks) + i * sizeof
(clinks->cross_links[0]));
if (old_loc != clinks)
@@@ -701,8 -839,10 +839,10 @@@
clinks->cross_links[i].link = link;
clinks->cross_links[i].uncross = uncross;
// clinks->cross_links[i].data = data;
-
++
container_queue_cross_changes (container);
}
+
void
_bse_container_cross_unlink (BseContainer *container,
BseItem *owner,
@@@ -711,13 -851,16 +851,16 @@@
{
UncrossNode *unode;
gboolean found_one = FALSE;
-
++
g_return_if_fail (BSE_IS_CONTAINER (container));
g_return_if_fail (BSE_IS_ITEM (owner));
g_return_if_fail (BSE_IS_ITEM (link));
g_return_if_fail (uncross != NULL);
-
++
g_object_ref (container);
g_object_ref (owner);
g_object_ref (link);
-
++
/* _first_ check whether a currently uncrossing (in recursion)
* link is to be unlinked
*/
@@@ -740,6 -883,7 +883,7 @@@
if (clinks)
{
guint i = 0;
-
++
while (i < clinks->n_cross_links)
{
if (clinks->cross_links[i].owner == owner &&
@@@ -760,6 -904,7 +904,7 @@@
G_OBJECT_TYPE_NAME (owner),
G_OBJECT_TYPE_NAME (link),
G_OBJECT_TYPE_NAME (container));
-
++
g_object_unref (link);
g_object_unref (owner);
g_object_unref (container);
@@@ -770,12 -916,15 +916,15 @@@ _bse_container_uncross (BseContainer *
BseItem *link)
{
BseContainerCrossLinks *clinks;
-
++
g_return_if_fail (BSE_IS_CONTAINER (container));
g_return_if_fail (BSE_IS_ITEM (owner));
g_return_if_fail (BSE_IS_ITEM (link));
-
++
g_object_ref (container);
g_object_ref (owner);
g_object_ref (link);
-
++
clinks = container_get_clinks (container);
if (clinks)
{
@@@ -793,6 -942,7 +942,7 @@@
i++;
}
}
-
++
g_object_unref (link);
g_object_unref (owner);
g_object_unref (container);
@@@ -806,6 -957,7 +957,7 @@@ item_check_branch (BseItem *item
gpointer container)
{
BseItem *ancestor = BSE_ITEM (container);
-
++
do
{
if (item == ancestor)
@@@ -813,25 -965,32 +965,32 @@@
item = item->parent;
}
while (item);
-
++
return FALSE;
}
+
static void
bse_container_uncross_descendant (BseContainer *container,
BseItem *item)
{
BseContainerCrossLinks *clinks;
gboolean found_one = FALSE;
-
++
/* prerequisites:
* bse_item_has_ancestor (item, container) == TRUE
*/
-
++
g_return_if_fail (BSE_IS_CONTAINER (container));
g_return_if_fail (BSE_IS_ITEM (item));
-
++
clinks = container_get_clinks (container);
if (clinks)
{
guint i = 0;
-
++
g_object_ref (container);
g_object_ref (item);
-
++
/* suppress tree walks where possible
*/
if (!BSE_IS_CONTAINER (item) || ((BseContainer*) item)->n_items == 0)
@@@ -850,6 -1009,7 +1009,7 @@@
else /* need to check whether item is ancestor of any of the cross-link items here */
{
BseItem *saved_parent, *citem = BSE_ITEM (container);
-
++
/* we do some minor hackery here, for optimization purposes:
* since item is a child of container, we don't need to walk
* ->owner's or ->link's ancestor list any further than
@@@ -866,10 -1026,12 +1026,12 @@@
item_check_branch (clinks->cross_links[i].link, item))
{
citem->parent = saved_parent;
-
++
found_one = TRUE;
uncross_link_R (clinks, i, TRUE);
clinks = container_get_clinks (container);
i = 0;
-
++
saved_parent = citem->parent;
citem->parent = NULL;
}
@@@ -878,8 -1040,10 +1040,10 @@@
}
citem->parent = saved_parent;
}
-
++
if (found_one)
container_queue_cross_changes (container);
-
++
g_object_unref (item);
g_object_unref (container);
}
@@@ -890,18 -1055,23 +1055,23 @@@ forall_prepare (BseItem *item
{
if (BSE_IS_SOURCE (item) && !BSE_SOURCE_PREPARED (item))
bse_source_prepare (BSE_SOURCE (item));
-
++
return TRUE;
}
+
static void
bse_container_prepare (BseSource *source)
{
BseContainer *container = BSE_CONTAINER (source);
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->prepare (source);
-
++
/* make sure all BseSource children are prepared last */
if (container->n_items)
{
g_return_if_fail (BSE_CONTAINER_GET_CLASS (container)->forall_items != NULL); /* paranoid */
-
++
BSE_CONTAINER_GET_CLASS (container)->forall_items (container, forall_prepare, NULL);
}
}
@@@ -910,30 -1081,40 +1081,40 @@@ forall_slist_prepend (BseItem *item
gpointer data)
{
GSList **slist_p = (GSList**) data;
-
++
if (BSE_IS_SOURCE (item))
*slist_p = g_slist_prepend (*slist_p, item);
-
++
return TRUE;
}
+
static GSList*
container_context_children (BseContainer *container)
{
GSList *slist = NULL;
-
++
g_return_val_if_fail (BSE_CONTAINER_GET_CLASS (container)->forall_items != NULL, NULL); /* paranoid */
-
++
BSE_CONTAINER_GET_CLASS (container)->forall_items (container, forall_slist_prepend, &slist);
-
++
return slist;
}
+
static void
bse_container_context_create (BseSource *source,
guint context_handle,
BseTrans *trans)
{
BseContainer *container = BSE_CONTAINER (source);
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_create (source, context_handle, trans);
-
++
/* handle children */
if (container->n_items)
{
GSList *node, *slist = BSE_CONTAINER_GET_CLASS (container)->context_children (container);
-
++
for (node = slist; node; node = node->next)
bse_source_create_context (BSE_SOURCE (node->data), context_handle, trans);
g_slist_free (slist);
@@@ -945,28 -1127,37 +1127,37 @@@ forall_context_connect (BseItem *item
{
void **data = (void**) _data;
guint cid = GPOINTER_TO_UINT (data[0]);
-
++
if (BSE_IS_SOURCE (item))
{
BseSource *source = BSE_SOURCE (item);
-
++
g_return_val_if_fail (BSE_SOURCE_PREPARED (item), TRUE);
-
++
if (bse_source_has_context (source, cid))
bse_source_connect_context (source, cid, (BseTrans*) data[1]);
}
-
++
return TRUE;
}
+
static void
bse_container_context_connect (BseSource *source,
guint context_handle,
BseTrans *trans)
{
BseContainer *container = BSE_CONTAINER (source);
-
++
/* handle children */
if (container->n_items)
{
gpointer data[2] = { GUINT_TO_POINTER (context_handle), trans };
-
++
g_return_if_fail (BSE_CONTAINER_GET_CLASS (container)->forall_items != NULL); /* paranoid */
-
++
BSE_CONTAINER_GET_CLASS (container)->forall_items (container, forall_context_connect, data);
}
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_connect (source, context_handle, trans);
}
@@@ -976,28 -1168,37 +1168,37 @@@ forall_context_dismiss (BseItem *item
{
void **data = (void**) _data;
guint cid = GPOINTER_TO_UINT (data[0]);
-
++
if (BSE_IS_SOURCE (item))
{
BseSource *source = BSE_SOURCE (item);
-
++
g_return_val_if_fail (BSE_SOURCE_PREPARED (item), TRUE);
-
++
if (bse_source_has_context (source, cid))
bse_source_dismiss_context (source, cid, (BseTrans*) data[1]);
}
-
++
return TRUE;
}
+
static void
bse_container_context_dismiss (BseSource *source,
guint context_handle,
BseTrans *trans)
{
BseContainer *container = BSE_CONTAINER (source);
-
++
/* handle children */
if (container->n_items)
{
gpointer data[2] = { GUINT_TO_POINTER (context_handle), trans };
-
++
g_return_if_fail (BSE_CONTAINER_GET_CLASS (container)->forall_items != NULL); /* paranoid */
-
++
BSE_CONTAINER_GET_CLASS (container)->forall_items (container, forall_context_dismiss, data);
}
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_dismiss (source, context_handle, trans);
}
@@@ -1008,20 -1210,26 +1210,26 @@@ forall_reset (BseItem *item
if (BSE_IS_SOURCE (item))
{
g_return_val_if_fail (BSE_SOURCE_PREPARED (item), TRUE);
-
++
bse_source_reset (BSE_SOURCE (item));
}
-
++
return TRUE;
}
+
static void
bse_container_reset (BseSource *source)
{
BseContainer *container = BSE_CONTAINER (source);
-
++
/* make sure all BseSource children are reset first */
if (container->n_items)
{
g_return_if_fail (BSE_CONTAINER_GET_CLASS (container)->forall_items != NULL); /* paranoid */
-
++
BSE_CONTAINER_GET_CLASS (container)->forall_items (container, forall_reset, NULL);
}
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->reset (source);
}
diff --cc bse/bsecontainer.proc
index 5d22c6f,e29b72d..2366605
--- a/bse/bsecontainer.proc
+++ b/bse/bsecontainer.proc
@@@ -18,10 -23,13 +23,13 @@@ METHOD (BseContainer, list-children)
/* check parameters */
if (!BSE_IS_CONTAINER (container))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
bse_value_take_boxed (out_values++, bse_container_list_children (container));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseContainer, lookup-item) {
HELP = ("Find an immediate child of a container from its uname (the uname "
"is the name of the item, unique between all immediate children of a container).");
@@@ -38,10 -47,13 +47,13 @@@
/* check parameters */
if (!BSE_IS_CONTAINER (container) || !uname)
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
bse_value_set_object (out_values++, bse_container_lookup_item (container, uname));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseContainer, get-item) {
HELP = "Retrieve a containers immediate child from it's sequential id.";
IN = bse_param_spec_object ("container", NULL, NULL, BSE_TYPE_CONTAINER, SFI_PARAM_STANDARD);
diff --cc bse/bsecontextmerger.cc
index f73819d,627ed7e..837e00a
--- a/bse/bsecontextmerger.cc
+++ b/bse/bsecontextmerger.cc
@@@ -30,6 -37,7 +37,7 @@@ BSE_BUILTIN_TYPE (BseContextMerger
0 /* n_preallocs */,
(GInstanceInitFunc) bse_context_merger_init,
};
-
++
return bse_type_register_static (BSE_TYPE_SOURCE,
"BseContextMerger",
"Internal CONTEXT Voice glue object (merger)",
@@@ -41,16 -50,21 +50,21 @@@ bse_context_merger_class_init (BseConte
{
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
uint channel_id, i;
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
source_class->context_create = bse_context_merger_context_create;
source_class->context_dismiss = bse_context_merger_context_dismiss;
-
++
for (i = 0; i < BSE_CONTEXT_MERGER_N_IOPORTS; i++)
{
char *ident;
-
++
ident = g_strdup_printf ("input-%u", i + 1);
channel_id = bse_source_class_add_jchannel (source_class, ident, NULL, NULL);
g_assert (channel_id == i);
g_free (ident);
-
++
ident = g_strdup_printf ("output-%u", i + 1);
channel_id = bse_source_class_add_ochannel (source_class, ident, NULL, NULL);
g_assert (channel_id == i);
@@@ -67,6 -83,7 +83,7 @@@ bse_context_merger_set_merge_context (B
uint merge_context)
{
g_return_if_fail (BSE_CONTEXT_MERGER (self));
-
++
if (merge_context)
{
g_return_if_fail (self->merge_context == 0);
@@@ -74,8 -91,10 +91,10 @@@
}
else
g_return_if_fail (self->merge_context != 0);
-
++
self->merge_context = merge_context;
}
+
typedef struct {
uint real_context;
uint ref_count;
@@@ -85,10 -105,12 +105,12 @@@ context_merger_process (BseModule *m
uint n_values)
{
uint i;
-
++
for (i = 0; i < BSE_CONTEXT_MERGER_N_IOPORTS; i++)
if (BSE_MODULE_OSTREAM (module, i).connected)
{
uint j, n_cons = BSE_MODULE_JSTREAM (module, i).n_connections;
-
++
if (!n_cons)
module->ostreams[i].values = bse_engine_const_values (0);
else if (n_cons == 1)
@@@ -123,6 -146,7 +146,7 @@@ bse_context_merger_context_create (BseS
};
BseContextMerger *self = BSE_CONTEXT_MERGER (source);
BseModule *module;
-
++
/* merge with existing context if set */
if (self->merge_context)
{
@@@ -145,8 -169,10 +169,10 @@@
/* commit module to engine */
bse_trans_add (trans, bse_job_integrate (module));
}
-
++
/* setup module i/o streams with BseSource i/o channels */
bse_source_set_context_module (source, context_handle, module);
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_create (source, context_handle, trans);
}
@@@ -156,6 -183,7 +183,7 @@@ bse_context_merger_context_dismiss (Bse
BseTrans *trans)
{
BseModule *module;
-
++
/* if the BseModule wasn't created within context_handle, we would
* just need to disconnect it from connections within this context
* and not discard it. however, that's somewhat tedious since it
@@@ -164,6 -192,7 +192,7 @@@
* so we can simply skip the disconnection, as usually all contexts
* should be dismissed together.
*/
-
++
module = bse_source_get_context_imodule (source, context_handle);
if (module)
{
@@@ -176,6 -205,7 +205,7 @@@
bse_source_set_context_omodule (source, context_handle, NULL);
}
}
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_dismiss (source, context_handle, trans);
}
diff --cc bse/bsecsynth.cc
index 30b150b,d5531bd..eb58956
--- a/bse/bsecsynth.cc
+++ b/bse/bsecsynth.cc
@@@ -39,7 -48,9 +48,9 @@@ static voi
bse_csynth_class_init (BseCSynthClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
++
parent_class = (GTypeClass*) g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = bse_csynth_set_property;
gobject_class->get_property = bse_csynth_get_property;
gobject_class->finalize = bse_csynth_finalize;
@@@ -53,6 -66,7 +66,7 @@@ static voi
bse_csynth_finalize (GObject *object)
{
// BseCSynth *csynth = BSE_CSYNTH (object);
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@@ -63,6 -78,7 +78,7 @@@ bse_csynth_set_property (GObject *
GParamSpec *pspec)
{
BseCSynth *self = BSE_CSYNTH (object);
-
++
switch (param_id)
{
default:
@@@ -77,6 -94,7 +94,7 @@@ bse_csynth_get_property (GObject *o
GParamSpec *pspec)
{
BseCSynth *self = BSE_CSYNTH (object);
-
++
switch (param_id)
{
default:
diff --cc bse/bsecsynth.hh
index be777c6,0f3ecaa..92d9976
--- a/bse/bsecsynth.hh
+++ b/bse/bsecsynth.hh
@@@ -11,12 -14,22 +14,14 @@@ G_BEGIN_DECL
#define BSE_IS_CSYNTH_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), BSE_TYPE_CSYNTH))
#define BSE_CSYNTH_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BSE_TYPE_CSYNTH, BseCSynthClass))
#define BSE_CSYNTH_USER_SYNTH(src) ((BSE_OBJECT_FLAGS (src) & BSE_CSYNTH_FLAG_USER_SYNTH) != 0)
+
+
/* --- BseCSynth object --- */
-struct _BseCSynth
-{
- BseSNet parent_object;
-};
-struct _BseCSynthClass
-{
- BseSNetClass parent_class;
-};
-
+struct BseCSynth : BseSNet
+{};
+struct BseCSynthClass : BseSNetClass
+{};
/* --- prototypes --- */
-
-
G_END_DECLS
-
#endif /* __BSE_CSYNTH_H__ */
diff --cc bse/bsecxxbase.cc
index 3f5d12f,bd507f8..e4875c4
--- a/bse/bsecxxbase.cc
+++ b/bse/bsecxxbase.cc
@@@ -242,8 -282,10 +282,10 @@@ CxxBaseClass::add_signal (const gchar *
{
va_list args;
guint signal_id;
-
++
g_return_val_if_fail (n_params <= SFI_VMARSHAL_MAX_ARGS, 0);
g_return_val_if_fail (signal_name != NULL, 0);
-
++
va_start (args, n_params);
signal_id = g_signal_new_valist (signal_name,
G_TYPE_FROM_CLASS (this),
@@@ -253,8 -295,10 +295,10 @@@
G_TYPE_NONE,
n_params, args);
va_end (args);
-
++
return signal_id;
}
+
void
CxxBaseClass::add_ochannel (const char *ident,
const char *label,
diff --cc bse/bsecxxmodule.cc
index f5561d2,90b0a9a..eb89f32
--- a/bse/bsecxxmodule.cc
+++ b/bse/bsecxxmodule.cc
@@@ -61,26 -71,31 +71,28 @@@ SynthesisModule::set_module (BseModule
{
g_return_if_fail (intern_module == NULL);
g_return_if_fail (engine_module != NULL);
-
++
intern_module = engine_module;
+
/* assert validity of the above casts */
- BIRNET_STATIC_ASSERT (sizeof (JStream) == sizeof (BseJStream));
- BIRNET_STATIC_ASSERT (offsetof (JStream, values) == offsetof (BseJStream, values));
- BIRNET_STATIC_ASSERT (sizeof (((JStream*)0)->values) == sizeof (((BseJStream*)0)->values));
- BIRNET_STATIC_ASSERT (offsetof (JStream, n_connections) == offsetof (BseJStream, n_connections));
- BIRNET_STATIC_ASSERT (sizeof (((JStream*)0)->n_connections) == sizeof (((BseJStream*)0)->n_connections));
- BIRNET_STATIC_ASSERT (offsetof (JStream, jcount) == offsetof (BseJStream, jcount));
- BIRNET_STATIC_ASSERT (sizeof (((JStream*)0)->jcount) == sizeof (((BseJStream*)0)->jcount));
-
- BIRNET_STATIC_ASSERT (sizeof (IStream) == sizeof (BseIStream));
- BIRNET_STATIC_ASSERT (offsetof (IStream, values) == offsetof (BseIStream, values));
- BIRNET_STATIC_ASSERT (sizeof (((IStream*)0)->values) == sizeof (((BseIStream*)0)->values));
- BIRNET_STATIC_ASSERT (offsetof (IStream, connected) == offsetof (BseIStream, connected));
- BIRNET_STATIC_ASSERT (sizeof (((IStream*)0)->connected) == sizeof (((BseIStream*)0)->connected));
-
- BIRNET_STATIC_ASSERT (sizeof (OStream) == sizeof (BseOStream));
- BIRNET_STATIC_ASSERT (offsetof (OStream, values) == offsetof (BseOStream, values));
- BIRNET_STATIC_ASSERT (sizeof (((OStream*)0)->values) == sizeof (((BseOStream*)0)->values));
- BIRNET_STATIC_ASSERT (offsetof (OStream, connected) == offsetof (BseOStream, connected));
- BIRNET_STATIC_ASSERT (sizeof (((OStream*)0)->connected) == sizeof (((BseOStream*)0)->connected));
+ RAPICORN_STATIC_ASSERT (sizeof (JStream) == sizeof (BseJStream));
+ RAPICORN_STATIC_ASSERT (offsetof (JStream, values) == offsetof (BseJStream, values));
+ RAPICORN_STATIC_ASSERT (sizeof (((JStream*)0)->values) == sizeof (((BseJStream*)0)->values));
+ RAPICORN_STATIC_ASSERT (offsetof (JStream, n_connections) == offsetof (BseJStream, n_connections));
+ RAPICORN_STATIC_ASSERT (sizeof (((JStream*)0)->n_connections) == sizeof
(((BseJStream*)0)->n_connections));
+ RAPICORN_STATIC_ASSERT (offsetof (JStream, jcount) == offsetof (BseJStream, jcount));
+ RAPICORN_STATIC_ASSERT (sizeof (((JStream*)0)->jcount) == sizeof (((BseJStream*)0)->jcount));
+ RAPICORN_STATIC_ASSERT (sizeof (IStream) == sizeof (BseIStream));
+ RAPICORN_STATIC_ASSERT (offsetof (IStream, values) == offsetof (BseIStream, values));
+ RAPICORN_STATIC_ASSERT (sizeof (((IStream*)0)->values) == sizeof (((BseIStream*)0)->values));
+ RAPICORN_STATIC_ASSERT (offsetof (IStream, connected) == offsetof (BseIStream, connected));
+ RAPICORN_STATIC_ASSERT (sizeof (((IStream*)0)->connected) == sizeof (((BseIStream*)0)->connected));
+ RAPICORN_STATIC_ASSERT (sizeof (OStream) == sizeof (BseOStream));
+ RAPICORN_STATIC_ASSERT (offsetof (OStream, values) == offsetof (BseOStream, values));
+ RAPICORN_STATIC_ASSERT (sizeof (((OStream*)0)->values) == sizeof (((BseOStream*)0)->values));
+ RAPICORN_STATIC_ASSERT (offsetof (OStream, connected) == offsetof (BseOStream, connected));
+ RAPICORN_STATIC_ASSERT (sizeof (((OStream*)0)->connected) == sizeof (((BseOStream*)0)->connected));
}
-
void
SynthesisModule::ostream_set (uint ostream_index,
const float *values)
@@@ -399,14 -435,17 +432,17 @@@ Effect::class_init (CxxBaseClass *klass
CxxBase *base = cast (source);
Effect *self = static_cast<Effect*> (base);
BseModule *engine_module = self->integrate_engine_module (context_handle, trans);
-
++
/* setup module i/o streams with BseSource i/o channels */
bse_source_set_context_module (source, context_handle, engine_module);
-
++
/* reset module */
bse_trans_add (trans, bse_job_force_reset (engine_module));
/* configure module */
SynthesisModule::Closure *clo = self->make_module_config_closure();
if (clo)
bse_trans_add (trans, bse_job_access (engine_module, access_trampoline, clo, access_data_free));
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (effect_parent_class)->context_create (source, context_handle, trans);
}
diff --cc bse/bsecxxmodule.hh
index 2a9aecc,19b37f0..386f67b
--- a/bse/bsecxxmodule.hh
+++ b/bse/bsecxxmodule.hh
@@@ -123,6 -129,7 +129,7 @@@ public
virtual void prepare2() { /* override this to do something after parent class prepare */ }
virtual void reset1() { /* override this to do something before parent class dismiss */ }
virtual void reset2() { /* override this to do something after parent class dismiss */ }
-
++
static void class_init (CxxBaseClass *klass);
protected:
const BseModuleClass* create_engine_class (SynthesisModule *sample_module,
diff --cc bse/bsedatahandle-fir.cc
index 15cefb8,ec36e5e..281c047
--- a/bse/bsedatahandle-fir.cc
+++ b/bse/bsedatahandle-fir.cc
@@@ -151,7 -173,9 +173,9 @@@ public
if (l < 0) // pass on errors
return l;
}
+
g_assert (ivoffset == m_input_voffset);
-
++
voffset -= ivoffset;
n_values = min (n_values, m_block_size - voffset);
fir_apply (voffset, n_values, values);
diff --cc bse/bsedatahandle-resample.cc
index 8bc92dd,4d1c438..a708ede
--- a/bse/bsedatahandle-resample.cc
+++ b/bse/bsedatahandle-resample.cc
@@@ -128,6 -144,7 +144,7 @@@ public
break;
default: g_assert_not_reached();
}
-
++
m_frame_size = 1024 * setup->n_channels;
m_pcm_frame = -2;
m_pcm_data.resize (m_frame_size);
@@@ -164,8 -185,10 +185,10 @@@
{
for (guint i = 0; i < m_dhandle.setup.n_channels; i++)
delete m_resamplers[i];
+
m_resamplers.clear();
m_pcm_data.clear();
-
++
m_dhandle.setup.xinfos = NULL; /* cleanup pointer reference */
gsl_data_handle_close (m_src_handle);
}
diff --cc bse/bsedatapocket.cc
index c8bb8f6,fd8855a..3061f30
--- a/bse/bsedatapocket.cc
+++ b/bse/bsedatapocket.cc
@@@ -40,15 -51,18 +51,18 @@@ BSE_BUILTIN_TYPE (BseDataPocket
{
static const GTypeInfo data_pocket_info = {
sizeof (BseDataPocketClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_data_pocket_class_init,
(GClassFinalizeFunc) bse_data_pocket_class_finalize,
NULL /* class_data */,
-
++
sizeof (BseDataPocket),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_data_pocket_init,
};
-
++
return bse_type_register_static (BSE_TYPE_ITEM,
"BseDataPocket",
"Data pocket type",
@@@ -61,13 -76,18 +76,18 @@@ bse_data_pocket_class_init (BseDataPock
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
BseItemClass *item_class = BSE_ITEM_CLASS (klass);
-
++
parent_class = g_type_class_peek_parent (klass);
quark_set_data = g_quark_from_static_string ("set-data");
-
++
gobject_class->dispose = bse_data_pocket_dispose;
gobject_class->finalize = bse_data_pocket_finalize;
-
++
object_class->store_private = bse_data_pocket_do_store_private;
object_class->restore_private = bse_data_pocket_restore_private;
-
++
item_class->needs_storage = bse_data_pocket_needs_storage;
+
signal_entry_added = bse_object_class_add_signal (object_class, "entry-added",
G_TYPE_NONE, 1, G_TYPE_INT);
signal_entry_removed = bse_object_class_add_signal (object_class, "entry-removed",
@@@ -92,26 -115,34 +115,34 @@@ static voi
bse_data_pocket_dispose (GObject *object)
{
BseDataPocket *pocket = BSE_DATA_POCKET (object);
+
/* set disposal flag early, since we check for it internally */
BSE_OBJECT_SET_FLAGS (object, BSE_OBJECT_FLAG_DISPOSING);
-
++
while (pocket->n_entries)
_bse_data_pocket_delete_entry (pocket, pocket->entries[0].id);
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->dispose (object);
-
++
g_return_if_fail (pocket->cr_items == NULL);
}
+
static void
bse_data_pocket_finalize (GObject *object)
{
BseDataPocket *pocket = BSE_DATA_POCKET (object);
Notify *notify, *last = NULL;
-
++
while (pocket->n_entries)
_bse_data_pocket_delete_entry (pocket, pocket->entries[0].id);
-
++
for (notify = changed_notify_list; notify; )
{
if (notify->pocket == pocket)
{
Notify *tmp;
-
++
if (last)
last->next = notify->next;
else
@@@ -126,30 -157,39 +157,39 @@@
notify = last->next;
}
}
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->finalize (object);
-
++
g_return_if_fail (pocket->cr_items == NULL);
}
+
static gboolean
changed_notify_handler (void *data)
{
BSE_THREADS_ENTER ();
-
++
while (changed_notify_list)
{
Notify *notify = changed_notify_list;
-
++
changed_notify_list = notify->next;
if (!BSE_OBJECT_DISPOSING (notify->pocket))
g_signal_emit (notify->pocket, signal_entry_changed, 0, notify->entry_id);
g_free (notify);
}
-
++
BSE_THREADS_LEAVE ();
-
++
return FALSE;
}
+
static void
changed_notify_add (BseDataPocket *pocket,
uint entry_id)
{
Notify *notify;
-
++
if (!changed_notify_list)
bse_idle_notify (changed_notify_handler, NULL);
for (notify = changed_notify_list; notify; notify = notify->next)
@@@ -167,10 -208,12 +208,12 @@@ pocket_uncross (BseItem *pitem
{
BseDataPocket *pocket = BSE_DATA_POCKET (pitem);
uint i;
-
++
for (i = 0; i < pocket->n_entries; i++)
{
BseDataPocketEntry *entry = pocket->entries + i;
uint n, have_this_id = 0;
-
++
for (n = 0; n < entry->n_items; n++)
if (entry->items[n].type == BSE_DATA_POCKET_OBJECT &&
entry->items[n].value.v_object == item)
@@@ -180,6 -223,7 +223,7 @@@
entry->items[n].value.v_object = NULL;
}
}
-
++
g_object_ref (pocket);
pocket->cr_items = g_slist_remove (pocket->cr_items, item);
g_object_unref (pocket);
@@@ -190,6 -235,7 +235,7 @@@ add_cross_ref (BseDataPocket *pocket
{
g_return_if_fail (BSE_IS_ITEM (item));
g_return_if_fail (bse_item_common_ancestor (BSE_ITEM (pocket), item) != NULL); // FIXME: delete
-
++
if (!g_slist_find (pocket->cr_items, item))
{
bse_item_cross_link (BSE_ITEM (pocket), item, pocket_uncross);
@@@ -201,18 -248,22 +248,22 @@@ remove_cross_ref (BseDataPocket *pocket
BseItem *item)
{
uint i;
-
++
g_return_if_fail (BSE_IS_ITEM (item));
g_return_if_fail (bse_item_common_ancestor (BSE_ITEM (pocket), item) != NULL); // FIXME: delete
g_return_if_fail (g_slist_find (pocket->cr_items, item) != NULL);
-
++
for (i = 0; i < pocket->n_entries; i++)
{
BseDataPocketEntry *entry = pocket->entries + i;
uint n;
-
++
for (n = 0; n < entry->n_items; n++)
if (entry->items[n].type == BSE_DATA_POCKET_OBJECT &&
entry->items[n].value.v_object == item)
return;
}
-
++
pocket->cr_items = g_slist_remove (pocket->cr_items, item);
bse_item_cross_unlink (BSE_ITEM (pocket), item, pocket_uncross);
}
@@@ -220,17 -272,23 +272,23 @@@ uin
_bse_data_pocket_create_entry (BseDataPocket *pocket)
{
uint id, i;
-
++
g_return_val_if_fail (BSE_IS_DATA_POCKET (pocket), 0);
-
++
id = pocket->free_id++;
g_assert (id != 0);
-
++
i = pocket->n_entries++;
pocket->entries = g_renew (BseDataPocketEntry, pocket->entries, pocket->n_entries);
pocket->entries[i].id = id;
pocket->entries[i].n_items = 0;
pocket->entries[i].items = NULL;
-
++
g_signal_emit (pocket, signal_entry_added, 0, id);
-
++
return id;
}
+
gboolean
_bse_data_pocket_delete_entry (BseDataPocket *pocket,
uint entry_id)
@@@ -238,13 -296,16 +296,16 @@@
BseDataPocketEntry *entry;
GSList *cr_del = NULL;
uint i, n;
-
++
g_return_val_if_fail (BSE_IS_DATA_POCKET (pocket), FALSE);
g_return_val_if_fail (entry_id > 0, FALSE);
-
++
for (i = 0; i < pocket->n_entries; i++)
if (pocket->entries[i].id == entry_id)
break;
if (i >= pocket->n_entries)
return FALSE;
-
++
entry = pocket->entries + i;
for (n = 0; n < entry->n_items; n++)
{
@@@ -256,22 -317,29 +317,29 @@@
cr_del = g_slist_prepend (cr_del, entry->items[n].value.v_object);
}
g_free (entry->items);
-
++
pocket->need_store -= entry->n_items;
n = entry->id;
-
++
pocket->n_entries--;
if (i < pocket->n_entries)
pocket->entries[i] = pocket->entries[pocket->n_entries];
-
++
while (cr_del)
{
GSList *tmp = cr_del;
-
++
cr_del = tmp->next;
remove_cross_ref (pocket, BSE_ITEM (tmp->data));
g_slist_free_1 (tmp);
}
-
++
if (!BSE_OBJECT_DISPOSING (pocket))
g_signal_emit (pocket, signal_entry_removed, 0, n);
-
++
return TRUE;
}
+
gboolean
_bse_data_pocket_entry_set (BseDataPocket *pocket,
uint id,
@@@ -282,30 -350,36 +350,36 @@@
BseDataPocketEntry *entry;
uint i, n;
bool delete_item;
-
++
g_return_val_if_fail (BSE_IS_DATA_POCKET (pocket), FALSE);
g_return_val_if_fail (id > 0, FALSE);
g_return_val_if_fail (data_quark > 0, FALSE);
if (type == BSE_DATA_POCKET_OBJECT && value.v_object)
g_return_val_if_fail (BSE_IS_ITEM (value.v_object), FALSE);
-
++
delete_item = ((type == BSE_DATA_POCKET_INT && value.v_int == 0) ||
(type == BSE_DATA_POCKET_INT64 && value.v_int64 == 0) ||
(type == BSE_DATA_POCKET_FLOAT && value.v_float == 0.0) ||
(type == BSE_DATA_POCKET_STRING && value.v_string == NULL) ||
(type == BSE_DATA_POCKET_OBJECT && value.v_object == NULL));
-
++
for (i = 0; i < pocket->n_entries; i++)
if (pocket->entries[i].id == id)
break;
if (i >= pocket->n_entries)
return FALSE;
-
++
entry = pocket->entries + i;
for (n = 0; n < entry->n_items; n++)
if (entry->items[n].quark == data_quark)
break;
-
++
/* check premature exit paths and grow as required */
if (n >= entry->n_items)
{
if (delete_item)
return TRUE;
-
++
n = entry->n_items++;
entry->items = (BseDataPocketEntry::Item*) g_realloc (entry->items, sizeof (entry->items[0]) *
entry->n_items);
entry->items[n].type = 0;
@@@ -314,6 -388,7 +388,7 @@@
}
else if (memcmp (&value, &entry->items[n].value, sizeof (value)) == 0)
return TRUE;
-
++
/* cleanup */
if (entry->items[n].type == BSE_DATA_POCKET_STRING)
g_free (entry->items[n].value.v_string);
@@@ -322,6 -397,7 +397,7 @@@
entry->items[n].type = 0;
remove_cross_ref (pocket, value.v_object);
}
-
++
/* assignment */
if (delete_item)
{
@@@ -339,9 -415,12 +415,12 @@@
else if (type == BSE_DATA_POCKET_OBJECT)
add_cross_ref (pocket, value.v_object);
}
-
++
changed_notify_add (pocket, entry->id);
-
++
return TRUE;
}
+
char
_bse_data_pocket_entry_get (BseDataPocket *pocket,
uint id,
@@@ -350,23 -429,31 +429,31 @@@
{
BseDataPocketEntry *entry;
uint i, n;
-
++
g_return_val_if_fail (BSE_IS_DATA_POCKET (pocket), 0);
-
++
if (!data_quark)
return 0;
-
++
for (i = 0; i < pocket->n_entries; i++)
if (pocket->entries[i].id == id)
break;
if (i >= pocket->n_entries)
return 0;
-
++
entry = pocket->entries + i;
-
++
for (n = 0; n < entry->n_items; n++)
if (entry->items[n].quark == data_quark)
break;
if (n >= entry->n_items)
return 0;
-
++
*value = entry->items[n].value;
-
++
return entry->items[n].type;
}
+
static gboolean
bse_data_pocket_needs_storage (BseItem *item,
BseStorage *storage)
@@@ -380,17 -468,22 +468,22 @@@ bse_data_pocket_do_store_private (BseOb
{
BseDataPocket *pocket = BSE_DATA_POCKET (object);
uint i, j;
-
++
/* chain parent class' handler */
if (BSE_OBJECT_CLASS (parent_class)->store_private)
BSE_OBJECT_CLASS (parent_class)->store_private (object, storage);
-
++
for (i = 0; i < pocket->n_entries; i++)
{
BseDataPocketEntry *entry = pocket->entries + i;
-
++
if (!entry->n_items)
continue;
-
++
bse_storage_break (storage);
bse_storage_printf (storage, "(create-entry");
bse_storage_push_level (storage);
-
++
for (j = 0; j < entry->n_items; j++)
{
bse_storage_break (storage);
@@@ -461,8 -559,10 +559,10 @@@ parse_set_data (BseDataPocket *pocket
GQuark quark;
uint ttype;
gboolean char_2_token;
-
++
parse_or_return (scanner, G_TOKEN_STRING);
quark = g_quark_from_string (scanner->value.v_string);
-
++
char_2_token = scanner->config->char_2_token;
scanner->config->char_2_token = FALSE;
g_scanner_get_next_token (scanner);
@@@ -470,6 -570,7 +570,7 @@@
if (scanner->token != G_TOKEN_CHAR)
return G_TOKEN_CHAR;
ttype = scanner->value.v_char;
-
++
switch (ttype)
{
GTokenType token;
@@@ -518,12 -619,16 +619,16 @@@
g_quark_to_string (quark));
}
peek_or_return (scanner, ')');
-
++
/* caution, value might still point to scanner->value.v_string */
if (!oentry)
_bse_data_pocket_entry_set (pocket, id, quark, ttype, value);
-
++
g_scanner_get_next_token (scanner); /* eat ')' */
-
++
return G_TOKEN_NONE;
}
+
static GTokenType
bse_data_pocket_restore_private (BseObject *object,
BseStorage *storage,
@@@ -536,7 -642,9 +642,9 @@@
bse_string_equals ("create-entry", scanner->next_value.v_identifier))
{
uint id = _bse_data_pocket_create_entry (pocket);
-
++
parse_or_return (scanner, G_TOKEN_IDENTIFIER); /* eat identifier */
+
while (g_scanner_peek_next_token (scanner) != ')')
{
g_scanner_get_next_token (scanner); /* read token */
diff --cc bse/bsedatapocket.hh
index 91137f9,9ecfd70..77287f3
--- a/bse/bsedatapocket.hh
+++ b/bse/bsedatapocket.hh
@@@ -20,10 -25,12 +25,12 @@@ typedef enum /*< skip >*
BSE_DATA_POCKET_STRING = 's',
BSE_DATA_POCKET_OBJECT = 'o'
} BseDataPocketType;
+
+
/* --- BseDataPocket structs --- */
-typedef struct _BseDataPocket BseDataPocket;
-typedef struct _BseDataPocketClass BseDataPocketClass;
-typedef union {
+struct BseDataPocket;
+struct BseDataPocketClass;
+union BseDataPocketValue {
guint64 v_int64;
guint v_int;
gfloat v_float;
diff --cc bse/bsedatapocket.proc
index cfc868b,98183f2..621a417
--- a/bse/bsedatapocket.proc
+++ b/bse/bsedatapocket.proc
@@@ -21,12 -26,16 +26,16 @@@ METHOD (BseDataPocket, create-entry)
/* check parameters */
if (!BSE_IS_DATA_POCKET (pocket))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
id = _bse_data_pocket_create_entry (pocket);
-
++
/* set output parameters */
sfi_value_set_int (out_values++, id);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseDataPocket, delete-entry) {
HELP = "Delete an existing entry from a data pocket";
IN = bse_param_spec_object ("data_pocket", "Data Pocket", NULL,
@@@ -47,13 -57,17 +57,17 @@@
/* check parameters */
if (!BSE_IS_DATA_POCKET (pocket))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
if (id)
fail = _bse_data_pocket_delete_entry (pocket, id);
-
++
/* set output parameters */
g_value_set_enum (out_values++, fail ? BSE_ERROR_NO_ENTRY : BSE_ERROR_NONE);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseDataPocket, get-n-entries) {
HELP = "Retrieve the number of entries created in a data pocket.";
IN = bse_param_spec_object ("data_pocket", "Data Pocket", "The data pocket storing values",
@@@ -69,10 -84,13 +84,13 @@@
/* check parameters */
if (!BSE_IS_DATA_POCKET (pocket))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_int (out_values++, pocket->n_entries);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseDataPocket, get-nth-entry-id) {
HELP = "Retrieve the ID of an entry in the data pocket by sequential index.";
IN = bse_param_spec_object ("data_pocket", "Data Pocket", "The data pocket storing values",
@@@ -91,10 -110,13 +110,13 @@@
/* check parameters */
if (!BSE_IS_DATA_POCKET (pocket))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_int (out_values++, index < pocket->n_entries ? pocket->entries[index].id : 0);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseDataPocket, set-float) {
HELP = ("Set a named floating point value in a data pocket entry. "
"Names are required to distinguish different values from each other "
@@@ -121,17 -143,22 +143,22 @@@
gfloat v_float = sfi_value_get_real (in_values++);
BseDataPocketValue value;
bool success = FALSE;
-
++
/* check parameters */
if (!BSE_IS_DATA_POCKET (pocket))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
value.v_float = v_float;
if (id)
success = _bse_data_pocket_entry_set (pocket, id, g_quark_from_string (name), BSE_DATA_POCKET_FLOAT,
value);
-
++
/* set output parameters */
g_value_set_enum (out_values++, success ? BSE_ERROR_NONE : BSE_ERROR_NO_ENTRY);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseDataPocket, set-int) {
HELP = ("Set a named integer value in a data pocket entry. "
"Names are required to distinguish different values from each other "
@@@ -158,17 -185,22 +185,22 @@@
guint v_uint = sfi_value_get_int (in_values++);
BseDataPocketValue value;
bool success = FALSE;
-
++
/* check parameters */
if (!BSE_IS_DATA_POCKET (pocket))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
value.v_int = v_uint;
if (id)
success = _bse_data_pocket_entry_set (pocket, id, g_quark_from_string (name), BSE_DATA_POCKET_INT,
value);
-
++
/* set output parameters */
g_value_set_enum (out_values++, success ? BSE_ERROR_NONE : BSE_ERROR_NO_ENTRY);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseDataPocket, set-object) {
HELP = ("Set a named object reference in a data pocket entry. "
"Object references stored in a data pocket must exist within the "
@@@ -195,18 -227,23 +227,23 @@@
BseItem *v_object = (BseItem*) bse_value_get_object (in_values++);
BseDataPocketValue value;
bool success = FALSE;
-
++
/* check parameters */
if (!BSE_IS_DATA_POCKET (pocket) ||
(v_object && !bse_item_common_ancestor ((BseItem*) pocket, v_object)))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
value.v_object = v_object;
if (id)
success = _bse_data_pocket_entry_set (pocket, id, g_quark_from_string (name), BSE_DATA_POCKET_OBJECT,
value);
-
++
/* set output parameters */
g_value_set_enum (out_values++, success ? BSE_ERROR_NONE : BSE_ERROR_NO_ENTRY);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseDataPocket, set-string) {
HELP = ("Set a named string in a data pocket entry.");
IN = bse_param_spec_object ("data_pocket", "Data Pocket", "The data pocket storing values",
@@@ -264,15 -302,20 +302,20 @@@ METHOD (BseDataPocket, get-float)
const char *name = sfi_value_get_string (in_values++);
BseDataPocketValue value = { 0, };
gchar type;
-
++
/* check parameters */
if (!BSE_IS_DATA_POCKET (pocket))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
type = _bse_data_pocket_entry_get (pocket, id, g_quark_try_string (name), &value);
-
++
/* set output parameters */
sfi_value_set_real (out_values++, type == BSE_DATA_POCKET_FLOAT ? value.v_float : 0);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseDataPocket, get-int) {
HELP = "Retrieve a previously set integer value from a data pocket entry.";
IN = bse_param_spec_object ("data_pocket", "Data Pocket", "The data pocket storing values",
@@@ -293,15 -336,20 +336,20 @@@
const char *name = sfi_value_get_string (in_values++);
BseDataPocketValue value = { 0, };
gchar type;
-
++
/* check parameters */
if (!BSE_IS_DATA_POCKET (pocket))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
type = _bse_data_pocket_entry_get (pocket, id, g_quark_try_string (name), &value);
-
++
/* set output parameters */
sfi_value_set_int (out_values++, type == BSE_DATA_POCKET_INT ? value.v_int : 0);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseDataPocket, get-object) {
HELP = "Retrieve a previously set object reference from a data pocket entry.";
IN = bse_param_spec_object ("data_pocket", "Data Pocket", "The data pocket storing values",
@@@ -322,15 -370,20 +370,20 @@@
const char *name = sfi_value_get_string (in_values++);
BseDataPocketValue value = { 0, };
gchar type;
-
++
/* check parameters */
if (!BSE_IS_DATA_POCKET (pocket))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
type = _bse_data_pocket_entry_get (pocket, id, g_quark_try_string (name), &value);
-
++
/* set output parameters */
bse_value_set_object (out_values++, type == BSE_DATA_POCKET_OBJECT ? value.v_object : 0);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseDataPocket, get-string) {
HELP = "Retrieve a previously set string from a data pocket entry.";
IN = bse_param_spec_object ("data_pocket", "Data Pocket", "The data pocket storing values",
@@@ -351,12 -404,16 +404,16 @@@
const char *name = sfi_value_get_string (in_values++);
BseDataPocketValue value = { 0, };
gchar type;
-
++
/* check parameters */
if (!BSE_IS_DATA_POCKET (pocket))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
type = _bse_data_pocket_entry_get (pocket, id, g_quark_try_string (name), &value);
-
++
/* set output parameters */
sfi_value_set_string (out_values++, type == BSE_DATA_POCKET_STRING ? value.v_string : 0);
-
++
return BSE_ERROR_NONE;
}
diff --cc bse/bsedefs.hh
index a4e26fe,b50646e..634e5df
--- a/bse/bsedefs.hh
+++ b/bse/bsedefs.hh
@@@ -121,6 -136,9 +127,9 @@@ typedef gboolean (*BseCategoryFore
gpointer user_data);
typedef void (*BseEngineAccessFunc) (BseModule *module,
gpointer data);
-
++
+
+
/* --- i18n and gettext helpers --- */
const gchar* bse_gettext (const gchar *text);
#define _(str) bse_gettext (str)
diff --cc bse/bsedevice.cc
index 031d620,cb72662..fa90d61
--- a/bse/bsedevice.cc
+++ b/bse/bsedevice.cc
@@@ -51,6 -55,7 +55,7 @@@ device_open_args (BseDevice *self
need_writable != FALSE,
n, (const char**) args);
g_strfreev (args);
-
++
if (!error)
{
g_return_val_if_fail (BSE_DEVICE_OPEN (self), BSE_ERROR_INTERNAL);
@@@ -448,16 -480,20 +480,20 @@@ BSE_BUILTIN_TYPE (BseDevice
{
static const GTypeInfo device_info = {
sizeof (BseDeviceClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_device_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseDevice),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_device_init,
};
-
++
g_assert (BSE_DEVICE_FLAGS_USHIFT < BSE_OBJECT_FLAGS_MAX_SHIFT);
-
++
return bse_type_register_abstract (BSE_TYPE_OBJECT,
"BseDevice",
"Abstract device base type",
diff --cc bse/bsedevice.hh
index 3a9a265,ce03dab..fd3dc92
--- a/bse/bsedevice.hh
+++ b/bse/bsedevice.hh
@@@ -22,8 -27,14 +27,10 @@@ typedef enum /*< skip >*
BSE_DEVICE_FLAG_WRITABLE = 1 << (BSE_OBJECT_FLAGS_USHIFT + 2)
} BseDeviceFlags;
#define BSE_DEVICE_FLAGS_USHIFT (BSE_OBJECT_FLAGS_USHIFT + 3)
+
+
/* --- BseDevice structs --- */
-typedef struct _BseDevice BseDevice;
-typedef struct _BseDeviceClass BseDeviceClass;
-struct _BseDevice
-{
- BseObject parent_object;
+struct BseDevice : BseObject {
/* valid while BSE_DEVICE_OPEN() */
gchar *open_device_name;
gchar *open_device_args;
diff --cc bse/bseeditablesample.cc
index e311109,160749b..83d566d
--- a/bse/bseeditablesample.cc
+++ b/bse/bseeditablesample.cc
@@@ -24,16 -33,20 +33,20 @@@ BSE_BUILTIN_TYPE (BseEditableSample
{
static const GTypeInfo editable_sample_info = {
sizeof (BseEditableSampleClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_editable_sample_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_editable */,
-
++
sizeof (BseEditableSample),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_editable_sample_init,
};
-
++
g_assert (BSE_EDITABLE_SAMPLE_FLAGS_USHIFT < BSE_OBJECT_FLAGS_MAX_SHIFT);
-
++
return bse_type_register_static (BSE_TYPE_ITEM,
"BseEditableSample",
"Editable sample type",
@@@ -45,9 -59,12 +59,12 @@@ bse_editable_sample_class_init (BseEdit
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->dispose = bse_editable_sample_dispose;
gobject_class->finalize = bse_editable_sample_finalize;
-
++
signal_changed = bse_object_class_add_signal (object_class, "changed",
G_TYPE_NONE, 0);
}
@@@ -60,7 -79,9 +79,9 @@@ static voi
bse_editable_sample_dispose (GObject *object)
{
BseEditableSample *self = BSE_EDITABLE_SAMPLE (object);
-
++
bse_editable_sample_set_wchunk (self, NULL);
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@@ -69,11 -91,13 +91,13 @@@ bse_editable_sample_finalize (GObject *
{
BseEditableSample *self = BSE_EDITABLE_SAMPLE (object);
Notify *notify, *last = NULL;
-
++
for (notify = changed_notify_list; notify; )
{
if (notify->esample == self)
{
Notify *tmp;
-
++
if (last)
last->next = notify->next;
else
@@@ -88,29 -112,38 +112,38 @@@
notify = last->next;
}
}
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->finalize (object);
-
++
g_return_if_fail (self->wchunk == NULL);
}
+
static gboolean
changed_notify_handler (void *editable)
{
BSE_THREADS_ENTER ();
-
++
while (changed_notify_list)
{
Notify *notify = changed_notify_list;
-
++
changed_notify_list = notify->next;
if (!BSE_OBJECT_DISPOSING (notify->esample))
g_signal_emit (notify->esample, signal_changed, 0);
g_free (notify);
}
-
++
BSE_THREADS_LEAVE ();
-
++
return FALSE;
}
+
static void
changed_notify_add (BseEditableSample *self)
{
Notify *notify;
-
++
if (!changed_notify_list)
bse_idle_notify (changed_notify_handler, NULL);
for (notify = changed_notify_list; notify; notify = notify->next)
@@@ -126,6 -160,7 +160,7 @@@ bse_editable_sample_set_wchunk (BseEdit
GslWaveChunk *wchunk)
{
g_return_if_fail (BSE_IS_EDITABLE_SAMPLE (self));
-
++
if (self->wchunk)
{
if (self->open_count)
diff --cc bse/bseeditablesample.proc
index c71ea95,7853c5d..926ed86
--- a/bse/bseeditablesample.proc
+++ b/bse/bseeditablesample.proc
@@@ -20,9 -23,11 +20,11 @@@ METHOD (BseEditableSample, open)
/* extract parameter values */
BseEditableSample *esample = (BseEditableSample*) bse_value_get_object (in_values++);
BseErrorType error;
-
++
/* check parameters */
if (!BSE_IS_EDITABLE_SAMPLE (esample))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
if (!esample->wchunk)
error = BSE_ERROR_WAVE_NOT_FOUND;
@@@ -37,10 -42,13 +39,13 @@@
if (!error)
esample->open_count++;
}
-
++
/* set output parameters */
g_value_set_enum (out_values++, error);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseEditableSample, close) {
HELP = ("Close an opened sample.");
IN = bse_param_spec_object ("esample", "Editable Sample", NULL,
@@@ -51,15 -59,19 +56,19 @@@
{
/* extract parameter values */
BseEditableSample *esample = (BseEditableSample*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_EDITABLE_SAMPLE (esample) || !esample->wchunk || !esample->open_count)
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
esample->open_count--;
if (!esample->open_count)
gsl_wave_chunk_close (esample->wchunk);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseEditableSample, get-length) {
HELP = ("Return the number of values in the sample.");
IN = bse_param_spec_object ("esample", "Editable Sample", NULL,
@@@ -73,15 -85,19 +82,19 @@@
/* extract parameter values */
BseEditableSample *esample = (BseEditableSample*) bse_value_get_object (in_values++);
GslDataCache *dcache = NULL;
-
++
/* check parameters */
if (!BSE_IS_EDITABLE_SAMPLE (esample))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
if (BSE_EDITABLE_SAMPLE_OPENED (esample) && esample->wchunk)
dcache = esample->wchunk->dcache;
sfi_value_set_int (out_values++, dcache ? gsl_data_handle_length (dcache->dhandle) : 0);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseEditableSample, get-n-channels) {
HELP = ("Return the number of channels in the sample.");
IN = bse_param_spec_object ("esample", "Editable Sample", NULL,
@@@ -94,13 -110,17 +107,17 @@@
{
/* extract parameter values */
BseEditableSample *esample = (BseEditableSample*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_EDITABLE_SAMPLE (esample))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_int (out_values++, esample->wchunk ? esample->wchunk->n_channels : 1);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseEditableSample, get-osc-freq) {
HELP = ("Return the oscillator frequency for the sample.");
IN = bse_param_spec_object ("esample", "Editable Sample", NULL,
@@@ -113,13 -133,17 +130,17 @@@
{
/* extract parameter values */
BseEditableSample *esample = (BseEditableSample*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_EDITABLE_SAMPLE (esample))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_real (out_values++, esample->wchunk ? esample->wchunk->osc_freq : BSE_KAMMER_FREQUENCY);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseEditableSample, read-samples) {
HELP = ("Read a set of samples from a specific offset.");
IN = bse_param_spec_object ("esample", "Editable Sample", NULL,
@@@ -150,18 -173,21 +171,19 @@@
{
GslDataCacheNode *dnode = (GslDataCacheNode*) gsl_data_cache_ref_node (dcache, voffset,
GSL_DATA_CACHE_DEMAND_LOAD);
guint i, l, dnode_length = dcache->node_size;
-
++
l = dnode_length - (voffset - dnode->offset) + dcache->padding;
l = MIN (l, gsl_data_handle_length (dcache->dhandle) - voffset);
- fblock = sfi_fblock_new_sized (l);
+ fseq = bse_float_seq_new ();
+ bse_float_seq_resize (fseq, l);
for (i = 0; i < l; i++)
- fblock->values[i] = dnode->data[voffset - dnode->offset + i];
+ fseq->values[i] = dnode->data[voffset - dnode->offset + i];
gsl_data_cache_unref_node (dcache, dnode);
}
-
/* set output parameters */
- sfi_value_take_fblock (out_values++, fblock);
-
+ g_value_take_boxed (out_values++, fseq);
return BSE_ERROR_NONE;
}
-
METHOD (BseEditableSample, collect-stats) {
HELP = ("Collect statistics from sample blocks as (minimum, maximum) pairs.");
IN = bse_param_spec_object ("esample", "Editable Sample", NULL,
diff --cc bse/bseengine.cc
index 66735aa,ad939af..e59e4e7
--- a/bse/bseengine.cc
+++ b/bse/bseengine.cc
@@@ -40,6 -42,7 +40,7 @@@ bse_module_new (const BseModuleClass *k
{
EngineNode *node;
guint i;
-
++
g_return_val_if_fail (klass != NULL, NULL);
g_return_val_if_fail (klass->process != NULL || klass->process_defer != NULL, NULL);
if (klass->process_defer)
@@@ -47,13 -50,16 +48,16 @@@
g_warning ("%s: Delay cycle processing not yet implemented", G_STRLOC);
return NULL;
}
-
++
node = sfi_new_struct0 (EngineNode, 1);
-
++
/* setup BseModule */
node->module.klass = klass;
node->module.user_data = user_data;
node->module.istreams = klass->n_istreams ? sfi_new_struct0 (BseIStream, ENGINE_NODE_N_ISTREAMS (node)) :
NULL;
node->module.jstreams = klass->n_jstreams ? sfi_new_struct0 (BseJStream, ENGINE_NODE_N_JSTREAMS (node)) :
NULL;
node->module.ostreams = _engine_alloc_ostreams (ENGINE_NODE_N_OSTREAMS (node));
-
++
/* setup EngineNode */
node->inputs = ENGINE_NODE_N_ISTREAMS (node) ? sfi_new_struct0 (EngineInput, ENGINE_NODE_N_ISTREAMS
(node)) : NULL;
node->jinputs = ENGINE_NODE_N_JSTREAMS (node) ? sfi_new_struct0 (EngineJInput*, ENGINE_NODE_N_JSTREAMS
(node)) : NULL;
@@@ -67,8 -73,10 +71,10 @@@
node->boundary_jobs = NULL;
node->probe_jobs = NULL;
node->tjob_head = node->tjob_tail = NULL;
-
++
return &node->module;
}
+
/**
* @param module a BSE Engine Module
* @return the module's tick stamp, indicating its process status
@@@ -83,8 -91,10 +89,10 @@@ guint6
bse_module_tick_stamp (BseModule *module)
{
g_return_val_if_fail (module != NULL, 0);
-
++
return ENGINE_NODE (module)->counter;
}
+
/**
* @param module a BSE Engine Module
* @param istream Index of input stream
@@@ -105,8 -115,10 +113,10 @@@ bse_module_has_source (BseModule *modul
{
g_return_val_if_fail (module != NULL, FALSE);
g_return_val_if_fail (istream < module->klass->n_istreams, FALSE);
-
++
return ENGINE_NODE (module)->inputs[istream].src_node != NULL;
}
+
/**
* @param module a BSE Engine Module
* @return whether the module is scheduled
@@@ -135,13 -148,17 +146,17 @@@ BseJob
bse_job_integrate (BseModule *module)
{
BseJob *job;
-
++
g_return_val_if_fail (module != NULL, NULL);
-
++
job = sfi_new_struct0 (BseJob, 1);
job->job_id = ENGINE_JOB_INTEGRATE;
job->data.node = ENGINE_NODE (module);
job->data.free_with_job = TRUE;
-
++
return job;
}
+
/**
* @param module The module to discard
* @return New job suitable for bse_trans_add()
@@@ -154,12 -171,16 +169,16 @@@ BseJob
bse_job_discard (BseModule *module)
{
BseJob *job;
-
++
g_return_val_if_fail (module != NULL, NULL);
-
++
job = sfi_new_struct0 (BseJob, 1);
job->job_id = ENGINE_JOB_DISCARD;
job->data.node = ENGINE_NODE (module);
-
++
return job;
}
+
/**
* @param module Module with input streams
* @return New job suitable for bse_trans_add()
@@@ -172,12 -193,16 +191,16 @@@ BseJob
bse_job_kill_inputs (BseModule *module)
{
BseJob *job;
-
++
g_return_val_if_fail (module != NULL, NULL);
-
++
job = sfi_new_struct0 (BseJob, 1);
job->job_id = ENGINE_JOB_KILL_INPUTS;
job->data.node = ENGINE_NODE (module);
-
++
return job;
}
+
/**
* @param module Module with output streams
* @return New job suitable for bse_trans_add()
@@@ -190,12 -215,16 +213,16 @@@ BseJob
bse_job_kill_outputs (BseModule *module)
{
BseJob *job;
-
++
g_return_val_if_fail (module != NULL, NULL);
-
++
job = sfi_new_struct0 (BseJob, 1);
job->job_id = ENGINE_JOB_KILL_OUTPUTS;
job->data.node = ENGINE_NODE (module);
-
++
return job;
}
+
/**
* @param src_module Module with output stream
* @param src_ostream Index of output stream of @a src_module
@@@ -216,18 -245,22 +243,22 @@@ bse_job_connect (BseModule *src_module
guint dest_istream)
{
BseJob *job;
-
++
g_return_val_if_fail (src_module != NULL, NULL);
g_return_val_if_fail (src_ostream < src_module->klass->n_ostreams, NULL);
g_return_val_if_fail (dest_module != NULL, NULL);
g_return_val_if_fail (dest_istream < dest_module->klass->n_istreams, NULL);
-
++
job = sfi_new_struct0 (BseJob, 1);
job->job_id = ENGINE_JOB_ICONNECT;
job->connection.dest_node = ENGINE_NODE (dest_module);
job->connection.dest_ijstream = dest_istream;
job->connection.src_node = ENGINE_NODE (src_module);
job->connection.src_ostream = src_ostream;
-
++
return job;
}
+
/**
* @param src_module Module with output stream
* @param src_ostream Index of output stream of @a src_module
@@@ -247,18 -280,22 +278,22 @@@ bse_job_jconnect (BseModule *src_module
guint dest_jstream)
{
BseJob *job;
-
++
g_return_val_if_fail (src_module != NULL, NULL);
g_return_val_if_fail (src_ostream < src_module->klass->n_ostreams, NULL);
g_return_val_if_fail (dest_module != NULL, NULL);
g_return_val_if_fail (dest_jstream < dest_module->klass->n_jstreams, NULL);
-
++
job = sfi_new_struct0 (BseJob, 1);
job->job_id = ENGINE_JOB_JCONNECT;
job->connection.dest_node = ENGINE_NODE (dest_module);
job->connection.dest_ijstream = dest_jstream;
job->connection.src_node = ENGINE_NODE (src_module);
job->connection.src_ostream = src_ostream;
-
++
return job;
}
+
/**
* @param dest_module Module with connected input stream
* @param dest_istream Index of input stream of @a dest_module
@@@ -274,16 -311,20 +309,20 @@@ bse_job_disconnect (BseModule *dest_mod
guint dest_istream)
{
BseJob *job;
-
++
g_return_val_if_fail (dest_module != NULL, NULL);
g_return_val_if_fail (dest_istream < dest_module->klass->n_istreams, NULL);
-
++
job = sfi_new_struct0 (BseJob, 1);
job->job_id = ENGINE_JOB_IDISCONNECT;
job->connection.dest_node = ENGINE_NODE (dest_module);
job->connection.dest_ijstream = dest_istream;
job->connection.src_node = NULL;
job->connection.src_ostream = ~0;
-
++
return job;
}
+
/**
* @param dest_module Module with connected input stream
* @param dest_jstream Index of input stream of @a dest_module
@@@ -306,30 -347,38 +345,38 @@@ bse_job_jdisconnect (BseModule *dest_mo
guint src_ostream)
{
BseJob *job;
-
++
g_return_val_if_fail (dest_module != NULL, NULL);
g_return_val_if_fail (dest_jstream < dest_module->klass->n_jstreams, NULL);
g_return_val_if_fail (src_module != NULL, NULL);
g_return_val_if_fail (src_ostream < src_module->klass->n_ostreams, NULL);
-
++
job = sfi_new_struct0 (BseJob, 1);
job->job_id = ENGINE_JOB_JDISCONNECT;
job->connection.dest_node = ENGINE_NODE (dest_module);
job->connection.dest_ijstream = dest_jstream;
job->connection.src_node = ENGINE_NODE (src_module);
job->connection.src_ostream = src_ostream;
-
++
return job;
}
+
BseJob*
bse_job_set_consumer (BseModule *module,
gboolean is_toplevel_consumer)
{
BseJob *job;
-
++
g_return_val_if_fail (module != NULL, NULL);
g_return_val_if_fail (ENGINE_MODULE_IS_VIRTUAL (module) == FALSE, NULL);
-
++
job = sfi_new_struct0 (BseJob, 1);
job->job_id = is_toplevel_consumer ? ENGINE_JOB_SET_CONSUMER : ENGINE_JOB_UNSET_CONSUMER;
job->data.node = ENGINE_NODE (module);
-
++
return job;
}
+
/**
* @param module The module to be reset
* @return New job suitable for bse_trans_add()
@@@ -347,12 -396,16 +394,16 @@@ BseJob
bse_job_force_reset (BseModule *module)
{
BseJob *job;
-
++
g_return_val_if_fail (module != NULL, NULL);
-
++
job = sfi_new_struct0 (BseJob, 1);
job->job_id = ENGINE_JOB_FORCE_RESET;
job->data.node = ENGINE_NODE (module);
-
++
return job;
}
+
/**
* \fn BseEngineAccessFunc
* @param module Module to operate on
@@@ -383,16 -436,20 +434,20 @@@ bse_job_access (BseModule *module
BseFreeFunc free_func)
{
BseJob *job;
-
++
g_return_val_if_fail (module != NULL, NULL);
g_return_val_if_fail (access_func != NULL, NULL);
-
++
job = sfi_new_struct0 (BseJob, 1);
job->job_id = ENGINE_JOB_ACCESS;
job->access.node = ENGINE_NODE (module);
job->access.access_func = access_func;
job->access.data = data;
job->access.free_func = free_func;
-
++
return job;
}
+
/**
* @param data Data passed in to the free_func
* @param free_func Function to free @a data (executed in user thread)
@@@ -463,6 -524,7 +522,7 @@@ bse_job_probe_request (BseModul
g_return_val_if_fail (module != NULL, NULL);
EngineNode *node = ENGINE_NODE (module);
g_return_val_if_fail (probe_func != NULL, NULL);
-
++
EngineTimedJob *tjob = (EngineTimedJob*) g_malloc0 (sizeof (tjob->probe));
tjob->type = ENGINE_JOB_PROBE_JOB;
tjob->tick_stamp = 0;
@@@ -470,12 -532,15 +530,15 @@@
tjob->probe.probe_func = probe_func;
tjob->probe.n_ostreams = ENGINE_NODE_N_OSTREAMS (node);
tjob->probe.ostreams = _engine_alloc_ostreams (ENGINE_NODE_N_OSTREAMS (node));
-
++
BseJob *job = sfi_new_struct0 (BseJob, 1);
job->job_id = ENGINE_JOB_PROBE_JOB;
job->timed_job.node = ENGINE_NODE (module);
job->timed_job.tjob = tjob;
-
++
return job;
}
+
/**
* @param module The module to access
* @param tick_stamp Engine time stamp
@@@ -688,9 -774,11 +756,11 @@@ bse_job_add_poll (BseEnginePollFunc
const GPollFD *fds)
{
BseJob *job;
-
++
g_return_val_if_fail (poll_func != NULL, NULL);
if (n_fds)
g_return_val_if_fail (fds != NULL, NULL);
-
++
job = sfi_new_struct0 (BseJob, 1);
job->job_id = ENGINE_JOB_ADD_POLL;
job->poll.poll_func = poll_func;
@@@ -698,8 -786,10 +768,10 @@@
job->poll.free_func = free_func;
job->poll.n_fds = n_fds;
job->poll.fds = (GPollFD*) g_memdup (fds, sizeof (fds[0]) * n_fds);
-
++
return job;
}
+
/**
* @param poll_func Poll function to remove
* @param data Data of poll function
@@@ -714,7 -804,9 +786,9 @@@ bse_job_remove_poll (BseEnginePollFunc
gpointer data)
{
BseJob *job;
-
++
g_return_val_if_fail (poll_func != NULL, NULL);
-
++
job = sfi_new_struct0 (BseJob, 1);
job->job_id = ENGINE_JOB_REMOVE_POLL;
job->poll.poll_func = poll_func;
@@@ -722,8 -814,10 +796,10 @@@
job->poll.free_func = NULL;
job->poll.n_fds = 0;
job->poll.fds = NULL;
-
++
return job;
}
+
/**
* @param timer_func Timer function to add
* @param data Data of timer function
@@@ -741,14 -835,18 +817,18 @@@ bse_job_add_timer (BseEngineTimerFunc t
BseFreeFunc free_func)
{
BseJob *job;
-
++
g_return_val_if_fail (timer_func != NULL, NULL);
-
++
job = sfi_new_struct0 (BseJob, 1);
job->job_id = ENGINE_JOB_ADD_TIMER;
job->timer.timer_func = timer_func;
job->timer.data = data;
job->timer.free_func = free_func;
-
++
return job;
}
+
/**
* @param debug Debug message
* @return New job suitable for bse_trans_add()
@@@ -762,6 -860,7 +842,7 @@@ BseJob
bse_job_debug (const gchar *debug)
{
g_return_val_if_fail (debug != NULL, NULL);
-
++
BseJob *job = sfi_new_struct0 (BseJob, 1);
job->job_id = ENGINE_JOB_MESSAGE;
job->data.message = g_strdup (debug);
@@@ -798,13 -899,17 +881,17 @@@ BseTrans
bse_trans_open (void)
{
BseTrans *trans;
-
++
trans = sfi_new_struct0 (BseTrans, 1);
-
++
trans->jobs_head = NULL;
trans->jobs_tail = NULL;
trans->comitted = FALSE;
trans->cqt_next = NULL;
-
++
return trans;
}
+
/**
* @param trans Opened transaction
* @param job Job to add
@@@ -820,6 -925,7 +907,7 @@@ bse_trans_add (BseTrans *trans
g_return_if_fail (trans->comitted == FALSE);
g_return_if_fail (job != NULL);
g_return_if_fail (job->next == NULL);
-
++
if (trans->jobs_tail)
trans->jobs_tail->next = job;
else
@@@ -844,6 -951,7 +933,7 @@@ bse_trans_merge (BseTrans *trans1
g_return_val_if_fail (trans1->comitted == FALSE, trans2);
g_return_val_if_fail (trans2 != NULL, trans1);
g_return_val_if_fail (trans2->comitted == FALSE, trans1);
-
++
if (!trans1->jobs_head)
{
trans1->jobs_head = trans2->jobs_head;
@@@ -878,6 -987,7 +969,7 @@@ bse_trans_commit (BseTrans *trans
{
g_return_val_if_fail (trans != NULL, 0);
g_return_val_if_fail (trans->comitted == FALSE, 0);
-
++
guint64 exec_tick_stamp = 0;
if (trans->jobs_head)
{
@@@ -943,14 -1057,19 +1036,15 @@@ bse_trans_commit_delayed (BseTrans *tra
DTrans data = { 0, };
data.trans = trans;
data.tick_stamp = tick_stamp;
- sfi_cond_init (&data.cond);
- sfi_mutex_init (&data.mutex);
bse_trans_add (wtrans, bse_job_add_timer (dtrans_timer, &data, NULL));
- sfi_mutex_lock (&data.mutex);
+ data.mutex.lock();
bse_trans_commit (wtrans);
while (data.trans)
- sfi_cond_wait (&data.cond, &data.mutex);
- sfi_mutex_unlock (&data.mutex);
- sfi_cond_destroy (&data.cond);
- sfi_mutex_destroy (&data.mutex);
+ data.cond.wait (data.mutex);
+ data.mutex.unlock();
}
}
+
/**
* @param trans Opened transaction
*
@@@ -963,8 -1082,10 +1057,10 @@@ bse_trans_dismiss (BseTrans *trans
{
g_return_if_fail (trans != NULL);
g_return_if_fail (trans->comitted == FALSE);
-
++
_engine_free_trans (trans);
}
+
/**
* @param job First job
* @param ... NULL terminated job list
@@@ -980,6 -1101,7 +1076,7 @@@ bse_transact (BseJob *job
{
BseTrans *trans = bse_trans_open ();
va_list var_args;
-
++
va_start (var_args, job);
while (job)
{
@@@ -995,6 -1119,7 +1094,7 @@@ virtual_module_process (BseModule *modu
guint n_values)
{
guint i;
-
++
/* dumb pass-through task (FIXME: virtualization works without _process()) */
for (i = 0; i < BSE_MODULE_N_OSTREAMS (module); i++)
if (module->ostreams[i].connected)
@@@ -1009,6 -1136,7 +1111,7 @@@ virtual_module_free (gpointer da
const BseModuleClass *klass)
{
VirtualModuleClass *vclass = (VirtualModuleClass*) klass;
-
++
if (vclass->free_data)
vclass->free_data (data);
g_free (vclass);
@@@ -1190,17 -1331,20 +1297,20 @@@ bse_engine_configure (guint
BseTrans *trans;
BseJob *job;
g_return_val_if_fail (bse_engine_initialized == TRUE, FALSE);
-
++
bse_engine_constrain (latency_ms, sample_freq, control_freq, &block_size, &control_raster);
/* optimize */
if (0 && block_size == bse_engine_block_size() && control_raster == bse_engine_control_raster())
return TRUE;
-
++
/* pseudo-sync first */
bse_engine_wait_on_trans();
/* paranoia checks */
if (_engine_mnl_head() || sync_lock)
return FALSE;
-
++
/* block master */
- GSL_SPIN_LOCK (&sync_mutex);
+ sync_mutex.lock();
job = sfi_new_struct0 (BseJob, 1);
job->job_id = ENGINE_JOB_SYNC;
job->sync.lock_mutex = &sync_mutex;
@@@ -1230,15 -1375,16 +1340,16 @@@
bse_engine_exvar_sample_freq = sample_freq;
bse_engine_exvar_control_mask = control_raster - 1;
/* fixup timer */
- _gsl_tick_stamp_set_leap (bse_engine_block_size());
- _gsl_tick_stamp_inc (); /* ensure stamp validity (>0 and systime mark) */
+ Bse::TickStamp::_set_leap (bse_engine_block_size());
+ Bse::TickStamp::_increment(); // ensure stamp validity (>0 and systime mark)
success = TRUE;
}
-
++
/* unblock master */
- GSL_SPIN_LOCK (&sync_mutex);
+ sync_mutex.lock();
sync_lock = FALSE;
- sfi_cond_signal (&sync_cond);
- GSL_SPIN_UNLOCK (&sync_mutex);
+ sync_cond.signal();
+ sync_mutex.unlock();
/* ensure SYNC job got collected */
bse_engine_wait_on_trans();
bse_engine_user_thread_collect();
@@@ -1374,8 -1580,10 +1485,9 @@@ bse_engine_tick_stamp_from_systime (gui
ustamp.system_time, ustamp.tick_stamp,
bse_engine_sample_freq ());
#endif
-
return tick_stamp;
}
+
/**
*
* Wait until all pending transactions have been processed
@@@ -1388,11 -1596,14 +1500,14 @@@ voi
bse_engine_wait_on_trans (void)
{
g_return_if_fail (bse_engine_initialized == TRUE);
-
++
/* non-threaded */
if (!bse_engine_threaded)
_engine_master_dispatch_jobs ();
-
++
/* threaded */
_engine_wait_on_trans ();
-
++
/* call all free() functions */
bse_engine_user_thread_collect ();
}
diff --cc bse/bseenginemaster.cc
index 644c3b5,431973b..bd577c6
--- a/bse/bseenginemaster.cc
+++ b/bse/bseenginemaster.cc
@@@ -70,6 -82,7 +78,7 @@@ static voi
add_consumer (EngineNode *node)
{
g_return_if_fail (ENGINE_NODE_IS_CONSUMER (node) && node->toplevel_next == NULL && node->integrated);
-
++
node->toplevel_next = master_consumer_list;
master_consumer_list = node;
}
@@@ -77,7 -91,9 +87,9 @@@ static voi
remove_consumer (EngineNode *node)
{
EngineNode *tmp, *last = NULL;
-
++
g_return_if_fail (!ENGINE_NODE_IS_CONSUMER (node) || !node->integrated);
-
++
for (tmp = master_consumer_list; tmp; last = tmp, tmp = last->toplevel_next)
if (tmp == node)
break;
@@@ -110,8 -128,10 +124,10 @@@ master_idisconnect_node (EngineNode *no
EngineNode *src_node = node->inputs[istream].src_node;
guint ostream = node->inputs[istream].src_stream;
gboolean was_consumer;
-
++
g_assert (ostream < ENGINE_NODE_N_OSTREAMS (src_node) &&
src_node->outputs[ostream].n_outputs > 0); /* these checks better pass */
-
++
node->inputs[istream].src_node = NULL;
node->inputs[istream].src_stream = ~0;
node->module.istreams[istream].connected = 0; /* scheduler update */
@@@ -135,9 -156,11 +152,11 @@@ master_jdisconnect_node (EngineNode *no
EngineNode *src_node = node->jinputs[jstream][con].src_node;
guint i, ostream = node->jinputs[jstream][con].src_stream;
gboolean was_consumer;
-
++
g_assert (ostream < ENGINE_NODE_N_OSTREAMS (src_node) &&
node->module.jstreams[jstream].jcount > 0 &&
src_node->outputs[ostream].n_outputs > 0); /* these checks better pass */
-
++
i = --node->module.jstreams[jstream].jcount;
node->jinputs[jstream][con] = node->jinputs[jstream][i];
node->module.jstreams[jstream].values[i] = NULL; /* float**values 0-termination */
@@@ -238,16 -268,19 +264,19 @@@ node_peek_flow_job_stamp (EngineNode *n
EngineTimedJob *tjob = node->flow_jobs;
if (UNLIKELY (tjob != NULL))
return tjob->tick_stamp;
- return GSL_MAX_TICK_STAMP;
+ return Bse::TickStamp::max_stamp();
}
+
static inline guint64
node_peek_boundary_job_stamp (EngineNode *node)
{
EngineTimedJob *tjob = node->boundary_jobs;
if (UNLIKELY (tjob != NULL))
return tjob->tick_stamp;
- return GSL_MAX_TICK_STAMP;
+ return Bse::TickStamp::max_stamp();
}
+
+
/* --- job processing --- */
static void
master_process_job (BseJob *job)
@@@ -606,6 -640,7 +636,7 @@@ master_poll_check (glong *timeout_p
{
gboolean need_processing = FALSE;
Poll *poll;
-
++
if (master_need_process || *timeout_p == 0)
{
master_need_process = TRUE;
@@@ -614,6 -649,7 +645,7 @@@
for (poll = master_poll_list; poll; poll = poll->next)
{
glong timeout = -1;
-
++
if (poll->poll_func (poll->data, bse_engine_block_size (), &timeout,
poll->n_fds, poll->n_fds ? poll->fds : NULL, check_with_revents)
|| timeout == 0)
@@@ -747,7 -788,9 +784,9 @@@ master_process_locked_node (EngineNode
guint64 next_counter, new_counter, final_counter = current_stamp + n_values;
guint i, j, diff;
bool needs_probe_reset = node->probe_jobs != NULL;
+
g_return_if_fail (node->integrated && node->sched_tag);
-
++
while (node->counter < final_counter)
{
/* call reset() and exec flow jobs */
@@@ -762,6 -805,7 +801,7 @@@
for (i = 0; i < ENGINE_NODE_N_ISTREAMS (node); i++)
{
EngineNode *inode = node->inputs[i].real_node;
-
++
if (inode)
{
ENGINE_NODE_LOCK (inode);
@@@ -779,6 -823,7 +819,7 @@@
for (i = 0; i < node->module.jstreams[j].n_connections; i++) /* assumes scheduled node */
{
EngineNode *inode = node->jinputs[j][i].real_node;
-
++
ENGINE_NODE_LOCK (inode);
if (inode->counter < final_counter)
master_process_locked_node (inode, final_counter - node->counter);
@@@ -826,19 -873,26 +869,26 @@@ master_process_flow (void
guint64 profile_maxtime = 0;
gboolean profile_modules = gsl_profile_modules;
EngineNode *profile_node = NULL;
-
++
g_return_if_fail (master_need_process == TRUE);
-
++
g_assert (bse_fpu_okround () == TRUE);
-
++
if (master_schedule)
{
_engine_schedule_restart (master_schedule);
_engine_set_schedule (master_schedule);
-
++
EngineNode *node = _engine_pop_unprocessed_node ();
while (node)
{
ToyprofStamp profile_stamp1, profile_stamp2;
-
++
if (UNLIKELY (profile_modules))
toyprof_stamp (profile_stamp1);
-
++
master_process_locked_node (node, n_values);
-
++
if (UNLIKELY (profile_modules))
{
toyprof_stamp (profile_stamp2);
@@@ -849,9 -903,11 +899,11 @@@
profile_node = node;
}
}
-
++
_engine_push_processed_node (node);
node = _engine_pop_unprocessed_node ();
}
-
++
/* walk unscheduled nodes with flow jobs */
node = _engine_mnl_head ();
while (node && BSE_ENGINE_MNL_UNSCHEDULED_TJOB_NODE (node))
@@@ -863,8 -919,10 +915,10 @@@
_engine_mnl_node_changed (node); /* collects trash jobs and reorders node */
node = tmp;
}
-
++
/* nothing new to process, wait for slaves */
_engine_wait_on_unprocessed ();
-
++
/* take remaining probes */
SfiRing *ring = probe_node_list;
while (ring)
@@@ -878,6 -936,7 +932,7 @@@
else
master_take_probes (node, current_stamp, n_values, PROBE_SCHEDULED);
}
-
++
if (UNLIKELY (profile_modules))
{
if (profile_node)
@@@ -890,6 -949,7 +945,7 @@@
profile_node, (long long unsigned int) profile_maxtime,
profile_node->module.klass->process);
}
}
-
++
_engine_unset_schedule (master_schedule);
master_tick_stamp_inc ();
_engine_recycle_const_values (FALSE);
@@@ -900,7 -961,9 +957,9 @@@ static voi
master_reschedule_flow (void)
{
EngineNode *node;
-
++
g_return_if_fail (master_need_reflow == TRUE);
-
++
if (!master_schedule)
master_schedule = _engine_schedule_new ();
else
@@@ -917,6 -981,7 +977,7 @@@ static voi
master_schedule_discard (void)
{
g_return_if_fail (master_need_reflow == TRUE);
-
++
if (master_schedule)
{
_engine_schedule_unsecure (master_schedule);
@@@ -930,7 -997,9 +993,9 @@@ _engine_master_prepare (BseEngineLoop *
{
gboolean need_dispatch;
guint i;
-
++
g_return_val_if_fail (loop != NULL, FALSE);
-
++
/* setup and clear pollfds here already, so master_poll_check() gets no junk (and IRIX can't handle non-0
revents) */
loop->fds_changed = master_pollfds_changed;
master_pollfds_changed = FALSE;
@@@ -939,6 -1008,7 +1004,7 @@@
for (i = 0; i < loop->n_fds; i++)
loop->fds[i].revents = 0;
loop->revents_filled = FALSE;
-
++
loop->timeout = -1;
/* cached checks first */
need_dispatch = master_need_reflow || master_need_process;
@@@ -953,17 -1023,21 +1019,21 @@@
}
if (need_dispatch)
loop->timeout = 0;
-
++
return need_dispatch;
}
+
gboolean
_engine_master_check (const BseEngineLoop *loop)
{
gboolean need_dispatch;
-
++
g_return_val_if_fail (loop != NULL, FALSE);
g_return_val_if_fail (loop->n_fds == master_n_pollfds, FALSE);
g_return_val_if_fail (loop->fds == master_pollfds, FALSE);
if (loop->n_fds)
g_return_val_if_fail (loop->revents_filled == TRUE, FALSE);
-
++
/* cached checks first */
need_dispatch = master_need_reflow || master_need_process;
/* lengthy query */
@@@ -973,11 -1047,14 +1043,14 @@@
if (!need_dispatch)
{
glong dummy = -1;
-
++
master_poll_check (&dummy, TRUE);
need_dispatch = master_need_process;
}
-
++
return need_dispatch;
}
+
void
_engine_master_dispatch_jobs (void)
{
diff --cc bse/bseenginenode.hh
index c537520,abb1bac..95ef689
--- a/bse/bseenginenode.hh
+++ b/bse/bseenginenode.hh
@@@ -17,9 -20,11 +20,11 @@@ G_BEGIN_DECL
#define ENGINE_NODE_IS_SCHEDULED(node) (ENGINE_NODE (node)->sched_tag)
#define ENGINE_NODE_IS_CHEAP(node) (((node)->module.klass->mflags & BSE_COST_CHEAP) != 0)
#define ENGINE_NODE_IS_EXPENSIVE(node) (((node)->module.klass->mflags & BSE_COST_EXPENSIVE) != 0)
-#define ENGINE_NODE_LOCK(node) sfi_rec_mutex_lock (&(node)->rec_mutex)
-#define ENGINE_NODE_UNLOCK(node) sfi_rec_mutex_unlock (&(node)->rec_mutex)
+#define ENGINE_NODE_LOCK(node) (node)->rec_mutex.lock()
+#define ENGINE_NODE_UNLOCK(node) (node)->rec_mutex.unlock()
#define ENGINE_MODULE_IS_VIRTUAL(mod) (ENGINE_NODE_IS_VIRTUAL (ENGINE_NODE (mod)))
+
+
/* --- typedefs --- */
typedef struct _EngineNode EngineNode;
typedef struct _EngineSchedule EngineSchedule;
diff --cc bse/bseengineschedule.cc
index 4d03c68,9e0be68..bbcff7a
--- a/bse/bseengineschedule.cc
+++ b/bse/bseengineschedule.cc
@@@ -20,6 -21,7 +22,7 @@@ EngineSchedule
_engine_schedule_new (void)
{
EngineSchedule *sched = sfi_new_struct0 (EngineSchedule, 1);
-
++
sched->n_items = 0;
sched->leaf_levels = 0;
sched->nodes = NULL;
@@@ -30,13 -32,16 +33,16 @@@
sched->cur_node = NULL;
sched->cur_cycle = NULL;
sched->vnodes = NULL;
-
++
return sched;
}
+
static inline void
unschedule_virtual (EngineSchedule *sched, EngineNode *vnode)
{
g_return_if_fail (ENGINE_NODE_IS_SCHEDULED (vnode) == TRUE);
g_return_if_fail (sched->n_items > 0);
-
++
/* SCHED_DEBUG ("unschedule_virtual(%p)", vnode); */
sched->vnodes = sfi_ring_remove (sched->vnodes, vnode);
vnode->sched_tag = FALSE;
@@@ -46,10 -52,12 +53,12 @@@ static inline voi
unschedule_node (EngineSchedule *sched, EngineNode *node)
{
guint leaf_level;
-
++
g_return_if_fail (ENGINE_NODE_IS_SCHEDULED (node) == TRUE);
leaf_level = node->sched_leaf_level;
g_return_if_fail (leaf_level <= sched->leaf_levels);
g_return_if_fail (sched->n_items > 0);
-
++
/* SCHED_DEBUG ("unschedule_node(%p,%u)", node, leaf_level); */
sched->nodes[leaf_level] = sfi_ring_remove (sched->nodes[leaf_level], node);
node->sched_leaf_level = 0;
@@@ -64,10 -73,12 +74,12 @@@ unschedule_cycle (EngineSchedule *sched
{
guint leaf_level;
SfiRing *walk;
-
++
g_return_if_fail (ENGINE_NODE_IS_SCHEDULED (ENGINE_NODE (ring->data)) == TRUE);
leaf_level = ENGINE_NODE (ring->data)->sched_leaf_level;
g_return_if_fail (leaf_level <= sched->leaf_levels);
g_return_if_fail (sched->n_items > 0);
-
++
/* SCHED_DEBUG ("unschedule_cycle(%p,%u,%p)", ring->data, leaf_level, ring); */
sched->nodes[leaf_level] = sfi_ring_remove (sched->nodes[leaf_level], ring);
for (walk = ring; walk; walk = sfi_ring_walk (walk, ring))
@@@ -89,6 -101,7 +102,7 @@@ _engine_schedule_debug_dump (EngineSche
if (sched)
{
guint i;
-
++
g_printerr (" n_items=%u, n_vnodes=%u, leaf_levels=%u, secured=%u,\n",
sched->n_items, sfi_ring_length (sched->vnodes), sched->leaf_levels, sched->secured);
g_printerr (" in_pqueue=%u, cur_leaf_level=%u,\n",
@@@ -98,6 -111,7 +112,7 @@@
for (i = 0; i < sched->leaf_levels; i++)
{
SfiRing *ring, *head = sched->nodes[i];
-
++
if (!head)
continue;
g_printerr (" { leaf_level=%u:", i);
@@@ -119,9 -135,11 +136,11 @@@ voi
_engine_schedule_clear (EngineSchedule *sched)
{
guint i;
-
++
g_return_if_fail (sched != NULL);
g_return_if_fail (sched->secured == FALSE);
g_return_if_fail (sched->in_pqueue == FALSE);
-
++
while (sched->vnodes)
unschedule_virtual (sched, (EngineNode*) sched->vnodes->data);
for (i = 0; i < sched->leaf_levels; i++)
@@@ -139,6 -158,7 +159,7 @@@ _engine_schedule_destroy (EngineSchedul
g_return_if_fail (sched != NULL);
g_return_if_fail (sched->secured == FALSE);
g_return_if_fail (sched->in_pqueue == FALSE);
-
++
_engine_schedule_clear (sched);
g_free (sched->nodes);
g_free (sched->cycles);
@@@ -149,9 -170,11 +171,11 @@@ _engine_schedule_grow (EngineSchedule *
guint leaf_level)
{
guint ll = 1 << g_bit_storage (leaf_level); /* power2 growth alignment, ll >= leaf_level+1 */
-
++
if (sched->leaf_levels < ll)
{
guint i = sched->leaf_levels;
-
++
sched->leaf_levels = ll;
sched->nodes = g_renew (SfiRing*, sched->nodes, sched->leaf_levels);
sched->cycles = g_renew (SfiRing*, sched->cycles, sched->leaf_levels);
@@@ -171,6 -195,7 +196,7 @@@ schedule_virtual (EngineSchedule *sched
g_return_if_fail (vnode != NULL);
g_return_if_fail (ENGINE_NODE_IS_VIRTUAL (vnode));
g_return_if_fail (!ENGINE_NODE_IS_SCHEDULED (vnode));
-
++
/* SCHED_DEBUG ("schedule_virtual(%p)", vnode); */
vnode->sched_tag = TRUE;
vnode->cleared_ostreams = FALSE;
@@@ -193,6 -219,7 +220,7 @@@ schedule_node (EngineSchedule *sched
g_return_if_fail (sched->secured == FALSE);
g_return_if_fail (node != NULL);
g_return_if_fail (!ENGINE_NODE_IS_SCHEDULED (node));
-
++
/* SCHED_DEBUG ("schedule_node(%p,%u)", node, leaf_level); */
node->sched_leaf_level = leaf_level;
node->sched_tag = TRUE;
@@@ -235,6 -265,7 +266,7 @@@ _engine_schedule_restart (EngineSchedul
g_return_if_fail (sched->cur_leaf_level == sched->leaf_levels);
g_return_if_fail (sched->cur_node == NULL);
g_return_if_fail (sched->cur_cycle == NULL);
-
++
sched->cur_leaf_level = 0;
if (sched->leaf_levels > 0)
{
@@@ -316,6 -354,7 +351,7 @@@ _engine_schedule_unsecure (EngineSchedu
g_return_if_fail (sched->cur_leaf_level == sched->leaf_levels);
g_return_if_fail (sched->cur_node == NULL);
g_return_if_fail (sched->cur_cycle == NULL);
-
++
sched->secured = FALSE;
sched->cur_leaf_level = ~0;
}
@@@ -324,11 -364,13 +361,13 @@@ _engine_schedule_consumer_node (EngineS
EngineNode *node)
{
EngineQuery query = { 0, };
-
++
g_return_if_fail (schedule != NULL);
g_return_if_fail (schedule->secured == FALSE);
g_return_if_fail (node != NULL);
g_return_if_fail (ENGINE_NODE_IS_CONSUMER (node));
g_return_if_fail (ENGINE_NODE_IS_VIRTUAL (node) == FALSE);
-
++
subschedule_query_node (schedule, node, &query);
g_assert (query.cycles == NULL); /* paranoid */
g_assert (query.cycle_nodes == NULL); /* paranoid */
@@@ -499,6 -552,7 +549,7 @@@ query_add_cycle (EngineQuery *query
EngineNode *node)
{
EngineCycle *cycle = sfi_new_struct0 (EngineCycle, 1);
-
++
cycle->last = dep;
cycle->nodes = sfi_ring_prepend (NULL, node);
cycle->seen_deferred_node = ENGINE_NODE_IS_DEFERRED (node); /* dep will be checked when added to nodes */
@@@ -531,6 -587,7 +584,7 @@@ clean_ostreams (EngineNode *node
if (!node->cleared_ostreams && !ENGINE_NODE_IS_SCHEDULED (node))
{
guint i;
-
++
for (i = 0; i < ENGINE_NODE_N_OSTREAMS (node); i++)
node->module.ostreams[i].connected = FALSE;
node->cleared_ostreams = TRUE;
@@@ -579,9 -639,11 +636,11 @@@ subschedule_child (EngineSchedule *sche
guint child_ostream)
{
g_return_if_fail (ENGINE_NODE_IS_VIRTUAL (node) == FALSE);
-
++
/* flag connected ostream */
clean_ostreams (child);
child->module.ostreams[child_ostream].connected = TRUE;
-
++
/* schedule away if necessary */
if (ENGINE_NODE_IS_SCHEDULED (child))
query->leaf_level = MAX (query->leaf_level, child->sched_leaf_level + 1);
@@@ -590,6 -652,7 +649,7 @@@
else /* nice boy ;) */
{
EngineQuery child_query = { 0, };
-
++
subschedule_query_node (schedule, child, &child_query);
query->leaf_level = MAX (query->leaf_level, child_query.leaf_level + 1);
if (!child_query.cycles)
@@@ -614,13 -678,16 +675,16 @@@ subschedule_query_node (EngineSchedule
EngineQuery *query)
{
guint i, j;
-
++
g_return_if_fail (ENGINE_NODE_IS_VIRTUAL (node) == FALSE);
g_return_if_fail (node->sched_recurse_tag == FALSE);
g_return_if_fail (query->leaf_level == 0);
-
++
/* update suspension state if necessary */
update_suspension_state (node);
/* reset ostream[].connected flags */
clean_ostreams (node);
-
++
/* SCHED_DEBUG ("sched_query(%p)", node); */
node->sched_recurse_tag = TRUE;
/* schedule input stream children */
@@@ -646,6 -713,7 +710,7 @@@
for (j = 0; j < ENGINE_NODE_N_JSTREAMS (node); j++)
{
BseJStream *jstream = node->module.jstreams + j;
-
++
/* we check this jstream's connections for virtual dead-ends.
* valid connections stay at (are moved to) the array front and
* are counted in n_connections, while dead-ends are moved
@@@ -688,9 -756,10 +753,10 @@@
{
EngineNode *child = node->jinputs[j][i].real_node;
guint child_ostream = node->jinputs[j][i].real_stream;
-
++
subschedule_child (schedule, node, query, child, child_ostream);
}
- node->counter = GSL_TICK_STAMP;
+ node->counter = Bse::TickStamp::current();
node->sched_recurse_tag = FALSE;
/* SCHED_DEBUG ("sched_done(%p)", node); */
}
diff --cc bse/bseengineutils.cc
index b4eee78,dabba43..8c8b419
--- a/bse/bseengineutils.cc
+++ b/bse/bseengineutils.cc
@@@ -72,6 -78,7 +78,7 @@@ bse_engine_free_node (EngineNode *node
const BseModuleClass *klass;
gpointer user_data;
guint j;
-
++
g_return_if_fail (node != NULL);
g_return_if_fail (node->output_nodes == NULL);
g_return_if_fail (node->integrated == FALSE);
@@@ -104,8 -113,8 +111,9 @@@
}
klass = node->module.klass;
user_data = node->module.user_data;
+ node->rec_mutex.~Mutex();
sfi_delete_struct (EngineNode, node);
-
++
/* allow the free function to free the klass as well */
if (klass->free)
klass->free (user_data, klass);
@@@ -114,6 -124,7 +123,7 @@@ static voi
bse_engine_free_job (BseJob *job)
{
g_return_if_fail (job != NULL);
-
++
switch (job->job_id)
{
case ENGINE_JOB_INTEGRATE:
@@@ -151,24 -163,29 +162,29 @@@ static voi
bse_engine_free_transaction (BseTrans *trans)
{
BseJob *job;
-
++
g_return_if_fail (trans != NULL);
g_return_if_fail (trans->comitted == FALSE);
if (trans->jobs_tail)
g_return_if_fail (trans->jobs_tail->next == NULL); /* paranoid */
-
++
job = trans->jobs_head;
while (job)
{
BseJob *tmp = job->next;
-
++
bse_engine_free_job (job);
job = tmp;
}
sfi_delete_struct (BseTrans, trans);
}
+
+
/* --- job transactions --- */
-static BirnetMutex cqueue_trans = { 0, };
+static Bse::Mutex cqueue_trans_mutex;
static BseTrans *cqueue_trans_pending_head = NULL;
static BseTrans *cqueue_trans_pending_tail = NULL;
-static BirnetCond cqueue_trans_cond = { 0, };
+static Bse::Cond cqueue_trans_cond;
static BseTrans *cqueue_trans_trash_head = NULL;
static BseTrans *cqueue_trans_trash_tail = NULL;
static BseTrans *cqueue_trans_active_head = NULL;
@@@ -193,27 -212,30 +209,30 @@@ _engine_enqueue_trans (BseTrans *trans
cqueue_trans_pending_head = trans;
cqueue_trans_pending_tail = trans;
guint64 base_stamp = cqueue_commit_base_stamp;
- GSL_SPIN_UNLOCK (&cqueue_trans);
- sfi_cond_broadcast (&cqueue_trans_cond);
+ cqueue_trans_mutex.unlock();
+ cqueue_trans_cond.broadcast();
return base_stamp + bse_engine_block_size(); /* returns tick_stamp of when this transaction takes effect
*/
}
+
void
_engine_wait_on_trans (void)
{
- GSL_SPIN_LOCK (&cqueue_trans);
+ cqueue_trans_mutex.lock();
while (cqueue_trans_pending_head || cqueue_trans_active_head)
- sfi_cond_wait (&cqueue_trans_cond, &cqueue_trans);
- GSL_SPIN_UNLOCK (&cqueue_trans);
+ cqueue_trans_cond.wait (cqueue_trans_mutex);
+ cqueue_trans_mutex.unlock();
}
+
gboolean
_engine_job_pending (void)
{
gboolean pending = cqueue_trans_job != NULL;
-
++
if (!pending)
{
- GSL_SPIN_LOCK (&cqueue_trans);
+ cqueue_trans_mutex.lock();
pending = cqueue_trans_pending_head != NULL;
- GSL_SPIN_UNLOCK (&cqueue_trans);
+ cqueue_trans_mutex.unlock();
}
return pending;
}
@@@ -231,8 -255,9 +251,9 @@@ _engine_free_trans (BseTrans *trans
else
cqueue_trans_trash_head = trans;
cqueue_trans_trash_tail = trans;
- GSL_SPIN_UNLOCK (&cqueue_trans);
+ cqueue_trans_mutex.unlock();
}
+
BseJob*
_engine_pop_job (gboolean update_commit_stamp)
{
@@@ -301,10 -326,11 +322,11 @@@
cqueue_trans_pending_tail = NULL;
cqueue_trans_job = cqueue_trans_active_head ? cqueue_trans_active_head->jobs_head : NULL;
if (!cqueue_trans_job && update_commit_stamp)
- cqueue_commit_base_stamp = gsl_tick_stamp(); /* last job has been handed out */
- GSL_SPIN_UNLOCK (&cqueue_trans);
+ cqueue_commit_base_stamp = Bse::TickStamp::current(); /* last job has been handed out */
+ cqueue_trans_mutex.unlock();
}
}
-
++
/* pick new job and out of here */
if (cqueue_trans_job)
{
@@@ -312,6 -338,7 +334,7 @@@
cqueue_trans_job = job->next;
return job;
}
-
++
/* no pending jobs... */
return NULL;
}
@@@ -344,6 -375,7 +369,7 @@@ bse_engine_user_thread_collect (void
tjob->next = NULL;
bse_engine_free_timed_job (tjob);
}
-
++
while (trans)
{
BseTrans *t = trans;
@@@ -360,14 -393,17 +387,17 @@@ bse_engine_has_garbage (void
{
return cqueue_tjobs_trash_head || cqueue_trans_trash_head;
}
+
+
/* --- node processing queue --- */
-static BirnetMutex pqueue_mutex = { 0, };
+static Bse::Mutex pqueue_mutex;
static EngineSchedule *pqueue_schedule = NULL;
static guint pqueue_n_nodes = 0;
static guint pqueue_n_cycles = 0;
-static BirnetCond pqueue_done_cond = { 0, };
+static Bse::Cond pqueue_done_cond;
static EngineTimedJob *pqueue_trash_tjobs_head = NULL;
static EngineTimedJob *pqueue_trash_tjobs_tail = NULL;
+
static inline void
engine_fetch_process_queue_trash_jobs_U (EngineTimedJob **trash_tjobs_head,
EngineTimedJob **trash_tjobs_tail)
@@@ -486,9 -537,10 +516,10 @@@ _engine_push_processed_node (EngineNod
pqueue_n_nodes -= 1;
ENGINE_NODE_UNLOCK (node);
if (!pqueue_n_nodes && !pqueue_n_cycles && BSE_ENGINE_SCHEDULE_NONPOPABLE (pqueue_schedule))
- sfi_cond_signal (&pqueue_done_cond);
- GSL_SPIN_UNLOCK (&pqueue_mutex);
+ pqueue_done_cond.signal();
+ pqueue_mutex.unlock();
}
+
SfiRing*
_engine_pop_unprocessed_cycle (void)
{
@@@ -504,11 -558,13 +537,13 @@@ _engine_push_processed_cycle (SfiRing *
void
_engine_wait_on_unprocessed (void)
{
- GSL_SPIN_LOCK (&pqueue_mutex);
+ pqueue_mutex.lock();
while (pqueue_n_nodes || pqueue_n_cycles || !BSE_ENGINE_SCHEDULE_NONPOPABLE (pqueue_schedule))
- sfi_cond_wait (&pqueue_done_cond, &pqueue_mutex);
- GSL_SPIN_UNLOCK (&pqueue_mutex);
+ pqueue_done_cond.wait (pqueue_mutex);
+ pqueue_mutex.unlock();
}
+
+
/* -- master node list --- */
static EngineNode *master_node_list_head = NULL;
static EngineNode *master_node_list_tail = NULL;
@@@ -521,6 -579,7 +558,7 @@@ voi
_engine_mnl_remove (EngineNode *node)
{
g_return_if_fail (node->integrated == TRUE);
-
++
node->integrated = FALSE;
/* remove */
if (node->mnl_prev)
@@@ -540,6 -600,7 +579,7 @@@ _engine_mnl_integrate (EngineNode *node
g_return_if_fail (node->integrated == FALSE);
g_return_if_fail (node->flow_jobs == NULL);
g_return_if_fail (node->boundary_jobs == NULL);
-
++
node->integrated = TRUE;
/* append */
if (master_node_list_tail)
@@@ -554,7 -616,9 +595,9 @@@ voi
_engine_mnl_node_changed (EngineNode *node)
{
EngineNode *sibling;
-
++
g_return_if_fail (node->integrated == TRUE);
-
++
/* the master node list is partially sorted. that is, all
* nodes which are not scheduled and have pending user jobs
* are agglomerated at the head.
@@@ -590,11 -654,13 +633,13 @@@
}
if (UNLIKELY (node->tjob_head != NULL))
{
- GSL_SPIN_LOCK (&pqueue_mutex);
+ pqueue_mutex.lock();
collect_user_jobs_L (node);
- GSL_SPIN_UNLOCK (&pqueue_mutex);
+ pqueue_mutex.unlock();
}
}
+
+
/* --- const value blocks --- */
float*
bse_engine_const_zeros (guint smaller_than_BSE_STREAM_MAX_VALUES)
@@@ -616,15 -685,18 +664,18 @@@ const_values_lookup_nextmost (ConstValu
gfloat key_value)
{
guint n_nodes = array->n_nodes;
-
++
if (n_nodes > 0)
{
gfloat **nodes = array->nodes;
gfloat **check;
-
++
nodes -= 1;
do
{
guint i;
register gfloat cmp;
-
++
i = (n_nodes + 1) >> 1;
check = nodes + i;
cmp = key_value - **check;
@@@ -639,10 -711,13 +690,13 @@@
return check; /* matched */
}
while (n_nodes);
-
++
return check; /* nextmost */
}
-
++
return NULL;
}
+
static inline guint
upper_power2 (guint number)
{
@@@ -704,6 -783,7 +762,7 @@@ bse_engine_const_values (gfloat value
const_values_insert (&cvalue_array, block - cvalue_array.nodes, values);
else
const_values_insert (&cvalue_array, 0, values);
-
++
return values;
}
}
@@@ -713,12 -794,14 +773,14 @@@ _engine_recycle_const_values (gboolean
gfloat **nodes = cvalue_array.nodes;
guint8 *used = cvalue_array.nodes_used;
guint count = cvalue_array.n_nodes, e = 0, i;
-
++
for (i = 0; i < count; i++)
{
if (nuke_all)
used[i] = 0;
else
used[i]--; /* invariant: use counts are never 0 */
-
++
if (used[i] == 0)
g_free (nodes[i]);
else /* preserve node */
diff --cc bse/bseengineutils.hh
index 38db350,033e643..67d3d8e
--- a/bse/bseengineutils.hh
+++ b/bse/bseengineutils.hh
@@@ -1,9 -1,13 +1,12 @@@
// Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
#ifndef __BSE_ENGINE_UTIL_H__
#define __BSE_ENGINE_UTIL_H__
+
#include <bse/bseenginenode.hh>
+
G_BEGIN_DECLS
+
/* --- UserThread --- */
-void bse_engine_reinit_utils (void);
void _engine_free_trans (BseTrans *trans);
BseOStream* _engine_alloc_ostreams (guint n);
#if 0 /* bseengine.hh: */
diff --cc bse/bseenums.cc
index ff04728,f5a1e77..dca2329
--- a/bse/bseenums.cc
+++ b/bse/bseenums.cc
@@@ -19,6 -21,7 +21,7 @@@ bse_type_register_enums (void
};
uint n_enums = sizeof (enums) / sizeof (enums[0]);
uint i;
-
++
for (i = 0; i < n_enums; i++)
{
if (enums[i].parent_type == G_TYPE_ENUM)
@@@ -39,8 -44,10 +44,10 @@@ const char
bse_error_name (BseErrorType error_value)
{
GEnumValue *ev;
-
++
if (!bse_error_class)
bse_error_class = (GEnumClass*) g_type_class_ref (BSE_TYPE_ERROR_TYPE);
-
++
ev = g_enum_get_value (bse_error_class, error_value);
return ev ? ev->value_name : NULL;
}
@@@ -48,8 -56,10 +56,10 @@@ const char
bse_error_nick (BseErrorType error_value)
{
GEnumValue *ev;
-
++
if (!bse_error_class)
bse_error_class = (GEnumClass*) g_type_class_ref (BSE_TYPE_ERROR_TYPE);
-
++
ev = g_enum_get_value (bse_error_class, error_value);
return ev ? ev->value_nick : NULL;
}
@@@ -57,8 -68,10 +68,10 @@@ const char
bse_error_blurb (BseErrorType error_value)
{
GEnumValue *ev;
-
++
if (!bse_error_class)
bse_error_class = (GEnumClass*) g_type_class_ref (BSE_TYPE_ERROR_TYPE);
-
++
switch (error_value)
{
case BSE_ERROR_NONE: return _("Everything went well");
@@@ -138,6 -151,7 +151,7 @@@
case BSE_ERROR_INVALID_DURATION: return _("Invalid duration");
case BSE_ERROR_INVALID_OVERLAP: return _("Invalid overlap");
}
-
++
ev = g_enum_get_value (bse_error_class, error_value);
return ev ? ev->value_nick : NULL;
}
diff --cc bse/bseenums.proc
index 98446a2,ae43d3e..3eef262
--- a/bse/bseenums.proc
+++ b/bse/bseenums.proc
@@@ -17,12 -21,17 +21,17 @@@ PROCEDURE (bse-error-name, "Error Name"
{
/* extract parameter values */
BseErrorType error = (BseErrorType) g_value_get_enum (in_values++);
-
++
/* check parameters */
-
++
/* action */
-
++
/* set output parameters */
g_value_set_string (out_values++, bse_error_name (error));
-
++
return BSE_ERROR_NONE;
}
+
PROCEDURE (bse-error-blurb, "Error Blurb") {
HELP = "Retrieve the description of an error value";
IN = bse_param_spec_genum ("error", "Error", NULL,
@@@ -36,9 -45,13 +45,13 @@@
{
/* extract parameter values */
BseErrorType error = (BseErrorType) g_value_get_enum (in_values++);
-
++
/* check parameters */
-
++
/* action */
-
++
/* set output parameters */
g_value_set_string (out_values++, bse_error_blurb (error));
-
++
return BSE_ERROR_NONE;
}
diff --cc bse/bsefilter-ellf.cc
index 5c2c0e2,3e28841..75ed281
--- a/bse/bsefilter-ellf.cc
+++ b/bse/bsefilter-ellf.cc
@@@ -216,19 -225,23 +225,23 @@@ math_set_error (char *name, int code
"total loss of precision",
"partial loss of precision"
};
-
++
/* Display string passed by calling program,
* which is supposed to be the name of the
* function in which the error occurred:
*/
error_printf ("\n%s ", name);
-
++
/* Set global error message word */
math_global_error = code;
-
++
/* Display error message defined
* by the code argument.
*/
if ((code <= 0) || (code >= 7))
code = 0;
error_printf ("%s error\n", ermsg[code]);
-
++
/* Return to calling
* program
*/
@@@ -266,6 -280,7 +280,7 @@@ ellik (double phi, double m
{
double a, b, c, e, temp, t, K;
int d, mod, sign, npio2;
-
++
if (m == 0.0)
return phi;
a = 1.0 - m;
@@@ -315,6 -330,7 +330,7 @@@
c = sqrt (m);
d = 1;
mod = 0;
-
++
while (fabs (c/a) > MACHEP)
{
temp = b/a;
@@@ -327,7 -343,9 +343,9 @@@
b = temp;
d += d;
}
-
++
temp = (atan (t) + mod * PI)/(d * a);
-
++
done:
if (sign < 0)
temp = -temp;
@@@ -403,6 -422,7 +422,7 @@@ ellpj (double u, double m
*dn = 1.0 - 0.5*m*t*t;
return 0;
}
-
++
if (m >= 0.9999999999)
{
ai = 0.25 * (1.0-m);
@@@ -423,6 -443,7 +443,7 @@@
c[0] = sqrt (m);
twon = 1.0;
i = 0;
-
++
while (fabs (c[i]/a[i]) > MACHEP)
{
if (i > 7)
@@@ -438,6 -459,7 +459,7 @@@
b = t;
twon *= 2.0;
}
-
++
done:
/* backward recurrence */
phi = twon * a[i] * u;
@@@ -448,6 -470,7 +470,7 @@@
phi = (asin (t) + phi)/2.0;
}
while (--i);
-
++
*sn = sin (phi);
t = cos (phi);
*cn = t;
@@@ -484,14 -508,18 +508,18 @@@ polevl (double x, const double coef[],
double ans;
int i;
const double *p;
-
++
p = coef;
ans = *p++;
i = N;
-
++
do
ans = ans * x + *p++;
while (--i);
-
++
return ans;
}
+
/* ellpk - Complete elliptic integral of the first kind
*
* SYNOPSIS:
@@@ -560,6 -589,7 +589,7 @@@ ellpk (double x
math_set_error ("ellpk", MATH_ERROR_DOMAIN);
return 0.0;
}
-
++
if (x > MACHEP)
{
return polevl (x,P_ellpk,10) - log (x) * polevl (x,Q_ellpk,10);
@@@ -608,6 -639,7 +639,7 @@@ jacobi_theta_by_nome (double q
r *= p;
a += 2.0 * r;
t1 = fabs (r / a);
-
++
r *= p;
b += r;
p *= q;
@@@ -851,10 -886,12 +886,12 @@@ convert_s_plane_to_z_plane (const BseII
{
BseComplex r, cnum, cden, cwc, ca, cb, b4ac;
double C;
-
++
if (ifr->kind == BSE_IIR_FILTER_ELLIPTIC)
C = ds->tan_angle_frequency;
else
C = ds->wc;
-
++
int i;
for (i = 0; i < BSE_IIR_CARRAY_SIZE; i++)
{
@@@ -874,6 -912,7 +912,7 @@@
ii = ir + 1;
r.re = ds->spz[ir];
r.im = ds->spz[ii];
-
++
switch (ifr->type)
{
case BSE_IIR_FILTER_LOW_PASS:
@@@ -961,6 -1000,7 +1000,7 @@@
} /* end switch */
}
while (--nc > 0);
-
++
if (icnt == 0)
{
ds->n_solved_poles = ds->z_counter + 1;
@@@ -981,8 -1022,10 +1022,10 @@@ z_plane_zeros_poles_to_numerator_denome
EllfDesignState *ds)
{
BseComplex lin[2];
-
++
lin[1].re = 1.0;
lin[1].im = 0.0;
-
++
if (ifr->kind == BSE_IIR_FILTER_BUTTERWORTH || ifr->kind == BSE_IIR_FILTER_CHEBYSHEV1)
{ /* Butterworth or Chebyshev */
/* generate the remaining zeros */
@@@ -1136,6 -1181,7 +1181,7 @@@ print_quadratic_factors (const BseIIRFi
bool is_pole) /* 1 if poles, 0 if zeros */
{
double a, b, r, f, g, g0;
-
++
if (y > 1.0e-16) /* check for imaginary pole/zero */
{
a = -2.0 * x;
@@@ -1168,6 -1214,7 +1214,7 @@@
g = 1.0 - a;
g0 = 1.0 + a;
}
-
++
if (is_pole)
{
if (g != 0.0)
@@@ -1193,6 -1241,7 +1241,7 @@@ gainscale_and_print_deno_nume_zeros2_po
ellf_outputf ("constant gain factor %23.13E\n", ds->gain);
for (j = 0; j <= ds->n_solved_poles; j++)
ds->zn[j] = ds->gain * ds->zn[j];
-
++
ellf_outputf ("z plane Denominator Numerator\n");
for (j = 0; j <= ds->n_solved_poles; j++)
{
@@@ -1230,10 -1281,12 +1281,12 @@@ response (const BseIIRFilterRequest *if
BseComplex x, num, den, w;
double u;
int j;
-
++
/* exp(j omega T) */
u = 2.0 * PI * f /ifr->sampling_frequency;
x.re = cos (u);
x.im = sin (u);
-
++
num.re = 1.0;
num.im = 0.0;
den.re = 1.0;
@@@ -1257,6 -1311,7 +1311,7 @@@ print_filter_table (const BseIIRFilterR
EllfDesignState *ds)
{
double f, limit = 0.05 * ds->nyquist_frequency * 21;
-
++
for (f=0; f < limit; f += limit / 21.)
{
double r = response (ifr, ds, f, ds->gain);
@@@ -1275,6 -1331,7 +1331,7 @@@ ellf_filter_design (const BseIIRFilterR
{
double passband_edge1 = ifr->passband_edge;
double passband_edge0 = ifr->passband_edge2;
-
++
if (ifr->kind != BSE_IIR_FILTER_BUTTERWORTH &&
ifr->kind != BSE_IIR_FILTER_CHEBYSHEV1 &&
ifr->kind != BSE_IIR_FILTER_ELLIPTIC)
@@@ -1308,13 -1367,17 +1367,17 @@@
ds->ripple_epsilon = sqrt (ds->ripple_epsilon - 1.0);
}
}
-
++
if (ifr->sampling_frequency <= 0.0)
return "sampling_frequency too small";
-
++
ds->nyquist_frequency = 0.5 * ifr->sampling_frequency;
-
++
if (passband_edge1 <= 0.0)
return "passband_edge1 too small";
if (passband_edge1 >= ds->nyquist_frequency)
return "passband_edge1 too high";
-
++
if (ifr->type == BSE_IIR_FILTER_BAND_PASS || ifr->type == BSE_IIR_FILTER_BAND_STOP)
{
if (passband_edge0 <= 0.0)
@@@ -1357,6 -1420,7 +1420,7 @@@
ds->wc = ds->tan_angle_frequency;
/*ellf_debugf("cos(1/2 (Whigh-Wlow) T) = %.5e, wc = %.5e\n", cang, ds->wc);*/
}
-
++
if (ifr->kind == BSE_IIR_FILTER_ELLIPTIC)
{ /* elliptic */
double tmp_cgam = cos ((high_edge + passband_edge0) * PI / ifr->sampling_frequency) / cang;
@@@ -1468,6 -1535,7 +1535,7 @@@
if ((2 * ifr->order + 2) > BSE_IIR_CARRAY_SIZE)
goto toosml;
} /* elliptic */
-
++
/* Transformation from low-pass to band-pass critical frequencies
*
* Center frequency
@@@ -1481,6 -1549,7 +1549,7 @@@
* Wanalog = -----------------------------------
* sin(Wdigital T)
*/
-
++
if (ifr->kind == BSE_IIR_FILTER_CHEBYSHEV1)
{ /* Chebyshev */
double a = PI * (high_edge + passband_edge0) / ifr->sampling_frequency ;
@@@ -1496,13 -1565,17 +1565,17 @@@
/* ds->chebyshev_band_cbp = (ds->cgam - cos (a)) / sin (a); */
ds->gain_scale = 1.0;
}
-
++
ellf_debugf ("State: gain_scale=%.20g ripple_epsilon=%.20g nyquist_frequency=%.20g " // BSE info
"tan_angle_frequency=%.20g stopband_edge=%.20g wc=%.20g wr=%.20g cgam=%.20g\n",
ds->gain_scale, ds->ripple_epsilon, ds->nyquist_frequency,
ds->tan_angle_frequency, ds->stopband_edge, ds->wc, ds->wr, ds->cgam);
-
++
find_s_plane_poles_and_zeros (ifr, ds); /* find s plane poles and zeros */
-
++
if ((ifr->type == BSE_IIR_FILTER_BAND_PASS || ifr->type == BSE_IIR_FILTER_BAND_STOP) && 4 * ifr->order +
2 > BSE_IIR_CARRAY_SIZE)
goto toosml;
-
++
convert_s_plane_to_z_plane (ifr, ds); /* convert s plane to z plane */
// volatile_sink ("x");
z_plane_zeros_poles_to_numerator_denomerator (ifr, ds);
diff --cc bse/bseglobals.cc
index 231ad5a,61bc128..0aa1aa1
--- a/bse/bseglobals.cc
+++ b/bse/bseglobals.cc
@@@ -28,6 -33,7 +33,7 @@@ bse_time_range_to_ms (BseTimeRangeType
{
g_return_val_if_fail (time_range >= BSE_TIME_RANGE_SHORT, 0);
g_return_val_if_fail (time_range <= BSE_TIME_RANGE_LONG, 0);
-
++
switch (time_range)
{
case BSE_TIME_RANGE_SHORT: return BSE_TIME_RANGE_SHORT_ms;
diff --cc bse/bseglue.cc
index 4390805,5f27cc0..d640f5b
--- a/bse/bseglue.cc
+++ b/bse/bseglue.cc
@@@ -341,12 -369,15 +369,15 @@@ bse_glue_boxed_to_value (GType boxed
BseGlueBoxedToRec b2rec;
BseGlueBoxedToSeq b2seq;
GValue *value;
-
++
/* Convert a boxed value into a #SfiGlueValue (usually holding
* either a sequence or a record). The returned value is owned
* by the GC.
*/
+
g_return_val_if_fail (G_TYPE_IS_BOXED (boxed_type) && G_TYPE_IS_DERIVED (boxed_type), NULL);
g_return_val_if_fail (boxed != NULL, NULL);
-
++
b2rec = (BseGlueBoxedToRec) g_type_get_qdata (boxed_type, g_quark_from_string ("BseGlueBoxedToRec"));
b2seq = (BseGlueBoxedToSeq) g_type_get_qdata (boxed_type, g_quark_from_string ("BseGlueBoxedToSeq"));
if (b2rec)
@@@ -384,8 -417,10 +417,10 @@@ bglue_describe_iface (SfiGlueContext *c
GParamSpec **pspecs;
GSList *plist = NULL;
uint i, n;
-
++
if (!G_TYPE_IS_OBJECT (type) || !g_type_is_a (type, BSE_TYPE_ITEM))
return NULL;
-
++
f = sfi_glue_iface_new (g_type_name (type));
f->n_ifaces = g_type_depth (type) - g_type_depth (BSE_TYPE_ITEM) + 1;
f->ifaces = g_new (char*, f->n_ifaces + 1);
@@@ -396,6 -431,7 +431,7 @@@
xtype = g_type_parent (xtype);
}
f->ifaces[i] = NULL;
-
++
oclass = (GObjectClass*) g_type_class_ref (type);
xtype = BSE_TYPE_ITEM;
pspecs = g_object_class_list_properties (oclass, &n);
@@@ -403,6 -439,7 +439,7 @@@
for (i = 0; i < n; i++)
{
GParamSpec *pspec = pspecs[i];
-
++
if (g_type_is_a (pspec->owner_type, xtype))
{
plist = g_slist_prepend (plist, g_strdup (pspec->name));
@@@ -411,18 -448,22 +448,22 @@@
}
g_free (pspecs);
g_type_class_unref (oclass);
-
++
i = f->n_props;
f->props = g_new (char*, i + 1);
f->props[i] = NULL;
while (i--)
{
GSList *tmp = plist->next;
-
++
f->props[i] = (char*) plist->data;
g_slist_free_1 (plist);
plist = tmp;
}
-
++
return f;
}
+
uint
bse_glue_enum_index (GType enum_type,
int enum_value)
@@@ -430,16 -471,20 +471,20 @@@
GEnumClass *eclass;
GEnumValue *ev;
uint index;
-
++
g_return_val_if_fail (G_TYPE_IS_ENUM (enum_type), G_MAXINT);
g_return_val_if_fail (G_TYPE_IS_DERIVED (enum_type), G_MAXINT);
-
++
eclass = (GEnumClass*) g_type_class_ref (enum_type);
ev = g_enum_get_value (eclass, enum_value);
if (!ev)
sfi_diag ("%s: enum \"%s\" has no value %u", G_STRLOC, g_type_name (enum_type), enum_value);
index = ev ? ev - eclass->values : G_MAXINT;
g_type_class_unref (eclass);
-
++
return index;
}
+
static SfiGlueProc*
bglue_describe_proc (SfiGlueContext *context,
const char *proc_name)
@@@ -447,12 -492,15 +492,15 @@@
GType type = g_type_from_name (proc_name);
BseProcedureClass *proc;
SfiGlueProc *p = NULL;
-
++
if (!BSE_TYPE_IS_PROCEDURE (type))
return NULL;
-
++
proc = (BseProcedureClass*) g_type_class_ref (type);
if (proc->n_out_pspecs < 2)
{
uint i;
-
++
p = sfi_glue_proc_new (g_type_name (type));
p->help = g_strdup (bse_type_get_blurb (type));
p->authors = g_strdup (bse_type_get_authors (type));
@@@ -471,21 -519,26 +519,26 @@@
}
}
g_type_class_unref (proc);
-
++
return p;
}
+
static char**
bglue_list_proc_names (SfiGlueContext *context)
{
BseCategorySeq *cseq = bse_categories_match_typed ("/Proc/""*", BSE_TYPE_PROCEDURE);
char **p;
uint i;
-
++
p = g_new (char*, cseq->n_cats + 1);
for (i = 0; i < cseq->n_cats; i++)
p[i] = g_strdup (cseq->cats[i]->type);
p[i] = NULL;
bse_category_seq_free (cseq);
-
++
return p;
}
+
static char**
bglue_list_method_names (SfiGlueContext *context,
const char *iface_name)
@@@ -494,10 -547,13 +547,13 @@@
BseCategorySeq *cseq;
char **p, *prefix;
uint i, l, n_procs;
-
++
if (!g_type_is_a (type, BSE_TYPE_ITEM))
return NULL;
-
++
prefix = g_strdup_printf ("%s+", g_type_name (type));
l = strlen (prefix);
-
++
cseq = bse_categories_match_typed ("/Methods/" "*", BSE_TYPE_PROCEDURE);
p = g_new (char*, cseq->n_cats + 1);
n_procs = 0;
@@@ -507,8 -563,10 +563,10 @@@
p[n_procs] = NULL;
bse_category_seq_free (cseq);
g_free (prefix);
-
++
return p;
}
+
static char*
bglue_base_iface (SfiGlueContext *context)
{
@@@ -520,10 -579,12 +579,12 @@@ bglue_iface_children (SfiGlueContext *c
{
GType type = g_type_from_name (iface_name);
char **childnames = NULL;
-
++
if (g_type_is_a (type, BSE_TYPE_ITEM))
{
GType *children;
uint n;
-
++
children = g_type_children (type, &n);
childnames = g_new (char*, n + 1);
childnames[n] = NULL;
@@@ -548,6 -611,7 +611,7 @@@ bglue_exec_proc (SfiGlueContext *contex
{
GValue *retval = NULL;
GType ptype = bse_procedure_lookup (proc_name);
-
++
if (BSE_TYPE_IS_PROCEDURE (ptype) && G_TYPE_IS_DERIVED (ptype))
{
BseProcedureClass *proc = (BseProcedureClass*) g_type_class_ref (ptype);
@@@ -555,6 -619,7 +619,7 @@@
GSList *ilist = NULL, *olist = NULL, *clearlist = NULL;
uint i, sl = sfi_seq_length (params);
BseErrorType error;
-
++
for (i = 0; i < proc->n_in_pspecs; i++)
{
GParamSpec *pspec = proc->in_pspecs[i];
@@@ -580,6 -645,7 +645,7 @@@
g_value_init (ovalues + i, G_PARAM_SPEC_VALUE_TYPE (proc->out_pspecs[i]));
olist = g_slist_prepend (olist, ovalues + i);
}
-
++
ilist = g_slist_reverse (ilist);
olist = g_slist_reverse (olist);
error = bse_procedure_execvl (proc, ilist, olist, bglue_marshal_proc, NULL);
@@@ -588,6 -654,7 +654,7 @@@
for (ilist = clearlist; ilist; ilist = ilist->next)
sfi_value_free ((GValue*) ilist->data);
g_slist_free (clearlist);
-
++
if (error)
g_warning ("while executing \"%s\": %s", BSE_PROCEDURE_NAME (proc), bse_error_blurb (error));
if (proc->n_out_pspecs)
@@@ -599,13 -666,16 +666,16 @@@
}
else
sfi_diag ("failed to execute \"%s\": no such procedure", proc_name);
-
++
return retval;
}
+
static char*
bglue_proxy_iface (SfiGlueContext *context,
SfiProxy proxy)
{
BseObject *object = (BseObject*) bse_object_from_id (proxy);
-
++
if (BSE_IS_ITEM (object))
return g_strdup (G_OBJECT_TYPE_NAME (object));
else
@@@ -639,6 -713,7 +713,7 @@@ bglue_proxy_list_properties (SfiGlueCon
for (i = 0; i < n; i++)
{
GParamSpec *pspec = pspecs[i];
-
++
if ((!first_base_type || g_type_is_a (pspec->owner_type, first_base_type)) &&
(!last_base_type || g_type_is_a (last_base_type, pspec->owner_type)))
*p++ = g_strdup (pspec->name);
@@@ -656,6 -732,7 +732,7 @@@ bglue_proxy_get_pspec (SfiGlueContext *
{
BseObject *object = (BseObject*) bse_object_from_id (proxy);
GParamSpec *pspec;
-
++
if (!BSE_IS_ITEM (object))
{
sfi_diag ("property lookup: no such object (proxy=%lu)", proxy);
@@@ -664,9 -741,12 +741,12 @@@
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), prop_name);
if (!pspec)
return NULL;
-
++
pspec = bglue_pspec_to_serializable (pspec);
-
++
return pspec;
}
+
static SfiSCategory
bglue_proxy_get_pspec_scategory (SfiGlueContext *context,
SfiProxy proxy,
@@@ -688,6 -769,7 +769,7 @@@ bglue_proxy_set_property (SfiGlueContex
const GValue *value)
{
void *object = bse_object_from_id (proxy);
-
++
if (BSE_IS_OBJECT (object) && G_IS_VALUE (value))
{
GParamSpec *pspec = prop ? g_object_class_find_property (G_OBJECT_GET_CLASS (object), prop) : NULL;
@@@ -732,9 -815,11 +815,11 @@@ bglue_proxy_get_property (SfiGlueContex
{
GObject *object = (GObject*) bse_object_from_id (proxy);
GValue *rvalue = NULL;
-
++
if (BSE_IS_OBJECT (object) && prop)
{
GParamSpec *pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), prop);
-
++
if (pspec)
{
GValue *value = sfi_value_empty ();
@@@ -906,8 -1005,10 +1005,10 @@@ bglue_proxy_request_notify (SfiGlueCont
}
else
sig_closure_marshal = bclosure_marshal;
-
++
/* canonify signal name */
signal = g_quark_to_string (qsignal);
-
++
for (slist = p->closures; slist; last = slist, slist = last->next)
{
bclosure = (BClosure*) slist->data;
@@@ -938,6 -1039,7 +1039,7 @@@
#endif
return FALSE;
}
-
++
/* abort early if the signal is unknown */
sig_name = g_strdup (signal);
c = strchr (sig_name, ':');
@@@ -980,6 -1085,7 +1085,7 @@@ bglue_client_msg (SfiGlueContext *conte
GValue *value)
{
GValue *retval = NULL;
-
++
if (!msg)
;
else
@@@ -987,8 -1093,10 +1093,10 @@@
sfi_diag ("unhandled client message: %s", msg);
retval = sfi_value_string ("Unknown client msg");
}
-
++
return retval;
}
+
static SfiRing*
bglue_fetch_events (SfiGlueContext *context)
{
diff --cc bse/bseieee754.hh
index b9b5cfa,fe531c1..9276262
--- a/bse/bseieee754.hh
+++ b/bse/bseieee754.hh
@@@ -222,6 -241,7 +241,7 @@@ static inline voi
bse_fpu_setround (BseFpuState *cw)
{
BseFpuState cv;
-
++
__asm__ ("fnstcw %0"
: "=m" (*&cv));
*cw = cv;
@@@ -234,6 -254,7 +254,7 @@@ static inline in
bse_fpu_okround (void)
{
BseFpuState cv;
-
++
__asm__ ("fnstcw %0"
: "=m" (*&cv));
return !(cv & 0x0c00);
@@@ -249,6 -270,7 +270,7 @@@ static inline int G_GNUC_CONS
bse_ftoi (register float f)
{
int r;
-
++
__asm__ ("fistl %0"
: "=m" (r)
: "t" (f));
@@@ -258,6 -280,7 +280,7 @@@ static inline int G_GNUC_CONS
bse_dtoi (register double f)
{
int r;
-
++
__asm__ ("fistl %0"
: "=m" (r)
: "t" (f));
diff --cc bse/bseinfo.cc
index 1e33f71,0434075..682007f
--- a/bse/bseinfo.cc
+++ b/bse/bseinfo.cc
@@@ -15,8 -18,9 +18,9 @@@ print_note (const char *note_name
int note)
{
char *string;
-
++
string = bse_note_to_string (note);
- g_print ("%s =%-4d \tfactor=%"FLF"f [%-5s] (freq=%"FLF"f)\n",
+ g_print ("%s =%-4d \tfactor=%" FLF "f [%-5s] (freq=%" FLF "f)\n",
note_name, note,
bse_transpose_factor (BSE_MUSICAL_TUNING_12_TET, note - BSE_KAMMER_NOTE),
string, bse_note_to_freq (BSE_MUSICAL_TUNING_12_TET, note));
@@@ -48,12 -56,14 +53,14 @@@ main (int argc
print_fine_tune ("bse-mid-fine-tune", (BSE_MIN_FINE_TUNE + BSE_MAX_FINE_TUNE) / 2);
print_fine_tune ("BSE_MAX_FINE_TUNE", BSE_MAX_FINE_TUNE);
print_note ("BSE_KAMMER_NOTE+1", BSE_KAMMER_NOTE + 1);
-
++
if (0)
for (j = BSE_MIN_NOTE; j <= BSE_MAX_NOTE; j += 3)
print_note (":", j);
if (0)
for (j = BSE_MIN_FINE_TUNE; j <= BSE_MAX_FINE_TUNE; j += 10)
print_fine_tune (":", j);
-
++
if (0)
for (j = BSE_MIN_NOTE; j <= BSE_MAX_NOTE; j += 3)
for (k = BSE_MIN_FINE_TUNE / 2; k <= BSE_MAX_FINE_TUNE / 2; k += 10)
@@@ -74,10 -84,12 +81,12 @@@
int semitone = SFI_NOTE_SEMITONE (j);
int note = BSE_NOTE_GENERIC (octave, semitone);
char *name = bse_note_to_string (j);
-
++
g_print ("note[%3d]: name=%-8s octave=%3d semitone=%3d note=%3d match=%u\n",
j, name, octave, semitone, note, j == note);
g_free (name);
}
-
++
if (argc == 2)
{
SfiRing *ring;
diff --cc bse/bseinstrument.hh
index a32ed11,03441c7..e62b363
--- a/bse/bseinstrument.hh
+++ b/bse/bseinstrument.hh
@@@ -36,6 -43,7 +43,7 @@@ struct _BseEnvelop
struct _BseInstrument
{
BseItem parent_instance;
-
++
BseInstrumentType type;
BseWave *wave;
BseSNet *user_snet;
diff --cc bse/bseinstrumentinput.cc
index 86280f2,ff6d332..7cd37c9
--- a/bse/bseinstrumentinput.cc
+++ b/bse/bseinstrumentinput.cc
@@@ -20,6 -27,7 +27,7 @@@ bse_instrument_input_reset_names (BseIn
BseItem *item = BSE_ITEM (self);
BseSNet *snet = item->parent ? BSE_SNET (item->parent) : NULL;
const char *name;
-
++
g_object_freeze_notify (G_OBJECT (self));
name = BSE_SOURCE_OCHANNEL_IDENT (self, 0);
if (strcmp (iport->input_ports[0], name) != 0 &&
@@@ -53,10 -63,13 +63,13 @@@ bse_instrument_input_set_parent (BseIte
BseItem *parent)
{
BseInstrumentInput *self = BSE_INSTRUMENT_INPUT (item);
-
++
if (item->parent)
g_signal_handlers_disconnect_by_func (item->parent, (void*) bse_instrument_input_reset_names, self);
-
++
/* chain parent class' handler */
BSE_ITEM_CLASS (parent_class)->set_parent (item, parent);
-
++
if (item->parent)
g_signal_connect_swapped (item->parent, "port_unregistered",
G_CALLBACK (bse_instrument_input_reset_names), self);
@@@ -81,9 -96,12 +96,12 @@@ bse_instrument_input_class_init (BseIns
BseItemClass *item_class = BSE_ITEM_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
uint i, ochannel_id;
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->get_property = bse_instrument_input_get_property;
item_class->set_parent = bse_instrument_input_set_parent;
-
++
/* assert parent class introduced enough ports */
g_assert (BSE_SUB_IPORT_N_PORTS >= 4);
/* override parent properties with NOP properties */
@@@ -108,11 -128,13 +128,13 @@@ BSE_BUILTIN_TYPE (BseInstrumentInput
{
static const GTypeInfo type_info = {
sizeof (BseInstrumentInputClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_instrument_input_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseInstrumentInput),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_instrument_input_init,
diff --cc bse/bseinstrumentinput.hh
index 05d116c,21212fd..61ef908
--- a/bse/bseinstrumentinput.hh
+++ b/bse/bseinstrumentinput.hh
@@@ -10,13 -13,22 +13,15 @@@ G_BEGIN_DECL
#define BSE_IS_INPUT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object),
BSE_TYPE_INSTRUMENT_INPUT))
#define BSE_IS_INPUT_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), BSE_TYPE_INSTRUMENT_INPUT))
#define BSE_INSTRUMENT_INPUT_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object),
BSE_TYPE_INSTRUMENT_INPUT, BseInstrumentInputClass))
+
+
/* --- BseInstrumentInput source --- */
-typedef struct _BseInstrumentInput BseInstrumentInput;
-typedef struct _BseInstrumentInputClass BseInstrumentInputClass;
-struct _BseInstrumentInput
-{
- BseSubIPort parent_object;
-};
-struct _BseInstrumentInputClass
-{
- BseSubIPortClass parent_class;
-};
+struct BseInstrumentInput : BseSubIPort
+{};
+struct BseInstrumentInputClass : BseSubIPortClass
+{};
-/* --- channels --- */
enum
{
BSE_INSTRUMENT_INPUT_OCHANNEL_FREQUENCY,
diff --cc bse/bseinstrumentoutput.cc
index 50bc9f2,1d081b9..b9eef47
--- a/bse/bseinstrumentoutput.cc
+++ b/bse/bseinstrumentoutput.cc
@@@ -20,6 -27,7 +27,7 @@@ bse_instrument_output_reset_names (BseI
BseItem *item = BSE_ITEM (self);
BseSNet *snet = item->parent ? BSE_SNET (item->parent) : NULL;
const char *name;
-
++
g_object_freeze_notify (G_OBJECT (self));
name = BSE_SOURCE_ICHANNEL_IDENT (self, 0);
if (strcmp (oport->output_ports[0], name) != 0 &&
@@@ -53,10 -63,13 +63,13 @@@ bse_instrument_output_set_parent (BseIt
BseItem *parent)
{
BseInstrumentOutput *self = BSE_INSTRUMENT_OUTPUT (item);
-
++
if (item->parent)
g_signal_handlers_disconnect_by_func (item->parent, (void*) bse_instrument_output_reset_names, self);
-
++
/* chain parent class' handler */
BSE_ITEM_CLASS (parent_class)->set_parent (item, parent);
-
++
if (item->parent)
g_signal_connect_swapped (item->parent, "port_unregistered",
G_CALLBACK (bse_instrument_output_reset_names), self);
@@@ -81,9 -96,12 +96,12 @@@ bse_instrument_output_class_init (BseIn
BseItemClass *item_class = BSE_ITEM_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
uint i, ichannel_id;
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->get_property = bse_instrument_output_get_property;
item_class->set_parent = bse_instrument_output_set_parent;
-
++
/* assert parent class introduced enough ports */
g_assert (BSE_SUB_OPORT_N_PORTS >= 4);
/* override parent properties with NOP properties */
@@@ -95,6 -113,7 +113,7 @@@
/* override parent property: 0 */ "r"));
g_free (string);
}
-
++
ichannel_id = bse_source_class_add_ichannel (source_class, "left-audio", _("Left Audio"), _("Left Channel
Output"));
g_assert (ichannel_id == BSE_INSTRUMENT_OUTPUT_ICHANNEL_LEFT);
ichannel_id = bse_source_class_add_ichannel (source_class, "right-audio", _("Right Audio"), _("Right
Channel Output"));
@@@ -108,11 -128,13 +128,13 @@@ BSE_BUILTIN_TYPE (BseInstrumentOutput
{
static const GTypeInfo type_info = {
sizeof (BseInstrumentOutputClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_instrument_output_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseInstrumentOutput),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_instrument_output_init,
diff --cc bse/bseitem.cc
index 3fc33e3,87c16ca..348e339
--- a/bse/bseitem.cc
+++ b/bse/bseitem.cc
@@@ -47,16 -54,20 +54,20 @@@ BSE_BUILTIN_TYPE (BseItem
{
static const GTypeInfo item_info = {
sizeof (BseItemClass),
-
++
(GBaseInitFunc) bse_item_class_init_base,
(GBaseFinalizeFunc) bse_item_class_finalize_base,
(GClassInitFunc) bse_item_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseItem),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_item_init,
};
-
++
g_assert (BSE_ITEM_FLAGS_USHIFT < BSE_OBJECT_FLAGS_MAX_SHIFT);
-
++
return bse_type_register_abstract (BSE_TYPE_OBJECT,
"BseItem",
"Base type for objects managed by a container",
@@@ -77,16 -91,21 +91,21 @@@ bse_item_class_init (BseItemClass *klas
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
-
++
parent_class = (GTypeClass*) g_type_class_peek_parent (klass);
-
++
gobject_class->get_property = bse_item_get_property_internal;
gobject_class->set_property = bse_item_set_property_internal;
gobject_class->dispose = bse_item_do_dispose;
gobject_class->finalize = bse_item_do_finalize;
-
++
object_class->set_uname = bse_item_do_set_uname;
-
++
klass->set_parent = bse_item_do_set_parent;
klass->get_seqid = bse_item_do_get_seqid;
klass->get_undo = bse_item_default_get_undo;
klass->needs_storage = bse_item_real_needs_storage;
-
++
bse_object_class_add_param (object_class, NULL,
PROP_SEQID,
sfi_pspec_int ("seqid", "Sequential ID", NULL,
@@@ -133,10 -156,13 +156,13 @@@ static voi
bse_item_do_dispose (GObject *gobject)
{
BseItem *item = BSE_ITEM (gobject);
-
++
/* force removal from parent */
if (item->parent)
bse_container_remove_item (BSE_CONTAINER (item->parent), item);
-
++
bse_item_delete_parasites (item);
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->dispose (gobject);
}
@@@ -144,17 -171,22 +171,22 @@@ static voi
bse_item_do_finalize (GObject *object)
{
BseItem *item = BSE_ITEM (object);
-
++
bse_item_delete_parasites (item);
item_seqid_changed_queue = g_slist_remove (item_seqid_changed_queue, item);
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->finalize (object);
-
++
g_return_if_fail (item->use_count == 0);
}
+
static void
bse_item_do_set_uname (BseObject *object,
const char *uname)
{
BseItem *item = BSE_ITEM (object);
-
++
/* ensure that item names within their container are unique,
* and that we don't end up with a NULL uname
*/
@@@ -184,12 -219,14 +219,14 @@@ bse_item_update_state (BseItem *self
{
/* save original state */
gboolean old_internal = BSE_ITEM_INTERNAL (self);
-
++
/* update state */
if ((BSE_OBJECT_FLAGS (self) & BSE_ITEM_FLAG_INTERN) ||
(self->parent && BSE_ITEM_INTERNAL (self->parent)))
BSE_OBJECT_SET_FLAGS (self, BSE_ITEM_FLAG_INTERN_BRANCH);
else
BSE_OBJECT_UNSET_FLAGS (self, BSE_ITEM_FLAG_INTERN_BRANCH);
-
++
/* compare state and recurse if necessary */
if (BSE_IS_CONTAINER (self) && (old_internal != BSE_ITEM_INTERNAL (self)))
bse_container_forall_items ((BseContainer*) self, recurse_update_state, NULL);
@@@ -211,7 -249,9 +249,9 @@@ bse_item_set_internal (void *item
gboolean internal)
{
BseItem *self = BSE_ITEM (item);
-
++
g_return_if_fail (BSE_IS_ITEM (self));
-
++
if (internal)
BSE_OBJECT_SET_FLAGS (self, BSE_ITEM_FLAG_INTERN);
else
@@@ -230,8 -272,10 +272,10 @@@ bse_item_needs_storage (BseItem *sel
{
g_return_val_if_fail (BSE_IS_ITEM (self), FALSE);
g_return_val_if_fail (BSE_IS_STORAGE (storage), FALSE);
-
++
return BSE_ITEM_GET_CLASS (self)->needs_storage (self, storage);
}
+
void
bse_item_compat_setup (BseItem *self,
uint vmajor,
@@@ -239,6 -283,7 +283,7 @@@
uint vmicro)
{
g_return_if_fail (BSE_IS_ITEM (self));
-
++
if (BSE_ITEM_GET_CLASS (self)->compat_setup)
BSE_ITEM_GET_CLASS (self)->compat_setup (self, vmajor, vminor, vmicro);
}
@@@ -255,6 -302,7 +302,7 @@@ gather_child (BseItem *child
void *data)
{
GatherData *gdata = (GatherData*) data;
-
++
if (child != gdata->item && !BSE_ITEM_INTERNAL (child) &&
g_type_is_a (G_OBJECT_TYPE (child), gdata->base_type) &&
(!gdata->pcheck || gdata->pcheck (child, gdata->item, gdata->data)))
@@@ -283,15 -332,18 +332,18 @@@ bse_item_gather_items (BseIte
void *data)
{
GatherData gdata;
-
++
g_return_val_if_fail (BSE_IS_ITEM (item), NULL);
g_return_val_if_fail (iseq != NULL, NULL);
g_return_val_if_fail (g_type_is_a (base_type, BSE_TYPE_ITEM), NULL);
-
++
gdata.item = item;
gdata.data = data;
gdata.iseq = iseq;
gdata.base_type = base_type;
gdata.ccheck = ccheck;
gdata.pcheck = pcheck;
-
++
item = BSE_IS_CONTAINER (item) ? item : item->parent;
while (item)
{
@@@ -350,6 -406,7 +406,7 @@@ bse_item_get_candidates (BseIte
{
BseItemClass *klass;
GParamSpec *pspec;
-
++
g_return_val_if_fail (BSE_IS_ITEM (item), FALSE);
g_return_val_if_fail (property != NULL, FALSE);
g_return_val_if_fail (pc != NULL, FALSE);
@@@ -370,6 -429,7 +429,7 @@@ bse_item_use (BseItem *item
{
g_return_val_if_fail (BSE_IS_ITEM (item), NULL);
g_return_val_if_fail (G_OBJECT (item)->ref_count > 0, NULL);
-
++
if (!item->use_count)
g_object_ref (item);
item->use_count++;
@@@ -380,6 -441,7 +441,7 @@@ bse_item_unuse (BseItem *item
{
g_return_if_fail (BSE_IS_ITEM (item));
g_return_if_fail (item->use_count > 0);
-
++
item->use_count--;
if (!item->use_count)
{
@@@ -401,16 -464,21 +464,21 @@@ bse_item_set_parent (BseItem *item
else
g_return_if_fail (item->parent != NULL);
g_return_if_fail (BSE_ITEM_GET_CLASS (item)->set_parent != NULL); /* paranoid */
-
++
g_object_ref (item);
if (parent)
g_object_ref (parent);
-
++
BSE_ITEM_GET_CLASS (item)->set_parent (item, parent);
-
++
if (parent)
g_object_unref (parent);
else
g_object_run_dispose (G_OBJECT (item));
-
++
g_object_unref (item);
}
+
static uint
bse_item_do_get_seqid (BseItem *item)
{
@@@ -423,21 -492,27 +492,27 @@@ static gboolea
idle_handler_seqid_changed (void *data)
{
BSE_THREADS_ENTER ();
-
++
while (item_seqid_changed_queue)
{
BseItem *item = (BseItem*) g_slist_pop_head (&item_seqid_changed_queue);
g_object_notify (G_OBJECT (item), "seqid");
}
-
++
BSE_THREADS_LEAVE ();
-
++
return FALSE;
}
+
void
bse_item_queue_seqid_changed (BseItem *item)
{
g_return_if_fail (BSE_IS_ITEM (item));
g_return_if_fail (BSE_ITEM (item)->parent != NULL);
-
++
if (!item_seqid_changed_queue)
bse_idle_notify (idle_handler_seqid_changed, NULL);
-
++
if (!g_slist_find (item_seqid_changed_queue, item))
item_seqid_changed_queue = g_slist_prepend (item_seqid_changed_queue, item);
}
@@@ -446,17 -522,21 +522,21 @@@ bse_item_get_seqid (BseItem *item
{
g_return_val_if_fail (BSE_IS_ITEM (item), 0);
g_return_val_if_fail (BSE_ITEM_GET_CLASS (item)->get_seqid != NULL, 0); /* paranoid */
-
++
return BSE_ITEM_GET_CLASS (item)->get_seqid (item);
}
+
BseItem*
bse_item_common_ancestor (BseItem *item1,
BseItem *item2)
{
g_return_val_if_fail (BSE_IS_ITEM (item1), NULL);
g_return_val_if_fail (BSE_IS_ITEM (item2), NULL);
-
++
do
{
BseItem *item = item2;
-
++
do
{
if (item == item1)
@@@ -467,8 -547,10 +547,10 @@@
item1 = item1->parent;
}
while (item1);
-
++
return NULL;
}
+
/**
* @param owner reference owner
* @param link item to be referenced by @a owner
@@@ -486,10 -568,13 +568,13 @@@ bse_item_cross_link (BseItem *o
BseItemUncross uncross_func)
{
BseItem *container;
-
++
g_return_if_fail (BSE_IS_ITEM (owner));
g_return_if_fail (BSE_IS_ITEM (link));
g_return_if_fail (uncross_func != NULL);
-
++
container = bse_item_common_ancestor (owner, link);
-
++
if (container)
_bse_container_cross_link (BSE_CONTAINER (container), owner, link, uncross_func);
else
@@@ -511,10 -597,13 +597,13 @@@ bse_item_cross_unlink (BseItem *
BseItemUncross uncross_func)
{
BseItem *container;
-
++
g_return_if_fail (BSE_IS_ITEM (owner));
g_return_if_fail (BSE_IS_ITEM (link));
g_return_if_fail (uncross_func != NULL);
-
++
container = bse_item_common_ancestor (owner, link);
-
++
if (container)
_bse_container_cross_unlink (BSE_CONTAINER (container), owner, link, uncross_func);
else
@@@ -534,9 -624,12 +624,12 @@@ bse_item_uncross_links (BseItem *owner
BseItem *link)
{
BseItem *container;
-
++
g_return_if_fail (BSE_IS_ITEM (owner));
g_return_if_fail (BSE_IS_ITEM (link));
-
++
container = bse_item_common_ancestor (owner, link);
-
++
if (container)
_bse_container_uncross (BSE_CONTAINER (container), owner, link);
}
@@@ -544,48 -638,63 +638,63 @@@ BseSuper
bse_item_get_super (BseItem *item)
{
g_return_val_if_fail (BSE_IS_ITEM (item), NULL);
-
++
while (!BSE_IS_SUPER (item) && item)
item = item->parent;
-
++
return item ? BSE_SUPER (item) : NULL;
}
+
BseSNet*
bse_item_get_snet (BseItem *item)
{
g_return_val_if_fail (BSE_IS_ITEM (item), NULL);
-
++
while (!BSE_IS_SNET (item) && item)
item = item->parent;
-
++
return item ? BSE_SNET (item) : NULL;
}
+
BseItem*
bse_item_get_toplevel (BseItem *item)
{
g_return_val_if_fail (BSE_IS_ITEM (item), NULL);
-
++
while (item->parent)
item = item->parent;
-
++
return item;
}
+
BseProject*
bse_item_get_project (BseItem *item)
{
g_return_val_if_fail (BSE_IS_ITEM (item), NULL);
-
++
while (item->parent)
item = item->parent;
-
++
return BSE_IS_PROJECT (item) ? (BseProject*) item : NULL;
}
+
gboolean
bse_item_has_ancestor (BseItem *item,
BseItem *ancestor)
{
g_return_val_if_fail (BSE_IS_ITEM (item), FALSE);
g_return_val_if_fail (BSE_IS_ITEM (ancestor), FALSE);
-
++
while (item->parent)
{
item = item->parent;
if (item == ancestor)
return TRUE;
}
-
++
return FALSE;
}
+
/**
* @param self a valid Item
* @return the current BseMusicalTuningType, defaulting to BSE_MUSICAL_TUNING_12_TET
@@@ -645,12 -758,14 +758,14 @@@ bse_item_execva_i (BseItem *item
BseErrorType error;
GType proc_type = find_method_procedure (BSE_OBJECT_TYPE (item), procedure);
GValue obj_value;
-
++
if (!proc_type)
{
g_warning ("no such method \"%s\" of item %s",
procedure, bse_object_debug_name (item));
return BSE_ERROR_INTERNAL;
}
-
++
/* setup first arg (the object) */
obj_value.g_type = 0;
g_value_init (&obj_value, BSE_TYPE_ITEM);
@@@ -668,13 -784,17 +784,17 @@@ bse_item_exec (void *_item
BseItem *item = (BseItem*) _item;
va_list var_args;
BseErrorType error;
-
++
g_return_val_if_fail (BSE_IS_ITEM (item), BSE_ERROR_INTERNAL);
g_return_val_if_fail (procedure != NULL, BSE_ERROR_INTERNAL);
-
++
va_start (var_args, procedure);
error = bse_item_execva_i (item, procedure, var_args, FALSE);
va_end (var_args);
-
++
return error;
}
+
BseErrorType
bse_item_exec_void (void *_item,
const char *procedure,
@@@ -683,13 -803,17 +803,17 @@@
BseItem *item = (BseItem*) _item;
va_list var_args;
BseErrorType error;
-
++
g_return_val_if_fail (BSE_IS_ITEM (item), BSE_ERROR_INTERNAL);
g_return_val_if_fail (procedure != NULL, BSE_ERROR_INTERNAL);
-
++
va_start (var_args, procedure);
error = bse_item_execva_i (item, procedure, var_args, TRUE);
va_end (var_args);
-
++
return error;
}
+
static GValue*
pack_value_for_undo (GValue *value,
BseUndoStack *ustack)
@@@ -807,6 -935,7 +935,7 @@@ bse_item_push_undo_proc_valist (voi
bse_item_undo_close (ustack);
return;
}
-
++
proc = (BseProcedureClass*) g_type_class_ref (proc_type);
/* we allow one return value */
if (proc->n_out_pspecs > 1)
@@@ -817,11 -946,13 +946,13 @@@
bse_item_undo_close (ustack);
return;
}
-
++
ivalues = g_new (GValue, proc->n_in_pspecs);
/* setup first arg (the object) */
ivalues[0].g_type = 0;
g_value_init (ivalues + 0, BSE_TYPE_ITEM);
g_value_set_object (ivalues + 0, item);
-
++
/* collect procedure args */
error = bse_procedure_collect_input_args (proc, ivalues + 0, var_args, ivalues);
if (!error)
@@@ -852,8 -984,10 +984,10 @@@ bse_item_push_undo_proc (void *it
...)
{
va_list var_args;
-
++
g_return_if_fail (BSE_IS_ITEM (item));
g_return_if_fail (procedure != NULL);
-
++
va_start (var_args, procedure);
bse_item_push_undo_proc_valist (item, procedure, FALSE, var_args);
va_end (var_args);
@@@ -864,8 -999,10 +999,10 @@@ bse_item_push_redo_proc (void *it
...)
{
va_list var_args;
-
++
g_return_if_fail (BSE_IS_ITEM (item));
g_return_if_fail (procedure != NULL);
-
++
va_start (var_args, procedure);
bse_item_push_undo_proc_valist (item, procedure, TRUE, var_args);
va_end (var_args);
@@@ -876,7 -1014,9 +1014,9 @@@ bse_item_set_undoable (void *o
...)
{
va_list var_args;
-
++
g_return_if_fail (BSE_IS_ITEM (object));
-
++
va_start (var_args, first_property_name);
bse_item_set_valist_undoable (object, first_property_name, var_args);
va_end (var_args);
@@@ -888,15 -1029,19 +1029,19 @@@ bse_item_set_valist_undoable (voi
{
BseItem *self = BSE_ITEM (object);
const char *name;
-
++
g_return_if_fail (BSE_IS_ITEM (self));
-
++
g_object_ref (object);
g_object_freeze_notify (G_OBJECT (object));
-
++
name = first_property_name;
while (name)
{
GValue value = { 0, };
GParamSpec *pspec;
char *error = NULL;
-
++
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (self), name);
if (!pspec)
{
@@@ -1016,7 -1168,9 +1168,9 @@@ bse_item_undo_open (void *item
BseUndoStack *ustack;
char *buffer;
va_list args;
-
++
g_return_val_if_fail (format != NULL, NULL);
-
++
ustack = BSE_ITEM_GET_CLASS (self)->get_undo (self);
va_start (args, format);
buffer = g_strdup_vprintf (format, args);
@@@ -1046,11 -1202,14 +1202,14 @@@ undo_restore_item (BseUndoStep *ustep
BseItem *item = (BseItem*) bse_undo_pointer_unpack ((const char*) ustep->data[0].v_pointer, ustack);
BseStorage *storage = BSE_STORAGE (ustep->data[1].v_pointer);
GTokenType expected_token = G_TOKEN_NONE;
-
++
expected_token = bse_storage_restore_item (storage, item);
if (expected_token != G_TOKEN_NONE)
bse_storage_unexp_token (storage, expected_token);
-
++
bse_storage_finish_parsing (storage);
}
+
static void
unde_free_item (BseUndoStep *ustep)
{
@@@ -1085,6 -1246,7 +1246,7 @@@ bse_item_backup_to_undo (BseItem *
bse_storage_prepare_write (storage, BseStorageMode (BSE_STORAGE_DBLOCK_CONTAINED |
BSE_STORAGE_SELF_CONTAINED));
bse_storage_store_item (storage, self);
-
++
bse_item_push_undo_storage (self, ustack, storage);
g_object_unref (storage);
}
diff --cc bse/bseitem.proc
index 1771bec,c408ca7..4dcfdd6
--- a/bse/bseitem.proc
+++ b/bse/bseitem.proc
@@@ -20,13 -24,17 +24,17 @@@ METHOD (BseItem, get-type)
{
/* extract parameter values */
BseItem *item = (BseItem*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_ITEM (item))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_static_string (out_values++, g_type_name (G_OBJECT_TYPE (item)));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseItem, get-type-name) {
HELP = "Retrieve an item's type name.";
IN = bse_param_spec_object ("item", "Item", NULL,
@@@ -40,13 -48,17 +48,17 @@@
{
/* extract parameter values */
BseItem *item = (BseItem*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_ITEM (item))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_string (out_values++, g_type_name (G_OBJECT_TYPE (item)));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseItem, get-type-blurb) {
HELP = "Retrieve an item's type description.";
IN = bse_param_spec_object ("item", "Item", NULL,
@@@ -60,13 -72,17 +72,17 @@@
{
/* extract parameter values */
BseItem *item = (BseItem*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_ITEM (item))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_string (out_values++, bse_type_get_blurb (G_OBJECT_TYPE (item)));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseItem, get-type-authors) {
HELP = "Retrieve authors of an item's type implementation.";
IN = bse_param_spec_object ("item", "Item", NULL,
@@@ -80,13 -96,17 +96,17 @@@
{
/* extract parameter values */
BseItem *item = (BseItem*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_ITEM (item))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_string (out_values++, bse_type_get_authors (G_OBJECT_TYPE (item)));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseItem, get-type-license) {
HELP = "Retrieve the license for an item's type implementation.";
IN = bse_param_spec_object ("item", "Item", NULL,
@@@ -100,13 -120,17 +120,17 @@@
{
/* extract parameter values */
BseItem *item = (BseItem*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_ITEM (item))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_string (out_values++, bse_type_get_license (G_OBJECT_TYPE (item)));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseItem, get-parent) {
HELP = "Retrieve an item's parent.";
IN = bse_param_spec_object ("item", "Item", NULL,
@@@ -119,13 -143,17 +143,17 @@@
{
/* extract parameter values */
BseItem *item = (BseItem*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_ITEM (item))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
bse_value_set_object (out_values++, item->parent);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseItem, get-project) {
HELP = "Retrieve an item's project.";
IN = bse_param_spec_object ("item", "Item", NULL,
@@@ -138,13 -166,17 +166,17 @@@
{
/* extract parameter values */
BseItem *item = (BseItem*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_ITEM (item))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
bse_value_set_object (out_values++, bse_item_get_project (item));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseItem, get-uname-path) {
HELP = "Retrieve the project relative uname path for this item.";
IN = bse_param_spec_object ("item", NULL, NULL,
@@@ -158,15 -190,20 +190,20 @@@
/* extract parameter values */
BseItem *item = (BseItem*) bse_value_get_object (in_values++);
BseProject *project;
-
++
/* check parameters */
if (!BSE_IS_ITEM (item))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
project = bse_item_get_project (item);
-
++
/* set output parameters */
sfi_value_take_string (out_values++,
project ? bse_container_make_upath (BSE_CONTAINER (project), item) : NULL);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseItem, internal) {
HELP = "Check whether an item is internal, i.e. owned by another non-internal item.";
IN = bse_param_spec_object ("item", "Item", NULL,
@@@ -179,13 -216,17 +216,17 @@@
{
/* extract parameter values */
BseItem *item = (BseItem*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_ITEM (item))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_bool (out_values++, BSE_ITEM_INTERNAL (item));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseItem, use) {
HELP = "Increment use count to keep an item alive.";
IN = bse_param_spec_object ("item", "Item", NULL,
@@@ -198,15 -239,20 +239,20 @@@
{
/* extract parameter values */
BseItem *item = (BseItem*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_ITEM (item) || (!item->parent && !item->use_count))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
bse_item_use (item);
-
++
/* set output parameters */
bse_value_set_object (out_values++, item);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseItem, unuse) {
HELP = "Decrement use count for when an item is not needed anymore.";
IN = bse_param_spec_object ("item", "Item", NULL,
@@@ -217,15 -263,20 +263,20 @@@
{
/* extract parameter values */
BseItem *item = (BseItem*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_ITEM (item))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
if (item->use_count < 1)
return BSE_ERROR_NOT_OWNER;
+
bse_item_unuse (item);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseItem, set-name) {
HELP = "Set an item's name.";
IN = bse_param_spec_object ("item", "Item", NULL,
@@@ -259,13 -315,17 +315,17 @@@ METHOD (BseItem, get-name)
{
/* extract parameter values */
BseItem *item = (BseItem*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_ITEM (item))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_string (out_values++, BSE_OBJECT_UNAME (item));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseItem, get-name-or-type) {
HELP = "Retrieve an item's name or type if it has no name.";
IN = bse_param_spec_object ("item", "Item", NULL,
@@@ -279,17 -339,21 +339,21 @@@
/* extract parameter values */
BseItem *item = (BseItem*) bse_value_get_object (in_values++);
gchar *name = NULL;
-
++
/* check parameters */
if (!BSE_IS_ITEM (item))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
name = BSE_OBJECT_UNAME (item);
if (name)
sfi_value_set_string (out_values++, name);
else
sfi_value_set_string (out_values++, BSE_OBJECT_TYPE_NAME (item));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseItem, common-ancestor) {
HELP = "Retrieve the common ancestor of two items if there's any.";
IN = bse_param_spec_object ("item", "Item", "First item",
@@@ -305,13 -369,17 +369,17 @@@
/* extract parameter values */
BseItem *item = (BseItem*) bse_value_get_object (in_values++);
BseItem *item2 = (BseItem*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_ITEM (item) || !BSE_IS_ITEM (item2))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
bse_value_set_object (out_values++, bse_item_common_ancestor (item, item2));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseItem, get-seqid) {
HELP = ("Retrieve an item's sequential ID. The sequential ID depends "
"on the item's type an it's position inbetween siblings "
@@@ -326,13 -394,17 +394,17 @@@
{
/* extract parameter values */
BseItem *item = (BseItem*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_ITEM (item))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_int (out_values++, bse_item_get_seqid (item));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseItem, check-is-a) {
HELP = "Check whether an item has a certain type.";
IN = bse_param_spec_object ("item", "Item", "The Item",
@@@ -350,16 -422,21 +422,21 @@@
const char *type_name = sfi_value_get_string (in_values++);
GType type;
gboolean is_a;
-
++
/* check parameters */
if (!type_name)
type_name = "";
-
++
/* action */
type = g_type_from_name (type_name);
is_a = item && g_type_is_a (G_OBJECT_TYPE (item), type);
-
++
/* set output parameters */
sfi_value_set_bool (out_values++, is_a);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseItem, get-property-candidates) {
HELP = "Retrieve tentative values for an item or item sequence property.";
IN = bse_param_spec_object ("item", NULL, NULL,
@@@ -377,6 -455,7 +455,7 @@@
/* check parameters */
if (!BSE_IS_ITEM (self) || !property)
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
BsePropertyCandidates *pc = bse_property_candidates_new();
if (!bse_item_get_candidates (self, property, pc))
@@@ -404,10 -486,13 +486,13 @@@ METHOD (BseItem, editable-property)
/* check parameters */
if (!BSE_IS_ITEM (self) || !property)
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_bool (out_values++, bse_object_editable_property (self, property));
+
return BSE_ERROR_NONE;
}
+
METHOD (BseItem, get-icon) {
HELP = "Get the current icon of an item.";
IN = bse_param_spec_object ("item", NULL, NULL,
@@@ -420,13 -505,17 +505,17 @@@
{
/* extract parameter values */
BseItem *self = (BseItem*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_ITEM (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
bse_value_set_boxed (out_values++, bse_object_get_icon (BSE_OBJECT (self)));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseItem, group-undo) {
HELP = "Request multiple modifying actions on an item to be grouped together as single undo
operation.";
IN = bse_param_spec_object ("item", NULL, NULL,
@@@ -447,8 -538,10 +538,10 @@@
ustack = bse_item_undo_open (self, "item-group-undo");
bse_undo_stack_add_merger (ustack, name);
bse_item_undo_close (ustack);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseItem, ungroup-undo) {
HELP = "Ends the undo grouping opened up by a previous group-undo() call.";
IN = bse_param_spec_object ("item", NULL, NULL,
@@@ -466,8 -561,10 +561,10 @@@
ustack = bse_item_undo_open (self, "item-ungroup-undo");
bse_undo_stack_remove_merger (ustack);
bse_item_undo_close (ustack);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseItem, undo) {
HELP = "Call the undo function of the project corresponding to this item if any.";
IN = bse_param_spec_object ("item", NULL, NULL,
diff --cc bse/bsejanitor.cc
index c0d0c51,69cc5bd..8a41bf0
--- a/bse/bsejanitor.cc
+++ b/bse/bsejanitor.cc
@@@ -49,15 -57,18 +57,18 @@@ BSE_BUILTIN_TYPE (BseJanitor
{
static const GTypeInfo janitor_info = {
sizeof (BseJanitorClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_janitor_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseJanitor),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_janitor_init,
};
-
++
return bse_type_register_static (BSE_TYPE_ITEM,
"BseJanitor",
"BSE connection interface object",
@@@ -70,11 -82,15 +82,15 @@@ bse_janitor_class_init (BseJanitorClas
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
BseItemClass *item_class = BSE_ITEM_CLASS (klass);
-
++
parent_class = (GTypeClass*) g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = bse_janitor_set_property;
gobject_class->get_property = bse_janitor_get_property;
gobject_class->finalize = bse_janitor_finalize;
-
++
item_class->set_parent = bse_janitor_set_parent;
-
++
bse_object_class_add_param (object_class, NULL, PROP_IDENT,
sfi_pspec_string ("ident", "Script Identifier", NULL, NULL, SFI_PARAM_GUI));
bse_object_class_add_param (object_class, NULL, PROP_CONNECTED,
@@@ -85,6 -101,7 +101,7 @@@
sfi_pspec_int ("exit-code", "Exit Code", NULL, 0, -256, 256, 0, "G:r"));
bse_object_class_add_param (object_class, NULL, PROP_EXIT_REASON,
sfi_pspec_string ("exit-reason", "Exit Reason", NULL, NULL, "G:r"));
-
++
signal_progress = bse_object_class_add_signal (object_class, "progress",
G_TYPE_NONE, 1, G_TYPE_FLOAT);
signal_action_changed = bse_object_class_add_dsignal (object_class, "action-changed",
@@@ -119,6 -138,7 +138,7 @@@ bse_janitor_set_property (GObject
GParamSpec *pspec)
{
BseJanitor *self = BSE_JANITOR (object);
-
++
switch (param_id)
{
case PROP_STATUS_MESSAGE:
@@@ -137,6 -158,7 +158,7 @@@ bse_janitor_get_property (GObject *o
GParamSpec *pspec)
{
BseJanitor *self = BSE_JANITOR (object);
-
++
switch (param_id)
{
case PROP_IDENT:
@@@ -163,13 -186,16 +186,16 @@@ static voi
bse_janitor_finalize (GObject *object)
{
BseJanitor *self = BSE_JANITOR (object);
-
++
g_return_if_fail (self->port == NULL);
g_return_if_fail (self->source == NULL);
-
++
while (self->actions)
{
BseJanitorAction *a = (BseJanitorAction*) self->actions->data;
bse_janitor_remove_action (self, g_quark_to_string (a->action));
}
-
++
g_free (self->status_message);
g_free (self->script_name);
g_free (self->proc_name);
@@@ -181,9 -209,12 +209,12 @@@ BseJanitor
bse_janitor_new (SfiComPort *port)
{
BseJanitor *self;
-
++
g_return_val_if_fail (port != NULL, NULL);
-
++
self = (BseJanitor*) bse_container_new_child ((BseContainer*) bse_server_get (), BSE_TYPE_JANITOR, NULL);
g_object_ref (self);
+
/* store the port */
self->port = sfi_com_port_ref (port);
sfi_com_port_set_close_func (self->port, janitor_port_closed, self);
@@@ -194,14 -225,17 +225,17 @@@
sfi_glue_decoder_add_handler (self->decoder, janitor_client_msg, self);
/* main loop integration */
janitor_install_jsource (self);
-
++
return self;
}
+
void
bse_janitor_set_procedure (BseJanitor *self,
const char *script_name,
const char *proc_name)
{
g_return_if_fail (BSE_IS_JANITOR (self));
-
++
g_free (self->proc_name);
self->proc_name = g_strdup (proc_name);
g_free (self->script_name);
@@@ -212,8 -247,10 +247,10 @@@ const char
bse_janitor_get_ident (BseJanitor *self)
{
g_return_val_if_fail (BSE_IS_JANITOR (self), NULL);
-
++
return self->port ? self->port->ident : NULL;
}
+
/**
* @param self janitor object
* @param progress progress value
@@@ -227,6 -264,7 +264,7 @@@ bse_janitor_progress (BseJanitor *self
float progress)
{
g_return_if_fail (BSE_IS_JANITOR (self));
-
++
if (progress < 0)
progress = -1;
else
@@@ -253,10 -293,12 +293,12 @@@ bse_janitor_add_action (BseJanitor *sel
const char *blurb)
{
BseJanitorAction *a;
-
++
g_return_if_fail (BSE_IS_JANITOR (self));
g_return_if_fail (action != NULL);
g_return_if_fail (name != NULL);
g_return_if_fail (!BSE_OBJECT_DISPOSING (self));
-
++
a = find_action (self, g_quark_try_string (action));
if (!a)
{
@@@ -273,12 -316,15 +316,15 @@@ bse_janitor_remove_action (BseJanitor *
const char *action)
{
BseJanitorAction *a;
-
++
g_return_if_fail (BSE_IS_JANITOR (self));
g_return_if_fail (action != NULL);
-
++
a = find_action (self, g_quark_try_string (action));
if (a)
{
GQuark aquark;
-
++
self->actions = g_slist_remove (self->actions, a);
aquark = a->action;
g_free (a->name);
@@@ -293,8 -340,10 +340,10 @@@ bse_janitor_trigger_action (BseJanitor
const char *action)
{
BseJanitorAction *a;
-
++
g_return_if_fail (BSE_IS_JANITOR (self));
g_return_if_fail (action != NULL);
-
++
a = find_action (self, g_quark_try_string (action));
if (a && !BSE_OBJECT_DISPOSING (self))
g_signal_emit (self, signal_action, a->action, g_quark_to_string (a->action), g_slist_index
(self->actions, a));
@@@ -337,6 -392,7 +392,7 @@@ bse_janitor_set_parent (BseItem *item
BseItem *parent)
{
BseJanitor *self = BSE_JANITOR (item);
-
++
if (!parent && /* removal */
!self->port_closed)
janitor_shutdown (self);
diff --cc bse/bsejanitor.hh
index 50679c2,036277e..3784d43
--- a/bse/bsejanitor.hh
+++ b/bse/bsejanitor.hh
@@@ -10,8 -13,12 +13,10 @@@ G_BEGIN_DECL
#define BSE_IS_JANITOR(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BSE_TYPE_JANITOR))
#define BSE_IS_JANITOR_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), BSE_TYPE_JANITOR))
#define BSE_JANITOR_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BSE_TYPE_JANITOR,
BseJanitorClass))
+
+
/* --- object structures --- */
-struct _BseJanitor
-{
- BseItem parent_instance;
+struct BseJanitor : BseItem {
guint port_closed : 1;
guint force_kill : 1;
guint force_normal_exit : 1;
diff --cc bse/bsejanitor.proc
index 61c81b8,084c8b1..51fc58c
--- a/bse/bsejanitor.proc
+++ b/bse/bsejanitor.proc
@@@ -20,13 -24,17 +24,17 @@@ BODY (BseProcedureClass *proc
/* extract parameter values */
BseJanitor *self = (BseJanitor*) bse_value_get_object (in_values++);
const gchar *action = sfi_value_get_string (in_values++);
-
++
/* check parameters */
if (!BSE_IS_JANITOR (self) || !action)
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
bse_janitor_trigger_action (self, action);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseJanitor, get-script-name) {
HELP = "Retrieve the script name of this janitor.";
IN = bse_param_spec_object ("janitor", "Janitor", NULL,
@@@ -40,13 -48,17 +48,17 @@@ BODY (BseProcedureClass *proc
{
/* extract parameter values */
BseJanitor *self = (BseJanitor*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_JANITOR (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_string (out_values++, self->script_name);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseJanitor, get-proc-name) {
HELP = "Retrieve the procedure name of this janitor.";
IN = bse_param_spec_object ("janitor", "Janitor", NULL,
@@@ -60,13 -72,17 +72,17 @@@ BODY (BseProcedureClass *proc
{
/* extract parameter values */
BseJanitor *self = (BseJanitor*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_JANITOR (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_string (out_values++, self->proc_name);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseJanitor, n-actions) {
HELP = "Retrieve number of user actions of this janitor.";
IN = bse_param_spec_object ("janitor", "Janitor", NULL,
@@@ -80,13 -96,17 +96,17 @@@ BODY (BseProcedureClass *proc
{
/* extract parameter values */
BseJanitor *self = (BseJanitor*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_JANITOR (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_int (out_values++, g_slist_length (self->actions));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseJanitor, get-action) {
HELP = "Retrieve an action of this janitor.";
IN = bse_param_spec_object ("janitor", "Janitor", NULL,
@@@ -170,13 -203,17 +203,17 @@@ BODY (BseProcedureClass *proc
{
/* extract parameter values */
BseJanitor *self = (BseJanitor*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_JANITOR (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
bse_janitor_kill (self);
-
++
return BSE_ERROR_NONE;
}
+
PROCEDURE (bse-script-janitor, "Script/Get Janitor") {
HELP = "Retrieve the connection dependant janitor object.";
OUT = bse_param_spec_object ("janitor", "Janitor", NULL,
@@@ -187,13 -224,17 +224,17 @@@ BODY (BseProcedureClass *proc
GValue *out_values)
{
BseJanitor *self = bse_janitor_get_current ();
-
++
/* check execution context */
if (!self || !self->port || self->port_closed)
return BSE_ERROR_PROC_EXECUTION;
+
/* set output parameters */
bse_value_set_object (out_values++, self);
-
++
return BSE_ERROR_NONE;
}
+
PROCEDURE (bse-script-add-action, "Script/Add Action") {
HELP = "Install a user action for script control.";
IN = sfi_pspec_string ("action", "Action", NULL,
@@@ -212,16 -253,21 +253,21 @@@ BODY (BseProcedureClass *proc
const gchar *action = sfi_value_get_string (in_values++);
const gchar *name = sfi_value_get_string (in_values++);
const gchar *blurb = sfi_value_get_string (in_values++);
-
++
/* check parameters */
if (!BSE_IS_JANITOR (self) || !action || !name)
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* check execution context */
if (!self->port || self->port_closed)
return BSE_ERROR_PROC_EXECUTION;
-
++
/* action */
bse_janitor_add_action (self, action, name, blurb);
-
++
return BSE_ERROR_NONE;
}
+
PROCEDURE (bse-script-remove-action, "Script/Remove Action") {
HELP = "Remove a previously installed user action from script control.";
IN = sfi_pspec_string ("action", "Action", NULL,
@@@ -234,16 -280,21 +280,21 @@@ BODY (BseProcedureClass *proc
/* extract parameter values */
BseJanitor *self = bse_janitor_get_current ();
const gchar *action = sfi_value_get_string (in_values++);
-
++
/* check parameters */
if (!BSE_IS_JANITOR (self) || !action)
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* check execution context */
if (!self->port || self->port_closed)
return BSE_ERROR_PROC_EXECUTION;
-
++
/* action */
bse_janitor_remove_action (self, action);
-
++
return BSE_ERROR_NONE;
}
+
PROCEDURE (bse-script-set-status, "Script/Set Status") {
HELP = "Alter script status message.";
IN = sfi_pspec_string ("message", "Message", NULL,
@@@ -255,6 -306,7 +306,7 @@@
/* extract parameter values */
BseJanitor *self = bse_janitor_get_current ();
const gchar *message = sfi_value_get_string (in_values++);
-
++
/* check parameters */
if (!BSE_IS_JANITOR (self))
return BSE_ERROR_PROC_PARAM_INVAL;
@@@ -263,10 -316,13 +316,13 @@@
return BSE_ERROR_PROC_EXECUTION;
if (!message)
message = "";
-
++
/* action */
bse_item_set (self, "status-message", message, NULL);
-
++
return BSE_ERROR_NONE;
}
+
PROCEDURE (bse-script-progress, "Script/Progress") {
HELP = "Indicate progress (from 0.0 to 1.0 or -1 for unknown amount).";
IN = sfi_pspec_real ("progress", "Progress", NULL,
@@@ -279,6 -335,7 +335,7 @@@
/* extract parameter values */
BseJanitor *self = bse_janitor_get_current ();
gfloat progress = sfi_value_get_real (in_values++);
-
++
/* check parameters */
if (!BSE_IS_JANITOR (self))
return BSE_ERROR_PROC_PARAM_INVAL;
@@@ -285,10 -343,13 +343,13 @@@
/* check execution context */
if (!self->port || self->port_closed)
return BSE_ERROR_PROC_EXECUTION;
-
++
/* action */
bse_janitor_progress (self, progress);
-
++
return BSE_ERROR_NONE;
}
+
PROCEDURE (bse-script-send-message, "Script/Message") {
HELP = "Send a message from a script.";
/* keep arguments in sync with bsescminterp.c */
@@@ -357,8 -401,10 +419,10 @@@ PROCEDURE (bse-script-quit, "Script/Qui
/* check execution context */
if (!BSE_IS_JANITOR (janitor) || !janitor->port || janitor->port_closed)
return BSE_ERROR_PROC_EXECUTION;
-
++
/* action */
janitor->force_normal_exit = TRUE;
bse_janitor_close (janitor);
-
++
return BSE_ERROR_NONE;
}
diff --cc bse/bseladspa.cc
index 43eaf29,dd489f6..dc5309b
--- a/bse/bseladspa.cc
+++ b/bse/bseladspa.cc
@@@ -49,8 -61,10 +56,10 @@@ BSE_BUILTIN_TYPE (BseLadspaPlugin
__FILE__, __LINE__,
&type_info);
g_type_add_interface_static (type, G_TYPE_TYPE_PLUGIN, &iface_info);
-
++
return type;
}
+
static void
ladspa_plugin_iface_init (GTypePluginClass *iface)
{
@@@ -421,12 -460,13 +440,13 @@@ bse_ladspa_info_assemble (const gchar
bli->file_path = g_strdup (file_path);
if (!file_path)
file_path = ""; /* ensure !=NULL for messages below */
+
bli->plugin_id = cld->UniqueID;
if (bli->plugin_id < 1 || bli->plugin_id >= 0x1000000)
- Msg::display (debug_ladspa, "%s: plugin with suspicious ID: %u", file_path, bli->plugin_id);
+ LDEBUG ("%s: plugin with suspicious ID: %u", file_path, bli->plugin_id);
if (!cld->Label)
{
- Msg::display (debug_ladspa, "%s: ignoring plugin with NULL label", file_path);
+ LDEBUG ("%s: ignoring plugin with NULL label", file_path);
goto bail_broken;
}
else
@@@ -441,9 -481,10 +461,10 @@@
bli->copyright = cld->Copyright;
bli->interactive = (cld->Properties & LADSPA_PROPERTY_REALTIME) != 0;
bli->rt_capable = (cld->Properties & LADSPA_PROPERTY_HARD_RT_CAPABLE) != 0;
+
if (!cld->PortCount)
{
- Msg::display (debug_ladspa, "%s: ignoring plugin without ports", bli->ident);
+ LDEBUG ("%s: ignoring plugin without ports", bli->ident);
goto bail_broken;
}
if (!cld->PortDescriptors)
@@@ -493,12 -534,13 +514,13 @@@
}
if (!seen_audio_output)
{
- Msg::display (debug_ladspa, "%s: ignoring plugin without audio output channels", bli->ident);
+ LDEBUG ("%s: ignoring plugin without audio output channels", bli->ident);
goto bail_broken;
}
+
if (!cld->instantiate)
{
- Msg::display (debug_ladspa, "%s: ignoring plugin without instantiate() function", bli->ident);
+ LDEBUG ("%s: ignoring plugin without instantiate() function", bli->ident);
goto bail_broken;
}
bli->descdata = cld;
@@@ -625,6 -687,7 +667,7 @@@ ladspa_test_load (const gchar *file
LADSPA_Descriptor_Function ldf = NULL;
const gchar *error;
GModule *gmodule;
-
++
gmodule = g_module_open (file, 0);
error = g_module_error ();
if (!error && gmodule)
diff --cc bse/bseladspa.hh
index 22e3372,80c9489..7aa951e
--- a/bse/bseladspa.hh
+++ b/bse/bseladspa.hh
@@@ -11,8 -14,10 +14,10 @@@ G_BEGIN_DECL
#define BSE_IS_LADSPA_PLUGIN(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BSE_TYPE_LADSPA_PLUGIN))
#define BSE_IS_LADSPA_PLUGIN_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), BSE_TYPE_LADSPA_PLUGIN))
#define BSE_LADSPA_PLUGIN_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BSE_TYPE_LADSPA_PLUGIN,
BseLadspaPluginClass))
+
+
/* --- BseLadspaPlugin --- */
-typedef struct _BseLadspaInfo BseLadspaInfo;
+struct BseLadspaInfo;
typedef struct {
GType type;
BseLadspaInfo *info;
diff --cc bse/bseladspamodule.cc
index 5371005,8885536..c5061da
--- a/bse/bseladspamodule.cc
+++ b/bse/bseladspamodule.cc
@@@ -30,16 -36,19 +36,19 @@@ BSE_BUILTIN_TYPE (BseLadspaModule
{
static const GTypeInfo type_info = {
sizeof (BseLadspaModuleClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_ladspa_module_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseLadspaModule),
0 /* n_preallocs */,
(GInstanceInitFunc) NULL,
};
GType type;
-
++
type = bse_type_register_static (BSE_TYPE_SOURCE,
"BseLadspaModule",
"LADSPA Module base type",
@@@ -94,11 -114,14 +114,14 @@@ bse_ladspa_module_class_init_from_info
BseSourceClass *source_class = BSE_SOURCE_CLASS (ladspa_module_class);
BseLadspaInfo *bli = ladspa_module_class->bli;
uint ochannel, ichannel, i;
-
++
g_assert (ladspa_module_class->bli != NULL &&
gobject_class->set_property == NULL &&
gobject_class->get_property == NULL);
+
gobject_class->set_property = ladspa_derived_set_property;
gobject_class->get_property = ladspa_derived_get_property;
-
++
for (i = 0; i < bli->n_cports; i++)
{
BseLadspaPort *port = bli->cports + i;
@@@ -441,9 -478,11 +478,11 @@@ ladspa_derived_context_create (BseSourc
for (i = 0, nis = 0; i < bli->n_aports; i++)
if (bli->aports[i].input)
bli->connect_port (ldata->handle, bli->aports[i].port_index, ldata->ibuffers + nis++ *
bse_engine_block_size ());
-
++
module = bse_module_new (klass->gsl_class, ldata);
bse_source_set_context_module (source, context_handle, module);
bse_trans_add (trans, bse_job_integrate (module));
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (derived_parent_class)->context_create (source, context_handle, trans);
}
diff --cc bse/bseladspamodule.hh
index 2e61579,7a402a8..3b2c54d
--- a/bse/bseladspamodule.hh
+++ b/bse/bseladspamodule.hh
@@@ -11,11 -14,19 +14,13 @@@ G_BEGIN_DECL
#define BSE_IS_LADSPA_MODULE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BSE_TYPE_LADSPA_MODULE))
#define BSE_IS_LADSPA_MODULE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), BSE_TYPE_LADSPA_MODULE))
#define BSE_LADSPA_MODULE_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BSE_TYPE_LADSPA_MODULE,
BseLadspaModuleClass))
+
+
/* --- BseLadspaModule --- */
-typedef struct _BseLadspaModule BseLadspaModule;
-typedef struct _BseLadspaModuleClass BseLadspaModuleClass;
-struct _BseLadspaModule
-{
- BseSource parent_instance;
+struct BseLadspaModule : BseSource {
gfloat *cvalues;
};
-struct _BseLadspaModuleClass
-{
- BseSourceClass parent_class;
+struct BseLadspaModuleClass : BseSourceClass {
BseLadspaInfo *bli;
BseModuleClass *gsl_class;
};
diff --cc bse/bseloader-aiff.cc
index bd62f68,87aa8d6..5a8adc0
--- a/bse/bseloader-aiff.cc
+++ b/bse/bseloader-aiff.cc
@@@ -213,13 -224,14 +222,14 @@@ aiff_read_inst (int fd
afile->instrument.release_loop_mode = GUINT16_FROM_BE (afile->instrument.release_loop_mode);
afile->instrument.release_begin_id = GUINT16_FROM_BE (afile->instrument.release_begin_id);
afile->instrument.release_end_id = GUINT16_FROM_BE (afile->instrument.release_end_id);
- AIFF_DEBUG ("INST: N:%u<=%u%+d<=%u V:%u..%u G:%+ddB S:{%u:%u..%u} R:{%u:%u..%u}",
- afile->instrument.low_note, afile->instrument.base_note, afile->instrument.detune,
afile->instrument.high_note,
- afile->instrument.low_velocity, afile->instrument.high_velocity, afile->instrument.gain_dB,
- afile->instrument.sustain_loop_mode, afile->instrument.sustain_begin_id,
afile->instrument.sustain_end_id,
- afile->instrument.release_loop_mode, afile->instrument.release_begin_id,
afile->instrument.release_end_id);
+ LDEBUG ("INST: N:%u<=%u%+d<=%u V:%u..%u G:%+ddB S:{%u:%u..%u} R:{%u:%u..%u}",
+ afile->instrument.low_note, afile->instrument.base_note, afile->instrument.detune,
afile->instrument.high_note,
+ afile->instrument.low_velocity, afile->instrument.high_velocity, afile->instrument.gain_dB,
+ afile->instrument.sustain_loop_mode, afile->instrument.sustain_begin_id,
afile->instrument.sustain_end_id,
+ afile->instrument.release_loop_mode, afile->instrument.release_begin_id,
afile->instrument.release_end_id);
return BSE_ERROR_NONE;
}
+
static BseErrorType
aiff_read_ssnd (int fd,
AiffFile *afile,
@@@ -241,9 -253,10 +251,10 @@@
return BSE_ERROR_FORMAT_INVALID;
afile->data_start = pos + alignment_offset;
afile->data_size = chunk_size - 8 - alignment_offset;
- AIFF_DEBUG ("SSND: pos:>%u< n_bytes:%u", afile->data_start, afile->data_size);
+ LDEBUG ("SSND: pos:>%u< n_bytes:%u", afile->data_start, afile->data_size);
return BSE_ERROR_NONE;
}
+
static BseErrorType
aiff_append_string (int fd,
AiffFile *afile,
@@@ -386,6 -407,7 +404,7 @@@ aiff_free_file_info (void *d
BseWaveFileInfo *file_info)
{
FileInfo *fi = (FileInfo*) file_info;
-
++
aiff_file_free (fi->afile);
g_free (fi->wfi.waves[0].name);
g_free (fi->wfi.waves);
@@@ -452,13 -478,16 +475,16 @@@ aiff_load_wave_dsc (void *da
dsc->n_values = afile->n_values;
/* in aiff, data is left shifted up to byte boundary */
dsc->format = afile->bit_depth > 8 ? GSL_WAVE_FORMAT_SIGNED_16 : GSL_WAVE_FORMAT_SIGNED_8;
-
++
return &dsc->wdsc;
}
+
static void
aiff_free_wave_dsc (void *data,
BseWaveDsc *wave_dsc)
{
WaveDsc *dsc = (WaveDsc*) wave_dsc;
-
++
uint i;
for (i = 0; i < dsc->wdsc.n_chunks; i++)
g_strfreev (dsc->wdsc.chunks[i].xinfos);
@@@ -474,7 -504,9 +501,9 @@@ aiff_create_chunk_handle (void
WaveDsc *dsc = (WaveDsc*) wave_dsc;
FileInfo *fi = (FileInfo*) dsc->wdsc.file_info;
GslDataHandle *dhandle;
-
++
g_return_val_if_fail (nth_chunk == 0, NULL);
-
++
dhandle = gsl_wave_handle_new (fi->wfi.file_name,
dsc->wdsc.n_channels,
dsc->format, G_BIG_ENDIAN,
@@@ -511,7 -544,9 +541,9 @@@ _gsl_init_loader_aiff (void
aiff_create_chunk_handle,
};
static gboolean initialized = FALSE;
-
++
g_assert (initialized == FALSE);
initialized = TRUE;
-
++
bse_loader_register (&loader);
}
diff --cc bse/bseloader-bsewave.cc
index 4ba3569,99bca5a..b8e3ee9
--- a/bse/bseloader-bsewave.cc
+++ b/bse/bseloader-bsewave.cc
@@@ -102,6 -113,7 +109,7 @@@ bsewave_skip_rest_statement (GScanner *
uint level)
{
g_return_val_if_fail (scanner != NULL, G_TOKEN_ERROR);
-
++
while (level)
{
g_scanner_get_next_token (scanner);
@@@ -113,8 -125,10 +121,10 @@@
default: break;
}
}
-
++
return G_TOKEN_NONE;
}
+
static BseWaveFileInfo*
bsewave_load_file_info (void *data,
const char *_file_name,
@@@ -127,9 -141,11 +137,11 @@@
char *cwd, *file_name;
int fd;
uint i;
-
++
if (g_path_is_absolute (_file_name))
{
const char *p = strrchr (_file_name, G_DIR_SEPARATOR);
-
++
g_assert (p != NULL);
cwd = g_strndup (_file_name, p - _file_name + 1);
file_name = g_strdup (_file_name);
@@@ -139,6 -155,7 +151,7 @@@
cwd = g_get_current_dir ();
file_name = g_strdup_printf ("%s%c%s", cwd, G_DIR_SEPARATOR, _file_name);
}
-
++
fd = open (file_name, O_RDONLY);
if (fd < 0)
{
@@@ -147,6 -164,7 +160,7 @@@
g_free (file_name);
return NULL;
}
-
++
scanner = g_scanner_new64 (sfi_storage_scanner_config);
scanner->config->cpair_comment_single = (char*) "#\n";
g_scanner_scope_add_symbol (scanner, 0, "wave", GUINT_TO_POINTER (BSEWAVE_TOKEN_WAVE));
@@@ -175,6 -193,7 +189,7 @@@
if (g_scanner_peek_next_token (scanner) == G_TOKEN_STRING)
{
char *wave_name;
-
++
g_scanner_get_next_token (scanner); /* eat string */
wave_name = g_strdup (scanner->value.v_string);
if (bsewave_skip_rest_statement (scanner, 1) == G_TOKEN_NONE)
@@@ -198,9 -217,11 +213,11 @@@
}
g_scanner_destroy (scanner);
close (fd);
-
++
if (wave_names)
{
SfiRing *ring;
-
++
fi = sfi_new_struct0 (FileInfo, 1);
fi->wfi.n_waves = sfi_ring_length (wave_names);
fi->wfi.waves = (BseWaveFileInfo::Wave*) g_malloc0 (sizeof (fi->wfi.waves[0]) * fi->wfi.n_waves);
@@@ -212,14 -233,17 +229,17 @@@
else
g_free (cwd);
g_free (file_name);
-
++
return fi ? &fi->wfi : NULL;
}
+
static void
bsewave_free_file_info (void *data,
BseWaveFileInfo *file_info)
{
FileInfo *fi = (FileInfo*) file_info;
uint i;
-
++
for (i = 0; i < fi->wfi.n_waves; i++)
g_free (fi->wfi.waves[i].name);
g_free (fi->wfi.waves);
@@@ -528,12 -556,14 +552,14 @@@ bsewave_load_wave_dsc (void
BseErrorType *error_p)
{
uint token, i;
-
++
int fd = open (file_info->file_name, O_RDONLY);
if (fd < 0)
{
*error_p = gsl_error_from_errno (errno, BSE_ERROR_FILE_OPEN_FAILED);
return NULL;
}
-
++
GScanner *scanner = g_scanner_new64 (sfi_storage_scanner_config);
scanner->config->cpair_comment_single = (char*) "#\n";
scanner->input_name = file_info->file_name;
@@@ -580,15 -611,19 +607,19 @@@
}
g_scanner_destroy (scanner);
close (fd);
-
++
return dsc ? &dsc->wdsc : NULL;
}
+
static void
bsewave_free_wave_dsc (void *data,
BseWaveDsc *wave_dsc)
{
WaveDsc *dsc = (WaveDsc*) wave_dsc;
-
++
bsewave_wave_dsc_free (dsc);
}
+
static GslDataHandle*
bsewave_load_singlechunk_wave (BseWaveFileInfo *fi,
const char *wave_name,
@@@ -598,6 -633,7 +629,7 @@@
{
BseWaveDsc *wdsc;
uint i;
-
++
if (fi->n_waves == 1 && !wave_name)
i = 0;
else if (!wave_name)
@@@ -615,9 -651,11 +647,11 @@@
*error_p = BSE_ERROR_WAVE_NOT_FOUND;
return NULL;
}
-
++
wdsc = bse_wave_dsc_load (fi, i, FALSE, error_p);
if (!wdsc)
return NULL;
-
++
if (wdsc->n_chunks == 1)
{
*n_channelsp = wdsc->n_channels;
@@@ -634,6 -672,7 +668,7 @@@
bse_wave_dsc_free (wdsc);
return dhandle;
}
-
++
/* this is ridiculous, letting the chunk of a wave
* point to a wave with multiple chunks...
*/
@@@ -650,6 -690,7 +686,7 @@@ bsewave_create_chunk_handle (voi
WaveDsc *dsc = (WaveDsc*) wave_dsc;
FileInfo *fi = (FileInfo*) dsc->wdsc.file_info;
BseWaveChunkDsc *chunk = wave_dsc->chunks + nth_chunk;
-
++
GslDataHandle *dhandle = NULL;
switch (LOADER_TYPE (chunk))
{
@@@ -780,7 -822,9 +818,9 @@@ _gsl_init_loader_gslwave (void
bsewave_create_chunk_handle,
};
static gboolean initialized = FALSE;
-
++
g_assert (initialized == FALSE);
initialized = TRUE;
-
++
bse_loader_register (&loader);
}
diff --cc bse/bseloader-guspatch.cc
index 6cfd171,5ff69d9..656a191
--- a/bse/bseloader-guspatch.cc
+++ b/bse/bseloader-guspatch.cc
@@@ -81,32 -88,41 +87,41 @@@ fread_word (FILE *file
word &w)
{
byte h, l;
-
++
read_or_return_error (fread_block (file, 1, &l));
read_or_return_error (fread_block (file, 1, &h));
w = (h << 8) + l;
-
++
return BSE_ERROR_NONE;
}
+
static inline BseErrorType
fread_short_word (FILE *file,
sword &sw)
{
word w;
-
++
read_or_return_error (fread_word (file, w));
sw = (sword) w;
-
++
return BSE_ERROR_NONE;
}
+
/* readXXX with sizeof(xxx) == 4 */
static inline BseErrorType
fread_dword (FILE *file, dword& dw)
{
byte h, l, hh, hl;
-
++
read_or_return_error (fread_block (file, 1, &l));
read_or_return_error (fread_block (file, 1, &h));
read_or_return_error (fread_block (file, 1, &hl));
read_or_return_error (fread_block (file, 1, &hh));
dw = (hh << 24) + (hl << 16) + (h << 8) + l;
-
++
return BSE_ERROR_NONE;
}
+
struct PatHeader
{
char id[12]; /* ID='GF1PATCH110' */
@@@ -121,9 -137,11 +136,11 @@@
word mastervolume; /* Master volume for all samples */
dword size; /* Size of the following data */
char reserved[36]; /* reserved */
-
++
PatHeader()
{
}
-
++
BseErrorType
load (FILE *file)
{
@@@ -131,13 -149,17 +148,17 @@@
read_or_return_error (fread_string (file, manufacturer_id, 10));
read_or_return_error (fread_string (file, description, 60));
/* skip(file, 2);*/
-
++
read_or_return_error (fread_byte (file, instruments));
read_or_return_error (fread_byte (file, voices));
read_or_return_error (fread_byte (file, channels));
-
++
read_or_return_error (fread_word (file, waveforms));
read_or_return_error (fread_word (file, mastervolume));
read_or_return_error (fread_dword (file, size));
-
++
read_or_return_error (fread_string (file, reserved, 36));
-
++
return BSE_ERROR_NONE;
}
};
@@@ -148,14 -171,17 +170,17 @@@ struct PatInstrumen
dword size; /* Size of the whole instrument in bytes. */
byte layers;
char reserved[40];
-
++
/* layer? */
word layerUnknown;
dword layerSize;
byte sampleCount; /* number of samples in this layer (?) */
char layerReserved[40];
-
++
PatInstrument()
{
}
-
++
BseErrorType
load (FILE *file)
{
@@@ -164,11 -190,13 +189,13 @@@
read_or_return_error (fread_dword (file, size));
read_or_return_error (fread_byte (file, layers));
read_or_return_error (fread_string (file, reserved, 40));
-
++
/* layer: (?) */
read_or_return_error (fread_word (file, layerUnknown));
read_or_return_error (fread_dword (file, layerSize));
read_or_return_error (fread_byte (file, sampleCount));
read_or_return_error (fread_string (file, reserved, 40));
-
++
return BSE_ERROR_NONE;
}
};
@@@ -208,9 -238,11 +237,11 @@@ struct PatPatc
sword freqScale;
word freqScaleFactor;
char reserved[36];
-
++
PatPatch()
{
}
-
++
BseErrorType
load (FILE *file)
{
@@@ -237,6 -269,7 +268,7 @@@
read_or_return_error (fread_short_word (file, freqScale));
read_or_return_error (fread_word (file, freqScaleFactor));
read_or_return_error (fread_string (file, reserved, 36));
-
++
return BSE_ERROR_NONE;
}
};
@@@ -250,9 -285,11 +284,11 @@@ struct FileInf
{
BseWaveFileInfo wfi;
BseWaveDsc wdsc;
-
++
PatHeader *header;
PatInstrument *instrument;
vector<PatPatch *> patches;
-
++
GslWaveLoopType
loop_type (int wave_format)
{
@@@ -289,11 -326,13 +325,13 @@@
return GSL_WAVE_LOOP_NONE;
}
}
-
++
guint&
data_offset (int chunk_number)
{
return wdsc.chunks[chunk_number].loader_data[0].uint;
}
-
++
GslWaveFormatType
wave_format (int wave_format)
{
@@@ -304,13 -343,15 +342,15 @@@
case PAT_FORMAT_16BIT: return GSL_WAVE_FORMAT_SIGNED_16;
case PAT_FORMAT_UNSIGNED | PAT_FORMAT_16BIT: return GSL_WAVE_FORMAT_UNSIGNED_16;
}
- BIRNET_ASSERT_NOT_REACHED();
+ RAPICORN_ASSERT_UNREACHED();
}
-
++
int
bytes_per_frame (int wave_format)
{
return ((wave_format & PAT_FORMAT_16BIT) ? 2 : 1);
}
-
++
string
envelope_point_to_string (guint value)
{
@@@ -319,24 -360,30 +359,30 @@@
g_free (tmp_str);
return str;
}
-
++
string
envelope_array_to_string (byte *envelope_array)
{
string envelope_str;
-
++
for (int i = 0; i < 6; i++)
{
if (i)
envelope_str += ",";
envelope_str += envelope_point_to_string (envelope_array[i]);
}
-
++
return envelope_str;
}
-
-
++
++
FileInfo (const gchar *file_name,
BseErrorType *error_p)
{
/* initialize C structures with zeros */
memset (&wfi, 0, sizeof (wfi));
memset (&wdsc, 0, sizeof (wdsc));
-
++
/* open patch file */
FILE *patfile = fopen (file_name, "r");
if (!patfile)
@@@ -344,47 -391,59 +390,59 @@@
*error_p = gsl_error_from_errno (errno, BSE_ERROR_FILE_OPEN_FAILED);
return;
}
-
++
/* parse contents of patfile into Pat* data structurs */
header = new PatHeader();
-
++
*error_p = header->load (patfile);
if (*error_p)
{
fclose (patfile);
return;
}
-
++
if (header->channels == 0) /* fixup channels setting */
header->channels = 1;
-
++
instrument = new PatInstrument();
-
++
*error_p = instrument->load (patfile);
if (*error_p)
{
fclose (patfile);
return;
}
-
++
/* allocate BseWaveDsc */
wdsc.n_chunks = instrument->sampleCount;
wdsc.chunks = (typeof (wdsc.chunks)) g_malloc0 (sizeof (wdsc.chunks[0]) * wdsc.n_chunks);
-
++
for (int i = 0; i<instrument->sampleCount; i++)
{
PatPatch *patch = new PatPatch();
patches.push_back (patch);
-
++
*error_p = patch->load (patfile);
if (*error_p)
return;
-
++
data_offset (i) = (guint) ftell (patfile);
-
++
*error_p = skip (patfile, patch->wavesize);
if (*error_p)
{
fclose (patfile);
return;
}
- DEBUG (" - read patch, srate = %d (%d bytes)", patch->sampleRate, patch->wavesize);
+ LDEBUG (" - read patch, srate = %d (%d bytes)", patch->sampleRate, patch->wavesize);
}
fclose (patfile);
-
++
/* allocate and fill BseWaveFileInfo */
wfi.n_waves = 1;
wfi.waves = (typeof (wfi.waves)) g_malloc0 (sizeof (wfi.waves[0]) * wfi.n_waves);
wfi.waves[0].name = g_strdup (file_name);
-
++
/* fill BseWaveDsc */
wdsc.name = g_strdup (file_name);
/* header->channels means output channels, GUS Patches are mono only */
@@@ -412,6 -475,7 +470,7 @@@
xinfos = bse_xinfos_add_num (xinfos, "loop-count", 1000000);
xinfos = bse_xinfos_add_num (xinfos, "loop-start", patches[i]->loopStart / frame_size);
xinfos = bse_xinfos_add_num (xinfos, "loop-end", patches[i]->loopEnd / frame_size);
-
++
#ifdef WITH_GUSPATCH_XINFOS
xinfos = bse_xinfos_add_value (xinfos, "gus-patch-envelope-rates",
envelope_array_to_string (patches[i]->filterRate).c_str());
@@@ -438,6 -503,7 +498,7 @@@
#endif
}
}
-
++
~FileInfo()
{
/* free patch data loaded from file */
@@@ -446,12 -512,15 +507,15 @@@
delete *pi;
delete instrument;
delete header;
-
++
/* free BseWaveDsc */
for (guint i = 0; i < wdsc.n_chunks; i++)
g_strfreev (wdsc.chunks[i].xinfos);
-
++
g_strfreev (wdsc.xinfos);
g_free (wdsc.name);
g_free (wdsc.chunks);
-
++
/* free BseWaveFileInfo */
if (wfi.waves)
{
@@@ -471,8 -541,10 +536,10 @@@ pat_load_file_info (gpointer data
delete file_info;
return NULL;
}
-
++
return &file_info->wfi;
}
+
static void
pat_free_file_info (gpointer data,
BseWaveFileInfo *wave_file_info)
@@@ -552,7 -632,9 +624,9 @@@ bse_init_loader_gus_patch (void
pat_create_chunk_handle,
};
static gboolean initialized = FALSE;
-
++
g_assert (initialized == FALSE);
initialized = TRUE;
-
++
bse_loader_register (&loader);
}
diff --cc bse/bseloader-oggvorbis.cc
index fb93abb,6939edc..0a49a94
--- a/bse/bseloader-oggvorbis.cc
+++ b/bse/bseloader-oggvorbis.cc
@@@ -22,12 -27,14 +27,14 @@@ oggv_load_file_info (void *data
FileInfo *fi = sfi_new_struct0 (FileInfo, 1);
FILE *file;
int err, i;
-
++
file = fopen (file_name, "r");
if (!file)
{
*error_p = gsl_error_from_errno (errno, BSE_ERROR_FILE_OPEN_FAILED);
return NULL;
}
-
++
fi = sfi_new_struct0 (FileInfo, 1);
err = ov_open (file, &fi->ofile, NULL, 0);
if (err)
diff --cc bse/bseloader-wav.cc
index 4657518,b2cff12..b8c1733
--- a/bse/bseloader-wav.cc
+++ b/bse/bseloader-wav.cc
@@@ -36,19 -45,23 +36,23 @@@ wav_read_header (int fd
WavHeader *header)
{
uint n_bytes;
-
++
memset (header, 0, sizeof (*header));
-
++
/* read header contents */
n_bytes = 4 + 4 + 4;
g_assert (n_bytes == sizeof (*header));
if (read (fd, header, n_bytes) != n_bytes)
{
- WAV_DEBUG ("failed to read WavHeader: %s", g_strerror (errno));
+ LDEBUG ("failed to read WavHeader: %s", g_strerror (errno));
return gsl_error_from_errno (errno, BSE_ERROR_IO);
}
-
++
/* endianess corrections */
header->main_chunk = DWORD_FROM_BE (header->main_chunk);
header->file_length = DWORD_FROM_LE (header->file_length);
header->chunk_type = DWORD_FROM_BE (header->chunk_type);
-
++
/* validation */
if (header->main_chunk != ('R' << 24 | 'I' << 16 | 'F' << 8 | 'F'))
{
@@@ -62,11 -75,13 +66,13 @@@
}
if (header->chunk_type != ('W' << 24 | 'A' << 16 | 'V' << 8 | 'E'))
{
- WAV_DEBUG ("unmatched token 'WAVE'");
+ LDEBUG ("unmatched token 'WAVE'");
return BSE_ERROR_FORMAT_INVALID;
}
-
++
return BSE_ERROR_NONE;
}
+
typedef struct
{
DWord sub_chunk; /* 'fmt ', big endian as int */
@@@ -83,15 -98,18 +89,18 @@@ wav_read_fmt_header (int fd
FmtHeader *header)
{
uint n_bytes;
-
++
memset (header, 0, sizeof (*header));
-
++
/* read header contents */
n_bytes = 4 + 4 + 2 + 2 + 4 + 4 + 2 + 2;
g_assert (n_bytes == sizeof (*header));
if (read (fd, header, n_bytes) != n_bytes)
{
- WAV_DEBUG ("failed to read FmtHeader");
+ LDEBUG ("failed to read FmtHeader");
return gsl_error_from_errno (errno, BSE_ERROR_IO);
}
-
++
/* endianess corrections */
header->sub_chunk = DWORD_FROM_BE (header->sub_chunk);
header->length = DWORD_FROM_LE (header->length);
@@@ -101,6 -119,7 +110,7 @@@
header->byte_per_second = DWORD_FROM_LE (header->byte_per_second);
header->byte_per_sample = WORD_FROM_LE (header->byte_per_sample);
header->bit_per_sample = WORD_FROM_LE (header->bit_per_sample);
-
++
/* validation */
if (header->sub_chunk != ('f' << 24 | 'm' << 16 | 't' << 8 | ' '))
{
@@@ -166,8 -188,10 +176,10 @@@
n -= l;
}
}
-
++
return BSE_ERROR_NONE;
}
+
typedef struct
{
DWord data_chunk; /* 'data', big endian as int */
@@@ -179,31 -203,37 +191,37 @@@ wav_read_data_header (int fd
uint byte_alignment)
{
uint n_bytes;
-
++
memset (header, 0, sizeof (*header));
-
++
/* read header contents */
n_bytes = 4 + 4;
g_assert (n_bytes == sizeof (*header));
if (read (fd, header, n_bytes) != n_bytes)
{
- WAV_DEBUG ("failed to read DataHeader");
+ LDEBUG ("failed to read DataHeader");
return gsl_error_from_errno (errno, BSE_ERROR_IO);
}
-
++
/* endianess corrections */
header->data_chunk = DWORD_FROM_BE (header->data_chunk);
header->data_length = DWORD_FROM_LE (header->data_length);
-
++
/* validation */
if (header->data_chunk != ('d' << 24 | 'a' << 16 | 't' << 8 | 'a'))
{
uint8 chunk[5];
char *esc;
-
++
chunk[0] = header->data_chunk >> 24;
chunk[1] = (header->data_chunk >> 16) & 0xff;
chunk[2] = (header->data_chunk >> 8) & 0xff;
chunk[3] = header->data_chunk & 0xff;
chunk[4] = 0;
esc = g_strescape ((char*) chunk, NULL);
-
++
/* skip chunk and retry */
- WAV_DEBUG ("ignoring sub-chunk '%s'", esc);
+ LDEBUG ("ignoring sub-chunk '%s'", esc);
g_free (esc);
if (lseek (fd, header->data_length, SEEK_CUR) < 0)
{
@@@ -214,12 -244,14 +232,14 @@@
}
if (header->data_length < 1 || header->data_length % byte_alignment != 0)
{
- WAV_DEBUG ("invalid data length (%u) or alignment (%u)",
- header->data_length, header->data_length % byte_alignment);
+ LDEBUG ("invalid data length (%u) or alignment (%u)",
+ header->data_length, header->data_length % byte_alignment);
return BSE_ERROR_FORMAT_INVALID;
}
-
++
return BSE_ERROR_NONE;
}
+
typedef struct
{
BseWaveFileInfo wfi;
@@@ -233,31 -266,37 +254,37 @@@ wav_load_file_info (void *data
WavHeader wav_header;
FileInfo *fi;
int fd;
-
++
fd = open (file_name, O_RDONLY);
if (fd < 0)
{
*error_p = gsl_error_from_errno (errno, BSE_ERROR_FILE_OPEN_FAILED);
return NULL;
}
-
++
*error_p = wav_read_header (fd, &wav_header);
if (*error_p)
{
close (fd);
return NULL;
}
-
++
fi = sfi_new_struct0 (FileInfo, 1);
fi->wfi.n_waves = 1;
fi->wfi.waves = (BseWaveFileInfo::Wave*) g_malloc0 (sizeof (fi->wfi.waves[0]) * fi->wfi.n_waves);
const char *dsep = strrchr (file_name, G_DIR_SEPARATOR);
fi->wfi.waves[0].name = g_strdup (dsep ? dsep + 1 : file_name);
fi->fd = fd;
-
++
return &fi->wfi;
}
+
static void
wav_free_file_info (void *data,
BseWaveFileInfo *file_info)
{
FileInfo *fi = (FileInfo*) file_info;
-
++
g_free (fi->wfi.waves[0].name);
g_free (fi->wfi.waves);
close (fi->fd);
@@@ -341,8 -389,10 +371,10 @@@ wav_load_wave_dsc (void *dat
dsc->data_offset = data_offset;
dsc->n_values = data_header.data_length / data_width;
dsc->format = format;
-
++
return &dsc->wdsc;
}
+
static void
wav_free_wave_dsc (void *data,
BseWaveDsc *wave_dsc)
@@@ -363,7 -414,9 +396,9 @@@ wav_create_chunk_handle (void *
{
WaveDsc *dsc = (WaveDsc*) wave_dsc;
GslDataHandle *dhandle;
-
++
g_return_val_if_fail (nth_chunk == 0, NULL);
-
++
dhandle = gsl_wave_handle_new (dsc->wdsc.file_info->file_name,
dsc->wdsc.n_channels,
dsc->format, G_LITTLE_ENDIAN,
@@@ -419,7 -473,9 +455,9 @@@ _gsl_init_loader_wav (void
wav_create_chunk_handle,
};
static gboolean initialized = FALSE;
-
++
g_assert (initialized == FALSE);
initialized = TRUE;
-
++
bse_loader_register (&loader);
}
diff --cc bse/bseloader.cc
index 06c65ed,80af7a8..08eb43c
--- a/bse/bseloader.cc
+++ b/bse/bseloader.cc
@@@ -33,8 -39,10 +39,10 @@@ bse_loader_register (BseLoader *loader
g_return_if_fail (loader->load_wave_dsc != NULL);
g_return_if_fail (loader->free_wave_dsc != NULL);
g_return_if_fail (loader->create_chunk_handle != NULL);
-
++
loader->next = bse_loader_list;
bse_loader_list = loader;
+
if (loader->magic_specs)
{
GslMagic *magic;
@@@ -119,6 -136,7 +136,7 @@@ bse_wave_file_info_load (const char *
BseWaveFileInfo *finfo = NULL;
BseErrorType error = BSE_ERROR_NONE;
BseLoader *loader;
-
++
if (error_p)
*error_p = BSE_ERROR_INTERNAL;
g_return_val_if_fail (file_name != NULL, NULL);
@@@ -139,10 -158,13 +158,13 @@@
if (finfo->n_waves > 0)
{
uint i;
+
g_return_val_if_fail (finfo->loader == NULL, NULL);
g_return_val_if_fail (finfo->file_name == NULL, NULL);
-
++
for (i = 0; i < finfo->n_waves; i++)
g_return_val_if_fail (finfo->waves[i].name != NULL, NULL);
-
++
finfo->file_name = g_strdup (file_name);
finfo->loader = loader;
finfo->ref_count = 1;
@@@ -227,6 -264,7 +264,7 @@@ bse_wave_dsc_load (BseWaveFileInfo *wav
{
g_return_val_if_fail (wdsc->file_info == NULL, NULL);
g_return_val_if_fail (wdsc->name && strcmp (wdsc->name, wave_file_info->waves[nth_wave].name) == 0,
NULL);
-
++
wdsc->file_info = wave_file_info;
bse_wave_file_info_ref (wave_file_info);
}
@@@ -237,10 -275,13 +275,13 @@@
error = BSE_ERROR_FILE_EMPTY;
}
}
+
if (error_p)
*error_p = error;
-
++
return wdsc;
}
+
void
bse_wave_dsc_free (BseWaveDsc *wave_dsc)
{
diff --cc bse/bseloader.hh
index 0131f08,e2515c4..15790ae
--- a/bse/bseloader.hh
+++ b/bse/bseloader.hh
@@@ -1,11 -1,15 +1,14 @@@
// Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
#ifndef __BSE_LOADER_H__
#define __BSE_LOADER_H__
+
#include <bse/bseutils.hh>
#include <bse/gslwavechunk.hh>
+
G_BEGIN_DECLS
+
/* --- structures --- */
-struct _BseWaveFileInfo
-{
+struct BseWaveFileInfo {
guint n_waves;
struct Wave {
gchar *name;
@@@ -61,8 -71,10 +70,9 @@@ typedef enum /*< skip >*
BSE_LOADER_NO_FLAGS = 0,
BSE_LOADER_SKIP_PRECEEDING_NULLS = 1 << 0
} BseLoaderFlags;
-struct _BseLoader
-{
+struct BseLoader {
const gchar *name; /* format/loader name, e.g. "BseWave" or "WAVE audio, RIFF (little-endian)" */
+
/* at least one of the
* following three must
* be non-NULL
diff --cc bse/bsemain.cc
index d78a954,9eeb0ae..ff71d88
--- a/bse/bsemain.cc
+++ b/bse/bsemain.cc
@@@ -239,31 -279,43 +242,37 @@@ server_registration (SfiProx
sfi_diag ("failed to register \"%s\": %s", what, error);
}
}
+
static void
-bse_init_intern (gint *argc,
- gchar ***argv,
- const char *app_name,
- SfiInitValue values[],
- bool as_test)
+bse_init_intern (int *argc, char **argv, const char *app_name, const Bse::StringVector &args, bool as_test)
{
bse_init_textdomain_only();
+
if (bse_initialization_stage != 0)
g_error ("%s() may only be called once", "bse_init_intern");
bse_initialization_stage++;
if (bse_initialization_stage != 1)
g_error ("%s() may only be called once", "bse_init_intern");
+
/* paranoid assertions */
g_assert (G_BYTE_ORDER == G_LITTLE_ENDIAN || G_BYTE_ORDER == G_BIG_ENDIAN);
-
++
/* initialize submodules */
if (as_test)
- sfi_init_test (argc, argv, values);
+ sfi_init_test (argc, argv);
else
- sfi_init (argc, argv, app_name, values);
+ sfi_init (argc, argv, app_name);
bse_main_args = &default_main_args;
- bse_main_args->birnet = sfi_init_settings();
-
/* early argument handling */
if (argc && argv)
{
if (*argc && !g_get_prgname ())
- g_set_prgname (**argv);
- bse_async_parse_args (argc, argv, bse_main_args, values);
+ g_set_prgname (*argv);
+ bse_async_parse_args (argc, argv, bse_main_args, args);
}
-
++
bse_init_core ();
+
/* initialize core plugins & scripts */
if (bse_main_args->load_core_plugins || bse_main_args->load_core_scripts)
g_object_connect (bse_server_get(), "signal::registration", server_registration, NULL, NULL);
@@@ -522,34 -696,38 +533,35 @@@ bse_async_parse_args (int *argc_p, cha
argv[i] = NULL;
}
*argc_p = e;
-
- if (values)
+ for (auto arg : args)
{
- SfiInitValue *value = values;
- while (value->value_name)
- {
- if (strcmp (value->value_name, "debug-extensions") == 0)
- margs->debug_extensions |= sfi_init_value_bool (value);
- else if (strcmp (value->value_name, "force-fpu") == 0)
- margs->force_fpu |= sfi_init_value_bool (value);
- else if (strcmp (value->value_name, "allow-randomization") == 0)
- margs->allow_randomization |= sfi_init_value_bool (value);
- else if (strcmp (value->value_name, "load-core-plugins") == 0)
- margs->load_core_plugins |= sfi_init_value_bool (value);
- else if (strcmp (value->value_name, "load-core-scripts") == 0)
- margs->load_core_scripts |= sfi_init_value_bool (value);
- else if (strcmp ("wave-chunk-padding", value->value_name) == 0)
- margs->wave_chunk_padding = sfi_init_value_int (value);
- else if (strcmp ("wave-chunk-big-pad", value->value_name) == 0)
- margs->wave_chunk_big_pad = sfi_init_value_int (value);
- else if (strcmp ("dcache-cache-memory", value->value_name) == 0)
- margs->dcache_cache_memory = sfi_init_value_int (value);
- else if (strcmp ("dcache-block-size", value->value_name) == 0)
- margs->dcache_block_size = sfi_init_value_int (value);
- else if (strcmp ("midi-kammer-note", value->value_name) == 0)
- margs->midi_kammer_note = sfi_init_value_int (value);
- else if (strcmp ("kammer-freq", value->value_name) == 0)
- margs->kammer_freq = sfi_init_value_double (value);
- value++;
- }
+ bool b; double d; int64 i;
+ if (parse_bool_option (arg, "stand-alone", &b))
+ margs->stand_alone |= b;
+ else if (parse_bool_option (arg, "allow-randomization", &b))
+ margs->allow_randomization |= b;
+ else if (parse_bool_option (arg, "force-fpu", &b))
+ margs->force_fpu |= b;
+ else if (parse_bool_option (arg, "load-core-plugins", &b))
+ margs->load_core_plugins |= b;
+ else if (parse_bool_option (arg, "load-core-scripts", &b))
+ margs->load_core_scripts |= b;
+ else if (parse_bool_option (arg, "debug-extensions", &b))
+ margs->debug_extensions |= b;
+ else if (parse_int_option (arg, "wave-chunk-padding", &i))
+ margs->wave_chunk_padding = i;
+ else if (parse_int_option (arg, "wave-chunk-big-pad", &i))
+ margs->wave_chunk_big_pad = i;
+ else if (parse_int_option (arg, "dcache-cache-memory", &i))
+ margs->dcache_cache_memory = i;
+ else if (parse_int_option (arg, "dcache-block-size", &i))
+ margs->dcache_block_size = i;
+ else if (parse_int_option (arg, "midi-kammer-note", &i))
+ margs->midi_kammer_note = i;
+ else if (parse_float_option (arg, "kammer-freq", &d))
+ margs->kammer_freq = d;
}
+
/* constrain (user) config */
margs->wave_chunk_padding = MAX (1, margs->wave_chunk_padding);
margs->wave_chunk_big_pad = MAX (2 * margs->wave_chunk_padding, margs->wave_chunk_big_pad);
diff --cc bse/bsemain.hh
index 8d3c720,1ef978f..62104ed
--- a/bse/bsemain.hh
+++ b/bse/bsemain.hh
@@@ -21,32 -39,35 +21,33 @@@ void bse_main_wakeup ()
/* --- global macros --- */
#define BSE_THREADS_ENTER() // bse_main_global_lock ()
#define BSE_THREADS_LEAVE() // bse_main_global_unlock ()
-#define BSE_SEQUENCER_LOCK() sfi_mutex_lock (&bse_main_sequencer_mutex)
-#define BSE_SEQUENCER_UNLOCK() sfi_mutex_unlock (&bse_main_sequencer_mutex)
#define BSE_DBG_EXT (bse_main_args->debug_extensions != FALSE)
#define BSE_CONFIG(field) (bse_main_args->field)
+
/* --- argc/argv overide settings --- */
-typedef struct {
- BirnetInitSettings birnet;
- guint n_processors;
+struct BseMainArgs {
+ uint n_processors;
/* # values to pad around wave chunk blocks per channel */
- guint wave_chunk_padding;
- guint wave_chunk_big_pad;
+ uint wave_chunk_padding;
+ uint wave_chunk_big_pad;
/* data (file) cache block size (aligned to power of 2) */
- guint dcache_block_size;
+ uint dcache_block_size;
/* amount of bytes to spare for memory cache */
- guint dcache_cache_memory;
- guint midi_kammer_note;
+ uint dcache_cache_memory;
+ uint midi_kammer_note;
/* kammer frequency, normally 440Hz, historically 435Hz */
- gfloat kammer_freq;
- const gchar *path_binaries;
- const gchar *bse_rcfile;
- const gchar *override_plugin_globs;
- const gchar *override_script_path;
- const gchar *override_sample_path;
- bool allow_randomization; /* init-value "allow-randomization" - enables
non-deterministic behavior */
- bool force_fpu; /* init-value "force-fpu" */
- bool load_core_plugins; /* init-value "load-core-plugins" */
- bool load_core_scripts; /* init-value "load-core-scripts" */
- bool debug_extensions; /* init-value "debug-extensions" */
+ double kammer_freq;
+ const char *path_binaries;
+ const char *bse_rcfile;
+ const char *override_plugin_globs;
+ const char *override_script_path;
+ const char *override_sample_path;
+ bool stand_alone; ///< Initialization argument "stand-alone" - no rcfiles,
boot scripts, etc.
+ bool allow_randomization; ///< Initialization argument "allow-randomization" - enables
non-deterministic behavior
+ bool force_fpu; ///< Initialization argument "force-fpu" - avoid vectorized
optimizations
+ bool load_core_plugins; ///< Initialization argument "load-core-plugins" -
enable core plugin bootup
+ bool load_core_scripts; ///< Initialization argument "load-core-scripts" -
enable core script bootup
+ bool debug_extensions; ///< Initialization argument "debug-extensions" -
enable debugging extensions
bool load_drivers_early;
bool dump_driver_list;
int latency;
diff --cc bse/bsemath.cc
index 5e83deb,7c5e52d..3cddc23
--- a/bse/bsemath.cc
+++ b/bse/bsemath.cc
@@@ -29,6 -32,7 +30,7 @@@ bse_complex_list (uint n_points
static char* rbuffer[RING_BUFFER_LENGTH] = { NULL, };
char *s, *tbuffer = g_newa (char, (FLOAT_STRING_SIZE * 2 * n_points));
uint i;
-
++
rbi = (rbi + 1) % RING_BUFFER_LENGTH;
if (rbuffer[rbi] != NULL)
g_free (rbuffer[rbi]);
@@@ -54,6 -59,7 +57,7 @@@ bse_complex_str (BseComplex c
static uint rbi = 0;
static char* rbuffer[RING_BUFFER_LENGTH] = { NULL, };
char *s, tbuffer[FLOAT_STRING_SIZE * 2];
-
++
rbi = (rbi + 1) % RING_BUFFER_LENGTH;
if (rbuffer[rbi] != NULL)
g_free (rbuffer[rbi]);
@@@ -77,6 -84,7 +82,7 @@@ bse_poly_str (uint degree
static char* rbuffer[RING_BUFFER_LENGTH] = { NULL, };
char *s, *tbuffer = g_newa (char, degree * FLOAT_STRING_SIZE);
uint i;
-
++
if (!var)
var = "x";
rbi = (rbi + 1) % RING_BUFFER_LENGTH;
@@@ -108,6 -117,7 +115,7 @@@ bse_poly_str1 (uint degree
static char* rbuffer[RING_BUFFER_LENGTH] = { NULL, };
char *s, *tbuffer = g_newa (char, degree * FLOAT_STRING_SIZE);
uint i, need_plus = 0;
-
++
if (!var)
var = "x";
rbi = (rbi + 1) % RING_BUFFER_LENGTH;
@@@ -158,6 -169,7 +167,7 @@@ bse_complex_gnuplot (const char *file_
BseComplex *points)
{
FILE *fout = fopen (file_name, "w");
-
++
fputs (bse_complex_list (n_points, points, ""), fout);
fclose (fout);
}
@@@ -184,15 -198,19 +196,19 @@@ bse_temp_freq (double kammer_freq
int semitone_delta)
{
double factor;
-
++
factor = pow (BSE_2_POW_1_DIV_12, semitone_delta);
-
++
return kammer_freq * factor;
}
+
void
bse_poly_from_re_roots (uint degree,
double *a,
BseComplex *roots)
{
uint i;
-
++
/* initialize polynomial */
a[1] = 1;
a[0] = -roots[0].re;
@@@ -200,6 -218,7 +216,7 @@@
for (i = 1; i < degree; i++)
{
uint j;
-
++
a[i + 1] = a[i];
for (j = i; j >= 1; j--)
a[j] = a[j - 1] - a[j] * roots[i].re;
@@@ -212,6 -232,7 +230,7 @@@ bse_cpoly_from_roots (uint degr
BseComplex *roots)
{
uint i;
-
++
/* initialize polynomial */
c[1].re = 1;
c[1].im = 0;
@@@ -222,6 -243,7 +241,7 @@@
{
BseComplex r = bse_complex (-roots[i].re, -roots[i].im);
uint j;
-
++
c[i + 1] = c[i];
for (j = i; j >= 1; j--)
c[j] = bse_complex_add (c[j - 1], bse_complex_mul (c[j], r));
@@@ -236,16 -259,21 +257,21 @@@ bse_poly2_droots (double roots[2]
{
double square = b * b - 4.0 * a * c;
double tmp;
-
++
if (square < 0)
return FALSE;
-
++
if (b > 0)
tmp = -b - sqrt (square);
else
tmp = -b + sqrt (square);
-
++
roots[0] = tmp / (a + a);
roots[1] = (c + c) / tmp;
-
++
return TRUE;
}
+
double
bse_bit_depth_epsilon (uint n_bits)
{
diff --cc bse/bsemath.hh
index 232511b,401094b..f37d4b3
--- a/bse/bsemath.hh
+++ b/bse/bsemath.hh
@@@ -212,6 -222,7 +222,7 @@@ bse_complex_mul3 (BseComplex c1
double bce = c1.im * c2.re * c3.re;
double acf = c1.re * c2.re * c3.im;
double bdf = c1.im * c2.im * c3.im;
-
++
return bse_complex (aec - bde - adf - bcf, ade + bce + acf - bdf);
}
static inline BseComplex
@@@ -352,6 -363,7 +363,7 @@@ bse_poly_add (uint degree
double *b)
{
uint i;
-
++
for (i = 0; i <= degree; i++)
a[i] += b[i];
}
@@@ -361,6 -373,7 +373,7 @@@ bse_poly_sub (uint degree
double *b)
{
uint i;
-
++
for (i = 0; i <= degree; i++)
a[i] -= b[i];
}
@@@ -372,10 -385,12 +385,12 @@@ bse_poly_mul (double *p, /* out
const double *b) /* in:[0..border] */
{
uint i;
-
++
for (i = aorder + border; i > 0; i--)
{
uint j;
double t = 0;
-
++
for (j = i - MIN (border, i); j <= MIN (aorder, i); j++)
t += a[j] * b[i - j];
p[i] = t;
@@@ -388,6 -403,7 +403,7 @@@ bse_cpoly_mul_monomial (uint de
BseComplex root)
{
uint j;
-
++
c[degree] = c[degree - 1];
for (j = degree - 1; j >= 1; j--)
c[j] = bse_complex_sub (c[j - 1], bse_complex_mul (c[j], root));
@@@ -399,6 -415,7 +415,7 @@@ bse_cpoly_mul_reciprocal (uint
BseComplex root)
{
uint j;
-
++
c[degree] = bse_complex_mul (c[degree - 1], bse_complex_inv (root));
for (j = degree - 1; j >= 1; j--)
c[j] = bse_complex_sub (c[j], bse_complex_mul (c[j - 1], root));
@@@ -412,10 -429,12 +429,12 @@@ bse_cpoly_mul (BseComplex *p, /* [0..
BseComplex *b)
{
uint i;
-
++
for (i = aorder + border; i > 0; i--)
{
BseComplex t;
uint j;
-
++
t = bse_complex (0, 0);
for (j = i - MIN (i, border); j <= MIN (aorder, i); j++)
t = bse_complex_add (t, bse_complex_mul (a[j], b[i - j]));
@@@ -429,6 -448,7 +448,7 @@@ bse_poly_scale (uint degree
double scale)
{
uint i;
-
++
for (i = 0; i <= degree; i++)
a[i] *= scale;
}
@@@ -439,6 -459,7 +459,7 @@@ bse_poly_xscale (uint degree
{
double scale = xscale;
uint i;
-
++
for (i = 1; i <= degree; i++)
{
a[i] *= scale;
@@@ -451,6 -472,7 +472,7 @@@ bse_poly_eval (uint degree
double x)
{
double sum = a[degree];
-
++
while (degree--)
sum = sum * x + a[degree];
return sum;
diff --cc bse/bsemathsignal.cc
index 87701b2,3174f4f..2827186
--- a/bse/bsemathsignal.cc
+++ b/bse/bsemathsignal.cc
@@@ -13,6 -16,7 +16,7 @@@ bse_frequency_modulator (const BseFrequ
fine_tune = bse_cent_tune_fast (fm->fine_tune);
with_fine_tune = fm->fine_tune != 0;
fm_strength = fm->fm_strength;
-
++
bound = fm_buffer + n_values;
if (ifreq && ifmod)
{
@@@ -97,10 -111,12 +111,12 @@@ bse_window_hamming (double x) /* sharp
{
if (fabs (x) > 1)
return 0;
+
return 0.54 + 0.46 * cos (PI * x);
}
+
double
-bse_window_sinc (double x) /* noramlied C. Lanczos window */
+bse_window_sinc (double x) /* normalized C. Lanczos window */
{
if (fabs (x) > 1)
return 0;
diff --cc bse/bsemidicontroller.cc
index e8bab01,8eed767..b974e3d
--- a/bse/bsemidicontroller.cc
+++ b/bse/bsemidicontroller.cc
@@@ -40,11 -50,13 +50,13 @@@ BSE_BUILTIN_TYPE (BseMidiController
{
static const GTypeInfo midi_controller_info = {
sizeof (BseMidiControllerClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_midi_controller_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseMidiController),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_midi_controller_init,
@@@ -66,11 -79,15 +79,15 @@@ bse_midi_controller_class_init (BseMidi
BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
uint ochannel_id;
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = bse_midi_controller_set_property;
gobject_class->get_property = bse_midi_controller_get_property;
-
++
source_class->context_create = bse_midi_controller_context_create;
source_class->context_connect = bse_midi_controller_context_connect;
-
++
bse_object_class_add_param (object_class, "MIDI Controls",
PROP_MIDI_CHANNEL,
sfi_pspec_int ("midi_channel", "MIDI Channel",
@@@ -101,6 -118,7 +118,7 @@@
BSE_TYPE_MIDI_SIGNAL_TYPE,
BSE_MIDI_SIGNAL_PRESSURE,
SFI_PARAM_STANDARD));
-
++
ochannel_id = bse_source_class_add_ochannel (source_class, "ctrl-out1", _("Ctrl Out1"), _("MIDI Signal
1"));
g_assert (ochannel_id == BSE_MIDI_CONTROLLER_OCHANNEL_CONTROL1);
ochannel_id = bse_source_class_add_ochannel (source_class, "ctrl-out2", _("Ctrl Out2"), _("MIDI Signal
2"));
@@@ -126,6 -146,7 +146,7 @@@ bse_midi_controller_set_property (GObje
GParamSpec *pspec)
{
BseMidiController *self = BSE_MIDI_CONTROLLER (object);
-
++
switch (param_id)
{
case PROP_MIDI_CHANNEL:
@@@ -160,6 -182,7 +182,7 @@@ bse_midi_controller_get_property (GObje
GParamSpec *pspec)
{
BseMidiController *self = BSE_MIDI_CONTROLLER (object);
-
++
switch (param_id)
{
case PROP_MIDI_CHANNEL:
@@@ -193,6 -218,7 +218,7 @@@ module_data_free (void *data
{
ModuleData *mdata = (ModuleData*) data;
BseTrans *trans = bse_trans_open ();
-
++
bse_midi_receiver_discard_control_module (mdata->midi_receiver, mdata->control_module, trans);
bse_trans_commit (trans);
g_free (mdata);
@@@ -207,6 -234,7 +234,7 @@@ bse_midi_controller_context_create (Bse
BseModule *module = bse_module_new_virtual (BSE_MIDI_CONTROLLER_N_OCHANNELS, mdata, module_data_free);
BseItem *parent = BSE_ITEM (self)->parent;
BseMidiContext mcontext = bse_snet_get_midi_context (BSE_SNET (parent), context_handle);
-
++
/* setup module data */
mdata->midi_receiver = mcontext.midi_receiver;
mdata->default_channel = mcontext.midi_channel;
@@@ -215,10 -243,13 +243,13 @@@
mdata->midi_channel,
self->controls,
trans);
-
++
/* setup module i/o streams with BseSource i/o channels */
bse_source_set_context_omodule (source, context_handle, module);
-
++
/* commit module to engine */
bse_trans_add (trans, bse_job_integrate (module));
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_create (source, context_handle, trans);
}
@@@ -229,11 -261,13 +261,13 @@@ bse_midi_controller_context_connect (Bs
{
BseModule *module = bse_source_get_context_omodule (source, context_handle);
ModuleData *mdata = (ModuleData*) module->user_data;
-
++
/* connect module to midi control uplink */
bse_trans_add (trans, bse_job_connect (mdata->control_module, 0, module, 0));
bse_trans_add (trans, bse_job_connect (mdata->control_module, 1, module, 1));
bse_trans_add (trans, bse_job_connect (mdata->control_module, 2, module, 2));
bse_trans_add (trans, bse_job_connect (mdata->control_module, 3, module, 3));
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_connect (source, context_handle, trans);
}
@@@ -245,22 -280,28 +280,28 @@@ bse_midi_controller_update_modules (Bse
BseSource *source = BSE_SOURCE (self);
BseTrans *trans = bse_trans_open ();
uint *cids, n, i;
-
++
/* forall contexts */
cids = bse_source_context_ids (source, &n);
-
++
/* reconnect modules */
for (i = 0; i < n; i++)
{
BseModule *module = bse_source_get_context_omodule (source, cids[i]);
ModuleData *mdata = (ModuleData*) module->user_data;
-
++
/* disconnect from old module */
bse_trans_add (trans, bse_job_disconnect (module, 0));
bse_trans_add (trans, bse_job_disconnect (module, 1));
bse_trans_add (trans, bse_job_disconnect (module, 2));
bse_trans_add (trans, bse_job_disconnect (module, 3));
-
++
/* discard old module */
bse_midi_receiver_discard_control_module (mdata->midi_receiver, mdata->control_module, trans);
-
++
/* update midi channel */
mdata->midi_channel = self->midi_channel > 0 ? self->midi_channel : mdata->default_channel;
-
++
/* fetch new module */
mdata->control_module = bse_midi_receiver_retrieve_control_module (mdata->midi_receiver,
mdata->midi_channel,
@@@ -272,6 -313,7 +313,7 @@@
bse_trans_add (trans, bse_job_connect (mdata->control_module, 2, module, 2));
bse_trans_add (trans, bse_job_connect (mdata->control_module, 3, module, 3));
}
-
++
/* commit and cleanup */
g_free (cids);
bse_trans_commit (trans);
diff --cc bse/bsemididecoder.cc
index e781dc6,d514069..db99be7
--- a/bse/bsemididecoder.cc
+++ b/bse/bsemididecoder.cc
@@@ -16,6 -18,7 +16,7 @@@ bse_midi_decoder_new (gboolea
BseMusicalTuningType musical_tuning)
{
BseMidiDecoder *self;
-
++
self = g_new0 (BseMidiDecoder, 1);
self->musical_tuning = musical_tuning;
self->auto_queue = auto_queue != FALSE;
@@@ -29,12 -32,15 +30,15 @@@
self->left_bytes = 0;
self->n_bytes = 0;
self->bytes = NULL;
-
++
return self;
}
+
void
bse_midi_decoder_destroy (BseMidiDecoder *self)
{
g_return_if_fail (self != NULL);
-
++
while (self->events)
{
BseMidiEvent *event = (BseMidiEvent*) sfi_ring_pop_head (&self->events);
@@@ -47,8 -54,10 +52,10 @@@ BseMidiEvent
bse_midi_decoder_pop_event (BseMidiDecoder *self)
{
g_return_val_if_fail (self != NULL, NULL);
-
++
return (BseMidiEvent*) sfi_ring_pop_head (&self->events);
}
+
SfiRing*
bse_midi_decoder_pop_event_list (BseMidiDecoder *self)
{
@@@ -280,9 -295,11 +293,11 @@@ bse_midi_decoder_push_data (BseMidiDeco
uint64 usec_systime)
{
Data data;
-
++
g_return_if_fail (self != NULL);
if (n_bytes)
g_return_if_fail (bytes != NULL);
-
++
data.delta_time = bse_engine_tick_stamp_from_systime (usec_systime);
data.bytes = bytes;
data.bound = bytes + n_bytes;
@@@ -291,6 -308,7 +306,7 @@@
self->state_changed = FALSE;
midi_decoder_parse_data (self, &data);
}
-
++
if (self->auto_queue)
{
while (self->events)
@@@ -494,6 -515,7 +513,7 @@@ bse_midi_decoder_construct_event (BseMi
BseMidiEvent *event = bse_midi_alloc_event ();
g_return_if_fail (self->event_type >= 0x080);
g_return_if_fail (self->left_bytes == 0);
-
++
/* try to collapse multi packet sys-ex to normal sys-ex */
if (self->event_type == BSE_MIDI_MULTI_SYS_EX_START &&
self->n_bytes > 0 &&
diff --cc bse/bsemididevice-null.cc
index 6028188,f12bdf7..bbe739e
--- a/bse/bsemididevice-null.cc
+++ b/bse/bsemididevice-null.cc
@@@ -66,17 -79,21 +68,21 @@@ bse_midi_device_null_class_init (BseMid
BSE_BUILTIN_TYPE (BseMidiDeviceNULL)
{
GType type;
-
++
static const GTypeInfo type_info = {
sizeof (BseMidiDeviceNULLClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_midi_device_null_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseMidiDeviceNULL),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_midi_device_null_init,
};
-
++
type = bse_type_register_static (BSE_TYPE_MIDI_DEVICE,
"BseMidiDeviceNULL",
"MIDI device implementation that does nothing",
diff --cc bse/bsemididevice-oss.cc
index e6efc27,4ec2252..6247166
--- a/bse/bsemididevice-oss.cc
+++ b/bse/bsemididevice-oss.cc
@@@ -122,8 -131,10 +124,10 @@@ bse_midi_device_oss_open (BseDevic
}
OSSHandle *oss = g_new0 (OSSHandle, 1);
BseMidiHandle *handle = &oss->handle;
-
++
/* setup request */
oss->fd = -1;
+
/* try open */
BseErrorType error;
int fd = -1;
@@@ -148,6 -159,7 +152,7 @@@
}
else
error = bse_error_from_errno (errno, BSE_ERROR_FILE_OPEN_FAILED);
-
++
/* setup MIDI handle or shutdown */
if (!error)
{
@@@ -199,12 -219,15 +204,15 @@@ oss_midi_io_handler (void *dat
uint8 buffer[buf_size];
uint64 systime;
gssize l;
-
++
/* this should spawn its own thread someday */
g_assert (handle->running_thread == FALSE);
-
++
systime = sfi_time_system ();
do
l = read (oss->fd, buffer, buf_size);
while (l < 0 && errno == EINTR); /* don't mind signals */
-
++
if (l > 0)
bse_midi_decoder_push_data (handle->midi_decoder, l, buffer, systime);
return TRUE; /* keep alive */
@@@ -231,17 -259,21 +244,21 @@@ bse_midi_device_oss_class_init (BseMidi
BSE_BUILTIN_TYPE (BseMidiDeviceOSS)
{
GType midi_device_oss_type;
-
++
static const GTypeInfo midi_device_oss_info = {
sizeof (BseMidiDeviceOSSClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_midi_device_oss_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseMidiDeviceOSS),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_midi_device_oss_init,
};
-
++
midi_device_oss_type = bse_type_register_static (BSE_TYPE_MIDI_DEVICE,
"BseMidiDeviceOSS",
"MIDI device implementation for OSS Lite /dev/midi*",
diff --cc bse/bsemididevice.cc
index 1f64470,43b6ad8..a6d675e
--- a/bse/bsemididevice.cc
+++ b/bse/bsemididevice.cc
@@@ -15,6 -22,7 +22,7 @@@ static voi
bse_midi_device_dispose (GObject *object)
{
BseMidiDevice *self = BSE_MIDI_DEVICE (object);
-
++
if (BSE_DEVICE_OPEN (self))
{
g_warning ("%s: midi device still opened", G_STRLOC);
@@@ -22,6 -30,7 +30,7 @@@
}
if (self->handle)
g_warning (G_STRLOC ": midi device with stale midi handle");
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@@ -29,8 -39,10 +39,10 @@@ static voi
bse_midi_device_finalize (GObject *object)
{
BseMidiDevice *self = BSE_MIDI_DEVICE (object);
-
++
bse_midi_decoder_destroy (self->midi_decoder);
self->midi_decoder = NULL;
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@@ -38,7 -51,9 +51,9 @@@ static voi
bse_midi_device_class_init (BseMidiDeviceClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->dispose = bse_midi_device_dispose;
gobject_class->finalize = bse_midi_device_finalize;
}
@@@ -46,15 -62,18 +62,18 @@@ BSE_BUILTIN_TYPE (BseMidiDevice
{
static const GTypeInfo midi_device_info = {
sizeof (BseMidiDeviceClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_midi_device_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseMidiDevice),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_midi_device_init,
};
-
++
return bse_type_register_abstract (BSE_TYPE_DEVICE,
"BseMidiDevice",
"MIDI device base type",
diff --cc bse/bsemidievent.cc
index 9418cc4,cb016e7..35b9d0c
--- a/bse/bsemidievent.cc
+++ b/bse/bsemidievent.cc
@@@ -48,8 -55,10 +55,10 @@@ const char
bse_midi_signal_name (BseMidiSignalType signal)
{
GEnumValue *ev;
-
++
if (!bse_midi_signal_class)
bse_midi_signal_class = (GEnumClass*) g_type_class_ref (BSE_TYPE_MIDI_SIGNAL_TYPE);
-
++
ev = g_enum_get_value (bse_midi_signal_class, signal);
return ev ? ev->value_name : NULL;
}
@@@ -57,8 -67,10 +67,10 @@@ const char
bse_midi_signal_nick (BseMidiSignalType signal)
{
GEnumValue *ev;
-
++
if (!bse_midi_signal_class)
bse_midi_signal_class = (GEnumClass*) g_type_class_ref (BSE_TYPE_MIDI_SIGNAL_TYPE);
-
++
ev = g_enum_get_value (bse_midi_signal_class, signal);
return ev ? ev->value_nick : NULL;
}
@@@ -74,6 -88,7 +88,7 @@@ bse_midi_free_event (BseMidiEvent *even
{
g_return_if_fail (event != NULL);
g_return_if_fail (event->status != 0);
-
++
switch (event->status)
{
case BSE_MIDI_MULTI_SYS_EX_START:
@@@ -126,33 -146,41 +146,41 @@@ bse_midi_event_note_on (uint midi_cha
float velocity)
{
BseMidiEvent *event;
-
++
g_return_val_if_fail (frequency > 0 && frequency < BSE_MAX_FREQUENCY, NULL);
g_return_val_if_fail (velocity >= 0 && velocity <= 1, NULL);
g_return_val_if_fail (midi_channel > 0, NULL);
-
++
event = bse_midi_alloc_event ();
event->status = BSE_MIDI_NOTE_ON;
event->channel = midi_channel;
event->delta_time = delta_time;
event->data.note.frequency = frequency;
event->data.note.velocity = velocity;
-
++
return event;
}
+
BseMidiEvent*
bse_midi_event_note_off (uint midi_channel,
uint64 delta_time,
float frequency)
{
BseMidiEvent *event;
-
++
g_return_val_if_fail (frequency > 0 && frequency < BSE_MAX_FREQUENCY, NULL);
g_return_val_if_fail (midi_channel > 0, NULL);
-
++
event = bse_midi_alloc_event ();
event->status = BSE_MIDI_NOTE_OFF;
event->channel = midi_channel;
event->delta_time = delta_time;
event->data.note.frequency = frequency;
event->data.note.velocity = 0.0;
-
++
return event;
}
+
BseMidiEvent*
bse_midi_event_signal (uint midi_channel,
uint64 delta_time,
diff --cc bse/bsemidiinput.cc
index 29af387,13d6d4a..e0b3cea
--- a/bse/bsemidiinput.cc
+++ b/bse/bsemidiinput.cc
@@@ -35,11 -45,13 +45,13 @@@ BSE_BUILTIN_TYPE (BseMidiInput
{
static const GTypeInfo midi_input_info = {
sizeof (BseMidiInputClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_midi_input_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseMidiInput),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_midi_input_init,
@@@ -61,17 -74,22 +74,22 @@@ bse_midi_input_class_init (BseMidiInput
BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
uint ochannel_id;
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = bse_midi_input_set_property;
gobject_class->get_property = bse_midi_input_get_property;
-
++
source_class->context_create = bse_midi_input_context_create;
source_class->context_connect = bse_midi_input_context_connect;
-
++
bse_object_class_add_param (object_class, "MIDI",
PROP_MIDI_CHANNEL,
sfi_pspec_int ("midi_channel", "MIDI Channel",
"Input MIDI channel, 0 uses network's default channel",
0, 0, BSE_MIDI_MAX_CHANNELS, 1,
SFI_PARAM_GUI SFI_PARAM_STORAGE ":scale:skip-default"));
-
++
ochannel_id = bse_source_class_add_ochannel (source_class, "frequency", _("Frequency"), _("Note
Frequency"));
g_assert (ochannel_id == BSE_MIDI_INPUT_OCHANNEL_FREQUENCY);
ochannel_id = bse_source_class_add_ochannel (source_class, "gate", _("Gate"), _("High if the note is
currently being pressed"));
@@@ -93,6 -113,7 +113,7 @@@ bse_midi_input_set_property (GObjec
GParamSpec *pspec)
{
BseMidiInput *self = BSE_MIDI_INPUT (object);
-
++
switch (param_id)
{
case PROP_MIDI_CHANNEL:
@@@ -111,6 -133,7 +133,7 @@@ bse_midi_input_get_property (GObjec
GParamSpec *pspec)
{
BseMidiInput *self = BSE_MIDI_INPUT (object);
-
++
switch (param_id)
{
case PROP_MIDI_CHANNEL:
@@@ -132,6 -157,7 +157,7 @@@ module_data_free (void *data
{
ModuleData *mdata = (ModuleData*) data;
BseTrans *trans = bse_trans_open ();
-
++
bse_midi_receiver_discard_mono_voice (mdata->midi_receiver, mdata->midi_channel, mdata->mvoice_module,
trans);
bse_trans_commit (trans);
g_free (mdata);
@@@ -146,6 -173,7 +173,7 @@@ bse_midi_input_context_create (BseSourc
BseModule *module = bse_module_new_virtual (BSE_MIDI_INPUT_N_OCHANNELS, mdata, module_data_free);
BseItem *parent = BSE_ITEM (self)->parent;
BseMidiContext mcontext = bse_snet_get_midi_context (BSE_SNET (parent), context_handle);
-
++
/* setup module data */
mdata->midi_receiver = mcontext.midi_receiver;
mdata->default_channel = mcontext.midi_channel;
@@@ -153,10 -181,13 +181,13 @@@
mdata->mvoice_module = bse_midi_receiver_retrieve_mono_voice (mdata->midi_receiver,
mdata->midi_channel,
trans);
-
++
/* setup module i/o streams with BseSource i/o channels */
bse_source_set_context_omodule (source, context_handle, module);
-
++
/* commit module to engine */
bse_trans_add (trans, bse_job_integrate (module));
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_create (source, context_handle, trans);
}
@@@ -167,11 -199,13 +199,13 @@@ bse_midi_input_context_connect (BseSour
{
BseModule *module = bse_source_get_context_omodule (source, context_handle);
ModuleData *mdata = (ModuleData*) module->user_data;
-
++
/* connect module to mono control uplink */
bse_trans_add (trans, bse_job_connect (mdata->mvoice_module, 0, module, 0));
bse_trans_add (trans, bse_job_connect (mdata->mvoice_module, 1, module, 1));
bse_trans_add (trans, bse_job_connect (mdata->mvoice_module, 2, module, 2));
bse_trans_add (trans, bse_job_connect (mdata->mvoice_module, 3, module, 3));
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_connect (source, context_handle, trans);
}
@@@ -183,22 -218,28 +218,28 @@@ bse_midi_input_update_modules (BseMidiI
BseSource *source = BSE_SOURCE (self);
BseTrans *trans = bse_trans_open ();
uint *cids, n, i;
-
++
/* forall contexts */
cids = bse_source_context_ids (source, &n);
-
++
/* reconnect modules */
for (i = 0; i < n; i++)
{
BseModule *module = bse_source_get_context_omodule (source, cids[i]);
ModuleData *mdata = (ModuleData*) module->user_data;
-
++
/* disconnect from old module */
bse_trans_add (trans, bse_job_disconnect (module, 0));
bse_trans_add (trans, bse_job_disconnect (module, 1));
bse_trans_add (trans, bse_job_disconnect (module, 2));
bse_trans_add (trans, bse_job_disconnect (module, 3));
-
++
/* discard old module */
bse_midi_receiver_discard_mono_voice (mdata->midi_receiver, mdata->midi_channel,
mdata->mvoice_module, trans);
-
++
/* update midi channel */
mdata->midi_channel = self->midi_channel > 0 ? self->midi_channel : mdata->default_channel;
-
++
/* fetch new module */
mdata->mvoice_module = bse_midi_receiver_retrieve_mono_voice (mdata->midi_receiver,
mdata->midi_channel,
@@@ -209,6 -250,7 +250,7 @@@
bse_trans_add (trans, bse_job_connect (mdata->mvoice_module, 2, module, 2));
bse_trans_add (trans, bse_job_connect (mdata->mvoice_module, 3, module, 3));
}
-
++
/* commit and cleanup */
g_free (cids);
bse_trans_commit (trans);
diff --cc bse/bsemidinotifier.cc
index 1133613,31edb9d..968bc81
--- a/bse/bsemidinotifier.cc
+++ b/bse/bsemidinotifier.cc
@@@ -17,15 -21,18 +21,18 @@@ BSE_BUILTIN_TYPE (BseMidiNotifier
{
static const GTypeInfo midi_notifier_info = {
sizeof (BseMidiNotifierClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_midi_notifier_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseMidiNotifier),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_midi_notifier_init,
};
-
++
return bse_type_register_static (BSE_TYPE_ITEM,
"BseMidiNotifier",
"MIDI Event Notifier",
@@@ -38,14 -46,19 +46,19 @@@ bse_midi_notifier_class_init (BseMidiNo
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
guint i;
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->finalize = bse_midi_notifier_finalize;
-
++
for (i = 0; i < BSE_MIDI_MAX_CHANNELS; i++)
{
gchar buffer[32];
-
++
g_snprintf (buffer, 32, "%u", i);
number_quarks[i] = g_quark_from_string (buffer);
}
-
++
signal_midi_event = bse_object_class_add_dsignal (object_class, "midi-event",
G_TYPE_NONE, 1,
BSE_TYPE_MIDI_CHANNEL_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
@@@ -60,6 -75,7 +75,7 @@@ bse_midi_notifier_finalize (GObject *ob
{
BseMidiNotifier *self = BSE_MIDI_NOTIFIER (object);
midi_notifier_list = sfi_ring_remove (midi_notifier_list, self);
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->finalize (object);
}
diff --cc bse/bsemidinotifier.proc
index 4b8667e,1ade4cc..64a7670
--- a/bse/bsemidinotifier.proc
+++ b/bse/bsemidinotifier.proc
@@@ -20,13 -23,17 +23,17 @@@ BODY (BseProcedureClass *proc
BseMidiNotifier *self = (BseMidiNotifier*) bse_value_get_object (in_values++);
struct timeval tv;
guint64 stamp;
-
++
/* check parameters */
if (!BSE_IS_MIDI_NOTIFIER (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
gettimeofday (&tv, NULL);
stamp = tv.tv_sec;
stamp = stamp * 1000000 + tv.tv_usec;
-
++
/* set output parameters */
sfi_value_set_int (out_values++, stamp / 1000);
-
++
return BSE_ERROR_NONE;
}
diff --cc bse/bsemidireceiver.cc
index 170df7e,7c62103..b72aa52
--- a/bse/bsemidireceiver.cc
+++ b/bse/bsemidireceiver.cc
@@@ -430,6 -447,7 +442,7 @@@ midi_control_module_process_U (BseModul
{
MidiCModuleData *cdata = (MidiCModuleData *) module->user_data;
guint i;
-
++
for (i = 0; i < BSE_MODULE_N_OSTREAMS (module); i++)
if (module->ostreams[i].connected)
module->ostreams[i].values = bse_engine_const_values (cdata->values[i]);
@@@ -452,7 -471,9 +466,9 @@@ create_midi_control_module_L (MidiRecei
MidiCModuleData *cdata;
BseModule *module;
guint i;
-
++
g_return_val_if_fail (signals != NULL, NULL);
-
++
cdata = g_new0 (MidiCModuleData, 1);
cdata->midi_channel = midi_channel;
for (i = 0; i < BSE_MIDI_CONTROL_MODULE_N_CHANNELS; i++)
@@@ -462,8 -483,10 +478,10 @@@
}
cdata->ref_count = 1;
module = bse_module_new (&midi_cmodule_class, cdata);
-
++
return module;
}
+
typedef struct {
BseMidiSignalType signal;
gfloat value;
@@@ -475,6 -499,7 +494,7 @@@ midi_control_module_access_U (BseModul
MidiCModuleData *cdata = (MidiCModuleData *) module->user_data;
MidiCModuleAccessData *adata = (MidiCModuleAccessData *) data;
guint i;
-
++
for (i = 0; i < BSE_MIDI_CONTROL_MODULE_N_CHANNELS; i++)
if (cdata->signals[i] == adata->signal)
cdata->values[i] = adata->value;
@@@ -488,6 -514,7 +509,7 @@@ change_midi_control_modules_L (GSLis
{
MidiCModuleAccessData *adata;
GSList *slist = modules;
-
++
if (!modules)
return;
adata = g_new0 (MidiCModuleAccessData, 1);
@@@ -508,11 -536,15 +531,15 @@@ match_midi_control_module_L (BseModul
MidiCModuleData *cdata = (MidiCModuleData *) cmodule->user_data;
gboolean match = TRUE;
guint i;
-
++
for (i = 0; i < BSE_MIDI_CONTROL_MODULE_N_CHANNELS; i++)
match &= cdata->signals[i] == signals[i];
match &= cdata->midi_channel == midi_channel;
-
++
return match;
}
+
+
/* --- VoiceInput module --- */
typedef enum {
VOICE_ON = 1,
@@@ -574,6 -609,7 +604,7 @@@ voice_input_module_process_U (BseModul
guint n_values)
{
VoiceInput *vinput = (VoiceInput*) module->user_data;
-
++
if (BSE_MODULE_OSTREAM (module, 0).connected)
BSE_MODULE_OSTREAM (module, 0).values = bse_engine_const_values (vinput->freq_value);
if (BSE_MODULE_OSTREAM (module, 1).connected)
@@@ -769,6 -816,7 +807,7 @@@ create_voice_input_L (VoiceInputTable *
BSE_COST_CHEAP
};
VoiceInput *vinput = new VoiceInput;
-
++
vinput->fmodule = bse_module_new (&mono_synth_module_class, vinput);
vinput->freq_value = 0;
vinput->gate = 0;
@@@ -782,13 -830,16 +821,16 @@@
vinput->next = NULL;
vinput->iter = table->end();
bse_trans_add (trans, bse_job_integrate (vinput->fmodule));
-
++
return vinput;
}
+
static void
destroy_voice_input_L (VoiceInput *vinput,
BseTrans *trans)
{
g_return_if_fail (vinput->ref_count == 0);
-
++
if (vinput->table && vinput->iter != vinput->table->end())
voice_input_remove_from_table_L (vinput);
bse_trans_add (trans, bse_job_boundary_discard (vinput->fmodule));
@@@ -819,10 -874,12 +865,12 @@@ voice_switch_module_process_U (BseModul
{
VoiceSwitch *vswitch = (VoiceSwitch*) module->user_data;
guint i;
-
++
/* dumb pass-through task */
for (i = 0; i < BSE_MODULE_N_OSTREAMS (module); i++)
if (BSE_MODULE_OSTREAM (module, i).connected)
BSE_MODULE_OSTREAM (module, i).values = (gfloat*) BSE_MODULE_IBUFFER (module, i);
-
++
/* check Done state on last stream */
if (BSE_MODULE_IBUFFER (module, BSE_MODULE_N_ISTREAMS (module) - 1)[n_values - 1] >= 1.0)
{
@@@ -890,6 -951,7 +942,7 @@@ create_voice_switch_module_L (BseTrans
BSE_COST_CHEAP
};
VoiceSwitch *vswitch = g_new0 (VoiceSwitch, 1);
-
++
vswitch->disconnected = TRUE;
vswitch->ref_count = 1;
vswitch->smodule = bse_module_new (&switch_module_class, vswitch);
@@@ -897,8 -959,10 +950,10 @@@
bse_trans_add (trans, bse_job_integrate (vswitch->smodule));
bse_trans_add (trans, bse_job_integrate (vswitch->vmodule));
bse_trans_add (trans, bse_job_suspend_now (vswitch->smodule));
-
++
return vswitch;
}
+
static inline gboolean
check_voice_switch_available_L (VoiceSwitch *vswitch)
{
@@@ -916,8 -982,10 +973,10 @@@ destroy_voice_switch_L (VoiceSwitch *vs
BseTrans *trans)
{
BseTrans *tmp_trans;
-
++
g_return_if_fail (vswitch->ref_count == 0);
g_return_if_fail (vswitch->n_vinputs == 0);
-
++
tmp_trans = bse_trans_open ();
bse_trans_add (tmp_trans, bse_job_boundary_discard (vswitch->smodule));
bse_trans_add (tmp_trans, bse_job_boundary_discard (vswitch->vmodule));
@@@ -966,7 -1038,9 +1029,9 @@@ MidiChannel::start_note (guint6
gfloat freq_val = BSE_VALUE_FROM_FREQ (freq);
VoiceSwitch *vswitch, *override_candidate = NULL;
guint i;
-
++
g_return_if_fail (freq > 0);
-
++
/* adjust channel global mono synth */
if (mchannel->vinput)
change_voice_input_L (mchannel->vinput, tick_stamp, VOICE_ON, freq_val, velocity, trans);
@@@ -989,6 -1065,7 +1056,7 @@@
/* grab voice to override */
if (!vswitch)
; // FIXME: voice = override_candidate;
-
++
if (vswitch && vswitch->n_vinputs)
{
/* start note */
@@@ -1016,12 -1094,16 +1085,16 @@@ MidiChannel::adjust_note (guint6
VoiceChangeType vctype = etype == BSE_MIDI_KEY_PRESSURE ? VOICE_PRESSURE : (sustain_note ? VOICE_SUSTAIN
: VOICE_OFF);
gfloat freq_val = BSE_VALUE_FROM_FREQ (freq);
VoiceInput *vinput = NULL;
-
++
g_return_if_fail (freq > 0 && velocity >= 0);
-
++
/* adjust channel global mono synth */
if (mchannel->vinput)
change_voice_input_L (mchannel->vinput, tick_stamp, vctype, freq_val, velocity, trans);
-
++
if (!mchannel->poly_enabled)
return;
+
/* find corresponding vinput */
vinput = mchannel->voice_input_table[freq_val];
while (vinput && vinput->queue_state != VSTATE_BUSY)
@@@ -1039,11 -1123,13 +1114,13 @@@ MidiChannel::kill_notes (guint64
{
MidiChannel *mchannel = this;
guint i, j;
-
++
/* adjust channel global voice inputs */
if (mchannel->vinput && sustained_only && mchannel->vinput->queue_state == VSTATE_SUSTAINED)
change_voice_input_L (mchannel->vinput, tick_stamp, VOICE_KILL_SUSTAIN, 0, 0, trans);
else if (mchannel->vinput && !sustained_only && mchannel->vinput->queue_state != VSTATE_IDLE)
change_voice_input_L (mchannel->vinput, tick_stamp, VOICE_KILL, 0, 0, trans);
-
++
/* adjust poly voice inputs */
for (i = 0; i < mchannel->n_voices; i++)
{
@@@ -1097,13 -1202,16 +1175,16 @@@ events_cmp (gconstpointer a
{
const BseMidiEvent *e1 = (const BseMidiEvent *) a;
const BseMidiEvent *e2 = (const BseMidiEvent *) b;
-
++
return e1->delta_time < e2->delta_time ? -1 : e1->delta_time != e2->delta_time;
}
+
void
bse_midi_receiver_enter_farm (BseMidiReceiver *self)
{
g_return_if_fail (self != NULL);
g_return_if_fail (find (farm_residents.begin(), farm_residents.end(), self) == farm_residents.end());
-
++
BSE_MIDI_RECEIVER_LOCK ();
farm_residents.push_back (self);
BSE_MIDI_RECEIVER_UNLOCK ();
@@@ -1112,6 -1221,7 +1194,7 @@@ voi
bse_midi_receiver_farm_distribute_event (BseMidiEvent *event)
{
g_return_if_fail (event != NULL);
-
++
BSE_MIDI_RECEIVER_LOCK ();
for (vector<BseMidiReceiver*>::iterator it = farm_residents.begin(); it != farm_residents.end(); it++)
(*it)->events = sfi_ring_insert_sorted ((*it)->events, bse_midi_copy_event (event), events_cmp, NULL);
@@@ -1136,6 -1248,7 +1221,7 @@@ bse_midi_receiver_leave_farm (BseMidiRe
{
g_return_if_fail (self != NULL);
g_return_if_fail (find (farm_residents.begin(), farm_residents.end(), self) != farm_residents.end());
-
++
BSE_MIDI_RECEIVER_LOCK ();
farm_residents.erase (find (farm_residents.begin(), farm_residents.end(), self));
BSE_MIDI_RECEIVER_UNLOCK ();
@@@ -1146,6 -1260,7 +1233,7 @@@ bse_midi_receiver_push_event (BseMidiRe
{
g_return_if_fail (self != NULL);
g_return_if_fail (event != NULL);
-
++
BSE_MIDI_RECEIVER_LOCK ();
self->events = sfi_ring_insert_sorted (self->events, event, events_cmp, NULL);
BSE_MIDI_RECEIVER_UNLOCK ();
@@@ -1155,7 -1271,9 +1244,9 @@@ bse_midi_receiver_process_events (BseMi
guint64 max_tick_stamp)
{
gboolean seen_event;
-
++
g_return_if_fail (self != NULL);
-
++
do
{
BSE_MIDI_RECEIVER_LOCK ();
@@@ -1168,31 -1288,40 +1261,40 @@@ BseMidiReceiver
bse_midi_receiver_new (const gchar *receiver_name) // FIXME
{
BseMidiReceiver *self;
-
++
self = new BseMidiReceiver ();
-
++
return self;
}
+
BseMidiReceiver*
bse_midi_receiver_ref (BseMidiReceiver *self)
{
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (self->ref_count > 0, NULL);
-
++
BSE_MIDI_RECEIVER_LOCK ();
self->ref_count++;
BSE_MIDI_RECEIVER_UNLOCK ();
-
++
return self;
}
+
void
bse_midi_receiver_unref (BseMidiReceiver *self)
{
gboolean need_destroy, leave_farm;
-
++
g_return_if_fail (self != NULL);
g_return_if_fail (self->ref_count > 0);
-
++
BSE_MIDI_RECEIVER_LOCK ();
self->ref_count--;
need_destroy = self->ref_count == 0;
leave_farm = need_destroy && find (farm_residents.begin(),
farm_residents.end(), self) != farm_residents.end();
BSE_MIDI_RECEIVER_UNLOCK ();
-
++
if (need_destroy)
{
if (leave_farm)
@@@ -1205,7 -1335,9 +1308,9 @@@ bse_midi_receiver_set_notifier (BseMidi
BseMidiNotifier *notifier)
{
BseMidiNotifier *old_notifier;
-
++
g_return_if_fail (self != NULL);
-
++
BSE_MIDI_RECEIVER_LOCK ();
old_notifier = self->notifier;
self->notifier = notifier;
@@@ -1231,13 -1365,17 +1338,17 @@@ SfiRing
bse_midi_receiver_fetch_notify_events (BseMidiReceiver *self)
{
SfiRing *ring;
-
++
g_return_val_if_fail (self != NULL, NULL);
-
++
BSE_MIDI_RECEIVER_LOCK ();
ring = self->notifier_events;
self->notifier_events = NULL;
BSE_MIDI_RECEIVER_UNLOCK ();
-
++
return ring;
}
+
BseModule*
bse_midi_receiver_retrieve_control_module (BseMidiReceiver *self,
guint midi_channel,
@@@ -1246,9 -1384,11 +1357,11 @@@
{
BseModule *cmodule;
guint i;
-
++
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (midi_channel > 0, NULL);
g_return_val_if_fail (signals != NULL, NULL);
-
++
BSE_MIDI_RECEIVER_LOCK ();
for (i = 0; i < self->n_cmodules; i++)
{
@@@ -1282,8 -1423,10 +1396,10 @@@ bse_midi_receiver_discard_control_modul
BseTrans *trans)
{
guint i;
-
++
g_return_if_fail (self != NULL);
g_return_if_fail (module != NULL);
-
++
BSE_MIDI_RECEIVER_LOCK ();
for (i = 0; i < self->n_cmodules; i++)
{
@@@ -1327,6 -1471,7 +1444,7 @@@ bse_midi_receiver_add_control_handler (
g_return_val_if_fail (midi_channel > 0, FALSE);
g_return_val_if_fail (handler_func != NULL, FALSE);
g_return_val_if_fail (module != NULL, FALSE);
-
++
BSE_MIDI_RECEIVER_LOCK ();
gboolean has_data = self->add_control_handler (midi_channel, signal_type, handler_func, handler_data,
module);
BSE_MIDI_RECEIVER_UNLOCK ();
@@@ -1344,6 -1490,7 +1463,7 @@@ bse_midi_receiver_set_control_handler_d
g_return_if_fail (self != NULL);
g_return_if_fail (midi_channel > 0);
g_return_if_fail (handler_func != NULL);
-
++
BSE_MIDI_RECEIVER_LOCK ();
self->set_control_handler_data (midi_channel, signal_type, handler_func, handler_data, extra_data,
extra_free);
BSE_MIDI_RECEIVER_UNLOCK ();
@@@ -1360,6 -1508,7 +1481,7 @@@ bse_midi_receiver_remove_control_handle
g_return_if_fail (midi_channel > 0);
g_return_if_fail (handler_func != NULL);
g_return_if_fail (module != NULL);
-
++
BSE_MIDI_RECEIVER_LOCK ();
self->remove_control_handler (midi_channel, signal_type, handler_func, handler_data, module);
BSE_MIDI_RECEIVER_UNLOCK ();
@@@ -1370,6 -1520,7 +1493,7 @@@ bse_midi_receiver_channel_enable_poly (
{
g_return_if_fail (self != NULL);
g_return_if_fail (midi_channel > 0);
-
++
BSE_MIDI_RECEIVER_LOCK ();
MidiChannel *mchannel = self->get_channel (midi_channel);
mchannel->enable_poly();
@@@ -1381,6 -1533,7 +1506,7 @@@ bse_midi_receiver_channel_disable_poly
{
g_return_if_fail (self != NULL);
g_return_if_fail (midi_channel > 0);
-
++
BSE_MIDI_RECEIVER_LOCK ();
MidiChannel *mchannel = self->get_channel (midi_channel);
mchannel->disable_poly();
@@@ -1392,8 -1546,10 +1519,10 @@@ bse_midi_receiver_retrieve_mono_voice (
BseTrans *trans)
{
MidiChannel *mchannel;
-
++
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (midi_channel > 0, NULL);
-
++
BSE_MIDI_RECEIVER_LOCK ();
mchannel = self->get_channel (midi_channel);
if (mchannel->vinput)
@@@ -1410,8 -1567,10 +1540,10 @@@ bse_midi_receiver_discard_mono_voice (B
BseTrans *trans)
{
MidiChannel *mchannel;
-
++
g_return_if_fail (self != NULL);
g_return_if_fail (fmodule != NULL);
-
++
BSE_MIDI_RECEIVER_LOCK ();
mchannel = self->get_channel (midi_channel);
if (mchannel->vinput && mchannel->vinput->fmodule == fmodule)
@@@ -1435,8 -1595,10 +1568,10 @@@ bse_midi_receiver_create_poly_voice (Bs
{
MidiChannel *mchannel;
guint i;
-
++
g_return_val_if_fail (self != NULL, 0);
g_return_val_if_fail (midi_channel > 0, 0);
-
++
BSE_MIDI_RECEIVER_LOCK ();
mchannel = self->get_channel (midi_channel);
/* find free voice slot */
@@@ -1451,8 -1613,10 +1586,10 @@@
}
mchannel->voices[i] = create_voice_switch_module_L (trans);
BSE_MIDI_RECEIVER_UNLOCK ();
-
++
return i + 1;
}
+
void
bse_midi_receiver_discard_poly_voice (BseMidiReceiver *self,
guint midi_channel,
@@@ -1461,10 -1625,12 +1598,12 @@@
{
MidiChannel *mchannel;
VoiceSwitch *vswitch;
-
++
g_return_if_fail (self != NULL);
g_return_if_fail (midi_channel > 0);
g_return_if_fail (voice_id > 0);
voice_id -= 1;
-
++
BSE_MIDI_RECEIVER_LOCK ();
mchannel = self->get_channel (midi_channel);
vswitch = voice_id < mchannel->n_voices ? mchannel->voices[voice_id] : NULL;
@@@ -1490,10 -1657,12 +1630,12 @@@ bse_midi_receiver_get_poly_voice_input
MidiChannel *mchannel;
VoiceSwitch *vswitch;
BseModule *module;
-
++
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (midi_channel > 0, NULL);
g_return_val_if_fail (voice_id > 0, NULL);
voice_id -= 1;
-
++
BSE_MIDI_RECEIVER_LOCK ();
mchannel = self->get_channel (midi_channel);
vswitch = voice_id < mchannel->n_voices ? mchannel->voices[voice_id] : NULL;
@@@ -1509,10 -1679,12 +1652,12 @@@ bse_midi_receiver_get_poly_voice_outpu
MidiChannel *mchannel;
VoiceSwitch *vswitch;
BseModule *module;
-
++
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (midi_channel > 0, NULL);
g_return_val_if_fail (voice_id > 0, NULL);
voice_id -= 1;
-
++
BSE_MIDI_RECEIVER_LOCK ();
mchannel = self->get_channel (midi_channel);
vswitch = voice_id < mchannel->n_voices ? mchannel->voices[voice_id] : NULL;
@@@ -1529,10 -1702,12 +1675,12 @@@ bse_midi_receiver_create_sub_voice (Bse
MidiChannel *mchannel;
VoiceSwitch *vswitch;
BseModule *module = NULL;
-
++
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (midi_channel > 0, NULL);
g_return_val_if_fail (voice_id > 0, NULL);
voice_id -= 1;
-
++
BSE_MIDI_RECEIVER_LOCK ();
mchannel = self->get_channel (midi_channel);
vswitch = voice_id < mchannel->n_voices ? mchannel->voices[voice_id] : NULL;
@@@ -1557,11 -1733,13 +1706,13 @@@ bse_midi_receiver_discard_sub_voice (Bs
MidiChannel *mchannel;
VoiceSwitch *vswitch;
guint i, need_unref = FALSE;
-
++
g_return_if_fail (self != NULL);
g_return_if_fail (midi_channel > 0);
g_return_if_fail (fmodule != NULL);
g_return_if_fail (voice_id > 0);
voice_id -= 1;
-
++
BSE_MIDI_RECEIVER_LOCK ();
mchannel = self->get_channel (midi_channel);
vswitch = voice_id < mchannel->n_voices ? mchannel->voices[voice_id] : NULL;
@@@ -1599,10 -1778,13 +1751,13 @@@ bse_midi_receiver_voices_pending (BseMi
MidiChannel *mchannel;
SfiRing *ring = NULL;
guint i, active = 0;
-
++
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (midi_channel > 0, FALSE);
-
++
if (self->events)
return TRUE;
-
++
BSE_MIDI_RECEIVER_LOCK ();
mchannel = self->get_channel (midi_channel);
if (mchannel)
@@@ -1620,8 -1802,11 +1775,11 @@@
active += event->channel == midi_channel;
}
BSE_MIDI_RECEIVER_UNLOCK ();
-
++
return active > 0;
}
+
+
/* --- event processing --- */
static inline void
update_midi_signal_L (BseMidiReceiver *self,
@@@ -1632,14 -1817,16 +1790,16 @@@
BseTrans *trans)
{
GSList *signal_modules;
-
++
signal_modules = self->set_control (channel, tick_stamp, signal, value, trans);
change_midi_control_modules_L (signal_modules, tick_stamp,
signal, value, trans);
#if 0
- DEBUG ("MidiChannel[%u]: Signal %3u Value=%f (%s)", channel,
- signal, value, bse_midi_signal_name (signal));
+ MDEBUG ("MidiChannel[%u]: Signal %3u Value=%f (%s)", channel,
+ signal, value, bse_midi_signal_name (signal));
#endif
}
+
static inline void
update_midi_signal_continuous_msb_L (BseMidiReceiver *self,
guint channel,
@@@ -1689,14 -1878,17 +1851,17 @@@ process_midi_control_L (BseMidiReceive
* multiple MIDI signals. extra_continuous are used
* internally to update only continuous signals.
*/
-
++
if (extra_continuous)
{
/* internal BSE_MIDI_SIGNAL_CONTINUOUS_* change */
update_midi_signal_L (self, channel, tick_stamp, static_cast<BseMidiSignalType> (64 + control),
value, trans);
return;
}
-
++
/* all MIDI controls are passed literally as BSE_MIDI_SIGNAL_CONTROL_* */
update_midi_signal_L (self, channel, tick_stamp, static_cast<BseMidiSignalType> (128 + control), value,
trans);
-
++
if (control < 32) /* MSB part of continuous 14bit signal */
update_midi_signal_continuous_msb_L (self, channel, tick_stamp,
static_cast<BseMidiSignalType> (control + 64), /* continuous
signal */
@@@ -1764,8 -1957,10 +1930,10 @@@ midi_receiver_process_event_L (BseMidiR
{
BseMidiEvent *event;
gboolean need_wakeup = FALSE;
-
++
if (!self->events)
return FALSE;
-
++
event = (BseMidiEvent *) self->events->data;
if (event->delta_time <= max_tick_stamp)
{
@@@ -1855,8 -2050,11 +2023,11 @@@
}
else
return FALSE;
-
++
if (need_wakeup)
bse_midi_notifiers_wakeup();
+
return TRUE;
}
+
} // "C"
diff --cc bse/bsemidisynth.cc
index 00efc9c,b67530c..d91eb53
--- a/bse/bsemidisynth.cc
+++ b/bse/bsemidisynth.cc
@@@ -47,24 -57,30 +57,30 @@@ static GTypeClass *parent_class = N
BSE_BUILTIN_TYPE (BseMidiSynth)
{
GType midi_synth_type;
-
++
static const GTypeInfo snet_info = {
sizeof (BseMidiSynthClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_midi_synth_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseMidiSynth),
0,
(GInstanceInitFunc) bse_midi_synth_init,
};
-
++
midi_synth_type = bse_type_register_static (BSE_TYPE_SNET,
"BseMidiSynth",
"BSE Midi Synthesizer",
__FILE__, __LINE__,
&snet_info);
-
++
return midi_synth_type;
}
+
static void
bse_midi_synth_init (BseMidiSynth *self)
{
@@@ -74,15 -91,18 +91,18 @@@
self->midi_channel_id = 1;
self->n_voices = 16;
self->volume_factor = bse_db_to_factor (0);
-
++
/* midi voice modules */
self->voice_input = (BseSource*) bse_container_new_child (BSE_CONTAINER (self),
BSE_TYPE_MIDI_VOICE_INPUT, NULL);
bse_snet_intern_child (snet, self->voice_input);
self->voice_switch = (BseSource*) bse_container_new_child (BSE_CONTAINER (self),
BSE_TYPE_MIDI_VOICE_SWITCH, NULL);
bse_snet_intern_child (snet, self->voice_switch);
bse_midi_voice_input_set_voice_switch (BSE_MIDI_VOICE_INPUT (self->voice_input), BSE_MIDI_VOICE_SWITCH
(self->voice_switch));
-
++
/* context merger */
self->context_merger = (BseSource*) bse_container_new_child (BSE_CONTAINER (self),
BSE_TYPE_CONTEXT_MERGER, NULL);
bse_snet_intern_child (snet, self->context_merger);
-
++
/* midi voice switch <-> context merger */
bse_source_must_set_input (self->context_merger, 0,
self->voice_switch, BSE_MIDI_VOICE_SWITCH_OCHANNEL_LEFT);
@@@ -100,11 -123,13 +123,13 @@@
/* output */
self->output = (BseSource*) bse_container_new_child (BSE_CONTAINER (self), BSE_TYPE_PCM_OUTPUT, NULL);
bse_snet_intern_child (snet, self->output);
-
++
/* postprocess <-> output */
bse_source_must_set_input (self->output, BSE_PCM_OUTPUT_ICHANNEL_LEFT,
self->postprocess, 0);
bse_source_must_set_input (self->output, BSE_PCM_OUTPUT_ICHANNEL_RIGHT,
self->postprocess, 1);
-
++
/* sub synth */
self->sub_synth = (BseSource*) bse_container_new_child (BSE_CONTAINER (self), BSE_TYPE_SUB_SYNTH,
"in_port_1", "frequency",
@@@ -126,6 -152,7 +152,7 @@@
self->voice_input, BSE_MIDI_VOICE_INPUT_OCHANNEL_VELOCITY);
bse_source_must_set_input (self->sub_synth, 3,
self->voice_input, BSE_MIDI_VOICE_INPUT_OCHANNEL_AFTERTOUCH);
-
++
/* sub-synth <-> voice switch */
bse_source_must_set_input (self->voice_switch, BSE_MIDI_VOICE_SWITCH_ICHANNEL_LEFT,
self->sub_synth, 0);
@@@ -149,6 -179,7 +179,7 @@@ static voi
bse_midi_synth_finalize (GObject *object)
{
BseMidiSynth *self = BSE_MIDI_SYNTH (object);
-
++
bse_container_remove_item (BSE_CONTAINER (self), BSE_ITEM (self->voice_input));
self->voice_input = NULL;
bse_container_remove_item (BSE_CONTAINER (self), BSE_ITEM (self->voice_switch));
@@@ -161,6 -192,7 +192,7 @@@
self->output = NULL;
bse_container_remove_item (BSE_CONTAINER (self), BSE_ITEM (self->sub_synth));
self->sub_synth = NULL;
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@@ -332,8 -370,10 +370,10 @@@ bse_midi_synth_context_create (BseSourc
{
BseMidiSynth *self = BSE_MIDI_SYNTH (source);
BseSNet *snet = BSE_SNET (self);
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_create (source, context_handle, trans);
-
++
if (!bse_snet_context_is_branch (snet, context_handle)) /* catch recursion */
{
BseMidiContext mcontext = bse_snet_get_midi_context (snet, context_handle);
diff --cc bse/bsemidivoice.cc
index 2dccf00,3c29ea7..5c10fa8
--- a/bse/bsemidivoice.cc
+++ b/bse/bsemidivoice.cc
@@@ -41,6 -48,7 +48,7 @@@ BSE_BUILTIN_TYPE (BseMidiVoiceInput
0 /* n_preallocs */,
(GInstanceInitFunc) bse_midi_voice_input_init,
};
-
++
return bse_type_register_static (BSE_TYPE_SOURCE,
"BseMidiVoiceInput",
"Internal MIDI Voice glue object (input)",
@@@ -60,6 -69,7 +69,7 @@@ BSE_BUILTIN_TYPE (BseMidiVoiceSwitch
0 /* n_preallocs */,
(GInstanceInitFunc) bse_midi_voice_switch_init,
};
-
++
return bse_type_register_static (BSE_TYPE_SOURCE,
"BseMidiVoiceSwitch",
"Internal MIDI Voice glue object (switch)",
@@@ -72,10 -83,14 +83,14 @@@ bse_midi_voice_input_class_init (BseMid
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
guint channel_id;
-
++
voice_input_parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->dispose = bse_midi_voice_input_dispose;
-
++
source_class->context_create = bse_midi_voice_input_context_create;
source_class->context_dismiss = bse_midi_voice_input_context_dismiss;
-
++
channel_id = bse_source_class_add_ochannel (source_class, "freq-out", _("Freq Out"), NULL);
g_assert (channel_id == BSE_MIDI_VOICE_INPUT_OCHANNEL_FREQUENCY);
channel_id = bse_source_class_add_ochannel (source_class, "gate-out", _("Gate Out"), NULL);
@@@ -91,10 -107,14 +107,14 @@@ bse_midi_voice_switch_class_init (BseMi
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
guint channel_id;
-
++
voice_switch_parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->dispose = bse_midi_voice_switch_dispose;
-
++
source_class->context_create = bse_midi_voice_switch_context_create;
source_class->context_dismiss = bse_midi_voice_switch_context_dismiss;
-
++
channel_id = bse_source_class_add_ichannel (source_class, "left-in", _("Left In"), NULL);
g_assert (channel_id == BSE_MIDI_VOICE_SWITCH_ICHANNEL_LEFT);
channel_id = bse_source_class_add_ichannel (source_class, "right-in", _("Right In"), NULL);
@@@ -134,7 -159,9 +159,9 @@@ static voi
bse_midi_voice_input_dispose (GObject *object)
{
BseMidiVoiceInput *self = BSE_MIDI_VOICE_INPUT (object);
-
++
bse_midi_voice_input_set_voice_switch (self, NULL);
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (voice_input_parent_class)->dispose (object);
}
@@@ -142,8 -170,10 +170,10 @@@ static voi
bse_midi_voice_switch_dispose (GObject *object)
{
BseMidiVoiceSwitch *self = BSE_MIDI_VOICE_SWITCH (object);
+
if (self->midi_voices)
g_warning ("disposing voice-switch with active midi voices");
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (voice_switch_parent_class)->dispose (object);
}
@@@ -180,7 -216,9 +216,9 @@@ bse_midi_voice_input_context_dismiss (B
module = bse_source_get_context_omodule (source, context_handle);
bse_midi_receiver_discard_sub_voice (mcontext.midi_receiver, mcontext.midi_channel, mcontext.voice_id,
module, trans);
bse_source_set_context_omodule (source, context_handle, NULL);
-
++
bse_midi_voice_switch_unref_poly_voice (self->voice_switch, context_handle, trans);
+
/* chain parent class' handler */
BSE_SOURCE_CLASS (voice_input_parent_class)->context_dismiss (source, context_handle, trans);
}
@@@ -198,6 -238,7 +238,7 @@@ bse_midi_voice_switch_context_create (B
bse_source_set_context_omodule (source, context_handle,
bse_midi_receiver_get_poly_voice_output (mcontext.midi_receiver,
mcontext.midi_channel,
mcontext.voice_id));
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (voice_switch_parent_class)->context_create (source, context_handle, trans);
}
@@@ -207,13 -249,17 +249,17 @@@ bse_midi_voice_switch_context_dismiss (
BseTrans *trans)
{
BseMidiVoiceSwitch *self = BSE_MIDI_VOICE_SWITCH (source);
-
++
/* the BseModules aren't ours, so we need to disconnect the input module
* and prevent discarding the modules.
*/
-
++
bse_trans_add (trans, bse_job_kill_inputs (bse_source_get_context_imodule (source, context_handle)));
bse_source_set_context_imodule (source, context_handle, NULL);
bse_source_set_context_omodule (source, context_handle, NULL);
-
++
bse_midi_voice_switch_unref_poly_voice (self, context_handle, trans);
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (voice_switch_parent_class)->context_dismiss (source, context_handle, trans);
}
@@@ -223,8 -270,10 +270,10 @@@ bse_midi_voice_switch_set_midi_channel
{
g_return_if_fail (BSE_IS_MIDI_VOICE_SWITCH (self));
g_return_if_fail (!BSE_SOURCE_PREPARED (self));
-
++
self->midi_channel = midi_channel;
}
+
typedef struct {
guint context_handle;
guint ref_count;
diff --cc bse/bsenote.cc
index 618ab07,1e1a952..90445ad
--- a/bse/bsenote.cc
+++ b/bse/bsenote.cc
@@@ -99,14 -110,18 +108,18 @@@ BseFreqArray
bse_freq_array_new (guint prealloc)
{
BseFreqArray *farray = g_new0 (BseFreqArray, 1);
-
++
farray->n_prealloced = prealloc;
farray->values = g_new0 (gdouble, farray->n_prealloced);
-
++
return farray;
}
+
void
bse_freq_array_free (BseFreqArray *farray)
{
g_return_if_fail (farray != NULL);
-
++
g_free (farray->values);
g_free (farray);
}
@@@ -122,16 -140,20 +138,20 @@@ bse_freq_array_get (BseFreqArray *farra
{
g_return_val_if_fail (farray != NULL, 0);
g_return_val_if_fail (index < farray->n_values, 0);
-
++
return farray->values[index];
}
+
void
bse_freq_array_insert (BseFreqArray *farray,
guint index,
gdouble value)
{
guint i;
-
++
g_return_if_fail (farray != NULL);
g_return_if_fail (index <= farray->n_values);
-
++
i = farray->n_values;
i = farray->n_values += 1;
if (farray->n_values > farray->n_prealloced)
@@@ -157,26 -181,33 +179,33 @@@ bse_freq_array_set (BseFreqArray *farra
{
g_return_if_fail (farray != NULL);
g_return_if_fail (index < farray->n_values);
-
++
farray->values[index] = value;
}
+
gboolean
bse_freq_arrays_match_freq (gfloat match_freq,
BseFreqArray *inclusive_set,
BseFreqArray *exclusive_set)
{
guint i;
-
++
if (exclusive_set)
for (i = 0; i < exclusive_set->n_values; i++)
{
gdouble *value = exclusive_set->values + i;
-
++
if (fabs (*value - match_freq) < BSE_FREQUENCY_EPSILON)
return FALSE;
}
-
++
if (!inclusive_set)
return TRUE;
-
++
for (i = 0; i < inclusive_set->n_values; i++)
{
gdouble *value = inclusive_set->values + i;
-
++
if (fabs (*value - match_freq) < BSE_FREQUENCY_EPSILON)
return TRUE;
}
diff --cc bse/bseobject.cc
index 0d35a07,3321cd7..13a2402
--- a/bse/bseobject.cc
+++ b/bse/bseobject.cc
@@@ -84,6 -96,7 +93,7 @@@ bse_object_debug_name (gpointer object
{
GTypeInstance *instance = (GTypeInstance*) object;
gchar *debug_name;
-
++
if (!instance)
return "<NULL>";
if (!instance->g_class)
@@@ -134,15 -152,21 +149,21 @@@ static voi
bse_object_do_dispose (GObject *gobject)
{
BseObject *object = BSE_OBJECT (gobject);
-
++
BSE_OBJECT_SET_FLAGS (object, BSE_OBJECT_FLAG_DISPOSING);
+
if (BSE_OBJECT_IN_RESTORE (object))
g_warning ("%s: object in restore state while disposing: %s", G_STRLOC, bse_object_debug_name (object));
+
/* perform release notification */
g_signal_emit (object, object_signals[SIGNAL_RELEASE], 0);
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->dispose (gobject);
+
BSE_OBJECT_UNSET_FLAGS (object, BSE_OBJECT_FLAG_DISPOSING);
}
+
static void
bse_object_do_finalize (GObject *gobject)
{
@@@ -173,6 -202,7 +199,7 @@@ bse_object_do_set_property (GObjec
switch (property_id)
{
gchar *string;
-
++
case PROP_UNAME:
if (!(object->flags & BSE_OBJECT_FLAG_FIXED_UNAME))
{
@@@ -241,8 -273,10 +270,10 @@@ bse_object_class_add_grouped_property (
g_return_if_fail (BSE_IS_OBJECT_CLASS (klass));
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
g_return_if_fail (property_id > 0);
-
++
g_object_class_install_property (G_OBJECT_CLASS (klass), property_id, pspec);
}
+
void
bse_object_class_add_property (BseObjectClass *klass,
const gchar *property_group,
@@@ -252,6 -286,7 +283,7 @@@
g_return_if_fail (BSE_IS_OBJECT_CLASS (klass));
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
g_return_if_fail (sfi_pspec_get_group (pspec) == NULL);
-
++
sfi_pspec_set_group (pspec, property_group);
bse_object_class_add_grouped_property (klass, property_id, pspec);
}
@@@ -264,6 -300,7 +297,7 @@@ bse_object_marshal_signal (GClosur
gpointer marshal_data)
{
gpointer arg0, argN;
-
++
g_return_if_fail (return_value == NULL);
g_return_if_fail (n_param_values >= 1 && n_param_values <= 1 + SFI_VMARSHAL_MAX_ARGS);
g_return_if_fail (G_VALUE_HOLDS_OBJECT (param_values));
@@@ -290,9 -329,11 +326,11 @@@ bse_object_class_add_signal (BseObjectC
{
va_list args;
guint signal_id;
-
++
g_return_val_if_fail (BSE_IS_OBJECT_CLASS (oclass), 0);
g_return_val_if_fail (n_params <= SFI_VMARSHAL_MAX_ARGS, 0);
g_return_val_if_fail (signal_name != NULL, 0);
-
++
va_start (args, n_params);
signal_id = g_signal_new_valist (signal_name,
G_TYPE_FROM_CLASS (oclass),
@@@ -302,8 -343,10 +340,10 @@@
return_type,
n_params, args);
va_end (args);
-
++
return signal_id;
}
+
guint
bse_object_class_add_asignal (BseObjectClass *oclass,
const gchar *signal_name,
@@@ -313,9 -356,11 +353,11 @@@
{
va_list args;
guint signal_id;
-
++
g_return_val_if_fail (BSE_IS_OBJECT_CLASS (oclass), 0);
g_return_val_if_fail (n_params <= SFI_VMARSHAL_MAX_ARGS, 0);
g_return_val_if_fail (signal_name != NULL, 0);
-
++
va_start (args, n_params);
signal_id = g_signal_new_valist (signal_name,
G_TYPE_FROM_CLASS (oclass),
@@@ -325,8 -370,10 +367,10 @@@
return_type,
n_params, args);
va_end (args);
-
++
return signal_id;
}
+
guint
bse_object_class_add_dsignal (BseObjectClass *oclass,
const gchar *signal_name,
@@@ -336,9 -383,11 +380,11 @@@
{
va_list args;
guint signal_id;
-
++
g_return_val_if_fail (BSE_IS_OBJECT_CLASS (oclass), 0);
g_return_val_if_fail (n_params <= SFI_VMARSHAL_MAX_ARGS, 0);
g_return_val_if_fail (signal_name != NULL, 0);
-
++
va_start (args, n_params);
signal_id = g_signal_new_valist (signal_name,
G_TYPE_FROM_CLASS (oclass),
@@@ -348,39 -397,52 +394,52 @@@
return_type,
n_params, args);
va_end (args);
-
++
return signal_id;
}
+
void
bse_object_lock (gpointer _object)
{
BseObject *object = (BseObject*) _object;
GObject *gobject = (GObject*) _object;
-
++
g_return_if_fail (BSE_IS_OBJECT (object));
g_return_if_fail (gobject->ref_count > 0);
-
++
g_assert (object->lock_count < 65535); // if this breaks, we need to fix the guint16
-
++
if (!object->lock_count)
{
g_object_ref (object);
-
++
/* we also keep the globals locked so we don't need to duplicate
* this all over the place
*/
bse_gconfig_lock ();
}
-
++
object->lock_count += 1;
}
+
void
bse_object_unlock (gpointer _object)
{
BseObject *object = (BseObject*) _object;
+
g_return_if_fail (BSE_IS_OBJECT (object));
g_return_if_fail (object->lock_count > 0);
-
++
object->lock_count -= 1;
-
++
if (!object->lock_count)
{
/* release global lock */
bse_gconfig_unlock ();
-
++
if (BSE_OBJECT_GET_CLASS (object)->unlocked)
BSE_OBJECT_GET_CLASS (object)->unlocked (object);
-
++
g_object_unref (object);
}
}
@@@ -394,7 -458,9 +455,9 @@@ bse_objects_list_by_uname (GType type
const gchar *uname)
{
GList *object_list = NULL;
-
++
g_return_val_if_fail (BSE_TYPE_IS_OBJECT (type) == TRUE, NULL);
-
++
if (object_unames_ht)
{
GSList *slist, *object_slist = (GSList*) g_hash_table_lookup (object_unames_ht, uname);
@@@ -402,8 -469,10 +466,10 @@@
if (g_type_is_a (BSE_OBJECT_TYPE (slist->data), type))
object_list = g_list_prepend (object_list, slist->data);
}
-
++
return object_list;
}
+
static void
list_objects (gpointer key,
gpointer value,
@@@ -451,23 -525,33 +522,33 @@@ voi
bse_object_notify_icon_changed (BseObject *object)
{
g_return_if_fail (BSE_IS_OBJECT (object));
-
++
g_signal_emit (object, object_signals[SIGNAL_ICON_CHANGED], 0);
}
+
BseIcon*
bse_object_get_icon (BseObject *object)
{
BseIcon *icon;
-
++
g_return_val_if_fail (BSE_IS_OBJECT (object), NULL);
-
++
g_object_ref (object);
-
++
icon = BSE_OBJECT_GET_CLASS (object)->get_icon (object);
-
++
g_object_unref (object);
-
++
return icon;
}
+
static BseIcon*
bse_object_do_get_icon (BseObject *object)
{
BseIcon *icon;
-
++
g_return_val_if_fail (BSE_IS_OBJECT (object), NULL);
+
icon = (BseIcon*) g_object_get_qdata (G_OBJECT (object), bse_quark_icon);
if (!icon)
{
@@@ -689,7 -791,9 +787,9 @@@ static voi
bse_object_class_init (BseObjectClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
bse_quark_uname = g_quark_from_static_string ("bse-object-uname");
bse_quark_icon = g_quark_from_static_string ("bse-object-icon");
quark_property_changed_queue = g_quark_from_static_string ("bse-property-changed-queue");
@@@ -697,10 -801,12 +797,12 @@@
object_unames_ht = g_hash_table_new (bse_string_hash, bse_string_equals);
eclosures_ht = g_hash_table_new (eclosure_hash, eclosure_equals);
object_id_ustore = sfi_ustore_new ();
-
++
gobject_class->set_property = bse_object_do_set_property;
gobject_class->get_property = bse_object_do_get_property;
gobject_class->dispose = bse_object_do_dispose;
gobject_class->finalize = bse_object_do_finalize;
-
++
klass->check_pspec_editable = object_check_pspec_editable;
klass->set_uname = bse_object_do_set_uname;
klass->store_private = bse_object_store_private;
@@@ -709,6 -815,7 +811,7 @@@
klass->restore_finish = object_restore_finish;
klass->unlocked = NULL;
klass->get_icon = bse_object_do_get_icon;
-
++
bse_object_class_add_param (klass, NULL,
PROP_UNAME,
sfi_pspec_string ("uname", _("Name"), _("Unique name of this object"),
@@@ -724,6 -831,7 +827,7 @@@
sfi_pspec_string ("blurb", _("Comment"), _("Free form comment or description"),
"",
SFI_PARAM_STANDARD ":skip-default"));
-
++
object_signals[SIGNAL_RELEASE] = bse_object_class_add_signal (klass, "release",
G_TYPE_NONE, 0);
object_signals[SIGNAL_ICON_CHANGED] = bse_object_class_add_signal (klass, "icon_changed",
@@@ -733,15 -842,18 +838,18 @@@ BSE_BUILTIN_TYPE (BseObject
{
static const GTypeInfo object_info = {
sizeof (BseObjectClass),
-
++
(GBaseInitFunc) bse_object_class_base_init,
(GBaseFinalizeFunc) bse_object_class_base_finalize,
(GClassInitFunc) bse_object_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseObject),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_object_init,
};
-
++
return bse_type_register_abstract (G_TYPE_OBJECT,
"BseObject",
"BSE Object Hierarchy base type",
diff --cc bse/bseparam.cc
index 29e9a3f,36d0140..7679f58
--- a/bse/bseparam.cc
+++ b/bse/bseparam.cc
@@@ -18,12 -25,16 +25,16 @@@ bse_param_spec_object (const gchar *
const gchar *hints)
{
GParamSpec *pspec;
-
++
g_return_val_if_fail (g_type_is_a (object_type, BSE_TYPE_OBJECT), NULL);
-
++
pspec = g_param_spec_object (name, NULL_CHECKED (nick), NULL_CHECKED (blurb), object_type, GParamFlags
(0));
sfi_pspec_set_options (pspec, hints);
sfi_pspec_add_option (pspec, "skip-default", "+");
-
++
return pspec;
}
+
GValue*
bse_value_object (gpointer vobject)
{
@@@ -67,7 -82,9 +82,9 @@@ bse_param_spec_boxed (const gchar *name
const gchar *hints)
{
GParamSpec *pspec = NULL;
-
++
g_return_val_if_fail (G_TYPE_IS_BOXED (boxed_type), NULL);
-
++
if (sfi_boxed_type_get_rec_fields (boxed_type).n_fields ||
sfi_boxed_type_get_seq_element (boxed_type))
{
diff --cc bse/bseparasite.cc
index a63fc57,00a3a2f..43a613d
--- a/bse/bseparasite.cc
+++ b/bse/bseparasite.cc
@@@ -467,6 -507,7 +507,7 @@@ parasite_list_free (gpointer data
{
ParasiteList *list = (ParasiteList*) data;
guint i;
-
++
for (i = 0; i < list->n_parasites; i++)
if (list->parasites[i].n_values)
g_free (list->parasites[i].data);
@@@ -494,18 -536,23 +536,23 @@@ fetch_parasite (BseObject *object
{
if (!quark_parasite_list)
quark_parasite_list = g_quark_from_static_string ("BseParasiteList");
-
++
if (olist)
g_object_steal_qdata ((GObject*) object, quark_parasite_list);
g_object_set_qdata_full ((GObject*) object, quark_parasite_list, list, parasite_list_free);
}
-
++
list->parasites[i].quark = quark;
list->parasites[i].type = type;
list->parasites[i].n_values = 0;
list->parasites[i].data = NULL;
-
++
return list->parasites + i;
}
-
++
return NULL;
}
+
static void
delete_parasite (BseObject *object,
GQuark quark,
@@@ -618,6 -674,7 +674,7 @@@ bse_parasite_set_floats (BseObject *o
g_return_if_fail (n_values < MAX_PARASITE_VALUES);
if (n_values)
g_return_if_fail (float_values != NULL);
-
++
if (!n_values)
delete_parasite (object, g_quark_try_string (name), PARASITE_FLOAT);
else
@@@ -626,6 -683,7 +683,7 @@@
g_quark_from_string (name),
PARASITE_FLOAT,
TRUE);
-
++
if (parasite->n_values != n_values)
{
if (parasite->n_values)
diff --cc bse/bsepart.cc
index e01d2b9,89816be..ecfb09f
--- a/bse/bsepart.cc
+++ b/bse/bsepart.cc
@@@ -56,15 -65,18 +65,18 @@@ BSE_BUILTIN_TYPE (BsePart
{
static const GTypeInfo info = {
sizeof (BsePartClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_part_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BsePart),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_part_init,
};
-
++
return bse_type_register_static (BSE_TYPE_ITEM,
"BsePart",
"BSE part type",
@@@ -77,13 -90,17 +90,17 @@@ bse_part_class_init (BsePartClass *klas
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
// BseItemClass *item_class = BSE_ITEM_CLASS (klass);
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = bse_part_set_property;
gobject_class->get_property = bse_part_get_property;
gobject_class->dispose = bse_part_dispose;
gobject_class->finalize = bse_part_finalize;
-
++
object_class->store_private = bse_part_store_private;
object_class->restore_private = bse_part_restore_private;
+
quark_insert_note = g_quark_from_static_string ("insert-note");
quark_insert_notes = g_quark_from_static_string ("insert-notes");
quark_insert_control = g_quark_from_static_string ("insert-control");
@@@ -189,6 -214,7 +214,7 @@@ bse_part_dispose (GObject *object
self->range_bound = 0;
self->range_min_note = BSE_MAX_NOTE;
self->range_max_note = 0;
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@@ -197,6 -224,7 +224,7 @@@ bse_part_finalize (GObject *object
{
BsePart *self = BSE_PART (object);
guint i;
-
++
self->links_queued = TRUE;
plist_links_changed = sfi_ring_remove (plist_links_changed, self);
self->range_queued = TRUE;
@@@ -210,6 -241,7 +241,7 @@@
bse_part_note_channel_destroy (&self->channels[i]);
g_free (self->channels);
self->channels = NULL;
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@@ -226,7 -260,9 +260,9 @@@ bse_part_alloc_id (BsePart *self
guint tick)
{
guint id;
-
++
g_return_val_if_fail (tick <= BSE_PART_MAX_TICK, 0);
+
/* we keep an array of ids to implement a fast lookup
* from id to tick of the event containing id. ticks
* >= BSE_PART_INVAL_TICK_FLAG indicate non-allocated
@@@ -259,8 -299,10 +299,10 @@@ bse_part_move_id (BsePart *self
g_return_if_fail (tick <= BSE_PART_MAX_TICK);
g_return_if_fail (id > 0 && id <= self->n_ids);
g_return_if_fail (self->ids[id - 1] < BSE_PART_INVAL_TICK_FLAG); /* check !freed id */
-
++
self->ids[id - 1] = tick;
}
+
static void
bse_part_free_id (BsePart *self,
guint id)
@@@ -303,6 -350,7 +350,7 @@@ range_changed_notify_handler (gpointer
self->range_queued = FALSE;
guint tick = self->range_tick, duration = self->range_bound - tick;
gint min_note = self->range_min_note, max_note = self->range_max_note;
-
++
self->range_tick = BSE_PART_MAX_TICK;
self->range_bound = 0;
self->range_min_note = BSE_MAX_NOTE;
@@@ -311,8 -359,10 +359,10 @@@
g_signal_emit (self, signal_range_changed, 0, tick, duration, min_note, max_note);
}
handler_id_range_changed = 0;
-
++
return FALSE;
}
+
static void
queue_update (BsePart *self,
guint tick,
@@@ -320,7 -370,9 +370,9 @@@
gint note)
{
guint bound = tick + duration;
-
++
g_return_if_fail (duration > 0);
-
++
if (!BSE_OBJECT_DISPOSING (self))
{
if (self->range_tick >= self->range_bound && !self->range_queued)
@@@ -347,6 -401,7 +401,7 @@@ queue_control_update (BsePart *self
guint tick)
{
guint bound = tick + 1;
-
++
if (!BSE_OBJECT_DISPOSING (self))
{
if (self->range_tick >= self->range_bound && !self->range_queued)
@@@ -372,8 -428,10 +428,10 @@@ links_changed_notify_handler (gpointer
g_signal_emit (self, signal_links_changed, 0);
}
handler_id_links_changed = 0;
-
++
return FALSE;
}
+
void
bse_part_links_changed (BsePart *self)
{
@@@ -509,6 -575,7 +575,7 @@@ bse_part_select_notes_exclusive (BsePar
BsePartTickNode *node, *cbound;
guint channel;
g_return_if_fail (BSE_IS_PART (self));
-
++
min_note = BSE_NOTE_CLAMP (min_note);
max_note = BSE_NOTE_CLAMP (max_note);
for (channel = 0; channel < self->n_channels; channel++)
@@@ -592,6 -666,7 +666,7 @@@ bse_part_set_note_selected (BsePar
guint tick;
g_return_val_if_fail (BSE_IS_PART (self), FALSE);
g_return_val_if_fail (channel < self->n_channels, FALSE);
-
++
tick = bse_part_tick_from_id (self, id);
if (tick > BSE_PART_MAX_TICK)
return FALSE; /* invalid id */
@@@ -612,6 -690,7 +690,7 @@@ bse_part_set_control_selected (BsePar
guint tick;
g_return_val_if_fail (BSE_IS_PART (self), FALSE);
selected = selected != FALSE;
-
++
tick = bse_part_tick_from_id (self, id);
if (tick > BSE_PART_MAX_TICK)
return FALSE; /* invalid id */
@@@ -746,6 -839,7 +839,7 @@@ bse_part_insert_control (BsePar
BsePartEventControl *cev;
guint id;
g_return_val_if_fail (BSE_IS_PART (self), BSE_ERROR_INTERNAL);
-
++
if (!(value >= -1 && value <= +1 &&
tick < BSE_PART_MAX_TICK &&
check_valid_control_type (ctype) &&
@@@ -782,10 -879,12 +879,12 @@@ bse_part_change_note (BsePart *self
BsePartEventNote key = { 0 }, *note;
const bool use_any_channel = channel == ~uint (0);
guint i, old_tick;
-
++
g_return_val_if_fail (BSE_IS_PART (self), FALSE);
if (use_any_channel)
channel = 0;
g_return_val_if_fail (channel < self->n_channels, FALSE);
-
++
if (!(BSE_NOTE_IS_VALID (vnote) && channel < self->n_channels &&
BSE_FINE_TUNE_IS_VALID (fine_tune) &&
tick < BSE_PART_MAX_TICK &&
@@@ -793,6 -892,7 +892,7 @@@
duration < BSE_PART_MAX_TICK &&
tick + duration <= BSE_PART_MAX_TICK))
return FALSE;
-
++
old_tick = bse_part_tick_from_id (self, id);
if (old_tick > BSE_PART_MAX_TICK)
return FALSE; /* invalid id */
@@@ -846,8 -949,10 +949,10 @@@
bse_part_note_channel_change_note (&self->channels[channel], note, key.id, key.selected,
key.note, key.fine_tune, key.velocity);
queue_note_update (self, &key);
-
++
return TRUE;
}
+
gboolean
bse_part_change_control (BsePart *self,
guint id,
@@@ -857,6 -962,7 +962,7 @@@
{
guint old_tick;
g_return_val_if_fail (BSE_IS_PART (self), FALSE);
-
++
if (!(tick < BSE_PART_MAX_TICK &&
check_valid_control_type (ctype) &&
value >= -1 && value <= +1))
@@@ -1099,9 -1220,11 +1220,11 @@@ bse_part_list_controls (BsePar
BseMidiSignalType ctype)
{
BsePartControlSeq *cseq;
-
++
g_return_val_if_fail (BSE_IS_PART (self), NULL);
g_return_val_if_fail (tick < BSE_PART_MAX_TICK, NULL);
g_return_val_if_fail (duration > 0 && duration <= BSE_PART_MAX_TICK, NULL);
-
++
cseq = bse_part_control_seq_new ();
if (BSE_PART_NOTE_CONTROL (ctype))
{
@@@ -1183,7 -1311,9 +1311,9 @@@ bse_part_list_selected_notes (BsePart *
{
BsePartNoteSeq *pseq;
guint channel;
-
++
g_return_val_if_fail (BSE_IS_PART (self), NULL);
-
++
pseq = bse_part_note_seq_new ();
for (channel = 0; channel < self->n_channels; channel++)
{
@@@ -1196,14 -1326,17 +1326,17 @@@
note++;
}
}
-
++
return pseq;
}
+
BsePartControlSeq*
bse_part_list_selected_controls (BsePart *self,
BseMidiSignalType ctype)
{
BsePartControlSeq *cseq;
g_return_val_if_fail (BSE_IS_PART (self), NULL);
-
++
cseq = bse_part_control_seq_new ();
if (BSE_PART_NOTE_CONTROL (ctype))
{
@@@ -1450,6 -1591,7 +1591,7 @@@ bse_part_restore_private (BseObject *o
}
}
parse_or_return (scanner, ')');
-
++
if (!bse_part_insert_note (self, ~0, tick, duration, note, fine_tune, velocity))
bse_storage_warn (storage, "note insertion (note=%d tick=%u duration=%u) failed",
note, tick, duration);
diff --cc bse/bsepart.hh
index 80de4dc,88c0ba7..dce9e5b
--- a/bse/bsepart.hh
+++ b/bse/bsepart.hh
@@@ -11,15 -14,21 +14,17 @@@ G_BEGIN_DECL
#define BSE_IS_PART(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BSE_TYPE_PART))
#define BSE_IS_PART_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), BSE_TYPE_PART))
#define BSE_PART_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BSE_TYPE_PART, BsePartClass))
+
+
/* --- typedefs & structures --- */
-typedef struct {
+struct BsePartControls {
GBSearchArray *bsa;
-} BsePartControls;
-typedef struct {
+};
+struct BsePartNoteChannel {
GBSearchArray *bsa;
-} BsePartNoteChannel;
-struct _BsePart
-{
- BseItem parent_instance;
-
+};
+struct BsePart : BseItem {
const double *semitone_table; // [-132..+132] only updated when not playing
-
/* id -> tick lookups */
guint n_ids;
guint *ids;
@@@ -165,13 -183,16 +172,14 @@@ BsePartEventType bse_part_query_even
#define BSE_PART_INVAL_TICK_FLAG (0x80000000)
#define BSE_PART_NOTE_CONTROL(ctype) ((ctype) == BSE_MIDI_SIGNAL_VELOCITY || \
(ctype) == BSE_MIDI_SIGNAL_FINE_TUNE)
+
/* --- BsePartControlChannel --- */
-typedef struct _BsePartEventControl BsePartEventControl;
-typedef struct
-{
+struct BsePartEventControl;
+struct BsePartTickNode {
guint tick;
BsePartEventControl *events;
-} BsePartTickNode;
-struct _BsePartEventControl
-{
+};
+struct BsePartEventControl {
BsePartEventControl *next;
guint id : 31;
guint selected : 1;
diff --cc bse/bsepart.proc
index d1e7e4e,04bfab2..7cdcdc8
--- a/bse/bsepart.proc
+++ b/bse/bsepart.proc
@@@ -36,19 -40,24 +40,24 @@@ BODY (BseProcedureClass *proc
gfloat velocity = sfi_value_get_real (in_values++);
BseUndoStack *ustack;
guint id;
-
++
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
ustack = bse_item_undo_open (self, "insert-note-auto");
id = bse_part_insert_note (self, ~0, tick, duration, note, fine_tune, velocity);
if (id)
bse_item_push_undo_proc (self, "delete-event", id);
bse_item_undo_close (ustack);
+
/* set output parameters */
sfi_value_set_int (out_values++, id);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, insert-note) {
HELP = "Insert a new note into a part.";
IN = bse_param_spec_object ("part", "Part", NULL,
@@@ -82,19 -91,24 +91,24 @@@ BODY (BseProcedureClass *proc
gfloat velocity = sfi_value_get_real (in_values++);
BseUndoStack *ustack;
guint id;
-
++
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
ustack = bse_item_undo_open (self, "insert-note");
id = bse_part_insert_note (self, channel, tick, duration, note, fine_tune, velocity);
if (id)
bse_item_push_undo_proc (self, "delete-event", id);
bse_item_undo_close (ustack);
+
/* set output parameters */
sfi_value_set_int (out_values++, id);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, insert-control) {
HELP = "Insert a new control event into a part.";
IN = bse_param_spec_object ("part", "Part", NULL,
@@@ -121,19 -135,24 +135,24 @@@ BODY (BseProcedureClass *proc
gfloat value = sfi_value_get_real (in_values++);
BseUndoStack *ustack;
guint id;
-
++
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
ustack = bse_item_undo_open (self, "insert-event");
id = bse_part_insert_control (self, tick, BseMidiSignalType (ctype), value);
if (id)
bse_item_push_undo_proc (self, "delete-event", id);
bse_item_undo_close (ustack);
+
/* set output parameters */
sfi_value_set_int (out_values++, id);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, change-note) {
HELP = "Change an existing note within a part.";
IN = bse_param_spec_object ("part", "Part", NULL,
@@@ -171,6 -191,7 +191,7 @@@ BODY (BseProcedureClass *proc
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
if (bse_part_query_event (self, id, &equery) == BSE_PART_EVENT_NOTE)
{
@@@ -188,10 -209,13 +209,13 @@@
success = TRUE;
bse_item_undo_close (ustack);
}
+
/* set output parameters */
g_value_set_enum (out_values++, success ? BSE_ERROR_NONE : BSE_ERROR_NO_EVENT);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, change-control) {
HELP = "Change an existing control event within a part.";
IN = bse_param_spec_object ("part", "Part", NULL,
@@@ -225,6 -250,7 +250,7 @@@ BODY (BseProcedureClass *proc
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
bse_part_query_event (self, id, &equery);
if (equery.event_type == BSE_PART_EVENT_CONTROL && !BSE_PART_NOTE_CONTROL (ctype))
@@@ -260,10 -286,13 +286,13 @@@
}
bse_item_undo_close (ustack);
}
-
++
/* set output parameters */
g_value_set_enum (out_values++, success ? BSE_ERROR_NONE : BSE_ERROR_NO_EVENT);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, delete-event) {
HELP = "Delete an existing event from a part.";
IN = bse_param_spec_object ("part", "Part", NULL,
@@@ -286,6 -316,7 +316,7 @@@ BODY (BseProcedureClass *proc
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
bse_part_query_event (self, id, &equery);
if (equery.event_type == BSE_PART_EVENT_NOTE)
@@@ -305,10 -336,13 +336,13 @@@
bse_item_push_undo_proc (self, "insert-control", equery.tick, equery.control_type,
equery.control_value);
bse_item_undo_close (ustack);
}
+
/* set output parameters */
g_value_set_enum (out_values++, deleted ? BSE_ERROR_NONE : BSE_ERROR_NO_EVENT);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, is-event-selected) {
HELP = "Check whether an event is selected.";
IN = bse_param_spec_object ("part", "Part", NULL,
@@@ -330,13 -365,17 +365,17 @@@ BODY (BseProcedureClass *proc
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
if (bse_part_query_event (self, id, &equery) != BSE_PART_EVENT_NONE)
selected = equery.selected;
+
/* set output parameters */
sfi_value_set_bool (out_values++, selected);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, list-notes-crossing) {
HELP = "List all notes within or crossing a tick range.";
IN = bse_param_spec_object ("part", "Part", NULL,
@@@ -356,13 -395,17 +395,17 @@@ BODY (BseProcedureClass *proc
BsePart *self = (BsePart*) bse_value_get_object (in_values++);
guint tick = sfi_value_get_int (in_values++);
guint duration = sfi_value_get_int (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
bse_value_take_boxed (out_values++, bse_part_list_notes (self, ~0, tick, duration, BSE_MIN_NOTE,
BSE_MAX_NOTE, TRUE));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, list-notes-within) {
HELP = "List all notes within a tick range.";
IN = bse_param_spec_object ("part", "Part", NULL,
@@@ -385,13 -428,17 +428,17 @@@ BODY (BseProcedureClass *proc
guint channel = sfi_value_get_int (in_values++);
guint tick = sfi_value_get_int (in_values++);
guint duration = sfi_value_get_int (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
bse_value_take_boxed (out_values++, bse_part_list_notes (self, channel, tick, duration, BSE_MIN_NOTE,
BSE_MAX_NOTE, FALSE));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, list-controls) {
HELP = "List all control events within a tick range.";
IN = bse_param_spec_object ("part", "Part", NULL,
@@@ -415,13 -462,17 +462,17 @@@ BODY (BseProcedureClass *proc
guint tick = sfi_value_get_int (in_values++);
guint duration = sfi_value_get_int (in_values++);
guint ctype = g_value_get_enum (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
bse_value_take_boxed (out_values++, bse_part_list_controls (self, ~0, tick, duration, BseMidiSignalType
(ctype)));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, queue-notes) {
HELP = "Queue updates for all notes starting within the given rectangle.";
IN = bse_param_spec_object ("part", "Part", NULL,
@@@ -445,13 -496,17 +496,17 @@@ BODY (BseProcedureClass *proc
guint duration = sfi_value_get_int (in_values++);
gint min_note = sfi_value_get_note (in_values++);
gint max_note = sfi_value_get_note (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
bse_part_queue_notes_within (self, tick, duration, min_note, max_note);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, queue-controls) {
HELP = "Queue updates for all control events and notes starting within the given range.";
IN = bse_param_spec_object ("part", "Part", NULL,
@@@ -469,13 -524,17 +524,17 @@@ BODY (BseProcedureClass *proc
BsePart *self = (BsePart*) bse_value_get_object (in_values++);
guint tick = sfi_value_get_int (in_values++);
guint duration = sfi_value_get_int (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
bse_part_queue_controls (self, tick, duration);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, list-selected-notes) {
HELP = "List all currently selected notes.";
IN = bse_param_spec_object ("part", "Part", NULL,
@@@ -489,13 -548,17 +548,17 @@@ BODY (BseProcedureClass *proc
{
/* extract parameter values */
BsePart *self = (BsePart*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
bse_value_take_boxed (out_values++, bse_part_list_selected_notes (self));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, list-selected-controls) {
HELP = "List all currently selected control events of a specific type.";
IN = bse_param_spec_object ("part", "Part", NULL,
@@@ -513,13 -576,17 +576,17 @@@ BODY (BseProcedureClass *proc
/* extract parameter values */
BsePart *self = (BsePart*) bse_value_get_object (in_values++);
guint ctype = g_value_get_enum (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
bse_value_take_boxed (out_values++, bse_part_list_selected_controls (self, BseMidiSignalType (ctype)));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, check-overlap) {
HELP = "Check whether a note would overlap with neighbours.";
IN = bse_param_spec_object ("part", "Part", NULL,
@@@ -541,13 -608,17 +608,17 @@@ BODY (BseProcedureClass *proc
guint tick = sfi_value_get_int (in_values++);
guint duration = sfi_value_get_int (in_values++);
gint note = sfi_value_get_note (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
bse_value_take_boxed (out_values++, bse_part_list_notes (self, ~0, tick, duration, note, note, TRUE));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, get-notes) {
HELP = "Retrieve all notes of specific frequency at or crossing a specific tick.";
IN = bse_param_spec_object ("part", "Part", NULL,
@@@ -567,13 -638,17 +638,17 @@@ BODY (BseProcedureClass *proc
BsePart *self = (BsePart*) bse_value_get_object (in_values++);
guint tick = sfi_value_get_int (in_values++);
gint note = sfi_value_get_note (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
bse_value_take_boxed (out_values++, bse_part_list_notes (self, ~0, tick, 1, note, note, TRUE));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, get-controls) {
HELP = "Retrieve all control events of a specific type at specified tick.";
IN = bse_param_spec_object ("part", "Part", NULL,
@@@ -594,13 -669,17 +669,17 @@@ BODY (BseProcedureClass *proc
BsePart *self = (BsePart*) bse_value_get_object (in_values++);
guint tick = sfi_value_get_int (in_values++);
guint ctype = g_value_get_enum (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
bse_value_take_boxed (out_values++, bse_part_list_controls (self, ~0, tick, 1, BseMidiSignalType
(ctype)));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, get-channel-controls) {
HELP = "Retrieve all control events of a specific type within range of a channel.";
IN = bse_param_spec_object ("part", "Part", NULL,
@@@ -627,13 -706,17 +706,17 @@@ BODY (BseProcedureClass *proc
guint tick = sfi_value_get_int (in_values++);
guint duration = sfi_value_get_int (in_values++);
guint ctype = g_value_get_enum (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
bse_value_take_boxed (out_values++, bse_part_list_controls (self, channel, tick, duration,
BseMidiSignalType (ctype)));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, get-min-note) {
HELP = "Retrieve the minimum note supported in this part.";
IN = bse_param_spec_object ("part", "Part", NULL,
@@@ -647,13 -730,17 +730,17 @@@ BODY (BseProcedureClass *proc
{
/* extract parameter values */
BsePart *self = (BsePart*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* it doesn't currently make sense to restrict the standard note range */
sfi_value_set_int (out_values++, BSE_MIN_NOTE);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, get-max-note) {
HELP = "Retrieve the maximum note supported in this part.";
IN = bse_param_spec_object ("part", "Part", NULL,
@@@ -667,13 -754,17 +754,17 @@@ BODY (BseProcedureClass *proc
{
/* extract parameter values */
BsePart *self = (BsePart*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* it doesn't currently make sense to restrict the standard note range */
sfi_value_set_int (out_values++, BSE_MAX_NOTE);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, select-notes-exclusive) {
HELP = "Select all notes within rectangle and deselect all others.";
IN = bse_param_spec_object ("part", "Part", "Part",
@@@ -697,12 -788,16 +788,16 @@@ BODY (BseProcedureClass *proc
guint duration = sfi_value_get_int (in_values++);
gint min_note = sfi_value_get_note (in_values++);
gint max_note = sfi_value_get_note (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
bse_part_select_notes_exclusive (self, ~0, tick, duration, min_note, max_note);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, select-controls-exclusive) {
HELP = "Select all control events within range and deselect all others.";
IN = bse_param_spec_object ("part", "Part", "Part",
@@@ -724,12 -819,16 +819,16 @@@ BODY (BseProcedureClass *proc
guint tick = sfi_value_get_int (in_values++);
guint duration = sfi_value_get_int (in_values++);
guint ctype = g_value_get_enum (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
bse_part_select_controls_exclusive (self, tick, duration, BseMidiSignalType (ctype));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, select-controls) {
HELP = "Select all control events within range.";
IN = bse_param_spec_object ("part", "Part", "Part",
@@@ -751,12 -850,16 +850,16 @@@ BODY (BseProcedureClass *proc
guint tick = sfi_value_get_int (in_values++);
guint duration = sfi_value_get_int (in_values++);
guint ctype = g_value_get_enum (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
bse_part_select_controls (self, tick, duration, BseMidiSignalType (ctype), TRUE);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, select-notes) {
HELP = "Select all notes within rectangle.";
IN = bse_param_spec_object ("part", "Part", "Part",
@@@ -780,12 -883,16 +883,16 @@@ BODY (BseProcedureClass *proc
guint duration = sfi_value_get_int (in_values++);
gint min_note = sfi_value_get_note (in_values++);
gint max_note = sfi_value_get_note (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
bse_part_select_notes (self, ~0, tick, duration, min_note, max_note, TRUE);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, deselect-notes) {
HELP = "Deselect all notes within rectangle.";
IN = bse_param_spec_object ("part", "Part", "Part",
@@@ -809,12 -916,16 +916,16 @@@ BODY (BseProcedureClass *proc
guint duration = sfi_value_get_int (in_values++);
gint min_note = sfi_value_get_note (in_values++);
gint max_note = sfi_value_get_note (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
bse_part_select_notes (self, ~0, tick, duration, min_note, max_note, FALSE);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, deselect-controls) {
HELP = "Deselect all controls within given range.";
IN = bse_param_spec_object ("part", "Part", "Part",
@@@ -836,12 -947,16 +947,16 @@@ BODY (BseProcedureClass *proc
guint tick = sfi_value_get_int (in_values++);
guint duration = sfi_value_get_int (in_values++);
guint ctype = g_value_get_enum (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
bse_part_select_controls (self, tick, duration, BseMidiSignalType (ctype), FALSE);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BsePart, select-event) {
HELP = "Select an existing event.";
IN = bse_param_spec_object ("part", "Part", NULL,
@@@ -857,9 -972,11 +972,11 @@@ BODY (BseProcedureClass *proc
BsePart *self = (BsePart*) bse_value_get_object (in_values++);
guint id = sfi_value_get_int (in_values++);
BsePartQueryEvent equery;
-
++
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
bse_part_query_event (self, id, &equery);
if (equery.event_type == BSE_PART_EVENT_CONTROL)
@@@ -885,9 -1003,11 +1003,11 @@@ BODY (BseProcedureClass *proc
BsePart *self = (BsePart*) bse_value_get_object (in_values++);
guint id = sfi_value_get_int (in_values++);
BsePartQueryEvent equery;
-
++
/* check parameters */
if (!BSE_IS_PART (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
bse_part_query_event (self, id, &equery);
if (equery.event_type == BSE_PART_EVENT_CONTROL)
diff --cc bse/bsepattern.hh
index 6bdf54b,afaf2f5..99a0b18
--- a/bse/bsepattern.hh
+++ b/bse/bsepattern.hh
@@@ -28,9 -37,12 +37,12 @@@ struct _BsePatternNot
struct _BsePattern
{
BseItem parent_object;
-
++
guint n_channels /* mirrored from BseSong */;
guint n_rows /* mirrored from BseSong.pattern_length */;
+
BsePatternNote *notes /* ->notes [ row * n_channels + channel] */;
+
/* only used during parsing phase */
guint current_channel;
guint current_row;
@@@ -92,6 -110,8 +110,8 @@@ void bse_pattern_select_note (BseP
void bse_pattern_unselect_note (BsePattern *pattern,
guint channel,
guint row);
-
++
+
/* --- selections --- */
/* selections within a BsePattern are supplied for procedure invocation
* from a pattern editor only, they don't actually affect core BSE
diff --cc bse/bsepcmdevice-null.cc
index 896c921,3aed88a..c7da40e
--- a/bse/bsepcmdevice-null.cc
+++ b/bse/bsepcmdevice-null.cc
@@@ -41,6 -47,7 +45,7 @@@ bse_pcm_device_null_open (BseDevic
{
NullHandle *null = g_new0 (NullHandle, 1);
BsePcmHandle *handle = &null->handle;
-
++
/* setup request */
handle->readable = require_readable;
handle->writable = require_writable;
@@@ -57,9 -64,10 +62,10 @@@
else
null->sleep_us = 10 * 1000;
BSE_PCM_DEVICE (device)->handle = handle;
- DEBUG ("NULL: opening PCM readable=%d writable=%d: %s", require_readable, require_writable,
bse_error_blurb (BSE_ERROR_NONE));
+ PDEBUG ("NULL: opening PCM readable=%d writable=%d: %s", require_readable, require_writable,
bse_error_blurb (BSE_ERROR_NONE));
return BSE_ERROR_NONE;
}
+
static void
bse_pcm_device_null_close (BseDevice *device)
{
@@@ -111,6 -122,7 +119,7 @@@ static voi
bse_pcm_device_null_class_init (BsePcmDeviceNullClass *klass)
{
BseDeviceClass *device_class = BSE_DEVICE_CLASS (klass);
-
++
device_class->list_devices = bse_pcm_device_null_list_devices;
bse_device_class_setup (device_class,
-1,
@@@ -130,11 -143,13 +140,13 @@@ BSE_BUILTIN_TYPE (BsePcmDeviceNull
GType pcm_device_null_type;
static const GTypeInfo pcm_device_null_info = {
sizeof (BsePcmDeviceNullClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_pcm_device_null_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BsePcmDeviceNull),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_pcm_device_null_init,
diff --cc bse/bsepcmdevice-null.hh
index 4ef50aa,2b58078..baf3cc3
--- a/bse/bsepcmdevice-null.hh
+++ b/bse/bsepcmdevice-null.hh
@@@ -10,12 -13,20 +13,14 @@@ G_BEGIN_DECL
#define BSE_IS_PCM_DEVICE_NULL(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object),
BSE_TYPE_PCM_DEVICE_NULL))
#define BSE_IS_PCM_DEVICE_NULL_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), BSE_TYPE_PCM_DEVICE_NULL))
#define BSE_PCM_DEVICE_NULL_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object),
BSE_TYPE_PCM_DEVICE_NULL, BsePcmDeviceNullClass))
+
+
/* --- BsePcmDeviceNull object --- */
-typedef struct _BsePcmDeviceNull BsePcmDeviceNull;
-typedef struct _BsePcmDeviceNullClass BsePcmDeviceNullClass;
-struct _BsePcmDeviceNull
-{
- BsePcmDevice parent_object;
-};
-struct _BsePcmDeviceNullClass
-{
- BsePcmDeviceClass parent_class;
-};
-G_END_DECLS
+struct BsePcmDeviceNull : BsePcmDevice
+{};
+struct BsePcmDeviceNullClass : BsePcmDeviceClass
+{};
+G_END_DECLS
#endif /* __BSE_PCM_DEVICE_NULL_H__ */
diff --cc bse/bsepcmdevice-oss.cc
index a8a3d0e,1e529cd..976e1ac
--- a/bse/bsepcmdevice-oss.cc
+++ b/bse/bsepcmdevice-oss.cc
@@@ -143,6 -159,7 +157,7 @@@ bse_pcm_device_oss_open (BseDevice
omode = require_readable && require_writable ? O_RDWR : require_readable ? O_RDONLY : O_WRONLY;
OSSHandle *oss = g_new0 (OSSHandle, 1);
BsePcmHandle *handle = &oss->handle;
-
++
/* setup request */
handle->n_channels = BSE_PCM_DEVICE (device)->req_n_channels;
handle->mix_freq = BSE_PCM_DEVICE (device)->req_mix_freq;
@@@ -239,6 -267,7 +258,7 @@@ oss_device_setup (OSSHandle *oss
d_int != AFMT_S16_HE)
return BSE_ERROR_DEVICE_FORMAT;
guint bytes_per_value = 2;
-
++
d_int = handle->n_channels - 1;
if (ioctl (fd, SNDCTL_DSP_STEREO, &d_int) < 0)
return BSE_ERROR_DEVICE_CHANNELS;
@@@ -266,6 -297,7 +288,7 @@@
d_int = (oss->n_frags << 16) | g_bit_storage (oss->frag_size - 1);
if (ioctl (fd, SNDCTL_DSP_SETFRAGMENT, &d_int) < 0)
return BSE_ERROR_DEVICE_LATENCY;
-
++
d_int = 0;
if (ioctl (fd, SNDCTL_DSP_GETBLKSIZE, &d_int) < 0 ||
d_int < 128 || d_int > 131072 || (d_int & 1))
@@@ -327,6 -366,7 +352,7 @@@ oss_device_retrigger (OSSHandle *oss
if (oss->handle.writable)
d_int |= PCM_ENABLE_OUTPUT;
(void) ioctl (oss->fd, SNDCTL_DSP_SETTRIGGER, &d_int);
-
++
/* Jaroslav Kysela <perex jcu cz>:
* Important sequence:
* 1) turn on capture
@@@ -495,12 -546,15 +528,15 @@@ oss_device_read (BsePcmHandle *handle
gpointer buf = oss->frag_buf;
gfloat *dest = values;
gsize n_left = n_values;
-
++
g_return_val_if_fail (oss->frame_size == 4, 0);
-
++
do
{
gsize n = MIN (buf_size, n_left << 1);
gint16 *b, *s = (gint16*) buf;
gssize l;
-
++
do
l = read (fd, buf, n);
while (l < 0 && errno == EINTR); /* don't mind signals */
@@@ -532,11 -589,14 +571,14 @@@ oss_device_write (BsePcmHandle *handle
if (handle->readable)
while (oss->read_write_count < 1)
oss_device_read (handle, NULL); /* dummy read to sync device */
-
++
g_return_if_fail (oss->frame_size == 4);
-
++
do
{
gsize n = MIN (buf_size, n_values << 1);
gssize l;
-
++
gsl_conv_from_float_clip (GSL_WAVE_FORMAT_SIGNED_16,
G_BYTE_ORDER,
s,
@@@ -558,8 -619,11 +601,11 @@@ bse_pcm_device_oss_class_init (BsePcmDe
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
BseDeviceClass *device_class = BSE_DEVICE_CLASS (klass);
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->finalize = bse_pcm_device_oss_finalize;
-
++
device_class->list_devices = bse_pcm_device_oss_list_devices;
bse_device_class_setup (klass,
BSE_RATING_DEFAULT,
@@@ -577,17 -642,21 +624,21 @@@
BSE_BUILTIN_TYPE (BsePcmDeviceOSS)
{
GType pcm_device_oss_type;
-
++
static const GTypeInfo pcm_device_oss_info = {
sizeof (BsePcmDeviceOSSClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_pcm_device_oss_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BsePcmDeviceOSS),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_pcm_device_oss_init,
};
-
++
pcm_device_oss_type = bse_type_register_static (BSE_TYPE_PCM_DEVICE,
"BsePcmDeviceOSS",
"PCM device implementation for OSS Lite /dev/dsp",
diff --cc bse/bsepcmdevice.cc
index 44b2f81,4fdcb86..2d2d88f
--- a/bse/bsepcmdevice.cc
+++ b/bse/bsepcmdevice.cc
@@@ -34,6 -42,7 +42,7 @@@ static voi
bse_pcm_device_dispose (GObject *object)
{
BsePcmDevice *pdev = BSE_PCM_DEVICE (object);
-
++
if (BSE_DEVICE_OPEN (pdev))
{
g_warning (G_STRLOC ": pcm device still opened");
@@@ -122,20 -142,24 +132,23 @@@ bse_pcm_handle_check_io (BsePcmHandl
glong dummy;
if (!timeoutp)
timeoutp = &dummy;
- GSL_SPIN_LOCK (&handle->mutex);
+ handle->spinlock.lock();
gboolean can_read_write = handle->check_io (handle, timeoutp);
- GSL_SPIN_UNLOCK (&handle->mutex);
+ handle->spinlock.unlock();
return can_read_write;
}
+
guint
bse_pcm_handle_latency (BsePcmHandle *handle)
{
g_return_val_if_fail (handle != NULL, 0);
- GSL_SPIN_LOCK (&handle->mutex);
+ handle->spinlock.lock();
guint n_frames = handle->latency (handle);
- GSL_SPIN_UNLOCK (&handle->mutex);
+ handle->spinlock.unlock();
return n_frames;
}
+
+
/* --- frequency utilities --- */
guint
bse_pcm_device_frequency_align (gint mix_freq)
@@@ -161,8 -186,11 +175,11 @@@ bse_pcm_device_class_init (BsePcmDevice
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
BseDeviceClass *device_class = BSE_DEVICE_CLASS (klass);
+
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->dispose = bse_pcm_device_dispose;
+
device_class->post_open = pcm_device_post_open;
device_class->pre_close = pcm_device_pre_close;
}
@@@ -170,15 -199,18 +188,18 @@@ BSE_BUILTIN_TYPE (BsePcmDevice
{
static const GTypeInfo pcm_device_info = {
sizeof (BsePcmDeviceClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_pcm_device_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BsePcmDevice),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_pcm_device_init,
};
-
++
return bse_type_register_abstract (BSE_TYPE_DEVICE,
"BsePcmDevice",
"PCM device base type",
diff --cc bse/bsepcmdevice.hh
index e5f1022,4568b1f..e277268
--- a/bse/bsepcmdevice.hh
+++ b/bse/bsepcmdevice.hh
@@@ -63,7 -83,12 +68,12 @@@ void bse_pcm_handle_write (BsePcmHand
gboolean bse_pcm_handle_check_io (BsePcmHandle *handle,
glong *timeoutp);
guint bse_pcm_handle_latency (BsePcmHandle *handle);
+
+
/* --- misc utils --- */
guint bse_pcm_device_frequency_align (gint mix_freq);
-
++
+
G_END_DECLS
+
#endif /* __BSE_PCM_DEVICE_H__ */
diff --cc bse/bsepcminput.cc
index addad12,2a524c8..029bcb4
--- a/bse/bsepcminput.cc
+++ b/bse/bsepcminput.cc
@@@ -38,11 -48,13 +48,13 @@@ BSE_BUILTIN_TYPE (BsePcmInput
{
static const GTypeInfo pcm_input_info = {
sizeof (BsePcmInputClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_pcm_input_class_init,
(GClassFinalizeFunc) bse_pcm_input_class_finalize,
NULL /* class_data */,
-
++
sizeof (BsePcmInput),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_pcm_input_init,
@@@ -64,13 -77,17 +77,17 @@@ bse_pcm_input_class_init (BsePcmInputCl
BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
guint ochannel_id;
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = bse_pcm_input_set_property;
gobject_class->get_property = bse_pcm_input_get_property;
-
++
source_class->prepare = bse_pcm_input_prepare;
source_class->context_create = bse_pcm_input_context_create;
source_class->context_connect = bse_pcm_input_context_connect;
source_class->reset = bse_pcm_input_reset;
-
++
bse_object_class_add_param (object_class, "Adjustments",
PARAM_MVOLUME_f,
sfi_pspec_real ("gain_volume_f", "Input Gain [float]", NULL,
@@@ -91,6 -108,7 +108,7 @@@
bse_db_to_factor (0) * 100,
0, bse_db_to_factor (BSE_MAX_VOLUME_dB) * 100,
1, SFI_PARAM_GUI ":dial"));
-
++
ochannel_id = bse_source_class_add_ochannel (source_class, "left-audio-out", _("Left Audio Out"), _("Left
channel output"));
g_assert (ochannel_id == BSE_PCM_INPUT_OCHANNEL_LEFT);
ochannel_id = bse_source_class_add_ochannel (source_class, "right-audio-out", _("Right Audio Out"),
_("Right channel output"));
@@@ -161,7 -184,9 +184,9 @@@ static voi
bse_pcm_input_prepare (BseSource *source)
{
BsePcmInput *iput = BSE_PCM_INPUT (source);
-
++
iput->uplink = bse_server_retrieve_pcm_input_module (bse_server_get (), source, "MasterIn");
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->prepare (source);
}
@@@ -179,6 -206,7 +206,7 @@@ pcm_input_process (BseModule *module
gfloat *ld = BSE_MODULE_OBUFFER (module, BSE_PCM_INPUT_OCHANNEL_LEFT);
gfloat *rd = BSE_MODULE_OBUFFER (module, BSE_PCM_INPUT_OCHANNEL_RIGHT);
gfloat v = mdata->volume;
-
++
if (mdata->volume_set)
while (n_values--)
{
@@@ -208,12 -237,16 +237,16 @@@ bse_pcm_input_context_create (BseSourc
};
ModData *mdata = g_new0 (ModData, 1);
BseModule *module = bse_module_new (&pcm_input_mclass, mdata);
-
++
mdata->volume = 1.0;
mdata->volume_set = mdata->volume != 1.0;
-
++
/* setup module i/o streams with BseSource i/o channels */
bse_source_set_context_omodule (source, context_handle, module);
-
++
/* commit module to engine */
bse_trans_add (trans, bse_job_integrate (module));
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_create (source, context_handle, trans);
}
@@@ -224,11 -258,14 +258,14 @@@ bse_pcm_input_context_connect (BseSourc
{
BsePcmInput *iput = BSE_PCM_INPUT (source);
BseModule *module;
-
++
/* get context specific module */
module = bse_source_get_context_omodule (source, context_handle);
-
++
/* connect module to server uplink */
bse_trans_add (trans, bse_job_connect (iput->uplink, 0, module, 0));
bse_trans_add (trans, bse_job_connect (iput->uplink, 1, module, 1));
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_connect (source, context_handle, trans);
}
@@@ -236,8 -274,10 +274,10 @@@ static voi
bse_pcm_input_reset (BseSource *source)
{
BsePcmInput *iput = BSE_PCM_INPUT (source);
-
++
bse_server_discard_pcm_input_module (bse_server_get (), iput->uplink);
iput->uplink = NULL;
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->reset (source);
}
diff --cc bse/bsepcmmodule.cc
index a041723,5ed17c2..e076af8
--- a/bse/bsepcmmodule.cc
+++ b/bse/bsepcmmodule.cc
@@@ -55,7 -62,9 +62,9 @@@ bse_pcm_omodule_process (BseModule *mod
gfloat *b = mdata->bound;
const gfloat *src;
guint i;
-
++
g_return_if_fail (n_values == mdata->n_values / BSE_PCM_MODULE_N_JSTREAMS);
-
++
if (BSE_MODULE_JSTREAM (module, BSE_PCM_MODULE_JSTREAM_LEFT).n_connections)
src = BSE_MODULE_JBUFFER (module, BSE_PCM_MODULE_JSTREAM_LEFT, 0);
else
@@@ -68,6 -77,7 +77,7 @@@
d = mdata->buffer;
do { *d += *src++; d += 2; } while (d < b);
}
-
++
if (BSE_MODULE_JSTREAM (module, BSE_PCM_MODULE_JSTREAM_RIGHT).n_connections)
src = BSE_MODULE_JBUFFER (module, BSE_PCM_MODULE_JSTREAM_RIGHT, 0);
else
@@@ -80,6 -90,7 +90,7 @@@
d = mdata->buffer + 1;
do { *d += *src++; d += 2; } while (d < b);
}
-
++
bse_pcm_handle_write (mdata->handle, mdata->n_values, mdata->buffer);
if (mdata->pcm_writer)
bse_pcm_writer_write (mdata->pcm_writer, mdata->n_values, mdata->buffer);
@@@ -89,6 -101,7 +101,7 @@@ bse_pcm_module_data_free (gpointe
const BseModuleClass *klass)
{
BsePCMModuleData *mdata = (BsePCMModuleData*) data;
-
++
g_free (mdata->buffer);
g_free (mdata);
}
@@@ -109,9 -123,11 +123,11 @@@ bse_pcm_omodule_insert (BsePcmHandle *h
};
BsePCMModuleData *mdata;
BseModule *module;
-
++
g_return_val_if_fail (handle != NULL, NULL);
g_return_val_if_fail (handle->write != NULL, NULL);
g_return_val_if_fail (trans != NULL, NULL);
-
++
mdata = g_new0 (BsePCMModuleData, 1);
mdata->n_values = bse_engine_block_size () * BSE_PCM_MODULE_N_JSTREAMS;
mdata->buffer = g_new0 (gfloat, mdata->n_values);
@@@ -119,14 -135,17 +135,17 @@@
mdata->handle = handle;
mdata->pcm_writer = writer;
module = bse_module_new (&pcm_omodule_class, mdata);
-
++
bse_trans_add (trans,
bse_job_integrate (module));
bse_trans_add (trans,
bse_job_set_consumer (module, TRUE));
bse_trans_add (trans,
bse_job_add_poll (bse_pcm_module_poll, mdata, NULL, 0, NULL));
-
++
return module;
}
+
static void
bse_pcm_omodule_remove (BseModule *pcm_module,
BseTrans *trans)
@@@ -164,7 -187,9 +187,9 @@@ bse_pcm_imodule_process (BseModule *mod
gfloat *left = BSE_MODULE_OBUFFER (module, BSE_PCM_MODULE_OSTREAM_LEFT);
gfloat *right = BSE_MODULE_OBUFFER (module, BSE_PCM_MODULE_OSTREAM_RIGHT);
gsize l;
-
++
g_return_if_fail (n_values <= mdata->n_values / BSE_PCM_MODULE_N_OSTREAMS);
+
if (mdata->handle->readable)
{
l = bse_pcm_handle_read (mdata->handle, mdata->n_values, mdata->buffer);
@@@ -198,9 -225,11 +225,11 @@@ bse_pcm_imodule_insert (BsePcmHandle *h
};
BsePCMModuleData *mdata;
BseModule *module;
-
++
g_return_val_if_fail (handle != NULL, NULL);
g_return_val_if_fail (handle->write != NULL, NULL);
g_return_val_if_fail (trans != NULL, NULL);
-
++
mdata = g_new0 (BsePCMModuleData, 1);
mdata->n_values = bse_engine_block_size () * BSE_PCM_MODULE_N_OSTREAMS;
mdata->buffer = g_new0 (gfloat, mdata->n_values);
@@@ -208,10 -237,13 +237,13 @@@
mdata->handle = handle;
mdata->pcm_writer = NULL;
module = bse_module_new (&pcm_imodule_class, mdata);
-
++
bse_trans_add (trans,
bse_job_integrate (module));
-
++
return module;
}
+
static void
bse_pcm_imodule_remove (BseModule *pcm_module,
BseTrans *trans)
diff --cc bse/bsepcmoutput.cc
index bff5dad,9ff937b..5d81ce7
--- a/bse/bsepcmoutput.cc
+++ b/bse/bsepcmoutput.cc
@@@ -38,11 -48,13 +48,13 @@@ BSE_BUILTIN_TYPE (BsePcmOutput
{
static const GTypeInfo pcm_output_info = {
sizeof (BsePcmOutputClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_pcm_output_class_init,
(GClassFinalizeFunc) bse_pcm_output_class_finalize,
NULL /* class_data */,
-
++
sizeof (BsePcmOutput),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_pcm_output_init,
@@@ -64,13 -77,17 +77,17 @@@ bse_pcm_output_class_init (BsePcmOutput
BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
guint ichannel_id;
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = bse_pcm_output_set_property;
gobject_class->get_property = bse_pcm_output_get_property;
-
++
source_class->prepare = bse_pcm_output_prepare;
source_class->context_create = bse_pcm_output_context_create;
source_class->context_connect = bse_pcm_output_context_connect;
source_class->reset = bse_pcm_output_reset;
-
++
bse_object_class_add_param (object_class, "Adjustments",
PARAM_MVOLUME_f,
sfi_pspec_real ("master_volume_f", "Master [float]", NULL,
@@@ -91,6 -108,7 +108,7 @@@
bse_db_to_factor (0) * 100,
0, bse_db_to_factor (BSE_MAX_VOLUME_dB) * 100,
1, SFI_PARAM_GUI ":dial"));
-
++
ichannel_id = bse_source_class_add_ichannel (source_class, "left-audio-in", _("Left Audio In"), _("Left
channel input"));
g_assert (ichannel_id == BSE_PCM_OUTPUT_ICHANNEL_LEFT);
ichannel_id = bse_source_class_add_ichannel (source_class, "right-audio-in", _("Right Audio In"),
_("Right channel Input"));
@@@ -161,7 -184,9 +184,9 @@@ static voi
bse_pcm_output_prepare (BseSource *source)
{
BsePcmOutput *oput = BSE_PCM_OUTPUT (source);
-
++
oput->uplink = bse_server_retrieve_pcm_output_module (bse_server_get (), source, "MasterOut");
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->prepare (source);
}
@@@ -179,6 -206,7 +206,7 @@@ pcm_output_process (BseModule *module
gfloat *ld = BSE_MODULE_OBUFFER (module, BSE_PCM_OUTPUT_ICHANNEL_LEFT);
gfloat *rd = BSE_MODULE_OBUFFER (module, BSE_PCM_OUTPUT_ICHANNEL_RIGHT);
gfloat v = mdata->volume;
-
++
if (mdata->volume_set)
while (n_values--)
{
@@@ -208,12 -237,16 +237,16 @@@ bse_pcm_output_context_create (BseSourc
};
ModData *mdata = g_new0 (ModData, 1);
BseModule *module = bse_module_new (&pcm_output_mclass, mdata);
-
++
mdata->volume = 1.0;
mdata->volume_set = mdata->volume != 1.0;
-
++
/* setup module i/o streams with BseSource i/o channels */
bse_source_set_context_imodule (source, context_handle, module);
-
++
/* commit module to engine */
bse_trans_add (trans, bse_job_integrate (module));
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_create (source, context_handle, trans);
}
@@@ -224,11 -258,14 +258,14 @@@ bse_pcm_output_context_connect (BseSour
{
BsePcmOutput *oput = BSE_PCM_OUTPUT (source);
BseModule *module;
-
++
/* get context specific module */
module = bse_source_get_context_imodule (source, context_handle);
-
++
/* connect module to server uplink */
bse_trans_add (trans, bse_job_jconnect (module, 0, oput->uplink, 0));
bse_trans_add (trans, bse_job_jconnect (module, 1, oput->uplink, 1));
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_connect (source, context_handle, trans);
}
@@@ -236,8 -274,10 +274,10 @@@ static voi
bse_pcm_output_reset (BseSource *source)
{
BsePcmOutput *oput = BSE_PCM_OUTPUT (source);
-
++
bse_server_discard_pcm_output_module (bse_server_get (), oput->uplink);
oput->uplink = NULL;
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->reset (source);
}
diff --cc bse/bsepcmwriter.cc
index 40c8e73,08bd307..684b54d
--- a/bse/bsepcmwriter.cc
+++ b/bse/bsepcmwriter.cc
@@@ -80,9 -98,10 +80,10 @@@ bse_pcm_writer_open (BsePcmWriter *self
fd = open (file, O_WRONLY | O_CREAT | O_TRUNC, 0666);
if (fd < 0)
{
- sfi_mutex_unlock (&self->mutex);
+ self->mutex.unlock();
return bse_error_from_errno (errno, BSE_ERROR_FILE_OPEN_FAILED);
}
+
errno = bse_wave_file_dump_header (fd, 0x7fff0000, 16, n_channels, sample_freq);
if (errno)
{
@@@ -106,9 -128,10 +107,10 @@@ bse_pcm_writer_close (BsePcmWriter *sel
close (self->fd);
self->fd = -1;
self->open = FALSE;
- sfi_mutex_unlock (&self->mutex);
+ self->mutex.unlock();
errno = 0;
}
+
static gboolean
bsethread_halt_recording (gpointer data)
{
diff --cc bse/bsepcmwriter.hh
index 0c9faf0,49f1269..db3d411
--- a/bse/bsepcmwriter.hh
+++ b/bse/bsepcmwriter.hh
@@@ -10,9 -13,13 +13,11 @@@ G_BEGIN_DECL
#define BSE_IS_PCM_WRITER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BSE_TYPE_PCM_WRITER))
#define BSE_IS_PCM_WRITER_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), BSE_TYPE_PCM_WRITER))
#define BSE_PCM_WRITER_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BSE_TYPE_PCM_WRITER,
BsePcmWriterClass))
+
+
/* --- BsePcmWriter --- */
-struct _BsePcmWriter
-{
- BseItem parent_instance;
- BirnetMutex mutex;
+struct BsePcmWriter : BseItem {
+ Bse::Mutex mutex;
guint open : 1;
guint broken : 1;
gint fd;
diff --cc bse/bseplugin.cc
index 29595c7,d4e28c0..328067d
--- a/bse/bseplugin.cc
+++ b/bse/bseplugin.cc
@@@ -64,8 -73,10 +70,10 @@@ static voi
bse_plugin_dispose (GObject *object)
{
BsePlugin *plugin = BSE_PLUGIN (object);
+
if (plugin->gmodule || plugin->use_count || plugin->n_types)
g_warning ("%s: plugin partially initialized during destruciton", G_STRFUNC);
-
++
/* chain parent class handler */
G_OBJECT_CLASS (g_type_class_peek_parent (BSE_PLUGIN_GET_CLASS (plugin)))->dispose (object);
}
@@@ -73,10 -85,13 +82,13 @@@ static voi
bse_plugin_finalize (GObject *object)
{
BsePlugin *plugin = BSE_PLUGIN (object);
+
if (plugin->gmodule || plugin->use_count || plugin->n_types)
g_warning ("%s: plugin partially initialized during destruciton", G_STRFUNC);
-
++
/* chain parent class handler */
G_OBJECT_CLASS (g_type_class_peek_parent (BSE_PLUGIN_GET_CLASS (plugin)))->finalize (object);
+
g_free (plugin->fname);
g_free (plugin->types);
}
@@@ -84,6 -100,7 +97,7 @@@ static voi
bse_plugin_class_init (BsePluginClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
++
gobject_class->dispose = bse_plugin_dispose;
gobject_class->finalize = bse_plugin_finalize;
}
@@@ -320,8 -360,10 +350,10 @@@ bse_plugin_complete_info (GTypePlugi
{
BsePlugin *plugin = BSE_PLUGIN (gplugin);
BseExportNode *node;
+
g_return_if_fail (plugin != NULL);
g_return_if_fail (plugin->use_count > 0);
-
++
for (node = plugin->chain; node && node->ntype; node = node->next)
if (node->type == type)
{
@@@ -534,7 -583,9 +573,9 @@@ bse_plugin_check_load (const gchar *con
GModule *gmodule;
gchar *error = NULL;
const gchar *cerror = NULL;
-
++
g_return_val_if_fail (const_file_name != NULL, NULL);
+
if (0) /* want to read .la files? */
{
const gint TOKEN_DLNAME = G_TOKEN_LAST + 1;
@@@ -545,15 -596,18 +586,18 @@@
return (errno == ENOENT || errno == ENOTDIR || errno == ELOOP ?
bse_error_blurb (BSE_ERROR_FILE_NOT_FOUND) :
"Unable to access plugin");
-
++
/* and search libtool's dlname specification */
scanner = g_scanner_new64 (NULL);
g_scanner_input_file (scanner, fd);
scanner->config->symbol_2_token = TRUE;
g_scanner_add_symbol (scanner, "dlname", GUINT_TO_POINTER (TOKEN_DLNAME));
-
++
/* skip ahead */
while (!g_scanner_eof (scanner) &&
g_scanner_peek_next_token (scanner) != TOKEN_DLNAME)
g_scanner_get_next_token (scanner);
-
++
/* parse dlname */
if (g_scanner_get_next_token (scanner) != TOKEN_DLNAME ||
g_scanner_get_next_token (scanner) != '=' ||
@@@ -561,8 -615,10 +605,10 @@@
{
g_scanner_destroy (scanner);
close (fd);
-
++
return "Plugin's dlname broken";
}
-
++
/* construct real module name */
if (g_path_is_absolute (scanner->value.v_string))
file_name = g_strdup (scanner->value.v_string);
diff --cc bse/bseprobe.cc
index 79e20fa,5421e27..fd9136c
--- a/bse/bseprobe.cc
+++ b/bse/bseprobe.cc
@@@ -313,8 -313,10 +318,10 @@@ public
}
};
private:
- BIRNET_PRIVATE_CLASS_COPY (ProbeQueue);
+ RAPICORN_CLASS_NON_COPYABLE (ProbeQueue);
};
+
+
/* --- SourceProbes --- */
class SourceProbes {
typedef std::set<ProbeQueue*, ProbeQueue::KeyLesser> ProbeQueueSet;
diff --cc bse/bseprocedure.cc
index d0f5752,2ac1eb8..a14d55f
--- a/bse/bseprocedure.cc
+++ b/bse/bseprocedure.cc
@@@ -38,6 -42,7 +39,7 @@@ static voi
bse_procedure_base_finalize (BseProcedureClass *proc)
{
guint i;
-
++
/* give up type references */
for (i = 0; proc->class_refs[i]; i++)
g_type_class_unref (proc->class_refs[i]);
@@@ -49,8 -55,10 +52,10 @@@
for (i = 0; i < proc->n_out_pspecs; i++)
g_param_spec_unref (proc->out_pspecs[i]);
g_free (proc->out_pspecs);
-
++
proc->execute = NULL;
}
+
static void
bse_procedure_init (BseProcedureClass *proc,
const BseExportNodeProc *pnode)
@@@ -58,9 -66,12 +63,12 @@@
GParamSpec *in_pspecs[BSE_PROCEDURE_MAX_IN_PARAMS + 8];
GParamSpec *out_pspecs[BSE_PROCEDURE_MAX_OUT_PARAMS + 8];
guint i, j;
-
++
memset (in_pspecs, 0, sizeof (in_pspecs));
memset (out_pspecs, 0, sizeof (out_pspecs));
-
++
proc->private_id = pnode->private_id;
-
++
/* init procedure class from plugin,
* paranoia check certain class members
*/
@@@ -76,6 -87,7 +84,7 @@@
proc->execute = NULL;
g_warning ("procedure \"%s\" messes with reserved class members", BSE_PROCEDURE_NAME (proc));
}
-
++
/* check input parameters and setup specifications */
for (i = 0; i < BSE_PROCEDURE_MAX_IN_PARAMS; i++)
if (in_pspecs[i])
@@@ -95,6 -107,7 +104,7 @@@
proc->in_pspecs = g_new (GParamSpec*, proc->n_in_pspecs + 1);
memcpy (proc->in_pspecs, in_pspecs, sizeof (in_pspecs[0]) * proc->n_in_pspecs);
proc->in_pspecs[proc->n_in_pspecs] = NULL;
-
++
/* check output parameters and setup specifications */
for (i = 0; i < BSE_PROCEDURE_MAX_OUT_PARAMS; i++)
if (out_pspecs[i])
@@@ -161,15 -178,21 +175,21 @@@ bse_procedure_type_register (const gcha
if (!g_type_is_a (base_type, BSE_TYPE_OBJECT))
return "Procedure base type invalid";
}
-
++
type = bse_type_register_dynamic (BSE_TYPE_PROCEDURE, name, G_TYPE_PLUGIN (plugin));
-
++
*ret_type = type;
-
++
return NULL;
}
+
GType
bse_procedure_lookup (const gchar *proc_name)
{
GType type;
-
++
g_return_val_if_fail (proc_name != NULL, 0);
-
++
type = g_type_from_name (proc_name);
return BSE_TYPE_IS_PROCEDURE (type) ? type : 0;
}
@@@ -185,6 -209,7 +206,7 @@@ signal_exec_status (BseErrorType
g_type_is_a (G_VALUE_TYPE (first_ovalue), BSE_TYPE_ERROR_TYPE))
{
BseErrorType verror = g_value_get_enum (first_ovalue);
-
++
bse_server_exec_status (bse_server_get (), BSE_EXEC_STATUS_DONE, BSE_PROCEDURE_NAME (proc), verror ?
0 : 1, verror);
}
else
@@@ -200,9 -226,11 +223,11 @@@ bse_procedure_call (BseProcedureClass
{
guint i, bail_out = FALSE;
BseErrorType error;
-
++
for (i = 0; i < proc->n_in_pspecs; i++)
{
GParamSpec *pspec = proc->in_pspecs[i];
-
++
if (g_param_value_validate (pspec, ivalues + i) && !(pspec->flags & G_PARAM_LAX_VALIDATION))
{
g_warning ("%s: input arg `%s' contains invalid value",
@@@ -211,6 -239,7 +236,7 @@@
bail_out = TRUE;
}
}
-
++
if (bail_out)
error = BSE_ERROR_PROC_PARAM_INVAL;
else
@@@ -228,16 -257,20 +254,20 @@@
else
error = proc->execute (proc, ivalues, ovalues);
}
-
++
for (i = 0; i < proc->n_out_pspecs; i++)
{
GParamSpec *pspec = proc->out_pspecs[i];
-
++
if (g_param_value_validate (pspec, ovalues + i) && !(pspec->flags & G_PARAM_LAX_VALIDATION))
g_warning ("%s: internal procedure error: output arg `%s' had invalid value",
BSE_PROCEDURE_NAME (proc),
pspec->name);
}
-
++
return error;
}
+
BseErrorType
bse_procedure_marshal (GType proc_type,
const GValue *ivalues,
@@@ -270,16 -303,19 +300,19 @@@
tmp_ovalues[i].g_type = 0;
g_value_init (tmp_ovalues + i, G_PARAM_SPEC_VALUE_TYPE (proc->out_pspecs[i]));
}
-
++
if (bail_out)
error = BSE_ERROR_PROC_PARAM_INVAL;
else
error = bse_procedure_call (proc, tmp_ivalues, tmp_ovalues, marshal, marshal_data);
signal_exec_status (error, proc, tmp_ovalues);
-
++
for (i = 0; i < proc->n_in_pspecs; i++)
g_value_unset (tmp_ivalues + i);
for (i = 0; i < proc->n_out_pspecs; i++)
{
GParamSpec *pspec = proc->out_pspecs[i];
-
++
if (!sfi_value_transform (tmp_ovalues + i, ovalues + i))
g_warning ("%s: output arg `%s' of type `%s' cannot be converted into `%s'",
BSE_PROCEDURE_NAME (proc),
@@@ -289,8 -325,10 +322,10 @@@
g_value_unset (tmp_ovalues + i);
}
procedure_class_unref (proc);
-
++
return error;
}
+
static inline BseErrorType
bse_procedure_call_collect (BseProcedureClass *proc,
const GValue *first_value,
@@@ -334,6 -374,7 +369,7 @@@
{
GParamSpec *pspec = proc->in_pspecs[i];
gchar *error_msg = NULL;
-
++
ivalues[i].g_type = 0;
g_value_init (ivalues + i, G_PARAM_SPEC_VALUE_TYPE (pspec));
if (!bail_out)
@@@ -363,8 -406,9 +401,9 @@@
error = BSE_ERROR_PROC_PARAM_INVAL;
else
error = bse_procedure_call (proc, ivalues, ovalues, marshal, marshal_data);
- HACK_DEBUG (" call result: %s", bse_error_blurb (error));
+ PDEBUG (" call result: %s", bse_error_blurb (error));
signal_exec_status (error, proc, ovalues);
+
/* free input arguments */
for (i = 0; i < proc->n_in_pspecs; i++)
g_value_unset (ivalues + i);
@@@ -373,6 -418,7 +413,7 @@@
{
GParamSpec *pspec = proc->out_pspecs[i];
gchar *error_msg = NULL;
-
++
if (!skip_ovalues)
G_VALUE_LCOPY (ovalues + i, var_args, 0, &error_msg);
if (error_msg)
@@@ -458,7 -509,9 +502,9 @@@ bse_procedure_exec (const gchar *proc_n
...)
{
GType proc_type;
-
++
g_return_val_if_fail (proc_name != NULL, BSE_ERROR_INTERNAL);
-
++
proc_type = bse_procedure_lookup (proc_name);
if (!proc_type)
{
@@@ -469,6 -522,7 +515,7 @@@
{
BseErrorType error;
va_list var_args;
-
++
va_start (var_args, proc_name);
error = bse_procedure_marshal_valist (proc_type, NULL, NULL, NULL, FALSE, var_args);
va_end (var_args);
@@@ -480,7 -535,9 +528,9 @@@ bse_procedure_exec_void (const gchar *p
...)
{
GType proc_type;
-
++
g_return_val_if_fail (proc_name != NULL, BSE_ERROR_INTERNAL);
-
++
proc_type = bse_procedure_lookup (proc_name);
if (!proc_type)
{
@@@ -491,6 -548,7 +541,7 @@@
{
BseErrorType error;
va_list var_args;
-
++
va_start (var_args, proc_name);
error = bse_procedure_marshal_valist (proc_type, NULL, NULL, NULL, TRUE, var_args);
va_end (var_args);
@@@ -509,7 -568,9 +561,9 @@@ bse_procedure_execvl (BseProcedureClas
BseErrorType error;
GSList *slist;
guint i;
-
++
/* FIXME: bad, bad compat: bse_procedure_execvl() */
-
++
for (i = 0, slist = in_value_list; slist && i < proc->n_in_pspecs; i++, slist = slist->next)
memcpy (tmp_ivalues + i, slist->data, sizeof (tmp_ivalues[0]));
if (slist || i != proc->n_in_pspecs)
@@@ -631,11 -699,13 +692,13 @@@ bse_type_register_procedure_info (GType
{
static const GTypeInfo proc_info = {
sizeof (BseProcedureClass),
-
++
(GBaseInitFunc) bse_procedure_base_init,
(GBaseFinalizeFunc) bse_procedure_base_finalize,
(GClassInitFunc) NULL,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
/* non classed type stuff */
0, 0, NULL,
};
diff --cc bse/bseprocedure.hh
index b425102,5040144..93b9442
--- a/bse/bseprocedure.hh
+++ b/bse/bseprocedure.hh
@@@ -31,8 -40,11 +40,11 @@@ struct _BseProcedureClas
GTypeClass **class_refs;
guint cache_stamp;
gpointer cache_next;
-
++
BseProcedureExec execute;
};
+
+
/* --- notifiers --- */
typedef gboolean (*BseProcedureNotify) (gpointer func_data,
const gchar *proc_name,
diff --cc bse/bseprocedure.proc
index ff27a63,f656edb..1c1e5b7
--- a/bse/bseprocedure.proc
+++ b/bse/bseprocedure.proc
@@@ -29,6 -32,7 +32,7 @@@ PROCEDURE (bse-note-to-freq, "Note to F
int fine_tune = sfi_value_get_int (in_values++);
BseNoteDescription *info;
gfloat freq;
-
++
/* action */
info = bse_note_description (musical_tuning, note, fine_tune);
if (!info->name)
@@@ -36,10 -40,13 +40,13 @@@
else
freq = info->freq;
bse_note_description_free (info);
-
++
/* set out params */
sfi_value_set_real (out_values++, freq);
-
++
return BSE_ERROR_NONE;
}
+
PROCEDURE (bse-note-from-freq, "Note from Freq") {
HELP = "Retrieve the note of a certain frequency.";
IN = bse_param_spec_enum ("musical_tuning", "Musical Tuning", NULL,
@@@ -55,10 -62,13 +62,13 @@@
/* extract parameter values */
BseMusicalTuningType musical_tuning = (BseMusicalTuningType) g_value_get_enum (in_values++);
float frequency = sfi_value_get_real (in_values++);
-
++
/* set out params */
sfi_value_set_int (out_values++, bse_note_from_freq (musical_tuning, frequency));
-
++
return BSE_ERROR_NONE;
}
+
PROCEDURE (bse-note-describe, "Describe Note") {
HELP = "Describe a note, providing information about its octave, semitone, frequency, etc.";
IN = bse_param_spec_enum ("musical_tuning", "Musical Tuning", NULL,
@@@ -76,10 -86,13 +86,13 @@@ BODY (BseProcedureClass *proc
BseMusicalTuningType musical_tuning = (BseMusicalTuningType) g_value_get_enum (in_values++);
int note = sfi_value_get_int (in_values++);
int fine_tune = sfi_value_get_int (in_values++);
-
++
/* describe note */
bse_value_take_boxed (out_values++, bse_note_description (musical_tuning, note, fine_tune));
-
++
return BSE_ERROR_NONE;
}
+
PROCEDURE (bse-note-describe-from-freq, "Describe Note From Freq") {
HELP = "Describe a note, given its frequency.";
IN = bse_param_spec_enum ("musical_tuning", "Musical Tuning", NULL,
@@@ -99,11 -112,14 +112,14 @@@ BODY (BseProcedureClass *proc
BseMusicalTuningType musical_tuning = (BseMusicalTuningType) g_value_get_enum (in_values++);
float freq = sfi_value_get_real (in_values++);
gint note;
-
++
/* describe note */
note = bse_note_from_freq (musical_tuning, freq);
bse_value_take_boxed (out_values++, bse_note_description (musical_tuning, note, 0));
-
++
return BSE_ERROR_NONE;
}
+
PROCEDURE (bse-note-from-string, "Note From String") {
HELP = "Describe a note, given its name and octave offset.";
IN = bse_param_spec_enum ("musical_tuning", "Musical Tuning", NULL,
@@@ -121,11 -137,14 +137,14 @@@ BODY (BseProcedureClass *proc
BseMusicalTuningType musical_tuning = (BseMusicalTuningType) g_value_get_enum (in_values++);
const char *name = sfi_value_get_string (in_values++);
gint note;
-
++
/* describe note */
note = bse_note_from_string (name);
bse_value_take_boxed (out_values++, bse_note_description (musical_tuning, note, 0));
-
++
return BSE_ERROR_NONE;
}
+
PROCEDURE (bse-note-construct, "Note Construction") {
HELP = "Describe a note, given its semitone, octave and fine tune.";
IN = bse_param_spec_enum ("musical_tuning", "Musical Tuning", NULL,
@@@ -148,11 -167,14 +167,14 @@@ BODY (BseProcedureClass *proc
int octave = sfi_value_get_int (in_values++);
int fine_tune = sfi_value_get_int (in_values++);
int note;
-
++
/* describe note */
note = BSE_NOTE_GENERIC (octave, semitone);
bse_value_take_boxed (out_values++, bse_note_description (musical_tuning, note, fine_tune));
-
++
return BSE_ERROR_NONE;
}
+
PROCEDURE (bse-type-options, "Type Options") {
HELP = "Retrieve the options of a specific type.";
IN = sfi_pspec_string ("type", NULL, NULL, NULL, SFI_PARAM_STANDARD);
diff --cc bse/bseprocidl.cc
index ca41cc4,e527b61..cb10541
--- a/bse/bseprocidl.cc
+++ b/bse/bseprocidl.cc
@@@ -15,6 -18,7 +18,7 @@@ bool silent = false
void print(const gchar *format, ...)
{
va_list args;
-
++
va_start (args, format);
if (!silent) vfprintf (stdout, format, args);
va_end (args);
@@@ -31,11 -38,13 +38,13 @@@ std::string removeBse (const std::strin
std::string getInterface (const std::string& name)
{
int i = name.find ("+", 0);
-
++
if(i >= 0)
{
std::string result = name.substr (0, i);
if (strncmp (result.c_str(), "Bse", 3) == 0)
result = name.substr (3, i-3);
-
++
return result;
}
return "";
@@@ -44,11 -54,13 +54,13 @@@ std::string getMethod (const std::strin
{
std::string result;
std::string::const_iterator ni = name.begin ();
-
++
int pos = name.find ("+", 0);
if (pos >= 0)
ni += pos + 1;
else if (name.size () > 4)
ni += 4; /* assume & skip bse prefix */
-
++
while (ni != name.end ())
{
if (*ni == '-')
@@@ -64,6 -77,7 +77,7 @@@ signalName (const std::string& signal
{
std::string result;
std::string::const_iterator si = signal.begin ();
-
++
while (si != signal.end ())
{
if (*si == '-')
@@@ -105,7 -123,9 +123,9 @@@ void setActiveInterface (const std::str
printIndent ();
print ("};\n\n");
}
-
++
activeInterface = x;
-
++
if (activeInterface != "")
{
printIndent ();
@@@ -122,6 -143,7 +143,7 @@@
std::string idlType (GType g)
{
std::string s = g_type_name (g);
-
++
if (s[0] == 'B' && s[1] == 's' && s[2] == 'e')
{
needTypes.insert (s);
@@@ -150,6 -173,7 +173,7 @@@ std::string symbolForInt (int i
{
if (i == SFI_MAXINT) return "SFI_MAXINT";
if (i == SFI_MININT) return "SFI_MININT";
-
++
char *x = g_strdup_printf ("%d", i);
std::string result = x;
g_free(x);
@@@ -158,6 -183,7 +183,7 @@@
void printPSpec (const char *dir, GParamSpec *pspec)
{
std::string pname = paramName (pspec->name);
-
++
printIndent ();
print ("%-4s%-20s= (\"%s\", \"%s\", ",
dir,
@@@ -165,11 -191,14 +191,14 @@@
g_param_spec_get_nick (pspec) ? g_param_spec_get_nick (pspec) : "",
g_param_spec_get_blurb (pspec) ? g_param_spec_get_blurb (pspec) : ""
);
-
++
if (SFI_IS_PSPEC_INT (pspec))
{
int default_value, minimum, maximum, stepping_rate;
-
++
default_value = sfi_pspec_get_int_default (pspec);
sfi_pspec_get_int_range (pspec, &minimum, &maximum, &stepping_rate);
-
++
print("%s, %s, %s, %s, ", symbolForInt (default_value).c_str(),
symbolForInt (minimum).c_str(), symbolForInt (maximum).c_str(),
symbolForInt (stepping_rate).c_str());
@@@ -177,6 -206,7 +206,7 @@@
if (SFI_IS_PSPEC_BOOL (pspec))
{
GParamSpecBoolean *bspec = G_PARAM_SPEC_BOOLEAN (pspec);
-
++
print("%s, ", bspec->default_value ? "TRUE" : "FALSE");
}
print("\":flagstodo\");\n");
@@@ -185,22 -216,26 +216,26 @@@ void printMethods (const std::string& i
{
BseCategorySeq *cseq;
guint i;
-
++
cseq = bse_categories_match_typed ("*", BSE_TYPE_PROCEDURE);
for (i = 0; i < cseq->n_cats; i++)
{
GType type_id = g_type_from_name (cseq->cats[i]->type);
const gchar *blurb = bse_type_get_blurb (type_id);
BseProcedureClass *klass = (BseProcedureClass *)g_type_class_ref (type_id);
-
++
/* procedures */
std::string t = cseq->cats[i]->type;
std::string iname = getInterface (t);
std::string mname = getMethod (t);
std::string rtype = klass->n_out_pspecs ?
idlType (klass->out_pspecs[0]->value_type) : "void";
-
++
if (iname == iface)
{
/* for methods, the first argument is implicit: the object itself */
guint first_p = iface == "" ? 0 : 1;
-
++
printIndent ();
print ("%s %s (", rtype.c_str(), mname.c_str ());
for (guint p = first_p; p < klass->n_in_pspecs; p++)
@@@ -213,6 -248,7 +248,7 @@@
}
print(") {\n");
indent++;
-
++
if (blurb)
{
char *ehelp = g_strescape (blurb, 0);
@@@ -220,10 -256,13 +256,13 @@@
print ("Info help = \"%s\";\n", ehelp);
g_free (ehelp);
}
-
++
for (guint p = first_p; p < klass->n_in_pspecs; p++)
printPSpec ("In", klass->in_pspecs[p]);
-
++
for (guint p = 0; p < klass->n_out_pspecs; p++)
printPSpec ("Out", klass->out_pspecs[p]);
-
++
indent--;
printIndent ();
print ("}\n");
@@@ -236,10 -276,13 +276,13 @@@
void printInterface (const std::string& iface, const std::string& parent = "")
{
std::string idliface = removeBse (iface);
+
if (excludeTypes.count (iface))
return;
+
setActiveInterface (idliface, parent);
printMethods (idliface);
-
++
if (iface != "")
{
/* signals */
@@@ -277,12 -323,14 +323,14 @@@
{
print("/* type %s (%s) is not instantiatable */\n", g_type_name (type_id), iface.c_str());
}
-
++
/* properties */
GObjectClass *klass = (GObjectClass *)g_type_class_ref (type_id);
if (klass)
{
guint n_properties = 0;
GParamSpec **properties = g_object_class_list_properties (klass, &n_properties);
-
++
for (guint i = 0; i < n_properties; i++)
{
if (properties[i]->owner_type == type_id)
@@@ -301,6 -351,7 +351,7 @@@ printChoices (void
{
GType *children;
guint n, i;
-
++
children = g_type_children (G_TYPE_ENUM, &n);
for (i = 0; i < n; i++)
{
@@@ -382,6 -440,9 +434,9 @@@ main (int argc, char **argv
printInterface (""); /* prints procedures without interface */
indent--;
print ("};\n");
-
-
++
++
sfi_glue_context_pop ();
}
+
/* vim:set ts=8 sts=2 sw=2: */
diff --cc bse/bseproject.cc
index e89c8a2,f96755f..e94fa52
--- a/bse/bseproject.cc
+++ b/bse/bseproject.cc
@@@ -72,15 -83,18 +83,18 @@@ BSE_BUILTIN_TYPE (BseProject
{
static const GTypeInfo project_info = {
sizeof (BseProjectClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_project_class_init,
(GClassFinalizeFunc) bse_project_class_finalize,
NULL /* class_data */,
-
++
sizeof (BseProject),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_project_init,
};
-
++
return bse_type_register_static (BSE_TYPE_CONTAINER,
"BseProject",
"BSE Super container type",
@@@ -95,8 -110,10 +110,10 @@@ bse_project_class_init (BseProjectClas
BseItemClass *item_class = BSE_ITEM_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
BseContainerClass *container_class = BSE_CONTAINER_CLASS (klass);
-
++
parent_class = (GTypeClass*) g_type_class_peek_parent (klass);
quark_storage_trap = g_quark_from_static_string ("bse-project-storage-trap");
+
gobject_class->set_property = bse_project_set_property;
gobject_class->get_property = bse_project_get_property;
gobject_class->dispose = bse_project_dispose;
@@@ -219,10 -258,13 +255,13 @@@ static voi
bse_project_finalize (GObject *object)
{
BseProject *self = BSE_PROJECT (object);
-
++
bse_midi_receiver_unref (self->midi_receiver);
self->midi_receiver = NULL;
+
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->finalize (object);
+
bse_undo_stack_destroy (self->undo_stack);
bse_undo_stack_destroy (self->redo_stack);
}
@@@ -281,6 -330,7 +327,7 @@@ bse_project_push_undo_silent_deactivat
ustep->data[0].v_pointer = bse_undo_pointer_pack (self, ustack);
bse_undo_stack_push_add_on (ustack, ustep);
bse_item_undo_close (ustack);
-
++
gboolean in_undo = self->in_undo;
self->in_undo = !in_undo; /* swap undo<=>redo */
ustack = bse_item_undo_open (self, "deactivate-project");
@@@ -429,6 -500,7 +497,7 @@@ bse_project_store_bse (BseProject *sel
gchar *string;
guint l, flags;
gint fd;
-
++
g_return_val_if_fail (BSE_IS_PROJECT (self), BSE_ERROR_INTERNAL);
if (super)
{
@@@ -472,11 -551,15 +548,15 @@@ bse_project_restore (BseProject *self
{
GScanner *scanner;
GTokenType expected_token = G_TOKEN_NONE;
-
++
g_return_val_if_fail (BSE_IS_PROJECT (self), BSE_ERROR_INTERNAL);
g_return_val_if_fail (BSE_IS_STORAGE (storage), BSE_ERROR_INTERNAL);
+
scanner = bse_storage_get_scanner (storage);
g_return_val_if_fail (scanner != NULL, BSE_ERROR_INTERNAL);
+
g_object_ref (self);
+
expected_token = bse_storage_restore_item (storage, BSE_ITEM (self));
if (expected_token != G_TOKEN_NONE)
bse_storage_unexp_token (storage, expected_token);
@@@ -626,6 -733,7 +730,7 @@@ bse_project_prepare (BseSource *source
{
BseProject *self = BSE_PROJECT (source);
GSList *slist;
-
++
/* make sure Wave repositories are prepared first */
for (slist = self->supers; slist; slist = slist->next)
if (BSE_IS_WAVE_REPO (slist->data))
@@@ -688,8 -807,10 +804,10 @@@ bse_project_activate (BseProject *self
error = bse_server_open_devices (bse_server_get ());
if (error)
return error;
+
bse_source_prepare (BSE_SOURCE (self));
self->deactivate_min_tick = 0;
-
++
trans = bse_trans_open ();
for (slist = self->supers; slist; slist = slist->next)
{
@@@ -750,14 -875,17 +872,17 @@@ bse_project_start_playback (BseProject
bse_project_state_changed (self, BSE_PROJECT_PLAYING);
/* then, start the sequencer */
while (songs)
- bse_sequencer_start_song ((BseSong*) sfi_ring_pop_head (&songs), 0);
+ Bse::Sequencer::instance().start_song ((BseSong*) sfi_ring_pop_head (&songs), 0);
}
+
void
bse_project_stop_playback (BseProject *self)
{
BseTrans *trans;
GSList *slist;
+
g_return_if_fail (BSE_IS_PROJECT (self));
-
++
if (self->state != BSE_PROJECT_PLAYING)
return;
g_return_if_fail (BSE_SOURCE_PREPARED (self) == TRUE);
@@@ -786,6 -916,7 +913,7 @@@ voi
bse_project_check_auto_stop (BseProject *self)
{
g_return_if_fail (BSE_IS_PROJECT (self));
-
++
if (self->state == BSE_PROJECT_PLAYING)
{
GSList *slist;
@@@ -806,7 -938,9 +935,9 @@@ bse_project_deactivate (BseProject *sel
{
BseTrans *trans;
GSList *slist;
+
g_return_if_fail (BSE_IS_PROJECT (self));
-
++
if (self->state == BSE_PROJECT_INACTIVE)
return;
g_return_if_fail (BSE_SOURCE_PREPARED (self) == TRUE);
diff --cc bse/bseproject.proc
index 6a7fce8,9597f34..ff4a8d5
--- a/bse/bseproject.proc
+++ b/bse/bseproject.proc
@@@ -31,11 -36,15 +36,15 @@@ METHOD (BseProject, is-playing)
/* check parameters */
if (!BSE_IS_PROJECT (project))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
-
++
/* set output parameters */
sfi_value_set_bool (out_values++, project->state == BSE_PROJECT_PLAYING);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseProject, is-active) {
HELP = "Check whether a project is active";
IN = bse_param_spec_object ("project", "Project", "The project",
@@@ -48,14 -57,19 +57,19 @@@
{
/* extract parameter values */
BseProject *project = (BseProject*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PROJECT (project))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
-
++
/* set output parameters */
sfi_value_set_bool (out_values++, project->state != BSE_PROJECT_INACTIVE);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseProject, get-midi-notifier) {
HELP = "Retrieve the project's midi notifier object.";
IN = bse_param_spec_object ("project", "Project", NULL, BSE_TYPE_PROJECT, SFI_PARAM_STANDARD);
@@@ -91,9 -110,11 +110,11 @@@ METHOD (BseProject, import-midi-file, "
const char *file_name = sfi_value_get_string (in_values++);
BseMidiFile *smf;
BseErrorType error;
-
++
/* check parameters */
if (!BSE_IS_PROJECT (project) || !file_name)
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
smf = bse_midi_file_load (file_name, &error);
if (!error)
@@@ -112,10 -133,13 +133,13 @@@
}
if (smf)
bse_midi_file_free (smf);
+
/* set output parameters */
g_value_set_enum (out_values++, error);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseProject, restore-from-file, "File/Restore") {
HELP = "Load a project from file";
IN = bse_param_spec_object ("project", "Project", "The project",
@@@ -133,9 -157,11 +157,11 @@@
BseProject *project = (BseProject*) bse_value_get_object (in_values++);
const char *file_name = sfi_value_get_string (in_values++);
BseErrorType error;
-
++
/* check parameters */
if (!BSE_IS_PROJECT (project) || !file_name)
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
if (!project->in_undo && !project->in_redo)
{
@@@ -149,10 -175,13 +175,13 @@@
}
else
error = BSE_ERROR_PROC_BUSY;
+
/* set output parameters */
g_value_set_enum (out_values++, error);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseProject, store-bse, "File/Store") {
HELP = "Save supers of a project into a BSE file. "
"If no super is specified, the project itself is stored.";
@@@ -179,16 -208,21 +208,21 @@@
const char *file_name = sfi_value_get_string (in_values++);
gboolean self_contained = sfi_value_get_bool (in_values++);
BseErrorType error;
-
++
/* check parameters */
if (!BSE_IS_PROJECT (project) || !file_name)
return BSE_ERROR_PROC_PARAM_INVAL;
if (super && BSE_ITEM (super)->parent != BSE_ITEM (project))
return BSE_ERROR_PROC_PARAM_INVAL;
+
error = bse_project_store_bse (project, super, file_name, self_contained);
-
++
/* set output parameters */
g_value_set_enum (out_values++, error);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseProject, create-song) {
HELP = "Create a song for this project.";
IN = bse_param_spec_object ("project", "Project", "The project",
@@@ -233,15 -272,20 +272,20 @@@ METHOD (BseProject, get-wave-repo)
/* extract parameter values */
BseProject *project = (BseProject*) bse_value_get_object (in_values++);
BseWaveRepo *wrepo = NULL;
-
++
/* check parameters */
if (!BSE_IS_PROJECT (project))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
wrepo = bse_project_get_wave_repo (project);
-
++
/* set output parameters */
bse_value_set_object (out_values++, wrepo);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseProject, get-data-pocket) {
HELP = "Retrieve a specifically named data pocket for this project";
IN = bse_param_spec_object ("project", "Project", "The project",
@@@ -258,17 -302,22 +302,22 @@@
BseProject *project = (BseProject*) bse_value_get_object (in_values++);
const char *name = sfi_value_get_string (in_values++);
BseItem *item;
-
++
/* check parameters */
if (!BSE_IS_PROJECT (project) || !name)
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
item = bse_project_lookup_typed_item (project, BSE_TYPE_DATA_POCKET, name);
if (!item)
item = (BseItem*) bse_container_new_child (BSE_CONTAINER (project), BSE_TYPE_DATA_POCKET, "uname",
name, NULL);
-
++
/* set output parameters */
bse_value_set_object (out_values++, item);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseProject, create-csynth) {
HELP = "Create a synthsizer network for this project.";
IN = bse_param_spec_object ("project", "Project", "The project",
@@@ -286,9 -335,11 +335,11 @@@
const char *name = sfi_value_get_string (in_values++);
BseUndoStack *ustack;
BseItem *child;
-
++
/* check parameters */
if (!BSE_IS_PROJECT (container))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
ustack = bse_item_undo_open (container, "create-csynth");
child = (BseItem*) bse_container_new_child (container, BSE_TYPE_CSYNTH, NULL);
@@@ -296,10 -347,13 +347,13 @@@
bse_item_set (child, "uname", name, NULL);
bse_item_push_undo_proc (container, "remove-snet", child);
bse_item_undo_close (ustack);
-
++
/* set output parameters */
bse_value_set_object (out_values++, child);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseProject, create-midi-synth) {
HELP = "Create a MIDI synthesizer network for this project.";
IN = bse_param_spec_object ("project", "Project", "The project",
@@@ -320,6 -375,7 +375,7 @@@
/* check parameters */
if (!BSE_IS_PROJECT (container))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
ustack = bse_item_undo_open (container, "create-midi-synth");
child = (BseItem*) bse_container_new_child (container, BSE_TYPE_MIDI_SYNTH, NULL);
@@@ -327,10 -383,13 +383,13 @@@
bse_item_set (child, "uname", name, NULL);
bse_item_push_undo_proc (container, "remove-snet", child);
bse_item_undo_close (ustack);
+
/* set output parameters */
bse_value_set_object (out_values++, child);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseProject, remove-snet) {
HELP = "Remove an existing synthesizer network from this project.";
IN = bse_param_spec_object ("project", "Project", "The project",
@@@ -345,6 -404,7 +404,7 @@@
BseContainer *self = (BseContainer*) bse_value_get_object (in_values++);
BseItem *child = (BseItem*) bse_value_get_object (in_values++);
BseUndoStack *ustack;
-
++
/* check parameters */
if (!BSE_IS_PROJECT (self) || !BSE_IS_SNET (child) || child->parent != (BseItem*) self)
return BSE_ERROR_PROC_PARAM_INVAL;
@@@ -361,8 -422,10 +422,10 @@@
/* done */
bse_item_undo_close (ustack);
}
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseProject, list-uname-paths) {
HELP = ("List uname paths for all items of a specified type within this project. "
"By their uname paths, items are uniquely identifyable within a project.");
@@@ -379,13 -442,17 +442,17 @@@
BseProject *project = (BseProject*) bse_value_get_object (in_values++);
const gchar *tname = sfi_value_get_string (in_values++);
GType type = tname ? g_type_from_name (tname) : 0;
-
++
/* check parameters */
if (!BSE_IS_PROJECT (project) || !g_type_is_a (type, BSE_TYPE_ITEM))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
bse_value_take_boxed (out_values++, bse_project_list_upaths (project, type));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseProject, find-item) {
HELP = "Find an item within a project, given its uname path.";
IN = bse_param_spec_object ("project", NULL, NULL,
@@@ -401,13 -468,17 +468,17 @@@
/* extract parameter values */
BseProject *project = (BseProject*) bse_value_get_object (in_values++);
const gchar *string = sfi_value_get_string (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PROJECT (project) || !string)
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
bse_value_set_object (out_values++, bse_container_resolve_upath (BSE_CONTAINER (project), string));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseProject, match-items-by-uname) {
HELP = "Retrieve all items of a specific type within a project with matching uname";
IN = bse_param_spec_object ("project", NULL, NULL,
@@@ -428,9 -499,11 +499,11 @@@
GType type = tname ? g_type_from_name (tname) : 0;
GList *list, *free_list;
BseItemSeq *iseq;
-
++
/* check parameters */
if (!BSE_IS_PROJECT (project) || !string || !g_type_is_a (type, BSE_TYPE_ITEM))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
iseq = bse_item_seq_new ();
free_list = bse_objects_list_by_uname (type, string);
@@@ -441,10 -514,13 +514,13 @@@
break;
}
g_list_free (free_list);
-
++
/* set output parameters */
bse_value_take_boxed (out_values++, iseq);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseProject, get-supers) {
HELP = "Retrieve all supers of this project.";
IN = bse_param_spec_object ("project", NULL, NULL,
@@@ -458,17 -534,22 +534,22 @@@
BseProject *project = (BseProject*) bse_value_get_object (in_values++);
BseItemSeq *iseq;
GSList *slist;
-
++
/* check parameters */
if (!BSE_IS_PROJECT (project))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
iseq = bse_item_seq_new ();
for (slist = project->supers; slist; slist = slist->next)
bse_item_seq_append (iseq, (BseItem*) slist->data);
-
++
/* set output parameters */
bse_value_take_boxed (out_values++, iseq);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseProject, can-play) {
HELP = "Check whether project playback would makes sense.";
IN = bse_param_spec_object ("project", "Project", "The project",
@@@ -482,6 -563,7 +563,7 @@@
/* extract parameter values */
BseProject *project = (BseProject*) bse_value_get_object (in_values++);
gpointer wrepo;
-
++
/* check parameters */
if (!BSE_IS_PROJECT (project))
return BSE_ERROR_PROC_PARAM_INVAL;
@@@ -488,8 -571,10 +571,10 @@@
/* playback works if we have supers other than wave repo */
wrepo = bse_project_get_wave_repo (project);
sfi_value_set_bool (out_values++, project->supers->data != wrepo || project->supers->next);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseProject, get-state) {
HELP = "Retrieve the current project state.";
IN = bse_param_spec_object ("project", "Project", "The project",
@@@ -502,13 -587,17 +587,17 @@@
{
/* extract parameter values */
BseProject *self = (BseProject*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PROJECT (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
g_value_set_enum (out_values++, self->state);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseProject, activate) {
HELP = "Activate a project, precondition to start playback.";
IN = bse_param_spec_object ("project", "Project", "The project",
@@@ -534,9 -625,12 +625,12 @@@
/* certain things work only (can only be undone) in deactivated projects */
bse_project_push_undo_silent_deactivate (self);
}
-
++
g_value_set_enum (out_values++, error);
+
return BSE_ERROR_NONE;
}
+
METHOD (BseProject, start-playback) {
HELP = "Start playback in an activated project.";
IN = bse_param_spec_object ("project", "Project", "The project",
@@@ -575,6 -673,7 +673,7 @@@ METHOD (BseProject, play)
BseProject *self = (BseProject*) bse_value_get_object (in_values++);
BseErrorType error;
BseProjectState state_before;
-
++
/* check parameters */
if (!BSE_IS_PROJECT (self))
return BSE_ERROR_PROC_PARAM_INVAL;
@@@ -679,6 -799,7 +799,7 @@@ METHOD (BseProject, inject-midi-control
/* check parameters */
if (!BSE_IS_PROJECT (project))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
if (BSE_SOURCE_PREPARED (project))
{
/* construct event */
@@@ -693,8 -814,10 +814,10 @@@
bse_midi_receiver_push_event (project->midi_receiver, event);
bse_midi_receiver_process_events (project->midi_receiver, event->delta_time);
}
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseProject, change-name) {
HELP = "Change a project name without recording undo steps.";
IN = bse_param_spec_object ("project", "Project", "The project",
@@@ -707,13 -830,17 +830,17 @@@
/* extract parameter values */
BseProject *project = (BseProject*) bse_value_get_object (in_values++);
const char *name = sfi_value_get_string (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PROJECT (project) || !name)
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
g_object_set (project, "uname", name, NULL); /* no undo */
+
return BSE_ERROR_NONE;
}
+
METHOD (BseProject, undo-depth) {
HELP = "Check whether a project can perform undo steps";
IN = bse_param_spec_object ("project", "Project", "The project",
@@@ -726,13 -853,17 +853,17 @@@
{
/* extract parameter values */
BseProject *project = (BseProject*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PROJECT (project))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_int (out_values++, bse_undo_stack_depth (project->undo_stack));
+
return BSE_ERROR_NONE;
}
+
METHOD (BseProject, undo) {
HELP = "Undo a previous operation in a project";
IN = bse_param_spec_object ("project", "Project", "The project",
@@@ -773,13 -908,17 +908,17 @@@ METHOD (BseProject, redo-depth)
{
/* extract parameter values */
BseProject *project = (BseProject*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PROJECT (project))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_int (out_values++, bse_undo_stack_depth (project->redo_stack));
+
return BSE_ERROR_NONE;
}
+
METHOD (BseProject, redo) {
HELP = "Redo a previously undone operaiton in a project";
IN = bse_param_spec_object ("project", "Project", "The project",
@@@ -790,6 -929,7 +929,7 @@@
{
/* extract parameter values */
BseProject *project = (BseProject*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PROJECT (project))
return BSE_ERROR_PROC_PARAM_INVAL;
@@@ -818,6 -961,7 +961,7 @@@ METHOD (BseProject, clear-undo)
{
/* extract parameter values */
BseProject *project = (BseProject*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PROJECT (project))
return BSE_ERROR_PROC_PARAM_INVAL;
@@@ -835,6 -982,7 +982,7 @@@ METHOD (BseProject, clean-dirty)
{
/* extract parameter values */
BseProject *project = (BseProject*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PROJECT (project))
return BSE_ERROR_PROC_PARAM_INVAL;
@@@ -853,9 -1004,11 +1004,11 @@@ METHOD (BseProject, is-dirty)
{
/* extract parameter values */
BseProject *project = (BseProject*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_PROJECT (project))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
gboolean dirty = FALSE;
g_object_get (project, "dirty", &dirty, NULL);
diff --cc bse/bsequery.cc
index c3baa3e,92e8026..98d21b5
--- a/bse/bsequery.cc
+++ b/bse/bsequery.cc
@@@ -45,6 -52,7 +52,7 @@@ show_nodes (GType type
if (type != root)
for (i = 0; i < spacing; i++)
fprintf (f_out, "%s%s\n", indent, O_VLINE);
-
++
fprintf (f_out, "%s%s%s%s",
indent,
sibling ? O_BRANCH : (type != root ? O_LLEAF : O_SPACE),
@@@ -71,7 -84,9 +84,9 @@@
fputs (buffer, f_out);
g_type_class_unref (klass);
}
+
fputc ('\n', f_out);
-
++
if (children && recursion)
{
gchar *new_indent;
diff --cc bse/bseresampler.hh
index 7687607,be691bc..41e0135
--- a/bse/bseresampler.hh
+++ b/bse/bseresampler.hh
@@@ -87,6 -96,7 +93,7 @@@ protected
static const double halfband_fir_96db_coeffs[32];
static const double halfband_fir_120db_coeffs[42];
static const double halfband_fir_144db_coeffs[52];
-
++
/* Creates implementation from filter coefficients and Filter implementation class
*
* Since up- and downsamplers use different (scaled) coefficients, its possible
@@@ -100,6 -110,7 +107,7 @@@
float taps[order];
for (guint i = 0; i < order; i++)
taps[i] = d[i] * scaling;
-
++
Resampler2 *filter = new Filter (taps);
g_assert (order == filter->order());
return filter;
diff --cc bse/bseresamplerimpl.hh
index e8d97d0,94b93bf..1e9383a
--- a/bse/bseresamplerimpl.hh
+++ b/bse/bseresamplerimpl.hh
@@@ -1,9 -1,10 +1,10 @@@
// Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
#ifndef __BSE_RESAMPLER_TCC__
#define __BSE_RESAMPLER_TCC__
+
#include <vector>
#include <bse/bseresampler.hh>
-#include <birnet/birnet.hh>
+#include <sfi/sfi.hh>
#include <math.h>
#include <string.h>
#include <stdlib.h>
@@@ -75,10 -80,12 +79,12 @@@ fir_process_4samples_sse (const float *
const F4Vector *input_v = reinterpret_cast<const F4Vector *> (input);
const F4Vector *sse_taps_v = reinterpret_cast<const F4Vector *> (sse_taps);
F4Vector out0_v, out1_v, out2_v, out3_v;
-
++
out0_v.v = _mm_mul_ps (input_v[0].v, sse_taps_v[0].v);
out1_v.v = _mm_mul_ps (input_v[0].v, sse_taps_v[1].v);
out2_v.v = _mm_mul_ps (input_v[0].v, sse_taps_v[2].v);
out3_v.v = _mm_mul_ps (input_v[0].v, sse_taps_v[3].v);
-
++
for (guint i = 1; i < (order + 6) / 4; i++)
{
out0_v.v = _mm_add_ps (out0_v.v, _mm_mul_ps (input_v[i].v, sse_taps_v[i * 4 + 0].v));
@@@ -86,6 -93,7 +92,7 @@@
out2_v.v = _mm_add_ps (out2_v.v, _mm_mul_ps (input_v[i].v, sse_taps_v[i * 4 + 2].v));
out3_v.v = _mm_add_ps (out3_v.v, _mm_mul_ps (input_v[i].v, sse_taps_v[i * 4 + 3].v));
}
-
++
*out0 = out0_v.f[0] + out0_v.f[1] + out0_v.f[2] + out0_v.f[3];
*out1 = out1_v.f[0] + out1_v.f[1] + out1_v.f[2] + out1_v.f[3];
*out2 = out2_v.f[0] + out2_v.f[1] + out2_v.f[2] + out2_v.f[3];
@@@ -117,14 -127,17 +126,17 @@@ fir_compute_sse_taps (const vector<floa
{
const int order = taps.size();
vector<float> sse_taps ((order + 6) / 4 * 16);
-
++
for (int j = 0; j < 4; j++)
for (int i = 0; i < order; i++)
{
int k = i + j;
sse_taps[(k / 4) * 16 + (k % 4) + j * 4] = taps[i];
}
-
++
return sse_taps;
}
+
/**
* This function tests the SSEified FIR filter code (that is, the reordering
* done by fir_compute_sse_taps and the actual computation implemented in
@@@ -206,10 -226,12 +225,12 @@@ protected
float *output)
{
const guint H = (ORDER / 2); /* half the filter length */
-
++
output[1] = input[H];
output[3] = input[H + 1];
output[5] = input[H + 2];
output[7] = input[H + 3];
-
++
fir_process_4samples_sse (input, &sse_taps[0], ORDER, &output[0], &output[2], &output[4], &output[6]);
}
/* slow convolution */
@@@ -280,11 -302,13 +301,13 @@@ public
float *output)
{
const uint history_todo = min (n_input_samples, ORDER - 1);
-
++
copy (input, input + history_todo, &history[ORDER - 1]);
process_block_aligned (&history[0], history_todo, output);
if (n_input_samples > history_todo)
{
process_block_unaligned (input, n_input_samples - history_todo, &output [2 * history_todo]);
-
++
// build new history from new input
copy (input + n_input_samples - history_todo, input + n_input_samples, &history[0]);
}
@@@ -329,7 -354,9 +353,9 @@@ class Downsampler2 : public Resampler2
float *output)
{
const guint H = (ORDER / 2) - 1; /* half the filter length */
-
++
fir_process_4samples_sse (input_even, &sse_taps[0], ORDER, &output[0], &output[1], &output[2],
&output[3]);
-
++
output[0] += 0.5 * input_odd[H * ODD_STEPPING];
output[1] += 0.5 * input_odd[(H + 1) * ODD_STEPPING];
output[2] += 0.5 * input_odd[(H + 2) * ODD_STEPPING];
@@@ -341,6 -368,7 +367,7 @@@
const float *input_odd)
{
const guint H = (ORDER / 2) - 1; /* half the filter length */
-
++
return fir_process_one_sample<float> (&input_even[0], &taps[0], ORDER) + 0.5 * input_odd[H *
ODD_STEPPING];
}
template<int ODD_STEPPING> void
@@@ -413,12 -441,16 +440,16 @@@ public
float *output)
{
g_assert ((n_input_samples & 1) == 0);
-
++
const uint BLOCKSIZE = 1024;
-
++
F4Vector block[BLOCKSIZE / 4]; /* using F4Vector ensures 16-byte alignment */
float *input_even = &block[0].f[0];
-
++
while (n_input_samples)
{
uint n_input_todo = min (n_input_samples, BLOCKSIZE * 2);
-
++
/* since the halfband filter contains zeros every other sample
* and since we're using SSE instructions, which expect the
* data to be consecutively represented in memory, we prepare
@@@ -433,15 -465,20 +464,20 @@@
* is only required for SSE instructions
*/
deinterleave2 (input, n_input_todo, input_even);
-
++
const float *input_odd = input + 1; /* we process this one with a stepping of 2 */
-
++
const uint n_output_todo = n_input_todo / 2;
const uint history_todo = min (n_output_todo, ORDER - 1);
-
++
copy (input_even, input_even + history_todo, &history_even[ORDER - 1]);
deinterleave2 (input_odd, history_todo * 2, &history_odd[ORDER - 1]);
-
++
process_block_aligned <1> (&history_even[0], &history_odd[0], output, history_todo);
if (n_output_todo > history_todo)
{
process_block_unaligned<2> (input_even, input_odd, &output[history_todo], n_output_todo -
history_todo);
-
++
// build new history from new input (here: history_todo == ORDER - 1)
copy (input_even + n_output_todo - history_todo, input_even + n_output_todo, &history_even[0]);
deinterleave2 (input_odd + n_input_todo - history_todo * 2, history_todo * 2, &history_odd[0]);
/* FIXME: can be optimized */
@@@ -453,6 -490,7 +489,7 @@@
g_memmove (&history_even[0], &history_even[n_output_todo], sizeof (history_even[0]) * (ORDER -
1));
g_memmove (&history_odd[0], &history_odd[n_output_todo], sizeof (history_odd[0]) * (ORDER - 1));
}
-
++
n_input_samples -= n_input_todo;
input += n_input_todo;
output += n_output_todo;
diff --cc bse/bsescripthelper.cc
index cd1e65e,108965e..664073a
--- a/bse/bsescripthelper.cc
+++ b/bse/bsescripthelper.cc
@@@ -29,8 -36,10 +36,10 @@@ bse_script_procedure_init (BseScriptPro
BseProcedureClass *proc = (BseProcedureClass*) klass;
SfiRing *ring;
guint n;
-
++
klass->sdata = sdata;
proc->execute = bse_script_procedure_exec;
-
++
/* we support a limited parameter set for scripts */
n = sfi_ring_length (sdata->params);
proc->in_pspecs = g_new (GParamSpec*, n + 1);
@@@ -65,17 -75,20 +75,20 @@@ bse_script_proc_register (const gchar *
{
GTypeInfo script_info = {
sizeof (BseScriptProcedureClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_script_procedure_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
/* non classed type stuff */
0, 0, NULL,
};
BseScriptData *sdata;
gchar *tname;
GType type;
-
++
g_return_val_if_fail (script_file != NULL, 0);
g_return_val_if_fail (name != NULL, 0);
if (sfi_ring_length (params) > BSE_PROCEDURE_MAX_IN_PARAMS)
@@@ -84,11 -97,14 +97,14 @@@
name, BSE_PROCEDURE_MAX_IN_PARAMS);
return 0;
}
-
++
sdata = g_new0 (BseScriptData, 1);
sdata->script_file = g_strdup (script_file);
sdata->name = g_strdup (name);
sdata->params = sfi_ring_copy_deep (params, (SfiRingDataFunc) g_strdup, NULL);
+
script_info.class_data = sdata;
-
++
tname = g_strconcat ("bse-script-", name, NULL);
type = g_type_register_static (BSE_TYPE_PROCEDURE, tname, &script_info, GTypeFlags (0));
g_free (tname);
@@@ -120,6 -137,7 +137,7 @@@ bse_script_procedure_exec (BseProcedure
BseErrorType error;
gchar *shellpath;
guint i;
-
++
params = sfi_ring_append (params, g_strdup_printf ("--bse-eval"));
params = sfi_ring_append (params, g_strdup_printf ("(load \"%s\")"
"(apply %s (bse-script-fetch-args))",
@@@ -130,6 -148,7 +148,7 @@@
params, sdata->script_file, BSE_PROCEDURE_NAME (proc), &janitor);
g_free (shellpath);
sfi_ring_free_deep (params, g_free);
-
++
if (error)
g_message ("failed to start script \"%s::%s\": %s",
sdata->script_file, BSE_PROCEDURE_NAME (proc), bse_error_blurb (error));
@@@ -235,12 -261,15 +261,15 @@@ bse_script_file_register (const gchar *
params, file_name, proc_name, janitor_p);
g_free (shellpath);
sfi_ring_free_deep (params, g_free);
-
++
return error;
}
+
static gchar*
make_sname (const gchar *string)
{
gchar *p, *cname = g_strdup (string);
-
++
for (p = cname; *p; p++)
{
if ((*p >= '0' && *p <= '9') || (*p >= 'a' && *p <= 'z'))
@@@ -323,6 -355,7 +355,7 @@@ bse_script_param_spec (gchar *psp
else if (strncmp (pspec_desc, "BseParamProxy", 13) == 0) /* "BseParamProxyBseProject:Project:0" */
{
GType type = g_type_from_name (pspec_desc + 13);
-
++
if (!g_type_is_a (type, BSE_TYPE_ITEM))
{
g_message ("unknown proxy type: %s", pspec_desc + 13);
diff --cc bse/bsescripthelper.proc
index 044841d,55aa031..02260cc
--- a/bse/bsescripthelper.proc
+++ b/bse/bsescripthelper.proc
@@@ -24,10 -29,13 +29,13 @@@ PROCEDURE (bse-proxy-check, "Proxy Chec
/* check parameters */
if (!type_name)
type_name = "";
-
++
/* action */
type = g_type_from_name (type_name);
is_a = item && g_type_is_a (G_OBJECT_TYPE (item), type);
-
++
/* set output parameters */
sfi_value_set_bool (out_values++, is_a);
-
++
return BSE_ERROR_NONE;
}
diff --cc bse/bsesequencer.cc
index 949ac18,7c6231c..088911f
--- a/bse/bsesequencer.cc
+++ b/bse/bsesequencer.cc
@@@ -238,12 -299,14 +238,13 @@@ Sequencer::start_song (BseSong *song, u
g_return_if_fail (BSE_IS_SONG (song));
g_return_if_fail (BSE_SOURCE_PREPARED (song));
g_return_if_fail (song->sequencer_start_request_SL == 0);
- g_assert (song->sequencer_owns_refcount_SL == FALSE);
+ g_assert (song->sequencer_owns_refcount_SL == false);
start_stamp = MAX (start_stamp, 1);
+
g_object_ref (song);
- BSE_SEQUENCER_LOCK ();
- song->sequencer_owns_refcount_SL = TRUE;
- song->sequencer_start_request_SL = start_stamp <= 1 ? global_sequencer->stamp : start_stamp;
+ BSE_SEQUENCER_LOCK();
+ song->sequencer_owns_refcount_SL = true;
+ song->sequencer_start_request_SL = start_stamp <= 1 ? stamp_ : start_stamp;
song->sequencer_start_SL = 0;
song->sequencer_done_SL = 0;
song->delta_stamp_SL = 0;
@@@ -507,6 -606,7 +508,7 @@@ Sequencer::process_part_SL (BsePart *pa
note++;
}
}
-
++
node = bse_part_controls_lookup_ge (&part->controls, start_tick);
last = bse_part_controls_lookup_lt (&part->controls, tick_bound);
if (node) while (node <= last)
diff --cc bse/bseserver.cc
index aed2b74,9b614d0..3c3d0f4
--- a/bse/bseserver.cc
+++ b/bse/bseserver.cc
@@@ -93,15 -107,20 +95,20 @@@ bse_server_class_init (BseServerClass *
BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
BseItemClass *item_class = BSE_ITEM_CLASS (klass);
BseContainerClass *container_class = BSE_CONTAINER_CLASS (klass);
-
++
parent_class = (GTypeClass*) g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = bse_server_set_property;
gobject_class->get_property = bse_server_get_property;
gobject_class->finalize = bse_server_finalize;
-
++
item_class->set_parent = bse_server_set_parent;
-
++
container_class->add_item = bse_server_add_item;
container_class->remove_item = bse_server_remove_item;
container_class->forall_items = bse_server_forall_items;
container_class->release_children = bse_server_release_children;
-
++
_bse_gconfig_init ();
bse_object_class_add_param (object_class, "BSE Configuration",
PROP_GCONFIG,
@@@ -166,13 -191,16 +177,16 @@@ bse_server_init (BseServer *self
self->pcm_omodule = NULL;
self->pcm_writer = NULL;
self->midi_device = NULL;
-
++
/* keep the server singleton alive */
bse_item_use (BSE_ITEM (self));
-
++
/* start dispatching main thread stuff */
main_thread_source_setup (self);
-
++
/* read rc file */
int fd = -1;
- if (!bse_main_args->birnet.stand_alone &&
+ if (!bse_main_args->stand_alone &&
bse_main_args->bse_rcfile &&
bse_main_args->bse_rcfile[0])
fd = open (bse_main_args->bse_rcfile, O_RDONLY, 0);
@@@ -193,6 -224,7 +210,7 @@@ static voi
bse_server_finalize (GObject *object)
{
g_error ("Fatal attempt to destroy singleton BseServer");
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@@ -252,8 -288,10 +274,10 @@@ voi
bse_server_notify_gconfig (BseServer *server)
{
g_return_if_fail (BSE_IS_SERVER (server));
-
++
g_object_notify ((GObject*) server, bse_gconfig_pspec ()->name);
}
+
static void
bse_server_set_parent (BseItem *item,
BseItem *parent)
@@@ -265,7 -304,9 +290,9 @@@ bse_server_add_item (BseContainer *cont
BseItem *item)
{
BseServer *self = BSE_SERVER (container);
-
++
self->children = g_slist_prepend (self->children, item);
-
++
/* chain parent class' handler */
BSE_CONTAINER_CLASS (parent_class)->add_item (container, item);
}
@@@ -276,9 -318,11 +304,11 @@@ bse_server_forall_items (BseContaine
{
BseServer *self = BSE_SERVER (container);
GSList *slist = self->children;
-
++
while (slist)
{
BseItem *item = (BseItem*) slist->data;
-
++
slist = slist->next;
if (!func (item, data))
return;
@@@ -289,7 -334,9 +320,9 @@@ bse_server_remove_item (BseContainer *c
BseItem *item)
{
BseServer *self = BSE_SERVER (container);
-
++
self->children = g_slist_remove (self->children, item);
-
++
/* chain parent class' handler */
BSE_CONTAINER_CLASS (parent_class)->remove_item (container, item);
}
@@@ -297,7 -345,9 +331,9 @@@ static voi
bse_server_release_children (BseContainer *container)
{
// BseServer *self = BSE_SERVER (container);
-
++
g_warning ("release_children() should never be triggered on BseServer singleton");
-
++
/* chain parent class' handler */
BSE_CONTAINER_CLASS (parent_class)->release_children (container);
}
@@@ -310,13 -361,16 +347,16 @@@ BseServer
bse_server_get (void)
{
static BseServer *server = NULL;
-
++
if (!server)
{
server = (BseServer*) g_object_new (BSE_TYPE_SERVER, NULL);
g_object_ref (server);
}
-
++
return server;
}
+
static void
destroy_project (BseProject *project,
BseServer *server)
@@@ -328,27 -383,34 +369,34 @@@ bse_server_create_project (BseServer
const gchar *name)
{
BseProject *project;
-
++
g_return_val_if_fail (BSE_IS_SERVER (server), NULL);
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (bse_server_find_project (server, name) == NULL, NULL);
-
++
project = (BseProject*) g_object_new (BSE_TYPE_PROJECT, "uname", name, NULL);
server->projects = g_list_prepend (server->projects, project);
g_object_connect (project,
"signal::release", destroy_project, server,
NULL);
-
++
return project;
}
+
BseProject*
bse_server_find_project (BseServer *server,
const gchar *name)
{
GList *node;
-
++
g_return_val_if_fail (BSE_IS_SERVER (server), NULL);
g_return_val_if_fail (name != NULL, NULL);
-
++
for (node = server->projects; node; node = node->next)
{
BseProject *project = (BseProject*) node->data;
gchar *uname = BSE_OBJECT_UNAME (project);
-
++
if (uname && strcmp (name, uname) == 0)
return project;
}
@@@ -568,6 -626,7 +618,8 @@@ bse_server_open_devices (BseServer *sel
bse_gconfig_unlock (); /* engine_init() holds another lock count on success */
return error;
}
+
++
void
bse_server_close_devices (BseServer *self)
{
@@@ -609,9 -670,12 +663,12 @@@ bse_server_retrieve_pcm_output_module (
g_return_val_if_fail (BSE_IS_SOURCE (source), NULL);
g_return_val_if_fail (uplink_name != NULL, NULL);
g_return_val_if_fail (self->dev_use_count > 0, NULL);
-
++
self->dev_use_count += 1;
-
++
return self->pcm_omodule;
}
+
void
bse_server_discard_pcm_output_module (BseServer *self,
BseModule *module)
@@@ -631,9 -697,12 +690,12 @@@ bse_server_retrieve_pcm_input_module (B
g_return_val_if_fail (BSE_IS_SOURCE (source), NULL);
g_return_val_if_fail (uplink_name != NULL, NULL);
g_return_val_if_fail (self->dev_use_count > 0, NULL);
-
++
self->dev_use_count += 1;
-
++
return self->pcm_imodule;
}
+
void
bse_server_discard_pcm_input_module (BseServer *self,
BseModule *module)
@@@ -655,8 -726,10 +719,10 @@@ bse_server_script_start (BseServer *se
{
g_return_if_fail (BSE_IS_SERVER (server));
g_return_if_fail (BSE_IS_JANITOR (janitor));
-
++
g_signal_emit (server, signal_script_start, 0, janitor);
}
+
void
bse_server_registration (BseServer *server,
BseRegistrationType rtype,
@@@ -697,8 -816,10 +765,9 @@@ bse_server_add_io_watch (BseServe
g_return_if_fail (BSE_IS_SERVER (server));
g_return_if_fail (watch_func != NULL);
g_return_if_fail (fd >= 0);
-
iowatch_add (server, fd, events, watch_func, data);
}
+
void
bse_server_remove_io_watch (BseServer *server,
BseIOWatch watch_func,
@@@ -706,6 -827,7 +775,7 @@@
{
g_return_if_fail (BSE_IS_SERVER (server));
g_return_if_fail (watch_func != NULL);
-
++
if (!iowatch_remove (server, watch_func, data))
g_warning (G_STRLOC ": no such io watch installed %p(%p)", watch_func, data);
}
@@@ -780,31 -908,40 +856,40 @@@ main_source_prepare (GSource *source
{
// MainSource *xsource = (MainSource*) source;
gboolean need_dispatch;
-
++
BSE_THREADS_ENTER ();
need_dispatch = FALSE;
BSE_THREADS_LEAVE ();
-
++
return need_dispatch;
}
+
static gboolean
main_source_check (GSource *source)
{
MainSource *xsource = (MainSource*) source;
gboolean need_dispatch;
-
++
BSE_THREADS_ENTER ();
need_dispatch = xsource->pfd.events & xsource->pfd.revents;
BSE_THREADS_LEAVE ();
-
++
return need_dispatch;
}
+
static gboolean
main_source_dispatch (GSource *source,
GSourceFunc callback,
gpointer user_data)
{
// MainSource *xsource = (MainSource*) source;
-
++
BSE_THREADS_ENTER ();
BSE_THREADS_LEAVE ();
-
++
return TRUE;
}
+
static void
main_thread_source_setup (BseServer *self)
{
@@@ -816,7 -953,9 +901,9 @@@
GSource *source = g_source_new (&main_source_funcs, sizeof (MainSource));
MainSource *xsource = (MainSource*) source;
static gboolean single_call = 0;
-
++
g_assert (single_call++ == 0);
-
++
xsource->server = self;
g_source_set_priority (source, BSE_PRIORITY_NORMAL);
g_source_attach (source, bse_main_context);
@@@ -834,32 -976,41 +924,41 @@@ iowatch_prepare (GSource *source
{
/* WSource *wsource = (WSource*) source; */
gboolean need_dispatch;
-
++
/* BSE_THREADS_ENTER (); */
need_dispatch = FALSE;
/* BSE_THREADS_LEAVE (); */
-
++
return need_dispatch;
}
+
static gboolean
iowatch_check (GSource *source)
{
WSource *wsource = (WSource*) source;
guint need_dispatch;
-
++
/* BSE_THREADS_ENTER (); */
need_dispatch = wsource->pfd.events & wsource->pfd.revents;
/* BSE_THREADS_LEAVE (); */
-
++
return need_dispatch > 0;
}
+
static gboolean
iowatch_dispatch (GSource *source,
GSourceFunc callback,
gpointer user_data)
{
WSource *wsource = (WSource*) source;
-
++
BSE_THREADS_ENTER ();
wsource->watch_func (wsource->data, 1, &wsource->pfd);
BSE_THREADS_LEAVE ();
-
++
return TRUE;
}
+
static void
iowatch_add (BseServer *server,
gint fd,
@@@ -875,6 -1026,7 +974,7 @@@
};
GSource *source = g_source_new (&iowatch_gsource_funcs, sizeof (WSource));
WSource *wsource = (WSource*) source;
-
++
server->watch_list = g_slist_prepend (server->watch_list, wsource);
wsource->pfd.fd = fd;
wsource->pfd.events = events;
@@@ -915,17 -1073,20 +1021,20 @@@ engine_prepare (GSource *source
{
PSource *psource = (PSource*) source;
gboolean need_dispatch;
-
++
BSE_THREADS_ENTER ();
need_dispatch = bse_engine_prepare (&psource->loop);
if (psource->loop.fds_changed)
{
guint i;
-
++
for (i = 0; i < psource->n_fds; i++)
g_source_remove_poll (source, psource->fds + i);
psource->n_fds = psource->loop.n_fds;
for (i = 0; i < psource->n_fds; i++)
{
GPollFD *pfd = psource->fds + i;
-
++
pfd->fd = psource->loop.fds[i].fd;
pfd->events = psource->loop.fds[i].events;
g_source_add_poll (source, pfd);
@@@ -933,22 -1094,27 +1042,27 @@@
}
*timeout_p = psource->loop.timeout;
BSE_THREADS_LEAVE ();
-
++
return need_dispatch;
}
+
static gboolean
engine_check (GSource *source)
{
PSource *psource = (PSource*) source;
gboolean need_dispatch;
guint i;
-
++
BSE_THREADS_ENTER ();
for (i = 0; i < psource->n_fds; i++)
psource->loop.fds[i].revents = psource->fds[i].revents;
psource->loop.revents_filled = TRUE;
need_dispatch = bse_engine_check (&psource->loop);
BSE_THREADS_LEAVE ();
-
++
return need_dispatch;
}
+
static gboolean
engine_dispatch (GSource *source,
GSourceFunc callback,
@@@ -957,8 -1123,10 +1071,10 @@@
BSE_THREADS_ENTER ();
bse_engine_dispatch ();
BSE_THREADS_LEAVE ();
-
++
return TRUE;
}
+
static void
engine_init (BseServer *server,
gfloat mix_freq)
@@@ -970,17 -1138,21 +1086,20 @@@
NULL
};
static gboolean engine_is_initialized = FALSE;
-
++
g_return_if_fail (server->engine_source == NULL);
-
++
bse_gconfig_lock ();
server->engine_source = g_source_new (&engine_gsource_funcs, sizeof (PSource));
g_source_set_priority (server->engine_source, BSE_PRIORITY_HIGH);
-
++
if (!engine_is_initialized)
{
- guint mypid = bse_main_getpid();
- int current_priority;
- engine_is_initialized = TRUE;
- bse_engine_init (TRUE);
- /* lower priorities compared to engine if our priority range permits */
- current_priority = getpriority (PRIO_PROCESS, mypid);
+ engine_is_initialized = true;
+ bse_engine_init (true);
+ // lower priority compared to engine if our priority range permits
+ const int mypid = Rapicorn::ThisThread::thread_pid();
+ int current_priority = getpriority (PRIO_PROCESS, mypid);
if (current_priority <= -2 && mypid)
setpriority (PRIO_PROCESS, mypid, current_priority + 1);
}
@@@ -991,6 -1165,7 +1112,7 @@@ static voi
engine_shutdown (BseServer *server)
{
g_return_if_fail (server->engine_source != NULL);
-
++
g_source_destroy (server->engine_source);
server->engine_source = NULL;
bse_engine_user_thread_collect ();
diff --cc bse/bseserver.proc
index b135fc9,e2af058..99ebf20
--- a/bse/bseserver.proc
+++ b/bse/bseserver.proc
@@@ -33,9 -37,11 +37,11 @@@ BODY (BseProcedureClass *proc
gchar *uname;
guint num = 1;
BseProject *project;
-
++
/* check parameters */
if (!BSE_IS_SERVER (server) || !name)
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* enforce unique name */
uname = g_strdup (name);
while (bse_server_find_project (server, uname))
@@@ -43,15 -49,19 +49,19 @@@
g_free (uname);
uname = g_strdup_printf ("%s-%u", name, num++);
}
-
++
/* create project */
project = bse_server_create_project (server, uname);
g_free (uname);
bse_item_use (BSE_ITEM (project));
g_object_unref (project);
-
++
/* set output parameters */
bse_value_set_object (out_values++, G_OBJECT (project));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseServer, can-load) {
HELP = "Check whether a loader can be found for a wave file";
IN = bse_param_spec_object ("server", "Server", NULL,
@@@ -69,16 -79,20 +79,20 @@@ BODY (BseProcedureClass *proc
BseServer *server = (BseServer*) bse_value_get_object (in_values++);
const char *file_name = sfi_value_get_string (in_values++);
BseWaveFileInfo *finfo;
-
++
/* check parameters */
if (!BSE_IS_SERVER (server) || !file_name)
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* find a loader */
finfo = bse_wave_file_info_load (file_name, NULL);
sfi_value_set_bool (out_values++, finfo != NULL);
if (finfo)
bse_wave_file_info_unref (finfo);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseServer, n-scripts) {
HELP = "Return the number of scripts currently running on this server.";
IN = bse_param_spec_object ("server", "Server", NULL,
@@@ -95,17 -109,22 +109,22 @@@ BODY (BseProcedureClass *proc
BseServer *server = (BseServer*) bse_value_get_object (in_values++);
GSList *slist;
guint n_scripts = 0;
-
++
/* check parameters */
if (!BSE_IS_SERVER (server))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* count script controls */
for (slist = server->children; slist; slist = slist->next)
if (BSE_IS_JANITOR (slist->data))
n_scripts++;
-
++
/* set output parameters */
sfi_value_set_int (out_values++, n_scripts);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseServer, preferences-locked) {
HELP = "Returns whether the bse-preferences property is currently locked against modifications or
not.";
IN = bse_param_spec_object ("server", "Server", NULL,
@@@ -119,13 -138,17 +138,17 @@@ BODY (BseProcedureClass *proc
{
/* extract parameter values */
BseServer *server = (BseServer*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_SERVER (server))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_int (out_values++, bse_gconfig_locked ());
-
++
return BSE_ERROR_NONE;
}
+
typedef struct _ScriptRegistration ScriptRegistration;
struct _ScriptRegistration
{
@@@ -155,6 -182,7 +182,7 @@@ register_scripts (gpointer data
return FALSE;
}
g_object_set_data ((GObject*) server, "script-registration-queue", scr->next);
-
++
error = scr->register_func (scr->script, &janitor);
if (!janitor)
bse_server_registration (server, BSE_REGISTER_SCRIPT, scr->script, bse_error_blurb (error));
@@@ -178,15 -207,18 +207,18 @@@ BODY (BseProcedureClass *proc
BseServer *server = (BseServer*) bse_value_get_object (in_values++);
ScriptRegistration *scr_list = NULL;
SfiRing *ring;
-
++
/* check parameters */
if (!BSE_IS_SERVER (server))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
if (registration_done)
{
bse_server_registration (server, BSE_REGISTER_DONE, NULL, NULL);
return BSE_ERROR_NONE;
}
registration_done = TRUE;
-
++
ring = bse_script_path_list_files ();
while (ring)
{
@@@ -196,16 -228,20 +228,20 @@@
scr->next = scr_list;
scr_list = scr;
}
-
++
g_object_set_data ((GObject*) server, "script-registration-queue", scr_list);
bse_idle_normal (register_scripts, server);
-
++
return BSE_ERROR_NONE;
}
+
static gboolean
register_core_plugins (gpointer data)
{
BseServer *server = (BseServer*) data;
SfiRing *plugins = (SfiRing*) g_object_get_data ((GObject*) server, "plugin-registration-queue");
const gchar *error;
-
++
if (plugins)
{
char *name = (char*) sfi_ring_pop_head (&plugins);
@@@ -234,31 -271,39 +271,39 @@@ BODY (BseProcedureClass *proc
/* extract parameter values */
BseServer *server = (BseServer*) bse_value_get_object (in_values++);
SfiRing *ring;
-
++
/* check parameters */
if (!BSE_IS_SERVER (server))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
if (registration_done)
{
bse_server_registration (server, BSE_REGISTER_DONE, NULL, NULL);
return BSE_ERROR_NONE;
}
registration_done = TRUE;
-
++
ring = bse_plugin_path_list_files (!bse_main_args->load_drivers_early, TRUE);
g_object_set_data ((GObject*) server, "plugin-registration-queue", ring);
-
++
bse_idle_normal (register_core_plugins, server);
-
++
return BSE_ERROR_NONE;
}
+
static gboolean
register_ladspa_plugins (gpointer data)
{
BseServer *server = (BseServer*) data;
SfiRing *lplugins = (SfiRing*) g_object_get_data ((GObject*) server, "ladspa-registration-queue");
const gchar *error;
-
++
if (g_object_get_data ((GObject*) server, "plugin-registration-queue"))
{
/* give precedence to core plugins until they're done registering */
return TRUE;
}
-
++
if (lplugins)
{
char *name = (char*) sfi_ring_pop_head (&lplugins);
@@@ -287,20 -333,26 +333,26 @@@ BODY (BseProcedureClass *proc
/* extract parameter values */
BseServer *server = (BseServer*) bse_value_get_object (in_values++);
SfiRing *ring;
-
++
/* check parameters */
if (!BSE_IS_SERVER (server))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
if (registration_done)
{
bse_server_registration (server, BSE_REGISTER_DONE, NULL, NULL);
return BSE_ERROR_NONE;
}
registration_done = TRUE;
-
++
ring = bse_ladspa_plugin_path_list_files ();
g_object_set_data ((GObject*) server, "ladspa-registration-queue", ring);
-
++
bse_idle_normal (register_ladspa_plugins, server);
-
++
return BSE_ERROR_NONE;
}
+
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@@ -321,9 -374,11 +374,11 @@@ BODY (BseProcedureClass *proc
GValue *value;
SfiRec *rec;
gint fd;
-
++
/* check parameters */
if (!BSE_IS_SERVER (server))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
file_name = g_strconcat (g_get_home_dir (), "/.bserc", NULL);
fd = open (file_name,
O_WRONLY | O_CREAT | O_TRUNC, /* O_EXCL, */
@@@ -331,8 -386,10 +386,10 @@@
g_free (file_name);
if (fd < 0)
return BSE_ERROR_NONE;
-
++
wstore = sfi_wstore_new ();
sfi_wstore_printf (wstore, "; rc-file for BSE v%s\n", BSE_VERSION);
-
++
/* store BseGConfig */
sfi_wstore_puts (wstore, "\n; BseGConfig Dump\n");
rec = bse_gconfig_to_rec (bse_global_config);
@@@ -341,12 -398,15 +398,15 @@@
sfi_value_free (value);
sfi_rec_unref (rec);
sfi_wstore_puts (wstore, "\n");
-
++
/* flush stuff to rc file */
sfi_wstore_flush_fd (wstore, fd);
sfi_wstore_destroy (wstore);
close (fd);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseServer, start-recording) {
HELP = "Start recording to a WAV file.";
IN = bse_param_spec_object ("server", "Server", NULL,
diff --cc bse/bsesnet.cc
index f259698,5fd169b..d29b172
--- a/bse/bsesnet.cc
+++ b/bse/bsesnet.cc
@@@ -112,6 -130,7 +130,7 @@@ bse_snet_finalize (GObject *object
{
BseSNet *snet = BSE_SNET (object);
BseContainer *container = BSE_CONTAINER (object);
-
++
while (snet->sources)
bse_container_remove_item (container, (BseItem*) sfi_ring_pop_head (&snet->sources));
while (snet->isources)
@@@ -125,20 -144,26 +144,26 @@@
g_warning ("%s: %s: leaking %cport \"%s\"", G_STRLOC, G_OBJECT_TYPE_NAME (snet), 'i', (gchar*)
snet->iport_names->data);
if (snet->oport_names)
g_warning ("%s: %s: leaking %cport \"%s\"", G_STRLOC, G_OBJECT_TYPE_NAME (snet), 'o', (gchar*)
snet->oport_names->data);
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->finalize (object);
-
++
g_return_if_fail (snet->port_unregistered_id == 0);
}
+
static gboolean
snet_notify_port_unregistered (gpointer data)
{
BseSNet *snet = BSE_SNET (data);
-
++
BSE_THREADS_ENTER ();
snet->port_unregistered_id = 0;
g_signal_emit (snet, signal_port_unregistered, 0);
BSE_THREADS_LEAVE ();
-
++
return FALSE;
}
+
static void
bse_snet_queue_port_unregistered (BseSNet *snet)
{
@@@ -152,6 -178,7 +178,7 @@@ bse_snet_set_property (GObject *ob
GParamSpec *pspec)
{
BseSNet *self = BSE_SNET (object);
-
++
switch (param_id)
{
case PARAM_AUTO_ACTIVATE:
@@@ -172,6 -200,7 +200,7 @@@ bse_snet_get_property (GObject *obje
GParamSpec *pspec)
{
BseSNet *self = BSE_SNET (object);
-
++
switch (param_id)
{
case PARAM_AUTO_ACTIVATE:
@@@ -187,11 -217,13 +217,13 @@@ bse_snet_add_item (BseContainer *contai
BseItem *item)
{
BseSNet *snet = BSE_SNET (container);
-
++
if (g_type_is_a (BSE_OBJECT_TYPE (item), BSE_TYPE_SOURCE))
snet->sources = sfi_ring_append (snet->sources, item);
else if (BSE_SNET_USER_SYNTH (snet))
g_warning ("BseSNet: cannot hold non-source item type `%s'",
BSE_OBJECT_TYPE_NAME (item));
-
++
/* chain parent class' add_item handler */
BSE_CONTAINER_CLASS (parent_class)->add_item (container, item);
}
@@@ -224,6 -260,7 +260,7 @@@ bse_snet_remove_item (BseContainer *con
BseItem *item)
{
BseSNet *self = BSE_SNET (container);
-
++
if (g_type_is_a (BSE_OBJECT_TYPE (item), BSE_TYPE_SOURCE))
{
SfiRing *node = sfi_ring_find (self->isources, item);
@@@ -235,6 -272,7 +272,7 @@@
else if (BSE_SNET_USER_SYNTH (self))
g_warning ("BseSNet: cannot hold non-source item type `%s'",
BSE_OBJECT_TYPE_NAME (item));
-
++
/* chain parent class' remove_item handler */
BSE_CONTAINER_CLASS (parent_class)->remove_item (container, item);
}
@@@ -244,6 -283,7 +283,7 @@@ snet_find_port_name (BseSNet *snet
gboolean in_port)
{
GSList *slist;
-
++
for (slist = in_port ? snet->iport_names : snet->oport_names; slist; slist = slist->next)
if (strcmp (name, (const char*) slist->data) == 0)
return slist;
@@@ -256,8 -297,10 +297,10 @@@ bse_snet_iport_name_register (BseSNe
GSList *slist;
gchar *name;
guint i;
-
++
g_return_val_if_fail (BSE_IS_SNET (snet), NULL);
g_return_val_if_fail (tmpl_name != NULL, NULL);
-
++
slist = snet_find_port_name (snet, tmpl_name, TRUE);
name = NULL;
i = 1;
@@@ -270,27 -313,36 +313,36 @@@
if (!name)
name = g_strdup (tmpl_name);
snet->iport_names = g_slist_prepend (snet->iport_names, name);
-
++
return name;
}
+
gboolean
bse_snet_iport_name_registered (BseSNet *snet,
const gchar *name)
{
GSList *slist;
-
++
g_return_val_if_fail (BSE_IS_SNET (snet), FALSE);
g_return_val_if_fail (name != NULL, FALSE);
-
++
slist = snet_find_port_name (snet, name, TRUE);
-
++
return slist != NULL;
}
+
void
bse_snet_iport_name_unregister (BseSNet *snet,
const gchar *name)
{
GSList *slist;
-
++
g_return_if_fail (BSE_IS_SNET (snet));
g_return_if_fail (name != NULL);
-
++
slist = snet_find_port_name (snet, name, TRUE);
g_return_if_fail (slist != NULL);
-
++
g_free (slist->data);
snet->iport_names = g_slist_delete_link (snet->iport_names, slist);
bse_snet_queue_port_unregistered (snet);
@@@ -302,8 -355,10 +355,10 @@@ bse_snet_oport_name_register (BseSNe
GSList *slist;
gchar *name;
guint i;
-
++
g_return_val_if_fail (BSE_IS_SNET (snet), NULL);
g_return_val_if_fail (tmpl_name != NULL, NULL);
-
++
slist = snet_find_port_name (snet, tmpl_name, FALSE);
name = NULL;
i = 1;
@@@ -316,27 -371,36 +371,36 @@@
if (!name)
name = g_strdup (tmpl_name);
snet->oport_names = g_slist_prepend (snet->oport_names, name);
-
++
return name;
}
+
gboolean
bse_snet_oport_name_registered (BseSNet *snet,
const gchar *name)
{
GSList *slist;
-
++
g_return_val_if_fail (BSE_IS_SNET (snet), FALSE);
g_return_val_if_fail (name != NULL, FALSE);
-
++
slist = snet_find_port_name (snet, name, FALSE);
-
++
return slist != NULL;
}
+
void
bse_snet_oport_name_unregister (BseSNet *snet,
const gchar *name)
{
GSList *slist;
-
++
g_return_if_fail (BSE_IS_SNET (snet));
g_return_if_fail (name != NULL);
-
++
slist = snet_find_port_name (snet, name, FALSE);
g_return_if_fail (slist != NULL);
-
++
g_free (slist->data);
snet->oport_names = g_slist_delete_link (snet->oport_names, slist);
bse_snet_queue_port_unregistered (snet);
@@@ -348,13 -413,16 +413,16 @@@ snet_ports_compare (gconstpointer bsear
const BseSNetPort *p1 = (const BseSNetPort*) bsearch_node1;
const BseSNetPort *p2 = (const BseSNetPort*) bsearch_node2;
gint cmp;
-
++
cmp = G_BSEARCH_ARRAY_CMP (p1->context, p2->context);
if (!cmp)
cmp = G_BSEARCH_ARRAY_CMP (p1->input, p2->input);
if (!cmp)
cmp = strcmp (p1->name, p2->name);
-
++
return cmp;
}
+
static BseSNetPort*
port_lookup (BseSNet *snet,
const gchar *name,
@@@ -392,8 -464,10 +464,10 @@@ port_delete (BseSNet *snet
BseSNetPort *port)
{
guint index = g_bsearch_array_get_index (snet->port_array, &port_array_config, port);
-
++
g_return_if_fail (index < g_bsearch_array_get_n_nodes (snet->port_array));
g_return_if_fail (port->src_omodule == NULL && port->dest_imodule == NULL);
-
++
g_free (port->name);
g_bsearch_array_remove (snet->port_array, &port_array_config, index);
}
@@@ -406,12 -481,14 +481,14 @@@ bse_snet_set_iport_src (BseSNet *sn
BseTrans *trans)
{
BseSNetPort *port;
-
++
g_return_if_fail (BSE_IS_SNET (snet));
g_return_if_fail (name != NULL);
g_return_if_fail (bse_source_has_context (BSE_SOURCE (snet), snet_context));
if (omodule)
g_return_if_fail (ostream < BSE_MODULE_N_OSTREAMS (omodule));
g_return_if_fail (trans != NULL);
-
++
port = port_lookup (snet, name, snet_context, TRUE);
if (!port && !omodule)
return;
@@@ -419,6 -496,7 +496,7 @@@
port = port_insert (snet, name, snet_context, TRUE);
else if (!omodule)
ostream = G_MAXUINT;
-
++
if (port->src_omodule && port->dest_imodule)
bse_trans_add (trans, bse_job_disconnect (port->dest_imodule, port->dest_istream));
port->src_omodule = omodule;
@@@ -438,12 -517,14 +517,14 @@@ bse_snet_set_iport_dest (BseSNet *s
BseTrans *trans)
{
BseSNetPort *port;
-
++
g_return_if_fail (BSE_IS_SNET (snet));
g_return_if_fail (name != NULL);
g_return_if_fail (bse_source_has_context (BSE_SOURCE (snet), snet_context));
if (imodule)
g_return_if_fail (istream < BSE_MODULE_N_ISTREAMS (imodule));
g_return_if_fail (trans != NULL);
-
++
port = port_lookup (snet, name, snet_context, TRUE);
if (!port && !imodule)
return;
@@@ -451,6 -532,7 +532,7 @@@
port = port_insert (snet, name, snet_context, TRUE);
else if (!imodule)
istream = G_MAXUINT;
-
++
if (port->src_omodule && port->dest_imodule)
bse_trans_add (trans, bse_job_disconnect (port->dest_imodule, port->dest_istream));
port->dest_imodule = imodule;
@@@ -470,12 -553,14 +553,14 @@@ bse_snet_set_oport_src (BseSNet *sn
BseTrans *trans)
{
BseSNetPort *port;
-
++
g_return_if_fail (BSE_IS_SNET (snet));
g_return_if_fail (name != NULL);
g_return_if_fail (bse_source_has_context (BSE_SOURCE (snet), snet_context));
if (omodule)
g_return_if_fail (ostream < BSE_MODULE_N_OSTREAMS (omodule));
g_return_if_fail (trans != NULL);
-
++
port = port_lookup (snet, name, snet_context, FALSE);
if (!port && !omodule)
return;
@@@ -483,6 -568,7 +568,7 @@@
port = port_insert (snet, name, snet_context, FALSE);
else if (!omodule)
ostream = G_MAXUINT;
-
++
if (port->src_omodule && port->dest_imodule)
bse_trans_add (trans, bse_job_disconnect (port->dest_imodule, port->dest_istream));
port->src_omodule = omodule;
@@@ -502,12 -589,14 +589,14 @@@ bse_snet_set_oport_dest (BseSNet *s
BseTrans *trans)
{
BseSNetPort *port;
-
++
g_return_if_fail (BSE_IS_SNET (snet));
g_return_if_fail (name != NULL);
g_return_if_fail (bse_source_has_context (BSE_SOURCE (snet), snet_context));
if (imodule)
g_return_if_fail (istream < BSE_MODULE_N_ISTREAMS (imodule));
g_return_if_fail (trans != NULL);
-
++
port = port_lookup (snet, name, snet_context, FALSE);
if (!port && !imodule)
return;
@@@ -515,6 -604,7 +604,7 @@@
port = port_insert (snet, name, snet_context, FALSE);
else if (!imodule)
istream = G_MAXUINT;
-
++
if (port->src_omodule && port->dest_imodule)
bse_trans_add (trans, bse_job_disconnect (port->dest_imodule, port->dest_istream));
port->dest_imodule = imodule;
@@@ -539,6 -631,7 +631,7 @@@ create_context_data (BseSNet *s
guint midi_channel)
{
ContextData *cdata = g_new0 (ContextData, 1);
-
++
cdata->context_id = context_id;
cdata->midi_receiver = bse_midi_receiver_ref (midi_receiver);
cdata->midi_channel = midi_channel;
@@@ -548,6 -641,7 +641,7 @@@
{
ContextData *pdata = find_context_data (self, parent_context);
guint i;
-
++
i = pdata->n_branches++;
pdata->branches = g_renew (guint, pdata->branches, pdata->n_branches);
pdata->branches[i] = context_id;
@@@ -555,8 -649,10 +649,10 @@@
}
else
cdata->parent_context = 0;
-
++
return cdata;
}
+
static void
free_context_data (BseSource *source,
gpointer data,
@@@ -571,7 -669,9 +669,9 @@@
{
ContextData *pdata = find_context_data (self, cdata->parent_context);
guint i, swap_context;
-
++
g_return_if_fail (pdata->n_branches > 0);
-
++
pdata->n_branches--;
swap_context = pdata->branches[pdata->n_branches];
for (i = 0; i < pdata->n_branches; i++)
@@@ -591,16 -692,21 +692,21 @@@ bse_snet_create_context (BseSNe
{
ContextData *cdata;
guint cid;
-
++
g_return_val_if_fail (BSE_IS_SNET (self), 0);
g_return_val_if_fail (BSE_SOURCE_PREPARED (self), 0);
g_return_val_if_fail (mcontext.midi_receiver != NULL, 0);
g_return_val_if_fail (trans != NULL, 0);
-
++
cid = bse_id_alloc ();
g_return_val_if_fail (bse_source_has_context (BSE_SOURCE (self), cid) == FALSE, 0);
-
++
cdata = create_context_data (self, cid, 0, mcontext.midi_receiver, mcontext.midi_channel);
bse_source_create_context_with_data (BSE_SOURCE (self), cid, cdata, free_context_data, trans);
-
++
return cid;
}
+
guint
bse_snet_context_clone_branch (BseSNet *self,
guint context,
@@@ -610,6 -716,7 +716,7 @@@
{
SfiRing *ring;
guint bcid = 0;
-
++
g_return_val_if_fail (BSE_IS_SNET (self), 0);
g_return_val_if_fail (BSE_SOURCE_PREPARED (self), 0);
g_return_val_if_fail (bse_source_has_context (BSE_SOURCE (self), context), 0);
@@@ -618,11 -725,13 +725,13 @@@
g_return_val_if_fail (BSE_ITEM (context_merger)->parent == BSE_ITEM (self), 0);
g_return_val_if_fail (mcontext.midi_receiver != NULL, 0);
g_return_val_if_fail (trans != NULL, 0);
-
++
ring = bse_source_collect_inputs_recursive (context_merger);
if (!BSE_SOURCE_COLLECTED (context_merger))
{
ContextData *cdata;
SfiRing *node;
-
++
g_assert (self->tmp_context_children == NULL);
for (node = ring; node; node = sfi_ring_walk (node, ring))
self->tmp_context_children = g_slist_prepend (self->tmp_context_children, node->data);
@@@ -638,16 -747,21 +747,21 @@@
g_warning ("%s: context merger forms a cycle with it's inputs", G_STRLOC);
bse_source_free_collection (ring);
}
-
-
++
++
return bcid;
}
+
gboolean
bse_snet_context_is_branch (BseSNet *self,
guint context_id)
{
ContextData *cdata;
-
++
g_return_val_if_fail (BSE_IS_SNET (self), FALSE);
g_return_val_if_fail (BSE_SOURCE_PREPARED (self), FALSE);
g_return_val_if_fail (context_id > 0, FALSE);
-
++
cdata = find_context_data (self, context_id);
return cdata ? cdata->parent_context > 0 : FALSE;
}
@@@ -656,6 -771,7 +771,7 @@@ snet_context_children (BseContainer *co
{
BseSNet *self = BSE_SNET (container);
GSList *slist;
-
++
if (self->tmp_context_children)
{
slist = self->tmp_context_children;
@@@ -663,15 -779,19 +779,19 @@@
}
else
slist = BSE_CONTAINER_CLASS (parent_class)->context_children (container);
-
++
return slist;
}
+
BseMidiContext
bse_snet_get_midi_context (BseSNet *self,
guint context_handle)
{
BseMidiContext mcontext = { 0, };
ContextData *cdata;
+
g_return_val_if_fail (BSE_IS_SNET (self), mcontext);
-
++
cdata = find_context_data (self, context_handle);
if (cdata)
{
@@@ -684,9 -805,12 +805,12 @@@ static voi
bse_snet_prepare (BseSource *source)
{
BseSNet *snet = BSE_SNET (source);
-
++
g_return_if_fail (snet->port_array == NULL);
-
++
bse_object_lock (BSE_OBJECT (snet));
snet->port_array = g_bsearch_array_create (&port_array_config);
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->prepare (source);
}
@@@ -694,9 -819,12 +819,12 @@@ static voi
bse_snet_reset (BseSource *source)
{
BseSNet *self = BSE_SNET (source);
-
++
g_return_if_fail (self->port_array != NULL);
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->reset (source);
-
++
if (g_bsearch_array_get_n_nodes (self->port_array))
{
BseSNetPort *port = (BseSNetPort*) g_bsearch_array_get_nth (self->port_array, &port_array_config, 0);
@@@ -706,19 -835,24 +835,24 @@@
}
g_bsearch_array_free (self->port_array, &port_array_config);
self->port_array = NULL;
-
++
bse_object_unlock (BSE_OBJECT (self));
}
+
static void
bse_snet_context_create (BseSource *source,
guint context_handle,
BseTrans *trans)
{
BseSNet *self = BSE_SNET (source);
-
++
if (self->tmp_context_children)
{
BseContextMerger *context_merger = (BseContextMerger*) self->tmp_context_children->data;
ContextData *cdata = find_context_data (self, context_handle);
-
++
g_assert (BSE_IS_CONTEXT_MERGER (context_merger));
-
++
bse_context_merger_set_merge_context (context_merger, cdata->parent_context);
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_create (source, context_handle, trans);
@@@ -738,8 -873,10 +873,10 @@@ bse_snet_context_connect (BseSource *so
BseSNet *self = BSE_SNET (source);
ContextData *cdata = find_context_data (self, context_handle);
guint i;
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_connect (source, context_handle, trans);
-
++
for (i = 0; i < cdata->n_branches; i++)
bse_source_connect_context (source, cdata->branches[i], trans);
}
@@@ -750,8 -888,10 +888,10 @@@ bse_snet_context_dismiss (BseSource *so
{
BseSNet *self = BSE_SNET (source);
ContextData *cdata = find_context_data (self, context_handle);
-
++
while (cdata->n_branches)
bse_source_dismiss_context (source, cdata->branches[cdata->n_branches - 1], trans);
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_dismiss (source, context_handle, trans);
}
@@@ -767,16 -910,19 +910,19 @@@ bse_snet_class_init (BseSNetClass *klas
gobject_class->get_property = bse_snet_get_property;
gobject_class->dispose = bse_snet_dispose;
gobject_class->finalize = bse_snet_finalize;
-
++
source_class->prepare = bse_snet_prepare;
source_class->context_create = bse_snet_context_create;
source_class->context_connect = bse_snet_context_connect;
source_class->context_dismiss = bse_snet_context_dismiss;
source_class->reset = bse_snet_reset;
-
++
container_class->add_item = bse_snet_add_item;
container_class->remove_item = bse_snet_remove_item;
container_class->forall_items = bse_snet_forall_items;
container_class->context_children = snet_context_children;
container_class->release_children = bse_snet_release_children;
-
++
bse_object_class_add_param (object_class, "Playback Settings",
PARAM_AUTO_ACTIVATE,
sfi_pspec_bool ("auto_activate", "Auto Activate",
diff --cc bse/bsesnet.proc
index 16c65a7,3973c7a..7f8ef88
--- a/bse/bsesnet.proc
+++ b/bse/bsesnet.proc
@@@ -42,19 -50,24 +50,24 @@@ METHOD (BseSNet, can-create-source)
const gchar *type_name = sfi_value_get_string (in_values++);
GType type = g_type_from_name (type_name);
BseErrorType error = BSE_ERROR_NONE;
-
++
/* check parameters */
if (!BSE_IS_SNET (snet))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
if (!BSE_SNET_USER_SYNTH (snet) && !BSE_DBG_EXT)
error = BSE_ERROR_NOT_OWNER;
else if (!g_type_is_a (type, BSE_TYPE_SOURCE) ||
g_type_is_a (type, BSE_TYPE_CONTAINER))
error = BSE_ERROR_SOURCE_TYPE_INVALID;
-
++
/* set output parameters */
g_value_set_enum (out_values++, error);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSNet, create-source) {
HELP = "Insert a new module into a synthesis network";
IN = bse_param_spec_object ("snet", "Synth Net", NULL,
@@@ -79,15 -93,19 +93,19 @@@
if (bse_item_exec (container, "can-create-source", type_name, &error) != 0 ||
error != 0)
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
ustack = bse_item_undo_open (container, "create-source");
child = (BseItem*) bse_container_new_child (container, g_type_from_name (type_name), NULL);
bse_item_push_undo_proc (container, "remove-source", child);
bse_item_undo_close (ustack);
+
/* set output parameters */
bse_value_set_object (out_values++, child);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSNet, remove-source) {
HELP = "Remove an existing module from its synthesis network";
IN = bse_param_spec_object ("snet", "Synth Net", NULL,
@@@ -110,6 -129,7 +129,7 @@@
if (!BSE_IS_SNET (self) || !BSE_IS_SOURCE (child) || child->parent != (BseItem*) self ||
(!BSE_SNET_USER_SYNTH (self) && !BSE_DBG_EXT))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
ustack = bse_item_undo_open (self, "remove-child %s", bse_object_debug_name (child));
/* remove object references */
@@@ -120,7 -140,9 +140,9 @@@
bse_container_remove_backedup (BSE_CONTAINER (self), child, ustack);
/* done */
bse_item_undo_close (ustack);
-
++
/* set output parameters */
g_value_set_enum (out_values++, error);
-
++
return BSE_ERROR_NONE;
}
diff --cc bse/bsesnooper.cc
index 20c8665,2623fc0..a1feba2
--- a/bse/bsesnooper.cc
+++ b/bse/bsesnooper.cc
@@@ -30,25 -39,30 +39,30 @@@ BSE_BUILTIN_TYPE (BseSnooper
{
static const GTypeInfo type_info = {
sizeof (BseSnooperClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_snooper_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseSnooper),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_snooper_init,
};
#include "./icons/snooper.c"
GType type_id;
-
++
type_id = bse_type_register_static (BSE_TYPE_SOURCE,
"BseSnooper",
"The Snooper module prints statistics about the incoming signal",
__FILE__, __LINE__,
&type_info);
bse_categories_register_stock_module (N_("/Misc/Snooper"), type_id, snooper_pixstream);
-
++
return type_id;
}
+
static void
bse_snooper_class_init (BseSnooperClass *klass)
{
@@@ -57,11 -71,16 +71,16 @@@
BseItemClass *item_class = BSE_ITEM_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
guint ichannel;
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = bse_snooper_set_property;
gobject_class->get_property = bse_snooper_get_property;
-
++
item_class->needs_storage = bse_snooper_needs_storage;
+
source_class->context_create = bse_snooper_context_create;
-
++
bse_object_class_add_param (object_class, "Context",
PARAM_CONTEXT_ID,
sfi_pspec_int ("context_id", "Context",
@@@ -69,6 -88,7 +88,7 @@@
"the context id, which is used to actually snoop data.",
0, 0, 65535, 1,
SFI_PARAM_STANDARD));
-
++
ichannel = bse_source_class_add_ichannel (source_class, "signal-in", _("Signal In"), _("Snoop Signal"));
g_assert (ichannel == BSE_SNOOPER_ICHANNEL_MONO);
}
@@@ -181,14 -210,18 +210,18 @@@ bse_snooper_context_create (BseSource *
BseSnooper *snooper = BSE_SNOOPER (source);
SnoopData *data = g_new0 (SnoopData, 1);
BseModule *module;
-
++
data->context_id = context_handle;
data->active_context_id = &snooper->active_context_id;
module = bse_module_new (&snooper_class, data);
-
++
/* setup module i/o streams with BseSource i/o channels */
bse_source_set_context_module (source, context_handle, module);
-
++
/* commit module to engine */
bse_trans_add (trans, bse_job_integrate (module));
bse_trans_add (trans, bse_job_set_consumer (module, TRUE));
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_create (source, context_handle, trans);
}
diff --cc bse/bsesong.cc
index d4e07cd,1cbc52b..279cc2e
--- a/bse/bsesong.cc
+++ b/bse/bsesong.cc
@@@ -42,15 -50,18 +50,18 @@@ BSE_BUILTIN_TYPE (BseSong
{
static const GTypeInfo song_info = {
sizeof (BseSongClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_song_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseSong),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_song_init,
};
-
++
return bse_type_register_static (BSE_TYPE_SNET,
"BseSong",
"BSE Song type",
@@@ -90,6 -108,7 +108,7 @@@ bse_song_finalize (GObject *object
self->postprocess = NULL;
bse_container_remove_item (BSE_CONTAINER (self), BSE_ITEM (self->output));
self->output = NULL;
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@@ -303,11 -329,15 +329,15 @@@ bse_song_lookup (BseProject *project
const gchar *name)
{
BseItem *item;
-
++
g_return_val_if_fail (BSE_IS_PROJECT (project), NULL);
g_return_val_if_fail (name != NULL, NULL);
-
++
item = bse_container_lookup_item (BSE_CONTAINER (project), name);
-
++
return BSE_IS_SONG (item) ? BSE_SONG (item) : NULL;
}
+
static void
bse_song_set_parent (BseItem *item,
BseItem *parent)
@@@ -375,6 -418,7 +418,7 @@@ bse_song_remove_item (BseContainer *con
BseItem *item)
{
BseSong *self = BSE_SONG (container);
-
++
if (g_type_is_a (BSE_OBJECT_TYPE (item), BSE_TYPE_TRACK))
{
SfiRing *ring, *tmp;
@@@ -525,11 -596,15 +586,15 @@@ bse_song_init (BseSong *self
self->numerator = timing.numerator;
self->denominator = timing.denominator;
self->bpm = timing.bpm;
-
++
self->parts = NULL;
self->busses = NULL;
+
self->pnet = NULL;
+
self->last_position = -1;
self->position_handler = 0;
+
self->tracks_SL = NULL;
self->loop_enabled_SL = 0;
self->loop_left_SL = -1;
@@@ -620,15 -704,20 +694,20 @@@ bse_song_class_init (BseSongClass *klas
BseContainerClass *container_class = BSE_CONTAINER_CLASS (klass);
BseSuperClass *super_class = BSE_SUPER_CLASS (klass);
BseSongTiming timing;
+
parent_class = (GTypeClass*) g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = bse_song_set_property;
gobject_class->get_property = bse_song_get_property;
gobject_class->finalize = bse_song_finalize;
-
++
item_class->set_parent = bse_song_set_parent;
item_class->get_candidates = bse_song_get_candidates;
+
source_class->prepare = bse_song_prepare;
source_class->context_create = bse_song_context_create;
source_class->reset = bse_song_reset;
-
++
container_class->add_item = bse_song_add_item;
container_class->remove_item = bse_song_remove_item;
container_class->forall_items = bse_song_forall_items;
diff --cc bse/bsesong.hh
index f631f79,39c7db6..d4d5873
--- a/bse/bsesong.hh
+++ b/bse/bsesong.hh
@@@ -10,12 -15,17 +15,14 @@@ G_BEGIN_DECL
#define BSE_IS_SONG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BSE_TYPE_SONG))
#define BSE_IS_SONG_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), BSE_TYPE_SONG))
#define BSE_SONG_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BSE_TYPE_SONG, BseSongClass))
+
+
/* --- BseSong object --- */
-typedef struct {
+struct BseSongVoice {
BseSource *constant;
BseSource *sub_synth;
-} BseSongVoice;
-struct _BseSong
-{
- BseSNet parent_instance;
-
+};
+struct BseSong : BseSNet {
guint tpqn; /* ticks per querter note */
guint numerator;
guint denominator;
diff --cc bse/bsesong.proc
index 5cf9a50,7b64b56..916abb3
--- a/bse/bsesong.proc
+++ b/bse/bsesong.proc
@@@ -33,6 -36,7 +36,7 @@@ METHOD (BseSong, create-bus)
/* check parameters */
if (!BSE_IS_SONG (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
if (BSE_SOURCE_PREPARED (self))
error = BSE_ERROR_SOURCE_BUSY;
@@@ -43,10 -47,13 +47,13 @@@
bse_item_push_undo_proc (self, "remove-bus", child);
bse_item_undo_close (ustack);
}
+
/* set output parameters */
bse_value_set_object (out_values++, child);
-
++
return error;
}
+
METHOD (BseSong, remove-bus) {
HELP = _("Delete a mixer bus from a Song.");
IN = bse_param_spec_object ("song", NULL, NULL,
@@@ -61,9 -68,11 +68,11 @@@
BseSong *self = (BseSong*) bse_value_get_object (in_values++);
BseItem *child = (BseItem*) bse_value_get_object (in_values++);
BseErrorType error = BSE_ERROR_NONE;
-
++
/* check parameters */
if (!BSE_IS_SONG (self) || !BSE_IS_BUS (child) || BSE_ITEM (child)->parent != BSE_ITEM (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
if (BSE_SOURCE_PREPARED (self))
error = BSE_ERROR_SOURCE_BUSY;
@@@ -99,12 -111,16 +111,16 @@@ METHOD (BseSong, ensure-master-bus)
/* check parameters */
if (!BSE_IS_SONG (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
child = bse_song_ensure_master (self);
+
/* set output parameters */
bse_value_set_object (out_values++, child);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSong, get-master-bus) {
HELP = _("Retrieve master output bus of a song if it exists.");
IN = bse_param_spec_object ("song", NULL, NULL,
@@@ -120,12 -137,16 +137,16 @@@
/* check parameters */
if (!BSE_IS_SONG (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
BseBus *bus = bse_song_find_master (self);
+
/* set output parameters */
bse_value_set_object (out_values++, bus);
-
++
return BSE_ERROR_NONE;
}
+
static const gchar*
orphans_track_name (void)
{
@@@ -178,6 -203,7 +203,7 @@@ METHOD (BseSong, ensure-track-links)
/* check parameters */
if (!BSE_IS_SONG (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
gboolean clear_undo = FALSE;
SfiRing *ring;
@@@ -194,8 -220,10 +220,10 @@@
if (project)
bse_project_clear_undo (project);
}
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSong, create-part) {
HELP = _("Create a new Part in a Song.");
IN = bse_param_spec_object ("song", NULL, NULL,
@@@ -356,10 -404,13 +404,13 @@@ METHOD (BseSong, find-track-for-part)
tick = start;
}
}
+
/* set output parameters */
bse_value_set_object (out_values++, track);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSong, find-any-track-for-part) {
HELP = _("Find the first track that contains part, suitable to check for orphan parts.");
IN = bse_param_spec_object ("song", "Song", NULL,
@@@ -379,10 -431,13 +431,13 @@@
if (!BSE_IS_SONG (self) || !BSE_IS_PART (part) ||
BSE_ITEM (part)->parent != BSE_ITEM (self))
return BSE_ERROR_PROC_PARAM_INVAL;
+
/* set output parameters */
bse_value_set_object (out_values++, bse_song_find_first_track (self, part));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSong, synthesize-note) {
HELP = _("Synthesize a note on a song of an active project.");
IN = bse_param_spec_object ("song", "Song", NULL,
@@@ -408,10 -463,12 +463,12 @@@
gint note = sfi_value_get_note (in_values++);
gint fine_tune = sfi_value_get_int (in_values++);
gfloat velocity = sfi_value_get_real (in_values++);
-
++
/* check parameters */
if (!BSE_IS_SONG (self) || !BSE_IS_TRACK (track) ||
BSE_ITEM (track)->parent != BSE_ITEM (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
if (BSE_SOURCE_PREPARED (self) && self->midi_receiver_SL)
{
@@@ -426,8 -483,10 +483,10 @@@
bse_midi_receiver_process_events (self->midi_receiver_SL, tstamp + duration);
bse_project_keep_activated (BSE_PROJECT (BSE_ITEM (self)->parent), tstamp + duration);
}
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSong, get-timing) {
HELP = _("Retrieve song timing information at a specific tick.");
IN = bse_param_spec_object ("song", "Song", NULL, BSE_TYPE_SONG, SFI_PARAM_STANDARD);
@@@ -444,9 -504,12 +504,12 @@@
/* check parameters */
if (!BSE_IS_SONG (self))
return BSE_ERROR_PROC_PARAM_INVAL;
+
/* action */
bse_song_get_timing (self, tick, &timing);
+
/* set output parameters */
bse_value_set_boxed (out_values++, &timing);
-
++
return BSE_ERROR_NONE;
}
diff --cc bse/bsesource.cc
index ba31a16,fec90f8..8347571
--- a/bse/bsesource.cc
+++ b/bse/bsesource.cc
@@@ -242,10 -277,12 +277,12 @@@ bse_source_class_add_ochannel (BseSourc
BseSourceChannelDefs *defs;
guint i;
gchar *cname;
-
++
g_return_val_if_fail (BSE_IS_SOURCE_CLASS (source_class), 0);
g_return_val_if_fail (ident != NULL, 0);
if (!label)
label = ident;
-
++
cname = channel_dup_canonify (ident);
if (bse_source_class_has_channel (source_class, cname))
{
@@@ -262,8 -299,10 +299,10 @@@
defs->ochannel_idents[i] = cname;
defs->ochannel_labels[i] = g_strdup (label);
defs->ochannel_blurbs[i] = g_strdup (blurb);
-
++
return i;
}
+
void
bse_source_class_cache_engine_class (BseSourceClass *source_class,
const BseModuleClass *engine_class)
@@@ -326,8 -371,9 +371,9 @@@ source_notify_properties (BseSource *se
source_class_collect_properties (BSE_SOURCE_GET_CLASS (self));
SfiRing *ring;
for (ring = klass->unprepared_properties; ring; ring = sfi_ring_walk (ring, klass->unprepared_properties))
- g_object_notify ((GObject*) self, G_PARAM_SPEC (ring->data)->name);
+ g_object_notify (self, G_PARAM_SPEC (ring->data)->name);
}
+
static gint
contexts_compare (gconstpointer bsearch_node1, /* key */
gconstpointer bsearch_node2)
@@@ -346,16 -395,18 +395,18 @@@ bse_source_prepare (BseSource *source
g_return_if_fail (BSE_IS_SOURCE (source));
g_return_if_fail (!BSE_SOURCE_PREPARED (source));
g_return_if_fail (source->contexts == NULL);
-
++
g_object_ref (source);
- g_object_freeze_notify (G_OBJECT (source));
+ g_object_freeze_notify (source);
source_class_collect_properties (BSE_SOURCE_GET_CLASS (source));
source->contexts = g_bsearch_array_create (&context_config);
- BSE_OBJECT_SET_FLAGS (source, BSE_SOURCE_FLAG_PREPARED); /* guard properties from _before_ preapre()
*/
+ BSE_OBJECT_SET_FLAGS (source, BSE_SOURCE_FLAG_PREPARED); /* guard properties from _before_ prepare()
*/
BSE_SOURCE_GET_CLASS (source)->prepare (source);
source_notify_properties (source);
- g_object_thaw_notify (G_OBJECT (source));
+ g_object_thaw_notify (source);
g_object_unref (source);
}
+
static void
bse_source_real_reset (BseSource *source)
{
@@@ -367,8 -420,9 +420,9 @@@ bse_source_reset (BseSource *source
g_return_if_fail (BSE_IS_SOURCE (source));
g_return_if_fail (BSE_SOURCE_PREPARED (source));
g_return_if_fail (source->contexts != NULL);
-
++
g_object_ref (source);
- g_object_freeze_notify (G_OBJECT (source));
+ g_object_freeze_notify (source);
n_contexts = BSE_SOURCE_N_CONTEXTS (source);
if (n_contexts)
{
@@@ -387,9 -441,10 +441,10 @@@
g_bsearch_array_free (source->contexts, &context_config);
source->contexts = NULL;
source_notify_properties (source);
- g_object_thaw_notify (G_OBJECT (source));
+ g_object_thaw_notify (source);
g_object_unref (source);
}
+
static gint
automation_properties_cmp (gconstpointer bsearch_node1, /* key */
gconstpointer bsearch_node2)
@@@ -793,6 -898,7 +898,7 @@@ bse_source_get_context_imodule (BseSour
g_return_val_if_fail (BSE_IS_SOURCE (source), NULL);
g_return_val_if_fail (BSE_SOURCE_PREPARED (source), NULL);
g_return_val_if_fail (BSE_SOURCE_N_ICHANNELS (source) > 0, NULL);
-
++
context = context_lookup (source, context_handle);
if (!context)
{
@@@ -846,9 -958,11 +958,11 @@@ bse_source_get_context_omodule (BseSour
guint context_handle)
{
BseSourceContext *context;
-
++
g_return_val_if_fail (BSE_IS_SOURCE (source), NULL);
g_return_val_if_fail (BSE_SOURCE_PREPARED (source), NULL);
g_return_val_if_fail (BSE_SOURCE_N_OCHANNELS (source) > 0, NULL);
-
++
context = context_lookup (source, context_handle);
if (!context)
{
@@@ -867,6 -982,7 +982,7 @@@ bse_source_set_context_module (BseSourc
g_return_if_fail (module != NULL);
g_return_if_fail (BSE_MODULE_N_OSTREAMS (module) >= BSE_SOURCE_N_OCHANNELS (source));
g_return_if_fail (BSE_MODULE_N_ISTREAMS (module) + BSE_MODULE_N_JSTREAMS (module) >=
BSE_SOURCE_N_ICHANNELS (source));
-
++
if (BSE_SOURCE_N_ICHANNELS (source))
bse_source_set_context_imodule (source, context_handle, module);
if (BSE_SOURCE_N_OCHANNELS (source))
@@@ -888,6 -1006,7 +1006,7 @@@ bse_source_flow_access_module (BseSourc
g_return_if_fail (access_func != NULL);
g_return_if_fail (context_handle > 0);
g_return_if_fail (BSE_SOURCE_N_ICHANNELS (source) || BSE_SOURCE_N_OCHANNELS (source));
-
++
context = context_lookup (source, context_handle);
if (!context)
{
@@@ -927,6 -1050,7 +1050,7 @@@ bse_source_flow_access_modules (BseSour
g_return_if_fail (BSE_SOURCE_PREPARED (source));
g_return_if_fail (access_func != NULL);
g_return_if_fail (BSE_SOURCE_N_ICHANNELS (source) || BSE_SOURCE_N_OCHANNELS (source));
-
++
for (i = 0; i < BSE_SOURCE_N_CONTEXTS (source); i++)
{
BseSourceContext *context = context_nth (source, i);
@@@ -957,10 -1085,12 +1085,12 @@@ bse_source_access_modules (BseSourc
{
GSList *modules = NULL;
guint i;
-
++
g_return_if_fail (BSE_IS_SOURCE (source));
g_return_if_fail (BSE_SOURCE_PREPARED (source));
g_return_if_fail (access_func != NULL);
g_return_if_fail (BSE_SOURCE_N_ICHANNELS (source) || BSE_SOURCE_N_OCHANNELS (source));
-
++
for (i = 0; i < BSE_SOURCE_N_CONTEXTS (source); i++)
{
BseSourceContext *context = context_nth (source, i);
@@@ -1039,9 -1182,11 +1182,11 @@@ bse_source_real_add_input (BseSource *s
{
BseTrans *trans = bse_trans_open ();
guint c;
-
++
for (c = 0; c < BSE_SOURCE_N_CONTEXTS (source); c++)
{
BseSourceContext *context = context_nth (source, c);
-
++
bse_source_context_connect_ichannel (source, context, ichannel, trans, j);
}
bse_trans_commit (trans);
@@@ -1102,8 -1253,10 +1253,10 @@@ bse_source_set_input (BseSource *source
g_signal_emit (osource, signal_io_changed, 0);
g_object_unref (source);
g_object_unref (osource);
-
++
return BSE_ERROR_NONE;
}
+
static void
bse_source_real_remove_input (BseSource *source,
guint ichannel,
@@@ -1140,6 -1295,7 +1295,7 @@@
for (c = 0; c < BSE_SOURCE_N_CONTEXTS (source); c++)
{
BseSourceContext *context = context_nth (source, c);
-
++
bse_trans_add (trans, bse_job_disconnect (context->u.mods.imodule,
BSE_SOURCE_ICHANNEL_ISTREAM (source, ichannel)));
}
@@@ -1195,6 -1359,7 +1359,7 @@@ bse_source_unset_input (BseSource *sour
BseErrorType error = bse_source_check_input (source, ichannel, osource, ochannel);
if (error != BSE_ERROR_NONE)
return error;
-
++
g_object_ref (source);
g_object_ref (osource);
BSE_SOURCE_GET_CLASS (source)->remove_input (source, ichannel, osource, ochannel);
@@@ -1402,6 -1594,7 +1594,7 @@@ bse_source_backup_ichannels_to_undo (Bs
for (i = 0; i < BSE_SOURCE_N_ICHANNELS (source); i++)
{
BseSourceInput *input = BSE_SOURCE_INPUT (source, i);
-
++
if (BSE_SOURCE_IS_JOINT_ICHANNEL (source, i))
for (j = 0; j < input->jdata.n_joints; j++)
bse_source_input_backup_to_undo (source, i,
@@@ -1419,12 -1613,15 +1613,15 @@@ voi
bse_source_clear_ochannels (BseSource *source)
{
gboolean io_changed = FALSE;
-
++
g_return_if_fail (BSE_IS_SOURCE (source));
+
g_object_ref (source);
while (source->outputs)
{
BseSource *isource = (BseSource*) source->outputs->data;
guint i;
-
++
g_object_ref (isource);
for (i = 0; i < BSE_SOURCE_N_ICHANNELS (isource); i++)
{
@@@ -1471,6 -1674,7 +1674,7 @@@ bse_source_backup_ochannels_to_undo (Bs
for (slist = source->outputs; slist; slist = slist->next)
if (!g_slist_find (uniq_outputs, slist->data))
uniq_outputs = g_slist_prepend (uniq_outputs, slist->data);
-
++
for (slist = uniq_outputs; slist; slist = slist->next)
{
BseSource *isource = (BseSource*) slist->data;
@@@ -1510,14 -1718,17 +1718,17 @@@ bse_source_real_store_private (BseObjec
{
BseSourceInput *input = BSE_SOURCE_INPUT (source, i);
GSList *slist, *outputs = NULL;
-
++
if (BSE_SOURCE_IS_JOINT_ICHANNEL (source, i))
for (j = 0; j < input->jdata.n_joints; j++)
outputs = g_slist_append (outputs, input->jdata.joints + j);
else if (input->idata.osource)
outputs = g_slist_append (outputs, &input->idata);
-
++
for (slist = outputs; slist; slist = slist->next)
{
BseSourceOutput *output = (BseSourceOutput*) slist->data;
-
++
bse_storage_break (storage);
bse_storage_printf (storage,
"(source-input \"%s\" ",
@@@ -1630,6 -1859,7 +1859,7 @@@ bse_source_restore_private (BseObject
parse_or_return (scanner, G_TOKEN_STRING);
dinput = g_new0 (DeferredInput, 1);
dinput->ichannel_ident = g_strdup (scanner->value.v_string);
-
++
/* parse osource upath and queue handler */
if (g_scanner_peek_next_token (scanner) == G_TOKEN_IDENTIFIER) /* bad, bad, hack */
{
@@@ -1726,6 -1962,7 +1962,7 @@@ static voi
bse_source_class_base_finalize (BseSourceClass *klass)
{
guint i;
-
++
for (i = 0; i < klass->channel_defs.n_ichannels; i++)
{
g_free (klass->channel_defs.ichannel_idents[i]);
@@@ -1797,16 -2041,20 +2041,20 @@@ BSE_BUILTIN_TYPE (BseSource
{
static const GTypeInfo source_info = {
sizeof (BseSourceClass),
-
++
(GBaseInitFunc) bse_source_class_base_init,
(GBaseFinalizeFunc) bse_source_class_base_finalize,
(GClassInitFunc) bse_source_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseSource),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_source_init,
};
+
g_assert (BSE_SOURCE_FLAGS_USHIFT < BSE_OBJECT_FLAGS_MAX_SHIFT);
-
++
return bse_type_register_abstract (BSE_TYPE_ITEM,
"BseSource",
"Base type for sound sources",
diff --cc bse/bsesource.proc
index c294505,9e676d6..d04841e
--- a/bse/bsesource.proc
+++ b/bse/bsesource.proc
@@@ -32,18 -35,23 +35,23 @@@ BODY (BseProcedureClass *proc
BseSource *osource = (BseSource*) bse_value_get_object (in_values++);
guint ochannel = sfi_value_get_int (in_values++);
BseErrorType error;
-
++
/* check parameters */
if (!BSE_IS_SOURCE (isource) || !BSE_IS_SOURCE (osource) ||
BSE_ITEM (isource)->parent != BSE_ITEM (osource)->parent)
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* connect */
error = bse_source_set_input (isource, ichannel, osource, ochannel);
if (error == BSE_ERROR_NONE)
bse_item_push_undo_proc (isource, "unset-input-by-id", ichannel, osource, ochannel);
+
/* set output parameters */
g_value_set_enum (out_values++, error);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSource, set-input) {
HELP = "Connect a module input to another module's output.";
IN = bse_param_spec_object ("imodule", "Input Module", NULL,
@@@ -69,21 -77,26 +77,26 @@@ BODY (BseProcedureClass *proc
const char *ochannel_ident = sfi_value_get_string (in_values++);
guint ichannel, ochannel;
BseErrorType error;
-
++
/* check parameters */
if (!BSE_IS_SOURCE (isource) || !BSE_IS_SOURCE (osource) ||
BSE_ITEM (isource)->parent != BSE_ITEM (osource)->parent ||
!ichannel_ident || !ochannel_ident)
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* connect */
ichannel = bse_source_find_ichannel (isource, ichannel_ident);
ochannel = bse_source_find_ochannel (osource, ochannel_ident);
error = bse_source_set_input (isource, ichannel, osource, ochannel);
if (error == BSE_ERROR_NONE)
bse_item_push_undo_proc (isource, "unset-input-by-id", ichannel, osource, ochannel);
-
++
/* set output parameters */
g_value_set_enum (out_values++, error);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSource, unset-input-by-id) {
HELP = "Disconnect a module input.";
IN = bse_param_spec_object ("module", "Module", NULL,
@@@ -108,9 -121,11 +121,11 @@@ BODY (BseProcedureClass *proc
BseSource *osource = (BseSource*) bse_value_get_object (in_values++);
guint ochannel = sfi_value_get_int (in_values++);
BseErrorType error = BSE_ERROR_NONE;
-
++
/* check parameters */
if (!BSE_IS_SOURCE (isource) || !BSE_IS_SOURCE (osource))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* disconnect */
error = bse_source_check_input (isource, ichannel, osource, ochannel);
if (error == BSE_ERROR_NONE)
@@@ -121,10 -136,13 +136,13 @@@
bse_item_undo_close (ustack);
error = bse_source_unset_input (isource, ichannel, osource, ochannel);
}
+
/* set output parameters */
g_value_set_enum (out_values++, error);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSource, unset-input) {
HELP = "Disconnect a module input.";
IN = bse_param_spec_object ("module", "Module", NULL,
@@@ -150,10 -168,12 +168,12 @@@ BODY (BseProcedureClass *proc
const char *ochannel_ident = sfi_value_get_string (in_values++);
guint ichannel, ochannel;
BseErrorType error = BSE_ERROR_NONE;
-
++
/* check parameters */
if (!BSE_IS_SOURCE (isource) || !BSE_IS_SOURCE (osource) ||
!ichannel_ident || !ochannel_ident)
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* disconnect */
ichannel = bse_source_find_ichannel (isource, ichannel_ident);
ochannel = bse_source_find_ochannel (osource, ochannel_ident);
@@@ -166,10 -186,13 +186,13 @@@
bse_item_undo_close (ustack);
error = bse_source_unset_input (isource, ichannel, osource, ochannel);
}
-
++
/* set output parameters */
g_value_set_enum (out_values++, error);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSource, clear-inputs) {
HELP = "Disconnect all module inputs.";
IN = bse_param_spec_object ("module", "Module", NULL,
@@@ -182,17 -205,21 +205,21 @@@ BODY (BseProcedureClass *proc
/* extract parameter values */
BseSource *isource = (BseSource*) bse_value_get_object (in_values++);
BseUndoStack *ustack;
-
++
/* check parameters */
if (!BSE_IS_SOURCE (isource))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* disconnect */
ustack = bse_item_undo_open (isource, "clear-inputs %s", bse_object_debug_name (isource));
bse_source_backup_ichannels_to_undo (isource);
bse_item_push_redo_proc (isource, "clear-inputs");
bse_item_undo_close (ustack);
bse_source_clear_ichannels (isource);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSource, clear-outputs) {
HELP = "Disconnect all module outputs.";
IN = bse_param_spec_object ("module", "Module", NULL,
@@@ -208,14 -236,17 +236,17 @@@ BODY (BseProcedureClass *proc
/* check parameters */
if (!BSE_IS_SOURCE (isource))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* disconnect */
ustack = bse_item_undo_open (isource, "clear-outputs %s", bse_object_debug_name (isource));
bse_source_backup_ochannels_to_undo (isource);
bse_item_push_redo_proc (isource, "clear-outputs");
bse_item_undo_close (ustack);
bse_source_clear_ochannels (isource);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSource, has-output) {
HELP = "Check whether a module's output channel is connected.";
IN = bse_param_spec_object ("module", NULL, NULL, BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
@@@ -229,13 -260,17 +260,17 @@@ BODY (BseProcedureClass *proc
/* extract parameter values */
BseSource *source = (BseSource*) bse_value_get_object (in_values++);
guint ochannel = sfi_value_get_int (in_values++);
-
++
/* check parameters */
if (!BSE_IS_SOURCE (source))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_bool (out_values++, bse_source_has_output (source, ochannel));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSource, has-outputs) {
HELP = "Check whether a module has output channel connections.";
IN = bse_param_spec_object ("module", "Module", NULL,
@@@ -249,13 -284,17 +284,17 @@@ BODY (BseProcedureClass *proc
{
/* extract parameter values */
BseSource *source = (BseSource*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_SOURCE (source))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_bool (out_values++, source->outputs != NULL);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSource, n-ichannels) {
HELP = "Get the number of input channels of a module.";
IN = bse_param_spec_object ("module", "Module", NULL,
@@@ -269,13 -308,17 +308,17 @@@ BODY (BseProcedureClass *proc
{
/* extract parameter values */
BseSource *source = (BseSource*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_SOURCE (source))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_int (out_values++, BSE_SOURCE_N_ICHANNELS (source));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSource, ichannel-label) {
HELP = "Get input channel name.";
IN = bse_param_spec_object ("module", "Module", NULL,
@@@ -292,13 -335,17 +335,17 @@@ BODY (BseProcedureClass *proc
/* extract parameter values */
BseSource *source = (BseSource*) bse_value_get_object (in_values++);
guint ichannel = sfi_value_get_int (in_values++);
-
++
/* check parameters */
if (!BSE_IS_SOURCE (source) || ichannel >= BSE_SOURCE_N_ICHANNELS (source))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_string (out_values++, BSE_SOURCE_ICHANNEL_LABEL (source, ichannel));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSource, ichannel-ident) {
HELP = "Get canonical input channel name.";
IN = bse_param_spec_object ("module", "Module", NULL,
@@@ -315,13 -362,17 +362,17 @@@ BODY (BseProcedureClass *proc
/* extract parameter values */
BseSource *source = (BseSource*) bse_value_get_object (in_values++);
guint ichannel = sfi_value_get_int (in_values++);
-
++
/* check parameters */
if (!BSE_IS_SOURCE (source) || ichannel >= BSE_SOURCE_N_ICHANNELS (source))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_string (out_values++, BSE_SOURCE_ICHANNEL_IDENT (source, ichannel));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSource, ichannel-blurb) {
HELP = "Get input channel description.";
IN = bse_param_spec_object ("module", "Module", NULL,
@@@ -338,13 -389,17 +389,17 @@@ BODY (BseProcedureClass *proc
/* extract parameter values */
BseSource *source = (BseSource*) bse_value_get_object (in_values++);
guint ichannel = sfi_value_get_int (in_values++);
-
++
/* check parameters */
if (!BSE_IS_SOURCE (source) || ichannel >= BSE_SOURCE_N_ICHANNELS (source))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_string (out_values++, BSE_SOURCE_ICHANNEL_BLURB (source, ichannel));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSource, is-joint-ichannel-by-id) {
HELP = "Check if an input channel is a joint (multi-connect) channel.";
IN = bse_param_spec_object ("module", "Module", NULL,
@@@ -361,13 -416,17 +416,17 @@@ BODY (BseProcedureClass *proc
/* extract parameter values */
BseSource *source = (BseSource*) bse_value_get_object (in_values++);
guint ichannel = sfi_value_get_int (in_values++);
-
++
/* check parameters */
if (!BSE_IS_SOURCE (source) || ichannel >= BSE_SOURCE_N_ICHANNELS (source))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_bool (out_values++, BSE_SOURCE_IS_JOINT_ICHANNEL (source, ichannel));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSource, is-joint-ichannel) {
HELP = "Check if an input channel is a joint (multi-connect) channel.";
IN = bse_param_spec_object ("module", "Module", NULL,
@@@ -385,15 -444,19 +444,19 @@@ BODY (BseProcedureClass *proc
BseSource *source = (BseSource*) bse_value_get_object (in_values++);
const char *ichannel = sfi_value_get_string (in_values++);
guint id;
-
++
/* check parameters */
if (!BSE_IS_SOURCE (source) || !ichannel)
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
id = bse_source_find_ichannel (source, ichannel);
sfi_value_set_bool (out_values++,
id < BSE_SOURCE_N_ICHANNELS (source) ? BSE_SOURCE_IS_JOINT_ICHANNEL (source, id) :
FALSE);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSource, ichannel-get-n-joints) {
HELP = "Retrieve the number of inputs connected to an input channel.";
IN = bse_param_spec_object ("module", "Module", NULL,
@@@ -411,17 -474,21 +474,21 @@@ BODY (BseProcedureClass *proc
BseSource *source = (BseSource*) bse_value_get_object (in_values++);
guint ichannel = sfi_value_get_int (in_values++);
BseSourceInput *input;
-
++
/* check parameters */
if (!BSE_IS_SOURCE (source) || ichannel >= BSE_SOURCE_N_ICHANNELS (source))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
input = BSE_SOURCE_INPUT (source, ichannel);
if (BSE_SOURCE_IS_JOINT_ICHANNEL (source, ichannel))
sfi_value_set_int (out_values++, input->jdata.n_joints);
else
sfi_value_set_int (out_values++, input->idata.osource ? 1 : 0);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSource, ichannel-get-osource) {
HELP = "Retrieve output module connected to a specific joint of an input channel";
IN = bse_param_spec_object ("module", "Module", NULL,
@@@ -442,9 -509,11 +509,11 @@@ BODY (BseProcedureClass *proc
guint ichannel = sfi_value_get_int (in_values++);
guint joint = sfi_value_get_int (in_values++);
BseSourceInput *input;
-
++
/* check parameters */
if (!BSE_IS_SOURCE (source) || ichannel >= BSE_SOURCE_N_ICHANNELS (source))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
input = BSE_SOURCE_INPUT (source, ichannel);
if (BSE_SOURCE_IS_JOINT_ICHANNEL (source, ichannel) && joint < input->jdata.n_joints)
@@@ -453,8 -522,10 +522,10 @@@
bse_value_set_object (out_values++, input->idata.osource);
else
bse_value_set_object (out_values++, NULL);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSource, ichannel-get-ochannel) {
HELP = "Retrieve output channel of the module connected to a specific joint of an input channel.";
IN = bse_param_spec_object ("module", "Module", NULL,
@@@ -475,9 -546,11 +546,11 @@@ BODY (BseProcedureClass *proc
guint ichannel = sfi_value_get_int (in_values++);
guint joint = sfi_value_get_int (in_values++);
BseSourceInput *input;
-
++
/* check parameters */
if (!BSE_IS_SOURCE (source) || ichannel >= BSE_SOURCE_N_ICHANNELS (source))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
input = BSE_SOURCE_INPUT (source, ichannel);
if (BSE_SOURCE_IS_JOINT_ICHANNEL (source, ichannel) && joint < input->jdata.n_joints)
@@@ -486,8 -559,10 +559,10 @@@
sfi_value_set_int (out_values++, input->idata.ochannel);
else
sfi_value_set_int (out_values++, G_MAXINT);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSource, n-ochannels) {
HELP = "Get the number of output channels of a module.";
IN = bse_param_spec_object ("module", "Module", NULL,
@@@ -501,13 -576,17 +576,17 @@@ BODY (BseProcedureClass *proc
{
/* extract parameter values */
BseSource *source = (BseSource*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_SOURCE (source))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_int (out_values++, BSE_SOURCE_N_OCHANNELS (source));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSource, ochannel-label) {
HELP = "Get output channel name.";
IN = bse_param_spec_object ("module", "Module", NULL,
@@@ -524,13 -603,17 +603,17 @@@ BODY (BseProcedureClass *proc
/* extract parameter values */
BseSource *source = (BseSource*) bse_value_get_object (in_values++);
guint ochannel = sfi_value_get_int (in_values++);
-
++
/* check parameters */
if (!BSE_IS_SOURCE (source) || ochannel >= BSE_SOURCE_N_OCHANNELS (source))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_string (out_values++, BSE_SOURCE_OCHANNEL_LABEL (source, ochannel));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSource, ochannel-ident) {
HELP = "Get canonical output channel name.";
IN = bse_param_spec_object ("module", "Module", NULL,
@@@ -547,13 -630,17 +630,17 @@@ BODY (BseProcedureClass *proc
/* extract parameter values */
BseSource *source = (BseSource*) bse_value_get_object (in_values++);
guint ochannel = sfi_value_get_int (in_values++);
-
++
/* check parameters */
if (!BSE_IS_SOURCE (source) || ochannel >= BSE_SOURCE_N_OCHANNELS (source))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_string (out_values++, BSE_SOURCE_OCHANNEL_IDENT (source, ochannel));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSource, ochannel-blurb) {
HELP = "Get output channel description.";
IN = bse_param_spec_object ("module", "Module", NULL,
@@@ -570,13 -657,17 +657,17 @@@ BODY (BseProcedureClass *proc
/* extract parameter values */
BseSource *source = (BseSource*) bse_value_get_object (in_values++);
guint ochannel = sfi_value_get_int (in_values++);
-
++
/* check parameters */
if (!BSE_IS_SOURCE (source) || ochannel >= BSE_SOURCE_N_OCHANNELS (source))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_string (out_values++, BSE_SOURCE_OCHANNEL_BLURB (source, ochannel));
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSource, set-pos) {
HELP = "Set the x and y position of a module. In contrast to setting the position "
"through ordinary object property setters, this function will not update "
@@@ -651,10 -748,13 +748,13 @@@ BODY (BseProcedureClass *proc
if (error == BSE_ERROR_NONE)
bse_item_push_undo_proc (source, "set-automation", property, old_midi_channel, old_control_type);
}
+
/* set output parameters */
g_value_set_enum (out_values++, error);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSource, get-automation-channel) {
HELP = "Get MIDI channel from an automation property.";
IN = bse_param_spec_object ("source", NULL, NULL,
@@@ -678,8 -780,10 +780,10 @@@ BODY (BseProcedureClass *proc
bse_source_get_automation_property (source, property, &midi_channel, NULL);
/* set output parameters */
g_value_set_int (out_values++, midi_channel);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSource, get-automation-control) {
HELP = "Get control type from an automation property.";
IN = bse_param_spec_object ("source", NULL, NULL,
@@@ -703,8 -809,10 +809,10 @@@ BODY (BseProcedureClass *proc
bse_source_get_automation_property (source, property, NULL, &control_type);
/* set output parameters */
g_value_set_enum (out_values++, control_type);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseSource, is-prepared) {
HELP = "Check whether a source is prepared for synthesis processing.";
IN = bse_param_spec_object ("source", NULL, NULL,
diff --cc bse/bsestandardosc.cc
index 13507d5,1253f18..6fe4b06
--- a/bse/bsestandardosc.cc
+++ b/bse/bsestandardosc.cc
@@@ -62,17 -72,20 +72,20 @@@ BSE_BUILTIN_TYPE (BseStandardOsc
{
static const GTypeInfo type_info = {
sizeof (BseStandardOscClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_standard_osc_class_init,
(GClassFinalizeFunc) bse_standard_osc_class_finalize,
NULL /* class_data */,
-
++
sizeof (BseStandardOsc),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_standard_osc_init,
};
#include "./icons/osc.c"
GType type;
-
++
type = bse_type_register_static (BSE_TYPE_SOURCE,
"BseStandardOsc",
_("StandardOsc is the BSE basis oscillator which supports various types "
@@@ -89,12 -103,16 +103,16 @@@ bse_standard_osc_class_init (BseStandar
BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
guint ochannel, ichannel;
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = bse_standard_osc_set_property;
gobject_class->get_property = bse_standard_osc_get_property;
-
++
source_class->prepare = bse_standard_osc_prepare;
source_class->context_create = bse_standard_osc_context_create;
source_class->reset = bse_standard_osc_reset;
-
++
bse_object_class_add_param (object_class, _("Wave Form"),
PROP_WAVE_FORM,
bse_param_spec_genum ("wave_form", _("Wave"), _("Oscillator wave form"),
@@@ -160,6 -178,7 +178,7 @@@
"(Pulse has to be selected as wave form for this to take
effect)"),
0.0, 0.0, 100.0, 5.0,
SFI_PARAM_STANDARD ":f:dial"));
-
++
ichannel = bse_source_class_add_ichannel (source_class, "freq-in", _("Freq In"), _("Oscillating Frequency
Input"));
g_assert (ichannel == BSE_STANDARD_OSC_ICHANNEL_FREQ);
ichannel = bse_source_class_add_ichannel (source_class, "freq-mod-in", _("Freq Mod In"), _("Frequency
Modulation Input"));
@@@ -265,6 -289,7 +289,7 @@@ bse_standard_osc_get_property (GObjec
GParamSpec *pspec)
{
BseStandardOsc *self = BSE_STANDARD_OSC (object);
-
++
switch (param_id)
{
case PROP_WAVE_FORM:
@@@ -318,6 -345,7 +345,7 @@@ bse_standard_osc_prepare (BseSource *so
G_N_ELEMENTS (osc_table_freqs),
osc_table_freqs);
self->config.transpose_factor = bse_transpose_factor (bse_source_prepared_musical_tuning (BSE_SOURCE
(self)), self->transpose);
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->prepare (source);
}
@@@ -339,6 -372,7 +372,7 @@@ static voi
standard_osc_access_free (gpointer data)
{
OscConfigData *cdata = (OscConfigData*) data;
-
++
if (cdata->old_osc_table)
gsl_osc_table_free (cdata->old_osc_table);
g_free (cdata);
@@@ -349,10 -384,12 +384,12 @@@ bse_standard_osc_update_modules (BseSta
BseTrans *trans)
{
self->config.fm_strength = self->config.exponential_fm ? self->n_octaves : self->fm_strength;
-
++
/* update modules in all contexts with the new vars */
if (BSE_SOURCE_PREPARED (self))
{
OscConfigData cdata;
-
++
self->config.transpose_factor = bse_transpose_factor (bse_source_prepared_musical_tuning (BSE_SOURCE
(self)), self->transpose);
cdata.config = self->config;
if (recreate_table)
@@@ -391,12 -431,14 +431,14 @@@ standard_osc_process (BseModule *module
const gfloat *pwm_in = NULL;
gfloat *osc_out = NULL;
gfloat *sync_out = NULL;
-
++
if (BSE_MODULE_OSTREAM (module, BSE_STANDARD_OSC_OCHANNEL_SYNC).connected)
sync_out = BSE_MODULE_OBUFFER (module, BSE_STANDARD_OSC_OCHANNEL_SYNC);
osc_out = BSE_MODULE_OBUFFER (module, BSE_STANDARD_OSC_OCHANNEL_OSC);
if (!BSE_MODULE_OSTREAM (module, BSE_STANDARD_OSC_OCHANNEL_OSC).connected &&
!sync_out)
return; /* nothing to process */
-
++
if (BSE_MODULE_ISTREAM (module, BSE_STANDARD_OSC_ICHANNEL_FREQ).connected)
freq_in = BSE_MODULE_IBUFFER (module, BSE_STANDARD_OSC_ICHANNEL_FREQ);
if (BSE_MODULE_ISTREAM (module, BSE_STANDARD_OSC_ICHANNEL_FREQ_MOD).connected)
@@@ -405,6 -447,7 +447,7 @@@
sync_in = BSE_MODULE_IBUFFER (module, BSE_STANDARD_OSC_ICHANNEL_SYNC);
if (BSE_MODULE_ISTREAM (module, BSE_STANDARD_OSC_ICHANNEL_PWM).connected)
pwm_in = BSE_MODULE_IBUFFER (module, BSE_STANDARD_OSC_ICHANNEL_PWM);
-
++
if (osc->config.table->wave_form == GSL_OSC_WAVE_PULSE_SAW)
gsl_osc_process_pulse (osc, n_values, freq_in, mod_in, sync_in, pwm_in, osc_out, sync_out);
else
@@@ -428,13 -472,17 +472,17 @@@ bse_standard_osc_context_create (BseSou
BseStandardOsc *self = BSE_STANDARD_OSC (source);
GslOscData *osc = g_new0 (GslOscData, 1);
BseModule *module;
-
++
gsl_osc_reset (osc);
gsl_osc_config (osc, &self->config);
module = bse_module_new (&sosc_class, osc);
-
++
/* setup module i/o streams with BseSource i/o channels */
bse_source_set_context_module (source, context_handle, module);
-
++
/* commit module to engine */
bse_trans_add (trans, bse_job_integrate (module));
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_create (source, context_handle, trans);
}
@@@ -442,8 -491,10 +491,10 @@@ static voi
bse_standard_osc_reset (BseSource *source)
{
BseStandardOsc *self = BSE_STANDARD_OSC (source);
-
++
gsl_osc_table_free (self->config.table);
self->config.table = NULL;
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->reset (source);
}
diff --cc bse/bsestorage.cc
index 4f1a273,5088847..6d8b5f2
--- a/bse/bsestorage.cc
+++ b/bse/bsestorage.cc
@@@ -1238,8 -1416,10 +1294,9 @@@ wstore_data_handle_reader (gpointer dat
return -EIO;
}
wh->length += n;
-
return gsl_conv_from_float_clip (GslWaveFormatType (wh->format), wh->byte_order, (const float*) buffer,
buffer, n);
}
+
void
bse_storage_put_data_handle (BseStorage *self,
guint significant_bits,
@@@ -1494,10 -1708,14 +1551,11 @@@ bse_storage_flush_fd (BseStorage *self
g_return_val_if_fail (BSE_IS_STORAGE (self), BSE_ERROR_INTERNAL);
g_return_val_if_fail (self->wstore, BSE_ERROR_INTERNAL);
g_return_val_if_fail (fd >= 0, BSE_ERROR_INTERNAL);
-
bse_storage_break (self);
-
gint nerrno = sfi_wstore_flush_fd (self->wstore, fd);
-
return bse_error_from_errno (-nerrno, BSE_ERROR_FILE_WRITE_FAILED);
}
+
void
bse_storage_compat_dhreset (BseStorage *self)
{
@@@ -1549,6 -1773,7 +1610,7 @@@ compat_parse_data_handle (BseStorag
if (string)
{
gchar *f = NULL;
-
++
bytes_per_value = strtol (string + 2, &f, 10);
if ((bytes_per_value != 1 && bytes_per_value != 2 && bytes_per_value != 4) ||
(f && *f != 0))
diff --cc bse/bsesubiport.cc
index d156d7f,014eab1..b7a561d
--- a/bse/bsesubiport.cc
+++ b/bse/bsesubiport.cc
@@@ -46,6 -57,7 +57,7 @@@ bse_sub_iport_set_property (GObjec
{
BseSubIPort *self = BSE_SUB_IPORT (object);
BseItem *item = BSE_ITEM (self);
-
++
switch (param_id)
{
guint indx, n;
@@@ -82,6 -95,7 +95,7 @@@ bse_sub_iport_get_property (GObjec
GParamSpec *pspec)
{
BseSubIPort *self = BSE_SUB_IPORT (object);
-
++
switch (param_id)
{
guint indx, n;
@@@ -107,12 -122,15 +122,15 @@@ bse_sub_iport_set_parent (BseItem *item
{
BseSubIPort *self = BSE_SUB_IPORT (item);
guint i;
-
++
/* remove port name from old parent */
if (item->parent)
for (i = 0; i < BSE_SOURCE_N_OCHANNELS (self); i++)
bse_snet_iport_name_unregister (BSE_SNET (item->parent), self->input_ports[i]);
-
++
/* chain parent class' handler */
BSE_ITEM_CLASS (parent_class)->set_parent (item, parent);
-
++
/* add port name to new parent */
if (item->parent)
for (i = 0; i < BSE_SOURCE_N_OCHANNELS (self); i++)
@@@ -157,10 -179,13 +179,13 @@@ bse_sub_iport_context_create (BseSourc
bse_source_class_cache_engine_class (BSE_SOURCE_GET_CLASS (self), &module_class);
}
BseModule *module = bse_module_new (BSE_SOURCE_GET_CLASS (self)->engine_class, NULL);
+
/* setup module i/o streams with BseSource i/o channels */
bse_source_set_context_omodule (source, context_handle, module);
-
++
/* commit module to engine */
bse_trans_add (trans, bse_job_integrate (module));
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_create (source, context_handle, trans);
}
@@@ -174,8 -200,10 +200,10 @@@ bse_sub_iport_context_connect (BseSourc
BseSNet *snet = BSE_SNET (item->parent);
BseModule *module = bse_source_get_context_omodule (source, context_handle);
guint i;
-
++
for (i = 0; i < BSE_SOURCE_N_OCHANNELS (self); i++)
bse_snet_set_iport_dest (snet, self->input_ports[i], context_handle, module, i, trans);
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_connect (source, context_handle, trans);
}
@@@ -188,8 -217,10 +217,10 @@@ bse_sub_iport_context_dismiss (BseSourc
BseItem *item = BSE_ITEM (self);
BseSNet *snet = BSE_SNET (item->parent);
guint i;
-
++
for (i = 0; i < BSE_SOURCE_N_OCHANNELS (self); i++)
bse_snet_set_iport_dest (snet, self->input_ports[i], context_handle, NULL, i, trans);
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_dismiss (source, context_handle, trans);
}
@@@ -204,7 -236,9 +236,9 @@@ bse_sub_iport_update_modules (BseSubIPo
BseSource *source = BSE_SOURCE (self);
BseTrans *trans = bse_trans_open ();
guint *cids, n, i;
-
++
g_return_if_fail (BSE_SOURCE_PREPARED (self));
-
++
cids = bse_source_context_ids (source, &n);
for (i = 0; i < n; i++)
{
@@@ -223,11 -258,15 +258,15 @@@ bse_sub_iport_class_init (BseSubIPortCl
BseItemClass *item_class = BSE_ITEM_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
guint i, channel_id;
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = bse_sub_iport_set_property;
gobject_class->get_property = bse_sub_iport_get_property;
gobject_class->finalize = bse_sub_iport_finalize;
-
++
item_class->set_parent = bse_sub_iport_set_parent;
-
++
source_class->context_create = bse_sub_iport_context_create;
source_class->context_connect = bse_sub_iport_context_connect;
source_class->context_dismiss = bse_sub_iport_context_dismiss;
@@@ -234,12 -274,14 +274,14 @@@
for (i = 0; i < BSE_SUB_IPORT_N_PORTS; i++)
{
gchar *ident, *label, *value;
-
++
ident = g_strdup_printf ("output-%u", i + 1);
label = g_strdup_printf (_("Virtual input %u"), i + 1);
channel_id = bse_source_class_add_ochannel (source_class, ident, label, NULL);
g_assert (channel_id == i);
g_free (ident);
g_free (label);
-
++
ident = g_strdup_printf ("in_port_%u", i + 1);
label = g_strdup_printf (_("Input Port %u"), i + 1);
value = g_strdup_printf ("synth_in_%u", i + 1);
@@@ -257,11 -300,13 +300,13 @@@ BSE_BUILTIN_TYPE (BseSubIPort
{
static const GTypeInfo type_info = {
sizeof (BseSubIPortClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_sub_iport_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseSubIPort),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_sub_iport_init,
diff --cc bse/bsesuboport.cc
index b1cafdb,3c43698..2a64af1
--- a/bse/bsesuboport.cc
+++ b/bse/bsesuboport.cc
@@@ -46,6 -57,7 +57,7 @@@ bse_sub_oport_set_property (GObjec
{
BseSubOPort *self = BSE_SUB_OPORT (object);
BseItem *item = BSE_ITEM (self);
-
++
switch (param_id)
{
guint indx, n;
@@@ -82,6 -95,7 +95,7 @@@ bse_sub_oport_get_property (GObjec
GParamSpec *pspec)
{
BseSubOPort *self = BSE_SUB_OPORT (object);
-
++
switch (param_id)
{
guint indx, n;
@@@ -107,12 -122,15 +122,15 @@@ bse_sub_oport_set_parent (BseItem *item
{
BseSubOPort *self = BSE_SUB_OPORT (item);
guint i;
-
++
/* remove port name from old parent */
if (item->parent)
for (i = 0; i < BSE_SOURCE_N_ICHANNELS (self); i++)
bse_snet_oport_name_unregister (BSE_SNET (item->parent), self->output_ports[i]);
-
++
/* chain parent class' handler */
BSE_ITEM_CLASS (parent_class)->set_parent (item, parent);
-
++
/* add port name to new parent */
if (item->parent)
for (i = 0; i < BSE_SOURCE_N_ICHANNELS (self); i++)
@@@ -121,6 -139,7 +139,7 @@@
if (strcmp (name, self->output_ports[i]) != 0)
{
gchar *string;
-
++
g_free (self->output_ports[i]);
self->output_ports[i] = g_strdup (name);
string = g_strdup_printf ("out_port_%u", i + 1);
@@@ -134,6 -154,7 +154,7 @@@ sub_oport_process (BseModule *module
guint n_values)
{
guint i, n = BSE_MODULE_N_ISTREAMS (module);
-
++
for (i = 0; i < n; i++)
BSE_MODULE_OBUFFER (module, i) = (gfloat*) BSE_MODULE_IBUFFER (module, i);
}
@@@ -158,10 -181,13 +181,13 @@@ bse_sub_oport_context_create (BseSourc
bse_source_class_cache_engine_class (BSE_SOURCE_GET_CLASS (self), &module_class);
}
BseModule *module = bse_module_new (BSE_SOURCE_GET_CLASS (self)->engine_class, NULL);
-
++
/* setup module i/o streams with BseSource i/o channels */
bse_source_set_context_imodule (source, context_handle, module);
-
++
/* commit module to engine */
bse_trans_add (trans, bse_job_integrate (module));
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_create (source, context_handle, trans);
}
@@@ -175,8 -202,10 +202,10 @@@ bse_sub_oport_context_connect (BseSourc
BseSNet *snet = BSE_SNET (item->parent);
BseModule *module = bse_source_get_context_imodule (source, context_handle);
guint i;
-
++
for (i = 0; i < BSE_SOURCE_N_ICHANNELS (self); i++)
bse_snet_set_oport_src (snet, self->output_ports[i], context_handle, module, i, trans);
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_connect (source, context_handle, trans);
}
@@@ -189,8 -219,10 +219,10 @@@ bse_sub_oport_context_dismiss (BseSourc
BseItem *item = BSE_ITEM (self);
BseSNet *snet = BSE_SNET (item->parent);
guint i;
-
++
for (i = 0; i < BSE_SOURCE_N_ICHANNELS (self); i++)
bse_snet_set_oport_src (snet, self->output_ports[i], context_handle, NULL, i, trans);
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_dismiss (source, context_handle, trans);
}
@@@ -205,7 -238,9 +238,9 @@@ bse_sub_oport_update_modules (BseSubOPo
BseSource *source = BSE_SOURCE (self);
BseTrans *trans = bse_trans_open ();
guint *cids, n, i;
-
++
g_return_if_fail (BSE_SOURCE_PREPARED (self));
-
++
cids = bse_source_context_ids (source, &n);
for (i = 0; i < n; i++)
{
@@@ -224,17 -259,23 +259,23 @@@ bse_sub_oport_class_init (BseSubOPortCl
BseItemClass *item_class = BSE_ITEM_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
guint i, channel_id;
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = bse_sub_oport_set_property;
gobject_class->get_property = bse_sub_oport_get_property;
gobject_class->finalize = bse_sub_oport_finalize;
-
++
item_class->set_parent = bse_sub_oport_set_parent;
-
++
source_class->context_create = bse_sub_oport_context_create;
source_class->context_connect = bse_sub_oport_context_connect;
source_class->context_dismiss = bse_sub_oport_context_dismiss;
-
++
for (i = 0; i < BSE_SUB_OPORT_N_PORTS; i++)
{
gchar *ident, *label, *value;
-
++
ident = g_strdup_printf ("input-%u", i + 1);
label = g_strdup_printf (_("Virtual output %u"), i + 1);
channel_id = bse_source_class_add_ichannel (source_class, ident, label, NULL);
@@@ -258,11 -301,13 +301,13 @@@ BSE_BUILTIN_TYPE (BseSubOPort
{
static const GTypeInfo type_info = {
sizeof (BseSubOPortClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_sub_oport_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseSubOPort),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_sub_oport_init,
diff --cc bse/bsesubsynth.cc
index 4eabecc,b878fe5..e55456f
--- a/bse/bsesubsynth.cc
+++ b/bse/bsesubsynth.cc
@@@ -49,11 -59,13 +59,13 @@@ BSE_BUILTIN_TYPE (BseSubSynth
{
static const GTypeInfo sub_synth_info = {
sizeof (BseSubSynthClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_sub_synth_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseSubSynth),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_sub_synth_init,
@@@ -72,8 -85,10 +85,10 @@@ static voi
bse_sub_synth_init (BseSubSynth *self)
{
guint i;
-
++
self->snet = NULL;
self->null_shortcut = FALSE;
+
self->input_ports = g_new (gchar*, BSE_SOURCE_N_ICHANNELS (self));
for (i = 0; i < BSE_SOURCE_N_ICHANNELS (self); i++)
self->input_ports[i] = g_strdup_printf ("synth_in_%u", i + 1);
@@@ -85,11 -102,13 +102,13 @@@ static voi
bse_sub_synth_dispose (GObject *object)
{
BseSubSynth *self = BSE_SUB_SYNTH (object);
-
++
if (self->snet)
{
g_object_unref (self->snet);
self->snet = NULL;
}
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@@ -131,9 -153,11 +153,11 @@@ find_name (BseSubSynth *self
gboolean is_input)
{
guint i;
-
++
for (i = 0; i < (is_input ? BSE_SOURCE_N_ICHANNELS (self) : BSE_SOURCE_N_OCHANNELS (self)); i++)
{
gchar *test = is_input ? self->input_ports[i] : self->output_ports[i];
-
++
if (test && strcmp (test, name) == 0)
return TRUE;
}
@@@ -146,6 -171,7 +171,7 @@@ dup_name_unique (BseSubSynth *self
{
gchar *name = g_strdup (tmpl);
guint i = 1;
-
++
while (find_name (self, name, is_input))
{
g_free (name);
@@@ -167,6 -195,7 +195,7 @@@ bse_sub_synth_set_property (GObjec
GParamSpec *pspec)
{
BseSubSynth *self = BSE_SUB_SYNTH (object);
-
++
switch (param_id)
{
guint indx, n;
@@@ -227,6 -257,7 +257,7 @@@ bse_sub_synth_get_property (GObject
GParamSpec *pspec)
{
BseSubSynth *self = BSE_SUB_SYNTH (object);
-
++
switch (param_id)
{
guint indx, n;
@@@ -262,8 -294,10 +294,10 @@@ bse_sub_synth_set_midi_channel (BseSubS
guint midi_channel)
{
g_return_if_fail (BSE_IS_SUB_SYNTH (self));
-
++
self->midi_channel = midi_channel;
}
+
void
bse_sub_synth_set_null_shortcut (BseSubSynth *self,
gboolean enabled)
@@@ -306,14 -344,18 +344,18 @@@ bse_sub_synth_context_create (BseSourc
}
else
shortcut = self->null_shortcut;
+
mdata_in->synth_context_handle = foreign_context_handle;
mdata_out->synth_context_handle = foreign_context_handle;
-
++
/* setup module i/o streams with BseSource i/o channels */
bse_source_set_context_imodule (source, context_handle, imodule);
bse_source_set_context_omodule (source, context_handle, omodule);
-
++
/* commit modules to engine */
bse_trans_add (trans, bse_job_integrate (imodule));
bse_trans_add (trans, bse_job_integrate (omodule));
-
++
if (shortcut)
{
guint i;
@@@ -331,6 -375,7 +375,7 @@@ bse_sub_synth_context_connect (BseSourc
BseSubSynth *self = BSE_SUB_SYNTH (source);
BseSNet *snet = self->snet;
guint i;
-
++
/* connect module to sub synthesizer */
if (snet)
{
@@@ -347,6 -393,7 +393,7 @@@
bse_snet_set_oport_dest (snet, self->output_ports[i], foreign_context_handle, omodule, i,
trans);
}
}
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_connect (source, context_handle, trans);
}
@@@ -357,6 -405,7 +405,7 @@@ bse_sub_synth_context_dismiss (BseSourc
{
BseSubSynth *self = BSE_SUB_SYNTH (source);
BseSNet *snet = self->snet;
-
++
if (snet)
{
BseModule *imodule = bse_source_get_context_imodule (source, context_handle);
@@@ -371,6 -421,7 +421,7 @@@
bse_source_dismiss_context (BSE_SOURCE (snet), foreign_context_handle, trans);
}
}
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_dismiss (source, context_handle, trans);
}
@@@ -385,7 -437,9 +437,9 @@@ bse_sub_synth_update_port_contexts (Bse
BseSource *source = BSE_SOURCE (self);
BseTrans *trans = bse_trans_open ();
guint *cids, n, i;
-
++
g_return_if_fail (BSE_SOURCE_PREPARED (self));
-
++
cids = bse_source_context_ids (source, &n);
for (i = 0; i < n; i++)
if (is_input)
@@@ -421,15 -478,20 +478,20 @@@ bse_sub_synth_class_init (BseSubSynthCl
BseItemClass *item_class = BSE_ITEM_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
guint channel_id, i;
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = bse_sub_synth_set_property;
gobject_class->get_property = bse_sub_synth_get_property;
gobject_class->dispose = bse_sub_synth_dispose;
gobject_class->finalize = bse_sub_synth_finalize;
-
++
item_class->get_candidates = bse_sub_synth_get_candidates;
-
++
source_class->context_create = bse_sub_synth_context_create;
source_class->context_connect = bse_sub_synth_context_connect;
source_class->context_dismiss = bse_sub_synth_context_dismiss;
-
++
bse_object_class_add_param (object_class, _("Assignments"),
PARAM_SNET,
bse_param_spec_object ("snet", _("Synthesizer"),
@@@ -438,6 -500,7 +500,7 @@@
for (i = 0; i < 8; i++)
{
gchar *ident, *label, *value;
-
++
ident = g_strdup_printf ("in_port_%u", i + 1);
label = g_strdup_printf (_("Input Port %u"), i + 1);
value = g_strdup_printf ("synth_in_%u", i + 1);
@@@ -447,6 -510,7 +510,7 @@@
g_free (ident);
g_free (label);
g_free (value);
-
++
ident = g_strdup_printf ("out_port_%u", i + 1);
label = g_strdup_printf (_("Output Port %u"), i + 1);
value = g_strdup_printf ("synth_out_%u", i + 1);
@@@ -456,12 -520,14 +520,14 @@@
g_free (ident);
g_free (label);
g_free (value);
-
++
ident = g_strdup_printf ("input-%u", i + 1);
label = g_strdup_printf (_("Virtual input %u"), i + 1);
channel_id = bse_source_class_add_ichannel (source_class, ident, label, NULL);
g_assert (channel_id == i);
g_free (ident);
g_free (label);
-
++
ident = g_strdup_printf ("output-%u", i + 1);
label = g_strdup_printf (_("Virtual output %u"), i + 1);
channel_id = bse_source_class_add_ochannel (source_class, ident, label, NULL);
diff --cc bse/bsesuper.cc
index ffa197d,f8404f3..9215931
--- a/bse/bsesuper.cc
+++ b/bse/bsesuper.cc
@@@ -24,7 -31,9 +31,9 @@@ bse_super_init (BseSuper *super
super->creation_time = sfi_time_from_utc (sfi_time_system ());
super->mod_time = super->creation_time;
super->context_handle = ~0;
-
++
bse_super_objects = g_slist_prepend (bse_super_objects, super);
-
++
/* we want Unnamed-xxx default unames */
bse_item_set (super, "uname", "Unnamed", NULL);
/* default-fill fields */
@@@ -39,7 -49,9 +49,9 @@@ static voi
bse_super_finalize (GObject *object)
{
BseSuper *super = BSE_SUPER (object);
-
++
bse_super_objects = g_slist_remove (bse_super_objects, super);
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@@ -152,9 -172,12 +172,12 @@@ bse_super_class_init (BseSuperClass *kl
gobject_class->set_property = bse_super_set_property;
gobject_class->get_property = bse_super_get_property;
gobject_class->finalize = bse_super_finalize;
+
item_class->compat_setup = super_compat_setup;
+
klass->modified = super_modified;
klass->compat_finish = super_compat_finish;
-
++
bse_object_class_add_param (object_class, NULL,
PARAM_AUTHOR,
sfi_pspec_string ("author", _("Author"), _("Person changing or creating this
object"),
@@@ -181,15 -205,18 +205,18 @@@ BSE_BUILTIN_TYPE (BseSuper
{
static const GTypeInfo super_info = {
sizeof (BseSuperClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_super_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseSuper),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_super_init,
};
-
++
return bse_type_register_abstract (BSE_TYPE_CONTAINER,
"BseSuper",
"Base type for item managers",
diff --cc bse/bsetrack.cc
index bc03d0e,70c2793..3367070
--- a/bse/bsetrack.cc
+++ b/bse/bsetrack.cc
@@@ -61,15 -68,18 +66,18 @@@ BSE_BUILTIN_TYPE (BseTrack
{
static const GTypeInfo track_info = {
sizeof (BseTrackClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_track_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseTrack),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_track_init,
};
-
++
return bse_type_register_static (BSE_TYPE_CONTEXT_MERGER,
"BseTrack",
"BSE track type",
@@@ -109,14 -123,18 +121,18 @@@ bse_track_dispose (GObject *object
* our parent (BseSong) doesn't properly implement track support
*/
g_assert (self->sub_synth == NULL);
-
++
/* check uncrossed references */
g_assert (self->snet == NULL);
g_assert (self->pnet == NULL);
g_assert (self->n_entries_SL == 0);
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->dispose (object);
+
g_assert (self->bus_outputs == NULL);
}
+
static void
bse_track_finalize (GObject *object)
{
@@@ -181,6 -209,7 +207,7 @@@ track_lookup_entry (BseTrack *self
{
BseTrackEntry *nodes = self->entries_SL;
guint n = self->n_entries_SL, offs = 0, i = 0;
-
++
while (offs < n)
{
gint cmp;
@@@ -193,6 -222,7 +220,7 @@@
else /* (cmp > 0) */
offs = i + 1;
}
-
++
/* return the closest entry with tick <= requested tick if possible */
if (!self->n_entries_SL)
return NULL;
@@@ -364,6 -409,7 +407,7 @@@ bse_track_set_property (GObject *o
GParamSpec *pspec)
{
BseTrack *self = BSE_TRACK (object);
-
++
switch (param_id)
{
guint i;
@@@ -457,6 -505,7 +503,7 @@@ bse_track_get_property (GObject *obj
GParamSpec *pspec)
{
BseTrack *self = BSE_TRACK (object);
-
++
switch (param_id)
{
BseItemSeq *iseq;
@@@ -646,6 -719,7 +717,7 @@@ bse_track_add_modules (BseTrack
/* midi voice input */
self->voice_input = (BseSource*) bse_container_new_child (container, BSE_TYPE_MIDI_VOICE_INPUT, NULL);
bse_item_set_internal (self->voice_input, TRUE);
-
++
/* sub synth */
self->sub_synth = (BseSource*) bse_container_new_child_bname (container, BSE_TYPE_SUB_SYNTH,
"Track-Instrument",
"in_port_1", "frequency",
@@@ -659,6 -733,7 +731,7 @@@
"snet", self->snet,
NULL);
bse_item_set_internal (self->sub_synth, TRUE);
-
++
/* voice input <-> sub-synth */
bse_source_must_set_input (self->sub_synth, 0,
self->voice_input, BSE_MIDI_VOICE_INPUT_OCHANNEL_FREQUENCY);
@@@ -726,8 -810,10 +808,10 @@@ bse_track_get_last_tick (BseTrack *self
}
else
last_tick += 1; /* always return one after */
-
++
return last_tick;
}
+
static void
bse_track_update_midi_channel (BseTrack *self)
{
@@@ -769,6 -858,7 +856,7 @@@ bse_track_remove_modules (BseTrack
g_return_if_fail (BSE_IS_TRACK (self));
g_return_if_fail (BSE_IS_CONTAINER (container));
g_return_if_fail (self->sub_synth != NULL);
-
++
bse_container_remove_item (container, BSE_ITEM (self->sub_synth));
self->sub_synth = NULL;
bse_container_remove_item (container, BSE_ITEM (self->voice_input));
@@@ -786,6 -877,7 +875,7 @@@ bse_track_clone_voices (BseTrack
BseTrans *trans)
{
guint i;
-
++
g_return_if_fail (BSE_IS_TRACK (self));
g_return_if_fail (BSE_IS_SNET (snet));
g_return_if_fail (trans != NULL);
@@@ -872,12 -977,17 +975,17 @@@ bse_track_class_init (BseTrackClass *kl
gobject_class->get_property = bse_track_get_property;
gobject_class->dispose = bse_track_dispose;
gobject_class->finalize = bse_track_finalize;
+
object_class->store_private = bse_track_store_private;
object_class->restore_private = bse_track_restore_private;
-
++
item_class->get_candidates = bse_track_get_candidates;
-
++
source_class->context_create = bse_track_context_create;
source_class->context_dismiss = bse_track_context_dismiss;
+
bse_source_class_inherit_channels (BSE_SOURCE_CLASS (klass));
+
bse_object_class_add_param (object_class, _("Adjustments"),
PROP_MUTED,
sfi_pspec_bool ("muted", _("Muted"), NULL,
diff --cc bse/bsetrack.proc
index 5f7a12d,52ba615..7690d8a
--- a/bse/bsetrack.proc
+++ b/bse/bsetrack.proc
@@@ -96,8 -111,10 +111,10 @@@ BODY (BseProcedureClass *proc
/* action */
bse_item_push_undo_proc (self, "insert-part", entry->tick, entry->part);
bse_track_remove_tick (self, entry->tick);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseTrack, list-parts) {
HELP = "List parts scheduled in a track, sorted by tick.";
IN = bse_param_spec_object ("track", "Track", NULL,
@@@ -164,6 -189,7 +189,7 @@@ BODY (BseProcedureClass *proc
BseTrack *self = (BseTrack*) bse_value_get_object (in_values++);
guint tick = sfi_value_get_int (in_values++);
BseTrackEntry *entry;
-
++
/* check parameters */
if (!BSE_IS_TRACK (self))
return BSE_ERROR_PROC_PARAM_INVAL;
diff --cc bse/bsetype.cc
index eb3117f,2176c29..eafc807
--- a/bse/bsetype.cc
+++ b/bse/bsetype.cc
@@@ -321,8 -357,10 +357,10 @@@ bse_param_spec_enum (const gchar *na
const gchar *hints)
{
GParamSpec *pspec;
-
++
g_return_val_if_fail (G_TYPE_IS_ENUM (enum_type), NULL);
g_return_val_if_fail (enum_type != G_TYPE_ENUM, NULL);
+
/* g_param_spec_enum() validates default_value, which we allways allow
* to be 0, so we might need to adjust it to pass validation
*/
@@@ -353,7 -397,9 +397,9 @@@ bse_type_init (void
const guint n_builtin_types = sizeof (builtin_types) / sizeof (builtin_types[0]);
static GTypeFundamentalInfo finfo = { GTypeFundamentalFlags (0), };
guint i;
-
++
g_return_if_fail (quark_blurb == 0);
-
++
/* type system initialization
*/
quark_options = g_quark_from_static_string ("BseType-options");
@@@ -364,10 -410,13 +410,13 @@@
quark_license = g_quark_from_static_string ("BseType-license");
quark_boxed_export_node = g_quark_from_static_string ("BseType-boxed-export-node");
g_type_init ();
-
++
/* initialize parameter types */
bse_param_types_init ();
-
++
/* initialize builtin enumerations */
bse_type_register_enums ();
-
++
/* BSE_TYPE_PROCEDURE
*/
memset (&finfo, 0, sizeof (finfo));
diff --cc bse/bsetype.hh
index add5cf3,365c1bc..c589525
--- a/bse/bsetype.hh
+++ b/bse/bsetype.hh
@@@ -80,9 -96,10 +96,11 @@@ void bse_param_types_init ()
/* --- dynamic config --- */
#define BSE_GCONFIG(cfg) (bse_global_config->cfg)
extern BseGConfig *bse_global_config; /* from bsegconfig.[hc] */
+
+
/* --- provide IDL pspec initializers --- */
-#define sfidl_pspec_Bool(group, locfile, locline, name, nick, blurb, dflt, options) \
+#define sfidl_pspec_Bool sfidl_pspec_SfiBool
+#define sfidl_pspec_SfiBool(group, locfile, locline, name, nick, blurb, dflt, options) \
sfi_pspec_set_group (sfi_pspec_bool (name, nick, blurb, dflt, options), group)
#define sfidl_pspec_Bool_default(group, locfile, locline, name) \
sfi_pspec_set_group (sfi_pspec_bool (name, NULL, NULL, FALSE, SFI_PARAM_STANDARD), group)
diff --cc bse/bseundostack.cc
index df4182b,431a98f..fd8b2bb
--- a/bse/bseundostack.cc
+++ b/bse/bseundostack.cc
@@@ -110,11 -123,13 +123,13 @@@ bse_undo_stack_push (BseUndoStack *self
BseUndoStep *ustep)
{
const char *debug_name = self->debug_names ? (const char*) self->debug_names->data : "-";
+
g_return_if_fail (self->n_open_groups > 0);
g_return_if_fail (ustep != NULL);
+
if (self->ignore_steps)
{
- DEBUG ("undo step: - ignored: ((BseUndoFunc) %p) (%s)", ustep->undo_func, debug_name);
+ UDEBUG ("undo step: - ignored: ((BseUndoFunc) %p) (%s)", ustep->undo_func, debug_name);
bse_undo_step_free (ustep);
}
else
diff --cc bse/bseutils.cc
index 409bfc0,3007add..1bd3d19
--- a/bse/bseutils.cc
+++ b/bse/bseutils.cc
@@@ -642,8 -725,6 +691,9 @@@ bse_bbuffer_printf (gchar bbuffe
va_start (args, format);
l = g_vsnprintf (bbuffer, BSE_BBUFFER_SIZE, format, args);
va_end (args);
+
return l;
}
+
+#include "bseclientapi.cc"
+#include "bseserverapi.cc" // build AIDA IDL stubs
diff --cc bse/bsewave.cc
index 4470b97,4b1df97..6d1658f
--- a/bse/bsewave.cc
+++ b/bse/bsewave.cc
@@@ -98,6 -110,7 +110,7 @@@ bse_wave_dispose (GObject *object
BseWave *wave = BSE_WAVE (object);
bse_wave_clear (wave);
g_return_if_fail (wave->index_list == NULL);
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@@ -128,20 -146,26 +146,26 @@@ bse_wave_lookup_chunk (BseWave *wave
{
BseWaveIndex *index;
GslWaveChunk *wchunk;
-
++
g_return_val_if_fail (BSE_IS_WAVE (wave), NULL);
-
++
bse_wave_request_index (wave);
index = bse_wave_get_index_for_modules (wave);
wchunk = index ? bse_wave_index_lookup_best (index, osc_freq, velocity) : NULL;
bse_wave_drop_index (wave);
-
++
return wchunk;
}
+
void
bse_wave_remove_chunk (BseWave *wave, GslWaveChunk *wchunk)
{
g_return_if_fail (BSE_IS_WAVE (wave));
g_return_if_fail (wchunk != NULL);
-
++
wave->wave_chunks = sfi_ring_remove (wave->wave_chunks, wchunk);
wave->n_wchunks--;
+
SfiRing *ring;
for (ring = wave->open_handles; ring; ring = sfi_ring_walk (ring, wave->open_handles))
if (ring->data == (void*) wchunk->dcache->dhandle)
@@@ -150,6 -174,7 +174,7 @@@
wave->open_handles = sfi_ring_remove_node (wave->open_handles, ring);
break;
}
-
++
gsl_wave_chunk_unref (wchunk);
wave->index_dirty = TRUE;
}
@@@ -160,8 -186,10 +186,10 @@@ wchunk_cmp (gconstpointer a
{
const GslWaveChunk *w1 = (const GslWaveChunk*) a;
const GslWaveChunk *w2 = (const GslWaveChunk*) b;
-
++
return w1->osc_freq < w2->osc_freq ? -1 : w1->osc_freq > w2->osc_freq;
}
+
void
bse_wave_add_chunk (BseWave *wave,
GslWaveChunk *wchunk)
@@@ -169,6 -197,7 +197,7 @@@
g_return_if_fail (BSE_IS_WAVE (wave));
g_return_if_fail (wchunk != NULL);
g_return_if_fail (wchunk->dcache != NULL);
-
++
wave->wave_chunks = sfi_ring_insert_sorted (wave->wave_chunks, gsl_wave_chunk_ref (wchunk), wchunk_cmp,
NULL);
wave->n_wchunks++;
wave->index_dirty = TRUE;
@@@ -182,9 -212,11 +212,11 @@@ bse_wave_set_locator (BseWave *wave
g_return_if_fail (file_name != NULL);
g_return_if_fail (wave_name != NULL);
g_return_if_fail (wave->locator_set == FALSE);
-
++
wave->locator_set = TRUE;
wave->file_name = g_strdup (file_name);
wave->wave_name = g_strdup (wave_name);
-
++
g_object_freeze_notify (G_OBJECT (wave));
g_object_notify (G_OBJECT (wave), "locator_set");
g_object_notify (G_OBJECT (wave), "file_name");
@@@ -217,10 -253,14 +253,14 @@@ bse_wave_load_wave_file (BseWave *
gboolean rename_wave)
{
BseErrorType error = BSE_ERROR_NONE;
-
++
g_return_val_if_fail (BSE_IS_WAVE (self), BSE_ERROR_INTERNAL);
g_return_val_if_fail (file_name != NULL, BSE_ERROR_INTERNAL);
+
bse_wave_clear (self);
+
BseWaveFileInfo *fi = NULL;
+
if (!g_path_is_absolute (file_name)) /* resolve relative path using search dir */
{
char *sample_path;
@@@ -364,9 -409,11 +409,11 @@@ parse_wave_chunk (BseWave *wave
BseStorage *storage,
GScanner *scanner,
ParsedWaveChunk *pwchunk)
-
++
{
if (g_scanner_peek_next_token (scanner) != G_TOKEN_IDENTIFIER)
return SFI_TOKEN_UNMATCHED;
-
++
GQuark quark = g_quark_try_string (scanner->next_value.v_string);
if (quark == quark_xinfos)
{
@@@ -466,6 -516,7 +516,7 @@@ bse_wave_restore_private (BseObject *o
BseFreqArray *skip_list, *load_list, *array;
gchar *file_name, *wave_name;
BseErrorType error;
-
++
g_scanner_get_next_token (scanner); /* eat quark identifier */
parse_or_return (scanner, G_TOKEN_STRING);
file_name = g_strdup (scanner->value.v_string);
@@@ -624,6 -681,7 +681,7 @@@ voi
bse_wave_request_index (BseWave *wave)
{
g_return_if_fail (BSE_IS_WAVE (wave));
-
++
if (!wave->request_count)
g_object_ref (wave);
wave->request_count++;
@@@ -685,16 -749,20 +749,20 @@@ bse_wave_index_lookup_best (BseWaveInde
{
gfloat best_diff = 1e+9;
const BseWaveEntry *best_chunk = NULL;
-
++
g_return_val_if_fail (windex != NULL, NULL);
-
++
if (windex->n_entries > 0)
{
const BseWaveEntry *check, *nodes = &windex->entries[0];
guint n_nodes = windex->n_entries;
-
++
nodes -= 1;
do
{
register gfloat cmp;
register guint i;
-
++
i = (n_nodes + 1) >> 1;
check = nodes + i;
cmp = osc_freq - check->wchunk->osc_freq;
@@@ -736,9 -807,12 +807,12 @@@ bse_wave_class_init (BseWaveClass *klas
gobject_class->get_property = bse_wave_get_property;
gobject_class->dispose = bse_wave_dispose;
gobject_class->finalize = bse_wave_finalize;
+
object_class->store_private = bse_wave_store_private;
object_class->restore_private = bse_wave_restore_private;
+
item_class->needs_storage = bse_wave_needs_storage;
-
++
quark_n_channels = g_quark_from_static_string ("n-channels");
quark_xinfos = g_quark_from_static_string ("xinfos");
quark_loop = g_quark_from_static_string ("loop");
@@@ -747,6 -821,7 +821,7 @@@
quark_load_wave = g_quark_from_static_string ("load-wave");
quark_set_locator = g_quark_from_static_string ("set-locator");
quark_wave_chunk = g_quark_from_static_string ("wave-chunk");
-
++
bse_object_class_add_param (object_class, "Locator",
PARAM_LOCATOR_SET,
sfi_pspec_bool ("locator_set", "Locator Set", NULL,
@@@ -764,15 -840,18 +840,18 @@@ BSE_BUILTIN_TYPE (BseWave
{
static const GTypeInfo wave_info = {
sizeof (BseWaveClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_wave_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseWave),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_wave_init,
};
-
++
return bse_type_register_static (BSE_TYPE_SOURCE,
"BseWave",
"BSE wave type",
diff --cc bse/bsewave.hh
index 967ed53,05327c0..674fa93
--- a/bse/bsewave.hh
+++ b/bse/bsewave.hh
@@@ -61,5 -78,7 +65,7 @@@ void bse_wave_drop_index (BseWave *wa
GslWaveChunk* bse_wave_index_lookup_best (BseWaveIndex *windex,
gfloat osc_freq,
gfloat velocity);
-
++
G_END_DECLS
+
#endif /* __BSE_WAVE_H__ */
diff --cc bse/bsewave.proc
index cc83edf,1de7338..11f37aa
--- a/bse/bsewave.proc
+++ b/bse/bsewave.proc
@@@ -26,14 -30,19 +30,19 @@@ BODY (BseProcedureClass *proc
const char *file_name = sfi_value_get_string (in_values++);
const char *wave_name = sfi_value_get_string (in_values++);
BseErrorType error = BSE_ERROR_NONE;
-
++
/* check parameters */
if (!BSE_IS_WAVE (wave) || !file_name || !wave_name)
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
error = bse_wave_load_wave_file (wave, file_name, wave_name, NULL, NULL, TRUE);
-
++
/* set output parameters */
g_value_set_enum (out_values++, error);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseWave, n-wave-chunks) {
HELP = "Get the number of wave chunks of a wave";
IN = bse_param_spec_object ("wave", "Wave", NULL,
@@@ -47,13 -56,17 +56,17 @@@ BODY (BseProcedureClass *proc
{
/* extract parameter values */
BseWave *wave = (BseWave*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_WAVE (wave))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* set output parameters */
sfi_value_set_int (out_values++, wave->n_wchunks);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseWave, use-editable) {
HELP = "Retrieve an editable sample object for a wave chunk.";
IN = bse_param_spec_object ("wave", "Wave", NULL,
@@@ -83,10 -98,13 +98,13 @@@ BODY (BseProcedureClass *proc
bse_item_use (BSE_ITEM (esample));
g_object_unref (esample);
}
-
++
/* set output parameters */
bse_value_set_object (out_values++, esample);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseWave, chunk-get-osc-freq) {
HELP = "Retrieve oscillating frequency of a wave chunk.";
IN = bse_param_spec_object ("wave", "Wave", NULL,
diff --cc bse/bsewaveosc.cc
index 4daa3af,b5e5e3e..3990e79
--- a/bse/bsewaveosc.cc
+++ b/bse/bsewaveosc.cc
@@@ -44,17 -53,20 +53,20 @@@ BSE_BUILTIN_TYPE (BseWaveOsc
{
static const GTypeInfo type_info = {
sizeof (BseWaveOscClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_wave_osc_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseWaveOsc),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_wave_osc_init,
};
#include "./icons/waveosc.c"
GType type;
-
++
type = bse_type_register_static (BSE_TYPE_SOURCE,
"BseWaveOsc",
"BseWaveOsc is a wave based oscillator module. "
@@@ -179,6 -200,7 +200,7 @@@ bse_wave_osc_set_property (GObjec
GParamSpec *pspec)
{
BseWaveOsc *self = BSE_WAVE_OSC (object);
-
++
switch (param_id)
{
BseWave *wave;
@@@ -245,6 -268,7 +268,7 @@@ bse_wave_osc_get_property (GObject *
GParamSpec *pspec)
{
BseWaveOsc *self = BSE_WAVE_OSC (object);
-
++
switch (param_id)
{
case PARAM_WAVE:
@@@ -271,7 -296,9 +296,9 @@@ static voi
bse_wave_osc_dispose (GObject *object)
{
BseWaveOsc *self = BSE_WAVE_OSC (object);
+
clear_wave_and_esample (self);
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@@ -279,9 -307,11 +307,11 @@@ static voi
bse_wave_osc_finalize (GObject *object)
{
BseWaveOsc *self = BSE_WAVE_OSC (object);
-
++
if (self->esample_wchunk)
gsl_wave_chunk_close (self->esample_wchunk);
self->esample_wchunk = NULL;
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@@ -291,9 -322,12 +322,12 @@@ wosc_access (BseModule *module
{
GslWaveOscData *wosc = (GslWaveOscData*) module->user_data;
GslWaveOscConfig *config = (GslWaveOscConfig*) data;
-
++
/* this runs in the Gsl Engine threads */
-
++
gsl_wave_osc_config (wosc, config);
}
+
static GslWaveChunk*
wchunk_from_data (gpointer wchunk_data,
gfloat freq,
@@@ -349,6 -388,7 +388,7 @@@ wosc_process (BseModule *module
{
GslWaveOscData *wosc = (GslWaveOscData*) module->user_data;
gfloat gate, done;
-
++
gsl_wave_osc_process (wosc,
n_values,
(BSE_MODULE_ISTREAM (module, BSE_WAVE_OSC_ICHANNEL_FREQ).connected ?
@@@ -358,6 -398,7 +398,7 @@@
(BSE_MODULE_ISTREAM (module, BSE_WAVE_OSC_ICHANNEL_SYNC).connected ?
BSE_MODULE_IBUFFER (module, BSE_WAVE_OSC_ICHANNEL_SYNC) : NULL),
BSE_MODULE_OBUFFER (module, BSE_WAVE_OSC_OCHANNEL_WAVE));
-
++
gate = wosc->done ? 0.0 : 1.0;
done = wosc->done ? 1.0 : 0.0;
module->ostreams[BSE_WAVE_OSC_OCHANNEL_GATE].values = bse_engine_const_values (gate);
@@@ -423,8 -476,10 +467,10 @@@ pcm_pos_access_free (gpointer data
{
PcmPos *pos = (PcmPos*) data;
BseWaveOsc *self = pos->wosc;
-
++
if (pos->perc < 0)
g_signal_emit (self, signal_notify_pcm_position, 0, pos->stamp, pos->module_pcm_position);
-
++
g_object_unref (self);
g_free (pos);
}
@@@ -458,6 -515,7 +506,7 @@@ voi
bse_wave_osc_request_pcm_position (BseWaveOsc *self)
{
g_return_if_fail (BSE_IS_WAVE_OSC (self));
-
++
if (BSE_SOURCE_PREPARED (self))
{
PcmPos *pos = g_new (PcmPos, 1);
@@@ -478,13 -537,18 +528,18 @@@ bse_wave_osc_class_init (BseWaveOscClas
BseItemClass *item_class = BSE_ITEM_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
guint ochannel, ichannel;
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = bse_wave_osc_set_property;
gobject_class->get_property = bse_wave_osc_get_property;
gobject_class->finalize = bse_wave_osc_finalize;
gobject_class->dispose = bse_wave_osc_dispose;
-
++
item_class->get_candidates = bse_wave_osc_get_candidates;
-
++
source_class->context_create = bse_wave_osc_context_create;
-
++
bse_object_class_add_param (object_class, _("Wave"),
PARAM_WAVE,
bse_param_spec_object ("wave", _("Wave"), _("Wave used as oscillator source"),
@@@ -511,10 -575,12 +566,12 @@@
_("Number of octaves to be affected by exponential frequency
modulation"),
1.0, 0, 3.0, 0.01,
SFI_PARAM_STANDARD ":scale"));
-
++
signal_notify_pcm_position = bse_object_class_add_signal (object_class, "notify_pcm_position",
G_TYPE_NONE, 2,
SFI_TYPE_NUM,
G_TYPE_INT);
-
++
ichannel = bse_source_class_add_ichannel (source_class, "freq-in", _("Freq In"), _("Frequency Input"));
g_assert (ichannel == BSE_WAVE_OSC_ICHANNEL_FREQ);
ichannel = bse_source_class_add_ichannel (source_class, "sync-in", _("Sync In"), _("Syncronization
Input"));
diff --cc bse/bsewaveosc.proc
index 5616197,d790e58..77f35d0
--- a/bse/bsewaveosc.proc
+++ b/bse/bsewaveosc.proc
@@@ -16,12 -19,16 +19,16 @@@ METHOD (BseWaveOsc, request-pcm-positio
{
/* extract parameter values */
BseWaveOsc *self = (BseWaveOsc*) bse_value_get_object (in_values++);
-
++
/* check parameters */
if (!BSE_IS_WAVE_OSC (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
bse_wave_osc_request_pcm_position (self);
-
++
return BSE_ERROR_NONE;
}
+
PROCEDURE (bse-wave-osc-mass-seek-perc, "Seek Wave Oscillators") {
HELP = "Seek a list of wave oscillators to a pcm position given in percentage. The oscillators
will seek to the given position syncronously.";
IN = bse_param_spec_boxed ("wosc-seq", "Wave Oscilators", NULL, BSE_TYPE_ITEM_SEQ,
SFI_PARAM_STANDARD); // FIXME: using BseItemSeq because BseWaveOscSeq requires idl+C++
@@@ -44,8 -51,10 +51,10 @@@
woscs[i] = (BseWaveOsc*) iseq->items[i];
if (n)
bse_wave_osc_mass_seek (n, woscs, pos);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseWaveOsc, set-from-editable-sample) {
HELP = "Set wave to play from editable sample, bypassing undo and storage mechanisms.";
IN = bse_param_spec_object ("wosc", NULL, "Wave Oscilator",
@@@ -62,6 -72,8 +72,8 @@@
/* check parameters */
if (!BSE_IS_WAVE_OSC (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
bse_wave_osc_set_from_esample (self, esample);
-
++
return BSE_ERROR_NONE;
}
diff --cc bse/bsewaverepo.cc
index 3e840b8,f1ee12e..3afdd76
--- a/bse/bsewaverepo.cc
+++ b/bse/bsewaverepo.cc
@@@ -32,17 -41,21 +41,21 @@@ static GTypeClass *parent_class = N
BSE_BUILTIN_TYPE (BseWaveRepo)
{
GType wave_repo_type;
+
static const GTypeInfo snet_info = {
sizeof (BseWaveRepoClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_wave_repo_class_init,
(GClassFinalizeFunc) NULL,
NULL /* class_data */,
-
++
sizeof (BseWaveRepo),
0,
(GInstanceInitFunc) bse_wave_repo_init,
};
-
++
wave_repo_type = bse_type_register_static (BSE_TYPE_SUPER,
"BseWaveRepo",
"BSE Wave Repository",
@@@ -118,11 -144,13 +144,13 @@@ bse_wave_repo_add_item (BseContainer *c
BseItem *item)
{
BseWaveRepo *wrepo = BSE_WAVE_REPO (container);
-
++
if (g_type_is_a (BSE_OBJECT_TYPE (item), BSE_TYPE_WAVE))
wrepo->waves = g_list_append (wrepo->waves, item);
else
g_warning ("BseWaveRepo: cannot hold non-wave item type `%s'",
BSE_OBJECT_TYPE_NAME (item));
-
++
/* chain parent class' add_item handler */
BSE_CONTAINER_CLASS (parent_class)->add_item (container, item);
}
@@@ -148,11 -179,13 +179,13 @@@ bse_wave_repo_remove_item (BseContaine
BseItem *item)
{
BseWaveRepo *wrepo = BSE_WAVE_REPO (container);
-
++
if (g_type_is_a (BSE_OBJECT_TYPE (item), BSE_TYPE_WAVE))
wrepo->waves = g_list_remove (wrepo->waves, item);
else
g_warning ("BseWaveRepo: cannot hold non-wave item type `%s'",
BSE_OBJECT_TYPE_NAME (item));
-
++
/* chain parent class' remove_item handler */
BSE_CONTAINER_CLASS (parent_class)->remove_item (container, item);
}
diff --cc bse/bsewaverepo.proc
index b64346c,662cfda..a6a05c8
--- a/bse/bsewaverepo.proc
+++ b/bse/bsewaverepo.proc
@@@ -57,18 -64,23 +64,23 @@@ BODY (BseProcedureClass *proc
BseUndoStack *ustack;
BseErrorType error;
BseWave *wave;
-
++
/* check parameters */
if (!BSE_IS_WAVE_REPO (self) || !file_name)
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
ustack = bse_item_undo_open (self, "load-wave");
error = load_file (self, file_name, &wave);
if (wave)
bse_item_push_undo_proc (self, "remove-wave", wave);
bse_item_undo_close (ustack);
-
++
/* set output parameters */
g_value_set_enum (out_values++, error);
-
++
return BSE_ERROR_NONE;
}
+
METHOD (BseWaveRepo, remove-wave) {
HELP = "Remove a wave from repository";
IN = bse_param_spec_object ("wave_repo", "Wave Repo", NULL,
@@@ -87,6 -100,7 +100,7 @@@
if (!BSE_IS_WAVE_REPO (self) || !BSE_IS_WAVE (child) ||
child->parent != BSE_ITEM (self))
return BSE_ERROR_PROC_PARAM_INVAL;
-
++
/* action */
ustack = bse_item_undo_open (self, "remove-wave %s", bse_object_debug_name (child));
/* remove object references */
@@@ -97,8 -111,10 +111,10 @@@
bse_container_remove_backedup (BSE_CONTAINER (self), child, ustack);
/* done */
bse_item_undo_close (ustack);
-
++
return BSE_ERROR_NONE;
}
+
PROCEDURE (bse-sample-file-info, "Sample File Info") {
HELP = "Load sample file info from file";
IN = sfi_pspec_string ("file_name", "File Name", "The file to load info from",
diff --cc bse/gsl-fftconf.sh
index 17c2240,17c2240..ee73f1a
--- a/bse/gsl-fftconf.sh
+++ b/bse/gsl-fftconf.sh
@@@ -95,7 -95,7 +95,7 @@@ gsl_power2_fftc_big (const unsigned in
}
theta *= (double) 1.0 / 8192.;
last_sin = sin (theta);
--
++
/* we're not combining the first and second halves coefficients
* in the below loop, since for fft sizes beyond 8192, it'd actually
* harm performance due to paging
@@@ -110,7 -110,7 +110,7 @@@
Dim = last_sin;
last_sin = sin (theta);
Dre = last_sin * last_sin * -2.;
--
++
/* loop over first coefficient in each block ==> w == {1,0} */
for (i = 0; i < n_values2; i += block_size2)
{
@@@ -131,7 -131,7 +131,7 @@@
for (i = k; i < n_values2; i += block_size2)
{
unsigned int v1 = i, v2 = i + block_size;
--
++
BUTTERFLY_XY (rivalues[v1], rivalues[v1 + 1],
rivalues[v2], rivalues[v2 + 1],
rivalues[v1], rivalues[v1 + 1],
@@@ -148,7 -148,7 +148,7 @@@
for (i = k; i < n_values2; i += block_size2)
{
unsigned int v1 = i, v2 = i + block_size;
--
++
BUTTERFLY_01 (rivalues[v1], rivalues[v1 + 1],
rivalues[v2], rivalues[v2 + 1],
rivalues[v1], rivalues[v1 + 1],
@@@ -159,7 -159,7 +159,7 @@@
for (i = k; i < n_values2; i += block_size2)
{
unsigned int v1 = i, v2 = i + block_size;
--
++
BUTTERFLY_0m (rivalues[v1], rivalues[v1 + 1],
rivalues[v2], rivalues[v2 + 1],
rivalues[v1], rivalues[v1 + 1],
@@@ -213,7 -213,7 +213,7 @@@ gsl_power2_fftac (const unsigned int n_
$IEEE_TYPE *rivalues_out)
{
g_return_if_fail ((n_values & (n_values - 1)) == 0 && n_values >= 1);
--
++
switch (n_values)
{
case 1: rivalues_out[0] = rivalues_in[0], rivalues_out[1] = rivalues_in[1]; break;
@@@ -239,7 -239,7 +239,7 @@@ gsl_power2_fftsc (const unsigned int n_
$IEEE_TYPE *rivalues_out)
{
g_return_if_fail ((n_values & (n_values - 1)) == 0 && n_values >= 1);
--
++
switch (n_values)
{
case 1: rivalues_out[0] = rivalues_in[0], rivalues_out[1] = rivalues_in[1]; break;
diff --cc bse/gslcommon.hh
index 07d8394,0a8b8ed..8a34ed4
--- a/bse/gslcommon.hh
+++ b/bse/gslcommon.hh
@@@ -43,7 -65,11 +45,9 @@@ guint gsl_progress_printer
gfloat pval,
const gchar *detail,
GslProgressState *pstate);
+
+
/* --- implementation details --- */
-void _gsl_tick_stamp_inc (void);
-void _gsl_tick_stamp_set_leap (guint ticks);
void _gsl_init_fd_pool (void);
void _gsl_init_data_caches (void);
void _gsl_init_loader_gslwave (void);
diff --cc bse/gsldatacache.cc
index a799883,790cb1c..2efb37f
--- a/bse/gsldatacache.cc
+++ b/bse/gsldatacache.cc
@@@ -194,9 -228,10 +197,10 @@@ gsl_data_cache_unref (GslDataCache *dca
goto restart;
}
dcache->ref_count--;
- GSL_SPIN_UNLOCK (&dcache->mutex);
+ dcache->mutex.unlock();
}
}
+
static inline GslDataCacheNode**
data_cache_lookup_nextmost_node_L (GslDataCache *dcache,
int64 offset)
@@@ -211,6 -247,7 +216,7 @@@
{
register gint cmp;
register guint i;
-
++
i = (n_nodes + 1) >> 1;
check = nodes + i;
cmp = offset < (*check)->offset ? -1 : offset >= (*check)->offset + node_size;
@@@ -225,6 -262,7 +231,7 @@@
n_nodes = i - 1;
}
while (n_nodes);
-
++
return check; /* nextmost */
}
return NULL;
@@@ -270,6 -312,7 +280,7 @@@ data_cache_new_node_L (GslDataCache *dc
offset -= dcache->padding;
if (!demand_load)
g_message (G_STRLOC ":FIXME: lazy data loading not yet supported");
-
++
/* copy over data from previous node */
GslDataCacheNode *prev_node = pos ? dcache->nodes[pos - 1] : NULL;
if (prev_node)
@@@ -277,10 -320,12 +288,12 @@@
int64 prev_node_size = dcache->node_size;
int64 prev_node_offset = prev_node->offset;
GslDataType *prev_node_data = prev_node->data;
-
++
/* padding around prev_node */
prev_node_size += dcache->padding << 1;
prev_node_offset -= dcache->padding;
prev_node_data -= dcache->padding;
-
++
/* check for overlap */
if (offset < prev_node_offset + prev_node_size)
{
diff --cc bse/gsldatacache.hh
index 11bd800,8973a53..f5be14c
--- a/bse/gsldatacache.hh
+++ b/bse/gsldatacache.hh
@@@ -50,5 -57,7 +57,7 @@@ void gsl_data_cache_free_olders (Gsl
guint max_age);
GslDataCache* gsl_data_cache_from_dhandle (GslDataHandle *dhandle,
guint min_padding);
-
++
G_END_DECLS
+
#endif /* __GSL_DATA_CACHE_H__ */
diff --cc bse/gsldatahandle-mad.cc
index c7f8309,1315915..9b853ec
--- a/bse/gsldatahandle-mad.cc
+++ b/bse/gsldatahandle-mad.cc
@@@ -138,9 -163,10 +156,10 @@@ check_frame_validity (MadHandl
if (MAD_NCHANNELS (header) != handle->dhandle.setup.n_channels)
reason = "frame with non-standard channel count";
}
+
if (reason)
{
- MAD_DEBUG ("skipping frame: %s", reason);
+ MDEBUG ("skipping frame: %s", reason);
return FALSE;
}
else
@@@ -231,32 -274,36 +267,36 @@@ create_seek_table (MadHandle *handle
{
guint this_pos = handle->file_pos - handle->bfill + handle->stream.this_frame - handle->buffer;
guint i = n_seeks++;
-
++
if (n_seeks > 256 * 1024) /* FIXME: max_frames */
{
g_free (seeks);
return NULL; /* FIXME: ETOOBIG */
}
-
++
if (sfi_alloc_upper_power2 (n_seeks) > sfi_alloc_upper_power2 (i))
seeks = g_renew (guint, seeks, sfi_alloc_upper_power2 (n_seeks));
seeks[i] = this_pos;
-
++
if (0)
{
if (mad_frame_decode (&handle->frame, &handle->stream) < 0)
- MAD_DEBUG ("failed to read seektable frame: %s", mad_stream_errorstr (&handle->stream));
+ MDEBUG ("failed to read seektable frame: %s", mad_stream_errorstr (&handle->stream));
mad_synth_frame (&handle->synth, &handle->frame);
- MAD_DEBUG ("frame(%u) PCM:%u => FILE:%u FDIFF:%d (%x %x %x) br:%lu time:%ld/%lu mode:%u ext:%u
flags:0x%x phase:%u",
- i, i * handle->frame_size, this_pos, this_pos - seeks[MAX (i, 1) - 1],
- handle->stream.this_frame[0], handle->stream.this_frame[1],
- (handle->stream.this_frame[1] >> 1) & 3,
- handle->frame.header.bitrate,
- handle->frame.header.duration.seconds,
- handle->frame.header.duration.fraction,
- handle->frame.header.mode,
- handle->frame.header.mode_extension,
- handle->frame.header.flags,
- handle->synth.phase);
+ MDEBUG ("frame(%u) PCM:%u => FILE:%u FDIFF:%d (%x %x %x) br:%lu time:%ld/%lu mode:%u ext:%u
flags:0x%x phase:%u",
+ i, i * handle->frame_size, this_pos, this_pos - seeks[MAX (i, 1) - 1],
+ handle->stream.this_frame[0], handle->stream.this_frame[1],
+ (handle->stream.this_frame[1] >> 1) & 3,
+ handle->frame.header.bitrate,
+ handle->frame.header.duration.seconds,
+ handle->frame.header.duration.fraction,
+ handle->frame.header.mode,
+ handle->frame.header.mode_extension,
+ handle->frame.header.flags,
+ handle->synth.phase);
}
}
-
++
if (!handle->eof)
{
g_free (seeks);
@@@ -268,11 -315,13 +308,13 @@@
}
}
while (!handle->eof);
-
++
/* reset file offset */
/* lseek (handle->hfile, offs, SEEK_SET) */
handle->eof = FALSE;
handle->file_pos = 0;
handle->bfill = 0;
-
++
/* shrink table */
seeks = g_renew (guint, seeks, n_seeks);
*n_seeks_p = n_seeks;
@@@ -347,9 -404,10 +397,10 @@@ dh_mad_open (GslDataHandle *dhandl
error = BSE_ERROR_NO_SEEK_INFO;
goto OPEN_FAILED;
}
- MAD_DEBUG ("frames in seektable: %u", handle->n_seeks);
+ MDEBUG ("frames in seektable: %u", handle->n_seeks);
}
}
-
++
/* validate/setup handle length */
n = handle->n_seeks * handle->frame_size * setup->n_channels;
if (n > 0)
@@@ -359,13 -417,16 +410,16 @@@
error = BSE_ERROR_NO_DATA;
goto OPEN_FAILED;
}
+
/* our code already uses dhandle->setup */
dhandle->setup = *setup;
-
++
if (dh_mad_coarse_seek (&handle->dhandle, 0) != 0)
{
error = BSE_ERROR_FILE_SEEK_FAILED;
goto OPEN_FAILED;
}
-
++
setup->bit_depth = 24;
setup->mix_freq = handle->sample_rate;
setup->needs_cache = TRUE;
@@@ -408,8 -474,10 +467,10 @@@ dh_mad_read (GslDataHandle *dhandle
tmp = dh_mad_coarse_seek (dhandle, voffset);
g_assert (tmp <= voffset);
}
-
++
while (pos >= handle->pcm_pos + handle->pcm_length)
frame_read_ok = pcm_frame_read (handle, TRUE);
+
/* check if the last call to pcm_frame_read() failed */
if (!frame_read_ok)
{
@@@ -454,6 -526,7 +518,7 @@@
offset /= dhandle->setup.n_channels;
for (i = 0; i < dhandle->setup.n_channels; i++)
pcm[i] = handle->synth.pcm.samples[i] + offset + (i < align);
-
++
for (i = align; values < bound; values++)
{
mad_fixed_t mf = *(pcm[i]++);
@@@ -633,7 -730,9 +717,9 @@@ gsl_data_handle_mad_testopen (const gch
{
GslDataHandle *dhandle;
MadHandle *handle;
-
++
g_return_val_if_fail (file_name != NULL, BSE_ERROR_INTERNAL);
+
BseErrorType error = BSE_ERROR_NONE;
dhandle = dh_mad_new (file_name, 439, TRUE, &error);
if (!dhandle)
diff --cc bse/gsldatahandle-vorbis.cc
index d2308b2,3158f1b..88c9f55
--- a/bse/gsldatahandle-vorbis.cc
+++ b/bse/gsldatahandle-vorbis.cc
@@@ -193,6 -216,7 +216,7 @@@ dh_vorbis_open (GslDataHandle *dha
vhandle->max_block_size = MAX (vhandle->max_block_size, n);
vhandle->pcm_pos = 0;
vhandle->pcm_length = 0;
-
++
setup->bit_depth = 24;
setup->mix_freq = vi->rate;
setup->needs_cache = TRUE;
@@@ -205,8 -230,10 +230,10 @@@ dh_vorbis_coarse_seek (GslDataHandle *d
{
VorbisHandle *vhandle = (VorbisHandle*) dhandle;
GslLong opos = vhandle->pcm_pos, pos = voffset / dhandle->setup.n_channels;
-
++
if (voffset < 0)
return vhandle->pcm_pos * dhandle->setup.n_channels;
+
if (pos < vhandle->pcm_pos ||
pos >= vhandle->pcm_pos + vhandle->pcm_length + SEEK_BY_READ_AHEAD (vhandle))
{
@@@ -267,6 -304,7 +304,7 @@@ dh_vorbis_read (GslDataHandle *dhandle
guint n_samples = MIN (n_values, vhandle->pcm_length * dhandle->setup.n_channels - offset);
gfloat *pcm[MAX_CHANNELS], *bound = values + n_samples;
guint i;
-
++
offset /= dhandle->setup.n_channels;
for (i = 0; i < dhandle->setup.n_channels; i++)
pcm[i] = vhandle->pcm[i] + offset + (i < align);
diff --cc bse/gsldatahandle.cc
index d94d885,7b7da8a..a685f49
--- a/bse/gsldatahandle.cc
+++ b/bse/gsldatahandle.cc
@@@ -126,6 -150,7 +133,7 @@@ gsl_data_handle_read (GslDataHandle *dh
gfloat *values)
{
int64 l;
-
++
g_return_val_if_fail (dhandle != NULL, -1);
g_return_val_if_fail (dhandle->open_count > 0, -1);
g_return_val_if_fail (value_offset >= 0, -1);
@@@ -280,13 -339,16 +289,16 @@@ mem_handle_open (GslDataHandle *dh
GslDataHandleSetup *setup)
{
MemHandle *mhandle = (MemHandle*) dhandle;
-
++
setup->n_values = mhandle->n_values;
setup->n_channels = mhandle->n_channels;
setup->xinfos = mhandle->xinfos;
setup->mix_freq = mhandle->mix_freq;
setup->bit_depth = mhandle->bit_depth;
-
++
return BSE_ERROR_NONE;
}
+
static void
mem_handle_close (GslDataHandle *dhandle)
{
@@@ -304,6 -368,7 +318,7 @@@ mem_handle_destroy (GslDataHandle *dhan
mhandle->values = NULL;
mhandle->free_values = NULL;
sfi_delete_struct (MemHandle, mhandle);
-
++
if (free_values)
free_values ((gpointer) mem_values);
}
@@@ -314,10 -380,14 +330,14 @@@ mem_handle_read (GslDataHandle *dhandle
gfloat *values)
{
MemHandle *mhandle = (MemHandle*) dhandle;
-
++
g_return_val_if_fail (voffset + n_values <= mhandle->n_values, -1);
-
++
memcpy (values, mhandle->values + voffset, n_values * sizeof (values[0]));
-
++
return n_values;
}
+
GslDataHandle*
gsl_data_handle_new_mem (guint n_channels,
guint bit_depth,
@@@ -337,6 -407,7 +357,7 @@@
};
MemHandle *mhandle;
gboolean success;
-
++
g_return_val_if_fail (n_channels > 0, NULL);
g_return_val_if_fail (bit_depth > 0, NULL);
g_return_val_if_fail (mix_freq >= 4000, NULL);
@@@ -344,6 -415,7 +365,7 @@@
g_return_val_if_fail (n_values >= n_channels, NULL);
if (n_values)
g_return_val_if_fail (values != NULL, NULL);
-
++
mhandle = sfi_new_struct0 (MemHandle, 1);
success = gsl_data_handle_common_init (&mhandle->dhandle, NULL);
if (success)
@@@ -453,9 -532,11 +482,11 @@@ static voi
xinfo_handle_destroy (GslDataHandle *dhandle)
{
XInfoHandle *chandle = (XInfoHandle*) dhandle;
-
++
sfi_ring_free_deep (chandle->remove_xinfos, g_free);
sfi_ring_free_deep (chandle->added_xinfos, g_free);
gsl_data_handle_unref (chandle->src_handle);
-
++
gsl_data_handle_common_free (dhandle);
sfi_delete_struct (XInfoHandle, chandle);
}
@@@ -635,16 -725,20 +675,20 @@@ chain_handle_open (GslDataHandle *
{
ChainHandle *chandle = (ChainHandle*) dhandle;
BseErrorType error;
-
++
error = gsl_data_handle_open (chandle->src_handle);
if (error != BSE_ERROR_NONE)
return error;
*setup = chandle->src_handle->setup; /* copies setup.xinfos by pointer */
-
++
return BSE_ERROR_NONE;
}
+
static void
chain_handle_close (GslDataHandle *dhandle)
{
ChainHandle *chandle = (ChainHandle*) dhandle;
-
++
dhandle->setup.xinfos = NULL; /* cleanup pointer reference */
gsl_data_handle_close (chandle->src_handle);
}
@@@ -659,7 -756,9 +706,9 @@@ static voi
reverse_handle_destroy (GslDataHandle *dhandle)
{
ReversedHandle *rhandle = (ReversedHandle*) dhandle;
-
++
gsl_data_handle_unref (rhandle->src_handle);
-
++
gsl_data_handle_common_free (dhandle);
sfi_delete_struct (ReversedHandle, rhandle);
}
@@@ -672,23 -772,29 +722,29 @@@ reverse_handle_read (GslDataHandle *dha
ReversedHandle *rhandle = (ReversedHandle*) dhandle;
int64 left, new_offset = dhandle->setup.n_values - (voffset + n_values);
gfloat *t, *p = values;
-
++
g_assert (new_offset >= 0);
-
++
left = n_values;
do
{
int64 l = gsl_data_handle_read (rhandle->src_handle, new_offset, left, p);
-
++
if (l < 0)
return l; /* pass on errors */
-
++
new_offset += l;
left -= l;
p += l;
}
while (left > 0);
-
++
p = values;
t = values + n_values - 1;
while (p < t)
{
gfloat v = *t;
-
++
*t-- = *p;
*p++ = v;
}
@@@ -707,7 -814,9 +764,9 @@@ gsl_data_handle_new_reverse (GslDataHan
};
ReversedHandle *rhandle;
gboolean success;
-
++
g_return_val_if_fail (src_handle != NULL, NULL);
-
++
rhandle = sfi_new_struct0 (ReversedHandle, 1);
success = gsl_data_handle_common_init (&rhandle->dhandle, NULL);
if (success)
@@@ -733,7 -845,9 +795,9 @@@ static voi
scale_handle_destroy (GslDataHandle *dhandle)
{
ScaledHandle *shandle = (ScaledHandle*) dhandle;
-
++
gsl_data_handle_unref (shandle->src_handle);
-
++
gsl_data_handle_common_free (dhandle);
sfi_delete_struct (ScaledHandle, shandle);
}
@@@ -763,7 -879,9 +829,9 @@@ gsl_data_handle_new_scale (GslDataHandl
};
ScaledHandle *shandle;
gboolean success;
-
++
g_return_val_if_fail (src_handle != NULL, NULL);
-
++
shandle = sfi_new_struct0 (ScaledHandle, 1);
success = gsl_data_handle_common_init (&shandle->dhandle, NULL);
if (success)
@@@ -794,19 -914,24 +864,24 @@@ cut_handle_open (GslDataHandle *dh
{
CutHandle *chandle = (CutHandle*) dhandle;
BseErrorType error;
-
++
error = gsl_data_handle_open (chandle->src_handle);
if (error != BSE_ERROR_NONE)
return error;
*setup = chandle->src_handle->setup; /* copies setup.xinfos by pointer */
setup->n_values -= MIN (setup->n_values, chandle->tail_cut);
setup->n_values -= MIN (setup->n_values, chandle->n_cut_values);
-
++
return BSE_ERROR_NONE;
}
+
static void
cut_handle_destroy (GslDataHandle *dhandle)
{
CutHandle *chandle = (CutHandle*) dhandle;
-
++
gsl_data_handle_unref (chandle->src_handle);
-
++
gsl_data_handle_common_free (dhandle);
sfi_delete_struct (CutHandle, chandle);
}
@@@ -818,9 -944,11 +894,11 @@@ cut_handle_read (GslDataHandle *dhandle
{
CutHandle *chandle = (CutHandle*) dhandle;
int64 orig_n_values = n_values;
-
++
if (voffset < chandle->cut_offset)
{
int64 l = MIN (chandle->cut_offset - voffset, n_values);
-
++
l = gsl_data_handle_read (chandle->src_handle, voffset, l, values);
if (l < 0)
return l; /* pass on errors */
@@@ -828,17 -956,22 +906,22 @@@
values += l;
voffset += l;
}
-
++
if (voffset >= chandle->cut_offset && n_values)
{
int64 l = gsl_data_handle_read (chandle->src_handle, voffset + chandle->n_cut_values, n_values,
values);
-
++
if (l < 0 && orig_n_values == n_values)
return l; /* pass on errors */
else if (l < 0)
l = 0;
-
++
n_values -= l;
}
-
++
return orig_n_values - n_values;
}
+
static GslDataHandle*
gsl_data_handle_new_translate (GslDataHandle *src_handle,
int64 cut_offset,
@@@ -855,8 -988,10 +938,10 @@@
};
CutHandle *chandle;
gboolean success;
-
++
g_return_val_if_fail (src_handle != NULL, NULL);
g_return_val_if_fail (cut_offset >= 0 && n_cut_values >= 0 && tail_cut >= 0, NULL);
-
++
chandle = sfi_new_struct0 (CutHandle, 1);
success = gsl_data_handle_common_init (&chandle->dhandle, NULL);
if (success)
@@@ -925,6 -1065,7 +1015,7 @@@ insert_handle_open (GslDataHandle
{
InsertHandle *ihandle = (InsertHandle*) dhandle;
BseErrorType error;
-
++
error = gsl_data_handle_open (ihandle->src_handle);
if (error != BSE_ERROR_NONE)
return error;
@@@ -936,8 -1077,10 +1027,10 @@@
setup->n_values += ihandle->n_paste_values;
guint n = gsl_data_handle_bit_depth (ihandle->src_handle);
setup->bit_depth = MAX (n, ihandle->paste_bit_depth);
-
++
return BSE_ERROR_NONE;
}
+
static void
insert_handle_close (GslDataHandle *dhandle)
{
@@@ -951,11 -1096,14 +1046,14 @@@ insert_handle_destroy (GslDataHandle *d
InsertHandle *ihandle = (InsertHandle*) dhandle;
void (*free_values) (gpointer) = ihandle->free_values;
const gfloat *paste_values = ihandle->paste_values;
-
++
gsl_data_handle_unref (ihandle->src_handle);
-
++
gsl_data_handle_common_free (dhandle);
ihandle->paste_values = NULL;
ihandle->free_values = NULL;
sfi_delete_struct (InsertHandle, ihandle);
-
++
if (free_values)
free_values ((gpointer) paste_values);
}
@@@ -967,6 -1116,7 +1066,7 @@@ insert_handle_read (GslDataHandle *dhan
{
InsertHandle *ihandle = (InsertHandle*) dhandle;
int64 l, orig_n_values = n_values;
-
++
if (voffset < ihandle->src_handle->setup.n_values &&
voffset < ihandle->paste_offset)
{
@@@ -974,10 -1124,12 +1074,12 @@@
l = gsl_data_handle_read (ihandle->src_handle, voffset, l, values);
if (l < 0)
return l; /* pass on errors */
-
++
voffset += l;
n_values -= l;
values += l;
}
-
++
if (n_values && voffset >= ihandle->src_handle->setup.n_values && voffset < ihandle->paste_offset)
{
l = MIN (n_values, ihandle->paste_offset - voffset);
@@@ -986,6 -1138,7 +1088,7 @@@
n_values -= l;
values += l;
}
-
++
if (n_values && voffset >= ihandle->paste_offset && voffset < ihandle->paste_offset +
ihandle->n_paste_values)
{
l = MIN (n_values, ihandle->paste_offset + ihandle->n_paste_values - voffset);
@@@ -994,6 -1147,7 +1097,7 @@@
n_values -= l;
values += l;
}
-
++
if (n_values && voffset >= ihandle->paste_offset + ihandle->n_paste_values)
{
l = gsl_data_handle_read (ihandle->src_handle, voffset - ihandle->n_paste_values, n_values, values);
@@@ -1003,8 -1157,10 +1107,10 @@@
l = 0;
n_values -= l;
}
-
++
return orig_n_values - n_values;
}
+
static int64
insert_handle_get_state_length (GslDataHandle *dhandle)
{
@@@ -1029,10 -1187,12 +1137,12 @@@ gsl_data_handle_new_insert (GslDataHand
};
InsertHandle *ihandle;
gboolean success;
-
++
g_return_val_if_fail (src_handle != NULL, NULL);
g_return_val_if_fail (n_paste_values >= 0, NULL);
if (n_paste_values)
g_return_val_if_fail (paste_values != NULL, NULL);
-
++
ihandle = sfi_new_struct0 (InsertHandle, 1);
success = gsl_data_handle_common_init (&ihandle->dhandle, NULL);
if (success)
@@@ -1069,9 -1232,11 +1182,11 @@@ loop_handle_open (GslDataHandle *d
{
LoopHandle *lhandle = (LoopHandle*) dhandle;
BseErrorType error;
-
++
error = gsl_data_handle_open (lhandle->src_handle);
if (error != BSE_ERROR_NONE)
return error;
-
++
*setup = lhandle->src_handle->setup; /* copies setup.xinfos by pointer */
if (setup->n_values > lhandle->requested_last)
{
@@@ -1084,13 -1249,17 +1199,17 @@@
lhandle->loop_start = setup->n_values;
lhandle->loop_width = 0;
}
-
++
return BSE_ERROR_NONE;
}
+
static void
loop_handle_destroy (GslDataHandle *dhandle)
{
LoopHandle *lhandle = (LoopHandle*) dhandle;
-
++
gsl_data_handle_unref (lhandle->src_handle);
-
++
gsl_data_handle_common_free (dhandle);
sfi_delete_struct (LoopHandle, lhandle);
}
@@@ -1101,6 -1271,7 +1221,7 @@@ loop_handle_read (GslDataHandle *dhandl
gfloat *values)
{
LoopHandle *lhandle = (LoopHandle*) dhandle;
-
++
if (voffset < lhandle->loop_start)
return gsl_data_handle_read (lhandle->src_handle, voffset,
MIN (lhandle->loop_start - voffset, n_values),
@@@ -1108,7 -1279,9 +1229,9 @@@
else
{
int64 noffset = voffset - lhandle->loop_start;
-
++
noffset %= lhandle->loop_width;
-
++
return gsl_data_handle_read (lhandle->src_handle,
lhandle->loop_start + noffset,
MIN (lhandle->loop_width - noffset, n_values),
@@@ -1130,9 -1304,11 +1254,11 @@@ gsl_data_handle_new_looped (GslDataHand
};
LoopHandle *lhandle;
gboolean success;
-
++
g_return_val_if_fail (src_handle != NULL, NULL);
g_return_val_if_fail (loop_first >= 0, NULL);
g_return_val_if_fail (loop_last >= loop_first, NULL);
-
++
lhandle = sfi_new_struct0 (LoopHandle, 1);
success = gsl_data_handle_common_init (&lhandle->dhandle, NULL);
if (success)
@@@ -1162,7 -1341,9 +1291,9 @@@ static voi
dcache_handle_destroy (GslDataHandle *dhandle)
{
DCacheHandle *chandle = (DCacheHandle*) dhandle;
-
++
gsl_data_cache_unref (chandle->dcache);
-
++
gsl_data_handle_common_free (dhandle);
sfi_delete_struct (DCacheHandle, chandle);
}
@@@ -1172,18 -1354,22 +1304,22 @@@ dcache_handle_open (GslDataHandle
{
DCacheHandle *chandle = (DCacheHandle*) dhandle;
BseErrorType error;
-
++
error = gsl_data_handle_open (chandle->dcache->dhandle);
if (error != BSE_ERROR_NONE)
return error;
gsl_data_cache_open (chandle->dcache);
*setup = chandle->dcache->dhandle->setup; /* copies setup.xinfos by pointer */
gsl_data_handle_close (chandle->dcache->dhandle);
-
++
return BSE_ERROR_NONE;
}
+
static void
dcache_handle_close (GslDataHandle *dhandle)
{
DCacheHandle *chandle = (DCacheHandle*) dhandle;
-
++
dhandle->setup.xinfos = NULL; /* cleanup pointer reference */
gsl_data_cache_close (chandle->dcache);
}
@@@ -1195,12 -1382,15 +1332,15 @@@ dcache_handle_read (GslDataHandle *dhan
{
DCacheHandle *chandle = (DCacheHandle*) dhandle;
GslDataCacheNode *node;
-
++
node = gsl_data_cache_ref_node (chandle->dcache, voffset, GSL_DATA_CACHE_DEMAND_LOAD);
voffset -= node->offset;
n_values = MIN (n_values, chandle->node_size - voffset);
memcpy (values, node->data + voffset, sizeof (values[0]) * n_values);
-
++
return n_values;
}
+
static GslDataHandle*
dcache_handle_get_source_handle (GslDataHandle *dhandle)
{
@@@ -1226,7 -1418,9 +1368,9 @@@ gsl_data_handle_new_dcached (GslDataCac
};
DCacheHandle *dhandle;
gboolean success;
-
++
g_return_val_if_fail (dcache != NULL, NULL);
-
++
dhandle = sfi_new_struct0 (DCacheHandle, 1);
success = gsl_data_handle_common_init (&dhandle->dhandle, NULL);
if (success)
@@@ -1311,6 -1512,7 +1462,7 @@@ static voi
wave_handle_destroy (GslDataHandle *dhandle)
{
WaveHandle *whandle = (WaveHandle*) dhandle;
-
++
g_strfreev (whandle->xinfos);
gsl_data_handle_common_free (dhandle);
sfi_delete_struct (WaveHandle, whandle);
@@@ -1320,6 -1523,7 +1473,7 @@@ wave_handle_open (GslDataHandle *d
GslDataHandleSetup *setup)
{
WaveHandle *whandle = (WaveHandle*) dhandle;
-
++
whandle->hfile = gsl_hfile_open (whandle->dhandle.name);
if (!whandle->hfile)
return gsl_error_from_errno (errno, BSE_ERROR_FILE_OPEN_FAILED);
@@@ -1361,6 -1566,7 +1516,7 @@@ static voi
wave_handle_close (GslDataHandle *dhandle)
{
WaveHandle *whandle = (WaveHandle*) dhandle;
-
++
dhandle->setup.xinfos = NULL;
gsl_hfile_close (whandle->hfile);
whandle->hfile = NULL;
@@@ -1374,8 -1581,10 +1531,10 @@@ wave_handle_read (GslDataHandle *dhandl
WaveHandle *whandle = (WaveHandle*) dhandle;
gpointer buffer = values;
int64 l, byte_offset;
-
++
byte_offset = voffset * wave_format_byte_width (whandle->format); /* float offset into bytes */
byte_offset += whandle->byte_offset;
-
++
switch (whandle->format)
{
guint8 *u8; gint8 *s8; guint16 *u16; guint32 *u32; gint32 *s32;
@@@ -1442,8 -1651,10 +1601,10 @@@
l = -1;
g_assert_not_reached ();
}
-
++
return l;
}
+
GslDataHandle*
gsl_wave_handle_new (const gchar *file_name,
guint n_channels,
@@@ -1464,6 -1675,7 +1625,7 @@@
wave_handle_destroy,
};
WaveHandle *whandle;
-
++
g_return_val_if_fail (file_name != NULL, NULL);
g_return_val_if_fail (format > GSL_WAVE_FORMAT_NONE && format < GSL_WAVE_FORMAT_LAST, NULL);
g_return_val_if_fail (byte_order == G_LITTLE_ENDIAN || byte_order == G_BIG_ENDIAN, NULL);
@@@ -1472,6 -1684,7 +1634,7 @@@
g_return_val_if_fail (byte_offset >= 0, NULL);
g_return_val_if_fail (n_channels >= 1, NULL);
g_return_val_if_fail (n_values >= 1 || n_values == -1, NULL);
-
++
whandle = sfi_new_struct0 (WaveHandle, 1);
if (gsl_data_handle_common_init (&whandle->dhandle, file_name))
{
@@@ -1537,7 -1753,9 +1703,9 @@@ GslWaveFormatTyp
gsl_wave_format_from_string (const gchar *string)
{
gboolean is_unsigned = FALSE;
-
++
g_return_val_if_fail (string != NULL, GSL_WAVE_FORMAT_NONE);
-
++
while (*string == ' ')
string++;
if (strncasecmp (string, "alaw", 5) == 0)
diff --cc bse/gsldatautils.cc
index e59d532,2b646a6..377fdfe
--- a/bse/gsldatautils.cc
+++ b/bse/gsldatautils.cc
@@@ -337,6 -388,7 +388,7 @@@ gsl_data_detect_signal (GslDataHandle *
gfloat signal_threshold = 16. * 16. * 16.; /* noise level threshold */
GslLong k, xcheck = -1, minsamp = -1, maxsamp = -2;
GslDataPeekBuffer peek_buffer = { +1 /* incremental direction */, 0, };
-
++
g_return_val_if_fail (handle != NULL, FALSE);
g_return_val_if_fail (GSL_DATA_HANDLE_OPENED (handle), FALSE);
g_return_val_if_fail (sigstart_p || sigend_p, FALSE);
@@@ -476,6 -553,7 +553,7 @@@ gsl_data_find_tailmatch (GslDataHandl
GslDataCache *dcache;
GslLong length, offset, l, lsize, pcount, start = 0, end = 0;
gdouble pbound, pval, best_score = GSL_MAXLONG;
-
++
g_return_val_if_fail (dhandle != NULL, FALSE);
g_return_val_if_fail (lspec != NULL, FALSE);
g_return_val_if_fail (loop_start_p != NULL, FALSE);
@@@ -506,6 -585,7 +585,7 @@@
gsl_data_handle_close (dhandle);
return FALSE;
}
-
++
dcache = gsl_data_cache_new (dhandle, 1);
shandle = gsl_data_handle_new_dcached (dcache);
gsl_data_cache_unref (dcache);
@@@ -513,6 -593,7 +593,7 @@@
gsl_data_handle_close (dhandle);
gsl_data_handle_unref (shandle);
/* at this point, we just hold one open() count on shandle */
-
++
pbound = (lspec->max_loop - lspec->min_loop + 1.);
pbound *= length / 100.;
pval = 0;
@@@ -523,10 -605,12 +605,12 @@@
{
GslDataHandle *lhandle = gsl_data_handle_new_looped (shandle, offset + l, offset + l + lsize - 1);
gdouble score;
-
++
gsl_data_handle_open (lhandle);
score = tailmatch_score_loop (shandle, lhandle, offset + l, best_score);
gsl_data_handle_close (lhandle);
gsl_data_handle_unref (lhandle);
-
++
if (score < best_score)
{
start = offset + l;
@@@ -546,11 -630,15 +630,15 @@@
}
}
gsl_data_handle_close (shandle);
+
g_print ("\nhalted: %f: [0x%llx..0x%llx] (%llu)\n", best_score, start, end, end - start + 1);
-
++
*loop_start_p = start;
*loop_end_p = end;
+
return TRUE;
}
+
/**
* @param handle an open GslDataHandle
* @param n_values amount of values to look for
@@@ -672,6 -773,7 +773,7 @@@ gsl_data_clip_sample (GslDataHandl
return result->error;
}
last_value -= 1;
-
++
/* signal range detection */
SfiNum head = gsl_data_find_sample (dhandle, +cconfig->threshold, -cconfig->threshold, 0, +1);
if (head < 0)
@@@ -684,6 -786,7 +786,7 @@@
}
SfiNum tail = gsl_data_find_sample (dhandle, +cconfig->threshold, -cconfig->threshold, -1, -1);
g_assert (tail >= 0);
-
++
/* verify silence detection */
if (last_value - tail < cconfig->tail_samples)
{
@@@ -703,6 -806,7 +806,7 @@@
result->head_detected = TRUE;
if (info)
sfi_info ("Silence detected: head_silence=%lld tail_silence=%llu", head, last_value - tail);
-
++
/* tail clipping protection */
if (last_value - tail < cconfig->tail_silence)
{
@@@ -710,6 -814,7 +814,7 @@@
sfi_info ("Tail silence too short for clipping: silence_length=%lld minimum_length=%u", last_value
- tail, cconfig->tail_silence);
tail = last_value;
}
-
++
/* padding */
if (cconfig->pad_samples)
{
@@@ -719,6 -824,7 +824,7 @@@
if (info && otail != tail)
sfi_info ("Padding Tail: old_tail=%lld tail=%llu padding=%lld", otail, tail, tail - otail);
}
-
++
/* unclipped handles */
if (head == 0 && last_value == tail)
{
@@@ -735,6 -842,7 +842,7 @@@
gsl_data_handle_n_values (clip_handle) - gsl_data_handle_n_values (dhandle));
result->clipped_head = head > 0;
result->clipped_tail = last_value != tail;
-
++
/* fading */
GslDataHandle *fade_handle;
if (cconfig->fade_samples && head)
@@@ -752,6 -861,7 +861,7 @@@
l -= j;
g_memmove (ramp, ramp + j, l * sizeof (ramp[0]));
}
-
++
fade_handle = gsl_data_handle_new_insert (clip_handle, gsl_data_handle_bit_depth (clip_handle), 0, l,
ramp, g_free);
gsl_data_handle_open (fade_handle);
gsl_data_handle_unref (fade_handle);
@@@ -763,6 -873,7 +873,7 @@@
fade_handle = clip_handle;
gsl_data_handle_open (fade_handle);
}
-
++
/* prepare result and cleanup */
result->dhandle = gsl_data_handle_ref (fade_handle);
gsl_data_handle_close (fade_handle);
diff --cc bse/gsldatautils.hh
index 3576392,49e23e4..60710c8
--- a/bse/gsldatautils.hh
+++ b/bse/gsldatautils.hh
@@@ -170,8 -186,10 +186,10 @@@ gsl_conv_from_float (GslWaveFormatType
guint32 *u32dest = (guint32*) dest;
const gfloat *bound = src + n_values;
const guint32 *u32src = (guint32*) src, *u32bound = (const guint32*) bound;
-
++
if (!n_values)
return 0;
-
++
switch (GSL_CONV_FORMAT (format, byte_order == G_BYTE_ORDER))
{
BseFpuState fpu;
@@@ -374,8 -393,10 +393,10 @@@ gsl_conv_from_float_clip (GslWaveFormat
guint32 *u32dest = (guint32*) dest;
const gfloat *bound = src + n_values;
const guint32 *u32src = (const guint32*) src, *u32bound = (const guint32*) bound;
-
++
if (!n_values)
return 0;
-
++
switch (GSL_CONV_FORMAT (format, byte_order == G_BYTE_ORDER))
{
BseFpuState fpu;
@@@ -650,8 -674,10 +674,10 @@@ gsl_conv_to_float (GslWaveFormatType fo
const guint32 *u32src = (guint32*) src;
gfloat *bound = dest + n_values;
guint32 *u32dest = (guint32*) dest, *u32bound = (guint32*) bound;
-
++
if (!n_values)
return;
-
++
switch (GSL_CONV_FORMAT (format, byte_order == G_BYTE_ORDER))
{
gint16 vi16;
@@@ -816,8 -843,10 +843,10 @@@ gsl_conv_from_double (GslWaveFormatTyp
gint32 *i32 = (gint32*) dest;
const gdouble *bound = src + n_values;
const guint32 *u32src = (const guint32*) src, *u32bound = (const guint32*) bound;
-
++
if (!n_values)
return 0;
-
++
switch (GSL_CONV_FORMAT (format, byte_order == G_BYTE_ORDER))
{
BseFpuState fpu;
@@@ -1020,8 -1050,10 +1050,10 @@@ gsl_conv_from_double_clip (GslWaveForma
gint32 *i32 = (gint32*) dest;
const gdouble *bound = src + n_values;
const guint32 *u32src = (const guint32*) src, *u32bound = (const guint32*) bound;
-
++
if (!n_values)
return 0;
-
++
switch (GSL_CONV_FORMAT (format, byte_order == G_BYTE_ORDER))
{
BseFpuState fpu;
@@@ -1248,8 -1281,10 +1281,10 @@@ gsl_conv_to_double (GslWaveFormatType f
const gint32 *i32 = (gint32*) src;
gdouble *bound = dest + n_values;
guint32 *u32dest = (guint32*) dest, *u32bound = (guint32*) bound;
-
++
if (!n_values)
return;
-
++
switch (GSL_CONV_FORMAT (format, byte_order == G_BYTE_ORDER))
{
gint16 vi16;
diff --cc bse/gslfft.hh
index 61aeaa6,ca4cf27..389391b
--- a/bse/gslfft.hh
+++ b/bse/gslfft.hh
@@@ -171,6 -181,9 +181,9 @@@ void gsl_power2_fftsr_simple (const uin
void gsl_power2_fftsr_scale_simple (const unsigned int n_values,
const float *complex_values,
float *real_values);
+
-
-
++
++
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --cc bse/gslfilehash.cc
index e06b6a9,605310b..783b08b
--- a/bse/gslfilehash.cc
+++ b/bse/gslfilehash.cc
@@@ -90,6 -110,7 +91,7 @@@ gsl_hfile_open (const gchar *file_name
else
{
gint fd;
-
++
fd = open (file_name, O_RDONLY | O_NOCTTY, 0);
if (fd >= 0)
{
@@@ -168,6 -195,7 +171,7 @@@ gsl_hfile_pread (GslHFile *hfile
{
GslLong ret_bytes = -1;
gint ret_errno;
-
++
errno = EFAULT;
g_return_val_if_fail (hfile != NULL, -1);
g_return_val_if_fail (hfile->ocount > 0, -1);
@@@ -418,6 -476,7 +442,7 @@@ gsl_rfile_close (GslRFile *rfile
{
errno = EFAULT;
g_return_if_fail (rfile != NULL);
-
++
gsl_hfile_close (rfile->hfile);
sfi_delete_struct (GslRFile, rfile);
errno = 0;
diff --cc bse/gslfilter.cc
index 060c1d5,51ba0a8..19af598
--- a/bse/gslfilter.cc
+++ b/bse/gslfilter.cc
@@@ -32,8 -37,10 +37,10 @@@ band_filter_common (uint iorder
BseComplex fpoly[2 + 1] = { { 0, }, { 0, }, { 1, 0 } };
double alpha, norm;
guint i;
-
++
epsilon = bse_trans_zepsilon2ss (epsilon);
alpha = cos ((s_freq + p_freq) * 0.5) / cos ((s_freq - p_freq) * 0.5);
-
++
fpoly[0] = bse_complex (1, 0);
fpoly[1] = bse_complex (1, 0);
for (i = 0; i < iorder2; i++)
@@@ -42,13 -49,16 +49,16 @@@
fpoly[1] = bse_complex_mul (fpoly[1], bse_complex_sub (bse_complex (1, 0), bse_complex_reciprocal
(poles[i])));
}
norm = bse_complex_div (fpoly[1], fpoly[0]).re;
-
++
if ((iorder2 & 1) == 0) /* norm is fluctuation minimum */
norm *= sqrt (1.0 / (1.0 + epsilon * epsilon));
-
++
/* z numerator polynomial */
poly[0] = bse_complex (norm, 0);
for (i = 0; i < iorder2; i++)
{
BseComplex t, alphac = bse_complex (alpha, 0);
-
++
t = band_pass ? bse_complex_inv (roots[i]) : roots[i];
fpoly[1] = bse_complex_sub (bse_complex_div (alphac, t), alphac);
fpoly[0] = bse_complex_inv (bse_complex_reciprocal (t));
@@@ -56,11 -66,13 +66,13 @@@
}
for (i = 0; i <= iorder; i++)
a[i] = poly[i].re;
-
++
/* z denominator polynomial */
poly[0] = bse_complex (1, 0);
for (i = 0; i < iorder2; i++)
{
BseComplex t, alphac = bse_complex (alpha, 0);
-
++
t = band_pass ? bse_complex_inv (poles[i]) : poles[i];
fpoly[1] = bse_complex_sub (bse_complex_div (alphac, t), alphac);
fpoly[0] = bse_complex_inv (bse_complex_reciprocal (t));
@@@ -80,6 -93,7 +93,7 @@@ filter_rp_to_z (uint iorder
{
BseComplex *poly = g_newa (BseComplex, iorder + 1);
guint i;
-
++
/* z numerator polynomial */
poly[0] = bse_complex (1, 0);
for (i = 0; i < iorder; i++)
@@@ -216,22 -254,26 +254,26 @@@ gsl_filter_tscheb2_rp (uint ior
epsilon = bse_trans_zepsilon2ss (epsilon);
tepsilon = epsilon * tschebyscheff_eval (iorder, kappa_r / kappa_c);
alpha = asinh (tepsilon) / order;
-
++
/* construct poles polynomial from tschebyscheff polynomial */
for (i = 1; i <= iorder; i++)
{
double t = (i << 1) + iorder - 1;
double beta = t * beta_mul;
-
++
root.re = sinh (alpha) * cos (beta);
root.im = cosh (alpha) * sin (beta);
root = bse_complex_div (bse_complex (kappa_r, 0), root);
root = bse_trans_s2z (root);
poles[i - 1] = root;
}
-
++
/* construct roots polynomial from tschebyscheff polynomial */
for (i = 1; i <= iorder; i++)
{
double t = (i << 1) - 1;
BseComplex root = bse_complex (0, cos (t * beta_mul));
-
++
if (fabs (root.im) > 1e-14)
{
root = bse_complex_div (bse_complex (kappa_r, 0), root);
@@@ -301,9 -349,12 +349,12 @@@ gsl_filter_butter_lp (uint iord
BseComplex *roots = g_newa (BseComplex, iorder);
BseComplex *poles = g_newa (BseComplex, iorder);
double norm;
-
++
g_return_if_fail (freq > 0 && freq < PI);
+
gsl_filter_butter_rp (iorder, freq, epsilon, roots, poles);
filter_rp_to_z (iorder, roots, poles, a, b);
+
/* scale maximum to 1.0 */
norm = bse_poly_eval (iorder, b, 1) / bse_poly_eval (iorder, a, 1);
bse_poly_scale (iorder, a, norm);
@@@ -366,8 -423,10 +423,10 @@@ gsl_filter_tscheb2_lp (uint ior
g_return_if_fail (freq > 0 && freq < PI);
g_return_if_fail (freq * steepness < PI);
g_return_if_fail (steepness > 1.0);
+
gsl_filter_tscheb2_rp (iorder, freq, steepness, epsilon, roots, poles);
filter_rp_to_z (iorder, roots, poles, a, b);
-
++
/* scale maximum to 1.0 */
norm = bse_poly_eval (iorder, b, 1) / bse_poly_eval (iorder, a, 1); /* H(z=0):=1, e^(j*omega) for omega=0
=> e^0==1 */
bse_poly_scale (iorder, a, norm);
@@@ -495,7 -568,9 +568,9 @@@ gsl_filter_tscheb1_bp (uint ior
g_return_if_fail (freq1 > 0);
g_return_if_fail (freq1 < freq2);
g_return_if_fail (freq2 < PI);
-
++
theta = 2. * atan2 (1., cotan ((freq2 - freq1) * 0.5));
+
gsl_filter_tscheb1_rp (iorder2, theta, epsilon, roots, poles);
band_filter_common (iorder, freq1, freq2, epsilon, roots, poles, a, b, TRUE, TRUE);
}
@@@ -527,7 -604,9 +604,9 @@@ gsl_filter_tscheb2_bp (uint ior
g_return_if_fail (freq1 > 0);
g_return_if_fail (freq1 < freq2);
g_return_if_fail (freq2 < PI);
-
++
theta = 2. * atan2 (1., cotan ((freq2 - freq1) * 0.5));
+
gsl_filter_tscheb2_rp (iorder2, theta, steepness, epsilon, roots, poles);
band_filter_common (iorder, freq1, freq2, epsilon, roots, poles, a, b, TRUE, FALSE);
}
@@@ -588,7 -674,9 +674,9 @@@ gsl_filter_tscheb1_bs (uint ior
g_return_if_fail (freq1 > 0);
g_return_if_fail (freq1 < freq2);
g_return_if_fail (freq2 < PI);
-
++
theta = 2. * atan2 (1., tan ((freq2 - freq1) * 0.5));
+
gsl_filter_tscheb1_rp (iorder2, theta, epsilon, roots, poles);
band_filter_common (iorder, freq1, freq2, epsilon, roots, poles, a, b, FALSE, TRUE);
}
@@@ -620,7 -710,9 +710,9 @@@ gsl_filter_tscheb2_bs (uint ior
g_return_if_fail (freq1 > 0);
g_return_if_fail (freq1 < freq2);
g_return_if_fail (freq2 < PI);
-
++
theta = 2. * atan2 (1., tan ((freq2 - freq1) * 0.5));
+
gsl_filter_tscheb2_rp (iorder2, theta, steepness, epsilon, roots, poles);
band_filter_common (iorder, freq1, freq2, epsilon, roots, poles, a, b, FALSE, FALSE);
}
@@@ -640,11 -734,14 +734,14 @@@ tschebyscheff_poly (uint degree
else
{
double *u = g_newa (double, 1 + degree);
-
++
u[degree] = 0; u[degree - 1] = 0;
tschebyscheff_poly (degree - 2, u);
-
++
v[0] = 0;
tschebyscheff_poly (degree - 1, v + 1);
bse_poly_scale (degree - 1, v + 1, 2);
-
++
bse_poly_sub (degree, v, u);
}
}
@@@ -661,8 -759,10 +759,10 @@@ gsl_filter_tscheb1_test (uint i
double *q = g_newa (double, 2 * (1 + iorder));
double O = bse_trans_freq2s (zomega);
uint i;
-
++
/* calc Vk() */
tschebyscheff_poly (iorder, vk);
-
++
/* calc q=1+e^2*Vk()^2 */
bse_poly_mul (q, iorder >> 1, vk, iorder >> 1, vk);
iorder *= 2;
@@@ -672,6 -773,7 +773,7 @@@
bse_poly_complex_roots (iorder, q, roots);
for (i = 0; i < iorder; i++)
roots[i] = bse_complex_mul (roots[i], bse_complex (0, O));
-
++
/* choose roots from the left half-plane */
if (0)
g_print ("zhqr-root:\n%s\n", bse_complex_list (iorder, roots, " "));
@@@ -684,19 -786,23 +786,23 @@@
r++;
}
iorder /= 2;
-
++
/* assert roots found */
if (!(r - roots == iorder))
{
g_print ("ERROR: n_roots=%u != iorder=%u\n", r - roots, iorder);
abort ();
}
-
++
/* s => z */
for (i = 0; i < iorder; i++)
roots[i] = bse_trans_s2z (roots[i]);
-
++
/* z denominator polynomial */
bse_cpoly_from_roots (iorder, zf, roots);
for (i = 0; i <= iorder; i++)
b[i] = zf[i].re;
-
++
/* z numerator polynomial */
for (i = 0; i < iorder; i++)
{
@@@ -706,8 -812,10 +812,10 @@@
bse_cpoly_from_roots (iorder, zf, roots);
for (i = 0; i <= iorder; i++)
a[i] = zf[i].re;
-
++
/* scale for b[0]==1.0 */
bse_poly_scale (iorder, b, 1.0 / b[0]);
+
/* scale maximum to 1.0 */
norm = bse_poly_eval (iorder, a, 1) / bse_poly_eval (iorder, b, 1);
if ((iorder & 0x01) == 0) /* norm is fluctuation minimum */
@@@ -755,17 -866,22 +866,22 @@@ gsl_filter_fir_approx (uint io
double lfreq = -2, lval = 1.0, rfreq = -1, rval = 1.0;
double *fft_in, *fft_out;
double ffact;
-
++
g_return_if_fail (iorder >= 2);
g_return_if_fail ((iorder & 1) == 0);
+
while (fft_size / 2 <= iorder)
fft_size *= 2;
-
++
fft_in = g_newa (double, fft_size*2);
fft_out = fft_in+fft_size;
ffact = 2.0 * PI / (double)fft_size;
-
++
for (i = 0; i <= fft_size / 2; i++)
{
double f = (double) i * ffact;
double pos, val;
-
++
while (f > rfreq && point != n_points)
{
lfreq = rfreq;
@@@ -774,11 -890,13 +890,13 @@@
rval = value[point];
point++;
}
-
++
pos = (f - lfreq) / (rfreq - lfreq);
if (interpolate_db)
val = bse_db_to_factor (bse_db_from_factor (lval, -96) * (1.0 - pos) + bse_db_from_factor (rval, -96)
* pos);
else
val = lval * (1.0 - pos) + rval * pos;
-
++
if (i != fft_size / 2)
{
fft_in[2 * i] = val;
@@@ -787,7 -905,9 +905,9 @@@
else
fft_in[1] = val;
}
-
++
gsl_power2_fftsr_scale (fft_size, fft_in, fft_out);
-
++
for (i = 0; i <= iorder / 2; i++)
{
double c = fft_out[i] * gsl_blackman_window (0.5 + (double) i / (iorder + 2.0));
@@@ -824,8 -951,10 +951,10 @@@ gsl_iir_filter_change (GslIIRFilter *f
gdouble *buffer)
{
guint i;
+
g_return_if_fail (f != NULL && a != NULL && b != NULL && buffer != NULL);
g_return_if_fail (order > 0);
-
++
/* there's no point in calling this function if f wasn't setup properly
* and it's only the As and Bs that changed
*/
@@@ -897,8 -1042,10 +1042,10 @@@ gsl_iir_filter_eval (GslIIRFilter *f
gfloat *y)
{
const gfloat *bound;
-
++
g_return_if_fail (f != NULL && x != NULL && y != NULL);
g_return_if_fail (f->order > 0);
+
bound = x + n_values;
while (x < bound)
{
@@@ -1153,10 -1329,12 +1329,12 @@@ gsl_filter_sine_scan (guint order
GslIIRFilter filter_i;
gdouble *filter_state_r;
gdouble *filter_state_i;
-
++
g_return_val_if_fail (order > 0, 0.0);
g_return_val_if_fail (a != NULL, 0.0);
g_return_val_if_fail (b != NULL, 0.0);
g_return_val_if_fail (freq >= 0 && freq < (mix_freq / 2), 0.0);
-
++
filter_state_r = g_newa (double, (order + 1) * 4);
filter_state_i = g_newa (double, (order + 1) * 4);
gsl_iir_filter_setup (&filter_r, order, a, b, filter_state_r);
@@@ -1173,6 -1352,7 +1352,7 @@@
do
{
guint i;
-
++
for (i = 0; i < block_size; i++)
{
#if HAVE_SINCOS
@@@ -1193,9 -1373,12 +1373,12 @@@
phase -= 2 * M_PI;
}
}
-
++
gsl_iir_filter_eval (&filter_r, block_size, x_r, y_r);
gsl_iir_filter_eval (&filter_i, block_size, x_i, y_i);
+
last_volume = volume;
+
volume = 0;
for (i = 0; i < block_size; i++)
volume += bse_complex_abs (bse_complex (y_r[i], y_i[i]));
diff --cc bse/gslincluder.hh
index df7ebbe,cd0b1ee..bd0756e
--- a/bse/gslincluder.hh
+++ b/bse/gslincluder.hh
@@@ -6,6 -7,7 +7,7 @@@
my $first_case = 0;
my $last_case = 1024;
my $i;
-
++
print "#define GSL_INCLUDER_MAKE_FUNC(name,case) GSL_INCLUDER_CONCAT3 (name, __, case)\n";
print "#define GSL_INCLUDER_CONCAT3(x,y,z) x ## y ## z\n";
print "#define GSL_INCLUDER_FUNC GSL_INCLUDER_MAKE_FUNC (GSL_INCLUDER_NAME,
GSL_INCLUDER_CASE)\n";
diff --cc bse/gslmagic.cc
index 567c7f1,5fed756..78d1822
--- a/bse/gslmagic.cc
+++ b/bse/gslmagic.cc
@@@ -54,6 -65,7 +65,7 @@@ gsl_magic_list_brute_match (SfiRin
SfiRing **other_matches)
{
BFile bfile = { -1, };
-
++
g_return_if_fail (file_name != NULL);
if (ext_matches)
g_return_if_fail (*ext_matches == NULL);
@@@ -65,6 -79,7 +79,7 @@@
{
const char *extension = strrchr (file_name, '.');
SfiRing *node;
-
++
/* match by extension */
if (ext_matches && extension)
for (node = magic_list; node; node = sfi_ring_walk (node, magic_list))
@@@ -99,7 -117,9 +117,9 @@@ gsl_magic_list_match_file_skip (SfiRin
{
GslMagic *rmagic = NULL;
BFile bfile = { -1, };
-
++
g_return_val_if_fail (file_name != NULL, NULL);
-
++
if (bfile_open (&bfile, file_name, skip_offset))
{
const char *extension = strrchr (file_name, '.');
@@@ -152,8 -176,10 +176,10 @@@
}
bfile_close (&bfile);
}
-
++
return rmagic;
}
+
GslMagic*
gsl_magic_list_match_file (SfiRing *magic_list,
const gchar *file_name)
@@@ -224,6 -258,7 +258,7 @@@ magic_parse_test (GslRealMagic *magic,
if (!magic->read_string)
{
gchar *f = NULL;
-
++
if (string[0] == '<' || string[0] == '>')
{
if (magic->cmp_unsigned)
@@@ -251,12 -286,14 +286,14 @@@
magic->value.v_int32 = strtol (string, &f, string[1] == 'x' ? 16 : 8);
else
magic->value.v_int32 = strtol (string, &f, 10);
-
++
return *string == 0 || !f || *f == 0;
}
else
{
gchar tmp_string[MAX_MAGIC_STRING + 1];
guint n = 0;
-
++
if (string[0] == '<' || string[0] == '>')
{
magic->magic_check = string[0] == '<' ? MAGIC_CHECK_STRING_SMALLER : MAGIC_CHECK_STRING_GREATER;
@@@ -393,6 -435,7 +435,7 @@@ static gboolea
magic_parse_offset (GslRealMagic *magic, char *string)
{
gchar *f = NULL;
-
++
if (string[0] == '0')
magic->offset = strtol (string, &f, string[1] == 'x' ? 16 : 8);
else
@@@ -406,9 -451,11 +451,11 @@@ magic_create (char *magic_string, cons
if (*s) do *(s++) = 0; while (strchr (magic_field_delims, *s)); }
GslRealMagic *magics = NULL;
gchar *p = magic_string;
-
++
while (p && *p)
{
gchar *next_line;
-
++
if (*p == '#' || *p == '\n')
{
next_line = strchr (p, '\n');
@@@ -448,8 -496,10 +496,10 @@@
}
p = next_line;
}
-
++
return magics;
}
+
static gboolean
magic_check_data (GslRealMagic *magic, MagicData *data)
{
@@@ -512,6 -566,7 +566,7 @@@ magic_read_data (BFile *bfile, GslRealM
else if (magic->read_string)
{
guint l = magic->data_size;
-
++
if (l < 1 || l > MAX_MAGIC_STRING)
l = MIN (MAX_MAGIC_STRING, file_size - magic->offset);
if (!bfile_read (bfile, magic->offset, data->v_string, l))
diff --cc bse/gsloscillator-aux.cc
index c121e95,ca70152..488f91d
--- a/bse/gsloscillator-aux.cc
+++ b/bse/gsloscillator-aux.cc
@@@ -31,14 -35,17 +35,17 @@@ GSL_INCLUDER_FUNC (GslOscData *osc
gfloat posm_strength, self_posm_strength;
gfloat *boundary = mono_out + n_values;
GslOscWave *wave = &osc->wave;
-
++
pos_inc = bse_dtoi (osc->last_freq_level * transpose * fine_tune * wave->freq_to_step);
sync_pos = osc->config.phase * wave->phase_to_pos;
posm_strength = pos_inc * osc->config.fm_strength;
self_posm_strength = pos_inc * osc->config.self_fm_strength;
-
++
/* do the mixing */
do
{
gfloat v;
-
++
/* handle syncs
*/
#if (ISYNC1_OSYNC0) /* input sync only */
@@@ -70,6 -77,7 +77,7 @@@
*sync_out++ = is_sync >= 2 ? 1.0 : 0.0;
}
#endif
-
++
/* track frequency changes
*/
#if (WITH_FREQ)
@@@ -144,6 -155,7 +155,7 @@@
}
#endif /* v = value_out done */
*mono_out++ = v;
-
++
/* position increment
*/
#if (WITH_OSYNC)
@@@ -167,6 -179,7 +179,7 @@@
#endif
}
while (mono_out < boundary);
-
++
osc->last_pos = WITH_OSYNC ? last_pos : cur_pos;
osc->cur_pos = cur_pos;
osc->last_sync_level = last_sync_level;
diff --cc bse/gsloscillator.cc
index 74a76c9,efa232e..09aba60
--- a/bse/gsloscillator.cc
+++ b/bse/gsloscillator.cc
@@@ -16,8 -22,10 +22,10 @@@ osc_update_pwm_offset (GslOscData *osc
/* calculate pulse scaling range for this offset */
osc->pwm_offset = foffset * osc->wave.n_values;
osc->pwm_offset <<= osc->wave.n_frac_bits;
+
maxp_offs = (osc->wave.min_pos + osc->wave.n_values + osc->wave.max_pos) << (osc->wave.n_frac_bits - 1);
minp_offs = (osc->wave.max_pos + osc->wave.min_pos) << (osc->wave.n_frac_bits - 1);
-
++
mpos = maxp_offs + (osc->pwm_offset >> 1);
tpos = mpos >> osc->wave.n_frac_bits;
max = osc->wave.values[tpos];
@@@ -97,9 -111,11 +111,11 @@@ osc_process (GslOscData *osc
mode |= OSC_FLAG_EXP_MOD;
else if (imod)
mode |= OSC_FLAG_LINEAR_MOD;
-
++
if (UNLIKELY (mode != osc->last_mode))
{
guint change_mask = osc->last_mode >= OSC_FLAG_INVAL ? OSC_FLAG_INVAL : osc->last_mode ^ mode;
-
++
if (change_mask & OSC_FLAG_FREQ)
{
gdouble fcpos, flpos, transposed_freq;
@@@ -120,6 -137,7 +137,7 @@@
}
osc->last_mode = mode;
}
-
++
/* invoke generated function variant */
if (mode & OSC_FLAG_PULSE_OSC)
osc_process_pulse_table[mode & ~OSC_FLAG_PULSE_OSC] (osc, n_values,
diff --cc bse/gslosctable.cc
index 509a994,0fb5862..96c1b59
--- a/bse/gslosctable.cc
+++ b/bse/gslosctable.cc
@@@ -58,6 -69,7 +64,7 @@@ cache_table_entry_locs_cmp (gconstpoint
const OscTableEntry *const *ep2 = (const OscTableEntry*const*) bsearch_node2;
const OscTableEntry *e1 = *ep1;
const OscTableEntry *e2 = *ep2;
-
++
if (e1->wave_form == e2->wave_form)
{
if (e1->filter_func == e2->filter_func)
@@@ -76,8 -89,10 +84,10 @@@ osc_table_entry_locs_cmp (gconstpointe
const OscTableEntry *const *ep2 = (const OscTableEntry*const*) bsearch_node2;
const OscTableEntry *e1 = *ep1;
const OscTableEntry *e2 = *ep2;
-
++
return G_BSEARCH_ARRAY_CMP (e1->mfreq, e2->mfreq);
}
+
static OscTableEntry*
cache_table_entry_lookup_best (GslOscWaveForm wave_form,
guint8* filter_func,
@@@ -129,6 -148,7 +143,7 @@@
ep2 = NULL; /* no valid match at all */
}
}
-
++
/* now figure best out of valid siblings */
if (ep2)
{
@@@ -178,18 -202,22 +196,22 @@@ osc_table_entry_lookup_best (const GslO
if (i > 0)
{
OscTableEntry **tp = (OscTableEntry**) g_bsearch_array_get_nth (table->entry_array, &osc_taconfig,
i - 1);
-
++
*min_mfreq = (*tp)->mfreq;
}
else
*min_mfreq = 0;
}
-
++
return *ep;
}
+
static guint
wave_table_size (GslOscWaveForm wave_form,
gfloat mfreq)
{
/* have to return power of 2, and honour 8 <= size */
-
++
/* FIXME: decide on other table sizes
10000: 256
5000: 512
@@@ -223,6 -256,7 +250,7 @@@ cache_table_ref_entry (GslOscWaveForm w
gfloat mfreq)
{
OscTableEntry *e = cache_table_entry_lookup_best (wave_form, (guint8*) filter_func, mfreq);
-
++
if (e && !CACHE_MATCH_FREQ (mfreq, e->mfreq))
e = NULL;
if (!e)
@@@ -241,6 -276,7 +270,7 @@@
e->ref_count = 1;
e->n_values = size;
gsl_osc_wave_fill_buffer (e->wave_form, e->n_values, values);
-
++
/* filter wave accordingly */
gsl_osc_wave_extrema (e->n_values, values, &min, &max);
fft = g_new (gfloat, e->n_values + 2); /* [0..n_values] for n_values/2 complex freqs */
@@@ -265,6 -305,7 +299,7 @@@ static voi
cache_table_unref_entry (OscTableEntry *e)
{
g_return_if_fail (e->ref_count > 0);
-
++
e->ref_count -= 1;
if (e->ref_count == 0)
{
@@@ -283,11 -325,14 +319,14 @@@ gsl_osc_table_create (gfloat mi
GslOscTable *table;
gfloat nyquist;
guint i;
-
++
g_return_val_if_fail (mix_freq > 0, NULL);
g_return_val_if_fail (n_freqs > 0, NULL);
g_return_val_if_fail (freqs != NULL, NULL);
-
++
if (!cache_entries)
cache_entries = g_bsearch_array_create (&cache_taconfig);
-
++
table = sfi_new_struct (GslOscTable, 1);
table->mix_freq = mix_freq;
table->wave_form = wave_form;
@@@ -299,6 -344,7 +338,7 @@@
{
OscTableEntry *e;
gdouble mfreq = MIN (nyquist, freqs[i]);
-
++
mfreq /= table->mix_freq;
e = osc_table_entry_lookup_best (table, mfreq, NULL);
if (!e || fabs (e->mfreq * table->mix_freq - mfreq * table->mix_freq) > OSC_FREQ_EPSILON)
@@@ -307,11 -353,13 +347,13 @@@
table->entry_array = g_bsearch_array_insert (table->entry_array, &osc_taconfig, &e);
}
else if (e)
- OSC_DEBUG ("not inserting existing entry (freq=%f) for freq %f (nyquist=%f)",
- e->mfreq * table->mix_freq, mfreq * table->mix_freq, nyquist);
+ ODEBUG ("not inserting existing entry (freq=%f) for freq %f (nyquist=%f)",
+ e->mfreq * table->mix_freq, mfreq * table->mix_freq, nyquist);
}
-
++
return table;
}
+
void
gsl_osc_table_lookup (const GslOscTable *table,
gfloat freq,
@@@ -319,8 -367,10 +361,10 @@@
{
OscTableEntry *e;
gfloat mfreq, min_mfreq;
+
g_return_if_fail (table != NULL);
g_return_if_fail (wave != NULL);
-
++
mfreq = freq / table->mix_freq;
e = osc_table_entry_lookup_best (table, mfreq, &min_mfreq);
if (e)
@@@ -354,7 -406,9 +400,9 @@@ voi
gsl_osc_table_free (GslOscTable *table)
{
guint n;
-
++
g_return_if_fail (table != NULL);
-
++
n = g_bsearch_array_get_n_nodes (table->entry_array);
while (n--)
{
@@@ -510,7 -573,9 +565,9 @@@ gsl_osc_wave_adjust_range (guint n_va
{
gfloat center;
guint i;
-
++
g_return_if_fail (n_values > 0 && values != NULL);
+
center = (min + max) / 2;
center = new_center - center;
min = fabs (min + center);
diff --cc bse/gslvorbis-cutter.cc
index c7ff54a,ef24522..e0357ce
--- a/bse/gslvorbis-cutter.cc
+++ b/bse/gslvorbis-cutter.cc
@@@ -141,6 -159,7 +156,7 @@@ voi
gsl_vorbis_cutter_destroy (GslVorbisCutter *self)
{
g_return_if_fail (self != NULL);
-
++
/* cleanup codec state */
if (self->vorbis_initialized)
vorbis_dsp_clear (&self->vdsp);
diff --cc bse/gslvorbis-enc.cc
index 1561e1f,4ceddb7..3703984
--- a/bse/gslvorbis-enc.cc
+++ b/bse/gslvorbis-enc.cc
@@@ -59,21 -66,28 +65,28 @@@ GslVorbisEncoder
gsl_vorbis_encoder_new (void)
{
GslVorbisEncoder *self;
-
++
self = g_new0 (GslVorbisEncoder, 1);
self->stream_setup = FALSE;
-
++
vorbis_comment_init (&self->vcomment);
-
++
/* defaults */
gsl_vorbis_encoder_set_quality (self, 3.0);
gsl_vorbis_encoder_set_n_channels (self, 2);
gsl_vorbis_encoder_set_sample_freq (self, 44100);
-
++
/* init portions */
gsl_vorbis_encoder_reset (self);
-
++
return self;
}
+
void
gsl_vorbis_encoder_destroy (GslVorbisEncoder *self)
{
g_return_if_fail (self != NULL);
-
++
gsl_vorbis_encoder_reset (self);
vorbis_comment_clear (&self->vcomment);
g_free (self);
@@@ -123,9 -143,11 +142,11 @@@ gsl_vorbis_encoder_add_lcomment (GslVor
const gchar *comment)
{
gchar *utf8_comment;
-
++
g_return_if_fail (self != NULL);
g_return_if_fail (self->stream_setup == FALSE);
g_return_if_fail (comment != NULL);
-
++
utf8_comment = convert_latin1_to_utf8 (comment);
vorbis_comment_add (&self->vcomment, utf8_comment);
g_free (utf8_comment);
@@@ -136,10 -159,12 +158,12 @@@ gsl_vorbis_encoder_add_named_lcomment (
const gchar *comment)
{
gchar *utf8_comment;
-
++
g_return_if_fail (self != NULL);
g_return_if_fail (self->stream_setup == FALSE);
g_return_if_fail (tag_name != NULL);
g_return_if_fail (comment != NULL);
-
++
utf8_comment = convert_latin1_to_utf8 (comment);
vorbis_comment_add_tag (&self->vcomment, tag_name, utf8_comment);
g_free (utf8_comment);
@@@ -170,8 -200,10 +199,10 @@@ gsl_vorbis_encoder_set_n_channels (GslV
g_return_if_fail (self != NULL);
g_return_if_fail (self->stream_setup == FALSE);
g_return_if_fail (n_channels >= 1 && n_channels <= 2);
-
++
self->n_channels = n_channels;
}
+
void
gsl_vorbis_encoder_set_sample_freq (GslVorbisEncoder *self,
guint sample_freq)
@@@ -179,8 -211,10 +210,10 @@@
g_return_if_fail (self != NULL);
g_return_if_fail (self->stream_setup == FALSE);
g_return_if_fail (sample_freq >= 8000 && sample_freq <= 96000);
-
++
self->sample_freq = sample_freq;
}
+
static void
gsl_vorbis_encoder_reset (GslVorbisEncoder *self)
{
@@@ -213,12 -249,14 +248,14 @@@ gsl_vorbis_encoder_setup_stream (GslVor
ogg_packet opacket1, opacket2, opacket3;
ogg_page opage;
gint result;
+
g_return_val_if_fail (self != NULL, BSE_ERROR_INTERNAL);
g_return_val_if_fail (self->stream_setup == FALSE, BSE_ERROR_INTERNAL);
-
++
self->serial = serial;
vorbis_info_init (&self->vinfo);
- DEBUG ("init: channels=%u mixfreq=%u quality=%f bitrate=%d\n",
- self->n_channels, self->sample_freq, self->vbr_quality, self->vbr_nominal);
+ VDEBUG ("init: channels=%u mixfreq=%u quality=%f bitrate=%d\n",
+ self->n_channels, self->sample_freq, self->vbr_quality, self->vbr_nominal);
if (self->vbr_nominal > 0) /* VBR setup by nominal bitrate */
result = vorbis_encode_setup_managed (&self->vinfo,
self->n_channels,
@@@ -238,6 -276,7 +275,7 @@@
vorbis_info_clear (&self->vinfo);
return BSE_ERROR_CODEC_FAILURE;
}
-
++
self->stream_setup = TRUE;
vorbis_analysis_init (&self->vdsp, &self->vinfo);
vorbis_block_init (&self->vdsp, &self->vblock);
@@@ -292,6 -338,7 +337,7 @@@ gsl_vorbis_encoder_write_pcm (GslVorbis
g_return_if_fail (self->n_channels * (n_values / self->n_channels) == n_values); /* check alignment */
if (n_values)
g_return_if_fail (values != NULL);
-
++
/* compress away remaining data so we only buffer encoded data */
while (gsl_vorbis_encoder_needs_processing (self))
gsl_vorbis_encoder_process (self);
@@@ -309,6 -358,7 +357,7 @@@ gsl_vorbis_encoder_pcm_done (GslVorbisE
{
g_return_if_fail (self != NULL);
g_return_if_fail (self->stream_setup == TRUE);
-
++
if (!self->pcm_done)
{
self->pcm_done = TRUE;
@@@ -392,8 -451,10 +450,10 @@@ gsl_vorbis_encoder_ogg_eos (GslVorbisEn
{
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (self->stream_setup == TRUE, FALSE);
-
++
return self->eos && !self->dblocks;
}
+
gchar*
gsl_vorbis_encoder_version (void)
{
diff --cc bse/gslwavechunk.cc
index b22b7a9,30b34d9..9ea0cee
--- a/bse/gslwavechunk.cc
+++ b/bse/gslwavechunk.cc
@@@ -78,6 -88,7 +88,7 @@@ fill_block (GslWaveChunk *wchunk
guint i, dnode_length = wchunk->dcache->node_size;
GslDataCacheNode *dnode;
WPos wpos;
-
++
wpos.one = wchunk->n_channels;
wpos.dir = 1; // wchunk->n_channels;
if (backward)
@@@ -88,6 -99,7 +99,7 @@@
for (i = 0; i < length; i++)
{
GslLong offset = wpos.pos;
-
++
if (offset < 0 || offset >= dcache_length)
block[i] = 0;
else
@@@ -114,8 -127,10 +127,10 @@@ create_block_for_offset (GslWaveChunk *
GslLong loop_width = wchunk->loop_last - wchunk->loop_first;
gfloat *mem;
GslLong l, j, k;
-
++
if (wchunk->loop_type != GSL_WAVE_LOOP_PINGPONG)
loop_width += one;
-
++
l = length + 2 * padding;
mem = sfi_new_struct (gfloat, l);
offset -= padding;
@@@ -156,9 -172,11 +172,11 @@@ setup_pblocks (GslWaveChunk *wchunk
GslLong loop_duration, wave_last = wchunk->length - one;
gfloat *mem;
guint l;
-
++
if (wchunk->loop_type != GSL_WAVE_LOOP_PINGPONG)
loop_width += one;
loop_duration = loop_width * wchunk->loop_count;
-
++
wchunk->head.first = -padding;
wchunk->head.last = big_pad;
wchunk->head.length = wchunk->head.last - wchunk->head.first + one;
@@@ -218,6 -236,7 +236,7 @@@
wchunk->leave_end_norm = 0;
wchunk->leave.length = 0;
}
-
++
l = wchunk->head.length + 2 * padding;
mem = sfi_new_struct (gfloat, l);
fill_block (wchunk, mem, wchunk->head.first - padding, l, FALSE, wchunk->loop_count);
@@@ -250,6 -270,7 +270,7 @@@ wave_identify_offset (GslWaveChunk *wch
{
GslLong pos = iter->pos;
GslLong one = wchunk->n_channels;
-
++
if (UNLIKELY (pos < wchunk->head.first)) /* outside wave boundaries */
{
iter->lbound = 0;
@@@ -328,6 -349,7 +349,7 @@@
else if (wchunk->loop_type == GSL_WAVE_LOOP_PINGPONG) /* in ping-pong loop */
{
guint loop_width = wchunk->loop_last - wchunk->loop_first;
-
++
pos -= wchunk->loop_last + one;
pos %= 2 * loop_width;
if (pos <= wchunk->ppwrap.last)
@@@ -370,6 -392,7 +392,7 @@@
else if (wchunk->loop_type == GSL_WAVE_LOOP_JUMP) /* in jump loop */
{
guint loop_width = wchunk->loop_last - wchunk->loop_first + one;
-
++
pos -= wchunk->loop_last + one;
pos %= loop_width;
if (pos >= wchunk->wrap.first)
@@@ -408,23 -432,28 +432,28 @@@ gsl_wave_chunk_use_block (GslWaveChun
GslLong one;
Iter iter = { 0, };
gboolean reverse;
-
++
g_return_if_fail (wchunk != NULL);
g_return_if_fail (wchunk->open_count > 0);
g_return_if_fail (block != NULL);
g_return_if_fail (wchunk->dcache != NULL);
g_return_if_fail (block->node == NULL);
g_return_if_fail (block->play_dir == -1 || block->play_dir == +1);
-
++
block->offset /= wchunk->n_channels;
block->offset *= wchunk->n_channels;
-
++
one = wchunk->n_channels;
reverse = block->play_dir < 0;
iter.pos = block->offset;
phase = wave_identify_offset (wchunk, &iter);
-
++
block->is_silent = FALSE;
if (phase <= PHASE_UNDEF (wchunk))
{
GslDataCacheNode *dnode;
guint offset;
-
++
if (phase == PHASE_UNDEF (wchunk))
{
block->is_silent = TRUE;
@@@ -437,6 -466,7 +466,7 @@@
else
{
GslLong max_length;
-
++
if (phase == PHASE_NORM_BACKWARD (wchunk))
{
offset = iter.ubound - iter.rel_pos;
@@@ -493,6 -524,7 +524,7 @@@ gsl_wave_chunk_unuse_block (GslWaveChun
g_return_if_fail (wchunk != NULL);
g_return_if_fail (block != NULL);
g_return_if_fail (wchunk->dcache != NULL);
-
++
if (block->node)
{
gsl_data_cache_unref_node (wchunk->dcache, (GslDataCacheNode*) block->node);
@@@ -507,13 -540,17 +540,17 @@@ wave_chunk_setup_loop (GslWaveChunk *wc
GslLong loop_last = wchunk->requested_loop_last;
guint loop_count = wchunk->requested_loop_count;
GslLong one, padding, big_pad;
-
++
g_return_if_fail (wchunk->open_count > 0);
-
++
one = wchunk->n_channels;
padding = wchunk->n_pad_values;
big_pad = PBLOCK_SIZE (wchunk->n_pad_values, wchunk->n_channels);
-
++
/* check validity */
if (loop_count < 1 || loop_first < 0 || loop_last < 0 || wchunk->length < 1)
loop_type = GSL_WAVE_LOOP_NONE;
-
++
/* setup loop types */
switch (loop_type)
{
@@@ -570,9 -608,11 +608,11 @@@ gsl_wave_chunk_new (GslDataCache *dca
guint loop_count)
{
GslWaveChunk *wchunk;
-
++
g_return_val_if_fail (dcache != NULL, NULL);
g_return_val_if_fail (osc_freq < mix_freq / 2, NULL);
g_return_val_if_fail (loop_type >= GSL_WAVE_LOOP_NONE && loop_type <= GSL_WAVE_LOOP_PINGPONG, NULL);
-
++
wchunk = sfi_new_struct0 (GslWaveChunk, 1);
wchunk->dcache = gsl_data_cache_ref (dcache);
wchunk->length = 0;
@@@ -592,13 -632,16 +632,16 @@@
wchunk->requested_loop_first = loop_first;
wchunk->requested_loop_last = loop_last;
wchunk->requested_loop_count = loop_count;
-
++
return wchunk;
}
+
GslWaveChunk*
gsl_wave_chunk_ref (GslWaveChunk *wchunk)
{
g_return_val_if_fail (wchunk != NULL, NULL);
g_return_val_if_fail (wchunk->ref_count > 0, NULL);
-
++
wchunk->ref_count++;
return wchunk;
}
@@@ -607,6 -651,7 +651,7 @@@ gsl_wave_chunk_unref (GslWaveChunk *wch
{
g_return_if_fail (wchunk != NULL);
g_return_if_fail (wchunk->ref_count > 0);
-
++
wchunk->ref_count--;
if (wchunk->ref_count == 0)
{
@@@ -620,9 -666,11 +666,11 @@@ gsl_wave_chunk_open (GslWaveChunk *wchu
{
g_return_val_if_fail (wchunk != NULL, BSE_ERROR_INTERNAL);
g_return_val_if_fail (wchunk->ref_count > 0, BSE_ERROR_INTERNAL);
-
++
if (wchunk->open_count == 0)
{
BseErrorType error;
-
++
error = gsl_data_handle_open (wchunk->dcache->dhandle);
if (error != BSE_ERROR_NONE)
return error;
@@@ -655,12 -704,15 +704,15 @@@ voi
gsl_wave_chunk_close (GslWaveChunk *wchunk)
{
GslLong padding;
-
++
g_return_if_fail (wchunk != NULL);
g_return_if_fail (wchunk->open_count > 0);
g_return_if_fail (wchunk->ref_count > 0);
-
++
wchunk->open_count--;
if (wchunk->open_count)
return;
-
++
padding = wchunk->n_pad_values;
gsl_data_cache_close (wchunk->dcache);
if (wchunk->head.mem)
@@@ -699,13 -752,16 +752,16 @@@ gsl_wave_chunk_debug_block (GslWaveChun
gfloat *block)
{
g_return_if_fail (wchunk != NULL);
-
++
fill_block (wchunk, block, offset, length, FALSE, wchunk->loop_count);
}
+
GslWaveChunk*
_gsl_wave_chunk_copy (GslWaveChunk *wchunk)
{
g_return_val_if_fail (wchunk != NULL, NULL);
g_return_val_if_fail (wchunk->ref_count > 0, NULL);
-
++
return gsl_wave_chunk_new (wchunk->dcache,
wchunk->mix_freq,
wchunk->osc_freq,
@@@ -718,6 -775,7 +775,7 @@@ const gchar
gsl_wave_loop_type_to_string (GslWaveLoopType wave_loop)
{
g_return_val_if_fail (wave_loop >= GSL_WAVE_LOOP_NONE && wave_loop <= GSL_WAVE_LOOP_PINGPONG, NULL);
-
++
switch (wave_loop)
{
case GSL_WAVE_LOOP_NONE: return "none";
@@@ -730,6 -789,7 +789,7 @@@ GslWaveLoopTyp
gsl_wave_loop_type_from_string (const gchar *string)
{
g_return_val_if_fail (string != NULL, GSL_WAVE_LOOP_NONE);
-
++
while (*string == ' ')
string++;
if (strncasecmp (string, "jump", 4) == 0)
diff --cc bse/gslwavechunk.hh
index 93ca5a7,d909a7e..787889f
--- a/bse/gslwavechunk.hh
+++ b/bse/gslwavechunk.hh
@@@ -22,18 -25,22 +25,22 @@@ struct _GslWaveChun
/* wave chunk data residency */
GslDataCache *dcache;
GslLong length; /* number of per-channel-values * n-channels */
-
++
/* chunk specific parameters */
gint n_channels;
GslLong n_pad_values; /* guaranteed pad values around blocks */
GslLong wave_length; /* start + loop duration + end (single channel) */
-
++
/* flags */
guint pploop_ends_backwards : 1;
guint mini_loop : 1;
-
++
/* loop spec */
GslWaveLoopType loop_type;
GslLong loop_first;
GslLong loop_last;
guint loop_count;
-
++
/* preformatted blocks */
GslWaveChunkMem head;
GslWaveChunkMem enter;
@@@ -43,6 -50,7 +50,7 @@@
GslWaveChunkMem tail;
GslLong leave_end_norm;
GslLong tail_start_norm;
-
++
GslWaveLoopType requested_loop_type;
GslLong requested_loop_first;
GslLong requested_loop_last;
diff --cc bse/gslwaveosc-aux.cc
index 9494edf,a2e6de4..6301260
--- a/bse/gslwaveosc-aux.cc
+++ b/bse/gslwaveosc-aux.cc
@@@ -102,6 -110,7 +110,7 @@@ WOSC_MIX_VARIANT_NAME (GslWaveOscData *
wosc->x = block->start + CLAMP (wosc->config.channel, 0, wosc->wchunk->n_channels - 1);
boundary = block->end;
}
-
++
x = wosc->x;
d0 = b[0] * y[wosc_j]; wosc_j++; wosc_j &= 0x7;
d1 = b[1] * y[wosc_j]; wosc_j++; wosc_j &= 0x7;
diff --cc bse/gslwaveosc.cc
index 2beab53,41a692e..18800c8
--- a/bse/gslwaveosc.cc
+++ b/bse/gslwaveosc.cc
@@@ -347,6 -393,7 +380,7 @@@ voi
gsl_wave_osc_shutdown (GslWaveOscData *wosc)
{
g_return_if_fail (wosc != NULL);
-
++
if (wosc->wchunk)
gsl_wave_chunk_unuse_block (wosc->wchunk, &wosc->block);
memset (wosc, 0xaa, sizeof (GslWaveOscData));
diff --cc bse/ladspa.hh
index 1c06b8b,cf0d3a1..af49342
--- a/bse/ladspa.hh
+++ b/bse/ladspa.hh
@@@ -46,11 -58,16 +58,16 @@@ extern "C"
is used to communicate audio samples and control values. It is
assumed that the plugin will work sensibly given any numeric input
value although it may have a preferred range (see hints below).
+
For audio it is generally assumed that 1.0f is the `0dB' reference
amplitude and is a `normal' signal level. */
+
typedef float LADSPA_Data;
+
/*****************************************************************************/
+
/* Special Plugin Properties:
-
++
Optional features of the plugin type are encapsulated in the
LADSPA_Properties type. This is assembled by ORing individual
properties together. */
@@@ -79,6 -103,7 +103,7 @@@ typedef int LADSPA_Properties
(3) The plugin will not access files, devices, pipes, sockets, IPC
or any other mechanism that might result in process or thread
blocking.
-
++
(4) The plugin will take an amount of time to execute a run() or
run_adding() call approximately of form (A+B*SampleCount) where A
and B depend on the machine and host in use. This amount of time
@@@ -120,14 -159,17 +159,17 @@@ typedef int LADSPA_PortDescriptor
leaving a plugin (e.g. to generate a GUI automatically). To make
this more meaningful, the plugin should provide `hints' to the host
describing the usual values taken by the data.
-
++
Note that these are only hints. The host may ignore them and the
plugin must not assume that data supplied to it is meaningful. If
the plugin receives invalid input data it is expected to continue
to run without failure and, where possible, produce a sensible
output (e.g. a high-pass filter given a negative cutoff frequency
might switch to an all-pass mode).
-
++
Hints are meaningful for all input and output ports but hints for
input control ports are expected to be particularly useful.
-
++
More hint information is encapsulated in the
LADSPA_PortRangeHintDescriptor type which is assembled by ORing
individual hint types together. Hints may require further
@@@ -426,6 -532,7 +532,7 @@@ typedef struct _LADSPA_Descriptor
/* Once an instance of a plugin has been finished with it can be
deleted using the following function. The instance handle passed
ceases to be valid after this call.
-
++
If activate() was called for a plugin instance then a
corresponding call to deactivate() must be made before cleanup()
is called. */
diff --cc bse/tests/blocktests.cc
index 3385dd8,e89151d..38ab325
--- a/bse/tests/blocktests.cc
+++ b/bse/tests/blocktests.cc
@@@ -227,6 -277,7 +228,7 @@@ bench_fill (void
const guint dups = TEST_CALIBRATION (50.0, Bse::Block::fill (BLOCK_SIZE, fblock, 2.f));
g_timer_stop (timer);
double c = g_timer_elapsed (timer, NULL);
-
++
double m = 9e300;
for (guint i = 0; i < RUNS; i++)
{
@@@ -254,6 -306,7 +257,7 @@@ bench_copy (void
const guint dups = TEST_CALIBRATION (50.0, Bse::Block::copy (BLOCK_SIZE, dest_fblock, src_fblock));
g_timer_stop (timer);
double c = g_timer_elapsed (timer, NULL);
-
++
double m = 9e300;
for (guint i = 0; i < RUNS; i++)
{
@@@ -282,6 -336,7 +287,7 @@@ bench_add (void
const guint dups = TEST_CALIBRATION (50.0, Bse::Block::add (BLOCK_SIZE, fblock1, fblock2));
g_timer_stop (timer);
double c = g_timer_elapsed (timer, NULL);
-
++
double m = 9e300;
for (guint i = 0; i < RUNS; i++)
{
@@@ -309,6 -365,7 +316,7 @@@ bench_sub (void
const guint dups = TEST_CALIBRATION (50.0, Bse::Block::sub (BLOCK_SIZE, fblock1, fblock2));
g_timer_stop (timer);
double c = g_timer_elapsed (timer, NULL);
-
++
double m = 9e300;
for (guint i = 0; i < RUNS; i++)
{
@@@ -336,6 -394,7 +345,7 @@@ bench_mul (void
const guint dups = TEST_CALIBRATION (50.0, Bse::Block::mul (BLOCK_SIZE, fblock1, fblock2));
g_timer_stop (timer);
double c = g_timer_elapsed (timer, NULL);
-
++
double m = 9e300;
for (guint i = 0; i < RUNS; i++)
{
@@@ -395,6 -460,7 +411,7 @@@ bench_range (void
const guint dups = TEST_CALIBRATION (50.0, Bse::Block::range (BLOCK_SIZE, fblock, min_value, max_value));
g_timer_stop (timer);
double c = g_timer_elapsed (timer, NULL);
-
++
double m = 9e300;
for (guint i = 0; i < RUNS; i++)
{
@@@ -423,6 -490,7 +441,7 @@@ bench_square_sum (void
const guint dups = TEST_CALIBRATION (50.0, Bse::Block::square_sum (BLOCK_SIZE, fblock));
g_timer_stop (timer);
double c = g_timer_elapsed (timer, NULL);
-
++
double m = 9e300;
for (guint i = 0; i < RUNS; i++)
{
@@@ -454,6 -526,7 +477,7 @@@ bench_range_and_square_sum (void
const guint dups = TEST_CALIBRATION (50.0, Bse::Block::range_and_square_sum (BLOCK_SIZE, fblock,
min_value, max_value));
g_timer_stop (timer);
double c = g_timer_elapsed (timer, NULL);
-
++
double m = 9e300;
for (guint i = 0; i < RUNS; i++)
{
diff --cc bse/tests/filtertest.cc
index 3280fc8,70c56d2..8fb3daf
--- a/bse/tests/filtertest.cc
+++ b/bse/tests/filtertest.cc
@@@ -610,6 -653,7 +628,7 @@@ random_filter_tests (
}
/* design and test filters */
generic_filter_tests ("Random Elliptic (dB)", filter_index, filters, skip_count);
-
++
/* generate filter requirements */
filter_index = 0;
frequest.kind = BSE_IIR_FILTER_ELLIPTIC;
@@@ -753,9 -806,9 +772,10 @@@ generic_filter_tests (const cha
if (i % tick_count == 0)
TOK();
}
+ Test::set_assertion_hook (NULL);
TDONE();
}
+
int
main (int argc,
char **argv)
diff --cc bse/tests/firhandle.cc
index fd90845,aa70993..6fa2ece
--- a/bse/tests/firhandle.cc
+++ b/bse/tests/firhandle.cc
@@@ -50,6 -57,7 +56,7 @@@ band_min (const vector<double>& scanned
double end_freq)
{
g_assert (scanned_freq.size() == scanned_values.size());
-
++
bool init = false;
double min_value = 1e19;
for (size_t i = 0; i < scanned_values.size(); i++)
@@@ -75,6 -84,7 +83,7 @@@ band_max (const vector<double>& scanned
double end_freq)
{
g_assert (scanned_freq.size() == scanned_values.size());
-
++
bool init = false;
double max_value = -1e19;
for (size_t i = 0; i < scanned_values.size(); i++)
@@@ -163,6 -187,7 +186,7 @@@ test_with_sine_sweep (FirHandleType typ
scanned_freq.push_back (sweep_freq[i]);
scanned_level_db.push_back (level_db);
// printf ("%f %.17g\n", sweep_freq[i], scanned_level_db.back());
-
++
if ((i & 15) == 0)
{
// check that theoretical and scanned response match
@@@ -216,6 -252,7 +240,7 @@@
const guint RUNS = 10;
GTimer *timer = g_timer_new();
const guint dups = TEST_CALIBRATION (50.0, read_through (fir_handle_sin));
-
++
double m = 9e300;
for (guint i = 0; i < RUNS; i++)
{
@@@ -228,14 -265,13 +253,15 @@@
m = e;
}
samples_per_second = sweep_sin.size() / (m / dups);
- treport_maximized (string_printf ("%s O64 mono", handle_name (type)).c_str(),
- samples_per_second, TUNIT (SAMPLE, SECOND));
- treport_maximized (string_printf ("CPU %s mono", handle_name (type)).c_str(),
- samples_per_second / 44100.0, TUNIT_STREAM);
+ TMSG (" %-28s : %+.14f samples/second",
+ string_printf ("%s O64 mono", handle_name (type)).c_str(),
+ samples_per_second);
+ TMSG (" %-28s : %+.14f streams",
+ string_printf ("CPU %s mono", handle_name (type)).c_str(),
+ samples_per_second / 44100.0);
}
}
+
static double
raised_cosine_fade (int64 pos,
int64 length,
@@@ -281,6 -323,7 +313,7 @@@ test_multi_channel (FirHandleType type
GslDataHandle *ihandle = gsl_data_handle_new_mem (n_channels, 32, mix_freq, 440, input.size(),
&input[0], NULL);
const int order = 116;
GslDataHandle *fir_handle = NULL;
-
++
if (type == FIR_HIGHPASS)
fir_handle = bse_data_handle_new_fir_highpass (ihandle, cutoff_freq, order);
else
@@@ -314,12 -360,16 +350,16 @@@ test_seek (FirHandleType type
const double mix_freq = 48000;
const double cutoff_freq = 11000;
const int order = 28;
+
vector<float> input (1 * 2 * 3 * 3000); // can be divided by n_channels
vector<float> output (input.size());
+
for (size_t i = 0; i < input.size(); i++)
input[i] = g_random_int_range (-1, 1);
+
GslDataHandle *ihandle = gsl_data_handle_new_mem (n_channels, 32, mix_freq, 440, input.size(),
&input[0], NULL);
GslDataHandle *fir_handle = NULL;
-
++
if (type == FIR_HIGHPASS)
fir_handle = bse_data_handle_new_fir_highpass (ihandle, cutoff_freq, order);
else
@@@ -330,6 -382,7 +372,7 @@@
GslDataPeekBuffer peek_buffer = { +1 /* incremental direction */, 0, };
for (size_t i = 0; i < output.size(); i++)
output[i] = gsl_data_handle_peek_value (fir_handle, i, &peek_buffer);
-
++
for (int t = 0; t < 400; t++)
{
int64 start = rand() % fir_handle->setup.n_values;
diff --cc bse/tests/loophandle.cc
index 333cc0b,cfb112d..971ebb3
--- a/bse/tests/loophandle.cc
+++ b/bse/tests/loophandle.cc
@@@ -19,9 -21,11 +21,11 @@@ loop_handle_reference_open (GslDataHand
{
LoopHandleReference *lhandle = (LoopHandleReference*) dhandle;
BseErrorType error;
-
++
error = gsl_data_handle_open (lhandle->src_handle);
if (error != BSE_ERROR_NONE)
return error;
-
++
*setup = lhandle->src_handle->setup; /* copies setup.xinfos by pointer */
if (setup->n_values > lhandle->requested_last)
{
@@@ -34,8 -38,10 +38,10 @@@
lhandle->loop_start = setup->n_values;
lhandle->loop_width = 0;
}
-
++
return BSE_ERROR_NONE;
}
+
static void
loop_handle_reference_close (GslDataHandle *dhandle)
{
@@@ -47,7 -55,9 +55,9 @@@ static voi
loop_handle_reference_destroy (GslDataHandle *dhandle)
{
LoopHandleReference *lhandle = (LoopHandleReference*) dhandle;
-
++
gsl_data_handle_unref (lhandle->src_handle);
-
++
gsl_data_handle_common_free (dhandle);
sfi_delete_struct (LoopHandleReference, lhandle);
}
@@@ -58,6 -69,7 +69,7 @@@ loop_handle_reference_read (GslDataHand
gfloat *values)
{
LoopHandleReference *lhandle = (LoopHandleReference*) dhandle;
-
++
if (voffset < lhandle->loop_start)
return gsl_data_handle_read (lhandle->src_handle, voffset,
MIN (lhandle->loop_start - voffset, n_values),
@@@ -65,7 -77,9 +77,9 @@@
else
{
GslLong noffset = voffset - lhandle->loop_start;
-
++
noffset %= lhandle->loop_width;
-
++
return gsl_data_handle_read (lhandle->src_handle,
lhandle->loop_start + noffset,
MIN (lhandle->loop_width - noffset, n_values),
@@@ -93,9 -110,11 +110,11 @@@ gsl_data_handle_new_looped_reference (G
};
LoopHandleReference *lhandle;
gboolean success;
-
++
g_return_val_if_fail (src_handle != NULL, NULL);
g_return_val_if_fail (loop_first >= 0, NULL);
g_return_val_if_fail (loop_last >= loop_first, NULL);
-
++
lhandle = sfi_new_struct0 (LoopHandleReference, 1);
success = gsl_data_handle_common_init (&lhandle->dhandle, NULL);
if (success)
diff --cc bse/tests/resamplehandle.cc
index d75474c,2071690..00ec5ef
--- a/bse/tests/resamplehandle.cc
+++ b/bse/tests/resamplehandle.cc
@@@ -44,7 -48,9 +46,9 @@@ check (const char *up_down
char *samplestr = g_strdup_printf ("ResampleHandle-%s%02d%s", up_down, bits, channels);
char *streamstr = g_strdup_printf ("CPU Resampling %s%02d%s", up_down, bits, channels);
TSTART ("%s (%s)", samplestr, cpu_type);
+
TASSERT (input.size() % n_channels == 0);
-
++
GslDataHandle *ihandle = gsl_data_handle_new_mem (n_channels, 32, 44100, 440, input.size(), &input[0],
NULL);
GslDataHandle *rhandle;
if (resampler_mode == BSE_RESAMPLER2_MODE_UPSAMPLE)
@@@ -84,12 -93,13 +91,13 @@@
worst_diff = max (fabs (resampled - expected[i]), worst_diff);
}
worst_diff_db = bse_db_from_factor (worst_diff, -200);
- TPRINT ("linear(%dst read) read worst_diff = %f (%f dB)\n", repeat, worst_diff, worst_diff_db);
+ TOUT ("linear(%dst read) read worst_diff = %f (%f dB)\n", repeat, worst_diff, worst_diff_db);
TASSERT (worst_diff_db < max_db);
}
+
/* test seeking */
worst_diff = 0.0;
- const uint count = sfi_init_settings().test_slow ? 300 : 100;
+ const uint count = Rapicorn::Test::slow() ? 300 : 100;
for (uint j = 0; j < count; j++)
{
int64 start = rand() % rhandle->setup.n_values;
@@@ -102,16 -113,19 +111,19 @@@
}
}
worst_diff_db = bse_db_from_factor (worst_diff, -200);
- TPRINT ("seek worst_diff = %f (%f dB)\n", worst_diff, worst_diff_db);
+ TOUT ("seek worst_diff = %f (%f dB)\n", worst_diff, worst_diff_db);
TASSERT (worst_diff_db < max_db);
+
TDONE();
+
/* test speed */
double samples_per_second = 0;
- if (sfi_init_settings().test_perf)
+ if (Rapicorn::Test::slow())
{
const guint RUNS = 10;
GTimer *timer = g_timer_new();
const guint dups = TEST_CALIBRATION (50.0, read_through (rhandle));
-
++
double m = 9e300;
for (guint i = 0; i < RUNS; i++)
{
@@@ -124,18 -138,22 +136,22 @@@
m = e;
}
samples_per_second = input.size() / (m / dups);
- treport_maximized (samplestr, samples_per_second, TUNIT (SAMPLE, SECOND));
- treport_maximized (streamstr, samples_per_second / 44100.0, TUNIT_STREAM);
- //TPRINT (" samples / second = %f\n", samples_per_second);
- //TPRINT (" which means the resampler can process %.2f 44100 Hz streams simultaneusly\n",
samples_per_second / 44100.0);
- //TPRINT (" or one 44100 Hz stream takes %f %% CPU usage\n", 100.0 / (samples_per_second / 44100.0));
+ TMSG (" %-28s : %+.14f samples/second", samplestr, samples_per_second);
+ TMSG (" %-28s : %+.14f streams", streamstr, samples_per_second / 44100.0);
+ //TOUT (" samples / second = %f\n", samples_per_second);
+ //TOUT (" which means the resampler can process %.2f 44100 Hz streams simultaneusly\n",
samples_per_second / 44100.0);
+ //TOUT (" or one 44100 Hz stream takes %f %% CPU usage\n", 100.0 / (samples_per_second / 44100.0));
}
+
gsl_data_handle_close (rhandle);
gsl_data_handle_unref (rhandle);
+
g_free (samplestr);
g_free (streamstr);
+
return samples_per_second / 44100.0;
}
+
template<typename Sample> static void
generate_test_signal (vector<Sample> &signal,
const size_t signal_length,
@@@ -195,8 -219,9 +213,9 @@@ run_tests (const char *run_type
const int LEN = 44100 / 2; /* 500ms test signal */
vector<float> input;
vector<double> expected;
+
// mono upsampling test
- if (!sfi_init_settings().test_quick)
+ if (Rapicorn::Test::slow())
{
generate_test_signal (input, LEN, 44100, 440);
generate_test_signal (expected, LEN * 2, 88200, 440);
@@@ -205,6 -230,7 +224,7 @@@
params[p].bits, params[p].mono_upsample_db);
// g_printerr (" ===> speed is equivalent to %.2f simultaneous 44100 Hz streams\n", streams);
}
-
++
// stereo upsampling test
if (1)
{
@@@ -215,8 -241,9 +235,9 @@@
params[p].bits, params[p].stereo_upsample_db);
// g_printerr (" ===> speed is equivalent to %.2f simultaneous 44100 Hz streams\n", streams);
}
-
++
// mono downsampling test
- if (!sfi_init_settings().test_quick)
+ if (Rapicorn::Test::slow())
{
generate_test_signal (input, LEN, 44100, 440);
generate_test_signal (expected, LEN / 2, 22050, 440);
@@@ -225,6 -252,7 +246,7 @@@
params[p].bits, params[p].mono_downsample_db);
// g_printerr (" ===> speed is equivalent to %.2f simultaneous 44100 Hz streams\n", streams);
}
-
++
// stereo downsampling test
if (1)
{
@@@ -321,10 -365,12 +355,12 @@@ test_delay_compensation (const char *ru
error = MAX (error, fabs (out[j] - in[i]));
i += iinc; j += jinc;
}
+
delete resampler;
+
/* check error against bound */
double error_db = bse_db_from_factor (error, -250);
- TPRINT ("Resampler Delay Compensation delta: %f\n", error_db);
+ TOUT ("Resampler Delay Compensation delta: %f\n", error_db);
TASSERT (error_db < -params[p].error_db);
}
TDONE();
diff --cc bse/tests/testcxx.cc
index a42f11b,c46698d..da6e41c
--- a/bse/tests/testcxx.cc
+++ b/bse/tests/testcxx.cc
@@@ -22,12 -27,14 +27,14 @@@ main (int argc
char *argv[])
{
g_thread_init (NULL);
- bse_init_test (&argc, &argv, NULL);
+ bse_init_test (&argc, argv);
std::set_terminate (__gnu_cxx::__verbose_terminate_handler);
// g_log_set_always_fatal ((GLogLevelFlags) (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL | (int)
g_log_set_always_fatal ((GLogLevelFlags) G_LOG_FATAL_MASK)));
+
/* work around known C++ binding bugs (critical warnings from GClosure) */
unsigned int flags = g_log_set_always_fatal ((GLogLevelFlags) G_LOG_FATAL_MASK);
g_log_set_always_fatal ((GLogLevelFlags) (flags & ~(G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING)));
-
++
// test closure Arg types
Arg<FooTest*> a1;
a1.token();
@@@ -47,5 -56,6 +56,6 @@@
Foo f;
b->connect ("notify", Closure (&f, &Foo::bar));
b->connect ("notify", Closure (&f, &Foo::baz));
-
++
return 0;
}
diff --cc bse/tests/testfft.cc
index d35b768,391c7e2..b822a58
--- a/bse/tests/testfft.cc
+++ b/bse/tests/testfft.cc
@@@ -61,7 -71,9 +65,9 @@@ main (int argc
for (i = 8; i <= MAX_FFT_SIZE >> 1; i <<= 1)
{
double d;
-
++
TSTART ("Testing fft code for size %u", i);
+
/* setup reference and work fft records */
fill_rand (i << 1, ref_fft_in);
// memset (ref_fft_aout, 0, MAX_FFT_SIZE * sizeof (ref_fft_aout[0]));
@@@ -231,14 -268,16 +244,16 @@@ diff (guint m
max = MAX (max, a);
min = MIN (min, a);
}
- TPRINT ("Diff sum: %.9f, ", d);
- TPRINT ("min/av/max: %.9f %.9f %.9f, ", min, d / (double) m, max);
- TPRINT ("noise: %u %u %u\n",
- g_bit_storage (1. / min),
- g_bit_storage (m / d),
- g_bit_storage (1. / max));
+ TMSG ("Diff sum: %.9f, ", d);
+ TMSG ("min/av/max: %.9f %.9f %.9f, ", min, d / (double) m, max);
+ TMSG ("noise: %u %u %u\n",
+ g_bit_storage (1. / min),
+ g_bit_storage (m / d),
+ g_bit_storage (1. / max));
return d;
}
+
+
/* --- fft implementation --- */
#define BUTTERFLY_XY(X1re,X1im,X2re,X2im,Y1re,Y1im,Y2re,Y2im,Wre,Wim) { \
register double T1re, T1im, T2re, T2im; \
@@@ -311,6 -351,7 +327,7 @@@ reference_bitreverse_fft2analysis (cons
{
const unsigned int n2 = n >> 1, n1 = n + n2, max = n >> 2;
unsigned int i, r;
-
++
BUTTERFLY_10 (X[0], X[1],
X[n], X[n + 1],
Y[0], Y[1],
@@@ -414,8 -463,10 +439,10 @@@ reference_power2_fftc (unsigned int n_
reference_bitreverse_fft2synthesis (n_values, rivalues_in, rivalues);
theta *= (double) 1.0 / 2.;
last_sin = sin (theta);
+
if (n_values < 4)
return;
-
++
do
{
double Dre, Dim, Wre, Wim;
@@@ -425,6 -477,7 +453,7 @@@
Dim = last_sin;
last_sin = sin (theta);
Dre = last_sin * last_sin * -2.;
-
++
/* loop over first coefficient in each block ==> w == {1,0} */
for (i = 0; i < n_values2; i += block_size2)
{
@@@ -444,6 -498,7 +474,7 @@@
for (i = k; i < n_values2; i += block_size2)
{
unsigned int v1 = i, v2 = i + block_size;
-
++
BUTTERFLY_XY (rivalues[v1], rivalues[v1 + 1],
rivalues[v2], rivalues[v2 + 1],
rivalues[v1], rivalues[v1 + 1],
@@@ -460,6 -515,7 +491,7 @@@
for (i = k; i < n_values2; i += block_size2)
{
unsigned int v1 = i, v2 = i + block_size;
-
++
BUTTERFLY_01 (rivalues[v1], rivalues[v1 + 1],
rivalues[v2], rivalues[v2 + 1],
rivalues[v1], rivalues[v1 + 1],
@@@ -470,6 -526,7 +502,7 @@@
for (i = k; i < n_values2; i += block_size2)
{
unsigned int v1 = i, v2 = i + block_size;
-
++
BUTTERFLY_0m (rivalues[v1], rivalues[v1 + 1],
rivalues[v2], rivalues[v2 + 1],
rivalues[v1], rivalues[v1 + 1],
diff --cc drivers/bse-portaudio/bsepcmdevice-portaudio.cc
index fced88c,587bccf..0e6e7d2
--- a/drivers/bse-portaudio/bsepcmdevice-portaudio.cc
+++ b/drivers/bse-portaudio/bsepcmdevice-portaudio.cc
@@@ -84,6 -93,7 +89,7 @@@ static std::strin
port_audio_host_api_name (PaHostApiIndex host_api_index)
{
const PaHostApiInfo *host_api_info = Pa_GetHostApiInfo (host_api_index);
-
++
switch (host_api_info->type)
{
case paOSS: return "oss";
@@@ -91,6 -101,7 +97,7 @@@
case paALSA: return "alsa";
default: ;
}
-
++
char *api_str = g_strdup_printf ("pa%02d", host_api_info->type);
string name = api_str;
g_free (api_str);
@@@ -105,10 -117,12 +113,12 @@@ static vector<string
port_audio_devices()
{
vector<string> devices (Pa_GetDeviceCount());
-
++
for (PaHostApiIndex host_api_index = 0; host_api_index < Pa_GetHostApiCount(); host_api_index++)
{
int host_api_device_index = 0; /* host api specific index */
string host_api_name = port_audio_host_api_name (host_api_index);
-
++
for (PaDeviceIndex device_index = 0; device_index < Pa_GetDeviceCount(); device_index++)
{
const PaDeviceInfo *device_info = Pa_GetDeviceInfo (device_index);
@@@ -120,19 -134,24 +130,24 @@@
}
}
}
-
++
return devices;
}
+
static SfiRing*
bse_pcm_device_port_audio_list_devices (BseDevice *device)
{
vector<string> devices = port_audio_devices();
SfiRing *ring = NULL;
-
++
int default_device_index = Pa_GetDefaultOutputDevice();
-
++
for (PaDeviceIndex device_index = 0; device_index < Pa_GetDeviceCount(); device_index++)
{
const PaDeviceInfo *device_info = Pa_GetDeviceInfo (device_index);
const PaHostApiInfo *host_api_info = Pa_GetHostApiInfo (device_info->hostApi);
char *device_args = g_strdup (devices[device_index].c_str());
-
++
BseDeviceEntry *entry = bse_device_group_entry_new (device, device_args,
g_strdup (host_api_info->name),
g_strdup_printf ("%-10s%s%s", device_args,
device_info->name,
@@@ -153,6 -173,7 +169,7 @@@ bse_pcm_device_port_audio_open (BseDevi
PortAudioPcmHandle *portaudio = g_new0 (PortAudioPcmHandle, 1);
BsePcmHandle *handle = &portaudio->handle;
BsePcmDevice *pdev = BSE_PCM_DEVICE (device);
-
++
handle->readable = require_readable;
handle->writable = require_writable;
handle->n_channels = 2; /* TODO: mono */
@@@ -175,7 -196,9 +192,9 @@@
handle->writable = TRUE;
}
}
-
++
BseErrorType error = BSE_ERROR_NONE;
+
PaStreamParameters inputParameters = { 0, };
inputParameters.device = Pa_GetDefaultInputDevice();
PaStreamParameters outputParameters = { 0, };
@@@ -226,6 -249,7 +245,7 @@@
portaudio->stream = NULL;
}
}
-
++
if (!error)
{
bse_device_set_opened (device, device_name.c_str(), handle->readable, handle->writable);
@@@ -274,6 -303,7 +296,7 @@@ port_audio_device_retrigger (PortAudioP
/* silence fill output, to resynchronize output and input streams to the desired latency */
guint write_frames_avail = Pa_GetStreamWriteAvailable (portaudio->stream);
float *silence = (float*) g_malloc0 (portaudio->handle.block_length * sizeof (float) *
portaudio->handle.n_channels);
-
++
while (write_frames_avail >= portaudio->handle.block_length)
{
Pa_WriteStream (portaudio->stream, silence, portaudio->handle.block_length);
@@@ -289,6 -320,7 +313,7 @@@ port_audio_device_check_io (BsePcmHandl
guint read_frames_avail = handle->readable ? Pa_GetStreamReadAvailable (portaudio->stream) : 0;
guint write_frames_avail = handle->writable ? Pa_GetStreamWriteAvailable (portaudio->stream) : 0;
guint n_frames_avail = handle->readable ? read_frames_avail : write_frames_avail;
-
++
if (handle->readable && handle->writable && write_frames_avail >= (2 * handle->block_length) &&
read_frames_avail == 0)
{
/* underrun occured (or stream just initialized) */
@@@ -297,15 -329,19 +322,19 @@@
/* check whether data can be processed */
if (n_frames_avail >= handle->block_length)
return TRUE; /* need processing */
-
++
/* calculate timeout until processing is possible or needed */
guint diff_frames = handle->block_length - n_frames_avail;
*timeoutp = diff_frames * 1000 / handle->mix_freq;
-
++
return FALSE;
}
+
static guint
port_audio_device_latency (BsePcmHandle *handle)
{
PortAudioPcmHandle *portaudio = (PortAudioPcmHandle*) handle;
-
++
/* return total latency in frames */
/* -> this is probably an estimate, as I don't think the PortAudio API exports a precise value at any
place */
return guint (max (Pa_GetStreamInfo (portaudio->stream)->inputLatency, Pa_GetStreamInfo
(portaudio->stream)->outputLatency) * handle->mix_freq);
@@@ -334,8 -375,11 +368,11 @@@ bse_pcm_device_port_audio_class_init (B
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
BseDeviceClass *device_class = BSE_DEVICE_CLASS (klass);
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->finalize = bse_pcm_device_port_audio_finalize;
-
++
device_class->list_devices = bse_pcm_device_port_audio_list_devices;
const gchar *name = "portaudio";
const gchar *syntax = _("DEVICE,MODE");
diff --cc drivers/bsemididevice-alsa.cc
index 82e3f54,23adfb6..81839fa
--- a/drivers/bsemididevice-alsa.cc
+++ b/drivers/bsemididevice-alsa.cc
@@@ -94,6 -51,7 +94,7 @@@ bse_midi_device_alsa_list_devices (BseD
snd_ctl_card_info_t *cinfo = alsa_alloca0 (snd_ctl_card_info);
snd_rawmidi_info_t *winfo = alsa_alloca0 (snd_rawmidi_info);
snd_rawmidi_info_t *rinfo = alsa_alloca0 (snd_rawmidi_info);
-
++
int cindex = -1;
snd_card_next (&cindex);
while (cindex >= 0)
@@@ -109,7 -67,9 +110,9 @@@
snd_ctl_close (chandle);
continue;
}
-
++
gchar *device_group = g_strdup_printf ("%s - %s", snd_ctl_card_info_get_id (cinfo),
snd_ctl_card_info_get_longname (cinfo));
-
++
int pindex = -1;
snd_ctl_rawmidi_next_device (chandle, &pindex);
while (pindex >= 0)
@@@ -307,8 -280,11 +319,11 @@@ bse_midi_device_alsa_class_init (BseMid
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
BseDeviceClass *device_class = BSE_DEVICE_CLASS (klass);
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->finalize = bse_midi_device_alsa_finalize;
-
++
device_class->list_devices = bse_midi_device_alsa_list_devices;
const gchar *name = "alsa";
const gchar *syntax = _("PLUGIN:CARD,DEV,SUBDEV");
diff --cc drivers/bsepcmdevice-alsa.cc
index a8f2a90,4e2cc04..e49935c
--- a/drivers/bsepcmdevice-alsa.cc
+++ b/drivers/bsepcmdevice-alsa.cc
@@@ -115,6 -76,7 +118,7 @@@ bse_pcm_device_alsa_list_devices (BseDe
snd_ctl_card_info_t *cinfo = alsa_alloca0 (snd_ctl_card_info);
snd_pcm_info_t *pinfo = alsa_alloca0 (snd_pcm_info);
snd_pcm_info_t *rinfo = alsa_alloca0 (snd_pcm_info);
-
++
int cindex = -1;
snd_card_next (&cindex);
while (cindex >= 0)
@@@ -130,7 -92,9 +134,9 @@@
snd_ctl_close (chandle);
continue;
}
-
++
gchar *device_group = g_strdup_printf ("%s - %s", snd_ctl_card_info_get_id (cinfo),
snd_ctl_card_info_get_longname (cinfo));
-
++
int pindex = -1;
snd_ctl_pcm_next_device (chandle, &pindex);
while (pindex >= 0)
@@@ -239,6 -205,7 +247,7 @@@ bse_pcm_device_alsa_open (BseDevic
error = BSE_ERROR_DEVICES_MISMATCH;
if (!error && snd_pcm_prepare (alsa->read_handle ? alsa->read_handle : alsa->write_handle) < 0)
error = BSE_ERROR_FILE_OPEN_FAILED;
-
++
/* setup PCM handle or shutdown */
if (!error)
{
@@@ -261,15 -228,18 +270,18 @@@
g_free (alsa->period_buffer);
g_free (alsa);
}
- DEBUG ("ALSA: opening PCM \"%s\" readable=%d writable=%d: %s", dname, require_readable, require_writable,
bse_error_blurb (error));
+ PDEBUG ("ALSA: opening PCM \"%s\" readable=%d writable=%d: %s", dname, require_readable,
require_writable, bse_error_blurb (error));
g_free (dname);
-
++
return error;
}
+
static void
bse_pcm_device_alsa_close (BseDevice *device)
{
AlsaPcmHandle *alsa = (AlsaPcmHandle*) BSE_PCM_DEVICE (device)->handle;
BSE_PCM_DEVICE (device)->handle = NULL;
-
++
if (alsa->read_handle)
{
snd_pcm_drop (alsa->read_handle);
@@@ -406,6 -385,7 +422,7 @@@ alsa_device_check_io (BsePcmHandle *han
glong *timeoutp)
{
AlsaPcmHandle *alsa = (AlsaPcmHandle*) handle;
-
++
if (0)
{
snd_pcm_state_t ws = SND_PCM_STATE_DISCONNECTED, rs = SND_PCM_STATE_DISCONNECTED;
@@@ -428,6 -408,7 +445,7 @@@
handle->block_length,
rn >= handle->block_length ? "TRUE" : "FALSE");
}
-
++
/* quick check for data availability */
gint n_frames_avail = snd_pcm_avail_update (alsa->read_handle ? alsa->read_handle : alsa->write_handle);
if (n_frames_avail < 0 || /* error condition, probably an underrun (-EPIPE) */
@@@ -441,14 -422,18 +459,18 @@@
n_frames_avail = snd_pcm_avail_update (alsa->read_handle ? alsa->read_handle : alsa->write_handle);
n_frames_avail = MAX (n_frames_avail, 0);
}
-
++
/* check whether data can be processed */
if (n_frames_avail >= ssize_t (handle->block_length))
return TRUE; /* need processing */
-
++
/* calculate timeout until processing is possible or needed */
guint diff_frames = handle->block_length - n_frames_avail;
*timeoutp = diff_frames * 1000 / handle->mix_freq;
-
++
return FALSE;
}
+
static guint
alsa_device_latency (BsePcmHandle *handle)
{
@@@ -471,6 -457,7 +494,7 @@@ alsa_device_read (BsePcmHandle *handle
gfloat *dest = values;
gsize n_left = handle->block_length;
const gsize n_values = n_left * handle->n_channels;
-
++
alsa->read_write_count += 1;
do
{
@@@ -494,8 -481,10 +518,10 @@@
n_left -= n_frames;
}
while (n_left);
-
++
return n_values;
}
+
static void
alsa_device_write (BsePcmHandle *handle,
const gfloat *values)
@@@ -504,6 -493,7 +530,7 @@@
gpointer buf = alsa->period_buffer; /* size in bytes = n_values * 2 */
const gfloat *floats = values;
gsize n_left = handle->block_length;
-
++
if (alsa->read_handle && alsa->read_write_count < 1)
{
snd_lib_error_set_handler (silent_error_handler); /* silence libALSA about -EPIPE */
@@@ -511,6 -501,7 +538,7 @@@
alsa->read_write_count += 1;
snd_lib_error_set_handler (NULL);
}
-
++
alsa->read_write_count -= 1;
do
{
@@@ -542,8 -534,11 +571,11 @@@ bse_pcm_device_alsa_class_init (BsePcmD
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
BseDeviceClass *device_class = BSE_DEVICE_CLASS (klass);
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->finalize = bse_pcm_device_alsa_finalize;
-
++
device_class->list_devices = bse_pcm_device_alsa_list_devices;
const gchar *name = "alsa";
const gchar *syntax = _("PLUGIN:CARD,DEV,SUBDEV");
diff --cc plugins/artscompressor.cc
index 3295175,f586bd8..f0289f3
--- a/plugins/artscompressor.cc
+++ b/plugins/artscompressor.cc
@@@ -37,6 -42,7 +42,7 @@@ class Compressor : public CompressorBas
threshold = comp_db2linear (threshold_db);
ratio = 1 / params->ratio_to_one;
output = comp_db2linear (params->output_db);
-
++
/* compute half-life times: using max ensures that computing the attack- and releasefactor will
* (a) not result in division by zero
* (b) result in a value <= 1.0, where 1.0 means: adapt volume immediately, without half-life time
@@@ -79,6 -88,7 +88,7 @@@
const float *invalue2 = istream (ICHANNEL_AUDIO_IN2).values;
float *outvalue1 = ostream (OCHANNEL_AUDIO_OUT1).values;
float *outvalue2 = ostream (OCHANNEL_AUDIO_OUT2).values;
-
++
for( unsigned int i = 0; i < samples; i++ ) {
double delta = 0.0;
switch (channels)
@@@ -96,6 -107,7 +107,7 @@@
volume += attackfactor * delta;
else
volume += releasefactor * delta;
-
++
if (volume > threshold)
{
if (channels & CHANNEL_A1)
diff --cc plugins/artscompressor.idl
index dd71431,c3d20fd..3228676
--- a/plugins/artscompressor.idl
+++ b/plugins/artscompressor.idl
@@@ -40,11 -43,13 +40,13 @@@ interface Compressor : Effect
Bool auto_output = Bool (_("Auto Output"), _("Adjust the output amplification automatically according
to threshold and ratio"), FALSE, GUI);
};
group "compat" { /* compatibility properties */
- Real threshold = Real (NULL, NULL, 1, 0.00001, 1, 0.01, "w");
- Real ratio = Real (NULL, NULL, 0.8, 0.0, 1.0, 0.1, "w");
- Real output = Real (NULL, NULL, 1, 0.1, 10.0, 1, "w");
+ Real threshold = SfiReal ("", "", 1, 0.00001, 1, 0.01, "w");
+ Real ratio = SfiReal ("", "", 0.8, 0.0, 1.0, 0.1, "w");
+ Real output = SfiReal ("", "", 1, 0.1, 10.0, 1, "w");
};
};
+
}; // Arts
}; // Bse
+
/* vim:set ts=8 sw=2 sts=2 syntax=cpp: */
diff --cc plugins/bseadder.cc
index 6b39525,4da2766..310e7fc
--- a/plugins/bseadder.cc
+++ b/plugins/bseadder.cc
@@@ -43,12 -54,18 +54,18 @@@ bse_adder_class_init (BseAdderClass *kl
BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
guint channel;
+
parent_class = g_type_class_peek (BSE_TYPE_SOURCE);
-
++
gobject_class->set_property = bse_adder_set_property;
gobject_class->get_property = bse_adder_get_property;
-
++
object_class->get_icon = bse_adder_do_get_icon;
-
++
source_class->context_create = bse_adder_context_create;
-
++
klass->sub_icon = bse_icon_from_pixstream (sub_pixstream);
-
++
bse_object_class_add_param (object_class, "Features",
PARAM_SUBTRACT,
sfi_pspec_bool ("subtract", "Subtract instead",
@@@ -56,6 -73,7 +73,7 @@@
"values (instead of addition)",
FALSE,
SFI_PARAM_STANDARD ":skip-default"));
-
++
channel = bse_source_class_add_jchannel (source_class, "audio-in1", _("Audio In1"), _("Audio Input 1"));
g_assert (channel == BSE_ADDER_JCHANNEL_AUDIO1);
channel = bse_source_class_add_jchannel (source_class, "audio-in2", _("Audio In2"), _("Audio Input 2"));
@@@ -72,6 -92,7 +92,7 @@@ static BseIcon
bse_adder_do_get_icon (BseObject *object)
{
BseAdder *self = BSE_ADDER (object);
-
++
if (self->subtract)
return BSE_ADDER_GET_CLASS (self)->sub_icon;
else /* chain parent class' handler */
diff --cc plugins/bseamplifier.idl
index 608ee4d,65ae8a2..246ceb4
--- a/plugins/bseamplifier.idl
+++ b/plugins/bseamplifier.idl
@@@ -51,12 -51,13 +51,13 @@@ interface Amplifier : Effect
Real master_volume = DBVolume (_("Master Volume"), _("Output stage amplification in decibel"), 0,
MINDB, +24, STANDARD);
};
group "compat" {
- Real audio_balance = Balance (NULL, NULL, 0, "w"); /* -> abalance (v0.5.4) */
- Real ctrl_balance = Balance (NULL, NULL, 0, "w"); /* -> cbalance (v0.5.4) */
- Real ctrl_strength_f = Real (NULL, NULL, 1, 0, 1, 0.1, "w"); /* *100 -> ostrength (v0.5.4) */
- Real master_gain_f = Real (NULL, NULL, 1, 0, 1, 0.1, "w"); /* *100 -> olevel (v0.5.4) */
- Real audio_gain_f = Real (NULL, NULL, 0, 0, 1, 0.1, "w"); /* *100 -> base_level (v0.5.4) */
- Real olevel = Perc (NULL, NULL, 100, "w"); /* -> master_volume (v0.6.2) */
+ Real audio_balance = Balance ("", "", 0, "w"); /* -> abalance (v0.5.4) */
+ Real ctrl_balance = Balance ("", "", 0, "w"); /* -> cbalance (v0.5.4) */
+ Real ctrl_strength_f = SfiReal ("", "", 1, 0, 1, 0.1, "w"); /* *100 -> ostrength (v0.5.4) */
+ Real master_gain_f = SfiReal ("", "", 1, 0, 1, 0.1, "w"); /* *100 -> olevel (v0.5.4) */
+ Real audio_gain_f = SfiReal ("", "", 0, 0, 1, 0.1, "w"); /* *100 -> base_level (v0.5.4) */
+ Real olevel = Perc ("", "", 100, "w"); /* -> master_volume (v0.6.2) */
};
};
+
};
diff --cc plugins/bseatandistort.cc
index 17ede85,fbf0e84..85d001d
--- a/plugins/bseatandistort.cc
+++ b/plugins/bseatandistort.cc
@@@ -41,10 -50,14 +50,14 @@@ bse_atan_distort_class_init (BseAtanDis
BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
guint channel_id;
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = bse_atan_distort_set_property;
gobject_class->get_property = bse_atan_distort_get_property;
-
++
source_class->context_create = bse_atan_distort_context_create;
-
++
bse_object_class_add_param (object_class, "Adjustments",
PARAM_BOOST_AMOUNT,
sfi_pspec_real ("boost_amount", "Boost Amount [%]",
@@@ -52,6 -65,7 +65,7 @@@
"from maximum attenuation (0%) to maximum boost (100%).",
50, 0, 100.0, 5,
SFI_PARAM_STANDARD ":f:scale"));
-
++
channel_id = bse_source_class_add_ichannel (source_class, "audio-in", _("Audio In"), _("Audio Input
Signal"));
g_assert (channel_id == BSE_ATAN_DISTORT_ICHANNEL_MONO1);
channel_id = bse_source_class_add_ochannel (source_class, "audio-out", _("Audio Out"), _("Distorted Audio
Output"));
@@@ -70,6 -86,7 +86,7 @@@ bse_atan_distort_set_property (GObjec
GParamSpec *pspec)
{
BseAtanDistort *self = BSE_ATAN_DISTORT (object);
-
++
switch (param_id)
{
case PARAM_BOOST_AMOUNT:
@@@ -89,6 -107,7 +107,7 @@@ bse_atan_distort_get_property (GObjec
GParamSpec *pspec)
{
BseAtanDistort *self = BSE_ATAN_DISTORT (object);
-
++
switch (param_id)
{
case PARAM_BOOST_AMOUNT:
@@@ -136,6 -158,7 +158,7 @@@ atan_distort_process (BseModule *module
gfloat *sig_out = module->ostreams[BSE_ATAN_DISTORT_OCHANNEL_MONO1].values;
gfloat *bound = sig_out + n_values;
gdouble prescale = admod->prescale;
-
++
/* we don't need to process any data if our input or
* output stream isn't connected
*/
@@@ -148,6 -171,7 +171,7 @@@
module->ostreams[BSE_ATAN_DISTORT_OCHANNEL_MONO1].values = bse_engine_const_values (0);
return;
}
-
++
/* do the mixing */
do
*sig_out++ = bse_approx_atan1 (prescale * *sig_in++);
@@@ -171,15 -196,19 +196,19 @@@ bse_atan_distort_context_create (BseSou
BseAtanDistort *self = BSE_ATAN_DISTORT (source);
AtanDistortModule *admod;
BseModule *module;
-
++
/* for each context that BseAtanDistort is used in, we create
* a BseModule with data portion AtanDistortModule, that runs
* in the synthesis engine.
*/
admod = g_new0 (AtanDistortModule, 1);
-
++
/* initial setup of module parameters */
admod->prescale = self->prescale;
-
++
/* create a BseModule with AtanDistortModule as user_data */
module = bse_module_new (&admod_class, admod);
-
++
/* the istreams and ostreams of our BseModule map 1:1 to
* BseAtanDistort's input/output channels, so we can call
* bse_source_set_context_module() which does all the internal
@@@ -187,8 -216,10 +216,10 @@@
* input/output channels of BseAtanDistort
*/
bse_source_set_context_module (source, context_handle, module);
-
++
/* commit module to engine */
bse_trans_add (trans, bse_job_integrate (module));
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_create (source, context_handle, trans);
}
diff --cc plugins/bsecontribsampleandhold.cc
index 8fc70fc,c682933..b9fa69f
--- a/plugins/bsecontribsampleandhold.cc
+++ b/plugins/bsecontribsampleandhold.cc
@@@ -6,17 -8,20 +8,20 @@@ class SampleAndHold: public SampleAndHo
class Module: public SynthesisModule {
gfloat value;
gboolean negative;
-
++
public:
void
config (SampleAndHoldProperties *params)
{
}
-
++
void
reset ()
{
value = 0;
negative = true;
}
-
++
void
process (unsigned int n_values)
{
@@@ -24,6 -29,7 +29,7 @@@
const float *trigger = istream (ICHANNEL_TRIGGER_IN).values;
float *output = ostream (OCHANNEL_AUDIO_OUT).values;
float *bound = output + n_values;
-
++
while (output < bound)
{
float t = *trigger++;
@@@ -41,6 -47,7 +47,7 @@@
}
}
};
-
++
public:
BSE_EFFECT_INTEGRATE_MODULE (SampleAndHold, Module, SampleAndHoldProperties);
};
diff --cc plugins/bsefirfilter.c
index fedce8b,62b6a98..c9127a6
--- a/plugins/bsefirfilter.c
+++ b/plugins/bsefirfilter.c
@@@ -37,11 -44,13 +44,13 @@@ static GType type_id_fir_filter = 0
static gpointer parent_class = NULL;
static const GTypeInfo type_info_fir_filter = {
sizeof (BseFIRFilterClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) bse_fir_filter_class_init,
(GClassFinalizeFunc) bse_fir_filter_class_finalize,
NULL /* class_data */,
-
++
sizeof (BseFIRFilter),
0 /* n_preallocs */,
(GInstanceInitFunc) bse_fir_filter_init,
@@@ -54,13 -65,18 +65,18 @@@ bse_fir_filter_class_init (BseFIRFilter
BseObjectClass *object_class = BSE_OBJECT_CLASS (class);
BseSourceClass *source_class = BSE_SOURCE_CLASS (class);
guint ochannel_id, ichannel_id;
-
++
parent_class = g_type_class_peek (BSE_TYPE_SOURCE);
-
++
gobject_class->set_property = bse_fir_filter_set_property;
gobject_class->get_property = bse_fir_filter_get_property;
+
object_class->destroy = bse_fir_filter_do_destroy;
-
++
source_class->prepare = bse_fir_filter_prepare;
source_class->calc_chunk = bse_fir_filter_calc_chunk;
source_class->reset = bse_fir_filter_reset;
-
++
bse_object_class_add_param (object_class, "Filter Type",
PARAM_ALLPASS,
sfi_pspec_bool ("allpass", "AllPass", NULL,
@@@ -106,6 -122,7 +122,7 @@@
bse_note_from_freq (BSE_KAMMER_FREQ / 2), 1,
TRUE,
BSE_PARAM_GUI));
-
++
ochannel_id = bse_source_class_add_ochannel (source_class, "mono_out", _("Mono Out"), _("Mono Filtered
Output"), 1);
g_assert (ochannel_id == BSE_FIR_FILTER_OCHANNEL_MONO);
ichannel_id = bse_source_class_add_ichannel (source_class, "mono_in", _("Mono In"), _("Mono Signal
Input"), 1, 1);
@@@ -133,7 -153,9 +153,9 @@@ static voi
bse_fir_filter_do_destroy (BseObject *object)
{
BseFIRFilter *fir_filter;
-
++
fir_filter = BSE_FIR_FILTER (object);
-
++
/* chain parent class' destroy handler */
BSE_OBJECT_CLASS (parent_class)->destroy (object);
}
@@@ -141,16 -164,19 +164,19 @@@ static inline voi
bse_fir_filter_update_locals (BseFIRFilter *filter)
{
gint i;
-
++
if (BSE_SOURCE_PREPARED (filter))
{
gdouble d, c;
gint z = filter->n_coeffs;
-
++
filter->n_coeffs = MIN (filter->degree, BSE_TRACK_LENGTH) * 2 + 1;
filter->history = g_renew (BseSampleValue, filter->history, filter->n_coeffs);
for (i = z; i < filter->n_coeffs; i++)
filter->history[i] = 0;
z = filter->n_coeffs / 2;
filter->history_pos %= filter->n_coeffs;
-
++
/* setup allpass
*/
g_free (filter->coeffs);
@@@ -158,6 -184,7 +184,7 @@@
for (i = 0; i < filter->n_coeffs; i++)
filter->coeffs[i] = 0;
filter->coeffs[z] = 1;
-
++
/* setup lowpass (precalculate highpass)
*/
if (filter->filter_type == BSE_FIR_FILTER_LOWPASS ||
@@@ -173,10 -200,12 +200,12 @@@
else
{
gdouble k = i - z;
-
++
filter->coeffs[i] = d * sin (c * k) / (c * k);
}
}
}
-
++
if (filter->lanczos_smoothing)
{
c = z;
@@@ -184,10 -213,12 +213,12 @@@
for (i = 0; i < filter->n_coeffs; i++)
{
gdouble k = (i - z);
-
++
if (k)
filter->coeffs[i] *= sin (c * k) / (c * k);
}
}
-
++
if (filter->hann_smoothing)
{
c = z;
@@@ -195,9 -226,11 +226,11 @@@
for (i = 0; i < filter->n_coeffs; i++)
{
gdouble k = (i - z);
-
++
filter->coeffs[i] *= 0.5 * (1.0 + cos (c * k));
}
}
-
++
/* setup highpass (from lowpass)
*/
if (filter->filter_type == BSE_FIR_FILTER_HIGHPASS)
@@@ -208,6 -241,7 +241,7 @@@
else
filter->coeffs[i] = - filter->coeffs[i];
}
-
++
#if 0
for (i = 0; i < filter->n_coeffs; i++)
g_print ("a[%d]=%f ", i - z, filter->coeffs[i]);
@@@ -222,6 -257,7 +257,7 @@@ bse_fir_filter_set_property (BseFIRFilt
GParamSpec *pspec)
{
BseFIRFilterType filter_type = BSE_FIR_FILTER_ALLPASS;
-
++
switch (param_id)
{
guint v_uint;
@@@ -314,7 -352,9 +352,9 @@@ bse_fir_filter_prepare (BseSource *sour
BseIndex index)
{
BseFIRFilter *filter = BSE_FIR_FILTER (source);
-
++
bse_fir_filter_update_locals (filter);
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->prepare (source, index);
}
@@@ -328,16 -369,22 +369,22 @@@ bse_fir_filter_calc_chunk (BseSource *s
BseSampleValue *hunk, *ihunk, *hvals;
gfloat *coeffs;
guint i, n_coeffs, history_pos;
-
++
g_return_val_if_fail (ochannel_id == BSE_FIR_FILTER_OCHANNEL_MONO, NULL);
-
++
input = bse_source_get_input (source, BSE_FIR_FILTER_ICHANNEL_MONO); /* mono */
if (!input) /* silence */
return bse_chunk_new_static_zero (1);
-
++
ichunk = bse_source_ref_chunk (input->osource, input->ochannel_id, source->index);
bse_chunk_complete_hunk (ichunk);
ihunk = ichunk->hunk;
-
++
if (filter->filter_type == BSE_FIR_FILTER_ALLPASS)
return ichunk;
-
++
hunk = bse_hunk_alloc (1);
-
++
n_coeffs = filter->n_coeffs;
coeffs = filter->coeffs;
history_pos = filter->history_pos;
@@@ -346,30 -393,37 +393,37 @@@
{
gfloat *a;
guint n;
-
++
a = coeffs;
hunk[i] = 0;
for (n = history_pos; n < n_coeffs; n++)
hunk[i] += (BseSampleValue) (*(a++) * hvals[n]);
for (n = 0; n < history_pos; n++)
hunk[i] += (BseSampleValue) (*(a++) * hvals[n]);
-
++
hvals[history_pos++] = ihunk[i];
if (history_pos >= n_coeffs)
history_pos -= n_coeffs;
}
filter->history_pos = history_pos;
-
++
bse_chunk_unref (ichunk);
-
++
return bse_chunk_new_orphan (1, hunk);
}
+
static void
bse_fir_filter_reset (BseSource *source)
{
BseFIRFilter *filter = BSE_FIR_FILTER (source);
-
++
filter->n_coeffs = 0;
g_free (filter->coeffs);
filter->coeffs = NULL;
filter->history_pos = 0;
g_free (filter->history);
filter->history = NULL;
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->reset (source);
}
diff --cc plugins/bseiirfilter.cc
index 885f5e4,7738d3d..d50203d
--- a/plugins/bseiirfilter.cc
+++ b/plugins/bseiirfilter.cc
@@@ -49,11 -59,15 +59,15 @@@ bse_iir_filter_class_init (BseIIRFilter
BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
guint ochannel_id, ichannel_id;
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = bse_iir_filter_set_property;
gobject_class->get_property = bse_iir_filter_get_property;
-
++
source_class->prepare = bse_iir_filter_prepare;
source_class->context_create = bse_iir_filter_context_create;
-
++
bse_object_class_add_param (object_class, _("Filter Choice"),
PARAM_FILTER_ALGO,
bse_param_spec_genum ("filter_algorithm", _("Filter Algorithm"), _("The filter
design type"),
@@@ -98,6 -112,7 +112,7 @@@
_("Filter cutoff frequency as note, converted to Hertz
according to the current musical tuning"),
bse_note_from_freq (BSE_MUSICAL_TUNING_12_TET,
BSE_KAMMER_FREQUENCY / 2 + FREQ_DELTA),
SFI_PARAM_GUI));
-
++
ichannel_id = bse_source_class_add_ichannel (source_class, "audio-in", _("Audio In"), _("Unfiltered
Input"));
g_assert (ichannel_id == BSE_IIR_FILTER_ICHANNEL_MONO);
ochannel_id = bse_source_class_add_ochannel (source_class, "audio-out", _("Audio Out"), _("Filtered
Output"));
@@@ -121,6 -138,7 +138,7 @@@ bse_iir_filter_set_property (GObject
GParamSpec *pspec)
{
BseIIRFilter *self = BSE_IIR_FILTER (object);
-
++
switch (param_id)
{
case PARAM_FILTER_ALGO:
@@@ -199,6 -218,7 +218,7 @@@ bse_iir_filter_get_property (GObject *o
GParamSpec *pspec)
{
BseIIRFilter *self = BSE_IIR_FILTER (object);
-
++
switch (param_id)
{
case PARAM_FILTER_ALGO:
@@@ -234,8 -255,10 +255,10 @@@ static voi
bse_iir_filter_prepare (BseSource *source)
{
BseIIRFilter *filt = BSE_IIR_FILTER (source);
-
++
/* need to call update_modules() because we only now have bse_engine_sample_freq() */
bse_iir_filter_update_modules (filt);
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->prepare (source);
}
@@@ -257,6 -284,7 +284,7 @@@ iir_filter_access (BseModule *module
static void
bse_iir_filter_update_modules (BseIIRFilter *filt)
{
-
++
if (BSE_SOURCE_PREPARED (filt))
{
FilterModule *fmod = g_new0 (FilterModule, 1);
@@@ -264,8 -292,10 +292,10 @@@
gfloat freq1 = MIN (filt->cut_off_freq1, 0.5 * bse_engine_sample_freq ());
gfloat freq2 = MIN (filt->cut_off_freq2, 0.5 * bse_engine_sample_freq ());
gfloat steepness = 1.1;
-
++
freq1 *= nyquist_fact;
freq2 *= nyquist_fact;
-
++
switch (filt->filter_algo << 16 | filt->filter_type)
{
case BSE_IIR_FILTER_BUTTERWORTH << 16 | BSE_IIR_FILTER_LOW_PASS:
@@@ -307,14 -337,17 +337,17 @@@
default:
g_assert_not_reached ();
}
-
++
fmod->iir.order = filt->order;
fmod->iir.a = fmod->dummy;
fmod->iir.b = fmod->iir.a + filt->order + 1;
memcpy (fmod->iir.a, filt->a, sizeof (filt->a[0]) * (filt->order + 1));
memcpy (fmod->iir.b, filt->b, sizeof (filt->b[0]) * (filt->order + 1));
-
++
/* abusing f->w as simple flag for algo_type_change */
fmod->iir.w = filt->algo_type_change ? fmod->dummy : NULL;
filt->algo_type_change = FALSE;
-
++
bse_source_access_modules (BSE_SOURCE (filt),
iir_filter_access, fmod, g_free,
NULL);
@@@ -327,8 -361,10 +361,10 @@@ iir_filter_process (BseModule *module
FilterModule *fmod = (FilterModule*) module->user_data;
const gfloat *sig_in = BSE_MODULE_IBUFFER (module, BSE_IIR_FILTER_ICHANNEL_MONO);
gfloat *sig_out = BSE_MODULE_OBUFFER (module, BSE_IIR_FILTER_OCHANNEL_MONO);
-
++
gsl_iir_filter_eval (&fmod->iir, n_values, sig_in, sig_out);
}
+
static void
bse_iir_filter_context_create (BseSource *source,
guint context_handle,
@@@ -347,12 -383,17 +383,17 @@@
BseIIRFilter *filt = BSE_IIR_FILTER (source);
FilterModule *fmod = g_new0 (FilterModule, 1);
BseModule *module;
-
++
gsl_iir_filter_setup (&fmod->iir, filt->order, filt->a, filt->b, fmod->dummy);
-
++
module = bse_module_new (&iir_filter_class, fmod);
-
++
/* setup module i/o streams with BseSource i/o channels */
bse_source_set_context_module (source, context_handle, module);
-
++
/* commit module to engine */
bse_trans_add (trans, bse_job_integrate (module));
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_create (source, context_handle, trans);
}
diff --cc plugins/bsemixer.cc
index 78a06e7,6c02171..3229377
--- a/plugins/bsemixer.cc
+++ b/plugins/bsemixer.cc
@@@ -49,10 -61,14 +61,14 @@@ bse_mixer_class_init (BseMixerClass *kl
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
guint ichannel, ochannel;
guint i;
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = bse_mixer_set_property;
gobject_class->get_property = bse_mixer_get_property;
-
++
source_class->context_create = bse_mixer_context_create;
-
++
bse_object_class_add_param (object_class, "Adjustments",
PROP_MVOLUME_f,
sfi_pspec_real ("master_volume_f", "Master [float]", NULL,
@@@ -77,6 -93,7 +93,7 @@@
for (i = 1; i <= BSE_MIXER_N_INPUTS; i++)
{
gchar *group, *ident, *label, *blurb;
-
++
group = g_strdup_printf (_("Channel%u"), i);
ident = g_strdup_printf ("volume_f%u", i);
label = g_strdup_printf (_("Channel%u [float]"), i);
@@@ -124,6 -142,7 +142,7 @@@ static voi
bse_mixer_init (BseMixer *self)
{
guint i;
-
++
self->master_volume_factor = bse_db_to_factor (DEFAULT_DB_VOLUME);
for (i = 0; i < BSE_MIXER_N_INPUTS; i++)
self->volume_factors[i] = bse_db_to_factor (DEFAULT_DB_VOLUME);
@@@ -135,6 -155,7 +155,7 @@@ bse_mixer_set_property (GObject *o
GParamSpec *pspec)
{
BseMixer *self = BSE_MIXER (object);
-
++
switch (param_id)
{
guint indx, n;
@@@ -205,6 -227,7 +227,7 @@@ bse_mixer_get_property (GObject *obj
GParamSpec *pspec)
{
BseMixer *self = BSE_MIXER (object);
-
++
switch (param_id)
{
guint indx, n;
@@@ -247,6 -272,7 +272,7 @@@ bse_mixer_update_modules (BseMixer *sel
{
gfloat volumes[BSE_MIXER_N_INPUTS];
guint i;
-
++
for (i = 0; i < BSE_MIXER_N_INPUTS; i++)
volumes[i] = self->volume_factors[i] * self->master_volume_factor;
if (BSE_SOURCE_PREPARED (self))
@@@ -263,15 -290,18 +290,18 @@@ mixer_process (BseModule *module
Mixer *mixer = (Mixer*) module->user_data;
gfloat *wave_out = BSE_MODULE_OBUFFER (module, 0);
gfloat *wave_bound = wave_out + n_values;
-
++
if (module->ostreams[0].connected)
{
guint n;
-
++
for (n = 0; n < BSE_MODULE_N_ISTREAMS (module); n++)
if (module->istreams[n].connected)
{
const gfloat *wave_in = BSE_MODULE_IBUFFER (module, n);
gfloat *w = wave_out;
gfloat volume = mixer->volumes[n];
-
++
if (volume != 1.0)
do { *w++ = volume * *wave_in++; } while (w < wave_bound);
else
@@@ -286,6 -316,7 +316,7 @@@
const gfloat *wave_in = BSE_MODULE_IBUFFER (module, n);
gfloat *w = wave_out;
gfloat volume = mixer->volumes[n];
-
++
if (volume != 1.0)
do { *w++ += volume * *wave_in++; } while (w < wave_bound);
else
@@@ -310,13 -342,18 +342,18 @@@ bse_mixer_context_create (BseSource *so
};
Mixer *mixer = g_new0 (Mixer, 1);
BseModule *module;
-
++
module = bse_module_new (&mixer_class, mixer);
-
++
/* setup module i/o streams with BseSource i/o channels */
bse_source_set_context_module (source, context_handle, module);
-
++
/* commit module to engine */
bse_trans_add (trans, bse_job_integrate (module));
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_create (source, context_handle, trans);
-
++
/* update module data */
bse_mixer_update_modules (BSE_MIXER (source), trans);
}
diff --cc plugins/bsemult.cc
index f838154,7a56f0e..ee4a793
--- a/plugins/bsemult.cc
+++ b/plugins/bsemult.cc
@@@ -48,6 -59,7 +59,7 @@@ multiply_process (BseModule *module
gfloat *wave_out = BSE_MODULE_OBUFFER (module, 0);
gfloat *bound = wave_out + n_values;
guint i;
-
++
if (!module->ostreams[0].connected)
return; /* nothing to process */
for (i = 0; i < BSE_MODULE_N_ISTREAMS (module); i++)
@@@ -67,6 -79,7 +79,7 @@@
{
const gfloat *in = BSE_MODULE_IBUFFER (module, i);
gfloat *out = wave_out;
-
++
/* found 1+nth channel to multiply with */
do
*out++ *= *in++;
@@@ -90,11 -104,15 +104,15 @@@ bse_mult_context_create (BseSource *sou
};
// BseMult *mult = BSE_MULT (source);
BseModule *module;
-
++
module = bse_module_new (&multiply_class, NULL);
-
++
/* setup module i/o streams with BseSource i/o channels */
bse_source_set_context_module (source, context_handle, module);
-
++
/* commit module to engine */
bse_trans_add (trans, bse_job_integrate (module));
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_create (source, context_handle, trans);
}
diff --cc plugins/bsenoise.cc
index 03e3510,298a873..0049552
--- a/plugins/bsenoise.cc
+++ b/plugins/bsenoise.cc
@@@ -75,6 -81,7 +81,7 @@@ public
/* preparation of a long block of random data */
static vector<float> *noise_data;
static uint noise_data_ref_count;
-
++
void
prepare1()
{
diff --cc plugins/bsenoise.idl
index a934936,8072a84..abc83d1
--- a/plugins/bsenoise.idl
+++ b/plugins/bsenoise.idl
@@@ -7,6 -9,7 +7,7 @@@ interface Noise : Effect
Info license = _("GNU Lesser General Public License");
Info category = _("/Audio Sources/Noise");
Info blurb = _("Noise is a generator of (supposedly) white noise");
- OStream noise_out = (_("Noise Out"), _("Noise Output"));
+ OStream noise_out = Stream (_("Noise Out"), _("Noise Output"));
};
+
} // Bse
diff --cc plugins/bsequantizer.idl
index bf51fa3,649e8d5..efaedc3
--- a/plugins/bsequantizer.idl
+++ b/plugins/bsequantizer.idl
@@@ -8,12 -10,13 +8,13 @@@ interface Quantizer : Bse::Effect
Info blurb = _("The Quantizer plugin quantizes the input signals according to a configurable step
setting. "
"This simulates low quality digital signal transfer paths or ancient computer
hardware.");
group _("Quantization") {
- Real qsteps = Real (_("Quantization Steps"), _("The number of different steps the output signal
is quantized to."), 256, 1, 4294967296, 256, STANDARD ":scale");
- Real qstep_powers = Real (_("Bit Depth"), _("The number of bits the quantization steps
correspond to."), 8, 0, 32, 0.0625, GUI ":scale");
+ Real qsteps = SfiReal (_("Quantization Steps"), _("The number of different steps the output
signal is quantized to."), 256, 1, 4294967296, 256, STANDARD ":scale");
+ Real qstep_powers = SfiReal (_("Bit Depth"), _("The number of bits the quantization steps
correspond to."), 8, 0, 32, 0.0625, GUI ":scale");
};
- IStream audio_in1 = ("Audio In1", "Audio Input 1");
- IStream audio_in2 = ("Audio In2", "Audio Input 2");
- OStream audio_out1 = ("Audio Out1", "Audio Output 1");
- OStream audio_out2 = ("Audio Out2", "Audio Output 2");
+ IStream audio_in1 = Stream ("Audio In1", "Audio Input 1");
+ IStream audio_in2 = Stream ("Audio In2", "Audio Input 2");
+ OStream audio_out1 = Stream ("Audio Out1", "Audio Output 1");
+ OStream audio_out2 = Stream ("Audio Out2", "Audio Output 2");
};
+
} } // Bse::Standard
diff --cc plugins/bsesequencer.cc
index e89e4f3,778f67f..18b61ee
--- a/plugins/bsesequencer.cc
+++ b/plugins/bsesequencer.cc
@@@ -42,13 -51,17 +51,17 @@@ bse_sequencer_class_init (BseSequencerC
BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
guint ochannel;
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = (GObjectSetPropertyFunc) bse_sequencer_set_property;
gobject_class->get_property = (GObjectGetPropertyFunc) bse_sequencer_get_property;
gobject_class->finalize = bse_sequencer_finalize;
-
++
source_class->prepare = bse_sequencer_prepare;
source_class->context_create = bse_sequencer_context_create;
source_class->reset = bse_sequencer_reset;
-
++
bse_object_class_add_param (object_class, "Sequence",
PARAM_LENGTH,
sfi_pspec_int ("length", "Length", NULL,
@@@ -69,6 -82,7 +82,7 @@@
sfi_pspec_real ("counter", "Timing [ms]", NULL,
100, 0, 1000, 5,
SFI_PARAM_STANDARD ":f:scale"));
-
++
ochannel = bse_source_class_add_ochannel (source_class, "freq-out", _("Freq Out"), _("Frequency Signal"));
g_assert (ochannel == BSE_SEQUENCER_OCHANNEL_FREQ);
ochannel = bse_source_class_add_ochannel (source_class, "note-sync", _("Note Sync"), _("Note Sync
Signal"));
@@@ -88,7 -104,9 +104,9 @@@ static voi
bse_sequencer_finalize (GObject *object)
{
BseSequencer *seq = BSE_SEQUENCER (object);
-
++
bse_note_sequence_free (seq->sdata);
-
++
/* chain parent class' handler */
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@@ -179,16 -200,20 +200,20 @@@ freq_values_from_seq (BseMusicalTuningT
{
gfloat *v = g_new (gfloat, bse_note_sequence_length (sdata));
guint i;
-
++
for (i = 0; i < bse_note_sequence_length (sdata); i++)
{
gint note = sdata->notes->notes[i];
-
++
if (note == SFI_NOTE_VOID)
v[i] = 0;
else
v[i] = BSE_VALUE_FROM_FREQ (bse_note_to_freq (musical_tuning, CLAMP (note + transpose, SFI_MIN_NOTE,
SFI_MAX_NOTE)));
}
-
++
return v;
}
+
typedef struct {
guint n_values;
gfloat *values; /* notes */
@@@ -229,13 -259,17 +259,17 @@@ bse_sequencer_update_modules (BseSequen
if (BSE_SOURCE_PREPARED (seq))
{
AccessData *d = g_new (AccessData, 1);
-
++
d->old_values = seq->freq_values;
-
++
seq->n_freq_values = bse_note_sequence_length (seq->sdata);
seq->freq_values = freq_values_from_seq (bse_source_prepared_musical_tuning (BSE_SOURCE (seq)),
seq->sdata, seq->transpose);
-
++
d->n_values = seq->n_freq_values;
d->new_values = seq->freq_values;
d->counter = seq->counter / 1000.0 * bse_engine_sample_freq ();
d->counter = MAX (d->counter, 1);
-
++
bse_source_access_modules (BSE_SOURCE (seq),
seq_access, d, seq_access_free,
NULL);
@@@ -249,9 -284,11 +284,11 @@@ sequencer_process (BseModule *module
gfloat *freq_out = BSE_MODULE_OBUFFER (module, BSE_SEQUENCER_OCHANNEL_FREQ);
gfloat *nsync_out = BSE_MODULE_OBUFFER (module, BSE_SEQUENCER_OCHANNEL_NOTE_SYNC);
gfloat *bound = freq_out + n_values;
-
++
while (freq_out < bound)
{
gfloat nval = smod->values[smod->index];
-
++
if (smod->c == 0)
{
smod->c = smod->counter;
@@@ -271,8 -309,10 +309,10 @@@ static voi
bse_sequencer_prepare (BseSource *source)
{
BseSequencer *seq = BSE_SEQUENCER (source);
-
++
seq->n_freq_values = bse_note_sequence_length (seq->sdata);
seq->freq_values = freq_values_from_seq (bse_source_prepared_musical_tuning (source), seq->sdata,
seq->transpose);
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->prepare (source);
}
@@@ -300,11 -342,15 +342,15 @@@ bse_sequencer_context_create (BseSourc
smod->counter = MAX (smod->counter, 1);
smod->index = 0;
smod->c = smod->counter;
-
++
module = bse_module_new (&sequencer_class, smod);
-
++
/* setup module i/o streams with BseSource i/o channels */
bse_source_set_context_module (source, context_handle, module);
-
++
/* commit module to engine */
bse_trans_add (trans, bse_job_integrate (module));
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_create (source, context_handle, trans);
}
@@@ -312,9 -359,11 +359,11 @@@ static voi
bse_sequencer_reset (BseSource *source)
{
BseSequencer *seq = BSE_SEQUENCER (source);
-
++
g_free (seq->freq_values);
seq->freq_values = NULL;
seq->n_freq_values = 0;
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->reset (source);
}
diff --cc plugins/bsesimpleadsr-aux.cc
index a670365,182a7a6..ff3b3c4
--- a/plugins/bsesimpleadsr-aux.cc
+++ b/plugins/bsesimpleadsr-aux.cc
@@@ -45,6 -48,7 +48,7 @@@ BSE_MIX_VARIANT_NAME (BseMixRampLinear
register gfloat value = ramp->level;
gfloat level_step = ramp->level_step;
gfloat eps = STEP_DOWN ? ramp->level_border + BSE_MIX_EPSILON : ramp->level_border - BSE_MIX_EPSILON;
-
++
if (wave_out >= bound)
return BSE_MIX_RAMP_REACHED_BOUND;
do
diff --cc plugins/bsesimpleadsr.cc
index 4df0520,7005f34..0ed9bad
--- a/plugins/bsesimpleadsr.cc
+++ b/plugins/bsesimpleadsr.cc
@@@ -45,10 -53,14 +53,14 @@@ bse_simple_adsr_class_init (BseSimpleAD
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
guint ochannel, ichannel;
gchar *desc;
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = bse_simple_adsr_set_property;
gobject_class->get_property = bse_simple_adsr_get_property;
-
++
source_class->context_create = bse_simple_adsr_context_create;
-
++
bse_object_class_add_param (object_class, "Envelope",
PARAM_ATTACK_TIME,
sfi_pspec_real ("attack_time", "Attack Time [%]", NULL,
@@@ -80,6 -92,7 +92,7 @@@
BSE_TIME_RANGE_SHORT,
SFI_PARAM_STANDARD));
g_free (desc);
-
++
ichannel = bse_source_class_add_ichannel (source_class, "gate-in", _("Gate In"), _("Gate input
(activates/deactivates envelope)"));
g_assert (ichannel == BSE_SIMPLE_ADSR_ICHANNEL_GATE);
ichannel = bse_source_class_add_ichannel (source_class, "retrigger-in", _("Retrigger In"), _("Retrigger
input (raising edge retriggers envelope)"));
@@@ -213,9 -241,11 +241,11 @@@ simple_adsr_process (BseModule *module
gfloat *wave_out = BSE_MODULE_OBUFFER (module, BSE_SIMPLE_ADSR_OCHANNEL_OUT);
gboolean have_gate = BSE_MODULE_ISTREAM (module, BSE_SIMPLE_ADSR_ICHANNEL_GATE).connected;
guint state = 0;
-
++
if (!BSE_MODULE_OSTREAM (module, BSE_SIMPLE_ADSR_OCHANNEL_OUT).connected &&
!BSE_MODULE_OSTREAM (module, BSE_SIMPLE_ADSR_OCHANNEL_DONE).connected)
return; /* no output */
-
++
if (env->phase == POST_RELEASE &&
!BSE_MODULE_ISTREAM (module, BSE_SIMPLE_ADSR_ICHANNEL_GATE).connected &&
!BSE_MODULE_ISTREAM (module, BSE_SIMPLE_ADSR_ICHANNEL_RETRIGGER).connected)
@@@ -228,6 -258,7 +258,7 @@@
BSE_MODULE_OSTREAM (module, BSE_SIMPLE_ADSR_OCHANNEL_DONE).values = bse_engine_const_values (0.0);
return;
}
-
++
ramp->wave_out = wave_out;
ramp->bound = wave_out + n_values;
do
@@@ -311,6 -342,7 +342,7 @@@
}
}
while (state != BSE_MIX_RAMP_REACHED_BOUND);
-
++
if (env->phase == POST_RELEASE)
BSE_MODULE_OSTREAM (module, BSE_SIMPLE_ADSR_OCHANNEL_DONE).values = bse_engine_const_values (1.0);
else
@@@ -372,13 -407,18 +407,18 @@@ bse_simple_adsr_context_create (BseSour
BseSimpleADSR *simple_adsr = BSE_SIMPLE_ADSR (source);
SimpleADSR *env = g_new0 (SimpleADSR, 1);
BseModule *module;
-
++
module = bse_module_new (&env_class, env);
-
++
/* setup module i/o streams with BseSource i/o channels */
bse_source_set_context_module (source, context_handle, module);
-
++
/* commit module to engine */
bse_trans_add (trans, bse_job_integrate (module));
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_create (source, context_handle, trans);
-
++
/* update module data */
bse_simple_adsr_update_modules (simple_adsr, trans);
}
diff --cc plugins/bsesummation.idl
index be4f929,3f99f5f..8ee97c3
--- a/plugins/bsesummation.idl
+++ b/plugins/bsesummation.idl
@@@ -11,10 -13,11 +11,11 @@@ interface Summation : Effect
"similarly, 'Audio Sum2' is the accumulatiuon signal of all streams connected to
'Audio In2'. "
"A difference signal between 'Audio Sum1' and 'Audio Sum2' is also "
"generated and is available at 'Audio Diff'.");
- JStream audio_in1 = (_("Audio In1"), _("Audio input 1"));
- JStream audio_in2 = (_("Audio In2"), _("Audio input 2"));
- OStream audio_out1 = (_("Audio Sum1"), _("Accumulated audio output 1"));
- OStream audio_diff = (_("Audio Diff"), _("Difference between audio outputs 1 and 2"));
- OStream audio_out2 = (_("Audio Sum2"), _("Accumulated audio output 2"));
+ JStream audio_in1 = Stream (_("Audio In1"), _("Audio input 1"));
+ JStream audio_in2 = Stream (_("Audio In2"), _("Audio input 2"));
+ OStream audio_out1 = Stream (_("Audio Sum1"), _("Accumulated audio output 1"));
+ OStream audio_diff = Stream (_("Audio Diff"), _("Difference between audio outputs 1 and 2"));
+ OStream audio_out2 = Stream (_("Audio Sum2"), _("Accumulated audio output 2"));
};
+
} // Bse
diff --cc plugins/davbassfilter.idl
index 0f1c138,523a524..9960ef8
--- a/plugins/davbassfilter.idl
+++ b/plugins/davbassfilter.idl
@@@ -19,9 -21,11 +19,11 @@@ interface BassFilter : Effect
Real reso_perc = Perc (_("Resonance [%]"), _("Set the amount of resonance in percent"), 99.5,
STANDARD ":automate:");
Real env_mod = Perc (_("Envelope Modulation [%]"), _("Set the envelope magnitude in percent"), 90,
STANDARD ":automate:");
Real env_decay = Perc (_("Decay [%]"), _("Set the decay length in percent"), 20, STANDARD
":automate:");
- Bool trigger = Trigger (_("Trigger filter"), NULL, GUI);
+ Bool trigger = Trigger (_("Trigger filter"), "", GUI);
};
};
+
} // Dav
} // Bse
+
/* vim:set ts=8 sw=2 sts=2 syntax=cpp: */
diff --cc plugins/davcanyondelay.cc
index 803a764,00e2be2..9f1abe5
--- a/plugins/davcanyondelay.cc
+++ b/plugins/davcanyondelay.cc
@@@ -46,11 -55,15 +55,15 @@@ dav_canyon_delay_class_init (DavCanyonD
BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
guint channel;
+
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = dav_canyon_delay_set_property;
gobject_class->get_property = dav_canyon_delay_get_property;
-
++
source_class->prepare = dav_canyon_delay_prepare;
source_class->context_create = dav_canyon_delay_context_create;
-
++
bse_object_class_add_param (object_class, _("Left to Right"), PROP_LEFT_TO_RIGHT_TIME,
sfi_pspec_real ("left_to_right_time", _("Delay (seconds)"),
_("The time for the left to right delay"),
@@@ -196,6 -221,7 +221,7 @@@ canyon_delay_process (BseModule *module
pos2 = cmod->pos - cmod->params.l_to_r_pos + cmod->datasize;
while (pos2 >= cmod->datasize)
pos2 -= cmod->datasize;
-
++
/* Mix channels with past samples. */
accum_l = accum_l * cmod->params.r_to_l_invmag + cmod->data_r[pos1] * cmod->params.r_to_l_mag;
accum_r = accum_r * cmod->params.l_to_r_invmag + cmod->data_l[pos2] * cmod->params.l_to_r_mag;
@@@ -204,12 -231,15 +231,15 @@@
accum_l = BSE_SIGNAL_CLIP (accum_l);
accum_r = cmod->accum_r * cmod->params.filter_invmag + accum_r * cmod->params.filter_mag;
accum_r = BSE_SIGNAL_CLIP (accum_r);
-
++
/* Store IIR samples. */
cmod->accum_l = accum_l;
cmod->accum_r = accum_r;
-
++
/* Store samples in arrays. */
cmod->data_l[cmod->pos] = accum_l;
cmod->data_r[cmod->pos] = accum_r;
-
++
/* Write output. */
left_out[i] = accum_l;
right_out[i] = accum_r;
@@@ -288,11 -329,13 +329,13 @@@ dav_canyon_delay_update_modules (DavCan
self->params.r_to_l_invmag = 1.0 - ABS (self->params.r_to_l_mag);
self->params.l_to_r_pos = self->l_to_r_seconds * bse_engine_sample_freq();
self->params.r_to_l_pos = self->r_to_l_seconds * bse_engine_sample_freq();
-
++
/* The following stuff (except the multiplicative inverse)
* is a guesstimate. The calculations seem to be right, tho.
* Compare to the FIR filter for a reference.
*/
gdouble half = 1.0 / (4.0 * PI * self->filter_freq);
-
++
/* Calculate the half life rate given:
* half - the length of the half life
* sample_freq - time divisor (usually the # calcs per second)
@@@ -301,6 -344,7 +344,7 @@@
*/
self->params.filter_invmag = exp (-BSE_LN2 / (half * bse_engine_sample_freq()));
self->params.filter_mag = 1.0 - self->params.filter_invmag;
-
++
/* update all DavCanyonDelayModules. take a look at davxtalstrings.c
* to understand what this code does.
*/
diff --cc plugins/davchorus.cc
index 1b496b5,ff1f57a..8d66f9a
--- a/plugins/davchorus.cc
+++ b/plugins/davchorus.cc
@@@ -46,25 -48,32 +48,32 @@@ class Chorus : public ChorusBase
while (output < bound) // FIXME: this loop should be much more optimized
{
delay[delay_pos] = *input++;
-
++
int hi_pos = delay_pos;
int lo_pos = dtoi ((sin (sine_pos) + 1.0) * (delay_length - 1) * 256.0 * 0.5);
-
++
/* Normalize hi_pos and lo_pos counters. */
hi_pos += lo_pos >> 8;
lo_pos &= 0xff;
/* Find hi_pos modulus delay_length. */
while (hi_pos >= delay_length)
hi_pos -= delay_length;
-
++
/* Perform linear interpolation between hi_pos and hi_pos + 1. */
double wet = delay[hi_pos] * (256 - lo_pos);
-
++
hi_pos++;
if (hi_pos >= delay_length)
hi_pos -= delay_length;
wet += delay[hi_pos] * lo_pos;
wet = (wet / 256.0 + delay[delay_pos]) / 2;
-
++
*output++ = wet * wet_out + delay[delay_pos] * dry_out;
-
++
delay_pos++;
if (delay_pos >= delay_length)
delay_pos = 0;
-
++
sine_pos += sine_delta;
while (sine_pos >= 2.0 * M_PI)
sine_pos -= 2.0 * M_PI;
diff --cc plugins/davguitar.c
index a6fb8fb,2ea733a..6834544
--- a/plugins/davguitar.c
+++ b/plugins/davguitar.c
@@@ -56,11 -63,13 +63,13 @@@ static GType type_id_guitar = 0
static gpointer parent_class = NULL;
static const GTypeInfo type_info_guitar = {
sizeof (DavGuitarClass),
-
++
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) dav_guitar_class_init,
(GClassFinalizeFunc) dav_guitar_class_finalize,
NULL /* class_data */,
-
++
sizeof (DavGuitar),
0 /* n_preallocs */,
(GInstanceInitFunc) dav_guitar_init,
@@@ -81,11 -94,13 +94,13 @@@ wave_guide_set_freq (WaveGuide *wave
double frq)
{
guint i;
-
++
wave->freq = frq;
wave->pos = 0;
wave->wavelen = (int) (bse_engine_sample_freq() / frq);
wave->lowpass_data = 0.0;
wave_guide_unstop (wave);
-
++
for (i = 0; i < wave->wavelen; i++)
wave->data[i] = 0.0;
}
@@@ -97,22 -113,30 +113,30 @@@ wave_guide_pluck (WaveGuide *wave
{
guint i;
guint pivot;
-
++
wave->lowpass_data = 0.0;
wave_guide_unstop (wave);
-
++
/* Initialize wave guide (i.e. string) by setting it to random data. */
-
++
/* Create envelope. */
pivot = wave->wavelen / 5;
-
++
for (i = 0; i <= pivot; i++)
wave->data[i] = ((float) i) / pivot;
-
++
for (; i < wave->wavelen; i++)
wave->data[i] = ((float) (wave->wavelen - i - 1)) / (wave->wavelen - pivot - 1);
-
++
/* Add some snap. */
for (i = 0; i < wave->wavelen; i++)
wave->data[i] = pow (wave->data[i], snap_factor * 10.0F + 1.0F);
-
++
/* Add static to displacements. */
for (i = 0; i < wave->wavelen; i++)
wave->data[i] = wave->data[i] * (1.0F - metallic_factor) +
((rand() & 1) ? -1.0F : 1.0F) * metallic_factor;
-
++
/* Set velocity. */
for (i = 0; i < wave->wavelen; i++)
wave->data[i] *= trigger_vel;
@@@ -145,8 -174,10 +174,10 @@@ wave_guide_advance (WaveGuide *wave
{
wave->lowpass_data = wave->lowpass_data * (1.0F - wave->lowpass_coeff) + wave->data[wave->pos] *
wave->lowpass_coeff;
wave->data[wave->pos] = wave->lowpass_data;
-
++
wave->pos = ((wave->pos + 1) == wave->wavelen) ? 0 : wave->pos + 1;
}
+
static inline int
wave_guide_get_pos (WaveGuide *wave, int x)
{
@@@ -169,11 -201,13 +201,13 @@@ add_string_param (BseObjectClass *objec
50.0, 2000.0,
freq_value, 0.1,
BSE_PARAM_DEFAULT | BSE_PARAM_HINT_DIAL));
-
++
bse_object_class_add_param (object_class, name, note_enum,
bse_param_spec_note (note_param, "Note", NULL,
BSE_NOTE_G (-2), BSE_NOTE_B (3),
note_value, 1, FALSE,
BSE_PARAM_GUI));
-
++
bse_object_class_add_param (object_class, name, trigger_enum,
sfi_pspec_bool (trigger_param, "Trigger Hit", "Pluck the string",
FALSE, BSE_PARAM_GUI));
@@@ -189,13 -225,18 +225,18 @@@ dav_guitar_class_init (DavGuitarClass *
BseObjectClass *object_class = BSE_OBJECT_CLASS (class);
BseSourceClass *source_class = BSE_SOURCE_CLASS (class);
guint ochannel_id;
-
++
parent_class = g_type_class_peek (BSE_TYPE_SOURCE);
-
++
gobject_class->set_property = dav_guitar_set_property;
gobject_class->get_property = dav_guitar_get_property;
+
object_class->destroy = dav_guitar_do_destroy;
-
++
source_class->prepare = dav_guitar_prepare;
source_class->calc_chunk = dav_guitar_calc_chunk;
source_class->reset = dav_guitar_reset;
-
++
add_string_param (object_class, "String 1",
"freq_1", PARAM_FREQ_1, 97.998859, "note_1", PARAM_NOTE_1, BSE_NOTE_G (-1), "trigger_1",
PARAM_TRIGGER_1);
add_string_param (object_class, "String 2",
@@@ -208,27 -249,33 +249,33 @@@
"freq_5", PARAM_FREQ_5, 246.941651, "note_5", PARAM_NOTE_5, BSE_NOTE_B (0), "trigger_5",
PARAM_TRIGGER_5);
add_string_param (object_class, "String 6",
"freq_6", PARAM_FREQ_6, 391.995436, "note_6", PARAM_NOTE_6, BSE_NOTE_G (1), "trigger_6",
PARAM_TRIGGER_6);
-
++
bse_object_class_add_param (object_class, "Global Control", PARAM_TRIGGER_VEL,
bse_param_spec_float ("trigger_vel", "Trigger Velocity [%]",
"Set the velocity of the string pluck",
0.0, 100.0, 100.0, 10.0,
BSE_PARAM_GUI | BSE_PARAM_HINT_SCALE));
-
++
bse_object_class_add_param (object_class, "Global Control", PARAM_TRIGGER_ALL,
sfi_pspec_bool ("trigger_all", "Trigger Hit All", "Strum guitar",
FALSE, BSE_PARAM_GUI));
-
++
bse_object_class_add_param (object_class, "Global Control", PARAM_STOP_ALL,
sfi_pspec_bool ("stop_all", "Stop All", "Stop all the strings from vibrating",
FALSE, BSE_PARAM_GUI));
-
++
bse_object_class_add_param (object_class, "Flavour", PARAM_METALLIC_FACTOR,
bse_param_spec_float ("metallic_factor", "Metallic Factor [%]",
"Set the metallicness of the string",
0.0, 100.0, 16.0, 0.25,
BSE_PARAM_DEFAULT | BSE_PARAM_HINT_SCALE));
-
++
bse_object_class_add_param (object_class, "Flavour", PARAM_SNAP_FACTOR,
bse_param_spec_float ("snap_factor", "Snap Factor [%]",
"Set the snappiness of the string",
0.0, 100.0, 34.0, 0.25,
BSE_PARAM_DEFAULT | BSE_PARAM_HINT_SCALE));
-
++
ochannel_id = bse_source_class_add_ochannel (source_class, "mono-out", _("Guitar Output"));
g_assert (ochannel_id == DAV_GUITAR_OCHANNEL_MONO);
}
@@@ -244,6 -293,7 +293,7 @@@ dav_guitar_init (DavGuitar *guitar
guitar->trigger_vel = 1.0;
guitar->metallic_factor = 0.16;
guitar->snap_factor = 0.34;
-
++
wave_guide_init (&guitar->strings[0], 097.998859); /* G */
wave_guide_init (&guitar->strings[1], 123.470825); /* B */
wave_guide_init (&guitar->strings[2], 146.832384); /* D */
@@@ -251,17 -301,23 +301,23 @@@
wave_guide_init (&guitar->strings[4], 246.941651); /* B */
wave_guide_init (&guitar->strings[5], 391.995436); /* G */
wave_guide_init (&guitar->body, 50.0);
-
++
dav_guitar_update_locals (guitar);
}
+
static void
dav_guitar_do_destroy (BseObject *object)
{
DavGuitar *guitar;
int i;
-
++
guitar = DAV_GUITAR (object);
-
++
for (i = 0; i < 6; i++)
wave_guide_free (&guitar->strings[i]);
-
++
wave_guide_free (&guitar->body);
-
++
/* chain parent class' destroy handler */
BSE_OBJECT_CLASS (parent_class)->destroy (object);
}
@@@ -269,6 -326,7 +326,7 @@@ static voi
dav_guitar_trigger_string (DavGuitar *guitar, int str)
{
g_return_if_fail (DAV_IS_GUITAR (guitar));
-
++
wave_guide_pluck (&guitar->strings[str], guitar->metallic_factor, guitar->snap_factor,
guitar->trigger_vel);
wave_guide_unstop (&guitar->body);
}
@@@ -276,18 -335,24 +335,24 @@@ static voi
dav_guitar_trigger (DavGuitar *guitar)
{
guint i;
-
++
for (i = 0; i < 6; i++)
wave_guide_pluck (&guitar->strings[i], guitar->metallic_factor, guitar->snap_factor,
guitar->trigger_vel);
-
++
wave_guide_unstop (&guitar->body);
}
+
static void
dav_guitar_stop (DavGuitar *guitar)
{
guint i;
-
++
for (i = 0; i < 6; i++)
wave_guide_stop (&guitar->strings[i]);
-
++
wave_guide_stop (&guitar->body);
}
+
static void
dav_guitar_set_property (DavGuitar *guitar,
guint param_id,
@@@ -377,6 -442,7 +442,7 @@@
case PARAM_SNAP_FACTOR:
guitar->snap_factor = g_value_get_float (value) / 100.0;
break;
-
++
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (guitar, param_id, pspec);
break;
@@@ -459,6 -526,7 +526,7 @@@ dav_guitar_get_property (DavGuitar *g
case PARAM_SNAP_FACTOR:
g_value_set_float (value, guitar->snap_factor * 100.0);
break;
-
++
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (guitar, param_id, pspec);
break;
@@@ -470,15 -539,20 +539,20 @@@ dav_guitar_prepare (BseSource *source
{
DavGuitar *guitar = DAV_GUITAR (source);
int i;
-
++
guitar->hipass_coeff = pow (0.5, 20.0 / bse_engine_sample_freq());
guitar->hipass_data = 0.0;
-
++
wave_guide_prepare (&guitar->body);
-
++
for (i = 0; i < 6; i++)
{
wave_guide_prepare (&guitar->strings[i]);
guitar->body_taps[i] = ((i + 1) * (guitar->body.wavelen - 1)) / 7;
}
-
++
dav_guitar_update_locals (guitar);
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->prepare (source, index);
}
@@@ -488,13 -563,17 +563,17 @@@ resonate (DavGuitar *guitar, float fact
int body_pos;
float vel;
WaveGuide *body, *string;
-
++
body = &guitar->body;
string = &guitar->strings[n];
-
++
/* Find position on body. */
body_pos = wave_guide_get_pos (body, guitar->body_taps[n]);
-
++
/* Linearly approximate the force of an imaginary
spring connected between those two points. */
vel = (string->data[string->pos] - body->data[body_pos]) * factor;
-
++
/* Modify positions. */
string->data[string->pos] -= vel;
body->data[body_pos] += vel;
@@@ -507,25 -587,33 +587,33 @@@ dav_guitar_calc_chunk (BseSource *sourc
BseSampleValue *hunk;
gfloat sample;
guint i, j;
-
++
g_return_val_if_fail (ochannel_id == DAV_GUITAR_OCHANNEL_MONO, NULL);
-
++
hunk = bse_hunk_alloc (1);
-
++
for (i = 0; i < BSE_TRACK_LENGTH; i++)
{
/* Get sample from body and hipass it to remove DC offset. */
sample = guitar->body.data[guitar->body.pos] * 25.0F;
guitar->hipass_data = guitar->hipass_data * guitar->hipass_coeff + sample * (1.0F -
guitar->hipass_coeff);
-
++
/* Store sample. */
hunk[i] = BSE_CLIP_SAMPLE_VALUE ((sample - guitar->hipass_data) * BSE_MAX_SAMPLE_VALUE_f);
-
++
/* Resonate strings + body and advance waves one position. */
for (j = 0; j < 6; j++)
{
resonate (guitar, 0.01, j);
wave_guide_advance (&guitar->strings[j]);
}
-
++
wave_guide_advance (&guitar->body);
}
-
++
return bse_chunk_new_orphan (1, hunk);
}
+
static void
dav_guitar_reset (BseSource *source)
{
diff --cc plugins/davsyndrum.cc
index d79ef34,2104ab4..e76c2ed
--- a/plugins/davsyndrum.cc
+++ b/plugins/davsyndrum.cc
@@@ -50,11 -57,15 +57,15 @@@ dav_syn_drum_class_init (DavSynDrumClas
BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
guint ochannel_id, ichannel_id;
-
++
parent_class = g_type_class_peek_parent (klass);
+
gobject_class->set_property = dav_syn_drum_set_property;
gobject_class->get_property = dav_syn_drum_get_property;
-
++
source_class->prepare = dav_syn_drum_prepare;
source_class->context_create = dav_syn_drum_context_create;
+
bse_object_class_add_param (object_class, _("Frequency"), PROP_BASE_FREQ,
bse_param_spec_freq ("base_freq", _("Frequency"),
_("Drum frequency in Hertz"),
diff --cc plugins/davxtalstrings.cc
index ed627bc,64a959e..af2cc04
--- a/plugins/davxtalstrings.cc
+++ b/plugins/davxtalstrings.cc
@@@ -60,11 -69,15 +69,15 @@@ dav_xtal_strings_class_init (DavXtalStr
BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
guint channel_id;
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = dav_xtal_strings_set_property;
gobject_class->get_property = dav_xtal_strings_get_property;
-
++
source_class->prepare = dav_xtal_prepare;
source_class->context_create = dav_xtal_strings_context_create;
-
++
bse_object_class_add_param (object_class, _("Frequency"),
PARAM_BASE_FREQ,
bse_param_spec_freq ("base_freq", _("Frequency"),
@@@ -114,6 -127,7 +127,7 @@@
_("Snappiness of the string"),
34.0, 0.0, 100.0, 1,
SFI_PARAM_STANDARD ":scale"));
-
++
channel_id = bse_source_class_add_ichannel (source_class, "freq-in", _("Freq In"), _("Pluck frequency
input"));
g_assert (channel_id == DAV_XTAL_STRINGS_ICHANNEL_FREQ);
channel_id = bse_source_class_add_ichannel (source_class, "trigger-in", _("Trigger In"), _("Pluck strings
on raising edge"));
@@@ -136,6 -151,7 +151,7 @@@ dav_xtal_strings_init (DavXtalStrings *
self->size = 1;
self->pos = 0;
self->count = 0;
-
++
self->a = 0.0;
self->damping_factor = 0.0;
#endif
@@@ -315,11 -340,14 +340,14 @@@ xmod_trigger (XtalStringsModule *xmod
trigger_freq *= bse_cent_tune_fast (xmod->tparams.fine_tune);
trigger_freq = CLAMP (trigger_freq, 27.5, 4000.0);
xmod->last_transposed_trigger_freq = trigger_freq;
-
++
xmod->pos = 0;
xmod->count = 0;
xmod->size = (int) ((bse_engine_sample_freq() + trigger_freq - 1) / trigger_freq);
-
++
xmod->a = calc_factor (trigger_freq, xmod->tparams.tension_decay);
xmod->damping_factor = calc_factor (trigger_freq, xmod->tparams.note_decay);
-
++
/* Create envelope. */
int pivot = xmod->size / 5;
int i;
@@@ -327,9 -355,11 +355,11 @@@
xmod->string[i] = ((float) i) / pivot;
for (; i < xmod->size; i++)
xmod->string[i] = ((float) (xmod->size - i - 1)) / (xmod->size - pivot - 1);
-
++
/* Add some snap. */
for (i = 0; i < xmod->size; i++)
xmod->string[i] = pow (xmod->string[i], xmod->tparams.snap_factor * 10.0 + 1.0);
-
++
/* Add static to displacements. */
DavRand rand;
dav_rand_setup (&rand, bse_main_args->allow_randomization);
@@@ -351,8 -382,10 +382,10 @@@ xmod_process (BseModule *module
gfloat sample, last_trigger_level;
guint real_freq_256, actual_freq_256;
guint i;
-
++
real_freq_256 = (int) (xmod->last_transposed_trigger_freq * 256);
actual_freq_256 = (int) (bse_engine_sample_freq() * 256. / xmod->size);
-
++
if (BSE_MODULE_ISTREAM (module, DAV_XTAL_STRINGS_ICHANNEL_FREQ).connected)
freq_in = BSE_MODULE_IBUFFER (module, DAV_XTAL_STRINGS_ICHANNEL_FREQ);
else
@@@ -368,26 -401,32 +401,32 @@@
actual_freq_256 = (int) (bse_engine_sample_freq() * 256. / xmod->size);
}
last_trigger_level = trigger_in[i];
-
++
/* Get next position. */
pos2 = xmod->pos + 1;
if (pos2 >= xmod->size)
pos2 = 0;
-
++
/* Linearly interpolate sample. */
sample = xmod->string[xmod->pos] * (1.0 - (((float) xmod->count) / actual_freq_256));
sample += xmod->string[pos2] * (((float) xmod->count) / actual_freq_256);
-
++
/* store sample, clipping is required as the algorithm generates
* overshoot on purpose
*/
wave_out[i] = CLAMP (sample, -1.0, +1.0);
-
++
/* Use Bresenham's algorithm to advance to the next position. */
xmod->count += real_freq_256;
while (xmod->count >= actual_freq_256)
{
xmod->d = ((xmod->d * (1.0 - xmod->a)) + (xmod->string[xmod->pos] * xmod->a)) *
xmod->damping_factor;
xmod->string[xmod->pos] = xmod->d;
-
++
xmod->pos++;
if (xmod->pos >= xmod->size)
xmod->pos = 0;
-
++
xmod->count -= actual_freq_256;
}
}
@@@ -398,6 -439,7 +439,7 @@@ static voi
xmod_reset (BseModule *module)
{
XtalStringsModule *xmod = (XtalStringsModule*) module->user_data;
-
++
/* this function is called whenever we need to start from scratch */
memset (xmod->string, 0, STRING_LENGTH () * sizeof (xmod->string[0]));
xmod->size = 1;
@@@ -413,6 -456,7 +456,7 @@@ xmod_free (gpointer data
const BseModuleClass *klass)
{
XtalStringsModule *xmod = (XtalStringsModule*) data;
-
++
g_free (xmod->string);
g_free (xmod);
}
@@@ -434,14 -479,18 +479,18 @@@ dav_xtal_strings_context_create (BseSou
DavXtalStrings *self = DAV_XTAL_STRINGS (source);
XtalStringsModule *xmod = g_new0 (XtalStringsModule, 1);
BseModule *module;
-
++
xmod->string = g_new0 (gfloat, STRING_LENGTH ());
xmod->tparams = self->params;
module = bse_module_new (&xmod_class, xmod);
xmod_reset (module); /* value initialization */
-
++
/* setup module i/o streams with BseSource i/o channels */
bse_source_set_context_module (source, context_handle, module);
-
++
/* commit module to engine */
bse_trans_add (trans, bse_job_integrate (module));
-
++
/* chain parent class' handler */
BSE_SOURCE_CLASS (parent_class)->context_create (source, context_handle, trans);
}
@@@ -453,6 -503,7 +503,7 @@@ xmod_access (BseModule *module
{
XtalStringsModule *xmod = (XtalStringsModule*) module->user_data;
DavXtalStringsParams *params = (DavXtalStringsParams*) data;
-
++
xmod->tparams = *params;
if (params->trigger_now)
xmod_trigger (xmod, params->freq);
diff --cc plugins/evaluator/bseevaluator.cc
index 0f15b52,8c7cf0f..431cb49
--- a/plugins/evaluator/bseevaluator.cc
+++ b/plugins/evaluator/bseevaluator.cc
@@@ -43,6 -49,7 +49,7 @@@ class Evaluator : public EvaluatorBas
{
const float *input = istream (ICHANNEL_INPUT).values;
float *output = ostream (OCHANNEL_OUTPUT).values;
-
++
cpu.execute_1_1_block (input_reg, output_reg, input, output, samples);
}
};
@@@ -65,24 -72,30 +72,30 @@@ public
vector<Instruction> new_instructions;
Symbols symbols;
string error;
-
++
input_reg = symbols.alloc("input");
output_reg = symbols.alloc("output");
-
++
error = Compiler::tokenize (symbols, source_vec, tokens);
if (error != "")
{
set_status("ERROR: " + error);
break;
}
-
++
error = Compiler::compile (symbols, tokens, new_instructions);
if (error != "")
{
set_status("ERROR: " + error);
break;
}
-
++
instructions = new_instructions;
-
++
CPU cpu;
cpu.set_program(instructions);
cpu.print_program(symbols);
-
++
set_status("compile ok.");
}
break;
diff --cc plugins/evaluator/compiler.hh
index 7ad7699,f883c21..8bbf0ad
--- a/plugins/evaluator/compiler.hh
+++ b/plugins/evaluator/compiler.hh
@@@ -1,6 -1,8 +1,8 @@@
// Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-
++
#ifndef BSE_EVALUATOR_COMPILER_H
#define BSE_EVALUATOR_COMPILER_H
+
#include "token.hh"
#include "instruction.hh"
#include "symbols.hh"
diff --cc plugins/evaluator/evaluateexpr.cc
index 8aff67f,86f4ca0..5a0c8aa
--- a/plugins/evaluator/evaluateexpr.cc
+++ b/plugins/evaluator/evaluateexpr.cc
@@@ -22,6 -30,7 +30,7 @@@ int main(int argc, char **argv
vector<Token> tokens;
vector<Instruction> instructions;
string error;
-
++
error = Compiler::tokenize(symbols, source, tokens);
if (error != "")
{
diff --cc plugins/evaluator/instruction.hh
index 8793591,0fab11f..0a3b43b
--- a/plugins/evaluator/instruction.hh
+++ b/plugins/evaluator/instruction.hh
@@@ -28,12 -34,16 +34,16 @@@ public
{
case SET: regs[p1.reg] = p2.val;
break;
+
case MOVE: regs[p1.reg] = regs[p2.reg];
break;
-
++
case ADD: regs[p1.reg] += regs[p2.reg];
break;
+
case MUL: regs[p1.reg] *= regs[p2.reg];
break;
+
case SIN: regs[p1.reg] = sin(regs[p1.reg]);
break;
}
diff --cc plugins/freeverb/bsefreeverb.cc
index fd7fb83,c89f542..324901a
--- a/plugins/freeverb/bsefreeverb.cc
+++ b/plugins/freeverb/bsefreeverb.cc
@@@ -45,11 -54,16 +54,16 @@@ bse_free_verb_class_init (BseFreeVerbCl
BseFreeVerbConstants *constants = &klass->constants;
BseFreeVerbConfig defaults;
guint channel;
-
++
parent_class = g_type_class_peek_parent (klass);
-
++
gobject_class->set_property = bse_free_verb_set_property;
gobject_class->get_property = bse_free_verb_get_property;
-
++
source_class->context_create = bse_free_verb_context_create;
-
++
bse_free_verb_cpp_defaults (&defaults, constants);
-
++
bse_object_class_add_param (object_class, "Reverb Style",
PROP_ROOM_SIZE,
sfi_pspec_real ("room_size", "Room Size", NULL,
diff --cc plugins/freeverb/denormals.hh
index 39fa41b,c42cc89..0f812bf
--- a/plugins/freeverb/denormals.hh
+++ b/plugins/freeverb/denormals.hh
@@@ -6,9 -6,13 +6,13 @@@
// This code is public domain
#include <bse/bseplugin.hh>
#include <bse/bseieee754.hh>
-
++
#ifndef _denormals_
#define _denormals_
-
++
// #define undenormalise(sample) if(((*(unsigned int*)&sample)&0x7f800000)==0) sample=0.0f
#define undenormalise(sample) BSE_FLOAT_FLUSH (sample)
-
++
#endif//_denormals_
-
++
//ends
diff --cc plugins/freeverb/tuning.hh
index c9880b5,ced8925..bcb33bb
--- a/plugins/freeverb/tuning.hh
+++ b/plugins/freeverb/tuning.hh
@@@ -3,8 -3,10 +3,10 @@@
// Written by Jezar at Dreampoint, June 2000
// http://www.dreampoint.co.uk
// This code is public domain
-
++
#ifndef _tuning_
#define _tuning_
-
++
const int numcombs = 8;
const int numallpasses = 4;
const float muted = 0;
@@@ -22,6 -24,7 +24,7 @@@ const float initialwidth = 1
const float initialmode = 0;
const float freezemode = 0.5f;
const int stereospread = 23;
-
++
// These values assume 44.1KHz sample rate
// they will probably be OK for 48KHz sample rate
// but would need scaling for 96KHz (or other) sample rates.
@@@ -50,5 -53,8 +53,8 @@@ const int allpasstuningL3 = 341
const int allpasstuningR3 = 341+stereospread;
const int allpasstuningL4 = 225;
const int allpasstuningR4 = 225+stereospread;
-
++
#endif//_tuning_
-
++
//ends
-
++
diff --cc plugins/standardsaturator.idl
index cc13fcf,3d464cd..2f2f342
--- a/plugins/standardsaturator.idl
+++ b/plugins/standardsaturator.idl
@@@ -43,7 -42,8 +43,8 @@@ interface Saturator : Bse::Effect
_("Automatically adapt the output volume according to changes in
saturation level"),
TRUE, STANDARD);
Real output_volume = DBVolume (_("Output Volume"), _("Output stage amplification in
decibel"), 0, 0, +42, "automate:" STANDARD);
- // Bool test_dump = Trigger ("Test Dump", NULL, GUI);
+ // Bool test_dump = Trigger ("Test Dump", "", GUI);
};
};
+
} } // Bse::Standard
diff --cc r+d-files/bse-ellf.c
index 3679a3b,79b64e6..a0c3c58
--- a/r+d-files/bse-ellf.c
+++ b/r+d-files/bse-ellf.c
@@@ -350,7 -363,9 +363,9 @@@ extern int merror
*
* These lists are subject to change.
*/
-
++
/* const.c */
+
#if 1
double MACHEP = 1.11022302462515654042E-16; /* 2**-53 */
#else
@@@ -528,9 -558,12 +558,12 @@@ void Cdiv( a, b, c
cmplx *c;
{
double y, p, q, w;
-
-
++
++
y = a->r * a->r + a->i * a->i;
p = b->r * a->r + b->i * a->i;
q = b->i * a->r - b->r * a->i;
-
++
if( y < 1.0 )
{
w = MAXNUM * y;
@@@ -552,6 -588,7 +588,7 @@@ void Cmov( a, b
{
register short *pa, *pb;
int i;
-
++
pa = (short *) a;
pb = (short *) b;
i = 8;
@@@ -562,6 -601,7 +601,7 @@@
void Cneg( a )
register cmplx *a;
{
-
++
a->r = -a->r;
a->i = -a->i;
}
@@@ -610,43 -654,54 +654,54 @@@ double Cabs( z
{
double x, y, b, re, im;
int ex, ey, e;
-
++
#ifdef INFINITIES
/* Note, Cabs(INFINITY,NAN) = INFINITY. */
if( z->r == INFINITY || z->i == INFINITY
|| z->r == -INFINITY || z->i == -INFINITY )
return( INFINITY );
#endif
-
++
#ifdef NANS
if( isnan(z->r) )
return(z->r);
if( isnan(z->i) )
return(z->i);
#endif
-
++
re = fabs( z->r );
im = fabs( z->i );
-
++
if( re == 0.0 )
return( im );
if( im == 0.0 )
return( re );
-
++
/* Get the exponents of the numbers */
x = frexp( re, &ex );
y = frexp( im, &ey );
-
++
/* Check if one number is tiny compared to the other */
e = ex - ey;
if( e > PREC )
return( re );
if( e < -PREC )
return( im );
-
++
/* Find approximate exponent e of the geometric mean. */
e = (ex + ey) >> 1;
-
++
/* Rescale so mean is about 1 */
x = ldexp( re, -e );
y = ldexp( im, -e );
-
++
/* Hypotenuse of the right triangle */
b = sqrt( x * x + y * y );
-
++
/* Compute the exponent of the answer. */
y = frexp( b, &ey );
ey = e + ey;
-
++
/* Check it for overflow and underflow. */
if( ey > MAXEXP )
{
@@@ -655,6 -710,7 +710,7 @@@
}
if( ey < MINEXP )
return(0.0);
-
++
/* Undo the scaling */
b = ldexp( b, e );
return( b );
@@@ -710,8 -768,10 +768,10 @@@ void Csqrt( z, w
{
cmplx q, s;
double x, y, r, t;
-
++
x = z->r;
y = z->i;
-
++
if( y == 0.0 )
{
if( x < 0.0 )
@@@ -727,6 -787,8 +787,8 @@@
return;
}
}
-
-
++
++
if( x == 0.0 )
{
r = fabs(y);
@@@ -738,6 -800,7 +800,7 @@@
w->i = r;
return;
}
-
++
/* Approximate sqrt(x^2+y^2) - x = y^2/2x - y^4/24x^3 + ... .
* The relative error in the first term is approximately y^2/12x^2 .
*/
@@@ -751,6 -814,7 +814,7 @@@
r = Cabs(z);
t = 0.5*(r - x);
}
-
++
r = sqrt(t);
q.i = r;
q.r = y/(2.0*r);
@@@ -764,6 -830,7 +830,7 @@@ double hypot( x, y
double x, y;
{
cmplx z;
-
++
z.r = x;
z.i = y;
return( Cabs(&z) );
@@@ -825,6 -896,7 +896,7 @@@ double ellik( phi, m
{
double a, b, c, e, temp, t, K;
int d, mod, sign, npio2;
-
++
if( m == 0.0 )
return( phi );
a = 1.0 - m;
@@@ -874,6 -946,7 +946,7 @@@
c = sqrt(m);
d = 1;
mod = 0;
-
++
while( fabs(c/a) > MACHEP )
{
temp = b/a;
@@@ -886,7 -959,9 +959,9 @@@
b = temp;
d += d;
}
-
++
temp = (atan(t) + mod * PI)/(d * a);
-
++
done:
if( sign < 0 )
temp = -temp;
@@@ -978,6 -1059,7 +1059,7 @@@ extern double log ( double )
double ellpe(x)
double x;
{
-
++
if( (x <= 0.0) || (x > 1.0) )
{
if( x == 0.0 )
@@@ -1043,8 -1125,12 +1125,12 @@@
* Accuracy deteriorates when u is large.
*
*/
-
++
/* ellpj.c */
+
+
extern double PIO2, MACHEP;
+
int ellpj( u, m, sn, cn, dn, ph )
double u, m;
double *sn, *cn, *dn, *ph;
@@@ -1052,7 -1138,10 +1138,10 @@@
double ai, b, phi, t, twon;
double a[9], c[9];
int i;
-
-
++
++
/* Check for special cases */
-
++
if( m < 0.0 || m > 1.0 )
{
mtherr( "ellpj", DOMAIN );
@@@ -1073,6 -1162,7 +1162,7 @@@
*dn = 1.0 - 0.5*m*t*t;
return(0);
}
-
++
if( m >= 0.9999999999 )
{
ai = 0.25 * (1.0-m);
@@@ -1087,12 -1177,15 +1177,15 @@@
*dn = phi + ai * (twon + u);
return(0);
}
-
-
++
++
/* A. G. M. scale */
a[0] = 1.0;
b = sqrt(1.0 - m);
c[0] = sqrt(m);
twon = 1.0;
i = 0;
-
++
while( fabs(c[i]/a[i]) > MACHEP )
{
if( i > 7 )
@@@ -1108,7 -1201,9 +1201,9 @@@
b = t;
twon *= 2.0;
}
-
++
done:
-
++
/* backward recurrence */
phi = twon * a[i] * u;
do
@@@ -1118,6 -1213,7 +1213,7 @@@
phi = (asin(t) + phi)/2.0;
}
while( --i );
-
++
*sn = sin(phi);
t = cos(phi);
*cn = t;
@@@ -1180,7 -1276,11 +1276,11 @@@
* ellpk domain x<0, x>1 0.0
*
*/
-
++
/* ellpk.c */
+
+
+
static double P_ellpk[] =
{
1.37982864606273237150E-4,
@@@ -1217,11 -1320,13 +1320,13 @@@ extern double MACHEP, MAXNUM
double ellpk(x)
double x;
{
-
++
if( (x < 0.0) || (x > 1.0) )
{
mtherr( "ellpk", DOMAIN );
return( 0.0 );
}
-
++
if( x > MACHEP )
{
return( polevl(x,P_ellpk,10) - log(x) * polevl(x,Q_ellpk,10) );
@@@ -1290,8 -1395,12 +1395,12 @@@
* mconf.h
*
*/
-
++
+
#include <stdio.h>
+
int merror = 0;
+
/* Notice: the order of appearance of the following
* messages is bound to the error codes defined
* in mconf.h.
@@@ -1309,19 -1420,23 +1420,23 @@@ int mtherr( name, code
char *name;
int code;
{
-
++
/* Display string passed by calling program,
* which is supposed to be the name of the
* function in which the error occurred:
*/
ellf_debugf ( "\n%s ", name );
-
++
/* Set global error message word */
merror = code;
-
++
/* Display error message defined
* by the code argument.
*/
if( (code <= 0) || (code >= 7) )
code = 0;
ellf_debugf ( "%s error\n", ermsg[code] );
-
++
/* Return to calling
* program
*/
@@@ -1372,6 -1487,8 +1487,8 @@@
* program in microcode or assembly language.
*
*/
-
++
+
double polevl( x, coef, N )
double x;
double coef[];
@@@ -1380,14 -1497,18 +1497,18 @@@
double ans;
int i;
double *p;
-
++
p = coef;
ans = *p++;
i = N;
-
++
do
ans = ans * x + *p++;
while( --i );
-
++
return( ans );
}
+
/* p1evl() */
/* N
* Evaluate polynomial when coefficient of x is 1.0.
@@@ -1401,12 -1523,15 +1523,15 @@@ double p1evl( x, coef, N
double ans;
double *p;
int i;
-
++
p = coef;
ans = x + *p++;
i = N-1;
-
++
do
ans = ans * x + *p++;
while( --i );
-
++
return( ans );
}
/* === polevl.c - end === */
@@@ -1530,8 -1667,10 +1667,10 @@@ int zplnb ( void )
int zplnc ( void );
int quadf ( double, double, int );
double response ( double, double );
+
#define MIN(a,b) ((a) <= (b) ? (a) : (b))
#define MAX(a,b) ((a) >= (b) ? (a) : (b))
-
++
static void
print_z_fraction_before_zplnc (void) /* must be called *before* zplnc() */
{
@@@ -1540,6 -1679,7 +1679,7 @@@
zgain = 1.0;
else
zgain = an / (pn * scale);
-
++
const char *kind_string = kind == 1 ? "BSE_IIR_FILTER_BUTTERWORTH" : kind == 2 ?
"BSE_IIR_FILTER_CHEBYSHEV1" : "BSE_IIR_FILTER_ELLIPTIC";
const char *type_string = (type == 1 ? "BSE_IIR_FILTER_LOW_PASS" : type == 2 ? "BSE_IIR_FILTER_BAND_PASS"
:
type == 3 ? "BSE_IIR_FILTER_HIGH_PASS" : "BSE_IIR_FILTER_BAND_STOP");
@@@ -1631,6 -1776,7 +1776,7 @@@ generate_filters_brute_force (void
max_order_index = filter_orders[oix] ? oix : max_order_index;
int rand_order_width = (32 - filter_orders[max_order_index]);
double pbe1;
-
++
#if 1
einput.kind = BUTTERWORTH;
for (oix = 0; oix < n_orders; oix++)
@@@ -1652,6 -1798,7 +1798,7 @@@
}
}
#endif
-
++
#if 1
einput.kind = CHEBYSHEV;
for (oix = 0; oix < n_orders; oix++)
@@@ -1675,6 -1822,7 +1822,7 @@@
}
}
#endif
-
++
#if 1
einput.kind = ELLIPTIC;
for (oix = 0; oix < n_orders; oix++)
@@@ -1713,6 -1862,7 +1862,7 @@@ main (int argc
srand48 (tv.tv_usec + (tv.tv_sec << 16));
srand (lrand48());
}
-
++
if (argc >= 2 && strcmp (argv[1], "--test-code") == 0)
{
generate_filters_brute_force();
@@@ -1728,7 -1879,9 +1879,9 @@@ in
getnum (char *line, double *val, const double *einput)
{
char s[40];
-
++
ellf_debugf ( "%s = %.9E ? ", line, *val );
+
if (einput)
{
*val = *einput;
@@@ -1748,8 -1903,11 +1903,11 @@@ static voi
main_ellf (const EllfInput *einput)
{
char str[80];
-
++
dbfac = 10.0/log(10.0);
-
++
top:
-
++
ellf_debugf ( "%s ? ", wkind ); /* ask for filter kind */
if (einput)
kind = einput->kind;
@@@ -1762,6 -1920,7 +1920,7 @@@
ellf_debugf ( "%d\n", kind );
if( (kind <= 0) || (kind > 3) )
exit(0);
-
++
ellf_debugf ( "%s ? ", salut ); /* ask for filter type */
if (einput)
type = einput->type;
@@@ -1774,6 -1933,7 +1933,7 @@@
ellf_debugf ( "%d\n", type );
if( (type <= 0) || (type > 4) )
exit(0);
-
++
getnum( "Order of filter", &rn, einput ? &einput->order : NULL); /* see below for getnum() */
n = rn;
if( n <= 0 )
@@@ -1799,6 -1959,7 +1959,7 @@@
{
/* For Chebyshev filter, ripples go from 1.0 to 1/sqrt(1+eps^2) */
phi = exp( 0.5*dbr/dbfac );
-
++
if( (n & 1) == 0 )
scale = phi;
else
@@@ -1813,13 -1974,16 +1974,16 @@@
eps = sqrt( eps - 1.0 );
}
}
-
++
getnum( "Sampling frequency", &fs, einput ? &einput->sampling_frequency : NULL);
if( fs <= 0.0 )
{
ellf_debugf ("? Need sampling-frequency > 0\n");
goto specerr;
}
-
++
fnyq = 0.5 * fs;
-
++
getnum( "Passband edge", &f2, einput ? &einput->passband_edge : NULL);
if( (f2 <= 0.0))
{
@@@ -1831,6 -1995,7 +1995,7 @@@
ellf_debugf ("? Need passband-edge < nyquist frequency (%f)\n", fnyq);
goto specerr;
}
-
++
if( (type & 1) == 0 )
{
getnum( "Other passband edge", &f1, einput ? &einput->passband_edge2 : NULL);
@@@ -1849,6 -2014,7 +2014,7 @@@
{
f1 = 0.0;
}
-
++
if( f2 < f1 )
{
a = f2;
@@@ -1879,6 -2045,8 +2045,8 @@@
wc = c;
/*ellf_debugf( "cos( 1/2 (Whigh-Wlow) T ) = %.5e, wc = %.5e\n", cang, wc );*/
}
-
-
++
++
if( kind == 3 )
{ /* elliptic */
cgam = cos( (a+f1) * PI / fs ) / cang;
@@@ -1921,11 -2089,13 +2089,13 @@@
goto specerr;
}
break;
-
++
case 2:
if( (f3 > f2) || (f3 < f1) )
break;
ellf_debugf ("? Need stopband_edge < passband_edge or stopband_edge > passband_edge2\n");
goto specerr;
-
++
case 3:
if( f3 >= f2 )
{
@@@ -1933,6 -2103,7 +2103,7 @@@
goto specerr;
}
break;
-
++
case 4:
if( (f3 <= f1) || (f3 >= f2) )
{
@@@ -1944,6 -2115,7 +2115,7 @@@
ang = f3 * PI / fs;
cang = cos(ang);
sang = sin(ang);
-
++
if( type & 1 )
{
wr = sang/(cang*c);
@@@ -1955,6 -2127,7 +2127,7 @@@
cang = q;
wr = (cgam - cang)/(sang * c);
}
-
++
if( type >= 3 )
wr = 1.0/wr;
if( wr < 0.0 )
@@@ -1962,8 -2135,10 +2135,10 @@@
y[0] = 1.0;
y[1] = wr;
cbp = wr;
-
++
if( type >= 3 )
y[1] = 1.0/y[1];
-
++
if( type & 1 )
{
for( i=1; i<=2; i++ )
@@@ -1995,6 -2170,7 +2170,7 @@@
if( (2*n+2) > ARRSIZ )
goto toosml;
}
-
++
/* Transformation from low-pass to band-pass critical frequencies
*
* Center frequency
@@@ -2008,6 -2184,7 +2184,7 @@@
* Wanalog = -----------------------------------
* sin( Wdigital T )
*/
-
++
if( kind == 2 )
{ /* Chebyshev */
a = PI * (a+f1) / fs ;
@@@ -2023,13 -2200,17 +2200,17 @@@
cbp = (cgam - cos(a))/sin(a);
scale = 1.0;
}
-
++
ellf_debugf ("State: gain_scale=%.20g ripple_epsilon=%.20g nyquist_frequency=%.20g " // BSE info
"tan_angle_frequency=%.20g stopband_edge=%.20g wc=%.20g wr=%.20g cgam=%.20g\n",
scale, eps, fnyq,
c, f3, wc, wr, cgam);
-
++
spln(); /* find s plane poles and zeros */
-
++
if( ((type & 1) == 0) && ((4*n+2) > ARRSIZ) )
goto toosml;
-
++
zplna(); /* convert s plane to z plane */
zplnb();
ellf_debugf ("an=%.20g pn=%.20g scale=%.20g\n", an, pn, scale); // BSE info
@@@ -2040,6 -2221,7 +2221,7 @@@
return;
else
goto top;
-
++
toosml:
ellf_debugf ( "Cannot continue, storage arrays too small\n" );
if (einput)
@@@ -2047,8 -2229,10 +2229,10 @@@
else
goto top;
}
+
int lampln()
{
-
++
wc = 1.0;
k = wc/wr;
m = k * k;
@@@ -2285,15 -2479,18 +2479,18 @@@ double cay(q
{
double a, b, p, r;
double t1, t2;
-
++
a = 1.0;
b = 1.0;
r = 1.0;
p = q;
-
++
do
{
r *= p;
a += 2.0 * r;
t1 = fabs( r/a );
-
++
r *= p;
b += r;
p *= q;
@@@ -2302,6 -2499,7 +2499,7 @@@
t1 = t2;
}
while( t1 > MACHEP );
-
++
a = b/a;
a = 4.0 * sqrt(q) * a * a; /* see above formulas, solved for m */
return(a);
@@@ -2314,18 -2518,22 +2518,22 @@@ int zplna(
{
cmplx r, cnum, cden, cwc, ca, cb, b4ac;
double C;
-
++
if( kind == 3 )
C = c;
else
C = wc;
-
++
for( i=0; i<ARRSIZ; i++ )
{
z[i].r = 0.0;
z[i].i = 0.0;
}
-
++
nc = np;
jt = -1;
ii = -1;
-
++
for( icnt=0; icnt<2; icnt++ )
{
/* The maps from s plane to z plane */
@@@ -2335,6 -2543,7 +2543,7 @@@
ii = ir + 1;
r.r = zs[ir];
r.i = zs[ii];
-
++
switch( type )
{
case 1:
@@@ -2361,6 -2570,7 +2570,7 @@@
z[jt].i = -z[jt-1 ].i;
}
break;
-
++
case 2:
case 4:
/* Substitute s - r => s/wc - r
@@@ -2421,6 -2631,7 +2631,7 @@@
} /* end switch */
}
while( --nc > 0 );
-
++
if( icnt == 0 )
{
zord = jt+1;
@@@ -2439,8 -2654,10 +2654,10 @@@
int zplnb()
{
cmplx lin[2];
-
++
lin[1].r = 1.0;
lin[1].i = 0.0;
-
++
if( kind != 3 )
{ /* Butterworth or Chebyshev */
/* generate the remaining zeros */
@@@ -2478,6 -2695,7 +2695,7 @@@
}
}
ellf_debugf ( "order = %d\n", zord );
-
++
/* Expand the poles and zeros into numerator and
* denominator polynomials
*/
@@@ -2515,8 -2733,10 +2733,10 @@@
{
case 3:
a = -1.0;
-
++
case 1:
case 4:
-
++
pn = 1.0;
an = 1.0;
for( j=1; j<=zord; j++ )
@@@ -2525,6 -2745,7 +2745,7 @@@
an = a * an + aa[j];
}
break;
-
++
case 2:
gam = PI/2.0 - asin( cgam ); /* = acos( cgam ) */
mh = zord/2;
@@@ -2549,14 -2770,17 +2770,17 @@@
}
return 0;
}
+
int zplnc()
{
-
++
gain = an/(pn*scale);
if( (kind != 3) && (pn == 0) )
gain = 1.0;
ellf_printf( "constant gain factor %23.13E\n", gain );
for( j=0; j<=zord; j++ )
pp[j] = gain * pp[j];
-
++
ellf_printf( "z plane Denominator Numerator\n" );
for( j=0; j<=zord; j++ )
{
@@@ -2593,6 -2822,7 +2822,7 @@@ int quadf( x, y, pzflg
int pzflg; /* 1 if poles, 0 if zeros */
{
double a, b, r, f, g, g0;
-
++
if( y > 1.0e-16 )
{
a = -2.0 * x;
@@@ -2625,6 -2855,7 +2855,7 @@@
g = 1.0 - a;
g0 = 1.0 + a;
}
-
++
if( pzflg )
{
if( g != 0.0 )
@@@ -2645,6 -2879,7 +2879,7 @@@ voi
print_filter_table (void)
{
double f, limit = 0.05 * fnyq * 21;
-
++
for (f=0; f < limit; f += limit / 21.)
{
double r = response( f, gain );
@@@ -2665,10 -2902,12 +2902,12 @@@ double response( f, amp
cmplx x, num, den, w;
double u;
int j;
-
++
/* exp( j omega T ) */
u = 2.0 * PI * f /fs;
x.r = cos(u);
x.i = sin(u);
-
++
num.r = 1.0;
num.i = 0.0;
den.r = 1.0;
diff --cc sfi/glib-extra.cc
index cc691c6,edd5133..38e8174
--- a/sfi/glib-extra.cc
+++ b/sfi/glib-extra.cc
@@@ -551,7 -609,9 +609,9 @@@ gpointe
g_slist_pop_head (GSList **slist_p)
{
gpointer data;
-
++
g_return_val_if_fail (slist_p != NULL, NULL);
-
++
if (!*slist_p)
return NULL;
data = (*slist_p)->data;
@@@ -904,25 -1008,32 +1008,32 @@@ g_usignal_prepare (gpointer source_dat
gpointer user_data)
{
GUSignalData *usignal_data = source_data;
-
++
return usignals_notified[usignal_data->index] & (1 << usignal_data->shift);
}
+
static gboolean
g_usignal_check (gpointer source_data,
GTimeVal *current_time,
gpointer user_data)
{
GUSignalData *usignal_data = source_data;
-
++
return usignals_notified[usignal_data->index] & (1 << usignal_data->shift);
}
+
static gboolean
g_usignal_dispatch (gpointer source_data,
GTimeVal *dispatch_time,
gpointer user_data)
{
GUSignalData *usignal_data = source_data;
-
++
usignals_notified[usignal_data->index] &= ~(1 << usignal_data->shift);
-
++
return usignal_data->callback (-128 + usignal_data->index * 32 + usignal_data->shift, user_data);
}
+
guint
g_usignal_add (gint8 usignal,
GUSignalFunc function,
@@@ -939,20 -1051,26 +1051,26 @@@ g_usignal_add_full (gint prio
{
GUSignalData *usignal_data;
guint s = 128 + usignal;
-
++
g_return_val_if_fail (function != NULL, 0);
-
++
usignal_data = g_new (GUSignalData, 1);
usignal_data->index = s / 32;
usignal_data->shift = s % 32;
usignal_data->callback = function;
-
++
return g_source_add (priority, TRUE, &usignal_funcs, usignal_data, data, destroy);
}
+
void
g_usignal_notify (gint8 usignal)
{
guint index, shift;
guint s = 128 + usignal;
-
++
index = s / 32;
shift = s % 32;
-
++
usignals_notified[index] |= 1 << shift;
}
#endif
diff --cc sfi/glib-extra.hh
index 5dc33dd,7bae16d..dc1c182
--- a/sfi/glib-extra.hh
+++ b/sfi/glib-extra.hh
@@@ -266,28 -303,35 +303,31 @@@ GScanner* g_scanner_new64 (const GSca
#define g_scanner_freeze_symbol_table(scanner) ((void)0)
#define g_scanner_thaw_symbol_table(scanner) ((void)0)
#endif /* G_DISABLE_DEPRECATED */
+
+
G_END_DECLS
+
// == Flags Enumeration Operators in C++ ==
#ifdef __cplusplus
-inline GParamFlags operator& (GParamFlags s1, GParamFlags s2) { return GParamFlags (s1 & (long long
unsigned) s2); }
-inline GParamFlags& operator&= (GParamFlags &s1, GParamFlags s2) { s1 = s1 & s2; return s1; }
-inline GParamFlags operator| (GParamFlags s1, GParamFlags s2) { return GParamFlags (s1 | (long long
unsigned) s2); }
-inline GParamFlags& operator|= (GParamFlags &s1, GParamFlags s2) { s1 = s1 | s2; return s1; }
-inline GParamFlags operator~ (GParamFlags s1) { return GParamFlags (~(long long
unsigned) s1); }
-
-inline GSignalMatchType operator& (GSignalMatchType s1, GSignalMatchType s2) { return GSignalMatchType
(s1 & (long long unsigned) s2); }
-inline GSignalMatchType& operator&= (GSignalMatchType &s1, GSignalMatchType s2) { s1 = s1 & s2; return s1; }
-inline GSignalMatchType operator| (GSignalMatchType s1, GSignalMatchType s2) { return GSignalMatchType
(s1 | (long long unsigned) s2); }
-inline GSignalMatchType& operator|= (GSignalMatchType &s1, GSignalMatchType s2) { s1 = s1 | s2; return s1; }
-inline GSignalMatchType operator~ (GSignalMatchType s1) { return GSignalMatchType
(~(long long unsigned) s1); }
-
-inline GSignalFlags operator& (GSignalFlags s1, GSignalFlags s2) { return GSignalFlags (s1 & (long long
unsigned) s2); }
-inline GSignalFlags& operator&= (GSignalFlags &s1, GSignalFlags s2) { s1 = s1 & s2; return s1; }
-inline GSignalFlags operator| (GSignalFlags s1, GSignalFlags s2) { return GSignalFlags (s1 | (long long
unsigned) s2); }
-inline GSignalFlags& operator|= (GSignalFlags &s1, GSignalFlags s2) { s1 = s1 | s2; return s1; }
-inline GSignalFlags operator~ (GSignalFlags s1) { return GSignalFlags (~(long long
unsigned) s1); }
-
-inline GConnectFlags operator& (GConnectFlags s1, GConnectFlags s2) { return GConnectFlags (s1 & (long
long unsigned) s2); }
-inline GConnectFlags& operator&= (GConnectFlags &s1, GConnectFlags s2) { s1 = s1 & s2; return s1; }
-inline GConnectFlags operator| (GConnectFlags s1, GConnectFlags s2) { return GConnectFlags (s1 | (long
long unsigned) s2); }
-inline GConnectFlags& operator|= (GConnectFlags &s1, GConnectFlags s2) { s1 = s1 | s2; return s1; }
-inline GConnectFlags operator~ (GConnectFlags s1) { return GConnectFlags (~(long long
unsigned) s1); }
+constexpr GParamFlags operator& (GParamFlags s1, GParamFlags s2) { return GParamFlags (s1 & (long long
unsigned) s2); }
+inline GParamFlags& operator&= (GParamFlags &s1, GParamFlags s2) { s1 = s1 & s2; return s1; }
+constexpr GParamFlags operator| (GParamFlags s1, GParamFlags s2) { return GParamFlags (s1 | (long long
unsigned) s2); }
+inline GParamFlags& operator|= (GParamFlags &s1, GParamFlags s2) { s1 = s1 | s2; return s1; }
+constexpr GParamFlags operator~ (GParamFlags s1) { return GParamFlags (~(long long
unsigned) s1); }
+constexpr GSignalMatchType operator& (GSignalMatchType s1, GSignalMatchType s2) { return
GSignalMatchType (s1 & (long long unsigned) s2); }
+inline GSignalMatchType& operator&= (GSignalMatchType &s1, GSignalMatchType s2) { s1 = s1 & s2; return
s1; }
+constexpr GSignalMatchType operator| (GSignalMatchType s1, GSignalMatchType s2) { return
GSignalMatchType (s1 | (long long unsigned) s2); }
+inline GSignalMatchType& operator|= (GSignalMatchType &s1, GSignalMatchType s2) { s1 = s1 | s2; return
s1; }
+constexpr GSignalMatchType operator~ (GSignalMatchType s1) { return GSignalMatchType
(~(long long unsigned) s1); }
+constexpr GSignalFlags operator& (GSignalFlags s1, GSignalFlags s2) { return GSignalFlags (s1 & (long
long unsigned) s2); }
+inline GSignalFlags& operator&= (GSignalFlags &s1, GSignalFlags s2) { s1 = s1 & s2; return s1; }
+constexpr GSignalFlags operator| (GSignalFlags s1, GSignalFlags s2) { return GSignalFlags (s1 | (long
long unsigned) s2); }
+inline GSignalFlags& operator|= (GSignalFlags &s1, GSignalFlags s2) { s1 = s1 | s2; return s1; }
+constexpr GSignalFlags operator~ (GSignalFlags s1) { return GSignalFlags (~(long long
unsigned) s1); }
+constexpr GConnectFlags operator& (GConnectFlags s1, GConnectFlags s2) { return GConnectFlags (s1 &
(long long unsigned) s2); }
+inline GConnectFlags& operator&= (GConnectFlags &s1, GConnectFlags s2) { s1 = s1 & s2; return s1; }
+constexpr GConnectFlags operator| (GConnectFlags s1, GConnectFlags s2) { return GConnectFlags (s1 |
(long long unsigned) s2); }
+inline GConnectFlags& operator|= (GConnectFlags &s1, GConnectFlags s2) { s1 = s1 | s2; return s1; }
+constexpr GConnectFlags operator~ (GConnectFlags s1) { return GConnectFlags (~(long long
unsigned) s1); }
#endif // __cplusplus
-
#endif /* __SFI_GLIB_EXTRA_H__ */
diff --cc sfi/sficomport.cc
index f57cd04,7c72a36..4e78f77
--- a/sfi/sficomport.cc
+++ b/sfi/sficomport.cc
@@@ -37,7 -43,9 +39,9 @@@ nonblock_fd (gint fd
do
d_long = fcntl (fd, F_GETFL);
while (d_long < 0 && errno == EINTR);
-
++
d_long |= O_NONBLOCK;
-
++
do
r = fcntl (fd, F_SETFL, d_long);
while (r < 0 && errno == EINTR);
@@@ -91,24 -103,33 +99,26 @@@ sfi_com_port_from_pipe (const gchar *id
gint remote_output)
{
g_return_val_if_fail (ident != NULL, NULL);
-
++
return sfi_com_port_from_child (ident,
remote_input,
remote_output,
-1);
}
+
void
-sfi_com_port_create_linked (const gchar *ident1,
- BirnetThread *thread1,
- SfiComPort **port1,
- const gchar *ident2,
- BirnetThread *thread2,
- SfiComPort **port2)
+sfi_com_port_create_linked (const gchar *ident1, std::function<void()> wakeup1, SfiComPort **port1,
+ const gchar *ident2, std::function<void()> wakeup2, SfiComPort **port2)
{
SfiComPortLink *link;
-
- g_return_if_fail (thread1 && ident1);
- g_return_if_fail (thread2 && ident2);
+ g_return_if_fail (wakeup1 && ident1);
+ g_return_if_fail (wakeup2 && ident2);
g_return_if_fail (port1 && port2);
-
- link = g_new0 (SfiComPortLink, 1);
- sfi_mutex_init (&link->mutex);
+ link = new SfiComPortLink();
link->port1 = sfi_com_port_from_child (ident1, -1, -1, -1);
- link->thread1 = thread1;
+ link->wakeup1 = wakeup1;
link->port2 = sfi_com_port_from_child (ident2, -1, -1, -1);
- link->thread2 = thread2;
+ link->wakeup2 = wakeup2;
link->ref_count = 2;
link->port1->link = link;
link->port1->connected = TRUE;
@@@ -116,7 -137,9 +126,8 @@@
link->port2->connected = TRUE;
*port1 = link->port1;
*port2 = link->port2;
- sfi_cond_init (&link->wcond);
}
+
static void
sfi_com_port_link_destroy (SfiComPortLink *link)
{
@@@ -126,8 -150,11 +138,9 @@@
sfi_value_free ((GValue*) sfi_ring_pop_head (&link->p1queue));
while (link->p2queue)
sfi_value_free ((GValue*) sfi_ring_pop_head (&link->p2queue));
- sfi_mutex_destroy (&link->mutex);
- sfi_cond_destroy (&link->wcond);
- g_free (link);
+ delete link;
}
+
SfiComPort*
sfi_com_port_ref (SfiComPort *port)
{
@@@ -529,17 -578,20 +562,20 @@@ sfi_com_port_recv_intern (SfiComPort *p
if (blocking && /* flush output buffer if data is pending */
!com_port_write_queued (port))
sfi_com_port_close_remote (port, FALSE);
-
++
if (!port->rvalues)
{
if (!com_port_read_pending (port))
sfi_com_port_close_remote (port, FALSE);
sfi_com_port_deserialize (port);
}
-
++
if (blocking && !port->rvalues && port->pfd[0].fd >= 0)
{
struct timeval tv = { 60, 0, };
fd_set in_fds, out_fds, exp_fds;
gint xfd;
-
++
FD_ZERO (&in_fds);
FD_ZERO (&out_fds);
FD_ZERO (&exp_fds);
@@@ -560,9 -612,10 +596,10 @@@
goto loop_blocking;
}
}
- MASS_DEBUG ("[%s: DONE receiving]", port->ident);
+ CDEBUG ("[%s: DONE receiving]", port->ident);
return port->connected ? (GValue*) sfi_ring_pop_head (&port->rvalues) : NULL;
}
+
GValue*
sfi_com_port_recv (SfiComPort *port)
{
diff --cc sfi/sficomwire.cc
index ea903ba,18028a9..ecfa250
--- a/sfi/sficomwire.cc
+++ b/sfi/sficomwire.cc
@@@ -22,7 -26,9 +26,9 @@@ nonblock_fd (gint fd
do
d_long = fcntl (fd, F_GETFL);
while (d_long < 0 && errno == EINTR);
-
++
d_long |= O_NONBLOCK;
-
++
do
r = fcntl (fd, F_SETFL, d_long);
while (r < 0 && errno == EINTR);
@@@ -38,7 -45,9 +45,9 @@@ sfi_com_wire_from_child (const gchar *i
gint remote_pid)
{
SfiComWire *wire;
-
++
g_return_val_if_fail (ident != NULL, NULL);
-
++
wire = g_new0 (SfiComWire, 1);
if (remote_pid > 1)
wire->ident = g_strdup_printf ("%s[%u]", ident, remote_pid);
@@@ -63,14 -72,17 +72,17 @@@
nonblock_fd (wire->standard_input);
nonblock_fd (wire->standard_output);
nonblock_fd (wire->standard_error);
-
++
return wire;
}
+
SfiComWire*
sfi_com_wire_from_pipe (const gchar *ident,
gint remote_input,
gint remote_output)
{
g_return_val_if_fail (ident != NULL, NULL);
-
++
return sfi_com_wire_from_child (ident,
remote_input,
remote_output,
@@@ -80,15 -93,19 +93,19 @@@ static SfiComMsg
alloc_msg (SfiComMsgType type)
{
SfiComMsg *msg = g_new (SfiComMsg, 1);
-
++
msg->magic = BSE_MAGIC_BSEm;
msg->mlength = 0;
msg->type = type;
-
++
return msg;
}
+
static gchar*
free_msg_skel (SfiComMsg *msg)
{
gchar *content = msg->message;
-
++
g_free (msg);
return content;
}
@@@ -101,17 -120,21 +120,21 @@@ static voi
wire_write_remote (SfiComWire *wire)
{
guint8 *buf = wire->obuffer;
-
++
if (wire->obp - buf && wire->remote_output >= 0)
{
gint n;
-
++
do
{
n = write (wire->remote_output, buf, wire->obp - buf);
buf += MAX (n, 0);
}
while (n < 0 && errno == EINTR);
-
++
if (n == 0 || (n < 0 && errno != EINTR && errno != EAGAIN))
wire->remote_output_broke = TRUE;
-
++
n = wire->obp - buf;
g_memmove (wire->obuffer, buf, n);
wire->obp = wire->obuffer + n;
@@@ -130,7 -155,9 +155,9 @@@ wire_send (SfiComWire *wire
SfiComMsg *msg)
{
guint strl;
-
++
g_return_if_fail (msg->mlength == 0);
-
++
strl = strlen (msg->message) + 1; /* include trailing 0 */
msg->mlength = (4 + /* magic */
4 + /* mlength */
@@@ -159,6 -187,7 +187,7 @@@ wire_read_remote (SfiComWire *wire
{
guint read_size = 8192;
gint n;
-
++
if (wire->ibound - wire->ibp < read_size)
{
guint l = wire->ibp - wire->ibuffer;
@@@ -166,12 -195,14 +195,14 @@@
wire->ibp = wire->ibuffer + l;
wire->ibound = wire->ibp + read_size;
}
-
++
do
{
n = read (wire->remote_input, wire->ibp, wire->ibound - wire->ibp);
wire->ibp += MAX (n, 0);
}
while (n < 0 && errno == EINTR);
-
++
/* n==0 on pipes/fifos means remote closed the connection (end-of-file) */
if (n == 0 || (n < 0 && errno != EINTR && errno != EAGAIN))
wire->remote_input_broke = TRUE;
@@@ -190,11 -223,13 +223,13 @@@ static voi
wire_receive (SfiComWire *wire)
{
wire_read_remote (wire);
-
++
if (wire->ibp >= wire->ibuffer + 4 + 4 + 4) /* magic + mlength + type */
{
guint8 *p = wire->ibuffer;
guint32 magic, mlength, type;
guint mheader_length = 4 + 4 + 4 + 4, max_mlength = 4 * 1024 * 1024;
-
++
p = get_uint32 (p, &magic);
p = get_uint32 (p, &mlength);
p = get_uint32 (p, &type);
@@@ -214,6 -249,7 +249,7 @@@
else if (mlength <= wire->ibp - wire->ibuffer)
{
guint strl = mlength - mheader_length; /* >= 1 */
-
++
switch (type)
{
SfiComMsg *msg;
@@@ -322,38 -365,50 +365,50 @@@ static guin
wire_alloc_request (SfiComWire *wire)
{
guint request = (rand () << 16) ^ rand ();
-
++
while (request == 0 || wire_find_link (wire->orequests, request))
request++;
-
++
return request;
}
+
guint
sfi_com_wire_send_request (SfiComWire *wire,
const gchar *request_msg)
{
SfiComMsg *msg;
guint request;
-
++
g_return_val_if_fail (wire != NULL, 0);
g_return_val_if_fail (request_msg != NULL, 0);
-
++
request = wire_alloc_request (wire);
msg = alloc_msg (SFI_COM_MSG_REQUEST);
msg->request = request;
msg->message = g_strdup (request_msg);
-
++
wire->orequests = g_list_prepend (wire->orequests, msg);
wire_send (wire, msg);
-
++
wire_update_alive (wire);
-
++
return request;
}
+
gchar*
sfi_com_wire_receive_result (SfiComWire *wire,
guint request)
{
GList *out_link, *in_link;
-
++
g_return_val_if_fail (wire != NULL, NULL);
g_return_val_if_fail (request > 0, NULL);
out_link = wire_find_link (wire->orequests, request);
g_return_val_if_fail (out_link != NULL, NULL);
-
++
wire_receive (wire);
wire_update_alive (wire);
-
++
in_link = wire_find_link (wire->iresults, request);
if (in_link)
{
@@@ -408,6 -472,7 +472,7 @@@ sfi_com_wire_receive_request (SfiComWir
}
wire->rrequests = g_list_prepend (wire->rrequests, msg);
*request_p = msg->request;
-
++
return msg->message;
}
else
@@@ -423,6 -489,7 +489,7 @@@ sfi_com_wire_send_result (SfiComWire *
{
SfiComMsg *msg;
GList *received_link;
-
++
g_return_if_fail (wire != NULL);
g_return_if_fail (request > 0);
g_return_if_fail (result_msg != NULL);
@@@ -467,6 -543,7 +543,7 @@@ sfi_com_wire_set_dispatcher (SfiComWir
GDestroyNotify destroy_data)
{
g_return_if_fail (wire != NULL);
-
++
if (wire->destroy_data)
wire->destroy_data (wire->dispatch_data);
if (dispatch_func)
@@@ -501,20 -582,24 +582,24 @@@ gboolea
sfi_com_wire_need_dispatch (SfiComWire *wire)
{
g_return_val_if_fail (wire != NULL, FALSE);
-
++
return wire->iresults || wire->irequests || wire->gstring_stdout->len || wire->gstring_stderr->len;
}
+
gint*
sfi_com_wire_get_read_fds (SfiComWire *wire,
guint *n_fds_p)
{
g_return_val_if_fail (wire != NULL, NULL);
g_return_val_if_fail (n_fds_p != NULL, NULL);
-
++
if (wire->remote_input >= 0 ||
wire->standard_output >= 0 ||
wire->standard_error >= 0)
{
guint n_fds = 0;
gint *fds = g_new (gint, 3);
-
++
if (wire->remote_input >= 0)
fds[n_fds++] = wire->remote_input;
if (wire->standard_output >= 0)
@@@ -536,10 -622,12 +622,12 @@@ sfi_com_wire_get_write_fds (SfiComWire
{
g_return_val_if_fail (wire != NULL, NULL);
g_return_val_if_fail (n_fds_p != NULL, NULL);
-
++
if (wire->obp - wire->obuffer && wire->remote_output >= 0)
{
guint n_fds = 0;
gint *fds = g_new (gint, 1);
-
++
fds[n_fds++] = wire->remote_output;
*n_fds_p = n_fds;
return fds;
@@@ -556,6 -645,7 +645,7 @@@ sfi_com_wire_get_poll_fds (SfiComWire *
{
g_return_val_if_fail (wire != NULL, NULL);
g_return_val_if_fail (n_pfds_p != NULL, NULL);
-
++
if (wire->remote_input >= 0 ||
wire->standard_output >= 0 ||
wire->standard_error >= 0 ||
@@@ -563,6 -653,7 +653,7 @@@
{
guint n_pfds = 0;
GPollFD *pfds = g_new0 (GPollFD, 3 + 1);
-
++
if (wire->remote_input >= 0)
{
pfds[n_pfds].fd = wire->remote_input;
@@@ -599,10 -691,12 +691,12 @@@ voi
sfi_com_wire_process_io (SfiComWire *wire)
{
g_return_if_fail (wire != NULL);
-
++
wire_capture (wire);
wire_write_remote (wire);
wire_read_remote (wire);
wire_capture (wire);
-
++
if (wire->remote_input_broke)
{
if (wire->remote_input >= 0)
@@@ -639,6 -734,7 +734,7 @@@ sfi_com_wire_close_remote (SfiComWire *
gboolean terminate)
{
g_return_if_fail (wire != NULL);
-
++
wire->connected = FALSE;
if (wire->remote_input >= 0)
close (wire->remote_input);
@@@ -663,7 -760,9 +760,9 @@@ voi
sfi_com_wire_destroy (SfiComWire *wire)
{
GList *list;
-
++
g_return_if_fail (wire != NULL);
-
++
sfi_com_wire_set_dispatcher (wire, NULL, NULL, NULL);
sfi_com_wire_close_remote (wire, TRUE);
for (list = wire->orequests; list; list = list->next)
@@@ -689,7 -789,9 +789,9 @@@ gboolea
sfi_com_wire_receive_dispatch (SfiComWire *wire)
{
guint request;
-
++
g_return_val_if_fail (wire != NULL, FALSE);
-
++
if (sfi_com_wire_receive_request (wire, &request))
{
sfi_com_wire_dispatch (wire, request);
@@@ -717,6 -823,7 +823,7 @@@ sfi_com_wire_select (SfiComWire *wire
max_fd = MAX (max_fd, fds[i]);
}
g_free (fds);
-
++
fds = sfi_com_wire_get_write_fds (wire, &n);
for (i = 0; i < n; i++)
{
@@@ -725,6 -832,7 +832,7 @@@
max_fd = MAX (max_fd, fds[i]);
}
g_free (fds);
-
++
tv.tv_usec = (timeout % 1000) * 1000;
tv.tv_sec = timeout / 1000;
select (max_fd + 1, &rfds, &wfds, NULL, &tv);
@@@ -736,32 -845,39 +845,39 @@@ sfi_com_wire_ping_pong (SfiComWire *wi
{
guint request;
gchar *pong;
-
++
g_return_val_if_fail (wire != NULL, NULL);
g_return_val_if_fail (ping != NULL, NULL);
-
++
request = sfi_com_wire_send_request (wire, ping);
pong = sfi_com_wire_receive_result (wire, request);
if (pong)
return pong;
-
++
sfi_com_wire_select (wire, timeout / 4);
sfi_com_wire_process_io (wire);
pong = sfi_com_wire_receive_result (wire, request);
if (pong)
return pong;
-
++
sfi_com_wire_select (wire, timeout / 4);
sfi_com_wire_process_io (wire);
pong = sfi_com_wire_receive_result (wire, request);
if (pong)
return pong;
-
++
sfi_com_wire_select (wire, timeout / 4);
sfi_com_wire_process_io (wire);
pong = sfi_com_wire_receive_result (wire, request);
if (pong)
return pong;
-
++
sfi_com_wire_select (wire, timeout / 4);
sfi_com_wire_process_io (wire);
pong = sfi_com_wire_receive_result (wire, request);
if (pong)
return pong;
-
++
sfi_com_wire_forget_request (wire, request);
return NULL;
}
@@@ -777,6 -897,7 +897,7 @@@ static voi
unset_cloexec (gint fd)
{
gint r;
-
++
do
r = fcntl (fd, F_SETFD, 0 /* FD_CLOEXEC */);
while (r < 0 && errno == EINTR);
diff --cc sfi/sficomwire.hh
index 9b6dfab,efaa4cc..8438d09
--- a/sfi/sficomwire.hh
+++ b/sfi/sficomwire.hh
@@@ -21,6 -25,7 +25,7 @@@ struct _SfiComWir
guint standard_input_broke : 1;
guint standard_output_broke : 1;
guint standard_error_broke : 1;
-
++
SfiComDispatch dispatch_func;
gpointer dispatch_data;
GDestroyNotify destroy_data;
diff --cc sfi/sfidl-cbase.cc
index fd51c7c,195dfa5..1fe55fa
--- a/sfi/sfidl-cbase.cc
+++ b/sfi/sfidl-cbase.cc
@@@ -30,6 -35,7 +35,7 @@@ CodeGeneratorCBase::makeParamSpec(cons
{
String pspec;
const String group = (pdef.group != "") ? pdef.group.escaped() : "NULL";
-
++
switch (parser.typeOf (pdef.type))
{
case CHOICE:
@@@ -241,6 -257,7 +257,7 @@@ String CodeGeneratorCBase::createTypeCo
case MODEL_FROM_VALUE: g_assert (name != ""); break;
// how to convert the "type" called "name" to a GValue*
case MODEL_TO_VALUE: g_assert (name != ""); break;
-
++
/*
* vcall interface: the following models deal with how to perform a
* method/procedure invocation using a given data type
@@@ -457,6 -481,7 +481,7 @@@ void CodeGeneratorCBase::printProcedur
{
vector<Param>::const_iterator pi;
String dname, mname = makeProcName (className, mdef.name);
-
++
if (className == "")
{
dname = makeLowerName(mdef.name, '-');
diff --cc sfi/sfidl-cbase.hh
index eda0c79,cd00ed8..3080342
--- a/sfi/sfidl-cbase.hh
+++ b/sfi/sfidl-cbase.hh
@@@ -9,7 -10,9 +10,9 @@@
#include "sfidl-options.hh"
#include "sfidl-parser.hh"
#include "sfidl-generator.hh"
+
namespace Sfidl {
-
++
/*
* Base class for C and C++-like CodeGenerators
*/
@@@ -71,6 -93,7 +93,7 @@@
*/
virtual String funcCopy (const String& type);
const gchar *cFuncCopy (const String& type) { return makeCStr (funcNew (type)); }
-
++
/*
* function required to free a "type" (blank return value allowed)
* example: funcFree ("FBlock") => "sfi_fblock_unref" (in C)
diff --cc sfi/sfidl-clientc.cc
index f1f38c8,bb929e6..2bb5e61
--- a/sfi/sfidl-clientc.cc
+++ b/sfi/sfidl-clientc.cc
@@@ -177,6 -217,7 +217,7 @@@ class ClientCFactory : public Factory
public:
String option() const { return "--client-c"; }
String description() const { return "generate client C language binding"; }
-
++
CodeGenerator *create (const Parser& parser) const
{
return new CodeGeneratorClientC (parser);
diff --cc sfi/sfidl-clientc.hh
index 2fba238,119ecce..bbfd10b
--- a/sfi/sfidl-clientc.hh
+++ b/sfi/sfidl-clientc.hh
@@@ -10,7 -11,9 +11,9 @@@
#include "sfidl-parser.hh"
#include "sfidl-cbase.hh"
#include "sfiparams.hh" /* scatId (SFI_SCAT_*) */
+
namespace Sfidl {
-
++
class CodeGeneratorClientC : public CodeGeneratorCBase {
protected:
String prefix;
@@@ -19,6 -23,7 +23,7 @@@
void printClassMacros();
void printProcedureImpl ();
void addBindingSpecificFiles (const String& binding_specific_files);
-
++
public:
CodeGeneratorClientC(const Parser& parser) : CodeGeneratorCBase (parser) {
}
diff --cc sfi/sfidl-clientcxx.cc
index fd6f143,0facef6..710f512
--- a/sfi/sfidl-clientcxx.cc
+++ b/sfi/sfidl-clientcxx.cc
@@@ -217,10 -239,14 +239,14 @@@ void CodeGeneratorClientCxx::printRecSe
for (vector<Sequence>::const_iterator si = parser.getSequences().begin(); si !=
parser.getSequences().end(); si++)
{
if (parser.fromInclude (si->name)) continue;
+
nspace.setFromSymbol(si->name);
+
/* FIXME: need optimized refcounted copy-on-write sequences as base types */
+
String name = nspace.printableForm (si->name);
String content = typeField (si->content.type);
-
++
printf ("\n");
printf ("class %s : public Sfi::Sequence<%s> {\n", name.c_str(), content.c_str());
printf ("public:\n");
@@@ -320,6 -355,7 +355,7 @@@ void CodeGeneratorClientCxx::printRecSe
String name = nspace.printableForm (ri->name);
String nname = ri->name;
String type_name = makeMixedName (ri->name).c_str();
-
++
printf("%s\n", cTypeRet (ri->name));
printf("%s::from_rec (SfiRec *sfi_rec)\n", nname.c_str());
printf("{\n");
@@@ -375,7 -415,9 +415,9 @@@ bool CodeGeneratorClientCxx::run (
vector<Param>::const_iterator pi;
vector<Class>::const_iterator ci;
vector<Method>::const_iterator mi;
-
++
printf("\n/*-------- begin %s generated code --------*/\n\n\n", options.sfidlName.c_str());
+
if (generateHeader)
{
/* choices */
diff --cc sfi/sfidl-corec.cc
index e480758,81b27a7..770fad5
--- a/sfi/sfidl-corec.cc
+++ b/sfi/sfidl-corec.cc
@@@ -51,12 -54,15 +54,15 @@@ class CodeGeneratorCoreC : public CodeG
const Map<String,IString> &infos)
{
printf ("static const gchar *%s[] = {\n", name.c_str());
-
++
Map<String,IString>::const_iterator ii;
for (ii = infos.begin(); ii != infos.end(); ii++)
printf (" \"%s=%s\",\n", ii->first.c_str(), ii->second.c_str());
-
++
printf (" NULL,\n");
printf ("};\n");
}
-
++
void
help()
{
@@@ -67,7 -73,9 +73,9 @@@
getOptions()
{
OptionVector opts = CodeGenerator::getOptions();
-
++
opts.push_back (make_pair ("--init", true));
-
++
return opts;
}
void
@@@ -310,8 -320,10 +320,10 @@@
printf (" }\n");
printf (" return choice_values;\n");
printf ("}\n");
-
++
printf ("GType %s = 0;\n", make_TYPE_MACRO (ei->name));
printf ("\n");
-
++
enumCount++;
}
if (enumCount)
@@@ -343,7 -355,9 +355,9 @@@
for (vector<Record>::const_iterator ri = parser.getRecords().begin(); ri != parser.getRecords().end();
ri++)
{
if (parser.fromInclude (ri->name)) continue;
-
++
String mname = makeMixedName (ri->name.c_str());
-
++
printf ("struct _%s {\n", mname.c_str());
for (vector<Param>::const_iterator pi = ri->contents.begin(); pi != ri->contents.end(); pi++)
{
@@@ -403,9 -417,11 +417,11 @@@
for (vector<Record>::const_iterator ri = parser.getRecords().begin(); ri != parser.getRecords().end();
ri++)
{
if (parser.fromInclude (ri->name)) continue;
-
++
String ret = TypeRet (ri->name);
String arg = TypeArg (ri->name);
String lname = makeLowerName (ri->name.c_str());
-
++
printf ("SfiRecFields %s_get_fields (void);\n", lname.c_str());
printf ("%s %s_new (void);\n", ret.c_str(), lname.c_str());
printf ("%s %s_copy_shallow (%s rec);\n", ret.c_str(), lname.c_str(), arg.c_str());
@@@ -461,6 -481,7 +481,7 @@@
printf (" %sHandle rh (Sfi::INIT_DEFAULT); \n", type);
printf (" return hack_cast (rh.steal());\n");
printf ("}\n");
-
++
printf ("%s\n", ret.c_str());
printf ("%s_copy_shallow (%s cstruct)\n", lname.c_str(), arg.c_str());
printf ("{\n");
@@@ -468,12 -489,14 +489,14 @@@
printf (" rh.set_boxed (hack_cast (cstruct));\n");
printf (" return hack_cast (rh.steal());\n");
printf ("}\n");
-
++
printf ("%s\n", ret.c_str());
printf ("%s_from_rec (SfiRec *rec)\n", lname.c_str());
printf ("{\n");
printf (" %sHandle rh = %s::from_rec (rec);\n", type, type);
printf (" return hack_cast (rh.steal());\n");
printf ("}\n");
-
++
printf ("SfiRec*\n");
printf ("%s_to_rec (%s cstruct)\n", lname.c_str(), arg.c_str());
printf ("{\n");
@@@ -481,6 -504,7 +504,7 @@@
printf (" rh.set_boxed (hack_cast (cstruct));\n");
printf (" return %s::to_rec (rh);\n", type);
printf ("}\n");
-
++
printf ("void\n");
printf ("%s_free (%s cstruct)\n", lname.c_str(), arg.c_str());
printf ("{\n");
@@@ -498,16 -522,21 +522,21 @@@
{
if (parser.fromInclude (ri->name))
continue;
-
++
String name = makeLowerName (ri->name);
-
++
printf ("static GParamSpec *%s_field[%zd];\n", name.c_str(), ri->contents.size());
printf ("SfiRecFields %s_fields = { %zd, %s_field };\n", name.c_str(), ri->contents.size(),
name.c_str());
-
++
String mname = makeMixedName (ri->name);
-
++
printf ("static void\n");
printf ("%s_boxed2rec (const GValue *src_value, GValue *dest_value)\n", name.c_str());
printf ("{\n");
printf (" gpointer boxed = g_value_get_boxed (src_value);\n");
printf (" sfi_value_take_rec (dest_value, boxed ? %s_to_rec (boxed) : NULL);\n", name.c_str());
printf ("}\n");
-
++
printf ("static void\n");
printf ("%s_rec2boxed (const GValue *src_value, GValue *dest_value)\n", name.c_str());
printf ("{\n");
@@@ -515,6 -544,7 +544,7 @@@
printf (" g_value_take_boxed (dest_value,\n");
printf (" rec ? %s_from_rec (rec) : NULL);\n", name.c_str());
printf ("}\n");
-
++
printInfoStrings (name + "_info_strings", ri->infos);
printf ("static SfiBoxedRecordInfo %s_boxed_info = {\n", name.c_str());
printf (" \"%s\",\n", mname.c_str());
@@@ -545,9 -575,11 +575,11 @@@
for (vector<Sequence>::const_iterator si = parser.getSequences().begin(); si !=
parser.getSequences().end(); si++)
{
if (parser.fromInclude (si->name)) continue;
-
++
String mname = makeMixedName (si->name.c_str());
String array = String (TypeField (si->content.type)) + "*";
String elements = si->content.name;
-
++
printf ("struct _%s {\n", mname.c_str());
printf (" guint n_%s;\n", elements.c_str ());
printf (" %s %s;\n", array.c_str(), elements.c_str());
@@@ -658,7 -693,9 +693,9 @@@
String element = TypeArg (si->content.type);
String elements = si->content.name;
String lname = makeLowerName (si->name.c_str());
-
++
const gchar *type = make_fqtn (si->name);
+
printf ("GParamSpec*\n");
printf ("%s_get_element (void)\n", lname.c_str());
printf ("{\n");
@@@ -670,6 -708,7 +708,7 @@@
printf (" %s sh (0);\n", type);
printf (" return hack_cast (sh, sh.steal());\n");
printf ("}\n");
-
++
printf ("void\n");
printf ("%s_append (%s cseq, %s element)\n", lname.c_str(), arg.c_str(), element.c_str());
printf ("{\n");
@@@ -679,6 -718,7 +718,7 @@@
printf (" sh += %s;\n", cxx_handle (si->content.type, "element"));
printf (" sh.steal(); /* prevent cseq deletion */\n");
printf ("}\n");
-
++
printf ("%s\n", ret.c_str());
printf ("%s_copy_shallow (%s cseq)\n", lname.c_str(), arg.c_str());
printf ("{\n");
@@@ -686,12 -726,14 +726,14 @@@
printf (" sh.set_boxed (hack_cast (cseq));\n");
printf (" return hack_cast (sh, sh.steal());\n");
printf ("}\n");
-
++
printf ("%s\n", ret.c_str());
printf ("%s_from_seq (SfiSeq *seq)\n", lname.c_str());
printf ("{\n");
printf (" %s sh = %s::from_seq (seq);\n", type, type);
printf (" return hack_cast (sh, sh.steal());\n");
printf ("}\n");
-
++
printf ("SfiSeq*\n");
printf ("%s_to_seq (%s cseq)\n", lname.c_str(), arg.c_str());
printf ("{\n");
@@@ -701,6 -743,7 +743,7 @@@
printf (" sh.steal(); /* prevent cseq deletion */\n");
printf (" return seq;\n");
printf ("}\n");
-
++
printf ("void\n");
printf ("%s_resize (%s cseq, guint n)\n", lname.c_str(), arg.c_str());
printf ("{\n");
@@@ -726,15 -770,20 +770,20 @@@
for (vector<Sequence>::const_iterator si = parser.getSequences().begin(); si !=
parser.getSequences().end(); si++)
{
if (parser.fromInclude (si->name)) continue;
-
++
String name = makeLowerName (si->name);
-
++
printf ("static GParamSpec *%s_content;\n", name.c_str());
-
++
String mname = makeMixedName (si->name);
-
++
printf ("static void\n");
printf ("%s_boxed2seq (const GValue *src_value, GValue *dest_value)\n", name.c_str());
printf ("{\n");
printf (" gpointer boxed = g_value_get_boxed (src_value);\n");
printf (" sfi_value_take_seq (dest_value, boxed ? %s_to_seq (boxed) : NULL);\n", name.c_str());
printf ("}\n");
-
++
printf ("static void\n");
printf ("%s_seq2boxed (const GValue *src_value, GValue *dest_value)\n", name.c_str());
printf ("{\n");
@@@ -742,6 -791,7 +791,7 @@@
printf (" g_value_take_boxed (dest_value,\n");
printf (" seq ? %s_from_seq (seq) : NULL);\n", name.c_str());
printf ("}\n");
-
++
printInfoStrings (name + "_info_strings", si->infos);
printf ("static SfiBoxedSequenceInfo %s_boxed_info = {\n", name.c_str());
printf (" \"%s\",\n", mname.c_str());
@@@ -760,6 -810,7 +810,7 @@@
printf ("\n\n/* type initialization function */\n");
printf ("static void\n%s (void)\n", generateInitFunction.c_str());
printf ("{\n");
-
++
/*
* It is important to follow the declaration order of the idl file here, as for
* instance a Param inside a record might come from a sequence, and a Param
@@@ -767,9 -818,11 +818,11 @@@
* Params, we follow the getTypes()
*/
vector<String>::const_iterator ti;
-
++
for(ti = parser.getTypes().begin(); ti != parser.getTypes().end(); ti++)
{
if (parser.fromInclude (*ti)) continue;
-
++
if (parser.isRecord (*ti) || parser.isSequence (*ti))
{
if (!first)
@@@ -779,8 -832,10 +832,10 @@@
if (parser.isRecord (*ti))
{
const Record& rdef = parser.findRecord (*ti);
-
++
String name = makeLowerName (rdef.name);
int f = 0;
-
++
for (vector<Param>::const_iterator pi = rdef.contents.begin(); pi != rdef.contents.end(); pi++,
f++)
{
if (generateIdlLineNumbers)
@@@ -791,7 -846,9 +846,9 @@@
if (parser.isSequence (*ti))
{
const Sequence& sdef = parser.findSequence (*ti);
-
++
String name = makeLowerName (sdef.name);
-
++
if (generateIdlLineNumbers)
printf ("#line %u \"%s\"\n", sdef.content.line, parser.fileName().c_str());
printf (" %s_content = %s;\n", name.c_str(), construct_pspec (sdef.content).c_str());
@@@ -800,9 -857,11 +857,11 @@@
for (vector<Choice>::const_iterator ei = parser.getChoices().begin(); ei != parser.getChoices().end();
ei++)
{
if (parser.fromInclude (ei->name)) continue;
-
++
String gname = make_TYPE_MACRO (ei->name);
String name = makeLowerName(ei->name);
String mname = makeMixedName(ei->name);
-
++
printf (" %s = g_enum_register_static (\"%s\", %s_value);\n", gname.c_str(),
mname.c_str(), name.c_str());
printf (" g_value_register_transform_func (SFI_TYPE_CHOICE, %s, choice2enum);\n",
@@@ -813,8 -872,10 +872,10 @@@
for (vector<Record>::const_iterator ri = parser.getRecords().begin(); ri != parser.getRecords().end();
ri++)
{
if (parser.fromInclude (ri->name)) continue;
-
++
String gname = make_TYPE_MACRO (ri->name);
String name = makeLowerName(ri->name);
-
++
printf (" %s = sfi_boxed_make_record (&%s_boxed_info,\n", gname.c_str(), name.c_str());
printf (" (GBoxedCopyFunc) %s_copy_shallow,\n", name.c_str());
printf (" (GBoxedFreeFunc) %s_free);\n", name.c_str());
@@@ -822,8 -883,10 +883,10 @@@
for (vector<Sequence>::const_iterator si = parser.getSequences().begin(); si !=
parser.getSequences().end(); si++)
{
if (parser.fromInclude (si->name)) continue;
-
++
String gname = make_TYPE_MACRO (si->name);
String name = makeLowerName(si->name);
-
++
printf (" %s_boxed_info.element = %s_content;\n", name.c_str(), name.c_str());
printf (" %s = sfi_boxed_make_sequence (&%s_boxed_info,\n", gname.c_str(), name.c_str());
printf (" (GBoxedCopyFunc) %s_copy_shallow,\n", name.c_str());
@@@ -831,6 -894,7 +894,7 @@@
}
printf ("}\n");
}
-
++
public:
CodeGeneratorCoreC (const Parser& parser) :
CodeGenerator (parser)
@@@ -842,6 -907,7 +907,7 @@@
printf ("\n/*-------- begin %s generated code --------*/\n\n\n", options.sfidlName.c_str());
if (generateSource)
printf ("#include <string.h>\n");
-
++
if (generateHeader)
{
generate_enum_definitions ();
@@@ -893,6 -962,7 +962,7 @@@ class CoreCFactory : public Factory
public:
String option() const { return "--core-c"; }
String description() const { return "generate core C language binding"; }
-
++
CodeGenerator *create (const Parser& parser) const
{
return new CodeGeneratorCoreC (parser);
diff --cc sfi/sfidl-corecxx.cc
index 923b39b,0c775d3..be6e5d1
--- a/sfi/sfidl-corecxx.cc
+++ b/sfi/sfidl-corecxx.cc
@@@ -556,8 -564,10 +564,10 @@@ public
{
if (parser.fromInclude (ri->name))
continue;
-
++
nspace.setFromSymbol(ri->name);
const char *name = nspace.printable_form (ri->name);
-
++
printf ("class %s;\n", pure_TypeName (ri->name));
printf ("typedef Sfi::RecordHandle<%s> %sHandle;\n", name, name);
printf ("#define %s\t\tBSE_CXX_DECLARED_RECORD_TYPE (%s, %s)\n",
@@@ -576,6 -586,7 +586,7 @@@
if (parser.fromInclude (ri->name))
continue;
nspace.setFromSymbol(ri->name);
-
++
printf ("class %s : public ::Sfi::GNewable {\n", pure_TypeName (ri->name));
printf ("public:\n");
for (vector<Param>::const_iterator pi = ri->contents.begin(); pi != ri->contents.end(); pi++)
@@@ -605,6 -616,7 +616,7 @@@
if (parser.fromInclude (ri->name))
continue;
nspace.setFromSymbol(ri->name);
-
++
printf ("BSE_CXX_DECLARE_RECORD (%s);\n", pure_TypeName (ri->name));
printf ("\n");
}
@@@ -619,6 -631,7 +631,7 @@@
continue;
nspace.setFromSymbol(ri->name);
const char *nname = nspace.printable_form (ri->name);
-
++
printf ("%s\n", TypeRet (ri->name));
printf ("%s::from_rec (SfiRec *sfi_rec)\n", nname);
printf ("{\n");
@@@ -636,6 -649,7 +649,7 @@@
}
printf (" return rec;\n");
printf ("}\n\n");
-
++
printf ("SfiRec *\n");
printf ("%s::to_rec (%s rec)\n", nname, TypeArg (ri->name));
printf ("{\n");
@@@ -654,6 -668,7 +668,7 @@@
}
printf (" return sfi_rec;\n");
printf ("}\n\n");
-
++
printf ("%s\n", TypeRet (ri->name));
printf ("%s::value_get_boxed (const GValue *value)\n", nname);
printf ("{\n");
@@@ -664,6 -679,7 +679,7 @@@
printf ("{\n");
printf (" %s::value_set_boxed (value, self);\n", TypeRet (ri->name));
printf ("}\n\n");
-
++
printf ("SfiRecFields\n");
printf ("%s::get_fields()\n", nname);
printf ("{\n");
@@@ -693,6 -709,7 +709,7 @@@
if (parser.fromInclude (si->name))
continue;
nspace.setFromSymbol(si->name);
-
++
printf ("class %s;\n", pure_TypeName (si->name));
printf ("#define %s\t\tBSE_CXX_DECLARED_SEQUENCE_TYPE (%s, %s)\n",
make_TYPE_NAME (si->name),
@@@ -710,6 -727,7 +727,7 @@@
if (parser.fromInclude (si->name))
continue;
nspace.setFromSymbol(si->name);
-
++
printf ("class %s : public Sfi::Sequence< %s > {\n", pure_TypeName (si->name), TypeField
(si->content.type));
printf ("public:\n");
printf (" %s (unsigned int n = 0) : Sfi::Sequence< %s > (n) {}\n", pure_TypeName (si->name),
TypeField (si->content.type));
@@@ -750,6 -769,7 +769,7 @@@
continue;
nspace.setFromSymbol(si->name);
const char *nname = nspace.printable_form (si->name);
-
++
printf ("%s\n", TypeRet (si->name));
printf ("%s::from_seq (SfiSeq *sfi_seq)\n", nname);
printf ("{\n");
@@@ -768,6 -788,7 +788,7 @@@
printf (" }\n");
printf (" return cseq;\n");
printf ("}\n\n");
-
++
printf ("SfiSeq *\n");
printf ("%s::to_seq (%s cseq)\n", nname, TypeArg (si->name));
printf ("{\n");
@@@ -779,6 -800,7 +800,7 @@@
printf (" }\n");
printf (" return sfi_seq;\n");
printf ("}\n\n");
-
++
printf ("%s\n", TypeRet (si->name));
printf ("%s::value_get_boxed (const GValue *value)\n", nname);
printf ("{\n");
@@@ -789,6 -811,7 +811,7 @@@
printf ("{\n");
printf (" ::Sfi::cxx_value_set_boxed_sequence< %s> (value, self);\n", nname);
printf ("}\n\n");
-
++
printf ("GParamSpec*\n");
printf ("%s::get_element()\n", nname);
printf ("{\n");
@@@ -846,9 -869,11 +869,11 @@@
const char *ctProperties = intern (ctName + String ("Properties"));
const char *ctPropertyID = intern (ctName + String ("PropertyID"));
vector<String> destroy_jobs;
-
++
/* skeleton class declaration + type macro */
printf ("BSE_CXX_DECLARE_CLASS (%s);\n", pure_TypeName (ci->name));
printf ("class %s : public %s {\n", ctNameBase, make_fqtn (ci->inherits));
-
++
/* class Info strings */
/* pixstream(), this is a bit of a hack, we make it a template rather than
* a normal inline method to avoid huge images in debugging code
@@@ -878,6 -903,7 +903,7 @@@
printf (" static inline const char* authors () { return %s; }\n",
ci->infos.get("authors").escaped().c_str());
printf (" static inline const char* license () { return %s; }\n",
ci->infos.get("license").escaped().c_str());
printf (" static inline const char* type_name () { return \"%s\"; }\n", make_PrefixedTypeName
(ci->name));
-
++
/* i/j/o channel names */
if (ci->istreams.size())
{
@@@ -903,6 -929,7 +929,7 @@@
printf (" OCHANNEL_%s,\n", pure_UPPER (si->ident));
printf (" N_OCHANNELS\n };\n");
}
-
++
/* property IDs */
printf ("protected:\n enum %s {\n", ctPropertyID);
if (ci->properties.begin() != ci->properties.end())
@@@ -913,6 -940,7 +940,7 @@@
printf (" PROP_%s,\n", pure_UPPER (pi->name));
}
printf (" };\n");
-
++
/* "Properties" structure for synthesis modules */
if (ci->istreams.size() + ci->jstreams.size() + ci->ostreams.size())
{
@@@ -929,6 -957,7 +957,7 @@@
printf (" }\n");
printf (" };\n");
}
-
++
/* auto-update type */
printf ("protected:\n");
printf (" typedef %s AutoUpdateCategory;\n", class_has_automation_properties (*ci) ?
"::Bse::SynthesisModule::NeedAutoUpdateTag" : "void");
@@@ -940,6 -970,7 +970,7 @@@
if (g_option_check (pi->literal_options.c_str(), "automate"))
printf (" guint64 last__%s;\n", pi->name.c_str());
}
-
++
/* get_property() */
printf ("public:\n");
printf (" void get_property (%s prop_id, ::Bse::Value &value, GParamSpec *pspec)\n", ctPropertyID);
@@@ -953,6 -984,7 +984,7 @@@
}
printf (" };\n");
printf (" }\n");
-
++
/* set_property() */
printf (" void set_property (%s prop_id, const ::Bse::Value &value, GParamSpec *pspec)\n",
ctPropertyID);
printf (" {\n");
@@@ -1022,12 -1058,15 +1058,15 @@@
printf (" guint signal_%s;\n", sig_name);
}
printf (" } static_data;\n");
-
++
/* property-changed hooking */
printf ("protected:\n");
printf (" virtual bool property_changed (%s) { return false; }\n", ctPropertyID);
-
++
/* methods */
for (vector<Method>::const_iterator mi = ci->methods.begin(); mi != ci->methods.end(); mi++)
procs.push_back (&(*mi));
-
++
/* destructor */
printf (" virtual ~%s ()\n", ctNameBase);
printf (" {\n");
@@@ -1035,6 -1074,7 +1074,7 @@@
for (vector<String>::const_iterator vi = destroy_jobs.begin(); vi != destroy_jobs.end(); vi++)
printf (" %s;\n", vi->c_str());
printf (" }\n");
-
++
/* signal emission methods */
printf ("public:\n");
for (vector<Method>::const_iterator si = ci->signals.begin(); si != ci->signals.end(); si++)
@@@ -1063,6 -1103,7 +1103,7 @@@
printf (" g_value_unset (args + %u);\n", i);
printf (" }\n");
}
-
++
/* done */
printf ("};\n"); /* finish: class ... { }; */
}
@@@ -1081,6 -1122,7 +1122,7 @@@
const char *ctPropertyID = intern (ctName + String ("PropertyID"));
const char *nname = nspace.printable_form (ci->name);
vector<String> destroy_jobs;
-
++
/* class_init */
printf ("void\n");
printf ("%sBase::class_init (::Bse::CxxBaseClass *klass)\n", nname);
@@@ -1153,6 -1196,7 +1196,7 @@@
printf ("namespace Procedure {\n");
printf ("BSE_CXX_DECLARE_PROC (%s);\n", pure_lower (mi->name));
printf ("class %s {\n", pure_lower (mi->name));
-
++
/* class Info strings */
/* pixstream(), this is a bit of a hack, we make it a template rather than
* a normal inline method to avoid huge images in debugging code
@@@ -1181,6 -1225,7 +1225,7 @@@
printf (" static inline const char* authors () { return %s; }\n",
infos.get("authors").escaped().c_str());
printf (" static inline const char* license () { return %s; }\n",
infos.get("license").escaped().c_str());
printf (" static inline const char* type_name () { return \"%s\"; }\n", make_scheme_name
(mi->name));
-
++
/* return type */
printf (" static %s exec (", TypeRet (mi->result.type));
/* args */
@@@ -1191,6 -1236,7 +1236,7 @@@
printf ("%s %s", TypeArg (ai->type), ai->name.c_str());
}
printf (");\n");
-
++
/* marshal */
printf (" static BseErrorType marshal (BseProcedureClass *procedure,\n"
" const GValue *in_values,\n"
@@@ -1217,6 -1263,7 +1263,7 @@@
printf (" }\n");
printf (" return BSE_ERROR_NONE;\n");
printf (" }\n");
-
++
/* init */
printf (" static void init (BseProcedureClass *proc,\n"
" GParamSpec **in_pspecs,\n"
@@@ -1227,6 -1274,7 +1274,7 @@@
if (!is_void)
printf (" *(out_pspecs++) = %s;\n", typed_pspec_constructor (mi->result).c_str());
printf (" }\n");
-
++
/* done */
printf ("};\n"); /* finish: class ... { }; */
printf ("} // Procedure\n\n");
@@@ -1236,8 -1284,10 +1284,10 @@@
run ()
{
printf ("\n/*-------- begin %s generated code --------*/\n\n\n", Options::the()->sfidlName.c_str());
-
++
/* standard includes */
printf ("\n#include <bse/bsecxxplugin.hh>\n");
-
++
/* reset auxillary structures */
images.resize (0);
procs.resize (0);
@@@ -1307,7 -1368,9 +1368,9 @@@
printf (" return local_pixstream;\n");
printf ("}\n");
}
+
// printf ("\n}; // ...\n"); // FIXME: do images need a namespace?
-
++
/* done */
printf ("\n/*-------- end %s generated code --------*/\n\n\n", Options::the()->sfidlName.c_str());
return true;
diff --cc sfi/sfidl-generator.cc
index a1f3eae,c77c7d4..653fb6d
--- a/sfi/sfidl-generator.cc
+++ b/sfi/sfidl-generator.cc
@@@ -88,13 -102,16 +102,16 @@@ String CodeGenerator::makeLowerName (co
for (String::const_iterator i = wi->begin(); i != wi->end(); i++)
result += tolower (*i);
}
-
++
return result;
}
+
String CodeGenerator::makeUpperName (const String& name)
{
String lname = makeLowerName (name);
String result;
String::const_iterator i;
-
++
for(i = lname.begin(); i != lname.end(); i++)
result += toupper(*i);
return result;
@@@ -115,8 -135,10 +135,10 @@@ String CodeGenerator::makeMixedName (co
first = false;
}
}
-
++
return result;
}
+
String CodeGenerator::makeLMixedName (const String& name)
{
String result = makeMixedName (name);
diff --cc sfi/sfidl-generator.hh
index d25a7d7,646b1c1..be0852b
--- a/sfi/sfidl-generator.hh
+++ b/sfi/sfidl-generator.hh
@@@ -9,7 -10,9 +10,9 @@@
#include "sfidl-options.hh"
#include "sfidl-parser.hh"
#include "sfiparams.hh" /* scatId (SFI_SCAT_*) */
+
namespace Sfidl {
-
++
class CodeGenerator {
protected:
const Parser& parser;
@@@ -17,6 -21,7 +21,7 @@@
bool generateHeader;
bool generateSource;
bool generateIdlLineNumbers;
-
++
std::vector<String> splitName (const String& name);
String makeLowerName (const String& name, char seperator = '_');
String makeUpperName (const String& name);
@@@ -70,12 -80,14 +80,14 @@@
rename (NamespaceHelper& nsh, const String& name, WordCase namespace_wc,
const String& namespace_join, const std::vector<String>& namespace_append,
WordCase typename_wc, const String& typename_join);
-
++
CodeGenerator(const Parser& parser)
: parser (parser), options (*Options::the()),
generateHeader (true), generateSource (false),
generateIdlLineNumbers (true)
{
}
-
++
public:
/*
* returns the options supported by this code generator (used by the option parser)
diff --cc sfi/sfidl-hostc.cc
index f6ab7fd,63ecd36..3ab94f5
--- a/sfi/sfidl-hostc.cc
+++ b/sfi/sfidl-hostc.cc
@@@ -207,6 -250,7 +250,7 @@@ class HostCFactory : public Factory
public:
String option() const { return "--host-c"; }
String description() const { return "generate host C language binding"; }
-
++
CodeGenerator *create (const Parser& parser) const
{
return new CodeGeneratorHostC (parser);
diff --cc sfi/sfidl-hostc.hh
index 89ca912,58bc562..978d8f3
--- a/sfi/sfidl-hostc.hh
+++ b/sfi/sfidl-hostc.hh
@@@ -6,7 -7,9 +7,9 @@@
#include <algorithm>
#include "sfidl-utils.hh"
#include "sfidl-cbase.hh"
+
namespace Sfidl {
-
++
class CodeGeneratorHostC : public CodeGeneratorCBase {
protected:
String prefix;
diff --cc sfi/sfidl-namespace.cc
index 58a5c79,ed6af3a..e9666ab
--- a/sfi/sfidl-namespace.cc
+++ b/sfi/sfidl-namespace.cc
@@@ -11,6 -14,7 +14,7 @@@ static list<String> symbolToList (Strin
{
list<String> result;
String current;
-
++
String::iterator si;
for(si = symbol.begin(); si != symbol.end(); si++)
{
@@@ -22,9 -26,11 +26,11 @@@
{
if(current != "")
result.push_back(current);
-
++
current = "";
}
}
-
++
result.push_back(current);
return result;
}
@@@ -52,6 -62,7 +62,7 @@@ NamespaceHelper::setFromSymbol(String s
{
list<String> symlist = symbolToList (symbol);
symlist.pop_back();
-
++
/* check that the current namespace doesn't contain wrong parts at end */
list<String>::iterator ni,si;
ni = currentNamespace.begin();
@@@ -67,6 -78,7 +78,7 @@@
{
fprintf (out,"} // %s\n", (*ni++).c_str());
}
-
++
/* enter new components at the end */
while (si != symlist.end())
{
@@@ -82,10 -96,12 +96,12 @@@ String NamespaceHelper::printableForm(S
{
list<String> symlist = symbolToList(symbol);
list<String> current = currentNamespace;
-
++
while(!current.empty())
{
// namespace longer than symbol?
g_assert (!symlist.empty());
-
++
if(*current.begin() == *symlist.begin())
{
current.pop_front();
@@@ -96,6 -112,7 +112,7 @@@
return "::"+symbol;
}
}
-
++
return listToSymbol(symlist);
}
const char*
@@@ -106,6 -124,7 +124,7 @@@ NamespaceHelper::printable_form (Strin
String NamespaceHelper::nameOf(String symbol)
{
if(symbol == "") return "";
-
++
list<String> symlist = symbolToList(symbol);
return symlist.back();
}
@@@ -113,6 -133,7 +133,7 @@@ String NamespaceHelper::namespaceOf(Str
{
list<String> symlist = symbolToList(symbol);
if(symlist.size() < 2) return "";
-
++
symlist.pop_back();
return listToSymbol(symlist);
}
diff --cc sfi/sfidl-namespace.hh
index f8963ac,a923671..23d7c3e
--- a/sfi/sfidl-namespace.hh
+++ b/sfi/sfidl-namespace.hh
@@@ -12,9 -15,11 +15,11 @@@ class NamespaceHelper
protected:
FILE *out;
std::list<String> currentNamespace;
-
++
public:
NamespaceHelper(FILE *outputfile);
~NamespaceHelper();
-
++
/*
* This method will cause the NamespaceHelper to enter the namespace the
* symbol is in. That means setFromSymbol("Arts::Object") will enter the
@@@ -22,11 -27,13 +27,13 @@@
* outside of class definitions.
*/
void setFromSymbol (String symbol);
-
++
/*
* This leaves all open namespaces which is useful if you want to include
* a file or such, or if you are at the end of a file.
*/
void leaveAll();
-
++
/*
* The shortest printable form of a symbol - using "Arts::Object" as
* example, this would be "Arts::Object", if you are in no namespace,
@@@ -35,11 -42,13 +42,13 @@@
*/
String printableForm (String symbol);
const char* printable_form (String symbol);
-
++
/*
* Returns only the last component of the symbol (the name) cutting the
* namespace components
*/
static String nameOf (String symbol);
-
++
/*
* Returns everything but the last component of the symbol, which is
* the namespace (e.g. namespaceOf("Arts::Object") returns Arts, and
diff --cc sfi/sfidl-parser.cc
index e68adf6,6285bbe..4bac869
--- a/sfi/sfidl-parser.cc
+++ b/sfi/sfidl-parser.cc
@@@ -52,7 -56,9 +56,9 @@@ static GScannerConfig scanner_config_
G_CSET_A_2_Z
) /* cset_identifier_nth */,
0 /* cpair_comment_single */,
-
++
TRUE /* case_sensitive */,
-
++
TRUE /* skip_comment_multi */,
TRUE /* skip_comment_single */,
TRUE /* scan_comment_multi */,
@@@ -204,25 -223,32 +220,32 @@@ Type Parser::typeOf (const String& type
if (isSequence (type)) return SEQUENCE;
if (isRecord (type)) return RECORD;
if (isClass (type)) return OBJECT;
- g_error (("invalid type: " + type).c_str());
+ g_error ("%s", ("invalid type: " + type).c_str());
return VOID;
}
+
Sequence Parser::findSequence(const String& name) const
{
vector<Sequence>::const_iterator i;
-
++
for (i=sequences.begin(); i != sequences.end(); i++)
if (i->name == name)
return *i;
-
++
return Sequence();
}
+
Record Parser::findRecord(const String& name) const
{
vector<Record>::const_iterator i;
-
++
for (i=records.begin(); i != records.end(); i++)
if (i->name == name)
return *i;
-
++
return Record();
}
+
const Class*
Parser::findClass (const String& name) const
{
@@@ -234,8 -262,10 +259,10 @@@
Parser::Parser () : options (*Options::the())
{
scanner = g_scanner_new64 (&scanner_config_template);
-
++
for (int n = 0; token_symbols[n]; n++)
g_scanner_add_symbol (scanner, token_symbols[n], GUINT_TO_POINTER (G_TOKEN_LAST + 1 + n));
-
++
scanner->max_parse_errors = 10;
scanner->parse_errors = 0;
scanner->msg_handler = scannerMsgHandler;
@@@ -245,20 -276,26 +273,26 @@@ void Parser::printError (const gchar *f
{
va_list args;
gchar *string;
-
++
va_start (args, format);
string = g_strdup_vprintf (format, args);
va_end (args);
-
++
if (scanner->parse_errors < scanner->max_parse_errors)
g_scanner_error (scanner, "%s", string);
-
++
g_free (string);
}
+
void Parser::printWarning (const gchar *format, ...)
{
va_list args;
gchar *string;
-
++
va_start (args, format);
string = g_strdup_vprintf (format, args);
va_end (args);
-
++
g_scanner_warn (scanner, "%s", string);
g_free (string);
}
@@@ -520,17 -582,10 +581,18 @@@ void Parser::preprocessContents (const
fprintf (stderr, "include file '%s' not found\n", filename.c_str());
exit(1);
}
+ i++; // eat closing quote
+ if (match (i, " as implementation"))
+ {
+ i += 18;
+ includeImpl = true;
+ }
+ if (*i != ';')
+ g_error ("expected ';' after include statement");
+ i++; // eat semicolpon after include
preprocess (location, includeImpl);
+
state = idlCode;
- i++;
}
else if(state == filenameIn1 || state == filenameIn2)
{
@@@ -742,14 -816,17 +823,17 @@@ bool Parser::parse (const String& filen
defineSymbol ("Num");
defineSymbol ("Real");
defineSymbol ("String");
- defineSymbol ("BBlock");
- defineSymbol ("FBlock");
+ // deprecated: defineSymbol ("BBlock");
+ // deprecated: defineSymbol ("FBlock");
defineSymbol ("Rec");
leaveNamespace ();
+
GTokenType expected_token = G_TOKEN_NONE;
-
++
while (!g_scanner_eof (scanner) && expected_token == G_TOKEN_NONE)
{
g_scanner_get_next_token (scanner);
-
++
if (scanner->token == G_TOKEN_EOF)
break;
else if (scanner->token == TOKEN_NAMESPACE)
@@@ -757,6 -834,7 +841,7 @@@
else
expected_token = G_TOKEN_EOF; /* '('; */
}
-
++
if (expected_token != G_TOKEN_NONE && expected_token != (GTokenType)TOKEN_ERROR)
{
g_scanner_unexp_token (scanner, expected_token, NULL, NULL, NULL, NULL, TRUE);
@@@ -772,9 -853,12 +860,12 @@@ GTokenType Parser::parseNamespace(
{
DEBUG("parse namespace\n");
parse_or_return (G_TOKEN_IDENTIFIER);
+
if (!enterNamespace (scanner->value.v_identifier))
return GTokenType (TOKEN_ERROR);
-
++
parse_or_return (G_TOKEN_LEFT_CURLY);
+
bool ready = false;
do
{
@@@ -858,13 -943,18 +952,18 @@@
}
}
while (!ready);
-
++
parse_or_return (G_TOKEN_RIGHT_CURLY);
+
/* semicolon after namespaces is optional (like in C++) */
if (g_scanner_peek_next_token (scanner) == GTokenType(';'))
parse_or_return (';');
-
++
leaveNamespace();
-
++
return G_TOKEN_NONE;
}
+
GTokenType Parser::parseTypeName (String& type)
{
parse_or_return (G_TOKEN_IDENTIFIER);
@@@ -926,14 -1024,17 +1033,17 @@@ GTokenType Parser::parseConstant (bool
* constant BAR = 3;
*/
Constant cdef;
+
if (isident)
- parse_or_return (TOKEN_CONST_IDENT);
+ g_assert_not_reached (); /* parse_or_return (TOKEN_CONST_IDENT); */
else
parse_or_return (TOKEN_CONST);
parse_or_return (G_TOKEN_IDENTIFIER);
cdef.name = defineSymbol (scanner->value.v_identifier);
cdef.file = fileName();
-
++
parse_or_return ('=');
+
/* handle ConstIdent */
if (isident)
{
@@@ -1002,13 -1112,16 +1118,16 @@@ Parser::parseChoice (
while (g_scanner_peek_next_token (scanner) == G_TOKEN_IDENTIFIER)
{
ChoiceValue comp;
-
++
GTokenType expected_token = parseChoiceValue (comp, value, sequentialValue);
if (expected_token != G_TOKEN_NONE)
return expected_token;
-
++
choice.contents.push_back(comp);
}
parse_or_return (G_TOKEN_RIGHT_CURLY);
parse_or_return (';');
-
++
addChoiceTodo (choice);
return G_TOKEN_NONE;
}
@@@ -1039,6 -1156,7 +1162,7 @@@ Parser::parseChoiceValue (ChoiceValue&
if (comp.name[i] != ':' || comp.name[i + 1] != ':')
str += comp.name[i] == ':' ? '_' : to_lower(comp.name[i]);
comp.label = g_type_name_to_sname (str.c_str());
-
++
/*
YES,
YES = 1,
@@@ -1110,16 -1241,20 +1235,20 @@@
comp.sequentialValue = 0;
else
comp.sequentialValue = sequentialValue++;
-
++
if (g_scanner_peek_next_token (scanner) == GTokenType(','))
parse_or_return (',');
else
peek_or_return ('}');
-
++
return G_TOKEN_NONE;
}
+
GTokenType Parser::parseRecord ()
{
Record record;
DEBUG("parse record\n");
-
++
parse_or_return (TOKEN_RECORD);
parse_or_return (G_TOKEN_IDENTIFIER);
record.name = defineSymbol (scanner->value.v_identifier);
@@@ -1131,6 -1266,7 +1260,7 @@@
return G_TOKEN_NONE;
}
parse_or_return (G_TOKEN_LEFT_CURLY);
-
++
bool ready = false;
while (!ready)
{
@@@ -1140,9 -1276,11 +1270,11 @@@
case G_TOKEN_IDENTIFIER:
{
Param def;
-
++
expected_token = parseRecordField (def, "");
if (expected_token != G_TOKEN_NONE)
return expected_token;
-
++
if (def.type != "")
record.contents.push_back(def);
}
@@@ -1476,6 -1649,7 +1624,7 @@@ GTokenType Parser::parseSequence (
* Int ints @= (...);
* };
*/
-
++
parse_or_return (TOKEN_SEQUENCE);
parse_or_return (G_TOKEN_IDENTIFIER);
sequence.name = defineSymbol (scanner->value.v_identifier);
@@@ -1496,8 -1673,10 +1648,10 @@@
expected_token = parseInfoOptional (sequence.infos);
if (expected_token != G_TOKEN_NONE)
return expected_token;
+
parse_or_return ('}');
parse_or_return (';');
-
++
addSequenceTodo (sequence);
return G_TOKEN_NONE;
}
@@@ -1505,10 -1685,12 +1660,12 @@@ GTokenType Parser::parseClass (
{
Class cdef;
DEBUG("parse class\n");
-
++
parse_or_return (TOKEN_CLASS);
parse_or_return (G_TOKEN_IDENTIFIER);
cdef.name = defineSymbol (scanner->value.v_identifier);
cdef.file = fileName();
-
++
if (g_scanner_peek_next_token (scanner) == GTokenType(';'))
{
parse_or_return (';');
@@@ -1518,10 -1700,12 +1675,12 @@@
if (g_scanner_peek_next_token (scanner) == GTokenType(':'))
{
parse_or_return (':');
-
++
GTokenType expected_token = parseTypeName (cdef.inherits);
if (expected_token != G_TOKEN_NONE)
return expected_token;
}
-
++
parse_or_return ('{');
while (g_scanner_peek_next_token (scanner) != G_TOKEN_RIGHT_CURLY)
{
@@@ -1534,6 -1718,7 +1693,7 @@@
GTokenType expected_token = parseMethod (method);
if (expected_token != G_TOKEN_NONE)
return expected_token;
-
++
if (method.result.type == "signal")
cdef.signals.push_back(method);
else
@@@ -1554,6 -1741,7 +1716,7 @@@
expected_token = parseRecordField (property, ""); // no i18n support, deprecated
if (expected_token != G_TOKEN_NONE)
return expected_token;
-
++
cdef.properties.push_back (property);
}
break;
@@@ -1589,6 -1777,7 +1752,7 @@@
GTokenType expected_token = parseStream (stream, stype);
if (expected_token != G_TOKEN_NONE)
return expected_token;
-
++
switch (stream.type) {
case Stream::IStream: cdef.istreams.push_back (stream); break;
case Stream::JStream: cdef.jstreams.push_back (stream); break;
@@@ -1602,6 -1791,7 +1766,7 @@@
}
parse_or_return ('}');
parse_or_return (';');
-
++
addClassTodo (cdef);
return G_TOKEN_NONE;
}
@@@ -1630,6 -1824,7 +1799,7 @@@ GTokenType Parser::parseMethod (Method
parse_or_return (G_TOKEN_IDENTIFIER);
method.name = scanner->value.v_identifier;
method.file = fileName();
-
++
parse_or_return ('(');
while (g_scanner_peek_next_token (scanner) == G_TOKEN_IDENTIFIER)
{
@@@ -1637,7 -1833,9 +1808,9 @@@
GTokenType expected_token = parseTypeName (def.type);
if (expected_token != G_TOKEN_NONE)
return expected_token;
+
def.pspec = NamespaceHelper::nameOf (def.type); // FIXME: correct?
-
++
parse_or_return (G_TOKEN_IDENTIFIER);
def.name = scanner->value.v_identifier;
def.file = fileName();
@@@ -1710,6 -1920,7 +1895,7 @@@
void Parser::addConstantTodo(const Constant& constant)
{
constants.push_back(constant);
-
++
if (insideInclude ())
{
includedNames.push_back (constant.name);
@@@ -1722,6 -1934,7 +1909,7 @@@
void Parser::addChoiceTodo(const Choice& choice)
{
choices.push_back(choice);
-
++
if (insideInclude ())
{
includedNames.push_back (choice.name);
@@@ -1735,6 -1949,7 +1924,7 @@@
void Parser::addRecordTodo(const Record& record)
{
records.push_back(record);
-
++
if (insideInclude ())
{
includedNames.push_back (record.name);
@@@ -1748,6 -1964,7 +1939,7 @@@
void Parser::addSequenceTodo(const Sequence& sequence)
{
sequences.push_back(sequence);
-
++
if (insideInclude ())
{
includedNames.push_back (sequence.name);
@@@ -1761,6 -1979,7 +1954,7 @@@
void Parser::addClassTodo(const Class& cdef)
{
classes.push_back(cdef);
-
++
if (insideInclude ())
{
includedNames.push_back (cdef.name);
@@@ -1774,6 -1994,7 +1969,7 @@@
void Parser::addProcedureTodo(const Method& pdef)
{
procedures.push_back(pdef);
-
++
if (insideInclude ())
{
includedNames.push_back (pdef.name);
@@@ -1846,7 -2075,9 +2050,9 @@@ symbolToList (const String& symbol
{
list<String> result;
String current;
+
g_return_val_if_fail (isCxxTypeName (symbol), result);
-
++
for (String::const_iterator si = symbol.begin(); si != symbol.end(); si++)
{
if (*si != ':')
@@@ -1857,9 -2088,11 +2063,11 @@@
{
if (current != "")
result.push_back(current);
-
++
current = "";
}
}
-
++
result.push_back(current);
return result;
}
diff --cc sfi/sfidl-parser.hh
index 32f2795,04bc3c3..c8c1446
--- a/sfi/sfidl-parser.hh
+++ b/sfi/sfidl-parser.hh
@@@ -27,10 -33,13 +33,13 @@@ public
class IString : public String {
public:
bool i18n;
+
IString() : i18n (false) {
}
-
++
IString(const char *str) : String (str), i18n (false) {
}
+
/* produces an escaped version "foo" or _("foo") */
String escaped (const String &i18n_prefix = "_") const
{
@@@ -77,6 -93,7 +93,7 @@@ struct Param
String type;
String name;
String file;
-
++
IString group;
String pspec;
int line;
@@@ -95,11 -114,13 +114,13 @@@ struct Stream
String file;
int line;
};
-
++
struct ChoiceValue {
String name;
String file;
IString label;
IString blurb;
-
++
int value;
int sequentialValue;
bool neutral;
@@@ -112,6 -134,7 +134,7 @@@ struct Choice
*/
String name;
String file;
-
++
std::vector<ChoiceValue> contents;
Map<String, IString> infos;
};
@@@ -118,6 -142,7 +142,7 @@@
struct Record {
String name;
String file;
-
++
std::vector<Param> contents;
Map<String, IString> infos;
};
@@@ -130,6 -157,7 +157,7 @@@ struct Sequence
struct Method {
String name;
String file;
-
++
std::vector<Param> params;
Param result;
Map<String, IString> infos;
@@@ -138,6 -167,7 +167,7 @@@ struct Class
String name;
String file;
String inherits;
-
++
std::vector<Method> methods;
std::vector<Method> signals;
std::vector<Param> properties;
@@@ -250,7 -302,9 +302,9 @@@ protected
GTokenType parseInfoOptional (Map<String,IString>& infos);
public:
Parser ();
-
++
bool parse (const String& fileName);
-
++
String fileName() const { return scanner->input_name; }
const std::vector<String>& getIncludes () const { return includes; }
const std::vector<Constant>& getConstants () const { return constants; }
@@@ -260,10 -314,13 +314,13 @@@
const std::vector<Class>& getClasses () const { return classes; }
const std::vector<Method>& getProcedures () const { return procedures; }
const std::vector<String>& getTypes () const { return types; }
-
++
std::vector<Pragma> getPragmas (const String& binding) const;
+
Sequence findSequence (const String& name) const;
Record findRecord (const String& name) const;
const Class* findClass (const String &name) const;
-
++
bool isChoice (const String& type) const;
bool isSequence (const String& type) const;
bool isRecord (const String& type) const;
diff --cc sfi/sfidl-typelist.cc
index 123eaa5,326dc67..a1a001f
--- a/sfi/sfidl-typelist.cc
+++ b/sfi/sfidl-typelist.cc
@@@ -23,6 -30,7 +30,7 @@@ class TypeListFactory : public Factory
public:
String option() const { return "--list-types"; }
String description() const { return "print all types defined in the idlfile"; }
-
++
CodeGenerator *create (const Parser& parser) const
{
return new CodeGeneratorTypeList (parser);
diff --cc sfi/sfifilecrawler.cc
index 932d22b,6bc34e1..be18e40
--- a/sfi/sfifilecrawler.cc
+++ b/sfi/sfifilecrawler.cc
@@@ -139,6 -154,7 +154,7 @@@ file_crawler_queue_readdir (SfiFileCraw
GFileTest file_test)
{
g_assert (self->dhandle == NULL);
-
++
if (strchr (file_pattern, '?') || strchr (file_pattern, '*'))
{
gchar *s = g_strconcat (base_dir, G_DIR_SEPARATOR_S, NULL);
@@@ -199,12 -218,16 +218,16 @@@ file_crawler_queue_abs_file_path (SfiFi
GFileTest file_test)
{
gchar *sep, *p, *freeme, *tmp;
+
g_assert (self->pdqueue == NULL && self->dlist == NULL && self->accu == NULL);
+
freeme = p = g_strdup (path_pattern);
-
++
/* seperate root */
sep = strchr (p, G_DIR_SEPARATOR);
g_return_if_fail (sep != NULL); /* absolute paths must have a seperator */
*sep++ = 0;
-
++
/* check root existance */
tmp = g_strconcat (p, G_DIR_SEPARATOR_S, NULL);
if (!g_file_test_all (tmp, G_FILE_TEST_IS_DIR))
@@@ -214,11 -237,14 +237,14 @@@
return;
}
g_free (tmp);
-
++
/* add root to dir list ("" on unix) */
self->dlist = sfi_ring_prepend (self->dlist, g_strdup (p));
-
++
/* compress multiple dir seperators */
while (*sep == G_DIR_SEPARATOR)
sep++;
-
++
/* add remaining segments to queue */
p = sep;
sep = strchr (p, G_DIR_SEPARATOR);
@@@ -232,11 -258,14 +258,14 @@@
p = sep;
sep = strchr (p, G_DIR_SEPARATOR);
}
-
++
/* final segment */
if (p[0])
self->pdqueue = sfi_ring_append (self->pdqueue, g_strdup (p));
-
++
/* final segment test */
self->stest = file_test;
-
++
/* cleanup */
g_free (freeme);
}
@@@ -342,6 -375,7 +375,7 @@@ gboolea
sfi_file_crawler_needs_crawl (SfiFileCrawler *self)
{
g_return_val_if_fail (self != NULL, FALSE);
-
++
return (self->dpatterns ||
self->pdqueue || self->dlist ||
self->dhandle);
diff --cc sfi/sfiglue.cc
index 23955d5,1682031..b24326c
--- a/sfi/sfiglue.cc
+++ b/sfi/sfiglue.cc
@@@ -169,7 -186,9 +179,9 @@@ sfi_glue_describe_proc (const gchar *pr
{
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
SfiGlueProc *proc;
-
++
g_return_val_if_fail (proc_name != NULL, NULL);
-
++
proc = context->table.describe_proc (context, proc_name);
if (proc && !proc->name)
{
@@@ -185,6 -205,7 +198,7 @@@ sfi_glue_list_proc_names (void
{
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
gchar **names;
-
++
names = context->table.list_proc_names (context);
if (!names)
names = g_new0 (gchar*, 1);
@@@ -196,7 -218,9 +211,9 @@@ sfi_glue_list_method_names (const gcha
{
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
gchar **names;
-
++
g_return_val_if_fail (iface_name != NULL, NULL);
-
++
names = context->table.list_method_names (context, iface_name);
if (!names)
names = g_new0 (gchar*, 1);
@@@ -208,6 -233,7 +226,7 @@@ sfi_glue_base_iface (void
{
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
gchar *biface = context->table.base_iface (context);
-
++
if (biface)
sfi_glue_gc_add (biface, g_free);
return biface;
@@@ -217,7 -244,9 +237,9 @@@ sfi_glue_iface_children (const gchar *i
{
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
gchar **names;
-
++
g_return_val_if_fail (iface_name != NULL, NULL);
-
++
names = context->table.iface_children (context, iface_name);
if (!names)
names = g_new0 (gchar*, 1);
@@@ -265,7 -304,9 +297,9 @@@ sfi_glue_call_valist (const gchar *proc
{
guint8 arg_type = first_arg_type;
SfiSeq *seq;
-
++
g_return_val_if_fail (proc_name != NULL, NULL);
-
++
seq = sfi_seq_new ();
while (arg_type)
{
@@@ -316,7 -361,9 +354,9 @@@ sfi_glue_vcall_bool (const gchar *proc_
va_list var_args;
GValue *rvalue;
SfiBool retv = FALSE;
-
++
g_return_val_if_fail (proc_name != NULL, FALSE);
-
++
va_start (var_args, first_arg_type);
rvalue = sfi_glue_call_valist (proc_name, first_arg_type, var_args);
va_end (var_args);
@@@ -334,7 -382,9 +375,9 @@@ sfi_glue_vcall_int (const gchar *proc_n
va_list var_args;
GValue *rvalue;
SfiInt retv = 0;
-
++
g_return_val_if_fail (proc_name != NULL, 0);
-
++
va_start (var_args, first_arg_type);
rvalue = sfi_glue_call_valist (proc_name, first_arg_type, var_args);
va_end (var_args);
@@@ -352,7 -403,9 +396,9 @@@ sfi_glue_vcall_num (const gchar *pro
va_list var_args;
GValue *rvalue;
SfiNum retv = 0;
-
++
g_return_val_if_fail (proc_name != NULL, 0);
-
++
va_start (var_args, first_arg_type);
rvalue = sfi_glue_call_valist (proc_name, first_arg_type, var_args);
va_end (var_args);
@@@ -370,7 -424,9 +417,9 @@@ sfi_glue_vcall_real (const gchar *pr
va_list var_args;
GValue *rvalue;
SfiReal retv = 0;
-
++
g_return_val_if_fail (proc_name != NULL, 0);
-
++
va_start (var_args, first_arg_type);
rvalue = sfi_glue_call_valist (proc_name, first_arg_type, var_args);
va_end (var_args);
@@@ -426,7 -489,9 +482,9 @@@ sfi_glue_vcall_proxy (const gchar *proc
va_list var_args;
GValue *rvalue;
SfiProxy retv = 0;
-
++
g_return_val_if_fail (proc_name != NULL, 0);
-
++
va_start (var_args, first_arg_type);
rvalue = sfi_glue_call_valist (proc_name, first_arg_type, var_args);
va_end (var_args);
@@@ -444,7 -510,9 +503,9 @@@ sfi_glue_vcall_seq (const gchar *proc_n
va_list var_args;
GValue *rvalue;
SfiSeq *retv = NULL;
-
++
g_return_val_if_fail (proc_name != NULL, NULL);
-
++
va_start (var_args, first_arg_type);
rvalue = sfi_glue_call_valist (proc_name, first_arg_type, var_args);
va_end (var_args);
@@@ -468,7 -537,9 +530,9 @@@ sfi_glue_vcall_rec (const gchar *proc_n
va_list var_args;
GValue *rvalue;
SfiRec *retv = NULL;
-
++
g_return_val_if_fail (proc_name != NULL, NULL);
-
++
va_start (var_args, first_arg_type);
rvalue = sfi_glue_call_valist (proc_name, first_arg_type, var_args);
va_end (var_args);
@@@ -486,7 -558,9 +551,9 @@@ sfi_glue_vcall_fblock (const gchar *pro
{
va_list var_args;
GValue *rvalue;
-
++
g_return_val_if_fail (proc_name != NULL, NULL);
-
++
va_start (var_args, first_arg_type);
rvalue = sfi_glue_call_valist (proc_name, first_arg_type, var_args);
va_end (var_args);
@@@ -504,7 -579,9 +572,9 @@@ sfi_glue_vcall_bblock (const gchar *pro
{
va_list var_args;
GValue *rvalue;
-
++
g_return_val_if_fail (proc_name != NULL, NULL);
-
++
va_start (var_args, first_arg_type);
rvalue = sfi_glue_call_valist (proc_name, first_arg_type, var_args);
va_end (var_args);
@@@ -520,6 -599,7 +592,7 @@@ SfiGlueIFace
sfi_glue_iface_new (const gchar *iface_name)
{
SfiGlueIFace *iface;
-
++
iface = g_new0 (SfiGlueIFace, 1);
iface->type_name = g_strdup (iface_name ? iface_name : "<null>");
iface->n_ifaces = 0;
@@@ -527,13 -607,16 +600,16 @@@
iface->n_props = 0;
iface->props = NULL;
iface->ref_count = 1;
-
++
return iface;
}
+
SfiGlueIFace*
sfi_glue_iface_ref (SfiGlueIFace *iface)
{
g_return_val_if_fail (iface != NULL, NULL);
g_return_val_if_fail (iface->ref_count > 0, NULL);
-
++
iface->ref_count++;
return iface;
}
@@@ -573,8 -662,10 +655,10 @@@ sfi_glue_proc_add_param (SfiGlueProc *p
GParamSpec *param)
{
guint i;
-
++
g_return_if_fail (proc != NULL);
g_return_if_fail (param != NULL);
-
++
i = proc->n_params++;
proc->params = g_renew (GParamSpec*, proc->params, proc->n_params);
proc->params[i] = g_param_spec_ref (param);
@@@ -587,6 -679,7 +672,7 @@@ sfi_glue_proc_add_ret_param (SfiGluePro
g_return_if_fail (proc != NULL);
g_return_if_fail (param != NULL);
g_return_if_fail (proc->ret_param == NULL);
-
++
proc->ret_param = g_param_spec_ref (param);
g_param_spec_sink (param);
}
@@@ -595,6 -689,7 +682,7 @@@ sfi_glue_proc_ref (SfiGlueProc *proc
{
g_return_val_if_fail (proc != NULL, NULL);
g_return_val_if_fail (proc->ref_count > 0, NULL);
-
++
proc->ref_count++;
return proc;
}
diff --cc sfi/sfigluecodec.cc
index 4692dd7,8b0ae20..1f2e405
--- a/sfi/sfigluecodec.cc
+++ b/sfi/sfigluecodec.cc
@@@ -81,14 -85,18 +85,18 @@@ sfi_glue_encoder_context (SfiComPort *p
encoder_destroy,
};
SfiGlueEncoder *encoder;
-
++
g_return_val_if_fail (port != NULL, NULL);
-
++
encoder = g_new0 (SfiGlueEncoder, 1);
sfi_glue_context_common_init (&encoder->context, &encoder_vtable);
encoder->port = sfi_com_port_ref (port);
g_value_init (&encoder->svalue, SFI_TYPE_SEQ);
encoder->events = NULL;
-
++
return &encoder->context;
}
+
#if 0
GValue* /* needs sfi_value_free() */
sfi_glue_encode_message (guint log_level,
@@@ -99,10 -107,13 +107,13 @@@
GValue *value;
SfiSeq *seq;
va_list args;
-
++
g_return_val_if_fail (format != NULL, NULL);
-
++
va_start (args, format);
buffer = g_strdup_vprintf (format, args);
va_end (args);
-
++
switch (log_level)
{
case SFI_LOG_ERROR:
@@@ -113,6 -124,7 +124,7 @@@
default:
log_level = SFI_LOG_DEBUG;
}
-
++
seq = sfi_seq_new ();
sfi_seq_append_int (seq, SFI_GLUE_CODEC_ASYNC_MESSAGE);
sfi_seq_append_string (seq, G_LOG_DOMAIN);
@@@ -173,14 -186,17 +186,17 @@@ encoder_process_message (SfiGlueEncode
else
sfi_diag ("ignoring message of invalid type: %s", G_VALUE_TYPE_NAME (value));
sfi_value_free (value);
-
++
return FALSE;
}
+
static void
encoder_exec_one_way (SfiGlueContext *context,
SfiSeq *seq)
{
SfiGlueEncoder *encoder = (SfiGlueEncoder*) context;
GValue *value;
-
++
/* send request off to remote */
sfi_value_set_seq (&encoder->svalue, seq);
sfi_com_port_send (encoder->port, &encoder->svalue);
@@@ -201,10 -219,12 +219,12 @@@ encoder_exec_round_trip (SfiGlueContex
{
SfiGlueEncoder *encoder = (SfiGlueEncoder*) context;
GValue *rvalue = NULL;
-
++
/* send request off to remote */
sfi_value_set_seq (&encoder->svalue, seq);
sfi_com_port_send (encoder->port, &encoder->svalue);
sfi_value_set_seq (&encoder->svalue, NULL);
-
++
/* spin until we receive result */
while (!rvalue)
{
@@@ -212,6 -232,7 +232,7 @@@
if (value && encoder_process_message (encoder, value, &rvalue))
break;
}
-
++
sfi_seq_clear (seq);
if (rvalue)
{
@@@ -229,7 -251,9 +251,9 @@@ encoder_describe_iface (SfiGlueContext
SfiSeq *seq = sfi_seq_new ();
sfi_seq_append_int (seq, SFI_GLUE_CODEC_DESCRIBE_IFACE);
sfi_seq_append_string (seq, iface_name);
-
++
seq = encoder_exec_round_trip (context, seq);
-
++
rec = sfi_seq_get_rec (seq, 0);
if (rec)
{
@@@ -274,7 -300,9 +300,9 @@@ encoder_describe_proc (SfiGlueContext *
SfiSeq *seq = sfi_seq_new ();
sfi_seq_append_int (seq, SFI_GLUE_CODEC_DESCRIBE_PROC);
sfi_seq_append_string (seq, proc_name);
-
++
seq = encoder_exec_round_trip (context, seq);
-
++
rec = sfi_seq_get_rec (seq, 0);
if (rec)
{
@@@ -342,7 -373,9 +373,9 @@@ encoder_list_proc_names (SfiGlueContex
gchar **strv = NULL;
SfiSeq *seq = sfi_seq_new ();
sfi_seq_append_int (seq, SFI_GLUE_CODEC_LIST_PROC_NAMES);
-
++
seq = encoder_exec_round_trip (context, seq);
-
++
strv = sfi_seq_to_strv (sfi_seq_get_seq (seq, 0));
sfi_seq_unref (seq);
return strv;
@@@ -364,7 -399,9 +399,9 @@@ encoder_list_method_names (SfiGlueConte
SfiSeq *seq = sfi_seq_new ();
sfi_seq_append_int (seq, SFI_GLUE_CODEC_LIST_METHOD_NAMES);
sfi_seq_append_string (seq, iface_name);
-
++
seq = encoder_exec_round_trip (context, seq);
-
++
strv = sfi_seq_to_strv (sfi_seq_get_seq (seq, 0));
sfi_seq_unref (seq);
return strv;
@@@ -384,7 -423,9 +423,9 @@@ encoder_base_iface (SfiGlueContext *con
gchar *string = NULL;
SfiSeq *seq = sfi_seq_new ();
sfi_seq_append_int (seq, SFI_GLUE_CODEC_BASE_IFACE);
-
++
seq = encoder_exec_round_trip (context, seq);
-
++
string = g_strdup (sfi_seq_get_string (seq, 0));
sfi_seq_unref (seq);
return string;
@@@ -407,7 -450,9 +450,9 @@@ encoder_iface_children (SfiGlueContext
SfiSeq *seq = sfi_seq_new ();
sfi_seq_append_int (seq, SFI_GLUE_CODEC_IFACE_CHILDREN);
sfi_seq_append_string (seq, iface_name);
-
++
seq = encoder_exec_round_trip (context, seq);
-
++
strv = sfi_seq_to_strv (sfi_seq_get_seq (seq, 0));
sfi_seq_unref (seq);
return strv;
@@@ -431,7 -478,9 +478,9 @@@ encoder_exec_proc (SfiGlueContext *cont
sfi_seq_append_int (seq, SFI_GLUE_CODEC_EXEC_PROC);
sfi_seq_append_string (seq, proc_name);
sfi_seq_append_seq (seq, params);
-
++
seq = encoder_exec_round_trip (context, seq);
-
++
if (seq->n_elements)
rvalue = sfi_value_clone_shallow (sfi_seq_get (seq, 0));
sfi_seq_unref (seq);
@@@ -455,7 -506,9 +506,9 @@@ encoder_proxy_iface (SfiGlueContext *co
SfiSeq *seq = sfi_seq_new ();
sfi_seq_append_int (seq, SFI_GLUE_CODEC_PROXY_IFACE);
sfi_seq_append_proxy (seq, proxy);
-
++
seq = encoder_exec_round_trip (context, seq);
-
++
string = g_strdup (sfi_seq_get_string (seq, 0));
sfi_seq_unref (seq);
return string;
@@@ -480,7 -535,9 +535,9 @@@ encoder_proxy_is_a (SfiGlueContext *con
sfi_seq_append_int (seq, SFI_GLUE_CODEC_PROXY_IS_A);
sfi_seq_append_proxy (seq, proxy);
sfi_seq_append_string (seq, iface);
-
++
seq = encoder_exec_round_trip (context, seq);
-
++
vbool = sfi_seq_get_bool (seq, 0);
sfi_seq_unref (seq);
return vbool;
@@@ -505,7 -564,9 +564,9 @@@ encoder_proxy_list_properties (SfiGlueC
sfi_seq_append_proxy (seq, proxy);
sfi_seq_append_string (seq, first_ancestor);
sfi_seq_append_string (seq, last_ancestor);
-
++
seq = encoder_exec_round_trip (context, seq);
-
++
strv = sfi_seq_to_strv (sfi_seq_get_seq (seq, 0));
sfi_seq_unref (seq);
return strv;
@@@ -532,7 -595,9 +595,9 @@@ encoder_proxy_get_pspec (SfiGlueContex
sfi_seq_append_int (seq, SFI_GLUE_CODEC_PROXY_GET_PSPEC);
sfi_seq_append_proxy (seq, proxy);
sfi_seq_append_string (seq, prop_name);
-
++
seq = encoder_exec_round_trip (context, seq);
-
++
pspec = sfi_seq_get_pspec (seq, 0);
if (pspec)
g_param_spec_ref (pspec);
@@@ -584,8 -654,10 +654,10 @@@ encoder_proxy_set_property (SfiGlueCont
sfi_seq_append_proxy (seq, proxy);
sfi_seq_append_string (seq, prop);
sfi_seq_append (seq, value);
-
++
encoder_exec_one_way (context, seq);
}
+
static void
decoder_proxy_set_property (SfiGlueDecoder *decoder,
SfiSeq *seq)
@@@ -605,7 -678,9 +678,9 @@@ encoder_proxy_get_property (SfiGlueCont
sfi_seq_append_int (seq, SFI_GLUE_CODEC_PROXY_GET_PROPERTY);
sfi_seq_append_proxy (seq, proxy);
sfi_seq_append_string (seq, prop);
-
++
seq = encoder_exec_round_trip (context, seq);
-
++
if (seq->n_elements)
rvalue = sfi_value_clone_shallow (sfi_seq_get (seq, 0));
sfi_seq_unref (seq);
@@@ -629,7 -706,9 +706,9 @@@ encoder_proxy_watch_release (SfiGlueCon
SfiSeq *seq = sfi_seq_new ();
sfi_seq_append_int (seq, SFI_GLUE_CODEC_PROXY_WATCH_RELEASE);
sfi_seq_append_proxy (seq, proxy);
-
++
seq = encoder_exec_round_trip (context, seq);
-
++
vbool = sfi_seq_get_bool (seq, 0);
sfi_seq_unref (seq);
return vbool;
@@@ -654,7 -735,9 +735,9 @@@ encoder_proxy_request_notify (SfiGlueCo
sfi_seq_append_proxy (seq, proxy);
sfi_seq_append_string (seq, signal);
sfi_seq_append_bool (seq, enable_notify);
-
++
seq = encoder_exec_round_trip (context, seq);
-
++
vbool = sfi_seq_get_bool (seq, 0);
sfi_seq_unref (seq);
return vbool;
@@@ -697,7 -784,9 +784,9 @@@ encoder_client_msg (SfiGlueContext *con
sfi_seq_append_string (seq, msg);
if (value)
sfi_seq_append (seq, value);
-
++
seq = encoder_exec_round_trip (context, seq);
-
++
if (seq->n_elements)
rvalue = sfi_value_clone_shallow (sfi_seq_get (seq, 0));
sfi_seq_unref (seq);
@@@ -711,6 -801,7 +801,7 @@@ decoder_client_msg (SfiGlueDecoder *dec
GValue dummy = { 0, }, *rvalue = NULL;
GValue *cvalue = seq->n_elements > 2 ? sfi_seq_get (seq, 2) : &dummy;
guint i;
-
++
/* interception handler */
for (i = 0; i < decoder->n_chandler && !rvalue; i++)
rvalue = decoder->chandler[i].client_msg (decoder,
@@@ -723,8 -814,10 +814,10 @@@
if (rvalue)
sfi_glue_gc_remove (rvalue, SfiGlueGcFreeFunc (sfi_value_free));
}
-
++
return rvalue;
}
+
static SfiRing*
encoder_fetch_events (SfiGlueContext *context)
{
@@@ -785,6 -883,7 +883,7 @@@ decoder_process_request (SfiGlueDecode
* to the remote client.
*/
cmd = sfi_seq_get_int (seq, 0);
-
++
switch (cmd)
{
case SFI_GLUE_CODEC_DESCRIBE_IFACE:
@@@ -836,15 -936,19 +936,19 @@@ sfi_glue_context_decoder (SfiComPor
SfiGlueContext *context)
{
SfiGlueDecoder *decoder;
-
++
g_return_val_if_fail (port != NULL, NULL);
g_return_val_if_fail (context != NULL, NULL);
-
++
decoder = g_new0 (SfiGlueDecoder, 1);
decoder->context = context;
decoder->port = sfi_com_port_ref (port);
decoder->incoming = NULL;
decoder->outgoing = NULL;
-
++
return decoder;
}
+
void
sfi_glue_decoder_add_handler (SfiGlueDecoder *decoder,
SfiGlueDecoderClientMsg func,
@@@ -861,7 -966,9 +966,9 @@@ gboolea
sfi_glue_decoder_pending (SfiGlueDecoder *decoder)
{
gboolean pending;
-
++
g_return_val_if_fail (decoder != NULL, FALSE);
-
++
pending = decoder->outgoing || decoder->incoming;
if (!pending)
{
@@@ -876,14 -983,19 +983,19 @@@
pending |= sfi_glue_context_pending ();
sfi_glue_context_pop ();
}
-
++
return pending;
}
+
void
sfi_glue_decoder_dispatch (SfiGlueDecoder *decoder)
{
SfiSeq *seq;
-
++
g_return_if_fail (decoder != NULL);
-
++
sfi_glue_context_push (decoder->context);
-
++
/* queue emitted signals */
seq = sfi_glue_context_fetch_event (); /* instead of sfi_glue_context_dispatch() */
while (seq)
@@@ -896,11 -1008,14 +1008,14 @@@
sfi_seq_unref (tmp);
seq = sfi_glue_context_fetch_event ();
}
-
++
/* send away queued signals */
sfi_com_port_send_bulk (decoder->port, decoder->outgoing);
while (decoder->outgoing)
sfi_value_free ((GValue*) sfi_ring_pop_head (&decoder->outgoing));
-
++
/* FIXME: catch messages */
-
++
/* process incoming request */
if (!decoder->incoming)
decoder->incoming = sfi_com_port_recv (decoder->port);
@@@ -938,11 -1054,13 +1054,13 @@@
sfi_seq_unref (tmp);
seq = sfi_glue_context_fetch_event ();
}
-
++
/* send away new signals and result */
sfi_com_port_send_bulk (decoder->port, decoder->outgoing);
while (decoder->outgoing)
sfi_value_free ((GValue*) sfi_ring_pop_head (&decoder->outgoing));
sfi_com_port_process_io (decoder->port);
-
++
sfi_glue_gc_run ();
sfi_glue_context_pop ();
}
@@@ -952,7 -1071,9 +1071,9 @@@ sfi_glue_decoder_list_poll_fds (SfiGlue
GPollFD *pfd;
SfiRing *ring;
guint n;
-
++
g_return_val_if_fail (decoder != NULL, NULL);
-
++
sfi_glue_context_push (decoder->context);
ring = sfi_ring_copy (sfi_glue_context_list_poll_fds ());
sfi_glue_context_pop ();
@@@ -965,7 -1087,9 +1087,9 @@@ voi
sfi_glue_decoder_destroy (SfiGlueDecoder *decoder)
{
SfiRing *ring;
-
++
g_return_if_fail (decoder != NULL);
-
++
sfi_com_port_unref (decoder->port);
for (ring = decoder->outgoing; ring; ring = sfi_ring_walk (ring, decoder->outgoing))
sfi_value_free ((GValue*) ring->data);
diff --cc sfi/sfiglueproxy.cc
index f4c86e9,69b2f5c..f8d11ae
--- a/sfi/sfiglueproxy.cc
+++ b/sfi/sfiglueproxy.cc
@@@ -621,11 -702,13 +692,13 @@@ sfi_glue_proxy_weak_unref (SfiProx
{
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
Proxy *p;
-
++
g_return_if_fail (proxy > 0);
g_return_if_fail (weak_notify != NULL);
+
p = peek_proxy (context, proxy);
if (!p)
- sfi_proxy_warn_inval (G_STRLOC, proxy);
+ invalid_proxy (proxy);
else
{
ProxyWeakRefs *wstack = (ProxyWeakRefs*) g_datalist_id_get_data (&p->qdata, quark_weak_refs);
@@@ -633,6 -716,7 +706,7 @@@
if (wstack)
{
guint i;
-
++
for (i = 0; i < wstack->n_weak_refs; i++)
if (wstack->weak_refs[i].notify == weak_notify &&
wstack->weak_refs[i].data == data)
diff --cc sfi/sfimemory.cc
index 27a3517,012d4ac..c6e766d
--- a/sfi/sfimemory.cc
+++ b/sfi/sfimemory.cc
@@@ -134,15 -154,19 +135,19 @@@ sfi_alloc_report (void
}
}
g_message ("%lu bytes allocated from system, %u bytes unused in cache", memory_allocated, cached);
- sfi_mutex_unlock (&global_memory_mutex);
+ global_memory_mutex.unlock();
}
+
gpointer
sfi_alloc_memblock0 (gsize block_size)
{
gpointer mem = sfi_alloc_memblock (block_size);
-
++
memset (mem, 0, block_size);
-
++
return mem;
}
+
void
_sfi_free_node_list (gpointer mem,
gsize node_size)
diff --cc sfi/sfiparams.cc
index ecebd34,7642337..59ff3db
--- a/sfi/sfiparams.cc
+++ b/sfi/sfiparams.cc
@@@ -67,8 -76,11 +76,11 @@@ _sfi_init_params (void
NULL, /* instance_init */
};
static GType pspec_types[7] = { 0, };
-
++
g_assert (sfi__param_spec_types == NULL);
-
++
sfi__param_spec_types = pspec_types;
-
++
quark_hints = g_quark_from_static_string ("sfi-pspec-hints");
quark_param_group = g_quark_from_static_string ("sfi-pspec-group");
quark_param_owner = g_quark_from_static_string ("sfi-pspec-owner");
@@@ -151,8 -167,10 +167,10 @@@ param_bblock_values_cmp (GParamSpec *
// SfiParamSpecBBlock *bspec = SFI_PSPEC_BBLOCK (pspec);
SfiBBlock *bblock1 = sfi_value_get_bblock (value1);
SfiBBlock *bblock2 = sfi_value_get_bblock (value2);
-
++
if (!bblock1 || !bblock2)
return bblock2 ? -1 : bblock1 != bblock2;
-
++
if (bblock1->n_bytes != bblock2->n_bytes)
return bblock1->n_bytes < bblock2->n_bytes ? -1 : 1;
else /* bblock1->n_bytes == bblock2->n_bytes */
@@@ -172,8 -191,10 +191,10 @@@ param_fblock_values_cmp (GParamSpec *
// SfiParamSpecFBlock *fspec = SFI_PSPEC_FBLOCK (pspec);
SfiFBlock *fblock1 = sfi_value_get_fblock (value1);
SfiFBlock *fblock2 = sfi_value_get_fblock (value2);
-
++
if (!fblock1 || !fblock2)
return fblock2 ? -1 : fblock1 != fblock2;
-
++
if (fblock1->n_values != fblock2->n_values)
return fblock1->n_values < fblock2->n_values ? -1 : 1;
else /* fblock1->n_values == fblock2->n_values */
@@@ -193,8 -215,10 +215,10 @@@ param_seq_values_cmp (GParamSpec *psp
SfiParamSpecSeq *sspec = SFI_PSPEC_SEQ (pspec);
SfiSeq *seq1 = sfi_value_get_seq (value1);
SfiSeq *seq2 = sfi_value_get_seq (value2);
-
++
if (!seq1 || !seq2)
return seq2 ? -1 : seq1 != seq2;
-
++
if (seq1->n_elements != seq2->n_elements)
return seq1->n_elements < seq2->n_elements ? -1 : 1;
else if (!sspec->element)
@@@ -207,11 -231,13 +231,13 @@@
else /* seq1->n_elements == seq2->n_elements */
{
guint i;
-
++
for (i = 0; i < seq1->n_elements; i++)
{
GValue *element1 = seq1->elements + i;
GValue *element2 = seq2->elements + i;
gint cmp;
-
++
/* need corresponding element types, provide stable result otherwise */
if (G_VALUE_TYPE (element1) != G_VALUE_TYPE (element2))
return G_VALUE_TYPE (element1) < G_VALUE_TYPE (element2) ? -1 : 1;
@@@ -233,14 -260,17 +260,17 @@@ param_rec_values_cmp (GParamSpec *psp
// SfiParamSpecRec *rspec = SFI_PSPEC_REC (pspec);
SfiRec *rec1 = sfi_value_get_rec (value1);
SfiRec *rec2 = sfi_value_get_rec (value2);
-
++
if (!rec1 || !rec2)
return rec2 ? -1 : rec1 != rec2;
// if (rec1->n_fields) return -1;
-
++
if (rec1->n_fields != rec2->n_fields)
return rec1->n_fields < rec2->n_fields ? -1 : 1;
else /* rec1->n_fields == rec2->n_fields */
{
guint i;
-
++
sfi_rec_sort (rec1);
sfi_rec_sort (rec2);
for (i = 0; i < rec1->n_fields; i++)
@@@ -251,12 -281,15 +281,15 @@@
GValue *field2 = rec2->fields + i;
GParamSpec *fspec;
gint cmp;
-
++
cmp = strcmp (field_name1, field_name2);
if (cmp)
return cmp;
-
++
/* need corresponding field types, provide stable result otherwise */
if (G_VALUE_TYPE (field1) != G_VALUE_TYPE (field2))
return G_VALUE_TYPE (field1) < G_VALUE_TYPE (field2) ? -1 : 1;
-
++
fspec = sfi_pspec_get_rec_field (pspec, field_name1);
/* ignore fields without or non conforming param specs */
if (fspec && G_VALUE_HOLDS (field1, G_PARAM_SPEC_VALUE_TYPE (fspec)))
@@@ -276,13 -310,16 +310,16 @@@ param_seq_validate (GParamSpec *pspec
SfiParamSpecSeq *sspec = SFI_PSPEC_SEQ (pspec);
SfiSeq *seq = sfi_value_get_seq (value);
guint changed = 0;
-
++
if (seq && sspec->element)
{
GParamSpec *element_spec = sspec->element;
guint i;
-
++
for (i = 0; i < seq->n_elements; i++)
{
GValue *element = seq->elements + i;
-
++
/* support conversion of wrongly typed elements */
if (G_VALUE_TYPE (element) != G_PARAM_SPEC_VALUE_TYPE (element_spec) &&
sfi_value_type_transformable (G_VALUE_TYPE (element), G_PARAM_SPEC_VALUE_TYPE (element_spec)))
@@@ -294,6 -331,7 +331,7 @@@
memcpy (element, &dummy, sizeof (dummy)); /* relocate value */
changed++;
}
-
++
/* need to fixup value type, or ensure that the element is initialized at all */
if (!sfi_value_type_compatible (G_VALUE_TYPE (element), G_PARAM_SPEC_VALUE_TYPE (element_spec)))
{
@@@ -303,6 -341,7 +341,7 @@@
g_param_value_set_default (element_spec, element);
changed++;
}
-
++
/* validate element against element_spec */
changed += g_param_value_validate (element_spec, element);
}
@@@ -329,14 -370,17 +370,17 @@@ param_rec_validate (GParamSpec *pspec
{
SfiRec *rec = sfi_value_get_rec (value);
guint changed = 0;
-
++
if (rec)
{
SfiRecFields fspecs = sfi_pspec_get_rec_fields (pspec);
guint i;
-
++
for (i = 0; i < fspecs.n_fields; i++)
{
GParamSpec *fspec = fspecs.fields[i];
GValue *field = sfi_rec_get (rec, fspec->name);
-
++
/* ensure field presence */
if (!field)
{
@@@ -348,6 -392,7 +392,7 @@@
field = sfi_rec_get (rec, fspec->name);
changed++;
}
-
++
/* support conversion of wrongly typed fields */
if (G_VALUE_TYPE (field) != G_PARAM_SPEC_VALUE_TYPE (fspec) &&
sfi_value_type_transformable (G_VALUE_TYPE (field), G_PARAM_SPEC_VALUE_TYPE (fspec)))
@@@ -359,6 -404,7 +404,7 @@@
memcpy (field, &dummy, sizeof (dummy)); /* relocate value */
changed++;
}
-
++
/* need to fixup value type, or ensure that the field is initialized at all */
if (!sfi_value_type_compatible (G_VALUE_TYPE (field), G_PARAM_SPEC_VALUE_TYPE (fspec)))
{
@@@ -368,6 -414,7 +414,7 @@@
g_param_value_set_default (fspec, field);
changed++;
}
-
++
/* validate field against field_spec */
changed += g_param_value_validate (fspec, field);
}
@@@ -568,8 -645,10 +645,10 @@@ sfi_pspec_seq (const gchar *name
g_param_spec_sink (element_spec);
}
pspec->value_type = SFI_TYPE_SEQ;
-
++
return pspec;
}
+
GParamSpec*
sfi_pspec_rec (const gchar *name,
const gchar *nick,
@@@ -909,7 -1014,9 +1014,9 @@@ sfi_pspec_choice_from_enum (GParamSpec
GParamSpecEnum *espec;
TmpChoiceValues *tcv;
GEnumValue *default_evalue;
+
g_return_val_if_fail (G_IS_PARAM_SPEC_ENUM (enum_pspec), NULL);
-
++
espec = G_PARAM_SPEC_ENUM (enum_pspec);
tcv = tmp_choice_values_from_enum (espec->enum_class);
default_evalue = g_enum_get_value (espec->enum_class, espec->default_value);
@@@ -938,7 -1049,9 +1049,9 @@@ GParamSpec
sfi_pspec_to_serializable (GParamSpec *xpspec)
{
GParamSpec *pspec = NULL;
-
++
g_return_val_if_fail (G_IS_PARAM_SPEC (xpspec), NULL);
-
++
if (sfi_categorize_pspec (xpspec))
pspec = g_param_spec_ref (xpspec);
else if (G_IS_PARAM_SPEC_BOXED (xpspec))
@@@ -960,17 -1073,22 +1073,22 @@@
pspec = sfi_pspec_choice_from_enum (xpspec);
else if (G_IS_PARAM_SPEC_OBJECT (xpspec))
pspec = sfi_pspec_proxy_from_object (xpspec);
-
++
if (!pspec)
g_warning ("%s: unable to convert non serializable pspec \"%s\" of type `%s'",
G_STRLOC, xpspec->name, g_type_name (G_PARAM_SPEC_VALUE_TYPE (xpspec)));
-
++
return pspec;
}
+
+
/* --- pspec accessors --- */
GParamSpec *
sfi_pspec_set_group (GParamSpec *pspec,
const gchar *group)
{
g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), pspec);
-
++
g_param_spec_set_qdata_full (pspec, quark_param_group, g_strdup (group), group ? g_free : NULL);
return pspec;
}
@@@ -1026,14 -1156,18 +1156,18 @@@ SfiBoo
sfi_pspec_get_bool_default (GParamSpec *pspec)
{
g_return_val_if_fail (SFI_IS_PSPEC_BOOL (pspec), FALSE);
-
++
return SFI_PSPEC_BOOL (pspec)->default_value;
}
+
SfiInt
sfi_pspec_get_int_default (GParamSpec *pspec)
{
g_return_val_if_fail (SFI_IS_PSPEC_INT (pspec), 0);
-
++
return SFI_PSPEC_INT (pspec)->default_value;
}
+
void
sfi_pspec_get_int_range (GParamSpec *pspec,
SfiInt *minimum_value,
@@@ -1041,7 -1175,9 +1175,9 @@@
SfiInt *stepping)
{
SfiParamSpecInt *ispec;
-
++
g_return_if_fail (SFI_IS_PSPEC_INT (pspec));
-
++
ispec = SFI_PSPEC_INT (pspec);
if (minimum_value)
*minimum_value = ispec->minimum;
@@@ -1054,8 -1191,10 +1191,10 @@@ SfiNu
sfi_pspec_get_num_default (GParamSpec *pspec)
{
g_return_val_if_fail (SFI_IS_PSPEC_NUM (pspec), 0);
-
++
return SFI_PSPEC_NUM (pspec)->default_value;
}
+
void
sfi_pspec_get_num_range (GParamSpec *pspec,
SfiNum *minimum_value,
@@@ -1063,7 -1202,9 +1202,9 @@@
SfiNum *stepping)
{
SfiParamSpecNum *nspec;
-
++
g_return_if_fail (SFI_IS_PSPEC_NUM (pspec));
-
++
nspec = SFI_PSPEC_NUM (pspec);
if (minimum_value)
*minimum_value = nspec->minimum;
@@@ -1076,8 -1218,10 +1218,10 @@@ SfiRea
sfi_pspec_get_real_default (GParamSpec *pspec)
{
g_return_val_if_fail (SFI_IS_PSPEC_REAL (pspec), 0);
-
++
return SFI_PSPEC_REAL (pspec)->default_value;
}
+
void
sfi_pspec_get_real_range (GParamSpec *pspec,
SfiReal *minimum_value,
@@@ -1085,7 -1229,9 +1229,9 @@@
SfiReal *stepping)
{
SfiParamSpecReal *nspec;
-
++
g_return_if_fail (SFI_IS_PSPEC_REAL (pspec));
-
++
nspec = SFI_PSPEC_REAL (pspec);
if (minimum_value)
*minimum_value = nspec->minimum;
@@@ -1098,20 -1245,26 +1245,26 @@@ const gchar
sfi_pspec_get_string_default (GParamSpec *pspec)
{
g_return_val_if_fail (SFI_IS_PSPEC_STRING (pspec), NULL);
-
++
return SFI_PSPEC_STRING (pspec)->default_value;
}
+
const gchar*
sfi_pspec_get_choice_default (GParamSpec *pspec)
{
g_return_val_if_fail (SFI_IS_PSPEC_CHOICE (pspec), NULL);
-
++
return G_PARAM_SPEC_STRING (pspec)->default_value;
}
+
SfiChoiceValues
sfi_pspec_get_choice_values (GParamSpec *pspec)
{
SfiParamSpecChoice *cspec;
SfiChoiceValues dummy = { 0, };
-
++
g_return_val_if_fail (SFI_IS_PSPEC_CHOICE (pspec), dummy);
-
++
cspec = SFI_PSPEC_CHOICE (pspec);
return cspec->cvalues;
}
@@@ -1137,7 -1292,9 +1292,9 @@@ GParamSpec
sfi_pspec_get_seq_element (GParamSpec *pspec)
{
SfiParamSpecSeq *sspec;
-
++
g_return_val_if_fail (SFI_IS_PSPEC_SEQ (pspec), NULL);
-
++
sspec = SFI_PSPEC_SEQ (pspec);
return sspec->element;
}
@@@ -1146,7 -1304,9 +1304,9 @@@ sfi_pspec_get_rec_fields (GParamSpec *p
{
SfiParamSpecRec *rspec;
SfiRecFields dummy = { 0, };
-
++
g_return_val_if_fail (SFI_IS_PSPEC_REC (pspec), dummy);
-
++
rspec = SFI_PSPEC_REC (pspec);
return rspec->fields;
}
@@@ -1156,7 -1317,9 +1317,9 @@@ sfi_pspec_get_rec_field (GParamSpec *p
{
SfiParamSpecRec *rspec;
guint i;
-
++
g_return_val_if_fail (SFI_IS_PSPEC_REC (pspec), NULL);
-
++
rspec = SFI_PSPEC_REC (pspec);
for (i = 0; i < rspec->fields.n_fields; i++)
if (strcmp (rspec->fields.fields[i]->name, field) == 0)
@@@ -1246,12 -1414,17 +1414,17 @@@ sfi_categorize_pspec (GParamSpec *pspec
{
GType value_type, pspec_type;
SfiSCategory cat;
-
++
g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), SFI_SCAT_INVAL);
-
++
value_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
pspec_type = G_PARAM_SPEC_TYPE (pspec);
-
++
cat = sfi_categorize_type (value_type);
-
++
if (!g_type_is_a (pspec_type, sfi_category_param_type (cat)))
return SFI_SCAT_INVAL;
-
++
switch (cat)
{
case SFI_SCAT_INT:
@@@ -1265,8 -1438,11 +1438,11 @@@
default:
break;
}
-
++
return cat;
}
+
+
/* --- convenience aliases --- */
GParamSpec*
sfi_pspec_time (const gchar *name,
@@@ -1383,6 -1566,7 +1566,7 @@@ sfi_pspec_to_rec (GParamSpec *pspec
default:
break;
}
-
++
/* log scales */
if (sfi_pspec_get_log_scale (pspec, &log_center, &log_base, &log_n_steps))
{
@@@ -1390,8 -1574,10 +1574,10 @@@
sfi_rec_set_real (prec, "log_base", log_base);
sfi_rec_set_real (prec, "log_n_steps", log_n_steps);
}
-
++
return prec;
}
+
GParamSpec*
sfi_pspec_from_rec (SfiRec *prec)
{
@@@ -1408,6 -1596,7 +1596,7 @@@
nick = sfi_rec_get_string (prec, "nick");
blurb = sfi_rec_get_string (prec, "blurb");
hints = sfi_rec_get_string (prec, "options");
-
++
reswitch:
switch (scat)
{
diff --cc sfi/sfiprimitives.cc
index b4f61ca,68389a6..bc95b1e
--- a/sfi/sfiprimitives.cc
+++ b/sfi/sfiprimitives.cc
@@@ -312,8 -371,10 +371,10 @@@ sfi_seq_append (SfiSeq *seq
{
g_return_if_fail (seq != NULL);
g_return_if_fail (G_IS_VALUE (value));
-
++
sfi_seq_append_copy (seq, G_VALUE_TYPE (value), FALSE, value);
}
+
GValue*
sfi_seq_append_empty (SfiSeq *seq,
GType value_type)
@@@ -334,14 -398,18 +398,18 @@@ sfi_seq_get (const SfiSeq *seq
{
g_return_val_if_fail (seq != NULL, NULL);
g_return_val_if_fail (index < seq->n_elements, NULL);
-
++
return seq->elements + index;
}
+
gboolean
sfi_seq_check (SfiSeq *seq,
GType element_type)
{
guint i;
-
++
g_return_val_if_fail (seq != NULL, FALSE);
-
++
for (i = 0; i < seq->n_elements; i++)
if (!G_VALUE_HOLDS (seq->elements + i, element_type))
return FALSE;
@@@ -632,13 -739,17 +739,17 @@@ sfi_rec_ref (SfiRec *rec
{
g_return_val_if_fail (rec != NULL, NULL);
g_return_val_if_fail (rec->ref_count > 0, NULL);
-
++
rec->ref_count++;
-
++
return rec;
}
+
static void
sfi_rec_empty (SfiRec *rec)
{
guint i;
-
++
for (i = 0; i < rec->n_fields; i++)
{
g_value_unset (rec->fields + i);
@@@ -656,6 -768,7 +768,7 @@@ sfi_rec_unref (SfiRec *rec
{
g_return_if_fail (rec != NULL);
g_return_if_fail (rec->ref_count > 0);
-
++
rec->ref_count--;
if (rec->ref_count == 0)
{
@@@ -682,8 -799,10 +799,10 @@@ sfi_rec_field (const SfiRec *rec
{
g_return_val_if_fail (rec != NULL, NULL);
g_return_val_if_fail (index < rec->n_fields, NULL);
-
++
return rec->fields + index;
}
+
/* valid chars for dupcanon */
static inline int
valid (char c)
@@@ -782,8 -909,10 +909,10 @@@ sfi_rec_set (SfiRec *rec
g_return_if_fail (rec != NULL);
g_return_if_fail (field_name != NULL);
g_return_if_fail (SFI_IS_VALUE (value));
-
++
sfi_rec_set_copy (rec, field_name, G_VALUE_TYPE (value), FALSE, value);
}
+
GValue*
sfi_rec_get (SfiRec *rec,
const gchar *field_name)
@@@ -791,8 -920,10 +920,10 @@@
const gchar *name;
gchar *dupcanon_name;
guint i;
-
++
g_return_val_if_fail (rec != NULL, NULL);
g_return_val_if_fail (field_name != NULL, NULL);
+
if (!rec->sorted)
sfi_rec_sort (rec);
dupcanon_name = may_dupcanon (field_name);
@@@ -841,8 -974,10 +974,10 @@@ sfi_rec_copy_deep (SfiRec *rec
{
SfiRec *r;
guint i;
-
++
g_return_val_if_fail (rec != NULL, NULL);
g_return_val_if_fail (rec->ref_count > 0, NULL);
+
sfi_rec_sort (rec);
r = sfi_rec_new ();
for (i = 0; i < rec->n_fields; i++)
@@@ -911,8 -1053,10 +1053,10 @@@ sfi_rec_swap_fields (SfiRec *rec
guint n;
GValue *fields;
gchar **names;
+
g_return_if_fail (rec != NULL);
g_return_if_fail (swapper != NULL);
-
++
sfi_rec_sort (rec);
sfi_rec_sort (swapper);
n = rec->n_fields;
diff --cc sfi/sfiring.cc
index 51ffb50,f7b2d31..b45d84b
--- a/sfi/sfiring.cc
+++ b/sfi/sfiring.cc
@@@ -67,6 -75,7 +75,7 @@@ sfi_ring_prepend_i (SfiRing *head
gpointer data)
{
SfiRing *ring = node_alloc();
-
++
ring->data = data;
return sfi_ring_prepend_link_i (head, ring);
}
@@@ -193,6 -215,7 +215,7 @@@ sfi_ring_concat (SfiRing *head1
SfiRing *head2)
{
SfiRing *tail1, *tail2;
-
++
if (!head1)
return head2;
if (!head2)
@@@ -203,8 -226,10 +226,10 @@@
tail2->next = head1;
head2->prev = tail1;
tail1->next = head2;
-
++
return head1;
}
+
/**
* @param head1 a non-empty ring
* @param head2 a ring node different from @a head1 contained in @a head1
@@@ -219,9 -244,11 +244,11 @@@ sfi_ring_split (SfiRing *head1
SfiRing *head2)
{
SfiRing *tail1, *tail2;
-
++
g_return_val_if_fail (head1 != NULL, NULL);
g_return_val_if_fail (head2 != NULL, NULL);
g_return_val_if_fail (head1 != head2, NULL);
-
++
tail1 = head2->prev;
tail2 = head1->prev;
head2->prev = tail2;
@@@ -254,21 -283,26 +283,26 @@@ sfi_ring_remove_node (SfiRing *head
g_return_val_if_fail (head == NULL && node == NULL, NULL);
if (!head || !node)
return NULL;
-
++
/* special case one item ring */
if (head->prev == head)
{
g_return_val_if_fail (node == head, head);
-
++
node_free (node);
return NULL;
}
g_return_val_if_fail (node != node->next, head); /* node can't be a one item ring here */
-
++
node->next->prev = node->prev;
node->prev->next = node->next;
if (head == node)
head = node->next;
node_free (node);
-
++
return head;
}
+
SfiRing*
sfi_ring_reverse (SfiRing *head)
{
@@@ -291,38 -326,50 +326,50 @@@ sfi_ring_remove (SfiRing *head
gpointer data)
{
SfiRing *walk;
-
++
if (!head)
return NULL;
-
++
/* make tail data removal an O(1) operation */
if (head->prev->data == data)
return sfi_ring_remove_node (head, head->prev);
-
++
for (walk = head; walk; walk = sfi_ring_walk (walk, head))
if (walk->data == data)
return sfi_ring_remove_node (head, walk);
-
++
/* g_warning (G_STRLOC ": couldn't find data item (%p) to remove from ring (%p)", data, head); */
-
++
return head;
}
+
guint
sfi_ring_length (const SfiRing *head)
{
const SfiRing *ring;
guint i = 0;
-
++
for (ring = head; ring; ring = sfi_ring_walk (ring, head))
i++;
-
++
return i;
}
+
gint /* essentially compute length(ring) - test_length, clamped to -1..+1 */
sfi_ring_cmp_length (const SfiRing *head,
guint test_length)
{
const SfiRing *ring = head;
-
++
while (test_length && ring)
{
test_length--;
ring = sfi_ring_walk (ring, head);
}
-
++
return test_length > 0 ? -1 : ring != NULL;
}
+
SfiRing*
sfi_ring_find (const SfiRing *head,
gconstpointer data)
@@@ -347,10 -396,13 +396,13 @@@ sfi_ring_nth_data (const SfiRing *head
guint n)
{
const SfiRing *ring = head;
-
++
while (n-- && ring)
ring = sfi_ring_walk (ring, head);
-
++
return ring ? ring->data : NULL;
}
+
void
sfi_ring_free_deep (SfiRing *head,
GDestroyNotify data_destroy)
@@@ -375,24 -429,32 +429,32 @@@ gpointe
sfi_ring_pop_head (SfiRing **head_p)
{
gpointer data;
-
++
g_return_val_if_fail (head_p != NULL, NULL);
-
++
if (!*head_p)
return NULL;
data = (*head_p)->data;
*head_p = sfi_ring_remove_node (*head_p, *head_p);
-
++
return data;
}
+
gpointer
sfi_ring_pop_tail (SfiRing **head_p)
{
gpointer data;
-
++
g_return_val_if_fail (head_p != NULL, NULL);
-
++
if (!*head_p)
return NULL;
data = (*head_p)->prev->data;
*head_p = sfi_ring_remove_node (*head_p, (*head_p)->prev);
-
++
return data;
}
+
SfiRing*
sfi_ring_from_list (GList *list)
{
@@@ -438,17 -504,22 +504,22 @@@ sfi_ring_insert_sorted (SfiRing *
g_return_val_if_fail (cmp != NULL, head);
if (!head)
return sfi_ring_prepend (head, insertion_data);
-
++
/* implement stable sorting by inserting insertion_data *after* equal nodes */
-
++
if (cmp (insertion_data, head->data, cmp_data) >= 0) /* insert after head */
{
SfiRing *tmp, *tail = head->prev;
-
++
/* make appending an O(1) operation */
if (head == tail || cmp (insertion_data, tail->data, cmp_data) >= 0)
return sfi_ring_append (head, insertion_data);
-
++
/* walk forward while data >= tmp (skipping equal nodes) */
for (tmp = head->next; tmp != tail; tmp = tmp->next)
if (cmp (insertion_data, tmp->data, cmp_data) < 0)
break;
-
++
/* insert before sibling which is greater than insertion_data */
sfi_ring_prepend (tmp, insertion_data); /* keep current head */
return head;
@@@ -463,6 -535,7 +535,7 @@@ sfi_ring_merge_sorted (SfiRing *
gpointer data)
{
/* implement stable sorting by inserting head2 members *after* equal nodes from head1 */
-
++
if (head1 && head2)
{
SfiRing *tail1 = head1->prev;
@@@ -510,7 -584,9 +584,9 @@@ sfi_ring_sort (SfiRing *head
gpointer data)
{
g_return_val_if_fail (cmp != NULL, head);
-
++
/* stable sorting guaranteed by sfi_ring_merge_sorted() */
-
++
if (head && head->next != head)
{
SfiRing *ring, *tmp, *tail = head->prev;
@@@ -879,6 -968,7 +968,7 @@@ sfi_ring_reorder (SfiRing *unord
else /* catch dups */
counts[j]++;
n_items = j + 1; /* shrink to number of different items */
-
++
/* pick unordered_ring members in the order given by new_ring_order;
* O(length(new_ring_order) * O(bsearch(unordered_ring)))
*/
@@@ -888,10 -978,12 +978,12 @@@
counts[i]--;
unordered_ring = sfi_ring_append (unordered_ring, ring->data);
}
-
++
/* append left-over members from sorted_ring; O(length(unordered_ring)) */
for (i = 0; i < n_items; i++)
while (counts[i]--)
unordered_ring = sfi_ring_append (unordered_ring, items[i]);
-
++
g_free (items);
g_free (counts);
return unordered_ring;
diff --cc sfi/sfiserial.cc
index 74101f2,7005b83..a62e8ae
--- a/sfi/sfiserial.cc
+++ b/sfi/sfiserial.cc
@@@ -320,6 -334,7 +334,7 @@@ sfi_serialize_primitives (SfiSCategory
if (gstring)
{
gchar numbuf[G_ASCII_DTOSTR_BUF_SIZE + 1] = "";
-
++
if (g_option_check (hints, "f")) /* float hint */
gstring_puts (gstring, g_ascii_formatd (numbuf, G_ASCII_DTOSTR_BUF_SIZE, "%.7g",
sfi_value_get_real (value)));
else
diff --cc sfi/sfistore.cc
index 3c11a46,15bb92d..838ccdd
--- a/sfi/sfistore.cc
+++ b/sfi/sfistore.cc
@@@ -32,6 -38,7 +38,7 @@@ voi
sfi_wstore_destroy (SfiWStore *wstore)
{
g_return_if_fail (wstore != NULL);
-
++
g_string_free (wstore->text, TRUE);
wstore->text = NULL;
while (wstore->bblocks)
@@@ -52,6 -61,7 +61,7 @@@ voi
sfi_wstore_break (SfiWStore *wstore)
{
g_return_if_fail (wstore != NULL);
-
++
if (wstore->needs_break)
{
guint n;
@@@ -66,12 -77,15 +77,15 @@@ voi
sfi_wstore_push_level (SfiWStore *wstore)
{
g_return_if_fail (wstore != NULL);
-
++
wstore->indent += 2;
}
+
void
sfi_wstore_pop_level (SfiWStore *wstore)
{
g_return_if_fail (wstore != NULL);
-
++
if (wstore->indent >= 2)
wstore->indent -= 2;
}
@@@ -80,6 -95,7 +95,7 @@@ sfi_wstore_puts (SfiWStore *wstore
const gchar *string)
{
g_return_if_fail (wstore != NULL);
-
++
if (string)
{
g_string_append (wstore->text, string);
@@@ -92,6 -109,7 +109,7 @@@ sfi_wstore_putc (SfiWStore *wstore
gchar character)
{
g_return_if_fail (wstore != NULL);
-
++
g_string_append_c (wstore->text, character);
sfi_wstore_text_changed (wstore);
}
@@@ -102,7 -121,9 +121,9 @@@ sfi_wstore_printf (SfiWStore *wstore
{
gchar *buffer;
va_list args;
-
++
g_return_if_fail (wstore != NULL);
+
const gchar *ldir = g_printf_find_localised_directive (format);
if (ldir)
g_warning ("%s: encountered localised directive \"%s\" in format string: \"%s\"", G_STRFUNC, ldir,
format);
@@@ -109,6 -131,7 +131,7 @@@
va_start (args, format);
buffer = g_strdup_vprintf (format, args);
va_end (args);
-
++
g_string_append (wstore->text, buffer);
if (buffer[0])
sfi_wstore_text_changed (wstore);
@@@ -137,8 -169,10 +169,10 @@@ sfi_wstore_put_value (SfiWStore *wst
const GValue *value)
{
GString *gstring;
-
++
g_return_if_fail (wstore != NULL);
g_return_if_fail (G_IS_VALUE (value));
-
++
gstring = g_string_new (NULL);
sfi_value_store_typed (value, gstring);
sfi_wstore_puts (wstore, gstring->str);
@@@ -151,13 -186,16 +186,16 @@@ sfi_wstore_put_param (SfiWStore *wst
{
GValue svalue = { 0, };
GParamSpec *spspec;
-
++
g_return_if_fail (wstore != NULL);
g_return_if_fail (G_IS_VALUE (value));
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
-
++
spspec = sfi_pspec_to_serializable (pspec);
if (!spspec) /* we really can't do anything here */
g_error ("unable to (de-)serialize \"%s\" of type `%s'", pspec->name,
g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
-
++
g_value_init (&svalue, G_PARAM_SPEC_VALUE_TYPE (spspec));
if (sfi_value_transform (value, &svalue))
{
@@@ -191,14 -230,17 +230,17 @@@ sfi_wstore_put_binary (SfiWStore *
GDestroyNotify destroy)
{
BBlock *bblock;
-
++
g_return_if_fail (wstore != NULL);
g_return_if_fail (wstore->flushed == FALSE);
g_return_if_fail (reader != NULL);
-
++
bblock = g_new0 (BBlock, 1);
bblock->reader = reader;
bblock->data = data;
bblock->destroy = destroy;
wstore->bblocks = sfi_ring_append (wstore->bblocks, bblock);
-
++
sfi_wstore_puts (wstore, "(binary-appendix ");
bblock->patch_offset = wstore->text->len;
sfi_wstore_puts (wstore, "0x00000000 0x00000000)");
@@@ -221,11 -267,15 +267,15 @@@ sfi_wstore_flush_fd (SfiWStore *wstore
SfiRing *ring;
off_t text_offset, binary_offset;
guint l;
-
++
g_return_val_if_fail (wstore != NULL, -EINVAL);
g_return_val_if_fail (wstore->flushed == FALSE, -EINVAL);
g_return_val_if_fail (fd >= 0, -EINVAL);
+
wstore->flushed = TRUE;
+
sfi_wstore_break (wstore);
-
++
/* save text offset */
do
text_offset = lseek (fd, 0, SEEK_CUR);
@@@ -238,6 -289,7 +289,7 @@@
while (l < 0 && errno == EINTR);
if (l < 0 && errno)
return -errno;
-
++
/* binary data header */
if (wstore->bblocks)
{
@@@ -250,6 -302,7 +302,7 @@@
if (l < 0 && errno)
return -errno;
}
-
++
/* save binary offset */
do
binary_offset = lseek (fd, 0, SEEK_CUR);
@@@ -285,6 -341,7 +341,7 @@@
}
while (n);
}
-
++
/* patch binary offsets and lengths */
for (ring = wstore->bblocks; ring; ring = sfi_ring_walk (ring, wstore->bblocks))
{
diff --cc sfi/sfitime.cc
index 75cd29f,1bb238d..e478602
--- a/sfi/sfitime.cc
+++ b/sfi/sfitime.cc
@@@ -115,7 -131,9 +131,9 @@@ sfi_time_to_string (SfiTime ustime
{
time_t t = CLAMP (ustime, SFI_MIN_TIME, SFI_MAX_TIME) / SFI_USEC_FACTOR;
struct tm bt;
-
++
bt = *gmtime (&t); /* FIXME: not thread safe */
-
++
return g_strdup_printf ("%04d-%02d-%02d %02d:%02d:%02d",
bt.tm_year + 1900,
bt.tm_mon + 1,
@@@ -213,7 -237,9 +237,9 @@@ sfi_time_from_string_err (const gchar *
SfiTime ustime;
SfiRing *ring, *warnings = NULL;
guint i;
-
++
g_return_val_if_fail (time_string != NULL, 0);
-
++
/* here, we support several date formats by making several attempts
* to match a string and pick the best one. if we acquire a full match
* before all match possibilities have been tryed, we skip outstanding
@@@ -246,15 -272,19 +272,19 @@@
* more on time formats (ISO 8601) can be found at:
* http://www.cl.cam.ac.uk/~mgk25/iso-time.html
*/
-
++
string = g_strdup (time_string);
-
++
for (i = 0; i < n_formats; i++)
{
year[i] = month[i] = day[i] = 0;
hour[i] = minute[i] = second[i] = 0;
success[i] = garbage[i] = FALSE;
}
-
++
finished = FALSE;
i = 0;
-
++
#define DATE_CHECK(index) (year[(index)] >= 1990 && \
month[(index)] >= 1 && \
month[(index)] <= 12 && \
@@@ -273,6 -303,7 +303,7 @@@
{
gint n_values;
gchar end_char = 0;
-
++
n_values = sscanf (string,
"%u-%u-%u %u:%u:%u%c",
&year[i], &month[i], &day[i],
@@@ -287,6 -318,7 +318,7 @@@
{
gint n_values;
gchar end_char = 0;
-
++
second[i] = 0;
n_values = sscanf (string,
"%u-%u-%u %u:%u%c",
@@@ -302,6 -334,7 +334,7 @@@
{
gint n_values;
gchar end_char = 0;
-
++
second[i] = 0;
n_values = sscanf (string,
"%u-%u-%u%c",
@@@ -313,9 -346,11 +346,11 @@@
i++;
}
if (!finished) /* parse "mm/dd/yyyy hh:mm:ss" e.g. "04/16/1998 23:59:59" */
-
++
{
gint n_values;
gchar end_char = 0;
-
++
n_values = sscanf (string,
"%u/%u/%u %u:%u:%u%c",
&month[i], &day[i], &year[i],
@@@ -330,6 -365,7 +365,7 @@@
{
gint n_values;
gchar end_char = 0;
-
++
second[i] = 0;
n_values = sscanf (string,
"%u/%u/%u %u:%u%c",
@@@ -345,6 -381,7 +381,7 @@@
{
gint n_values;
gchar end_char = 0;
-
++
second[i] = 0;
n_values = sscanf (string,
"%u/%u/%u%c",
@@@ -359,6 -396,7 +396,7 @@@
{
gint n_values;
gchar end_char = 0;
-
++
n_values = sscanf (string,
"%u.%u.%u %u:%u:%u%c",
&day[i], &month[i], &year[i],
@@@ -373,6 -411,7 +411,7 @@@
{
gint n_values;
gchar end_char = 0;
-
++
second[i] = 0;
n_values = sscanf (string,
"%u.%u.%u %u:%u%c",
@@@ -388,6 -427,7 +427,7 @@@
{
gint n_values;
gchar end_char = 0;
-
++
second[i] = 0;
n_values = sscanf (string,
"%u.%u.%u%c",
@@@ -402,6 -442,7 +442,7 @@@
{
gint n_values;
gchar end_char = 0;
-
++
n_values = sscanf (string,
"%u:%u:%u %u-%u-%u%c",
&hour[i], &minute[i], &second[i],
@@@ -416,6 -457,7 +457,7 @@@
{
gint n_values;
gchar end_char = 0;
-
++
second[i] = 0;
n_values = sscanf (string,
"%u:%u %u-%u-%u%c",
@@@ -431,6 -473,7 +473,7 @@@
{
gint n_values;
gchar end_char = 0;
-
++
n_values = sscanf (string,
"%u:%u:%u %u/%u/%u%c",
&hour[i], &minute[i], &second[i],
@@@ -445,6 -488,7 +488,7 @@@
{
gint n_values;
gchar end_char = 0;
-
++
second[i] = 0;
n_values = sscanf (string,
"%u:%u %u/%u/%u%c",
@@@ -460,6 -504,7 +504,7 @@@
{
gint n_values;
gchar end_char = 0;
-
++
n_values = sscanf (string,
"%u:%u:%u %u.%u.%u%c",
&hour[i], &minute[i], &second[i],
@@@ -474,6 -519,7 +519,7 @@@
{
gint n_values;
gchar end_char = 0;
-
++
second[i] = 0;
n_values = sscanf (string,
"%u:%u %u.%u.%u%c",
@@@ -486,6 -532,7 +532,7 @@@
i++;
}
#undef DATE_CHECK
-
++
/* try to find out the best/first match if any */
if (finished)
i--;
@@@ -495,6 -542,7 +542,7 @@@
if (success[i])
break;
}
-
++
if (!success[i])
{
warnings = sfi_ring_append (warnings, g_strdup ("invalid date specification"));
@@@ -536,6 -585,7 +585,7 @@@
warnings = sfi_ring_append (warnings, g_strdup_printf ("%s out of bounds", "second"));
second[i] = CLAMP (second[i], 0, 61);
}
-
++
tm_data.tm_sec = second[i];
tm_data.tm_min = minute[i];
tm_data.tm_hour = hour[i];
@@@ -545,6 -595,7 +595,7 @@@
tm_data.tm_wday = 0;
tm_data.tm_yday = 0;
tm_data.tm_isdst = 1;
-
++
#if HAVE_TIMEGM
ttime = timegm (&tm_data); /* returns -1 on error */
#else
@@@ -561,12 -612,15 +612,15 @@@
g_free (tz);
}
#endif
-
++
ustime = ttime;
ustime *= SFI_USEC_FACTOR;
ustime = MAX (ustime, 0);
-
++
/* g_print ("mktime(): year(%u) month(%u) day(%u) hour(%u) minute(%u) second(%u)\n",
* year[i], month[i], day[i], hour[i], minute[i], second[i]);
*/
-
++
if (ustime < SFI_MIN_TIME) /* limit ustime to 1.1.1990 */
{
warnings = sfi_ring_append (warnings, g_strdup_printf ("invalid date specification (%lld < %lld,
gmt-diff=%lld)",
diff --cc sfi/sfitypes.cc
index 4d76eb2,da35a5d..b2088a6
--- a/sfi/sfitypes.cc
+++ b/sfi/sfitypes.cc
@@@ -124,7 -140,9 +140,9 @@@ sfi_constants_get_index (guin
guint l, offs, order, n_nodes = n_consts;
gchar *key;
gint i, cmp;
-
++
g_return_val_if_fail (constant != NULL, 0);
+
/* canonicalize key */
l = strlen (constant);
key = g_new (gchar, l);
diff --cc sfi/sfivalues.cc
index 1b22326,42cdaf9..c2e9108
--- a/sfi/sfivalues.cc
+++ b/sfi/sfivalues.cc
@@@ -73,8 -85,11 +85,11 @@@ _sfi_init_values (void
NULL, /* instance_init */
};
static GType value_types[6] = { 0, };
+
g_assert (sfi__value_types == NULL);
+
sfi__value_types = value_types;
-
++
/* value types */
SFI_TYPE_CHOICE = g_type_register_static (G_TYPE_STRING, "SfiChoice", &info, GTypeFlags (0));
SFI_TYPE_BBLOCK = g_boxed_type_register_static ("SfiBBlock", copy_bblock, free_bblock);
@@@ -182,8 -218,10 +218,10 @@@ sfi_value_take_fblock (GValue *value
SfiFBlock *fblock)
{
g_return_if_fail (SFI_VALUE_HOLDS_FBLOCK (value));
-
++
g_value_take_boxed (value, fblock);
}
+
GParamSpec*
sfi_value_get_pspec (const GValue *value)
{
@@@ -194,7 -234,9 +234,9 @@@ GParamSpec
sfi_value_dup_pspec (const GValue *value)
{
GParamSpec *pspec;
+
g_return_val_if_fail (SFI_VALUE_HOLDS_PSPEC (value), NULL);
-
++
pspec = g_value_get_param (value);
return pspec ? sfi_pspec_ref (pspec) : NULL;
}
@@@ -250,15 -306,19 +306,19 @@@ sfi_value_set_rec (GValue *value
SfiRec *rec)
{
g_return_if_fail (SFI_VALUE_HOLDS_REC (value));
-
++
g_value_set_boxed (value, rec);
}
+
void
sfi_value_take_rec (GValue *value,
SfiRec *rec)
{
g_return_if_fail (SFI_VALUE_HOLDS_REC (value));
-
++
g_value_take_boxed (value, rec);
}
+
SfiProxy
sfi_value_get_proxy (const GValue *value)
{
diff --cc sfi/sfiwrapper.cc
index 747c7ef,a58c892..47b7923
--- a/sfi/sfiwrapper.cc
+++ b/sfi/sfiwrapper.cc
@@@ -84,8 -244,9 +84,9 @@@ birnet_file_equals (const char *file1
void
sfi_url_show (const char *url)
{
- return Birnet::url_show (url);
+ return Rapicorn::url_show (url);
}
+
void
sfi_url_show_with_cookie (const char *url,
const char *url_title,
diff --cc sfi/tests/misctests.cc
index 6b7a5d2,ccf8b49..fc84d46
--- a/sfi/tests/misctests.cc
+++ b/sfi/tests/misctests.cc
@@@ -638,6 -806,7 +648,8 @@@ test_vmarshals (void
TDONE ();
sfi_seq_unref (seq);
}
+
++
static void
test_sfidl_seq (void)
{
@@@ -737,10 -932,15 +749,13 @@@ main (int argc
test_typed_serialization (SERIAL_TEST_PSPEC);
test_vmarshals ();
test_com_ports ();
- test_threads ();
test_sfidl_seq ();
- test_messages();
test_misc ();
+
return 0;
}
+
/* distcc preprocessing test */
const char *test_distcc_strings = "����";
+
/* vim:set ts=8 sts=2 sw=2: */
diff --cc shell/bsescm.cc
index 815f51a,12cce22..6b5e355
--- a/shell/bsescm.cc
+++ b/shell/bsescm.cc
@@@ -148,12 -175,16 +153,13 @@@ gh_main (int argc
}
sfi_glue_context_destroy (bse_scm_context);
}
+
static void
-shell_parse_args (gint *argc_p,
- gchar ***argv_p)
+shell_parse_args (int *argc_p, char **argv)
{
- guint argc = *argc_p;
- gchar **argv = *argv_p;
- guint i, e;
- gboolean initialize_bse_and_exit = FALSE;
-
+ uint argc = *argc_p;
+ uint i, e;
+ bool initialize_bse_and_exit = false;
for (i = 1; i < argc; i++)
{
if (strcmp (argv[i], "--") == 0 ||
@@@ -274,6 -306,7 +281,7 @@@
exit (0);
}
}
-
++
e = 1;
for (i = 1; i < argc; i++)
if (argv[i])
diff --cc shell/bsescminterp.cc
index d58fd95,d7c1b9b..2ea7dc4
--- a/shell/bsescminterp.cc
+++ b/shell/bsescminterp.cc
@@@ -322,8 -361,10 +361,10 @@@ bse_scm_proxy_equalp (SCM scm_p1
{
SfiProxy p1 = SCM_GET_GLUE_PROXY (scm_p1);
SfiProxy p2 = SCM_GET_GLUE_PROXY (scm_p2);
-
++
return SCM_BOOL (p1 == p2);
}
+
static int
bse_scm_proxy_print (SCM scm_p1,
SCM port,
@@@ -503,7 -559,9 +559,9 @@@ bse_scm_glue_set_prop (SCM s_proxy
}
else
scm_wrong_type_arg ("bse-set-prop", SCM_ARG3, s_value);
+
BSE_SCM_ALLOW_INTS ();
-
++
bse_scm_destroy_gc_plateau (gcplateau);
return SCM_UNSPECIFIED;
}
@@@ -529,7 -592,9 +592,9 @@@ bse_scm_glue_get_prop (SCM s_proxy
s_retval = bse_scm_from_value (value);
sfi_glue_gc_free_now ((void*) value, BseScmFreeFunc (sfi_value_free));
}
+
BSE_SCM_ALLOW_INTS ();
-
++
bse_scm_destroy_gc_plateau (gcplateau);
return s_retval;
}
@@@ -543,11 -609,15 +609,15 @@@ bse_scm_glue_call (SCM s_proc_name
gchar *proc_name;
GValue *value;
SfiSeq *seq;
-
++
SCM_ASSERT (IS_SCM_STRING (s_proc_name), s_proc_name, SCM_ARG1, "bse-glue-call");
SCM_ASSERT (IS_SCM_PAIR (s_arg_list) || s_arg_list == SCM_EOL, s_arg_list, SCM_ARG2, "bse-glue-call");
+
BSE_SCM_DEFER_INTS ();
-
++
proc_name = strdup_from_scm (s_proc_name);
bse_scm_enter_gc (&gclist, proc_name, g_free, STRING_LENGTH_FROM_SCM (s_proc_name));
+
seq = sfi_seq_new ();
bse_scm_enter_gc (&gclist, seq, BseScmFreeFunc (sfi_seq_unref), 1024); // FIXME: GC callbacks may run in
any thread
for (node = s_arg_list; IS_SCM_PAIR (node); node = SCM_CDR (node))
@@@ -640,8 -728,10 +728,10 @@@ bse_scm_signal_connect (SCM s_proxy
g_closure_set_marshal (closure, signal_closure_marshal);
id = sfi_glue_signal_connect_closure (proxy, sdata->signal, closure, NULL);
BSE_SCM_ALLOW_INTS ();
-
++
return gh_ulong2scm (id);
}
+
SCM
bse_scm_signal_disconnect (SCM s_proxy,
SCM s_handler_id)
@@@ -706,11 -807,12 +807,12 @@@ bse_scm_script_message (SCM s_type
/* figure message level */
BSE_SCM_DEFER_INTS();
gchar *strtype = strdup_from_scm (s_type);
- SfiMsgType mtype = sfi_msg_lookup_type (strtype);
+ Bse::String mtype = strtype ? strtype : "";
g_free (strtype);
BSE_SCM_ALLOW_INTS();
- if (!mtype)
+ if (!strtype)
scm_wrong_type_arg ("bse-script-message", 2, s_type);
+
/* figure argument list length */
guint i = 0;
SCM node = s_bits;
@@@ -868,6 -981,7 +981,7 @@@ bse_scm_script_register (SCM s_name
sfi_value_free (val);
sfi_seq_append (seq, val = string_value_from_scm (s_license));
sfi_value_free (val);
-
++
for (node = s_params; IS_SCM_PAIR (node); node = SCM_CDR (node))
{
SCM arg = SCM_CAR (node);
@@@ -976,6 -1105,7 +1105,7 @@@ register_types (const gchar **types
gchar *sname = g_type_name_to_sname (*types);
gchar *s;
guint i;
-
++
if (strncmp (sname, "bse-", 4) == 0)
{
s = g_strdup_printf ("(define (bse-is-%s proxy) (bse-item-check-is-a proxy \"%s\"))",
diff --cc tests/bse/filtertest.cc
index 2f827b0,e75b038..b2b95bc
--- a/tests/bse/filtertest.cc
+++ b/tests/bse/filtertest.cc
@@@ -246,6 -273,7 +266,7 @@@ public
m_a.push_back (coefficients[i+1]);
}
}
-
++
/* construction phase: used to add a passband to the specification */
void
add_passband (double freq_start,
diff --cc tests/latency/bselatencytest.idl
index e192577,4dc4a4f..a9c4d1e
--- a/tests/latency/bselatencytest.idl
+++ b/tests/latency/bselatencytest.idl
@@@ -13,8 -15,9 +13,9 @@@ interface LatencyTest : Effect
"After sending a midi event, the latency tester will count the number"
" of samples until it sees some signal on its input channel. From"
" that number a latency is computed and printed (or logged, if you specified a log
file)");
+
group _("Test configuration") {
- Real bpm = (_("Beats per Minute"), _("The speed at which test events (quarter notes) are generated"),
+ Real bpm = SfiReal (_("Beats per Minute"), _("The speed at which test events (quarter notes) are
generated"),
120, 10, 1000, 5, STANDARD);
Real threshold_db = Gain (_("Threshold [dB]"),
_("Input signal needs to be louder than this to be counted as active"),
diff --cc tests/testresampler.cc
index 75cce73,c0d4c99..a4e893c
--- a/tests/testresampler.cc
+++ b/tests/testresampler.cc
@@@ -593,9 -646,15 +646,11 @@@ main (int argc, char **argv
for (int i = 0; i < argc; i++)
if (strcmp (argv[i], "--fpu") == 0)
argv[i] = g_strdup ("--bse-force-fpu"); /* leak, but we don't care */
+
/* load plugins */
- SfiInitValue config[] = {
- { "load-core-plugins", "1" },
- { NULL },
- };
- bse_init_test (&argc, &argv, config);
+ bse_init_test (&argc, argv, Bse::cstrings_to_vector ("load-core-plugins=1", NULL));
options.parse (&argc, &argv);
+
if (argc == 2)
{
string command = argv[1];
diff --cc tools/bsefcompare.cc
index 001d453,3fc7717..8639825
--- a/tools/bsefcompare.cc
+++ b/tools/bsefcompare.cc
@@@ -223,7 -257,9 +257,9 @@@ static GScannerConfig scanner_config_
) /* cset_identifier_nth */,
const_cast<gchar *>
( "#\n" ) /* cpair_comment_single */,
-
++
TRUE /* case_sensitive */,
-
++
TRUE /* skip_comment_multi */,
TRUE /* skip_comment_single */,
TRUE /* scan_comment_multi */,
@@@ -562,6 -656,7 +656,7 @@@ FeatureValueFile::parse (const string&
while (!g_scanner_eof (scanner) && expected_token == G_TOKEN_NONE)
{
g_scanner_get_next_token (scanner);
-
++
if (scanner->token == G_TOKEN_EOF)
break;
else if (scanner->token == G_TOKEN_IDENTIFIER)
diff --cc tools/bsefextract.cc
index 34940fa,e25909e..9fac1db
--- a/tools/bsefextract.cc
+++ b/tools/bsefextract.cc
@@@ -132,6 -154,7 +154,7 @@@ public
{
return m_samples[k + m_offset];
}
-
++
double mix_freq() const
{
return gsl_data_handle_mix_freq (m_data_handle);
@@@ -1009,6 -1199,7 +1199,7 @@@ struct AttackTimes : public Featur
compute (const Signal &signal)
{
timing_slices->compute (signal);
-
++
for (int i = 0; i < timing_slices->n_slices(); i++)
attack_times.push_back (timing_slices->spectral_flux (i - 1, i,
TimingSlices::SPECTRAL_FLUX_POSITIVE));
}
@@@ -1033,6 -1228,7 +1228,7 @@@ struct ReleaseTimes : public Featur
compute (const Signal &signal)
{
timing_slices->compute (signal);
-
++
for (int i = 0; i < timing_slices->n_slices(); i++)
release_times.push_back (timing_slices->spectral_flux (i - 1, i,
TimingSlices::SPECTRAL_FLUX_NEGATIVE));
}
diff --cc tools/bseloopfuncs.cc
index 68f072f,56aece5..37fd213
--- a/tools/bseloopfuncs.cc
+++ b/tools/bseloopfuncs.cc
@@@ -631,6 -687,7 +687,7 @@@ gsl_data_find_loop1 (GslDataHandle *
config->loop_start, config->loop_start + config->loop_length, config->loop_length,
config->block_start, config->block_start + config->block_length, config->block_length,
config->score);
-
++
/* find best loop position */
ll = config->loop_length;
minll = ll;
@@@ -740,9 -807,11 +807,11 @@@ tailloop_score (GslDataCache *
lb = lnode->data + ldiff;
compare_len = loopstart - i;
loop_len = loopsize - (looppos - loopstart);
-
++
slen = MIN (slen, compare_len);
llen = MIN (llen, loop_len);
slen = MIN (slen, llen);
-
++
j = slen;
if (cfg->cmp_strategy == GSL_DATA_TAIL_LOOP_CMP_CORRELATION)
{
@@@ -759,6 -828,7 +828,7 @@@
if (score > worstscore)
break;
}
-
++
i += slen;
looppos += slen;
if (looppos >= loopstart + loopsize)
diff --cc tools/bwtwave.cc
index c42f14a,8649303..49570ff
--- a/tools/bwtwave.cc
+++ b/tools/bwtwave.cc
@@@ -307,6 -331,7 +331,7 @@@ Wave::store (const string file_name
sfi_wstore_putf (wstore, gsl_data_handle_osc_freq (chunk->dhandle));
sfi_wstore_puts (wstore, "\n");
}
-
++
GslDataHandle *dhandle, *tmp_handle = chunk->dhandle;
do /* skip comment or cache handles */
{
diff --cc tools/cutvorbis.cc
index 443685c,105c6d2..6f44398
--- a/tools/cutvorbis.cc
+++ b/tools/cutvorbis.cc
@@@ -67,10 -70,17 +70,11 @@@ main (int argc
const gchar *ifile, *ofile;
GslVorbisCutter *cutter;
gint ifd, ofd;
+
/* initialization */
- SfiInitValue values[] = {
- { "stand-alone", "true" }, /* no rcfiles etc. */
- { "wave-chunk-padding", NULL, 1, },
- { "dcache-block-size", NULL, 8192, },
- { "dcache-cache-memory", NULL, 5 * 1024 * 1024, },
- { NULL }
- };
- bse_init_inprocess (&argc, &argv, "BseCutVorbis", values);
-
+ bse_init_inprocess (&argc, argv, "BseCutVorbis",
+ Bse::cstrings_to_vector ("stand-alone=1", "wave-chunk-padding=1",
+ "dcache-block-size=8192", "dcache-cache-memory=5242880",
NULL));
/* arguments */
parse_args (&argc, &argv);
if (argc != 3)
diff --cc tools/magictest.cc
index e94928f,d55fc7d..1438b31
--- a/tools/magictest.cc
+++ b/tools/magictest.cc
@@@ -14,8 -15,10 +15,10 @@@ help (gchar *arg
fprintf (stderr, " -p include plugins\n");
fprintf (stderr, " -t test loading file info\n");
fprintf (stderr, " -h guess what ;)\n");
-
++
return arg != NULL;
}
+
int
main (gint argc,
gchar *argv[])
@@@ -64,6 -74,7 +67,7 @@@
GslMagic *magic = gsl_magic_list_match_file (magic_list, argv[i]);
guint l = strlen (argv[i]);
gchar *pad;
-
++
g_print ("%s:", argv[i]);
pad = g_strnfill (MAX (40, l) - l, ' ');
g_print ("%s", pad);
@@@ -93,5 -104,6 +97,6 @@@
g_print ("\n");
}
}
-
++
return 0;
}
diff --cc tools/mathtool.cc
index 11c667c,95d997a..6edad3a
--- a/tools/mathtool.cc
+++ b/tools/mathtool.cc
@@@ -17,6 -23,7 +23,7 @@@ static const gchar
shift (void)
{
const gchar *arg;
-
++
if (shift_argc > 1)
{
shift_argc--;
@@@ -32,8 -39,10 +39,10 @@@ static const gchar
pshift (void)
{
const gchar *arg = shift ();
-
++
return arg ? arg : "";
}
+
int
main (int argc,
char *argv[])
@@@ -44,12 -53,20 +53,14 @@@
const gchar *filter_label = 0;
gdouble *a, *b;
guint i, order = 0;
-
++
shift_argc = argc;
shift_argv = (const gchar**) argv;
+
/* init */
- SfiInitValue values[] = {
- { "stand-alone", "true" }, /* no rcfiles etc. */
- { "wave-chunk-padding", NULL, 1, },
- { "dcache-block-size", NULL, 8192, },
- { "dcache-cache-memory", NULL, 5 * 1024 * 1024, },
- { NULL }
- };
- bse_init_inprocess (&argc, &argv, NULL, values);
-
+ bse_init_inprocess (&argc, argv, NULL,
+ Bse::cstrings_to_vector ("stand-alone=1", "wave-chunk-padding=1",
+ "dcache-block-size=8192", "dcache-cache-memory=5242880",
NULL));
arg = shift ();
if (!arg)
usage ();
@@@ -76,14 -95,17 +87,17 @@@
else if (strcmp (arg, "wave-scan") == 0)
{
const gchar *file = pshift ();
-
++
while (file)
{
BseWaveFileInfo *fi;
BseErrorType error;
-
++
fi = bse_wave_file_info_load (file, &error);
if (fi)
{
guint i;
-
++
g_print ("Loader \"%s\" found %u waves in \"%s\":\n", fi->loader->name, fi->n_waves, file);
for (i = 0; i < fi->n_waves; i++)
g_print ("%u) %s\n", i + 1, fi->waves[i].name);
@@@ -99,6 -121,7 +113,7 @@@
else if (strcmp (arg, "file-test") == 0)
{
const gchar *file = pshift ();
-
++
g_print ("file test for \"%s\":\n", file);
g_print (" is readable : %s\n", bse_error_blurb (gsl_file_check (file, "r")));
g_print (" is writable : %s\n", bse_error_blurb (gsl_file_check (file, "w")));
@@@ -118,6 -141,7 +133,7 @@@
x = atof (pshift ());
y = atof (pshift ());
z = atof (pshift ());
-
++
g_print ("rf(%f, %f, %f) = %."PREC"f\n", x, y, z, gsl_ellip_rf (x, y, z));
}
else if (strcmp (arg, "F") == 0)
@@@ -125,6 -149,7 +141,7 @@@
double phi, ak;
phi = atof (pshift ());
ak = atof (pshift ());
-
++
g_print ("F(%f, %f) = %."PREC"f\n", phi, ak, gsl_ellip_F (phi, ak));
}
else if (strcmp (arg, "sn") == 0)
@@@ -132,6 -157,7 +149,7 @@@
double u, emmc;
u = atof (pshift ());
emmc = atof (pshift ());
-
++
g_print ("sn(%f, %f) = %."PREC"f\n", u, emmc, gsl_ellip_sn (u, emmc));
}
else if (strcmp (arg, "snc") == 0)
@@@ -141,6 -167,7 +159,7 @@@
u.im = atof (pshift ());
emmc.re = atof (pshift ());
emmc.im = atof (pshift ());
-
++
g_print ("snc(%s, %s) = %s\n",
bse_complex_str (u),
bse_complex_str (emmc),
@@@ -153,6 -180,7 +172,7 @@@
u.im = atof (pshift ());
k2.re = atof (pshift ());
k2.im = atof (pshift ());
-
++
g_print ("sci_snc(%s, %s) = %s\n",
bse_complex_str (u),
bse_complex_str (k2),
@@@ -163,6 -191,7 +183,7 @@@
double y, emmc;
y = atof (pshift ());
emmc = atof (pshift ());
-
++
g_print ("asn(%f, %f) = %."PREC"f\n", y, emmc, gsl_ellip_asn (y, emmc));
}
else if (strcmp (arg, "asnc") == 0)
@@@ -172,6 -201,7 +193,7 @@@
y.im = atof (pshift ());
emmc.re = atof (pshift ());
emmc.im = atof (pshift ());
-
++
g_print ("asnc(%s, %s) = %s\n",
bse_complex_str (y), bse_complex_str (emmc),
bse_complex_str (bse_complex_ellip_asn (y, emmc)));
@@@ -222,6 -252,7 +244,7 @@@
{
BseComplex root, roots[100];
guint i;
-
++
if (*arg == 'r')
{
g_print ("#roots:\n");
@@@ -333,6 -364,7 +356,7 @@@
f *= PI / 2.;
a = g_new (gdouble, order + 1);
b = g_new (gdouble, order + 1);
-
++
gsl_filter_butter_hp (order, f, e, a, b);
g_print ("# Highpass Butterworth filter order=%u freq=%f epsilon(s^2)=%f norm0=%f:\n",
order, f, e,
@@@ -350,6 -382,7 +374,7 @@@
f2 *= PI / 2.;
a = g_new (gdouble, order + 1);
b = g_new (gdouble, order + 1);
-
++
gsl_filter_butter_bp (order, f1, f2, e, a, b);
g_print ("# Bandpass Butterworth filter order=%u freq1=%f freq2=%f epsilon(s^2)=%f norm0=%f:\n",
order, f1, f2, e,
@@@ -367,6 -400,7 +392,7 @@@
f2 *= PI / 2.;
a = g_new (gdouble, order + 1);
b = g_new (gdouble, order + 1);
-
++
gsl_filter_butter_bs (order, f1, f2, e, a, b);
g_print ("# Bandstop Butterworth filter order=%u freq1=%f freq2=%f epsilon(s^2)=%f norm0=%f:\n",
order, f1, f2, e,
@@@ -382,6 -416,7 +408,7 @@@
f *= PI / 2.;
a = g_new (gdouble, order + 1);
b = g_new (gdouble, order + 1);
-
++
gsl_filter_tscheb1_lp (order, f, e, a, b);
g_print ("# Lowpass Tschebyscheff Type1 order=%u freq=%f epsilon(s^2)=%f norm0=%f:\n",
order, f, e,
@@@ -395,8 -430,10 +422,10 @@@
f = atof (pshift ());
e = atof (pshift ());
f *= PI / 2.;
-
++
a = g_new (gdouble, order + 1);
b = g_new (gdouble, order + 1);
-
++
gsl_filter_tscheb1_hp (order, f, e, a, b);
g_print ("# Highpass Tschebyscheff Type1 order=%u freq=%f epsilon(s^2)=%f norm0=%f:\n",
order, f, e,
@@@ -412,8 -449,10 +441,10 @@@
e = atof (pshift ());
fc *= PI / 2.;
fr *= PI / 2.;
-
++
a = g_new (gdouble, order + 1);
b = g_new (gdouble, order + 1);
-
++
gsl_filter_tscheb1_bs (order, fc, fr, e, a, b);
g_print ("# Bandstop Tschebyscheff Type1 order=%u freq_c=%f freq_r=%f epsilon(s^2)=%f norm=%f:\n",
order, fc, fr, e,
@@@ -429,8 -468,10 +460,10 @@@
e = atof (pshift ());
fc *= PI / 2.;
fr *= PI / 2.;
-
++
a = g_new (gdouble, order + 1);
b = g_new (gdouble, order + 1);
-
++
gsl_filter_tscheb1_bp (order, fc, fr, e, a, b);
g_print ("# Bandpass Tschebyscheff Type1 order=%u freq_c=%f freq_r=%f epsilon(s^2)=%f norm=%f:\n",
order, fc, fr, e,
@@@ -445,8 -486,10 +478,10 @@@
st = atof (pshift ());
e = atof (pshift ());
f *= PI / 2.;
-
++
a = g_new (gdouble, order + 1);
b = g_new (gdouble, order + 1);
-
++
gsl_filter_tscheb2_lp (order, f, st, e, a, b);
g_print ("# Lowpass Tschebyscheff Type2 order=%u freq=%f steepness=%f (%f) epsilon(s^2)=%f
norm=%f:\n",
order, f, st, f * (1.+st), e,
@@@ -461,8 -504,10 +496,10 @@@
st = atof (pshift ());
e = atof (pshift ());
f *= PI / 2.;
-
++
a = g_new (gdouble, order + 1);
b = g_new (gdouble, order + 1);
-
++
gsl_filter_tscheb2_hp (order, f, st, e, a, b);
g_print ("# Highpass Tschebyscheff Type2 order=%u freq=%f steepness=%f (%f, %f) epsilon(s^2)=%f
norm=%f:\n",
order, f, st, PI - f, (PI - f) * (1.+st), e,
@@@ -479,8 -524,10 +516,10 @@@
e = atof (pshift ());
f1 *= PI / 2.;
f2 *= PI / 2.;
-
++
a = g_new (gdouble, order + 1);
b = g_new (gdouble, order + 1);
-
++
gsl_filter_tscheb2_bp (order, f1, f2, st, e, a, b);
g_print ("# Bandpass Tschebyscheff Type2 order=%u freq1=%f freq2=%f steepness=%f epsilon(s^2)=%f
norm=%f:\n",
order, f1, f2, st, e,
@@@ -497,8 -544,10 +536,10 @@@
e = atof (pshift ());
f1 *= PI / 2.;
f2 *= PI / 2.;
-
++
a = g_new (gdouble, order + 1);
b = g_new (gdouble, order + 1);
-
++
gsl_filter_tscheb2_bs (order, f1, f2, st, e, a, b);
g_print ("# Bandstop Tschebyscheff Type2 order=%u freq1=%f freq2=%f steepness=%f epsilon(s^2)=%f
norm=%f:\n",
order, f1, f2, st, e,
@@@ -513,14 -562,17 +554,17 @@@
{
unsigned int iorder = atoi (pshift ());
unsigned int n_points = 0;
-
++
double *freq = g_newa (double, argc / 2 + 1);
double *value = g_newa (double, argc / 2 + 1);
double *a = g_newa (double, iorder);
const char *f, *v;
-
++
do
{
f = pshift ();
v = pshift ();
-
++
if (f[0] && v[0])
{
freq[n_points] = atof (f) * PI;
@@@ -529,14 -581,17 +573,17 @@@
}
}
while (f[0] && v[0]);
-
++
gsl_filter_fir_approx (iorder, a, n_points, freq, value, FALSE);
g_print ("FIR%u(z)=%s\n", iorder, bse_poly_str (iorder, a, "z"));
}
else
usage ();
-
++
if (a && b)
{
gdouble freq;
-
++
if (filter_mode == FILTER_SCAN)
{
freq = 0.001;
@@@ -557,11 -612,14 +604,14 @@@
g_free (a);
g_free (b);
}
-
++
arg = shift ();
if (arg)
goto restart;
-
++
return 0;
}
+
static void
usage (void)
{
diff --cc tools/sfiutils.cc
index eeccfd7,4a177cd..f1ecf88
--- a/tools/sfiutils.cc
+++ b/tools/sfiutils.cc
@@@ -22,14 -23,18 +23,18 @@@ parse_arguments (gint *arg
guint *lengths = alloca (sizeof (guint) * n_arguments);
guint i, k, l, missing = n_arguments, extraneous = n_arguments;
SfiRing *ring = NULL;
-
++
for (i = 0; i < n_arguments; i++)
{
g_return_val_if_fail (arguments[i].value_p != NULL, NULL);
-
++
lengths[i] = arguments[i].long_opt ? strlen (arguments[i].long_opt) : 0;
}
-
++
for (i = 1; i < argc; i++)
{
gchar *opt = argv[i];
-
++
l = strlen (opt);
if (l > 2 && opt[0] == '-' && opt[1] == '-')
{
@@@ -73,6 -78,7 +78,7 @@@
if (opt[0] == '-')
{
gboolean found_short = FALSE;
-
++
if (opt[1] == '-' && !opt[2]) /* abort on "--" */
break;
opt += 1;
@@@ -138,6 -144,7 +144,7 @@@
}
argv[i] = NULL;
}
-
++
/* handle errors */
if (unknown_short || missing < n_arguments || extraneous < n_arguments || extraneous_arg)
{
@@@ -156,9 -163,12 +163,12 @@@
g_printerr ("extraneous argument: \"%s\"\n", extraneous_arg);
exit (127);
}
-
++
sfi_arguments_collapse (argc_p, argv_p);
-
++
return ring;
}
+
void
sfi_arguments_parse (gint *argc_p,
gchar ***argv_p,
@@@ -181,6 -193,7 +193,7 @@@ sfi_arguments_collapse (gint *argc_p
{
gchar **argv = *argv_p;
guint argc = *argc_p, e, i;
-
++
e = 1;
for (i = 1; i < argc; i++)
if (argv[i])
@@@ -196,8 -211,10 +211,10 @@@ sfi_util_file_name_subst_ext (const gch
const gchar *new_extension)
{
gchar *p, *name;
-
++
g_return_val_if_fail (file_name != NULL, NULL);
g_return_val_if_fail (new_extension != NULL, NULL);
-
++
name = g_strdup (file_name);
p = strrchr (name, '.');
if (p && p > name)
@@@ -205,8 -222,11 +222,11 @@@
p = g_strconcat (name, new_extension, NULL);
g_free (name);
name = p;
-
++
return name;
}
+
+
/* --- word splitter --- */
static guint
upper_power2 (guint number)
@@@ -217,6 -238,7 +238,7 @@@ static voi
free_entry (SfiUtilFileList *flist)
{
guint i, j;
-
++
for (i = 0; i < flist->n_entries; i++)
{
for (j = 0; j < flist->entries[i].n_fields; j++)
@@@ -243,6 -267,7 +267,7 @@@ sfi_util_file_list_read (gint fd
gboolean line_start = TRUE;
gchar *cset_identifier;
guint i;
-
++
scanner = g_scanner_new64 (NULL);
scanner->config->cset_skip_characters = " \t\r"; /* parse "\n" */
scanner->config->scan_identifier_1char = TRUE;
@@@ -272,6 -297,7 +297,7 @@@
{
guint old_size = upper_power2 (flist.n_entries);
guint new_size = upper_power2 (++flist.n_entries);
-
++
if (new_size >= old_size)
flist.entries = g_renew (SfiUtilFileEntry, flist.entries, new_size);
entry = flist.entries + flist.n_entries - 1;
@@@ -283,6 -309,7 +309,7 @@@
{
guint old_size = upper_power2 (entry->n_fields);
guint new_size = upper_power2 (++entry->n_fields);
-
++
if (new_size >= old_size)
entry->fields = g_renew (gchar*, entry->fields, entry->n_fields);
entry->fields[entry->n_fields - 1] = g_strdup (scanner->value.v_string);
@@@ -298,8 -325,10 +325,10 @@@
}
g_scanner_destroy (scanner);
g_free (cset_identifier);
-
++
return g_memdup (&flist, sizeof (flist));
}
+
SfiUtilFileList*
sfi_util_file_list_read_simple (const gchar *file_name,
guint n_formats,
@@@ -309,8 -338,10 +338,10 @@@
gchar *s;
guint i;
gint fd;
-
++
g_return_val_if_fail (file_name != NULL, NULL);
g_return_val_if_fail (n_formats < 1000, NULL);
-
++
fd = open (file_name, O_RDONLY);
if (fd < 0)
return NULL;
@@@ -318,6 -349,7 +349,7 @@@
close (fd);
if (!flist)
return NULL;
-
++
flist->n_formats = n_formats;
flist->formats = g_new (gchar*, flist->n_formats);
s = g_new (gchar, flist->n_formats * 4);
@@@ -336,6 -368,7 +368,7 @@@
for (i = 0; s && *s && i < flist->n_formats; i++)
{
gchar *next = strchr (s, ':');
-
++
if (next)
*next++ = 0;
flist->formats[i] = s;
@@@ -349,6 -384,7 +384,7 @@@ str2num (const gchar *str
guint nth)
{
gchar *num_any = ".0123456789", *num_first = num_any + 1;
-
++
while (nth--)
{
/* skip number */
@@@ -373,6 -410,7 +410,7 @@@ sfi_util_file_entry_get_field (SfiUtilF
const gchar *format = *format_p;
gchar *field, *ep = NULL;
glong fnum;
-
++
*format_p = NULL;
if (*format == '#')
return format + 1;
@@@ -390,6 -429,7 +429,7 @@@ sfi_util_file_entry_get_string (SfiUtil
const gchar *dflt)
{
const gchar *field;
-
++
field = sfi_util_file_entry_get_field (entry, &format);
if (!field)
return g_strdup (dflt);
@@@ -405,6 -446,7 +446,7 @@@ sfi_util_file_entry_get_num (SfiUtilFil
const gchar *field = sfi_util_file_entry_get_field (entry, &format);
gchar *base, *ep = NULL;
gdouble d = dflt;
-
++
if (!field)
return d;
if (format)
@@@ -445,6 -488,7 +488,7 @@@ sfi_arguments_extract_num (const gchar
{
gchar *base, *ep = NULL;
gdouble d = dflt;
-
++
if (!string)
return d;
if (format)
@@@ -499,6 -544,7 +544,7 @@@ sfi_arguments_read_num (const gchar **o
const gchar *opt, *spaces = " \t\n";
gchar *p = NULL;
gdouble d;
-
++
if (!option)
return FALSE;
if (!*option)
@@@ -546,6 -593,7 +593,7 @@@ sfi_arguments_read_all_nums (const gcha
va_list args;
gdouble *d;
guint n = 0;
-
++
va_start (args, first);
d = first;
while (d)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]