Artem Garmash Software developer, hardware enthusiast, mountain bike rider, musichead

Using UISlider or UIProgressView to Display and Control the Playback Progress of AVAudioPlayer

While implementing audio playback with AVAudioPlayer, you may need to display the playback progress with UIProgressView, or even to synchronize the state of the player with UISlider. AVAudioPlayer doesn’t have any functionality to get periodically notified about the current playback position. However, it has 2 aptly named properties that represent the time of the current playback position and the duration of the audio file: currentTime and duration respectively.

Read More

Building a Wireless Receiver for Xbox 360 Controllers From a Broken Xbox 360 Console

I’ve accomplished this little project back in 2016 when I had two Xbox 360 wireless controllers and a huge desire to use them with a PC. To do so, you have to have a wireless receiver, and there were 2 mainstream options on the market:

  • a genuine one - the best option, but costs around $60;
  • an unofficial replica - can be found for $10-15, but reliability and driver support were quite questionable.

At that moment, I was short of money to get the first one and didn’t want to try luck with the second. Fortunately, if you dive a bit deeper into the topic and doesn’t afraid to do some soldering, there’s a third option - using an RF module from a broken Xbox 360 (later in the text I’ll refer to it just as “RF module”).

Read More

A Journey of Putting an SSD Into an iPod Classic With Rockbox

When the whole world was switching to streaming services, I bought an iPod Classic 5.5th generation. An independent device with locally stored music in lossless quality and decent audio codec was, and still is quite appealing for me. And as for me, its design is everlasting, a 14 y/o device still feels great and gets a lot of attention.

The only drawback was storage capacity - mine one had a 30 GB HDD, and although it was possible to find a unit with 80 gigs, it also wouldn’t be sufficient. Another option was to get a 6/7 generation one with 160 GB HDD, but I wanted to stay with the 5.5th gen unit.

Read More

How to Integrate a C Library into an iOS App Written in Swift

Initially, I wrote this article for Distillery Tech Blog back in 2018. I decided to copy it here for the further preservation.

Nowadays, everyone values privacy and security. That’s why it wasn’t surprising when, recently, we needed to use an encryption library on one of the projects.

For the project in question, the decision was made to use libsignal. Originally developed for Signal Private Messenger, libsignal has a good reputation among security specialists.

Using libsignal

At the end of July 2018, there were implementations of libsignal in C, Java, and JavaScript. There was also an implementation in Objective-C called SignalProtocolKit, but at that time it had already been deprecated.

Our goal was to use the library in an iOS app written in Swift. To keep everything up to date, we had to use the one written in C, for which the source code is stored here. Lucky for us, Swift can interact with C code very smoothly, at minimum because some of Apple’s low-level libraries are written in C. The tricky part was to add the library to the project correctly.

Read More