/usr/share/SuperCollider/SCClassLibrary/QtCollider/QSoundFileView.sc is in supercollider-common 1:3.6.3~repack-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | QSoundFileView : QView {
var <>soundfile;
var <metaAction;
var <>elasticMode; // NOTE: no-op, only for compatibility
var curDoneAction;
*qtClass { ^'QcWaveform' }
load { arg filename, startframe, frames, block, doneAction;
if( filename.isString && filename != "" ) {
if( curDoneAction.notNil )
{ this.disconnectFunction( 'loadingDone()', curDoneAction ) };
if( doneAction.notNil ) {
this.connectFunction( 'loadingDone()', doneAction );
};
curDoneAction = doneAction;
if( startframe.notNil && frames.notNil ) {
this.invokeMethod( \load, [filename, startframe.asInteger, frames.asInteger] );
}{
this.invokeMethod( \load, filename );
}
}
}
alloc { arg frames, channels=1, samplerate=44100;
this.invokeMethod( \allocate, [frames.asInteger, channels.asInteger, samplerate.asInteger] );
}
data_ { arg data;
this.setData(data);
}
setData { arg data, block, startframe=0, channels=1, samplerate=44100;
if( data.isKindOf(DoubleArray).not and: {data.isKindOf(FloatArray).not} )
{ data = data.as(DoubleArray) };
this.invokeMethod( \load, [data, startframe, channels, samplerate] );
}
set { arg offset=0, data;
if( data.isKindOf(DoubleArray).not and: {data.isKindOf(FloatArray).not} )
{ data = data.as(DoubleArray) };
this.invokeMethod( \write, [data, offset.asInteger] );
}
readFile { arg aSoundFile, startframe, frames, block, closeFile, doneAction;
this.load( aSoundFile.path, startframe, frames, block, doneAction );
}
read { arg startframe, frames, block, closeFile, doneAction;
if( soundfile.notNil ) {
this.readFile( soundfile, startframe, frames, block, nil, doneAction );
};
}
readFileWithTask { arg aSoundFile, startframe, frames, block, doneAction, showProgress;
this.readFile( aSoundFile, startframe, frames, block, nil, doneAction );
}
readWithTask { arg startframe, frames, block, doneAction, showProgress;
this.read( startframe, frames, block, nil, doneAction );
}
drawsWaveForm { ^this.getProperty( \drawsWaveform ); }
drawsWaveForm_ { arg boolean; this.setProperty( \drawsWaveform, boolean ); }
waveColors { ^this.getProperty( \waveColors ) }
waveColors_ { arg colors; this.setProperty( \waveColors, colors ) }
//// Info
startFrame { ^this.getProperty( \startFrame ); }
numFrames { ^this.getProperty( \frames ); }
scrollPos { ^this.getProperty( \scrollPos ); } // a fraction of the full scrolling range
viewFrames { ^this.getProperty( \viewFrames ); }
readProgress { ^this.getProperty( \readProgress ); }
//// Navigation
zoom { arg factor; this.invokeMethod( \zoomBy, factor.asFloat ); }
zoomToFrac { arg fraction; this.invokeMethod( \zoomTo, fraction.asFloat ); }
zoomAllOut { this.invokeMethod( \zoomAllOut ); }
zoomSelection { arg selection;
if( selection.isNil ) { selection = this.currentSelection };
this.invokeMethod( \zoomSelection, selection );
}
scrollTo { arg fraction; // a fraction of the full scrolling range
this.setProperty( \scrollPos, fraction );
}
scroll { arg fraction; // a fraction of the visible range
var frames = this.viewFrames * fraction + this.getProperty(\viewStartFrame);
this.setProperty( \viewStartFrame, frames );
}
scrollToStart { this.invokeMethod( \scrollToStart ); }
scrollToEnd { this.invokeMethod( \scrollToEnd ); }
xZoom { ^this.getProperty( \xZoom ); }
xZoom_ { arg seconds; this.setProperty( \xZoom, seconds ); }
yZoom { ^this.getProperty( \yZoom ); }
yZoom_ { arg factor; this.setProperty( \yZoom, factor.asFloat ); }
//// Selections
selections { ^this.getProperty( \selections ); }
currentSelection { ^this.getProperty( \currentSelection ); }
currentSelection_ { arg index; this.setProperty( \currentSelection, index ); }
selection { arg index; ^this.invokeMethod( \selection, index, true ); }
setSelection { arg index, selection;
this.invokeMethod( \setSelection, [index, selection] );
}
selectionStart { arg index;
var sel = this.selection( index );
^sel.at(0);
}
setSelectionStart { arg index, frame;
var sel = this.selection( index );
sel.put( 0, frame );
this.setSelection( index, sel );
}
selectionSize { arg index;
var sel = this.selection( index );
^sel.at(1);
}
setSelectionSize { arg index, frames;
var sel = this.selection( index );
sel.put( 1, frames );
this.setSelection( index, sel );
}
selectAll { arg index; this.setSelection( index, [0, this.numFrames] ); }
selectNone { arg index; this.setSelection( index, [0, 0] ); }
setEditableSelectionStart { arg index, editable; ^this.nonimpl("setEditableSelectionStart"); }
setEditableSelectionSize { arg index, editable; ^this.nonimpl("setEditableSelectionSize"); }
setSelectionColor { arg index, color; this.invokeMethod( \setSelectionColor, [index,color] ); }
selectionStartTime { arg index; ^this.nonimpl("selectionStartTime"); }
selectionDuration { arg index; ^this.nonimpl("selectionDuration"); }
readSelection { arg block, closeFile; ^this.nonimpl("readSelection"); }
readSelectionWithTask { ^this.nonimpl("readSelectionWithTask"); }
// cursor
timeCursorOn { ^this.getProperty( \cursorVisible ); }
timeCursorOn_ { arg flag; this.setProperty( \cursorVisible, flag ) }
timeCursorEditable { ^this.getProperty( \cursorEditable ); }
timeCursorEditable_ { arg flag; this.setProperty( \cursorEditable, flag ) }
timeCursorPosition { ^this.getProperty( \cursorPosition ); }
timeCursorPosition_ { arg frame; this.setProperty( \cursorPosition, frame ) }
// grid
gridOn { ^this.getProperty( \gridVisible ); }
gridOn_ { arg flag; this.setProperty( \gridVisible, flag ) }
gridResolution { ^this.getProperty( \gridResolution ) }
gridResolution_ { arg seconds; this.setProperty( \gridResolution, seconds ) }
gridOffset { ^this.getProperty( \gridOffset ) }
gridOffset_ { arg seconds; this.setProperty( \gridOffset, seconds ) }
// colors
peakColor { ^this.getProperty(\peakColor) }
peakColor_ { arg color; this.setProperty(\peakColor, color) }
rmsColor { ^this.getProperty(\rmsColor) }
rmsColor_ { arg color; this.setProperty(\rmsColor, color) }
timeCursorColor { ^this.getProperty( \cursorColor ); }
timeCursorColor_ { arg color; this.setProperty( \cursorColor, color ) }
gridColor { ^this.getProperty( \gridColor ) }
gridColor_ { arg color; this.setProperty( \gridColor, color ) }
// actions
metaAction_ { arg action;
this.manageFunctionConnection( metaAction, action, 'metaAction()' );
metaAction = action
}
}
|