| 3345 | } |
| 3346 | |
| 3347 | void configSound() |
| 3348 | { |
| 3349 | TFE_Settings_Sound* sound = TFE_Settings::getSoundSettings(); |
| 3350 | ImGui::LabelText("##ConfigLabel", "Audio Output"); |
| 3351 | |
| 3352 | const char* outputAudioNames[MAX_AUDIO_OUTPUTS]; |
| 3353 | char outputMidiNames[MAX_AUDIO_OUTPUTS * 256]; |
| 3354 | char outputMidiTypeNames[MIDI_TYPE_COUNT * 256]; |
| 3355 | { |
| 3356 | s32 outputCount = 0, curOutput = 0; |
| 3357 | const OutputDeviceInfo* outputInfo = TFE_Audio::getOutputDeviceList(outputCount, curOutput); |
| 3358 | outputCount = min(MAX_AUDIO_OUTPUTS, outputCount); |
| 3359 | for (s32 i = 0; i < outputCount; i++) |
| 3360 | { |
| 3361 | outputAudioNames[i] = outputInfo[i].name.c_str(); |
| 3362 | } |
| 3363 | |
| 3364 | ImGui::LabelText("##ConfigLabel", "Audio Device:"); ImGui::SameLine(150 * s_uiScale); |
| 3365 | ImGui::SetNextItemWidth(256 * s_uiScale); |
| 3366 | ImGui::Combo("##Audio Output", &curOutput, outputAudioNames, outputCount); |
| 3367 | |
| 3368 | if (ImGui::Button("Reset Audio Output")) |
| 3369 | { |
| 3370 | curOutput = -1; |
| 3371 | } |
| 3372 | TFE_Audio::selectDevice(curOutput); |
| 3373 | sound->audioDevice = curOutput; |
| 3374 | } |
| 3375 | ImGui::Separator(); |
| 3376 | { |
| 3377 | // Select between types. |
| 3378 | MidiDevice* device = TFE_MidiPlayer::getMidiDevice(); |
| 3379 | |
| 3380 | s32 typeCount = MIDI_TYPE_COUNT; |
| 3381 | s32 curType = (s32)device->getType(); |
| 3382 | char* typeList = outputMidiTypeNames; |
| 3383 | memset(outputMidiTypeNames, 0, 256 * MIDI_TYPE_COUNT); |
| 3384 | for (s32 i = 0; i < typeCount; i++) |
| 3385 | { |
| 3386 | strcpy(typeList, TFE_MidiPlayer::getMidiDeviceTypeName(MidiDeviceType(i))); |
| 3387 | typeList += strlen(typeList) + 1; // +1 as imgui entry divider |
| 3388 | } |
| 3389 | |
| 3390 | ImGui::LabelText("##ConfigLabel", "Midi Device:"); ImGui::SameLine(150 * s_uiScale); |
| 3391 | ImGui::SetNextItemWidth(256 * s_uiScale); |
| 3392 | if (ImGui::Combo("##Midi Type", &curType, (const char*)outputMidiTypeNames, typeCount)) |
| 3393 | { |
| 3394 | TFE_Audio::pause(); |
| 3395 | TFE_MidiPlayer::pauseThread(); |
| 3396 | |
| 3397 | TFE_MidiPlayer::setDeviceType(MidiDeviceType(curType)); |
| 3398 | device = TFE_MidiPlayer::getMidiDevice(); |
| 3399 | if (device) |
| 3400 | { |
| 3401 | sound->midiType = (s32)device->getType(); |
| 3402 | sound->midiOutput = device->getActiveOutput(); |
| 3403 | } |
| 3404 |
no test coverage detected