int getAudioDeviceDescriptionByIndex(int index, AudioDeviceDescription* adDesc, int getNames) {
    int count = MAX_AUDIO_DEVICES;
    int ret = 0;

    getAudioDevices(globalADPaths, &count);
    if (index>=0 && index < count) {
        ret = getAudioDeviceDescription(globalADPaths[index].path, adDesc, getNames);
    }
    return ret;
}
bool DeviceManager::getDefaultAudioDevice(bool input, Device& device)
{
    bool ret = false;
    std::vector<Device> devices;
    ret = (getAudioDevices(input, devices) && !devices.empty());
    if (ret) {
        // Use the first device by default
        device = devices[0];

        // Loop through devices to check if any are explicitly
        // set as default
        for (std::size_t i = 0; i < devices.size(); ++i) {
            if (devices[i].isDefault) {
                device = devices[i];
            }
        }
    }
    return ret;
}
Beispiel #3
0
void Master::init() {
	moveToThread(QCoreApplication::instance()->thread());

	settings = new QSettings("muntemu.org", "Munt mt32emu-qt");
	synthProfileName = settings->value("Master/defaultSynthProfile", "default").toString();

	trayIcon = NULL;
	defaultAudioDriverId = settings->value("Master/DefaultAudioDriver").toString();
	defaultAudioDeviceName = settings->value("Master/DefaultAudioDevice").toString();

	initAudioDrivers();
	initMidiDrivers();
	lastAudioDeviceScan = -4 * MasterClock::NANOS_PER_SECOND;
	getAudioDevices();
	pinnedSynthRoute = NULL;

	qRegisterMetaType<MidiDriver *>("MidiDriver*");
	qRegisterMetaType<MidiSession *>("MidiSession*");
	qRegisterMetaType<MidiSession **>("MidiSession**");
	qRegisterMetaType<SynthState>("SynthState");
}
Beispiel #4
0
Master::Master() {
	if (instance != NULL) {
		qFatal("Master already instantiated!");
		// Do nothing if ignored
		return;
	}
	instance = this;
	maxSessions = 0;

	moveToThread(QCoreApplication::instance()->thread());

	MasterClock::init();

	settings = new QSettings("muntemu.org", "Munt mt32emu-qt");
	int settingsVersion = settings->value("Master/settingsVersion", 1).toInt();
	if (settingsVersion != ACTUAL_SETTINGS_VERSION) {
		migrateSettings(*settings, settingsVersion);
	}

	synthProfileName = settings->value("Master/defaultSynthProfile", "default").toString();

	trayIcon = NULL;
	defaultAudioDriverId = settings->value("Master/DefaultAudioDriver").toString();
	defaultAudioDeviceName = settings->value("Master/DefaultAudioDevice").toString();

	initAudioDrivers();
	initMidiDrivers();
	lastAudioDeviceScan = -4 * MasterClock::NANOS_PER_SECOND;
	getAudioDevices();
	pinnedSynthRoute = NULL;
	audioFileWriterSynth = NULL;

	qRegisterMetaType<MidiDriver *>("MidiDriver*");
	qRegisterMetaType<MidiSession *>("MidiSession*");
	qRegisterMetaType<MidiSession **>("MidiSession**");
	qRegisterMetaType<SynthState>("SynthState");
}
int getAudioDeviceCount() {
    int count = MAX_AUDIO_DEVICES;

    getAudioDevices(globalADPaths, &count);
    return count;
}
bool DeviceManager::getAudioOutputDevices(std::vector<Device>& devices)
{
    return getAudioDevices(false, devices);
}
bool DeviceManager::getAudioInputDevices(std::vector<Device>& devices)
{
    return getAudioDevices(true, devices);
}