Audacity  3.0.3
ImportRaw.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  ImportRaw.cpp
6 
7  Dominic Mazzoni
8 
9 *******************************************************************//****************************************************************//*******************************************************************/
22 
23 
24 
25 #include "ImportRaw.h"
26 
27 #include "ImportPlugin.h"
28 
29 #include "../AudioIOBase.h"
30 #include "../FileFormats.h"
31 #include "Prefs.h"
32 #include "../ProjectSettings.h"
33 #include "../ShuttleGui.h"
34 #include "UserException.h"
35 #include "../WaveTrack.h"
36 #include "../widgets/ProgressDialog.h"
37 
38 #include <cmath>
39 #include <cstdio>
40 #include <stdint.h>
41 #include <vector>
42 
43 #include <wx/crt.h>
44 #include <wx/defs.h>
45 #include <wx/button.h>
46 #include <wx/choice.h>
47 #include <wx/combobox.h>
48 #include <wx/intl.h>
49 #include <wx/panel.h>
50 #include <wx/sizer.h>
51 #include <wx/stattext.h>
52 #include <wx/textctrl.h>
53 #include <wx/timer.h>
54 
55 // #include "RawAudioGuess.h"
56 #include "FormatClassifier.h"
57 
58 #include "sndfile.h"
59 
60 class ImportRawDialog final : public wxDialogWrapper {
61 
62  public:
63  ImportRawDialog(wxWindow * parent,
64  int encoding, unsigned channels,
65  int offset, double rate);
67 
68  void OnOK(wxCommandEvent & event);
69  void OnCancel(wxCommandEvent & event);
70  void OnPlay(wxCommandEvent & event);
71  void OnChoice(wxCommandEvent & event);
72 
73  // in and out
74  int mEncoding;
75  unsigned mChannels;
76  int mOffset;
77  double mRate;
78  double mPercent;
79 
80  private:
81 
82  wxButton *mOK;
83  wxChoice *mEncodingChoice;
84  wxChoice *mEndianChoice;
85  wxChoice *mChannelChoice;
86  wxTextCtrl *mOffsetText;
87  wxTextCtrl *mPercentText;
88  wxComboBox *mRateText;
89 
92 
93  DECLARE_EVENT_TABLE()
94 };
95 
96 // This function leaves outTracks empty as an indication of error,
97 // but may also throw FileException to make use of the application's
98 // user visible error reporting.
99 void ImportRaw(const AudacityProject &project, wxWindow *parent, const wxString &fileName,
100  WaveTrackFactory *trackFactory, TrackHolders &outTracks)
101 {
102  outTracks.clear();
103  int encoding = 0; // Guess Format
104  sf_count_t offset = 0;
105  double rate = 44100.0;
106  double percent = 100.0;
107  TrackHolders results;
108  auto updateResult = ProgressResult::Success;
109 
110  {
111  SF_INFO sndInfo;
112  unsigned numChannels = 0;
113 
114  try {
115  // Yes, FormatClassifier currently handles filenames in UTF8 format only, that's
116  // a TODO ...
117  FormatClassifier theClassifier(fileName.utf8_str());
118  encoding = theClassifier.GetResultFormatLibSndfile();
119  numChannels = theClassifier.GetResultChannels();
120  offset = 0;
121  } catch (...) {
122  // Something went wrong in FormatClassifier, use defaults instead.
123  encoding = 0;
124  }
125 
126  if (encoding <= 0) {
127  // Unable to guess. Use mono, 16-bit samples with CPU endianness
128  // as the default.
129  encoding = SF_FORMAT_RAW | SF_ENDIAN_CPU | SF_FORMAT_PCM_16;
130  numChannels = 1;
131  offset = 0;
132  }
133 
134  rate = ProjectSettings::Get( project ).GetRate();
135 
136  numChannels = std::max(1u, numChannels);
137  ImportRawDialog dlog(parent, encoding, numChannels, (int)offset, rate);
138  dlog.ShowModal();
139  if (!dlog.GetReturnCode())
140  return;
141 
142  encoding = dlog.mEncoding;
143  numChannels = dlog.mChannels;
144  rate = dlog.mRate;
145  offset = (sf_count_t)dlog.mOffset;
146  percent = dlog.mPercent;
147 
148  memset(&sndInfo, 0, sizeof(SF_INFO));
149  sndInfo.samplerate = (int)rate;
150  sndInfo.channels = (int)numChannels;
151  sndInfo.format = encoding | SF_FORMAT_RAW;
152 
153  wxFile f; // will be closed when it goes out of scope
154  SFFile sndFile;
155 
156  if (f.Open(fileName)) {
157  // Even though there is an sf_open() that takes a filename, use the one that
158  // takes a file descriptor since wxWidgets can open a file with a Unicode name and
159  // libsndfile can't (under Windows).
160  sndFile.reset(SFCall<SNDFILE*>(sf_open_fd, f.fd(), SFM_READ, &sndInfo, FALSE));
161  }
162 
163  if (!sndFile){
164  char str[1000];
165  sf_error_str((SNDFILE *)NULL, str, 1000);
166  wxPrintf("%s\n", str);
167 
168  throw FileException{ FileException::Cause::Open, fileName };
169  }
170 
171 
172  {
173  int result = sf_command(sndFile.get(), SFC_SET_RAW_START_OFFSET, &offset, sizeof(offset));
174  if (result != 0) {
175  char str[1000];
176  sf_error_str(sndFile.get(), str, 1000);
177  wxPrintf("%s\n", str);
178 
179  throw FileException{ FileException::Cause::Read, fileName };
180  }
181  }
182  SFCall<sf_count_t>(sf_seek, sndFile.get(), 0, SEEK_SET);
183 
184  auto totalFrames =
185  // fraction of a sf_count_t value
186  (sampleCount)(sndInfo.frames * percent / 100.0);
187 
188  //
189  // Sample format:
190  //
191  // In general, go with the user's preferences. However, if
192  // the file is higher-quality, go with a format which preserves
193  // the quality of the original file.
194  //
195 
198 
199  results.resize(1);
200  auto &channels = results[0];
201  channels.resize(numChannels);
202 
203  {
204  // iter not used outside this scope.
205  auto iter = channels.begin();
206  for (decltype(numChannels) c = 0; c < numChannels; ++iter, ++c)
207  *iter = trackFactory->NewWaveTrack(format, rate);
208  }
209  const auto firstChannel = channels.begin()->get();
210  auto maxBlockSize = firstChannel->GetMaxBlockSize();
211 
212  SampleBuffer srcbuffer(maxBlockSize * numChannels, format);
213  SampleBuffer buffer(maxBlockSize, format);
214 
215  decltype(totalFrames) framescompleted = 0;
216  if (totalFrames < 0) {
217  wxASSERT(false);
218  totalFrames = 0;
219  }
220 
221  auto msg = XO("Importing %s").Format( wxFileName::FileName(fileName).GetFullName() );
222 
223  /* i18n-hint: 'Raw' means 'unprocessed' here and should usually be translated.*/
224  ProgressDialog progress(XO("Import Raw"), msg);
225 
226  size_t block;
227  do {
228  block =
229  limitSampleBufferSize( maxBlockSize, totalFrames - framescompleted );
230 
231  sf_count_t sf_result;
232  if (format == int16Sample)
233  sf_result = SFCall<sf_count_t>(sf_readf_short, sndFile.get(), (short *)srcbuffer.ptr(), block);
234  else
235  sf_result = SFCall<sf_count_t>(sf_readf_float, sndFile.get(), (float *)srcbuffer.ptr(), block);
236 
237  if (sf_result >= 0) {
238  block = sf_result;
239  }
240  else {
241  // This is not supposed to happen, sndfile.h says result is always
242  // a count, not an invalid value for error
243  throw FileException{ FileException::Cause::Read, fileName };
244  }
245 
246  if (block) {
247  auto iter = channels.begin();
248  for(decltype(numChannels) c = 0; c < numChannels; ++iter, ++c) {
249  if (format==int16Sample) {
250  for(decltype(block) j=0; j<block; j++)
251  ((short *)buffer.ptr())[j] =
252  ((short *)srcbuffer.ptr())[numChannels*j+c];
253  }
254  else {
255  for(decltype(block) j=0; j<block; j++)
256  ((float *)buffer.ptr())[j] =
257  ((float *)srcbuffer.ptr())[numChannels*j+c];
258  }
259 
260  iter->get()->Append(buffer.ptr(), (format == int16Sample)?int16Sample:floatSample, block);
261  }
262  framescompleted += block;
263  }
264 
265  updateResult = progress.Update(
266  framescompleted.as_long_long(),
267  totalFrames.as_long_long()
268  );
269  if (updateResult != ProgressResult::Success)
270  break;
271 
272  } while (block > 0 && framescompleted < totalFrames);
273  }
274 
275  if (updateResult == ProgressResult::Failed || updateResult == ProgressResult::Cancelled)
276  throw UserException{};
277 
278  if (!results.empty() && !results[0].empty()) {
279  for (const auto &channel : results[0])
280  channel->Flush();
281  outTracks.swap(results);
282  }
283 }
284 
285 //
286 // ImportRawDialog
287 //
288 
289 enum {
290  ChoiceID = 9000,
291  PlayID
292 };
293 
294 BEGIN_EVENT_TABLE(ImportRawDialog, wxDialogWrapper)
300 
301 ImportRawDialog::ImportRawDialog(wxWindow * parent,
302  int encoding, unsigned channels,
303  int offset, double rate)
304 : wxDialogWrapper(parent, wxID_ANY, XO("Import Raw Data"),
305  wxDefaultPosition, wxDefaultSize,
306  wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
307  mEncoding(encoding),
308  mChannels(channels),
309  mOffset(offset),
310  mRate(rate)
311 {
312  wxASSERT(channels >= 1);
313 
314  SetName();
315 
316  ShuttleGui S(this, eIsCreating);
317  TranslatableStrings encodings;
318  int num;
319  int selection;
320  int endian;
321  int i;
322 
323  num = sf_num_encodings();
324  mNumEncodings = 0;
325  mEncodingSubtype.reinit(static_cast<size_t>(num));
326 
327  selection = 0;
328  for (i=0; i<num; i++) {
329  SF_INFO info;
330 
331  memset(&info, 0, sizeof(SF_INFO));
332 
333  int subtype = sf_encoding_index_to_subtype(i);
334  info.format = SF_FORMAT_RAW + SF_ENDIAN_LITTLE + subtype;
335  info.channels = 1;
336  info.samplerate = 44100;
337 
338  if (sf_format_check(&info)) {
339  mEncodingSubtype[mNumEncodings] = subtype;
340  encodings.push_back( Verbatim( sf_encoding_index_name(i) ) );
341 
342  if ((mEncoding & SF_FORMAT_SUBMASK) == subtype)
343  selection = mNumEncodings;
344 
345  mNumEncodings++;
346  }
347  }
348 
349  TranslatableStrings endians{
350  /* i18n-hint: Refers to byte-order. Don't translate "endianness" if you don't
351  know the correct technical word. */
352  XO("No endianness") ,
353  /* i18n-hint: Refers to byte-order. Don't translate this if you don't
354  know the correct technical word. */
355  XO("Little-endian") ,
356  /* i18n-hint: Refers to byte-order. Don't translate this if you don't
357  know the correct technical word. */
358  XO("Big-endian") ,
359  /* i18n-hint: Refers to byte-order. Don't translate "endianness" if you don't
360  know the correct technical word. */
361  XO("Default endianness") ,
362  };
363 
364  switch (mEncoding & (SF_FORMAT_ENDMASK))
365  {
366  default:
367  case SF_ENDIAN_FILE:
368  endian = 0;
369  break;
370  case SF_ENDIAN_LITTLE:
371  endian = 1;
372  break;
373  case SF_ENDIAN_BIG:
374  endian = 2;
375  break;
376  case SF_ENDIAN_CPU:
377  endian = 3;
378  break;
379  }
380 
381  TranslatableStrings chans{
382  XO("1 Channel (Mono)") ,
383  XO("2 Channels (Stereo)") ,
384  };
385  for (i=2; i<16; i++) {
386  chans.push_back( XO("%d Channels").Format( i + 1 ) );
387  }
388 
389  S.StartVerticalLay(false);
390  {
391  S.SetBorder(5);
392  S.StartTwoColumn();
393  {
394  mEncodingChoice = S.Id(ChoiceID).AddChoice(XXO("Encoding:"),
395  encodings,
396  selection);
397  mEndianChoice = S.Id(ChoiceID).AddChoice(XXO("Byte order:"),
398  endians,
399  endian);
400  mChannelChoice = S.Id(ChoiceID).AddChoice(XXO("Channels:"),
401  chans,
402  mChannels - 1);
403  }
404  S.EndTwoColumn();
405 
406  S.SetBorder(5);
407  S.StartMultiColumn(3);
408  {
409  // Offset text
410  /* i18n-hint: (noun)*/
411  mOffsetText = S.AddTextBox(XXO("Start offset:"),
412  wxString::Format(wxT("%d"), mOffset),
413  12);
414  S.AddUnits(XO("bytes"));
415 
416  // Percent text
417  mPercentText = S.AddTextBox(XXO("Amount to import:"),
418  wxT("100"),
419  12);
420  S.AddUnits(XO("%"));
421 
422  // Rate text
423  wxArrayStringEx rates;
424  for (int i = 0; i < AudioIOBase::NumStandardRates; i++) {
425  rates.Add(
426  wxString::Format(wxT("%d"), AudioIOBase::StandardRates[i]));
427  }
428 
429  /* i18n-hint: (noun)*/
430  mRateText = S.AddCombo(XXO("Sample rate:"),
431  wxString::Format(wxT("%d"), (int)mRate),
432  rates);
433  /* i18n-hint: This is the abbreviation for "Hertz", or
434  cycles per second. */
435  S.AddUnits(XO("Hz"));
436  }
437  S.EndMultiColumn();
438 
439  //
440  // Preview Pane goes here
441  //
442 
443  S.AddStandardButtons();
444  // Find the OK button, and change its text to 'Import'.
445  // We MUST set mOK because it is used later.
446  mOK = (wxButton *)wxWindow::FindWindowById(wxID_OK, this);
447  mOK->SetLabel(_("&Import"));
448  }
449  S.EndVerticalLay();
450 
451  Fit();
452  SetSizeHints(GetSize());
453 
454  Centre(wxBOTH);
455 }
456 
458 {
459 }
460 
461 void ImportRawDialog::OnOK(wxCommandEvent & WXUNUSED(event))
462 {
463  long l;
464 
465  mEncoding = mEncodingSubtype[mEncodingChoice->GetSelection()];
466  mEncoding += (mEndianChoice->GetSelection() * 0x10000000);
467  mChannels = mChannelChoice->GetSelection() + 1;
468  mOffsetText->GetValue().ToLong(&l);
469  mOffset = l;
470  mPercentText->GetValue().ToDouble(&mPercent);
471  mRateText->GetValue().ToDouble(&mRate);
472 
473  if (mChannels < 1 || mChannels > 16)
474  mChannels = 1;
475  if (mOffset < 0)
476  mOffset = 0;
477  if (mPercent < 0.0)
478  mPercent = 0.0;
479  if (mPercent > 100.0)
480  mPercent = 100.0;
481  if (mRate < 100.0)
482  mRate = 100.0;
483  // Highest preset sample rate supported in Audacity 2.3.0 is 384 kHz
484  if (mRate > 384000.0)
485  mRate = 384000.0;
486 
487  EndModal(true);
488 }
489 
490 void ImportRawDialog::OnCancel(wxCommandEvent & WXUNUSED(event))
491 {
492  EndModal(false);
493 }
494 
495 void ImportRawDialog::OnPlay(wxCommandEvent & WXUNUSED(event))
496 {
497 }
498 
499 void ImportRawDialog::OnChoice(wxCommandEvent & WXUNUSED(event))
500 {
501  SF_INFO info;
502 
503  memset(&info, 0, sizeof(SF_INFO));
504 
505  mEncoding = mEncodingSubtype[mEncodingChoice->GetSelection()];
506  mEncoding += (mEndianChoice->GetSelection() * 0x10000000);
507 
508  info.format = mEncoding | SF_FORMAT_RAW;
509  info.channels = mChannelChoice->GetSelection() + 1;
510  info.samplerate = 44100;
511 
512  //mOK = (wxButton *)wxWindow::FindWindowById(wxID_OK, this);
513  if (sf_format_check(&info)) {
514  mOK->Enable(true);
515  return;
516  }
517 
518  // Try it with 1-channel
519  info.channels = 1;
520  if (sf_format_check(&info)) {
521  mChannelChoice->SetSelection(0);
522  mOK->Enable(true);
523  return;
524  }
525 
526  // Otherwise, this is an unsupported format
527  mOK->Enable(false);
528 }
EVT_BUTTON
EVT_BUTTON(wxID_NO, DependencyDialog::OnNo) EVT_BUTTON(wxID_YES
eIsCreating
@ eIsCreating
Definition: ShuttleGui.h:38
ShuttleGuiBase::AddChoice
wxChoice * AddChoice(const TranslatableString &Prompt, const TranslatableStrings &choices, int Selected=-1)
Definition: ShuttleGui.cpp:398
ShuttleGuiBase::StartVerticalLay
void StartVerticalLay(int iProp=1)
Definition: ShuttleGui.cpp:1184
TrackHolders
std::vector< std::vector< std::shared_ptr< WaveTrack > > > TrackHolders
Definition: Import.h:39
AudioIOBase::StandardRates
static const int StandardRates[]
Array of common audio sample rates.
Definition: AudioIOBase.h:202
BasicUI::ProgressResult::Success
@ Success
UserException
Can be thrown when user cancels operations, as with a progress dialog. Delayed handler does nothing.
Definition: UserException.h:17
TranslatableStrings
std::vector< TranslatableString > TranslatableStrings
Definition: TranslatableString.h:295
FormatClassifier::GetResultChannels
unsigned GetResultChannels()
Definition: FormatClassifier.cpp:125
FileException::Cause::Read
@ Read
ImportRaw
void ImportRaw(const AudacityProject &project, wxWindow *parent, const wxString &fileName, WaveTrackFactory *trackFactory, TrackHolders &outTracks)
Definition: ImportRaw.cpp:99
Format
Abstract base class used in importing a file.
ChoiceID
@ ChoiceID
Definition: ImportRaw.cpp:290
FileException
Thrown for failure of file or database operations in deeply nested places.
Definition: FileException.h:19
RefreshCode::Cancelled
@ Cancelled
Definition: RefreshCode.h:23
XO
#define XO(s)
Definition: Internat.h:31
ProjectSettings::Get
static ProjectSettings & Get(AudacityProject &project)
Definition: ProjectSettings.cpp:40
ImportRaw.h
ImportRawDialog::~ImportRawDialog
~ImportRawDialog()
Definition: ImportRaw.cpp:457
ShuttleGuiBase::EndMultiColumn
void EndMultiColumn()
Definition: ShuttleGui.cpp:1238
AudioIOBase::NumStandardRates
static const int NumStandardRates
How many standard sample rates there are.
Definition: AudioIOBase.h:204
wxArrayStringEx
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.
Definition: wxArrayStringEx.h:18
sf_encoding_index_to_subtype
unsigned int sf_encoding_index_to_subtype(int i)
Definition: FileFormats.cpp:95
ShuttleGui::Id
ShuttleGui & Id(int id)
Definition: ShuttleGui.cpp:2274
floatSample
@ floatSample
Definition: SampleFormat.h:34
PlayID
@ PlayID
Definition: ImportRaw.cpp:291
ImportRawDialog
ImportRawDialog prompts you with options such as endianness and sample size to help you importing dat...
Definition: ImportRaw.cpp:60
XXO
#define XXO(s)
Definition: Internat.h:44
ImportRawDialog::OnChoice
void OnChoice(wxCommandEvent &event)
Definition: ImportRaw.cpp:499
ImportRawDialog::mOffsetText
wxTextCtrl * mOffsetText
Definition: ImportRaw.cpp:86
ProgressDialog
ProgressDialog Class.
Definition: ProgressDialog.h:51
ImportRawDialog::mEncoding
int mEncoding
Definition: ImportRaw.cpp:74
ImportRawDialog::mChannels
unsigned mChannels
Definition: ImportRaw.cpp:75
ImportFileHandle::ChooseFormat
static sampleFormat ChooseFormat(sampleFormat effectiveFormat)
Choose appropriate format, which will not be narrower than the specified one.
Definition: ImportPlugin.cpp:54
ShuttleGuiBase::AddTextBox
wxTextCtrl * AddTextBox(const TranslatableString &Caption, const wxString &Value, const int nChars)
Definition: ShuttleGui.cpp:638
ShuttleGuiBase::StartMultiColumn
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
Definition: ShuttleGui.cpp:1229
ShuttleGuiBase::EndVerticalLay
void EndVerticalLay()
Definition: ShuttleGui.cpp:1203
int16Sample
@ int16Sample
Definition: SampleFormat.h:32
ShuttleGuiBase::AddUnits
void AddUnits(const TranslatableString &Prompt, int wrapWidth=0)
Left aligned text string.
Definition: ShuttleGui.cpp:263
sf_subtype_to_effective_format
sampleFormat sf_subtype_to_effective_format(unsigned int format)
Choose the narrowest value in the sampleFormat enumeration for a given libsndfile format.
Definition: FileFormats.cpp:229
FormatClassifier.h
ImportRawDialog::OnPlay
void OnPlay(wxCommandEvent &event)
Definition: ImportRaw.cpp:495
FileException::Cause::Open
@ Open
ImportRawDialog::mNumEncodings
int mNumEncodings
Definition: ImportRaw.cpp:90
ShuttleGuiBase::StartTwoColumn
void StartTwoColumn()
Definition: ShuttleGui.h:366
format
int format
Definition: ExportPCM.cpp:56
ProgressDialog::Update
ProgressResult Update(int value, const TranslatableString &message={})
Definition: ProgressDialog.cpp:1327
ImportRawDialog::mEncodingChoice
wxChoice * mEncodingChoice
Definition: ImportRaw.cpp:83
SFFile
Definition: FileFormats.h:143
ImportRawDialog::mChannelChoice
wxChoice * mChannelChoice
Definition: ImportRaw.cpp:85
sf_num_encodings
int sf_num_encodings()
Get the number of data encodings libsndfile supports (in any container or none.
Definition: FileFormats.cpp:75
WaveTrackFactory
Used to create or clone a WaveTrack, with appropriate context from the project that will own the trac...
Definition: WaveTrack.h:701
UserException.h
An AudacityException with no visible message.
ImportRawDialog::mOffset
int mOffset
Definition: ImportRaw.cpp:76
SampleBuffer
Definition: SampleFormat.h:69
ImportRawDialog::mEncodingSubtype
ArrayOf< int > mEncodingSubtype
Definition: ImportRaw.cpp:91
wxDialogWrapper
Definition: wxPanelWrapper.h:81
ImportRawDialog::OnOK
void OnOK(wxCommandEvent &event)
Definition: ImportRaw.cpp:461
ImportRawDialog::mOK
wxButton * mOK
Definition: ImportRaw.cpp:82
_
#define _(s)
Definition: Internat.h:75
sampleCount
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:18
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:113
ImportPlugin.h
The interface that all file import "plugins" (if you want to call them that) must implement....
ImportRawDialog::mRateText
wxComboBox * mRateText
Definition: ImportRaw.cpp:88
ProjectSettings::GetRate
double GetRate() const
Definition: ProjectSettings.cpp:168
Verbatim
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
Definition: TranslatableString.h:321
ShuttleGui::AddStandardButtons
void AddStandardButtons(long buttons=eOkButton|eCancelButton, wxWindow *extra=NULL)
Definition: ShuttleGui.cpp:2432
ImportRawDialog::OnCancel
void OnCancel(wxCommandEvent &event)
Definition: ImportRaw.cpp:490
FormatClassifier
FormatClassifier classifies the sample format and endianness of raw audio files.
Definition: FormatClassifier.h:59
ImportRawDialog::mEndianChoice
wxChoice * mEndianChoice
Definition: ImportRaw.cpp:84
Prefs.h
ShuttleGuiBase::SetBorder
void SetBorder(int Border)
Definition: ShuttleGui.h:489
ShuttleGuiBase::EndTwoColumn
void EndTwoColumn()
Definition: ShuttleGui.h:367
ImportRawDialog::mRate
double mRate
Definition: ImportRaw.cpp:77
limitSampleBufferSize
size_t limitSampleBufferSize(size_t bufferSize, sampleCount limit)
Definition: SampleCount.cpp:21
ImportRawDialog::mPercentText
wxTextCtrl * mPercentText
Definition: ImportRaw.cpp:87
FormatClassifier::GetResultFormatLibSndfile
int GetResultFormatLibSndfile()
Definition: FormatClassifier.cpp:83
WaveTrackFactory::NewWaveTrack
std::shared_ptr< WaveTrack > NewWaveTrack(sampleFormat format=(sampleFormat) 0, double rate=0)
Definition: WaveTrack.cpp:85
END_EVENT_TABLE
END_EVENT_TABLE()
sf_encoding_index_name
wxString sf_encoding_index_name(int i)
Get the string name of the data encoding of the requested format.
Definition: FileFormats.cpp:84
ImportRawDialog::mPercent
double mPercent
Definition: ImportRaw.cpp:78
ShuttleGuiBase::AddCombo
wxComboBox * AddCombo(const TranslatableString &Prompt, const wxString &Selected, const wxArrayStringEx &choices)
Definition: ShuttleGui.cpp:517
ArrayOf< int >
ImportRawDialog::ImportRawDialog
ImportRawDialog(wxWindow *parent, int encoding, unsigned channels, int offset, double rate)
Definition: ImportRaw.cpp:301
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631
SampleBuffer::ptr
samplePtr ptr() const
Definition: SampleFormat.h:98