From: <pst...@us...> - 2010-07-11 21:19:51
|
Revision: 788 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=788&view=rev Author: pstieber Date: 2010-07-11 21:19:45 +0000 (Sun, 11 Jul 2010) Log Message: ----------- 1. Added a new version of the audio samples dialog (Dialogs/SamplesDialog.cpp.h) to replace the use of tSamplesDlg. I added the controls and laid them out, but the dialog is not functioning. 2. Changes an unnamed enumeration in tSampleSet that held MAXSMPL to a named enumeration (TESampleSize) with a single entry called eSampleCount, and made the enumeration public. 3. Changed the sample class label data member from a char* to a std::string. Modified Paths: -------------- trunk/jazz/src/Audio.cpp trunk/jazz/src/Audio.h trunk/jazz/src/Makefile.am trunk/jazz/src/PianoWindow.cpp trunk/jazz/src/Player.h trunk/jazz/src/Sample.cpp trunk/jazz/src/Sample.h trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj Added Paths: ----------- trunk/jazz/src/Dialogs/SamplesDialog.cpp trunk/jazz/src/Dialogs/SamplesDialog.h Modified: trunk/jazz/src/Audio.cpp =================================================================== --- trunk/jazz/src/Audio.cpp 2010-07-03 14:12:43 UTC (rev 787) +++ trunk/jazz/src/Audio.cpp 2010-07-11 21:19:45 UTC (rev 788) @@ -22,6 +22,7 @@ #include "Audio.h" +#include "Dialogs/SamplesDialog.h" #include "Sample.h" #include "Events.h" #include "RecordingInfo.h" @@ -211,7 +212,7 @@ is_playing = 0; dirty = 0; - for (i = 0; i < MAXSMPL; i++) + for (i = 0; i < eSampleCount; i++) { mSamples[i] = new tSample(*this); mSampleWindows[i] = 0; @@ -229,7 +230,7 @@ tSampleSet::~tSampleSet() { int i; - for (i = 0; i < MAXSMPL; i++) + for (i = 0; i < eSampleCount; i++) { delete mSamples[i]; delete mSampleWindows[i]; @@ -280,7 +281,7 @@ gpMidiPlayer->SetAudioEnabled(true); wxBeginBusyCursor(); - for (int i = 0; i < MAXSMPL; i++) + for (int i = 0; i < eSampleCount; i++) { mSamples[i]->Clear(); } @@ -319,7 +320,7 @@ ::wxMessageBox(String, "Error", wxOK); continue; } - assert(0 <= key && key < MAXSMPL); + assert(0 <= key && key < eSampleCount); mSamples[key]->SetFilename(SplFilePath.c_str()); mSamples[key]->SetLabel(Label.c_str()); mSamples[key]->SetVolume(vol); @@ -348,7 +349,7 @@ //----------------------------------------------------------------------------- void tSampleSet::ReloadSamples() { - for (int i = 0; i < MAXSMPL; i++) + for (int i = 0; i < eSampleCount; i++) { mSamples[i]->Load(dirty); } @@ -359,23 +360,22 @@ //----------------------------------------------------------------------------- int tSampleSet::Save(const wxString& FileName) { - ofstream os(FileName.c_str()); - os << 1 << " " << speed << " " << channels << " " << softsync << endl; - for (int i = 0; i < MAXSMPL; i++) + ofstream Ofs(FileName.c_str()); + Ofs << 1 << ' ' << speed << ' ' << channels << ' ' << softsync << endl; + for (int i = 0; i < eSampleCount; i++) { - tSample *spl = mSamples[i]; - const char *fname = spl->GetFilename(); - const char* pLabel = spl->GetLabel(); - int vol = spl->GetVolume(); - int pan = spl->GetPan(); - int pitch = spl->GetPitch(); + tSample* pSample = mSamples[i]; + const char* fname = pSample->GetFilename(); + int vol = pSample->GetVolume(); + int pan = pSample->GetPan(); + int pitch = pSample->GetPitch(); if (fname[0]) { - os << i << " "; - WriteString(os, fname); - os << " "; - WriteString(os, pLabel); - os << " " << pan << " " << vol << " " << pitch << endl; + Ofs << i << ' '; + WriteString(Ofs, fname); + Ofs << ' '; + WriteString(Ofs, pSample->GetLabel()); + Ofs << ' ' << pan << ' ' << vol << ' ' << pitch << endl; } } return 0; @@ -383,13 +383,14 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -const char* tSampleSet::GetSampleName(int i) +const string& tSampleSet::GetSampleLabel(int Index) { - if (0 <= i && i < MAXSMPL) + if (Index >= 0 && Index < eSampleCount) { - return mSamples[i]->GetLabel(); + return mSamples[Index]->GetLabel(); } - return ""; + static string EmptyString; + return EmptyString; } //----------------------------------------------------------------------------- @@ -611,7 +612,7 @@ ReloadSamples(); // touch all playback sample data, so they may get swapped into memory - for (int i = 0; i < MAXSMPL; i++) + for (int i = 0; i < eSampleCount; i++) { tSample *spl = mSamples[i]; spl->GotoRAM(); @@ -627,6 +628,7 @@ is_playing = 0; } +#if 0 //***************************************************************************** // Description: // This is the sample dialog. @@ -672,7 +674,7 @@ wxText* pFile; #endif // OBSOLETE - static char *path; + static char* mpSamplePath; static int current; char *ListEntry(int i); @@ -680,6 +682,7 @@ void Win2Sample(int index); void SetCurrentListEntry(int i); }; +#endif // ----------------------------------------------------------------- // ------------------------ global settings ------------------------ @@ -899,7 +902,7 @@ { return; } - for (int i = 0; i < MAXSMPL; ++i) + for (int i = 0; i < eSampleCount; ++i) { mSamples[i]->Clear(); } @@ -951,7 +954,7 @@ tSample *spl; // see if fname is already present in sample list - for (i = 0; i < MAXSMPL; i++) + for (i = 0; i < eSampleCount; i++) { spl = mSamples[i]; if (strcmp(spl->GetFilename(), fname) == 0) @@ -959,10 +962,10 @@ } // if no entry is there, add an entry - if (i >= MAXSMPL) + if (i >= eSampleCount) { // start somewhere near the top of the list - for (i = 15; i < MAXSMPL; i++) + for (i = 15; i < eSampleCount; i++) { spl = mSamples[i]; if (spl->GetFilename()[0] == 0) @@ -970,7 +973,7 @@ } } - if (i >= MAXSMPL) + if (i >= eSampleCount) return; int key = i; @@ -1114,11 +1117,11 @@ // ------------------------ sample settings ------------------------ // ----------------------------------------------------------------- - +#if 0 //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -char * tSamplesDlg::path = 0; -int tSamplesDlg::current = 0; +char* tSamplesDlg::mpSamplePath = 0; +int tSamplesDlg::current = 0; //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- @@ -1126,13 +1129,13 @@ : wxDialog(pParent, wxID_ANY, wxString("Sample Settings")), set(s) { - if (path == 0) + if (mpSamplePath == 0) { - path = copystring("*.wav"); + mpSamplePath = copystring("*.wav"); } wxArrayString SampleNames; - for (int i = 0; i < tSampleSet::MAXSMPL; i++) + for (int i = 0; i < tSampleSet::eSampleCount; ++i) { SampleNames.Add(ListEntry(i)); } @@ -1182,7 +1185,7 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -char *tSamplesDlg::ListEntry(int i) +char* tSamplesDlg::ListEntry(int i) { ostringstream Oss; Oss << i + 1 << ' ' << set.mSamples[i]->GetLabel(); @@ -1241,7 +1244,9 @@ void tSamplesDlg::OnCloseButton() { if (set.is_playing) + { return; + } Win2Sample(current); wxBeginBusyCursor(); set.ReloadSamples(); @@ -1255,12 +1260,18 @@ //----------------------------------------------------------------------------- void tSamplesDlg::OnAddButton() { - wxString fname = file_selector(path, "Load Sample", false, false, "*.wav"); - if (fname) + wxString FileName = file_selector( + mpSamplePath, + "Load Sample", + false, + false, + "*.wav"); + + if (FileName) { #ifdef OBSOLETE - file->SetValue(fname); - pLabel->SetValue(wxFileNameFromPath(fname)); + file->SetValue(FileName); + pLabel->SetValue(wxFileNameFromPath(FileName)); #endif Win2Sample(current); SetCurrentListEntry(current); @@ -1365,6 +1376,7 @@ ((tSamplesDlg *)itm.GetParent())->OnListClick(); } #endif // OBSOLETE +#endif //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- @@ -1377,7 +1389,7 @@ } if (mpSampleDialog == 0) { - mpSampleDialog = new tSamplesDlg(gpTrackWindow, *this); + mpSampleDialog = new JZSamplesDialog(gpTrackWindow, *this); } mpSampleDialog->Show(true); } @@ -1388,6 +1400,6 @@ { if (mpSampleDialog) { - mpSampleDialog->Sample2Win(mpSampleDialog->current); +// mpSampleDialog->Sample2Win(mpSampleDialog->current); } } Modified: trunk/jazz/src/Audio.h =================================================================== --- trunk/jazz/src/Audio.h 2010-07-03 14:12:43 UTC (rev 787) +++ trunk/jazz/src/Audio.h 2010-07-11 21:19:45 UTC (rev 788) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2010 Peter J. Stieber // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -219,7 +219,7 @@ // tSampleSet // ============================================================= -class tSamplesDlg; +class JZSamplesDialog; //***************************************************************************** //***************************************************************************** @@ -230,13 +230,17 @@ friend class tSampleVoice; friend class tSample; friend class tAudioGloblForm; - friend class tSamplesDlg; friend class JZWindowsAudioPlayer; friend class tAudioPlayer; friend class tAlsaAudioPlayer; public: + enum TESampleSize + { + eSampleCount = 128 + }; + tSampleSet(long ticks_per_minute); virtual ~tSampleSet(); @@ -338,7 +342,7 @@ return (long)(0.001 * time * speed * channels); } - virtual const char *GetSampleName(int i); + virtual const std::string& GetSampleLabel(int Index); void StartPlay(long clock); @@ -401,12 +405,8 @@ int bits; // must be 16! bool softsync; // enable software midi/audio sync - enum - { - MAXSMPL = 128 - }; - tSample* mSamples[MAXSMPL]; - tSampleWin* mSampleWindows[MAXSMPL]; + tSample* mSamples[eSampleCount]; + tSampleWin* mSampleWindows[eSampleCount]; long ticks_per_minute; // midi speed for audio/midi sync double clocks_per_buffer; @@ -425,7 +425,7 @@ long buffers_written; // for computing buffers clock wxDialog* mpGlobalSettingsDialog; - tSamplesDlg* mpSampleDialog; + JZSamplesDialog* mpSampleDialog; tEventArray* events; Added: trunk/jazz/src/Dialogs/SamplesDialog.cpp =================================================================== --- trunk/jazz/src/Dialogs/SamplesDialog.cpp (rev 0) +++ trunk/jazz/src/Dialogs/SamplesDialog.cpp 2010-07-11 21:19:45 UTC (rev 788) @@ -0,0 +1,181 @@ +//***************************************************************************** +// The JAZZ++ Midi Sequencer +// +// Copyright (C) 2010 Peter J. Stieber, all rights reserved. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +//***************************************************************************** + +#include "SamplesDialog.h" + +#include "../Audio.h" + +#include <wx/button.h> +#include <wx/listbox.h> +#include <wx/sizer.h> +#include <wx/slider.h> +#include <wx/stattext.h> +#include <wx/textctrl.h> + +//***************************************************************************** +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZSamplesDialog::JZSamplesDialog(wxWindow* pParent, tSampleSet& SampleSet) + : wxDialog(pParent, wxID_ANY, wxString("Samples Settings")), + mpListBox(0), + mpLabelEdit(0), + mpFileNameEdit(0), + mpFileNameBrowseButton(0), + mpVolumeSlider(0), + mpPanSlider(0), + mpPitchSlider(0) +{ + wxArrayString SampleNames; + for (int Index = 0; Index < tSampleSet::eSampleCount; ++Index) + { + wxString Entry; + Entry << Index + 1 << ' ' << SampleSet.GetSampleLabel(Index); + SampleNames.push_back(Entry); + } + + mpListBox = new wxListBox( + this, + wxID_ANY, + wxDefaultPosition, + wxDefaultSize, + SampleNames, + wxLB_SINGLE); + + mpLabelEdit = new wxTextCtrl(this, wxID_ANY); + + mpFileNameEdit = new wxTextCtrl(this, wxID_ANY); + + mpFileNameBrowseButton = new wxButton( + this, + wxID_ANY, +// IDC_BN_SD_FILE_SELECT_BROWSE, + "Browse..."); + + mpVolumeSlider = new wxSlider( + this, + wxID_ANY, + 64, + 0, + 127, + wxDefaultPosition, + wxDefaultSize, + wxSL_LABELS); + + mpPanSlider = new wxSlider( + this, + wxID_ANY, + 0, + -63, + 63, + wxDefaultPosition, + wxDefaultSize, + wxSL_LABELS); + + mpPitchSlider = new wxSlider( + this, + wxID_ANY, + 0, + -12, + 12, + wxDefaultPosition, + wxDefaultSize, + wxSL_LABELS); + + wxButton* pOkButton = new wxButton(this, wxID_OK, "&OK"); + wxButton* pCancelButton = new wxButton(this, wxID_CANCEL, "Cancel"); + wxButton* pHelpButton = new wxButton(this, wxID_HELP, "Help"); + pOkButton->SetDefault(); + + wxBoxSizer* pTopSizer = new wxBoxSizer(wxVERTICAL); + wxFlexGridSizer* pFlexGridSizer; + + pTopSizer->Add( + new wxStaticText(this, wxID_ANY, "Samples"), + 0, + wxLEFT | wxALL, + 3); + pTopSizer->Add(mpListBox, 0, wxGROW | wxALL, 3); + + pFlexGridSizer = new wxFlexGridSizer(1, 2, 4, 2); + pFlexGridSizer->AddGrowableCol(1); + + pFlexGridSizer->Add( + new wxStaticText(this, wxID_ANY, "Sample Label:"), + 0, + wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + mpLabelEdit, + 1, + wxGROW | wxALIGN_CENTER_VERTICAL); + + pTopSizer->Add(pFlexGridSizer, 0, wxGROW | wxALL, 5); + + pFlexGridSizer = new wxFlexGridSizer(1, 3, 4, 2); + + pFlexGridSizer->Add( + new wxStaticText(this, wxID_ANY, "Sample File Name:"), + 0, + wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + mpFileNameEdit, + 1, + wxGROW | wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + mpFileNameBrowseButton, + 0, + wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); + + pTopSizer->Add(pFlexGridSizer, 0, wxGROW | wxALL, 5); + + pTopSizer->Add( + new wxStaticText(this, wxID_ANY, "Volume"), + 0, + wxCENTER | wxALL, + 3); + pTopSizer->Add(mpVolumeSlider, 0, wxGROW | wxALL, 3); + + pTopSizer->Add( + new wxStaticText(this, wxID_ANY, "Pan"), + 0, + wxCENTER | wxALL, + 3); + pTopSizer->Add(mpPanSlider, 0, wxGROW | wxALL, 3); + + pTopSizer->Add( + new wxStaticText(this, wxID_ANY, "Pitch"), + 0, + wxCENTER | wxALL, + 3); + pTopSizer->Add(mpPitchSlider, 0, wxGROW | wxALL, 3); + + wxBoxSizer* pButtonSizer = new wxBoxSizer(wxHORIZONTAL); + pButtonSizer->Add(pOkButton, 0, wxALL, 5); + pButtonSizer->Add(pCancelButton, 0, wxALL, 5); + pButtonSizer->Add(pHelpButton, 0, wxALL, 5); + + pTopSizer->Add(pButtonSizer, 0, wxALIGN_CENTER | wxBOTTOM, 6); + + SetAutoLayout(true); + SetSizer(pTopSizer); + + pTopSizer->SetSizeHints(this); + pTopSizer->Fit(this); +} Property changes on: trunk/jazz/src/Dialogs/SamplesDialog.cpp ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/jazz/src/Dialogs/SamplesDialog.h =================================================================== --- trunk/jazz/src/Dialogs/SamplesDialog.h (rev 0) +++ trunk/jazz/src/Dialogs/SamplesDialog.h 2010-07-11 21:19:45 UTC (rev 788) @@ -0,0 +1,53 @@ +//***************************************************************************** +// The JAZZ++ Midi Sequencer +// +// Copyright (C) 2010 Peter J. Stieber, all rights reserved. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +//***************************************************************************** + +#ifndef JZ_SAMPLESDIALOG_H +#define JZ_SAMPLESDIALOG_H + +#include <wx/dialog.h> + +class tSampleSet; +class wxButton; +class wxListBox; +class wxSlider; +class wxTextCtrl; + +//***************************************************************************** +// Description: +// This is the sample dialog class declaration. +//***************************************************************************** +class JZSamplesDialog : public wxDialog +{ + public: + + JZSamplesDialog(wxWindow* pParent, tSampleSet& SampleSet); + + private: + + wxListBox* mpListBox; + wxTextCtrl* mpLabelEdit; + wxTextCtrl* mpFileNameEdit; + wxButton* mpFileNameBrowseButton; + wxSlider* mpVolumeSlider; + wxSlider* mpPanSlider; + wxSlider* mpPitchSlider; +}; + +#endif // !defined(JZ_SAMPLESDIALOG_H) Property changes on: trunk/jazz/src/Dialogs/SamplesDialog.h ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/jazz/src/Makefile.am =================================================================== --- trunk/jazz/src/Makefile.am 2010-07-03 14:12:43 UTC (rev 787) +++ trunk/jazz/src/Makefile.am 2010-07-11 21:19:45 UTC (rev 788) @@ -36,6 +36,7 @@ Dialogs/PitchWheelDialog.cpp \ Dialogs/ProgramChangeDialog.cpp \ Dialogs/QuantizeDialog.cpp \ +Dialogs/SamplesDialog.cpp \ Dialogs/SearchAndReplaceDialog.cpp \ Dialogs/SetTempoDialog.cpp \ Dialogs/ShiftDialog.cpp \ @@ -132,6 +133,7 @@ Dialogs/PitchWheelDialog.cpp \ Dialogs/ProgramChangeDialog.cpp \ Dialogs/QuantizeDialog.cpp \ +Dialogs/SamplesDialog.cpp \ Dialogs/SearchAndReplaceDialog.cpp \ Dialogs/SetTempoDialog.cpp \ Dialogs/ShiftDialog.cpp \ @@ -233,6 +235,7 @@ Dialogs/PitchWheelDialog.h \ Dialogs/ProgramChangeDialog.h \ Dialogs/QuantizeDialog.h \ +Dialogs/SamplesDialog.h \ Dialogs/SearchAndReplaceDialog.h \ Dialogs/SetTempoDialog.h \ Dialogs/ShiftDialog.h \ Modified: trunk/jazz/src/PianoWindow.cpp =================================================================== --- trunk/jazz/src/PianoWindow.cpp 2010-07-03 14:12:43 UTC (rev 787) +++ trunk/jazz/src/PianoWindow.cpp 2010-07-11 21:19:45 UTC (rev 788) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008-2009 Peter J. Stieber +// Modifications Copyright (C) 2008-2010 Peter J. Stieber // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -1336,7 +1336,7 @@ Dc.SetFont(*mpDrumFont); while (Pitch >= 0 && y < mEventsY + mEventsHeight) { - Dc.DrawText(gpMidiPlayer->GetSampleName(Pitch), mLittleBit, y); + Dc.DrawText(gpMidiPlayer->GetSampleLabel(Pitch), mLittleBit, y); y += mTrackHeight; --Pitch; } Modified: trunk/jazz/src/Player.h =================================================================== --- trunk/jazz/src/Player.h 2010-07-03 14:12:43 UTC (rev 787) +++ trunk/jazz/src/Player.h 2010-07-11 21:19:45 UTC (rev 788) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2010 Peter J. Stieber // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -261,9 +261,9 @@ return 0; } - virtual const char *GetSampleName(int i) + virtual const std::string& GetSampleLabel(int Index) { - return mSamples.GetSampleName(i); + return mSamples.GetSampleLabel(Index); } virtual void AdjustAudioLength(JZTrack *t) Modified: trunk/jazz/src/Sample.cpp =================================================================== --- trunk/jazz/src/Sample.cpp 2010-07-03 14:12:43 UTC (rev 787) +++ trunk/jazz/src/Sample.cpp 2010-07-11 21:19:45 UTC (rev 788) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2010 Peter J. Stieber // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -28,26 +28,24 @@ #include "DeprecatedStringUtils.h" #include "Mapper.h" +#include <cassert> +#include <cmath> #include <cstdlib> -#include <iostream> +#include <cstring> #include <fstream> -#include <cmath> -using namespace std; - -#include <assert.h> #include <sys/stat.h> -#include <string.h> +using namespace std; tSample::tSample(tSampleSet &s) - : set(s) + : set(s), + mLabel() { data = 0; length = 0; external_flag = 1; // auto reload when file changes on disk external_time = 0; - label = copystring(""); filename = copystring(""); volume = 127; pan = 0; @@ -59,14 +57,12 @@ tSample::~tSample() { delete [] data; - delete [] label; delete [] filename; } -void tSample::SetLabel(const char *str) +void tSample::SetLabel(const std::string& Label) { - delete [] label; - label = copystring(str); + mLabel = Label; } void tSample::SetFilename(const char *fname) @@ -75,7 +71,7 @@ { dirty = 1; char *s = copystring(fname); - label = copystring(wxFileNameFromPath(s)); + mLabel = wxFileNameFromPath(s); delete [] s; } delete [] filename; @@ -85,8 +81,7 @@ void tSample::Clear() { FreeData(); - delete [] label; - label = copystring(""); + mLabel.clear(); delete [] filename; filename = copystring(""); volume = 127; Modified: trunk/jazz/src/Sample.h =================================================================== --- trunk/jazz/src/Sample.h 2010-07-03 14:12:43 UTC (rev 787) +++ trunk/jazz/src/Sample.h 2010-07-11 21:19:45 UTC (rev 788) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2010 Peter J. Stieber // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -25,12 +25,12 @@ class tSampleSet; +#include <cmath> +#include <cstring> #include <iostream> -#include <cmath> +#include <string> -#include <assert.h> #include <sys/stat.h> -#include <string.h> #include "SignalInterface.h" @@ -219,10 +219,10 @@ int Save(); // Properties - void SetLabel(const char *str); - const char *GetLabel() const + void SetLabel(const std::string& Label); + const std::string& GetLabel() const { - return label; + return mLabel; } void SetVolume(int vol) @@ -400,12 +400,18 @@ void FreeData(); void MakeData(int length, int zero = 1); - int Convert(std::istream& is, int byte_count, int channels, int bits, int speed); + int Convert( + std::istream& is, + int byte_count, + int channels, + int bits, + int speed); + int length; // number of shorts short* data; // signed shorts tSampleSet& set; - char* label; // msvc cannot delete 'const char *' ???? + std::string mLabel; char* filename; int volume; int pan; @@ -421,7 +427,6 @@ int external_flag; // reload on disk change? int external_time; // last modified on disk - }; #endif // !defined(JZ_SAMPLE_H) Modified: trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj =================================================================== --- trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj 2010-07-03 14:12:43 UTC (rev 787) +++ trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj 2010-07-11 21:19:45 UTC (rev 788) @@ -1241,6 +1241,14 @@ > </File> <File + RelativePath="..\src\Dialogs\SamplesDialog.cpp" + > + </File> + <File + RelativePath="..\src\Dialogs\SamplesDialog.h" + > + </File> + <File RelativePath="..\src\Dialogs\SearchAndReplaceDialog.cpp" > </File> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |