Changeset b81a642 for python/ext
- Timestamp:
- Nov 28, 2016, 6:26:18 PM (8 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, sampler, yinfft+
- Children:
- 2f89ef4
- Parents:
- fa6373c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/ext/py-sink.c
rfa6373c rb81a642 87 87 88 88 self->samplerate = Py_aubio_default_samplerate; 89 if ( (sint_t)samplerate >0) {89 if (samplerate != 0) { 90 90 self->samplerate = samplerate; 91 } else if ((sint_t)samplerate < 0) {92 PyErr_SetString (PyExc_ValueError,93 "can not use negative value for samplerate");94 return NULL;95 91 } 96 92 97 93 self->channels = 1; 98 if ( (sint_t)channels >0) {94 if (channels != 0) { 99 95 self->channels = channels; 100 } else if ((sint_t)channels < 0) {101 PyErr_SetString (PyExc_ValueError,102 "can not use negative or null value for channels");103 return NULL;104 96 } 105 97 … … 110 102 Py_sink_init (Py_sink * self, PyObject * args, PyObject * kwds) 111 103 { 112 if (self->channels == 1) { 113 self->o = new_aubio_sink ( self->uri, self->samplerate ); 114 } else { 115 self->o = new_aubio_sink ( self->uri, 0 ); 116 aubio_sink_preset_channels ( self->o, self->channels ); 117 aubio_sink_preset_samplerate ( self->o, self->samplerate ); 118 } 104 self->o = new_aubio_sink ( self->uri, 0 ); 119 105 if (self->o == NULL) { 120 PyErr_SetString (PyExc_RuntimeError, "error creating sink with this uri");106 // error string was set in new_aubio_sink 121 107 return -1; 122 108 } 109 if (aubio_sink_preset_channels(self->o, self->channels) != 0) { 110 // error string was set in aubio_sink_preset_channels 111 return -1; 112 } 113 if (aubio_sink_preset_samplerate(self->o, self->samplerate) != 0) { 114 // error string was set in aubio_sink_preset_samplerate 115 return -1; 116 } 117 123 118 self->samplerate = aubio_sink_get_samplerate ( self->o ); 124 119 self->channels = aubio_sink_get_channels ( self->o );
Note: See TracChangeset
for help on using the changeset viewer.