Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
FIX: sounddevice stereo auto detection
sound device backend was not running the code to determine whether audio was mono or stereo. This is because the `if/elif` block of code to do this was indented too far in and never able to run. Moving this block of code out one indentation level allows the stereo attribute to be detected and properly reassigned based on the sound array's features.
  • Loading branch information
CRiddler authored and peircej committed May 17, 2018
1 parent 6ffa413 commit b07f8fb
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions psychopy/sound/backend_sounddevice.py
Expand Up @@ -427,15 +427,15 @@ def _setSndFromArray(self, thisArray):
"into sound with channels={}"
.format(self.sndArr.shape, self.channels))

# is this stereo?
if self.stereo == -1: # auto stereo. Try to detect
if self.sndArr.shape[1] == 1:
self.stereo = 0
elif self.sndArr.shape[1] == 2:
self.stereo = 1
else:
raise IOError("Couldn't determine whether array is "
"stereo. Shape={}".format(self.sndArr.shape))
# is this stereo?
if self.stereo == -1: # auto stereo. Try to detect
if self.sndArr.shape[1] == 1:
self.stereo = 0
elif self.sndArr.shape[1] == 2:
self.stereo = 1
else:
raise IOError("Couldn't determine whether array is "
"stereo. Shape={}".format(self.sndArr.shape))
self._nSamples = thisArray.shape[0]
if self.stopTime == -1:
self.stopTime = self._nSamples/float(self.sampleRate)
Expand Down

0 comments on commit b07f8fb

Please sign in to comment.