11.07.2014 Views

Flute acoustics: measurement, modelling and design - School of ...

Flute acoustics: measurement, modelling and design - School of ...

Flute acoustics: measurement, modelling and design - School of ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

APPENDIX B. PROGRAM LISTINGS 325<br />

for (segmentCount = 0; segmentCount < sizeVector(bore);<br />

segmentCount++) {<br />

s = (BoreSegment)elementAt(bore, segmentCount);<br />

if (s->length length / maxLength);<br />

radius1 = s->radius1;<br />

length = s->length / numSegments;<br />

for (newSegmentCount = 1; newSegmentCount radius2<br />

+ (numSegments - newSegmentCount) * s->radius1) / numSegments;<br />

newSegment = createBoreSegment(radius1, radius2, length);<br />

if (newSegmentCount == 1)<br />

setAt(bore, newSegment, segmentCount);<br />

else<br />

insertAt(bore, newSegment, ++segmentCount);<br />

radius1 = radius2;<br />

}<br />

}<br />

}<br />

int setFingering(Woodwind w, char* holestring) {<br />

int numholes = sizeVector(w->cells);<br />

int i;<br />

UnitCell cell;<br />

/* check for no holes */<br />

if((holestring == NULL) || (numholes == 0)) {<br />

if((holestring == NULL) && (numholes == 0))<br />

return 1;<br />

else<br />

return 0;<br />

}<br />

/* check for wrong number <strong>of</strong> holes entered */<br />

if(strlen(holestring) != numholes)<br />

return 0;<br />

/* set fingering array based on comm<strong>and</strong> line hole string */<br />

for(i = 0; i < numholes; i++) {<br />

cell = (UnitCell)elementAt(w->cells, i);<br />

if(holestring[i] == 'O')<br />

cell->hole->fingering = "OPEN";<br />

if(holestring[i] == 'X')<br />

cell->hole->fingering = "CLOSED";<br />

if((holestring[i] != 'O') && (holestring[i] != 'X'))<br />

return 0;<br />

}<br />

return 1;<br />

}<br />

TransferMatrix boreSegmentMatrix(double f, BoreSegment s, double x) {<br />

TransferMatrix m;<br />

double length, radius1, radius2;<br />

radius1 = s->radius1;<br />

if (x >= s->length) {<br />

length = s->length;<br />

radius2 = s->radius2;<br />

}<br />

else {

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!