Mercurial > hg > nimfks
view src/matlab/drawClickCallBack.m @ 0:c52bc3e8d3ad tip
user: boblsturm
branch 'default'
added README.md
added assets/.DS_Store
added assets/playButton.jpg
added assets/stopButton.png
added assets/swapButton.jpg
added data/.DS_Store
added data/fiveoctaves.mp3
added data/glock2.wav
added data/sinScale.mp3
added data/speech_female.mp3
added data/sweep.wav
added nimfks.m.lnk
added src/.DS_Store
added src/matlab/.DS_Store
added src/matlab/AnalysisCache.m
added src/matlab/CSS.m
added src/matlab/DataHash.m
added src/matlab/ExistsInCache.m
added src/matlab/KLDivCost.m
added src/matlab/LoadFromCache.m
added src/matlab/SA_B_NMF.m
added src/matlab/SaveInCache.m
added src/matlab/Sound.m
added src/matlab/SynthesisCache.m
added src/matlab/chromagram_E.m
added src/matlab/chromagram_IF.m
added src/matlab/chromagram_P.m
added src/matlab/chromsynth.m
added src/matlab/computeSTFTFeat.m
added src/matlab/controller.m
added src/matlab/decibelSliderReleaseCallback.m
added src/matlab/drawClickCallBack.m
added src/matlab/fft2chromamx.m
added src/matlab/hz2octs.m
added src/matlab/ifgram.m
added src/matlab/ifptrack.m
added src/matlab/istft.m
added src/matlab/nimfks.fig
added src/matlab/nimfks.m
added src/matlab/nmfFn.m
added src/matlab/nmf_beta.m
added src/matlab/nmf_divergence.m
added src/matlab/nmf_euclidean.m
added src/matlab/prune_corpus.m
added src/matlab/rot_kernel.m
added src/matlab/templateAdditionResynth.m
added src/matlab/templateDelCb.m
added src/matlab/templateScrollCb.m
author | boblsturm |
---|---|
date | Sun, 18 Jun 2017 06:26:13 -0400 |
parents | |
children |
line wrap: on
line source
%Used for the plot drawing function function drawClickCallBack(src,callbackdata, action) matlabVer = version; handles = guidata(src); ah = handles.axes2; if(strcmp(matlabVer, '9.0.0.341360 (R2016a)')) xAxisProps = get(ah, 'XAxis'); xLimits = get(xAxisProps, 'Limits') else xAxisProps = get(ah, 'Xlim'); xLimits = xAxisProps end acts = handles.SynthesisObject.Activations; yMax = size(acts, 1); xMax = size(acts, 2); xUnit = xLimits/size(acts, 2); sliderHandle = handles.sld_actstrength; paintBrush = handles.grp_paintbrush.SelectedObject.String; paintBrushSize = 0; if(strcmp(paintBrush, 'Large Brush')) paintBrushSize = 1; else(strcmp(paintBrush, 'Small Brush')) paintBrushSize = 0; end if(strcmp(action, 'Draw')) src.Pointer = 'cross'; fillValue = get(sliderHandle, 'Value') elseif(strcmp(action, 'Erase')) src.Pointer = 'circle'; fillValue = 0; end cp = ah.CurrentPoint; cx = cp(1,1)/xUnit(2) cy = cp(1,2) drawXMax = (ceil(cx) + paintBrushSize); drawYMax = (ceil(cy) + paintBrushSize); drawXMin = (ceil(cx) - paintBrushSize); drawYMin = (ceil(cy) - paintBrushSize); if(drawXMax >= xMax) drawXMax = xMax; end if(drawYMax >= yMax) drawYMax = yMax; end if(drawXMin <=0) drawXMin = 1; end if(drawYMin <=0) drawYMin = 1; end acts(drawYMin:drawYMax, drawXMin:drawXMax) = fillValue; handles.SynthesisObject.Activations = acts; size(acts, 1) guidata(src, handles); src.WindowButtonMotionFcn = @dragCallBack; src.WindowButtonUpFcn = @releaseCallBack; function dragCallBack(src, callbackdata) cp = ah.CurrentPoint; cx = cp(1,1)/xUnit(2); cy = cp(1,2); drawXMax = (ceil(cx) + paintBrushSize); drawYMax = (ceil(cy) + paintBrushSize); drawXMin = (ceil(cx) - paintBrushSize); drawYMin = (ceil(cy) - paintBrushSize); if(drawXMax >= xMax) drawXMax = xMax; end if(drawYMax >= yMax) drawYMax = yMax; end if(drawXMin <=0) drawXMin = 1; end if(drawYMin <=0) drawYMin = 1; end % fprintf('X: %u Y: %u', ceil(cy), ceil(cx)) acts(drawYMin:drawYMax, drawXMin:drawXMax) = fillValue; handles.SynthesisObject.Activations = acts; guidata(src, handles); end function releaseCallBack(src, callbackdata) controller('switchPlot', handles); src.Pointer = 'arrow'; src.WindowButtonMotionFcn = ''; src.WindowButtonUpFcn = ''; end end