rhysmorgan134 / node-CarPlay

MIT License
131 stars 23 forks source link

capturing volume messages #72

Closed rhysmorgan134 closed 8 months ago

rhysmorgan134 commented 8 months ago

The volume messages were being ignore as they were coming with no command type and there was no default case in the switch statement. I''m proposing to create our own command type where when the extra bytes are 4 it attaches the command type of AudioVolumeAdjust, useCarplayAudio then adjusts the volume using the new functionality it pcm-ringbuf-player

https://github.com/gozmanyoni/pcm-ringbuf-player/pull/5

gozmanyoni commented 8 months ago

@rhysmorgan134 what if instead a new command we do something like:

if (audio.data) { const { decodeType, data } = audio const format = decodeTypeMap[decodeType] const player = getAudioPlayer(format) player.feed(data) } else if (audio.volumeDuration) { const { decodeType, volume, } = audio const format = decodeTypeMap[decodeType] const player = getAudioPlayer(format) player.volume(volume, volumeDuration) } else if (audio.command) {