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 316<br />

/*<br />

Woodwind.c<br />

By Paul Dickens, 2005, 2006.<br />

Listing B.31: Woodwind.c<br />

A woodwind instrument. See Woodwind.h for interface details.<br />

*/<br />

#include <br />

#include <br />

#include <br />

#include <br />

#include <br />

#include "Woodwind.h"<br />

#include "Acoustics.h"<br />

#include "Map.h"<br />

#define P_ATM 101325 // 1 atm pressure<br />

BoreSegment createBoreSegment(double radius1, double radius2,<br />

double length) {<br />

BoreSegment s = (BoreSegment)malloc(size<strong>of</strong>(*s));<br />

s->radius1 = radius1;<br />

s->radius2 = radius2;<br />

s->length = length;<br />

s->c = 0.0;<br />

s->rho = 0.0;<br />

return s;<br />

}<br />

Hole createHole(double radius, double length, double boreRadius,<br />

Key key) {<br />

Hole h = (Hole)malloc(size<strong>of</strong>(*h));<br />

h->radius = radius;<br />

h->length = length;<br />

h->boreRadius = boreRadius;<br />

h->key = key;<br />

h->c = 0.0;<br />

h->rho = 0.0;<br />

return h;<br />

}<br />

Key createKey(double radius, double holeRadius, double height,<br />

double thickness, double wallThickness, double chimneyHeight) {<br />

Key k = (Key)malloc(size<strong>of</strong>(*k));<br />

k->radius = radius;<br />

k->holeRadius = holeRadius;<br />

k->height = height;<br />

k->thickness = thickness;<br />

k->wallThickness = wallThickness;<br />

k->chimneyHeight = chimneyHeight;<br />

return k;<br />

}<br />

EmbouchureHole createEmbouchureHole(double radiusin, double radiusout,

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

Saved successfully!

Ooh no, something went wrong!