Mercurial > hg > svapp
comparison audioio/AudioPortAudioTarget.cpp @ 70:716e9d2f91c7
* Skip ID3 block when reading MP3 files (so long as ID3 support is included)
* Show progress when retrieving audio file from playlist
* Avoid -- but do not actually fix -- segmentation fault on exit. I am
totally stumped at the moment about why both the PA and JACK audio targets
should crash when properly shut down. For the moment, we just don't shut
them down...
* Fix incorrect behaviour (introduced on Friday as part of a different fix)
when replacing main model in situation where no current main model exists
author | Chris Cannam |
---|---|
date | Fri, 30 Nov 2007 17:31:09 +0000 |
parents | bf1a53489ccc |
children | 448ff6e34b99 22bf057ea151 |
comparison
equal
deleted
inserted
replaced
68:cedeab01d4c8 | 70:716e9d2f91c7 |
---|---|
27 AudioPortAudioTarget::AudioPortAudioTarget(AudioCallbackPlaySource *source) : | 27 AudioPortAudioTarget::AudioPortAudioTarget(AudioCallbackPlaySource *source) : |
28 AudioCallbackPlayTarget(source), | 28 AudioCallbackPlayTarget(source), |
29 m_stream(0), | 29 m_stream(0), |
30 m_bufferSize(0), | 30 m_bufferSize(0), |
31 m_sampleRate(0), | 31 m_sampleRate(0), |
32 m_latency(0) | 32 m_latency(0), |
33 m_done(false) | |
33 { | 34 { |
34 PaError err; | 35 PaError err; |
35 | 36 |
36 #ifdef DEBUG_AUDIO_PORT_AUDIO_TARGET | 37 #ifdef DEBUG_AUDIO_PORT_AUDIO_TARGET |
37 #ifdef HAVE_PORTAUDIO_V18 | 38 #ifdef HAVE_PORTAUDIO_V18 |
103 #endif | 104 #endif |
104 } | 105 } |
105 | 106 |
106 AudioPortAudioTarget::~AudioPortAudioTarget() | 107 AudioPortAudioTarget::~AudioPortAudioTarget() |
107 { | 108 { |
109 std::cerr << "AudioPortAudioTarget::~AudioPortAudioTarget()" << std::endl; | |
110 | |
111 shutdown(); | |
112 | |
108 if (m_stream) { | 113 if (m_stream) { |
114 | |
115 std::cerr << "closing stream" << std::endl; | |
116 | |
109 PaError err; | 117 PaError err; |
110 err = Pa_CloseStream(m_stream); | 118 err = Pa_CloseStream(m_stream); |
111 if (err != paNoError) { | 119 if (err != paNoError) { |
112 std::cerr << "ERROR: AudioPortAudioTarget: Failed to close PortAudio stream: " << Pa_GetErrorText(err) << std::endl; | 120 std::cerr << "ERROR: AudioPortAudioTarget: Failed to close PortAudio stream: " << Pa_GetErrorText(err) << std::endl; |
113 } | 121 } |
122 | |
123 std::cerr << "terminating" << std::endl; | |
124 | |
114 err = Pa_Terminate(); | 125 err = Pa_Terminate(); |
115 if (err != paNoError) { | 126 if (err != paNoError) { |
116 std::cerr << "ERROR: AudioPortAudioTarget: Failed to terminate PortAudio: " << Pa_GetErrorText(err) << std::endl; | 127 std::cerr << "ERROR: AudioPortAudioTarget: Failed to terminate PortAudio: " << Pa_GetErrorText(err) << std::endl; |
117 } | 128 } |
118 } | 129 } |
130 | |
131 m_stream = 0; | |
132 | |
133 std::cerr << "AudioPortAudioTarget::~AudioPortAudioTarget() done" << std::endl; | |
134 } | |
135 | |
136 void | |
137 AudioPortAudioTarget::shutdown() | |
138 { | |
139 m_done = true; | |
119 } | 140 } |
120 | 141 |
121 bool | 142 bool |
122 AudioPortAudioTarget::isOK() const | 143 AudioPortAudioTarget::isOK() const |
123 { | 144 { |
167 { | 188 { |
168 #ifdef DEBUG_AUDIO_PORT_AUDIO_TARGET | 189 #ifdef DEBUG_AUDIO_PORT_AUDIO_TARGET |
169 std::cout << "AudioPortAudioTarget::process(" << nframes << ")" << std::endl; | 190 std::cout << "AudioPortAudioTarget::process(" << nframes << ")" << std::endl; |
170 #endif | 191 #endif |
171 | 192 |
172 if (!m_source) return 0; | 193 if (!m_source || m_done) return 0; |
173 | 194 |
174 float *output = (float *)outputBuffer; | 195 float *output = (float *)outputBuffer; |
175 | 196 |
176 assert(nframes <= m_bufferSize); | 197 assert(nframes <= m_bufferSize); |
177 | 198 |