Hi,
Is there a preferred way to cancel playback/decoding on the VS1063 whilst the decoder is paused ?
Looking in the datasheet it only specifies how to cancel if the end of file is reached, and how to cancel whilst playback/decoding is still in progress.
For my application, if the end user presses 'Pause' I'm setting the PLAYMODE_PAUSE_ON (Bit #1) of the parametric playMode register to immediately pause audio. But I need to handle the possibility of the user then pressing 'Stop' and so need to cancel the paused decoding and clear the SDI buffer etc.
After a bit of experimenting, I found that setting SM_CANCEL in the SCI_MODE register, and then clearing the PLAYMODE_PAUSE_ON bit works, reading SCI_MODE shows the SM_CANCEL it is now cleared, but I'm not keen on relying on observed/undocumented behaviour.
Another idea is to set SCI_VOL to mute the decoded output, clear the PLAYMODE_PAUSE_ON bit and cancel the playback as detailed in section 11.5.2 of the datasheet, then set SCI_VOL back to it's previous level.
Is either of these methods acceptable ?
VS1063 Cancelling playback whilst paused
Re: VS1063 Cancelling playback whilst paused
Like you found, pause and cancel are completely separate functions.
- The pause works on the system level at the audio output, between the decoder output and audio FIFO. When paused and the decoder generates audio output the next time, the control will not return to the decoder until pause is cleared, and thus cancel is also not checked until pause is cleared.
- Cancel works on the decoder level, and the decoder is free to implement it in any way it wants. Cancel might be checked only when audio output is generated (working close to the pause mode timing-wise), checked on the incoming audio block boundaries, or it can be checked at various additional points so that the decoder can return as soon as possible.
A decoder might be paused in the middle of an output block, so when you remove pause, there might still be some samples output before cancel gets checked by the decoder.
To work the best regardless of the audio format, I suggest you lower the volume (not powerdown, just the maximum attenuation), then set cancel, then remove pause. However, volume is also checked at the start of the audio output function, so you might still get some audio output before it gets updated, unless you write to the "software volume" variables directly (in vs1063a Y:6930dec and Y:6931dec for left and right channel, the default values are -32768 for 1.0 gain) and restore them afterwards.
- The pause works on the system level at the audio output, between the decoder output and audio FIFO. When paused and the decoder generates audio output the next time, the control will not return to the decoder until pause is cleared, and thus cancel is also not checked until pause is cleared.
- Cancel works on the decoder level, and the decoder is free to implement it in any way it wants. Cancel might be checked only when audio output is generated (working close to the pause mode timing-wise), checked on the incoming audio block boundaries, or it can be checked at various additional points so that the decoder can return as soon as possible.
A decoder might be paused in the middle of an output block, so when you remove pause, there might still be some samples output before cancel gets checked by the decoder.
To work the best regardless of the audio format, I suggest you lower the volume (not powerdown, just the maximum attenuation), then set cancel, then remove pause. However, volume is also checked at the start of the audio output function, so you might still get some audio output before it gets updated, unless you write to the "software volume" variables directly (in vs1063a Y:6930dec and Y:6931dec for left and right channel, the default values are -32768 for 1.0 gain) and restore them afterwards.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
-
- User
- Posts: 1
- Joined: Wed 2024-12-18 6:09
Re: VS1063 Cancelling playback whilst paused
Hi .
I have playing with a vs1053b (prototype device yet)
All works well.
But.... I have no find a solution to fix an issue when I going to play a new audio file.
When I play a new file a distortion of audio around 500ms is done. I have muted the vs1053b before to send a new audio file but the issue stills present.
I have implement the sequence of stopping . But with no lucky yet.
Any helps is welcome.
Att.
Vegano.
I have playing with a vs1053b (prototype device yet)
All works well.
But.... I have no find a solution to fix an issue when I going to play a new audio file.
When I play a new file a distortion of audio around 500ms is done. I have muted the vs1053b before to send a new audio file but the issue stills present.
I have implement the sequence of stopping . But with no lucky yet.
Any helps is welcome.
Att.
Vegano.
Re: VS1063 Cancelling playback whilst paused
Is SCI_HDAT1 0 before you start sending the new file?Vegano Drogon wrote: ↑Wed 2024-12-18 6:26When I play a new file a distortion of audio around 500ms is done. I have muted the vs1053b before to send a new audio file but the issue stills present.
What does the distortion sound like? Is the whole 500ms distorted?
What are the formats of the cancelled and the new file? What samplerate and bitrate?
Are you able to feed the data quickly enough so that DREQ is not high the whole time?
What is the value of SCI_CLOCKF (i.e. is the decoder able to decode faster than real-time)?
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook