If you are using more than one input device and at least one of the devices is not selected as the default recording device in Windows Vista and the input device is listed in the third position or below in the Audition 3.0 Audio Hardware Setup panel, then Audition might not recognize that device as valid and you cannot record audio from the device.
Using the native ASIO driver for the device allows Audition 3.0 to effectively use and interact with the device. When a native ASIO device driver is not available, the devcie conflict can be avioded by moving the input device up into the primary or secondary positions in the Audition 3.0 Audio Hardware Setup panel or by setting the device as the default recording device in the Windows Vista Sound control panel.
If I create an InputDevice section for a pointer, input hotplugging gets completely disabled for pointers. So If the USB mouse is not plugged in, when X is starting up, it will not be recognized if I plug it in later.
What's the correct method for getting the system's audio device? I have a small application that is using the MidiKeyboardComponent. Right now, if i run the app alongside my DAW (Logic X), i get clicks and pops because audioDeviceManager.initialiseWithDefaultDevices(1,1); is not sure what device or sample rate to use.
It should correctly pick defaults and work.. I don't understand why you're blaming clicks and pops on the fact that a DAW is also running - audio drivers should be able to play cleanly regardless of what other apps are doing (?)
The thing is, if there are pops and crackles because your audio driver can't handle two apps running at different rates, then that's a bug or problem in the driver. It's not the responsibility of an app to somehow change its sample rate to keep the driver happy - if the driver says it can do 44.1 and then fails to work when the app chooses 44.1, that's not the app's fault!
No audio hardware can support running at multiple sample rates, so this is not a problem specific to my hardware. The problem is that your AudioDeviceManager is trying to change the device settings and another application is already controlling the settings.
Perhaps not, but the app should default to reading what the driver's sample rate is currently set to, and set it up that way. your AudioDeviceManager class doesn't do that, as far as I can tell. It just grabs the driver, and tells it to use ___ sample rate and ___ buffer size instead of checking the current driver settings and useing those.
If you have an external audio interface like an Apogee Duet or MOTU box, turn it on, turn on your DAW (garageband, logic, protools etc), then run your demo app. you'll see it try to take over your interface and set whatever sample rate your AudioDeviceManager class is programmed to default to. and then you'll hear the clicks and pops because each program is trying to set the sample rate of the driver when they are the application in focus
As far as I can tell, what I need to do is use the AudioToolbox framework to get the current system device's settings, store them into a juce::AudioDeviceManager::AudioDeviceSetup object and then use that object in AudioDeviceManager.initialise(); Correct?
If a driver doesn't support multiple rates, then it's a mistake for it to tell the app that it can do so. If the first audio app chooses e.g. 48000 and the hardware is set to that rate, then the driver should tell subsequent apps that 48000 is the only rate it can use.
My code already checks the device's list of possible rates before deciding what to use as a default - perhaps it could be tweaked to prefer the value of kAudioDevicePropertyNominalSampleRate if there's a choice - if you want to experiment with that kind of thing and let me know if it helps with your particular setup, it's something I'd be open to looking at.
I'm not writing a Driver. I'm just writing a little piano roll viewer app that I can use alongside Logic for some video tutorials, and your audioDeviceManager class was trying to set the sample rate for my audio interface while logic was currently controlling it. My viewer app wasn't even using audio, it's strictly MIDI. but you haven't written a midi-only device manager class. you rolled it into an Audio+MIDI class.
Applications like Quicktime or iTunes automatically convert whatever files they're playing to match the sample rate of the device being used to play thru. They don't tell the device to switch sample rates to match the file they're playing. I think that's where the confusion comes in.
What I was trying to convey was that when you open a device with your AudioDeviceManager class, it should open it at whatever sample rate it is currently set to. It shouldn't try to change the sample rate, unless the user or programmer specifies it. THAT should be the default behavior. Right now, your class' default behavior is to open the device, and set the sample rate to the first(usually the lowest) sample rate returned from the device's driver. Understand?
and sure there are ways to have core audio instantiate rate converters in the app itself (not in drivers ), some apps (like Logic) on purpose do not do this to maintain bit perfect non-sample rate converter quality (for those using coreaudio's sample rate conversion I suggest you dig into settings giving you various degrees of quality vs CPU load by the way )
Jules, it would be great if you updated the AudioDeviceManager class to reflect the stuff discussed in this thread so your class doesn't try to hijack the audio devices the way it currently does. When you instantiate the AudioDeviceManager, it should grab the settings currently set by the driver, and configure itself to those settings as opposed to what it does now, which is force the device to use the first available setting in the list of settings provided by the driver.
There should be an easy means of getting the system device, in the situations where your application doesn't need to its own AudioDeviceManager object, but just needs to talk to the MIDI system. Currently there isn't, and the initialiseWithDefaultSetup() method forces the default system device to change its settings to the lowest values.
It'll stop in that function, and if you step forward, you'll see that it asks the device for its current sample rate, and uses that rate as its default. It does NOT force it to the first value in the list of sample rates unless you use the combo box to explicitly do so.
It seems that your code steals the sample rate from the INPUT device, and forces all devices (input and output) to use this sample rate, even if they're set to something else. In this video (you'll see at the very end), my input device was the Built-in Input on my iMac, and the sample rate for that was set to 96khz.
recall that AudioIODevice* createDevice() determined that the outputDeviceID and inputDeviceID are identical on line 1881 and 1882l, so this is why it pulls the sample rate from the inputDevice (iMac Built-in Input).
I then continued to execute the code and went into the dropbox to change Devices so that both the input and output were set to the Symphony I/O, and it resulted in the same inputDeviceID and outputDeviceID as when the Built-in Input was set as the Input:
These programs may be compact, but they provide the all-important means for a computer to interact with hardware, for everything from mouse, keyboard and display -- user input/output -- to working with networks, storage and graphics.
Device drivers generally run at a high level of privilege within the operating system (OS) runtime environment. Some device drivers, in fact, may be linked directly to the operating system kernel, a portion of an OS such as Windows, Linux or macOS, that remains memory resident and handles execution for all other code, including device drivers. Device drivers relay requests for device access and actions from the operating system and its active applications to their respective hardware devices. They also deliver outputs or status/messages from the hardware devices to the operating system and thus to applications.
Device drivers are necessary to permit a computer to interface and interact with specific devices. They define the messages and mechanisms whereby the computer -- the OS and applications -- can access the device or make requests for the device to fulfill. They also handle device responses and messages for delivery to the computer.
Invariably, hardware devices belong to a specific class, such as Bluetooth or 802.11xx wireless networking. Creating any specific device driver starts by working within its class framework. Within that class, a particular type of device, such as Bluetooth audio, keyboards or mice, also falls within a related driver framework.
Finally, for a specific individual device, within its class and type frameworks, its actual driver software interacts with that device using its native command set and data handling capabilities, as defined and published by its maker or manufacturer. In addition, device drivers can access physical devices -- actual hardware -- or virtual devices that are emulations of hardware in a software program. The former are called physical drivers and the latter are called virtual drivers.
If an administrator runs the driverquery command in Windows inside PowerShell or at the command line, it will produce a list of all device drivers installed on the host computer. For Linux and macOS, running the lsmod command at a command prompt also lists device driver modules. It is not unusual for a typical laptop or desktop PC to list hundreds of device drivers in response. Examining this output provides useful drive information, including module name, driver type and display name used to identify a driver. Here's a brief sample from Windows 10: