{"action":"opened","issue":{"url":"https://api.github.com/repos/kyleneideck/BackgroundMusic/issues/94","repository_url":"https://api.github.com/repos/kyleneideck/BackgroundMusic","labels_url":"https://api.github.com/repos/kyleneideck/BackgroundMusic/issues/94/labels{/name}","comments_url":"https://api.github.com/repos/kyleneideck/BackgroundMusic/issues/94/comments","events_url":"https://api.github.com/repos/kyleneideck/BackgroundMusic/issues/94/events","html_url":"https://github.com/kyleneideck/BackgroundMusic/issues/94","id":198145597,"number":94,"title":"Change output device when the current device is removed","user":{"login":"kyleneideck","id":2290968,"avatar_url":"https://avatars.githubusercontent.com/u/2290968?v=3","gravatar_id":"","url":"https://api.github.com/users/kyleneideck","html_url":"https://github.com/kyleneideck","followers_url":"https://api.github.com/users/kyleneideck/followers","following_url":"https://api.github.com/users/kyleneideck/following{/other_user}","gists_url":"https://api.github.com/users/kyleneideck/gists{/gist_id}","starred_url":"https://api.github.com/users/kyleneideck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyleneideck/subscriptions","organizations_url":"https://api.github.com/users/kyleneideck/orgs","repos_url":"https://api.github.com/users/kyleneideck/repos","events_url":"https://api.github.com/users/kyleneideck/events{/privacy}","received_events_url":"https://api.github.com/users/kyleneideck/received_events","type":"User","site_admin":false},"labels":[{"id":331109830,"url":"https://api.github.com/repos/kyleneideck/BackgroundMusic/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-30T13:08:30Z","updated_at":"2016-12-30T13:08:30Z","closed_at":null,"body":"From #93:\r\n\r\n>At the moment, when you remove the output device Background Music just stops playing audio until you change the audio device in the Preferences menu, which it might then fail to do.\r\n\r\nTo reproduce:\r\n\r\n- Connect an output device that can be removed. (Or figure out how to disable one that can't, if that's easier.) I used some USB headphones.\r\n- Set it as Background Music's output device.\r\n- Remove the device. That is, physically disconnect the hardware.\r\n- In BGMApp, open the Preferences menu. The removed device won't appear in the list of output devices (which is good), but none of the output devices in the menu will be selected.\r\n- If you try to play some audio, nothing happens and these errors are logged:\r\n\r\n```\r\ndefault\t23:27:32.604708 +1100\tBackground Music\tAudioHardware.cpp:671:AudioObjectGetPropertyData:  AudioObjectGetPropertyData: no object with given ID\r\ndefault\t23:27:32.604878 +1100\tBackground Music\t/Users/kyle/Desktop/bgm/BGMApp/BGMApp/BGMPlayThrough.cpp:783:HandleBGMDeviceIsRunning: CAException, error code: 560947818.  If you think this might be a bug: https://github.com/kyleneideck/BackgroundMusic/issues\r\ndefault\t23:27:32.609071 +1100\tBackground Music\tAudioHardware.cpp:671:AudioObjectGetPropertyData:  AudioObjectGetPropertyData: no object with given ID\r\ndefault\t23:27:32.609320 +1100\tBackground Music\t/Users/kyle/Desktop/bgm/BGMApp/BGMApp/BGMPlayThrough.cpp:450:WaitForOutputDeviceToStart: CAException, error code: 560947818.\r\ndefault\t23:27:32.609865 +1100\tcoreaudiod\tHALS_IOEngine2.cpp:1604:_StartIO:  _TellHardwareToStart on Context 240  result: 2003329396\r\ndefault\t23:27:32.609991 +1100\tcoreaudiod\tHALS_IOContext.cpp:1578:IOWorkLoop:  HALS_IOContext::StartIO: failed to start the hardware\r\ndefault\t23:27:32.610118 +1100\tcoreaudiod\tHALS_IOContext.cpp:937:StartIOThread:  HALS_IOContext::StartIOThread: the IO thread failed to start, Error: 2003329396 (what)\r\n```\r\n\r\nIf you then change the output device in BGMApp, you get an error dialog with a message like \"Failed to set Internal Speakers (Built-in Output) as the output device\". I haven't checked whether the previous step (starting/stopping IO) is required to trigger this error. Error logs:\r\n\r\n```\r\ndefault\t23:31:26.364734 +1100\tBackground Music\tAudioHardware.cpp:411:AudioObjectHasProperty:  AudioObjectHasProperty: no object with given ID\r\ndefault\t23:31:26.386599 +1100\tBackground Music\tAudioHardware.cpp:2366:AudioDeviceDestroyIOProcID:  AudioDeviceDestroyIOProcID: no device with given ID\r\ndefault\t23:31:26.386693 +1100\tBackground Music\t/Users/kyle/Desktop/bgm/BGMApp/BGMApp/BGMPlayThrough.cpp:104:BGMPlayThrough::Swap: CAException, error code: 560227702.  If you think this might be a bug: https://github.com/kyleneideck/BackgroundMusic/issues\r\ndefault\t23:31:26.389843 +1100\tBackground Music\tHALC_ProxyIOContext.cpp:578:_StartIOProc:  HALC_ProxyIOContext::_StartIOProc: IOProc doesn't exist\r\ndefault\t23:31:26.389898 +1100\tBackground Music\tHALPlugIn.cpp:518:DeviceStartIOProc:  HALPlugIn::StartIOProc: got an error from the plug-in routine, Error: 1852797029 (nope)\r\ndefault\t23:31:26.389961 +1100\tBackground Music\tBGMPlayThrough::Start: Failed to start output device\r\ndefault\t23:31:26.391665 +1100\tBackground Music\tHALC_ProxyIOContext.cpp:738:_StopIOProc:  HALC_ProxyIOContext::_StopIOProc: IOProc doesn't exist\r\ndefault\t23:31:26.391825 +1100\tBackground Music\tBGMAudioDeviceManager::failedToSetOutputDevice: Couldn't set device with ID 42 as output device. Error: 1852797029. Will attempt to revert to the previous device. Previous device ID: 79.\r\ndefault\t23:31:26.392933 +1100\tBackground Music\tAudioHardware.cpp:411:AudioObjectHasProperty:  AudioObjectHasProperty: no object with given ID\r\ndefault\t23:31:26.392999 +1100\tBackground Music\tAudioHardware.cpp:580:AudioObjectGetPropertyDataSize:  AudioObjectGetPropertyDataSize: no object with given ID\r\ndefault\t23:31:26.393063 +1100\tBackground Music\tBGMAudioDeviceManager::failedToSetOutputDevice: Couldn't set device with ID 79 as output device. Error: 560947818.\r\ndefault\t23:31:26.393098 +1100\tBackground Music\tBGMAudioDeviceManager::failedToSetOutputDevice: Failed to revert to the previous device.\r\ndefault\t23:31:26.393169 +1100\tBackground Music\tFailed to set output device: Internal Speakers (Built-in Output)\r\n```\r\n\r\nThe device you changed to will be shown as selected in the Preferences menu, but audio still won't play. Error logs:\r\n\r\n```\r\ndefault\t23:42:25.224632 +1100\tBackground Music\tBGMPlayThrough::WaitForOutputDeviceToStart: Device not starting\r\ndefault\t23:42:25.225306 +1100\tcoreaudiod\tHALS_IOEngine2.cpp:1604:_StartIO:  _TellHardwareToStart on Context 757  result: 2003329396\r\ndefault\t23:42:25.225433 +1100\tcoreaudiod\tHALS_IOContext.cpp:1578:IOWorkLoop:  HALS_IOContext::StartIO: failed to start the hardware\r\ndefault\t23:42:25.225554 +1100\tcoreaudiod\tHALS_IOContext.cpp:937:StartIOThread:  HALS_IOContext::StartIOThread: the IO thread failed to start, Error: 2003329396 (what)\r\n```\r\n\r\nIf you change the output device again, audio will start playing through it and, as far as I can tell, Background Music will work normally from that point. Error logs (messages from `coreaudiod` omitted):\r\n\r\n```\r\ndefault\t23:43:49.526278 +1100\tBackground Music\tHALC_ProxyIOContext.cpp:738:_StopIOProc:  HALC_ProxyIOContext::_StopIOProc: IOProc doesn't exist\r\ndefault\t23:43:49.780564 +1100\tBackground Music\tHALB_IOThread.cpp:244:_Start:  HALB_IOThread::_Start: there already is a thread\r\n```\r\n\r\nI'd be interested to find out why you have to change the output device twice to get things working again, even if fixing the main bug stops it mattering from a user's perspective. It would probably point to some improvements we could make to our error handling code.\r\n\r\nWe should also test removing an output device that isn't selected. I don't think it would cause any problems, but I've never tested it."}}
{"actor":{"display_login":"kyleneideck"}}