|
From: <pst...@us...> - 2010-04-25 03:30:58
|
Revision: 750
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=750&view=rev
Author: pstieber
Date: 2010-04-25 03:30:51 +0000 (Sun, 25 Apr 2010)
Log Message:
-----------
Changed curly bracket placement and made cosmetic indentation changes.
Modified Paths:
--------------
trunk/jazz/src/FileSelector.cpp
trunk/jazz/src/HarmonyBrowserAnalyzer.cpp
trunk/jazz/src/HarmonyP.cpp
trunk/jazz/src/Player.cpp
trunk/jazz/src/Random.cpp
trunk/jazz/src/Sample.cpp
trunk/jazz/src/SampleCommand.cpp
trunk/jazz/src/SampleDialog.cpp
trunk/jazz/src/SampleWindow.cpp
trunk/jazz/src/Signal2.cpp
Modified: trunk/jazz/src/FileSelector.cpp
===================================================================
--- trunk/jazz/src/FileSelector.cpp 2010-04-25 03:22:05 UTC (rev 749)
+++ trunk/jazz/src/FileSelector.cpp 2010-04-25 03:30:51 UTC (rev 750)
@@ -93,7 +93,8 @@
wxString buf;
//sprintf(buf, "overwrite %s?", (char*)s);
buf << "overwrite "<<s<<"?";
- if (wxMessageBox(buf, "Save ?", wxYES_NO) == wxNO) {
+ if (wxMessageBox(buf, "Save ?", wxYES_NO) == wxNO)
+ {
s = wxEmptyString;
}
Modified: trunk/jazz/src/HarmonyBrowserAnalyzer.cpp
===================================================================
--- trunk/jazz/src/HarmonyBrowserAnalyzer.cpp 2010-04-25 03:22:05 UTC (rev 749)
+++ trunk/jazz/src/HarmonyBrowserAnalyzer.cpp 2010-04-25 03:30:51 UTC (rev 750)
@@ -322,12 +322,16 @@
class tChordMatrix {
public:
- tChordMatrix() {
+ tChordMatrix()
+ {
for (int i = 0; i < 12; i++)
for (int j = 0; j < 12; j++)
mat[i][j] = 0;
}
- double* operator[](int i) { return mat[i]; }
+ double* operator[](int i)
+ {
+ return mat[i];i
+ }
private:
double mat[12][12];
};
Modified: trunk/jazz/src/HarmonyP.cpp
===================================================================
--- trunk/jazz/src/HarmonyP.cpp 2010-04-25 03:22:05 UTC (rev 749)
+++ trunk/jazz/src/HarmonyP.cpp 2010-04-25 03:30:51 UTC (rev 750)
@@ -212,15 +212,19 @@
void HBChord::Rotate(int semis)
{
- if (semis > 0) {
- while (semis--) {
+ if (semis > 0)
+ {
+ while (semis--)
+ {
if (keys & 0x800)
keys = ((keys & ~0x800) << 1) + 1;
else keys <<= 1;
}
}
- else if (semis < 0) {
- while (semis++) {
+ else if (semis < 0)
+ {
+ while (semis++)
+ {
if (keys & 1)
keys = (keys >> 1) | 0x800;
else keys >>= 1;
Modified: trunk/jazz/src/Player.cpp
===================================================================
--- trunk/jazz/src/Player.cpp 2010-04-25 03:22:05 UTC (rev 749)
+++ trunk/jazz/src/Player.cpp 2010-04-25 03:30:51 UTC (rev 750)
@@ -1278,9 +1278,10 @@
int numbytes = 0;
numbytes = get_recbuf_mpu( &recbuf );
- if (numbytes == 0) {
- // No bytes in record buffer
- return 0;
+ if (numbytes == 0)
+ {
+ // No bytes in record buffer
+ return 0;
}
// Go through the record buffer and create events
@@ -1996,7 +1997,8 @@
{
case EV_TIMING:
- switch (buf[i+1]) {
+ switch (buf[i+1])
+ {
case TMR_WAIT_ABS:
case TMR_ECHO:
recd_clock = *(unsigned long *)&buf[i+4] + start_clock;
@@ -2016,7 +2018,8 @@
//unsigned char par = buf[i+5];
short val = *(short *)&buf[i+6];
//printf("got: chn %d, ctl %d, val %d\n", chn, ctl, val);
- switch (buf[i+2]) {
+ switch (buf[i+2])
+ {
case MIDI_CTL_CHANGE:
pEvent = new tControl(0, chn, ctl, val);
break;
Modified: trunk/jazz/src/Random.cpp
===================================================================
--- trunk/jazz/src/Random.cpp 2010-04-25 03:22:05 UTC (rev 749)
+++ trunk/jazz/src/Random.cpp 2010-04-25 03:30:51 UTC (rev 750)
@@ -396,12 +396,14 @@
ybar = ynul - hbar - hblk/2;
hbar = hblk;
- if (ybar < y) {
+ if (ybar < y)
+ {
int d = y - ybar;
ybar += d;
hbar -= d;
}
- if (ybar + hbar > y + h) {
+ if (ybar + hbar > y + h)
+ {
int d = (ybar + hbar) - (y + h);
hbar -= d;
}
Modified: trunk/jazz/src/Sample.cpp
===================================================================
--- trunk/jazz/src/Sample.cpp 2010-04-25 03:22:05 UTC (rev 749)
+++ trunk/jazz/src/Sample.cpp 2010-04-25 03:30:51 UTC (rev 750)
@@ -71,7 +71,8 @@
void tSample::SetFilename(const char *fname)
{
- if (strcmp(filename, fname) != 0) {
+ if (strcmp(filename, fname) != 0)
+ {
dirty = 1;
char *s = copystring(fname);
label = copystring(wxFileNameFromPath(s));
@@ -175,7 +176,8 @@
int tSample::LoadWav()
{
struct stat buf;
- if (stat(filename, &buf) == -1) {
+ if (stat(filename, &buf) == -1)
+ {
perror(filename);
return 1;
}
@@ -194,7 +196,8 @@
//fprintf(stderr, "%s format not recognized\n", filename);
return 2;
}
- if (wh.format != PCM_CODE) {
+ if (wh.format != PCM_CODE)
+ {
//fprintf(stderr, "%s must be PCM_CODE\n", filename);
return 3;
}
@@ -316,13 +319,15 @@
}
// convert mono -> stereo
- if (channels == 1 && set.channels == 2) {
+ if (channels == 1 && set.channels == 2)
+ {
short *old = data;
length = length * 2;
data = new short [length];
int i = 0;
int j = 0;
- while (i < length) {
+ while (i < length)
+ {
data[i++] = old[j];
data[i++] = old[j++];
}
@@ -357,7 +362,8 @@
}
// apply volume and pan
- if (volume != 127 || pan != 0) {
+ if (volume != 127 || pan != 0)
+ {
int ch1 = volume;
int ch2 = volume;
int ppan = (set.channels == 2) ? pan : 0;
@@ -380,7 +386,8 @@
{
// determine file size
struct stat buf;
- if (stat(filename, &buf) == -1) {
+ if (stat(filename, &buf) == -1)
+ {
perror(filename);
return 1;
}
@@ -400,7 +407,8 @@
if (filename && filename[0] && !force && !dirty && external_flag)
{
struct stat buf;
- if (stat(filename, &buf) == -1) {
+ if (stat(filename, &buf) == -1)
+ {
perror(filename);
return 1;
}
@@ -411,7 +419,8 @@
if (force || dirty)
{
FreeData();
- if (filename && filename[0]) {
+ if (filename && filename[0])
+ {
int rc = LoadWav();
dirty = 0;
return rc;
Modified: trunk/jazz/src/SampleCommand.cpp
===================================================================
--- trunk/jazz/src/SampleCommand.cpp 2010-04-25 03:22:05 UTC (rev 749)
+++ trunk/jazz/src/SampleCommand.cpp 2010-04-25 03:30:51 UTC (rev 750)
@@ -428,7 +428,8 @@
val2 = in[inchan] * x;
out[0] = (val1 + val2);
- if (chans > 1) {
+ if (chans > 1)
+ {
out[1] = (1.0 - p[7]) * out[0];
out[0] *= p[7];
}
@@ -464,7 +465,8 @@
type = array[0] > 0 ? tSplFilter::LOWPASS : tSplFilter::HIGHPASS;
filters[0].Init(type, sr, Index2Hertz(0), 0);
// some band pass filters
- for (i = 1; i < nfilters-1; i++) {
+ for (i = 1; i < nfilters-1; i++)
+ {
double f = Index2Hertz(i);
double f0 = Index2Hertz(i-1);
double f1 = Index2Hertz(i+1);
Modified: trunk/jazz/src/SampleDialog.cpp
===================================================================
--- trunk/jazz/src/SampleDialog.cpp 2010-04-25 03:22:05 UTC (rev 749)
+++ trunk/jazz/src/SampleDialog.cpp 2010-04-25 03:30:51 UTC (rev 750)
@@ -354,11 +354,18 @@
#define N_HARM 40
-class tAddSynthArray {
+class tAddSynthArray
+{
public:
JZRndArray arr;
tRhyArrayEdit *edit;
- tAddSynthArray(wxFrame *parent, const char *label, int n, int ynul, int ymax, int style)
+ tAddSynthArray(
+ wxFrame *parent,
+ const char *label,
+ int n,
+ int ynul,
+ int ymax,
+ int style)
: arr(n, 0, ymax)
{
int i;
@@ -368,8 +375,14 @@
edit = new tRhyArrayEdit(parent, arr, 10,10,10,10, style);
edit->SetLabel(label);
}
- void Show(bool x) { edit->Show(x); }
- void Init() { edit->Init(); }
+ void Show(bool x)
+ {
+ edit->Show(x);
+ }
+ void Init()
+ {
+ edit->Init();
+ }
};
class tAddSynth
@@ -389,19 +402,22 @@
fft.edit->SetXMinMax(1, N_HARM);
}
- void SetDuration(int durat) {
+ void SetDuration(int durat)
+ {
vol.edit->SetXMinMax(0, durat);
pan.edit->SetXMinMax(0, durat);
frq.edit->SetXMinMax(0, durat);
}
- void Refresh() {
+ void Refresh()
+ {
fft.edit->Refresh();
vol.edit->Refresh();
frq.edit->Refresh();
pan.edit->Refresh();
}
- void Init() {
+ void Init()
+ {
fft.edit->Init();
vol.edit->Init();
frq.edit->Init();
@@ -617,7 +633,8 @@
case SYN_SAVE:
{
wxString fname = file_selector(default_filename, "Save Synth", 1, 0, "*.syn");
- if (fname) {
+ if (fname)
+ {
ofstream os(fname);
os << *this;
}
@@ -684,7 +701,8 @@
void tSynthDlg::AddEdits()
{
int i, k;
- for (i = 0, k = 0; i < MAXSYNTHS; i++) {
+ for (i = 0, k = 0; i < MAXSYNTHS; i++)
+ {
synths[i] = new tAddSynth(this);
synths[i]->SetDuration(duration);
}
@@ -794,27 +812,33 @@
else
#endif
- if (&item == chk_vol) {
+ if (&item == chk_vol)
+ {
vol_enable = chk_vol->GetValue();
resize = 1;
}
- else if (&item == chk_pan) {
+ else if (&item == chk_pan)
+ {
pan_enable = chk_pan->GetValue();
resize = 1;
}
- else if (&item == chk_frq) {
+ else if (&item == chk_frq)
+ {
frq_enable = chk_frq->GetValue();
resize = 1;
}
- else if (&item == chk_fft) {
+ else if (&item == chk_fft)
+ {
fft_enable = chk_fft->GetValue();
resize = 1;
}
- else if (&item == chk_noise) {
+ else if (&item == chk_noise)
+ {
noise_enable = chk_noise->GetValue();
resize = 1;
}
- else if (&item == num_synths_slider) {
+ else if (&item == num_synths_slider)
+ {
int n = num_synths_slider->GetValue();
if (n != num_synths)
{ // avoid flashing
@@ -822,9 +846,11 @@
resize = 1;
}
}
- else if (&item == duration_slider) {
+ else if (&item == duration_slider)
+ {
duration = duration_slider->GetValue();
- for (int i = 0, k = 0; i < num_synths; i++) {
+ for (int i = 0, k = 0; i < num_synths; i++)
+ {
tAddSynth &s = *synths[i];
s.SetDuration(duration);
}
@@ -833,14 +859,15 @@
else if (&item == midi_key_slider)
midi_key = midi_key_slider->GetValue();
- if (resize) {
+ if (resize)
+ {
SetupEdits();
int cw, ch;
GetClientSize(&cw, &ch);
OnSize(cw, ch);
}
-
- else if (redraw) {
+ else if (redraw)
+ {
for (int i = 0; i < num_synths; i++)
synths[i]->Refresh();
}
@@ -852,7 +879,8 @@
int i;
tSample &spl = win.GetSample();
JZRndArray *arr[MAXSYNTHS][4];
- for (i = 0; i < MAXSYNTHS; i++) {
+ for (i = 0; i < MAXSYNTHS; i++)
+ {
arr[i][0] = &synths[i]->fft.arr;
arr[i][1] = &synths[i]->vol.arr;
arr[i][2] = &synths[i]->frq.arr;
@@ -1112,7 +1140,8 @@
double maxfreq = (int)(win.GetSample().GetSamplingRate() / 2);
// watch order of enum in signali.h
typestring = 0;
- for (int i = 0; filter_types[i]; i++) {
+ for (int i = 0; filter_types[i]; i++)
+ {
typelist.Append((wxObject *)filter_types[i]); // ???
if (i == (int)type)
typestring = copystring(filter_types[i]);
Modified: trunk/jazz/src/SampleWindow.cpp
===================================================================
--- trunk/jazz/src/SampleWindow.cpp 2010-04-25 03:22:05 UTC (rev 749)
+++ trunk/jazz/src/SampleWindow.cpp 2010-04-25 03:30:51 UTC (rev 750)
@@ -92,11 +92,13 @@
class tInsertionPoint {
public:
- tInsertionPoint(wxScrolledWindow *c) : cnvs(c) {
+ tInsertionPoint(wxScrolledWindow *c) : cnvs(c)
+ {
last_x = 0;
visible = 0;
};
- void Draw(int x) {
+ void Draw(int x)
+ {
last_x = x;
visible ^= 1;
wxDC *dc = new wxClientDC(cnvs);
@@ -108,7 +110,8 @@
dc->SetPen(*wxBLACK_PEN);
dc->SetLogicalFunction(wxCOPY);
}
- void Draw() {
+ void Draw()
+ {
Draw(last_x);
}
int IsVisible() const {
@@ -133,7 +136,8 @@
public:
tSampleCnvs(tSampleWin *win, tSample &sample);
virtual ~tSampleCnvs();
- void Redraw() {
+ void Redraw()
+ {
OnPaint();
}
virtual void OnPaint();
@@ -180,22 +184,28 @@
{
public:
tSmplWinSettingsForm(tSampleWin &w)
- : wxForm( USED_WXFORM_BUTTONS ), win(w) {}
- void EditForm(wxPanel *panel) {
+ : wxForm( USED_WXFORM_BUTTONS ),
+ win(w)
+ {}
+ void EditForm(wxPanel *panel)
+ {
Add(wxMakeFormBool("Show Midi Time", &win.cnvs->midi_time));
Add(wxMakeFormNewLine());
AssociatePanel(panel);
}
- void OnOk() {
+ void OnOk()
+ {
win.settings = 0;
win.Redraw();
wxForm::OnOk();
}
- void OnCancel() {
+ void OnCancel()
+ {
win.settings = 0;
wxForm::OnCancel();
}
- void OnHelp() {
+ void OnHelp()
+ {
gpHelpInstance->ShowTopic("Settings");
}
private:
@@ -214,13 +224,15 @@
x = 0;
}
- ~tSamplePlayPosition() {
+ ~tSamplePlayPosition()
+ {
Stop();
if (visible)
Draw();
}
- void StopListen() {
+ void StopListen()
+ {
Stop();
if (gpMidiPlayer->IsListening())
gpMidiPlayer->ListenAudio(-1);
@@ -256,7 +268,8 @@
virtual void Notify()
{
int pos = player->GetListenerPlayPosition();
- if (pos < 0) {
+ if (pos < 0)
+ {
StopListen();
return;
}
@@ -498,7 +511,8 @@
int sfr = win->GetPaintOffset();
int sto = sfr + win->GetPaintLength();
- if (!midi_time) {
+ if (!midi_time)
+ {
// display time
JZMapper Map(sfr, sto, x, x+w);
int tfr = spl->Samples2Time(sfr) / 1000;
@@ -542,7 +556,8 @@
// draw a tickmark line
dc->DrawLine(xx, y - 5, xx, y);
// draw a text
- if (j == 0) {
+ if (j == 0)
+ {
char buf[50];
sprintf(buf, "%d", i + 1);
int fw, fh;
@@ -862,7 +877,8 @@
cnvs->SetSize(xx, yy, ww, hi);
hi = hh / nn;
- for (int i = 0; i < num_params; i++) {
+ for (int i = 0; i < num_params; i++)
+ {
int yi = yy + (i + spl.GetChannels()) * hh / nn;
params[i]->SetSize(xx, yi, ww, hi);
}
@@ -876,7 +892,8 @@
bool tSampleWin::HaveInsertionPoint(int &offs, bool warn)
{
- if (cnvs->sel_fr == cnvs->sel_to && cnvs->sel_fr >= 0) {
+ if (cnvs->sel_fr == cnvs->sel_to && cnvs->sel_fr >= 0)
+ {
offs = cnvs->sel_fr;
return TRUE;
}
@@ -890,7 +907,8 @@
bool tSampleWin::HaveSelection(int &fr_smpl, int &to_smpl, HaveSelectionMode mode)
{
- if (cnvs->sel_fr < cnvs->sel_to && cnvs->sel_fr >= 0) {
+ if (cnvs->sel_fr < cnvs->sel_to && cnvs->sel_fr >= 0)
+ {
fr_smpl = cnvs->sel_fr;
to_smpl = cnvs->sel_to;
return TRUE;
@@ -921,7 +939,8 @@
void tSampleWin::ClrParam()
{
- if (num_params > 0) {
+ if (num_params > 0)
+ {
int n = num_params;
num_params = 0;
for (int i = 0; i < n; ++i)
@@ -1351,7 +1370,8 @@
}
}
-void tSampleWin::PlaySample() {
+void tSampleWin::PlaySample()
+{
cnvs->Play();
}
Modified: trunk/jazz/src/Signal2.cpp
===================================================================
--- trunk/jazz/src/Signal2.cpp 2010-04-25 03:22:05 UTC (rev 749)
+++ trunk/jazz/src/Signal2.cpp 2010-04-25 03:30:51 UTC (rev 750)
@@ -36,7 +36,8 @@
const long N = isig.GetLength() + (long)(add_seconds * sampling_rate);
osig.Resize(N);
tSigValue val;
- for (long i = 0; i < N; i++) {
+ for (long i = 0; i < N; i++)
+ {
isig.GetSample(val);
osig.Out(val);
current++;
@@ -151,7 +152,8 @@
for (k = 0; k < N; k++)
wav[k] = 0;
- for (f = 0; f < arr.Size(); f++) {
+ for (f = 0; f < arr.Size(); f++)
+ {
tLineMap<float>map(0, N, 0, 2*PI*(f+1));
for (k = 0; k < N; k++)
wav[k] += sin(map(k)) * (float)arr[f] * (float)arr[f];
@@ -175,7 +177,8 @@
{
int i, k;
//cout << arr.GetLabel() << endl;
- for (i = 0; i < N; i++) {
+ for (i = 0; i < N; i++)
+ {
cout << i << ' ';
for (k = 0; k < tSigValue::MAXCHN; k++)
cout << wav[i][k] << ' ';
@@ -272,11 +275,13 @@
// old Filter Interface
// ---------------------------------------------------------------
-tSplFilter::tSplFilter() {
+tSplFilter::tSplFilter()
+{
filter = 0;
}
-tSplFilter::~tSplFilter() {
+tSplFilter::~tSplFilter()
+{
delete filter;
}
@@ -311,7 +316,8 @@
filter->Setup(sr, f0, f0 * bw);
}
-float tSplFilter::Loop(float sig) {
+float tSplFilter::Loop(float sig)
+{
return filter->Loop(sig);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|