Update of /cvsroot/audacity/audacity-src/src/prefs
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv1355/src/prefs
Modified Files:
AudioIOPrefs.cpp AudioIOPrefs.h
Log Message:
Allow for more then 16 input channels.
Index: AudioIOPrefs.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/prefs/AudioIOPrefs.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- AudioIOPrefs.h 6 Apr 2009 23:20:28 -0000 1.17
+++ AudioIOPrefs.h 15 Apr 2009 00:22:38 -0000 1.18
@@ -36,18 +36,19 @@
void GetNamesAndLabels();
void OnHost(wxCommandEvent & e);
+ void OnDevice(wxCommandEvent & e);
wxArrayString mHostNames;
wxArrayString mHostLabels;
- wxArrayString mChannelNames;
- wxArrayInt mChannelLabels;
wxString mPlayDevice;
wxString mRecordDevice;
+ long mRecordChannels;
wxChoice *mHost;
wxChoice *mPlay;
wxChoice *mRecord;
+ wxChoice *mChannels;
DECLARE_EVENT_TABLE();
};
Index: AudioIOPrefs.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/prefs/AudioIOPrefs.cpp,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- AudioIOPrefs.cpp 10 Apr 2009 14:27:33 -0000 1.67
+++ AudioIOPrefs.cpp 15 Apr 2009 00:22:38 -0000 1.68
@@ -43,11 +43,15 @@
#include "AudioIOPrefs.h"
enum {
- HostID = 10000
+ HostID = 10000,
+ PlayID,
+ RecordID,
+ ChannelsID
};
BEGIN_EVENT_TABLE(DevicePrefs, PrefsPanel)
EVT_CHOICE(HostID, DevicePrefs::OnHost)
+ EVT_CHOICE(RecordID, DevicePrefs::OnDevice)
END_EVENT_TABLE()
DevicePrefs::DevicePrefs(wxWindow * parent)
@@ -68,6 +72,7 @@
// Get current setting for devices
mPlayDevice = gPrefs->Read(wxT("/AudioIO/PlaybackDevice"), wxT(""));
mRecordDevice = gPrefs->Read(wxT("/AudioIO/RecordingDevice"), wxT(""));
+ mRecordChannels = gPrefs->Read(wxT("/AudioIO/RecordChannels"), 2L);
//------------------------- Main section --------------------
// Now construct the GUI itself.
@@ -79,6 +84,7 @@
wxCommandEvent e;
OnHost(e);
+ OnDevice(e);
}
void DevicePrefs::GetNamesAndLabels()
@@ -95,14 +101,6 @@
}
}
}
-
- // Channel counts, mono, stereo etc...
- for (int i = 0; i < 16; i++) {
- mChannelNames.Add(wxString::Format(wxT("%d"), i + 1));
- mChannelLabels.Add(i + 1);
- }
- mChannelNames[0] = _("1 (Mono)");
- mChannelNames[1] = _("2 (Stereo)");
}
void DevicePrefs::PopulateOrExchange(ShuttleGui & S)
@@ -115,11 +113,12 @@
{
S.StartMultiColumn(2);
{
- mHost = S.Id(HostID).TieChoice(_("Host") + wxString(wxT(":")),
- wxT("/AudioIO/Host"),
- wxT(""),
- mHostNames,
- mHostLabels);
+ S.Id(HostID);
+ mHost = S.TieChoice(_("Host") + wxString(wxT(":")),
+ wxT("/AudioIO/Host"),
+ wxT(""),
+ mHostNames,
+ mHostLabels);
S.SetSizeHints(mHostNames);
S.AddPrompt(_("Using:"));
@@ -134,6 +133,7 @@
{
S.StartMultiColumn(2);
{
+ S.Id(PlayID);
mPlay = S.AddChoice(_("Device") + wxString(wxT(":")),
wxEmptyString,
&empty);
@@ -146,16 +146,15 @@
{
S.StartMultiColumn(2);
{
+ S.Id(RecordID);
mRecord = S.AddChoice(_("Device") + wxString(wxT(":")),
wxEmptyString,
&empty);
- S.TieChoice(_("Channels") + wxString(wxT(":")),
- wxT("/AudioIO/RecordChannels"),
- 2,
- mChannelNames,
- mChannelLabels);
- S.SetSizeHints(mChannelNames);
+ S.Id(ChannelsID);
+ mChannels = S.AddChoice(_("Channels") + wxString(wxT(":")),
+ wxEmptyString,
+ &empty);
}
S.EndMultiColumn();
}
@@ -211,6 +210,62 @@
S.SetSizeHints(mRecord, recordnames);
}
+void DevicePrefs::OnDevice(wxCommandEvent & e)
+{
+ const PaDeviceInfo *info =
+ (const PaDeviceInfo *) mRecord->GetClientData(mRecord->GetSelection());
+ int cnt = info->maxInputChannels;
+ int sel = mChannels->GetSelection();
+
+ if (sel != wxNOT_FOUND) {
+ mRecordChannels = sel + 1;
+ }
+
+ mChannels->Clear();
+
+ // Mimic old behavior
+ if (cnt <= 0) {
+ cnt = 16;
+ }
+
+ // Place and artifical limit on the number of channels to prevent an
+ // outrageous number. I don't know if this is really necessary, but
+ // it doesn't hurt.
+ if (cnt > 256) {
+ cnt = 256;
+ }
+
+ wxArrayString channelnames;
+
+ // Channel counts, mono, stereo etc...
+ for (int i = 0; i < cnt; i++) {
+ wxString name;
+
+ if (i == 0) {
+ name = _("1 (Mono)");
+ }
+ else if (i == 1) {
+ name = _("2 (Stereo)");
+ }
+ else {
+ name = wxString::Format(wxT("%d"), i + 1);
+ }
+
+ channelnames.Add(name);
+ int index = mChannels->Append(name);
+ if (i == mRecordChannels - 1) {
+ mChannels->SetSelection(index);
+ }
+ }
+
+ if (mChannels->GetCount() && mChannels->GetSelection() == wxNOT_FOUND) {
+ mChannels->SetSelection(0);
+ }
+
+ ShuttleGui S(this, eIsCreating);
+ S.SetSizeHints(mChannels, channelnames);
+}
+
bool DevicePrefs::Apply()
{
ShuttleGui S(this, eIsSavingToPrefs);
@@ -226,6 +281,9 @@
gPrefs->Write(wxT("/AudioIO/RecordingDevice"),
DeviceName(info));
+ gPrefs->Write(wxT("/AudioIO/RecordChannels"),
+ mChannels->GetSelection() + 1);
+
return true;
}
------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs