Re: [Audacity-devel] [PATCH] Show default audio I/O device in Preferences
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
From: Martyn S. <mar...@go...> - 2009-08-26 22:10:16
|
Hi Richard Richard Ash wrote: > On Sat, 2009-08-22 at 22:16 +0100, Richard Ash wrote: >> It is real, the problem is that different bits of the audacity code are >> dealing with needing to find the default audio devices differently. This >> causes the symptoms Michael describes, however I think the problem was >> that I didn't agree with his solution to the problem, and failed to get >> anyone to actually implement anything better. >> >> As I said at the time the correct approach is a single method that gets >> the device and handles the defaults are required, and then is used >> everywhere when the device is required. This should ensure that the >> behaviour is consistent and correct. >> >> The question is where to put that code, because it could legitimately be >> considered more relevant in AudioIO than in the preferences, but that >> poses a problem of not having access to the right objects and >> references. Should we instantiate AudioIO within the preferences to >> handle the Audio device layer? Would that cause all sorts of other >> issues? Casting another way, could we provide (static?) methods in the >> preferences code that can be used by AudioIO to get the correct default >> devices? >> >> Any suggestions please, for the moment I will work on trying to get the >> correct code written in the prefs > This is now done, I have committed the relevant code to select the > default device from the currently selected API if there is no device > specified in the preferences. This means if the API is set in the > preferences, then a device from that API is chosen, even if the global > default device is from a different API (which has never worked before). > > At the moment these are private methods of the DevPrefs class, because > that was the easiest place to put them. > >> After that AudioIO is buggy, because it picks the default device >> regardless of API when there isn't a set device, which could cause >> further complications ... > This is now true - if you set the API in the preferences but not the > devices, then the preferences will honour your choice of API and put in > default devices from that API (I used OSS for this, default is ALSA). > However when AudioIO is independently deciding what devices to use for > sample rate probing etc, it just calls Pa_GetDefaultOutputDevice(), > which for me returns ALSA. This gives the odd effect where one set of > devices is shown in the preferences, but another is being used by the > sample rate probing code, and indeed by playback / recording. > > So the options are: > * Duplicate the default device choosing logic from DevPrefs in AudioIO, > so they do the same things > * Enable AudioIO to call the methods from DevPrefs, except that DevPrefs > won't be instantiated at the right moments > * Move the code from DevPrefs to AudioIO and enable DevPrefs to access > the relevant information from AudioIO when it needs it. I think AudioIO > is always instantiated when DevPrefs is working, but am not sure how to > get the reference from one object to the other. > > Anyone like to make some suggestions? I haven't looked at the code, so this is just a quick comment, but why not (in AudioIO) just mPlayDevice = gPrefs->Read(wxT("/AudioIO/PlaybackDevice"), wxT("")); and only use Pa_GetDefaultOutputDevice() if that is ""? Maybe I misunderstood the question. TTFN Martyn > Richard > > |