mirror of
https://github.com/cookiengineer/audacity
synced 2025-09-19 09:30:52 +02:00
Improve 'Import Raw Data' dialog (#679)
* Add sample rate preset(combo box) to Import Raw Data dialog * Import Raw Data dialog: Get default sample rate from Project Rate * Fix build
This commit is contained in:
parent
c5741cc1da
commit
f144a1f689
@ -24,8 +24,10 @@ and sample size to help you importing data of an unknown format.
|
|||||||
#include "../Audacity.h"
|
#include "../Audacity.h"
|
||||||
#include "ImportRaw.h"
|
#include "ImportRaw.h"
|
||||||
|
|
||||||
|
#include "../AudioIOBase.h"
|
||||||
#include "../FileFormats.h"
|
#include "../FileFormats.h"
|
||||||
#include "../Prefs.h"
|
#include "../Prefs.h"
|
||||||
|
#include "../ProjectSettings.h"
|
||||||
#include "../ShuttleGui.h"
|
#include "../ShuttleGui.h"
|
||||||
#include "../UserException.h"
|
#include "../UserException.h"
|
||||||
#include "../WaveTrack.h"
|
#include "../WaveTrack.h"
|
||||||
@ -41,6 +43,7 @@ and sample size to help you importing data of an unknown format.
|
|||||||
#include <wx/defs.h>
|
#include <wx/defs.h>
|
||||||
#include <wx/button.h>
|
#include <wx/button.h>
|
||||||
#include <wx/choice.h>
|
#include <wx/choice.h>
|
||||||
|
#include <wx/combobox.h>
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
#include <wx/panel.h>
|
#include <wx/panel.h>
|
||||||
#include <wx/sizer.h>
|
#include <wx/sizer.h>
|
||||||
@ -81,7 +84,7 @@ class ImportRawDialog final : public wxDialogWrapper {
|
|||||||
wxChoice *mChannelChoice;
|
wxChoice *mChannelChoice;
|
||||||
wxTextCtrl *mOffsetText;
|
wxTextCtrl *mOffsetText;
|
||||||
wxTextCtrl *mPercentText;
|
wxTextCtrl *mPercentText;
|
||||||
wxTextCtrl *mRateText;
|
wxComboBox *mRateText;
|
||||||
|
|
||||||
int mNumEncodings;
|
int mNumEncodings;
|
||||||
ArrayOf<int> mEncodingSubtype;
|
ArrayOf<int> mEncodingSubtype;
|
||||||
@ -92,7 +95,7 @@ class ImportRawDialog final : public wxDialogWrapper {
|
|||||||
// This function leaves outTracks empty as an indication of error,
|
// This function leaves outTracks empty as an indication of error,
|
||||||
// but may also throw FileException to make use of the application's
|
// but may also throw FileException to make use of the application's
|
||||||
// user visible error reporting.
|
// user visible error reporting.
|
||||||
void ImportRaw(wxWindow *parent, const wxString &fileName,
|
void ImportRaw(const AudacityProject &project, wxWindow *parent, const wxString &fileName,
|
||||||
WaveTrackFactory *trackFactory, TrackHolders &outTracks)
|
WaveTrackFactory *trackFactory, TrackHolders &outTracks)
|
||||||
{
|
{
|
||||||
outTracks.clear();
|
outTracks.clear();
|
||||||
@ -128,6 +131,8 @@ void ImportRaw(wxWindow *parent, const wxString &fileName,
|
|||||||
offset = 0;
|
offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rate = ProjectSettings::Get( project ).GetRate();
|
||||||
|
|
||||||
numChannels = std::max(1u, numChannels);
|
numChannels = std::max(1u, numChannels);
|
||||||
ImportRawDialog dlog(parent, encoding, numChannels, (int)offset, rate);
|
ImportRawDialog dlog(parent, encoding, numChannels, (int)offset, rate);
|
||||||
dlog.ShowModal();
|
dlog.ShowModal();
|
||||||
@ -418,10 +423,16 @@ ImportRawDialog::ImportRawDialog(wxWindow * parent,
|
|||||||
S.AddUnits(XO("%"));
|
S.AddUnits(XO("%"));
|
||||||
|
|
||||||
// Rate text
|
// Rate text
|
||||||
|
wxArrayStringEx rates;
|
||||||
|
for (int i = 0; i < AudioIOBase::NumStandardRates; i++) {
|
||||||
|
rates.Add(
|
||||||
|
wxString::Format(wxT("%d"), AudioIOBase::StandardRates[i]));
|
||||||
|
}
|
||||||
|
|
||||||
/* i18n-hint: (noun)*/
|
/* i18n-hint: (noun)*/
|
||||||
mRateText = S.AddTextBox(XXO("Sample rate:"),
|
mRateText = S.AddCombo(XXO("Sample rate:"),
|
||||||
wxString::Format(wxT("%d"), (int)mRate),
|
wxString::Format(wxT("%d"), (int)mRate),
|
||||||
12);
|
rates);
|
||||||
/* i18n-hint: This is the abbreviation for "Hertz", or
|
/* i18n-hint: This is the abbreviation for "Hertz", or
|
||||||
cycles per second. */
|
cycles per second. */
|
||||||
S.AddUnits(XO("Hz"));
|
S.AddUnits(XO("Hz"));
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "../MemoryX.h"
|
#include "../MemoryX.h"
|
||||||
|
|
||||||
|
class AudacityProject;
|
||||||
class WaveTrackFactory;
|
class WaveTrackFactory;
|
||||||
class WaveTrack;
|
class WaveTrack;
|
||||||
class wxString;
|
class wxString;
|
||||||
@ -26,7 +27,7 @@ using NewChannelGroup = std::vector< std::shared_ptr<WaveTrack> >;
|
|||||||
using TrackHolders = std::vector< NewChannelGroup >;
|
using TrackHolders = std::vector< NewChannelGroup >;
|
||||||
|
|
||||||
|
|
||||||
void ImportRaw(wxWindow *parent, const wxString &fileName,
|
void ImportRaw(const AudacityProject &project, wxWindow *parent, const wxString &fileName,
|
||||||
WaveTrackFactory *trackFactory, TrackHolders &outTracks);
|
WaveTrackFactory *trackFactory, TrackHolders &outTracks);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -603,7 +603,7 @@ void OnImportRaw(const CommandContext &context)
|
|||||||
|
|
||||||
TrackHolders newTracks;
|
TrackHolders newTracks;
|
||||||
|
|
||||||
::ImportRaw(&window, fileName, &trackFactory, newTracks);
|
::ImportRaw(project, &window, fileName, &trackFactory, newTracks);
|
||||||
|
|
||||||
if (newTracks.size() <= 0)
|
if (newTracks.size() <= 0)
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user