VS1005 Hi-Res Player (March 2017 Demo) source code

Discussion about writing software for VS1005 and the VSOS Operating System. Also posts about VS1005-related hardware design and device drivers should be posted here.
User avatar
Panu
VLSI Staff
Posts: 2572
Joined: Tue 2010-06-22 13:43

Re: VS1005 Hi-Res Player (March 2017 Demo) source code

Post by Panu » Wed 2018-03-28 12:05

I see in config.txt that the SDSDR (read only) driver is being used.
I totally forgot that :oops:

But I think the reason to use SDSDR might not have been memory usage, I think it was power usage - I remember doing some modifications to the SDSDR driver for the Hi-Res player to push the power usage down... something like autocanceling multiple block read or something. But to be honest, I totally forgot that!

Could you check the memory usage difference between SDSD and SDSDR. You can get a comprehensive memory usage listing by running LIBLIST2 and a nice visualization (to UART console) by running FRAGS from your main menu.

I'd be very interested to see the results! :)

-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

technic
Senior User
Posts: 47
Joined: Mon 2017-11-20 10:23

Re: VS1005 Hi-Res Player (March 2017 Demo) source code

Post by technic » Wed 2018-03-28 15:27

Ok.
with SDSDR (liblist2, then frags output):

Code: Select all

10 libs loaded:

Lib 1f39 has entry points 3168 and 2 sections:
  I:3100..3191 (146 words)
  X:1f18..1f2f (24 words)
HRHW       146i +   24x +    0y

Lib 205e has entry points 31fc 31df and 3 sections:
  I:3192..324b (186 words)
  X:1f48..204b (260 words)
  X:204c..2051 (6 words)
SHELLENV   186i +  266x +    0y

Lib 2079 has entry points 324c and 1 sections:
  I:324c..3293 (72 words)
RUN         72i +    0x +    0y

Lib 213a has entry points 32de 3294 and 3 sections:
  I:3294..35eb (856 words)
  X:2088..212f (168 words)
  Y:0c00..0c21 (34 words)
SDSDR      856i +  168x +   34y

Lib 2186 has entry points 388e 38ba 38c6 38da 38ba 388e and 4 sections:
  I:35ec..38f7 (780 words)
  X:214c..2171 (38 words)
  X:2174..2175 (2 words)
  Y:0c24..0c27 (4 words)
AUODAC     780i +   40x +    4y

Lib 2375 has entry points 3bf7 and 3 sections:
  I:38f8..3d2d (1078 words)
  X:2198..2311 (378 words)
  X:2314..2369 (86 words)
LCD177HR  1078i +  464x +    0y

Lib 23a5 has entry points 3d5b 3dbd 3d51 3dd8 3d2e and 2 sections:
  I:3d2e..3df5 (200 words)
  X:2388..2395 (14 words)
UNIFONT2   200i +   14x +    0y

Lib 24ed has entry points 24c2 24c9 3f73 3f8f 3f54 and 6 sections:
  I:3df6..4067 (626 words)
  X:24b8..24d1 (26 words)
  X:24d4..24dd (10 words)
  Y:0c28..0c2b (4 words)
  Y:0d00..0dff (256 words)
  Y:0e00..0eff (256 words)
UARTIN     626i +   36x +  516y

Lib 2895 has entry points 413c and 3 sections:
  I:4068..4349 (738 words)
  X:2504..2871 (878 words)
  X:2874..2889 (22 words)
HRTITLE2   738i +  900x +    0y

Lib 29bd has entry points 43ca and 4 sections:
  I:434a..4609 (704 words)
  X:28a8..29af (264 words)
  X:29b0..29b1 (2 words)
  Y:0c2c..0c2d (2 words)
LIBLIST2   704i +  266x +    2y

Free memory:
 I:460a..7fbf
I: 14774 words (59096 bytes)
 X:1e14..1f17
 X:29d0..7fcf
X: 22276 words (44552 bytes)
 Y:0c30..0cff
 Y:0f00..1c0f
 Y:1d10..1fff
 Y:4000..6fdf
 Y:7000..7fff
Y: 20656 words (41312 bytes)
Libs: Hrhw Shellenv Run sDsdr Auodac Lcd177hr Unifont2 uartIn hrTitle2 Frags
I 0000: ################ ################ ################ ################
I 1000: ################ ################ ################ ################
I 2000: ################ ################ ################ ################
I 3000: ####HHHSSSRDDDDD DDDDDDDDAAAAAAAA AAAALLLLLLLLLLLL LLLLLUUUIIIIIIII
I 4000: IITTTTTTTTTTTTFF FFFFFFFFFFF..... ................ ................
I 5000: ................ ................ ................ ................
I 6000: ................ ................ ................ ................
I 7000: ................ ................ ................ ...............#

X 0000: ################ ################ ################ ################
X 1000: ################ ################ ################ ##############SS
X 2000: SS#DD##LLLLLLL## ###I#TTTTTTTTTTT TTTFFFFFF....... ................
X 3000: ................ ................ ................ ................
X 4000: ................ ................ ................ ................
X 5000: ................ ................ ................ ................
X 6000: ................ ................ ................ ................
X 7000: ................ ................ ................ ................

Y 0000: ################ ################ ################ D###IIIIIIII....
Y 1000: ................ ................ ................ .####...........
Y 2000: ################ ################ ################ ################
Y 3000: ################ ################ ################ ################
Y 4000: ................ ................ ................ ................
Y 5000: ................ ................ ................ ................
Y 6000: ................ ................ ................ ................
Y 7000: ................ ................ ................ ................

Free: I: 14596 words (44%), X: 21908 words (66%), Y: 20448 words (62%)

technic
Senior User
Posts: 47
Joined: Mon 2017-11-20 10:23

Re: VS1005 Hi-Res Player (March 2017 Demo) source code

Post by technic » Wed 2018-03-28 15:29

when SDSD loaded:

Code: Select all

10 libs loaded:

Lib 1f39 has entry points 3168 and 2 sections:
  I:3100..3191 (146 words)
  X:1f18..1f2f (24 words)
HRHW       146i +   24x +    0y

Lib 205e has entry points 31fc 31df and 3 sections:
  I:3192..324b (186 words)
  X:1f48..204b (260 words)
  X:204c..2051 (6 words)
SHELLENV   186i +  266x +    0y

Lib 2079 has entry points 324c and 1 sections:
  I:324c..3293 (72 words)
RUN         72i +    0x +    0y

Lib 213a has entry points 32de 3294 and 3 sections:
  I:3294..370b (1144 words)
  X:2088..212d (166 words)
  Y:0c00..0c21 (34 words)
SDSD      1144i +  166x +   34y

Lib 2186 has entry points 39ae 39da 39e6 39fa 39da 39ae and 4 sections:
  I:370c..3a17 (780 words)
  X:214c..2171 (38 words)
  X:2174..2175 (2 words)
  Y:0c24..0c27 (4 words)
AUODAC     780i +   40x +    4y

Lib 2375 has entry points 3d17 and 3 sections:
  I:3a18..3e4d (1078 words)
  X:2198..2311 (378 words)
  X:2314..2369 (86 words)
LCD177HR  1078i +  464x +    0y

Lib 23a5 has entry points 3e7b 3edd 3e71 3ef8 3e4e and 2 sections:
  I:3e4e..3f15 (200 words)
  X:2388..2395 (14 words)
UNIFONT2   200i +   14x +    0y

Lib 24ed has entry points 24c2 24c9 4093 40af 4074 and 6 sections:
  I:3f16..4187 (626 words)
  X:24b8..24d1 (26 words)
  X:24d4..24dd (10 words)
  Y:0c28..0c2b (4 words)
  Y:0d00..0dff (256 words)
  Y:0e00..0eff (256 words)
UARTIN     626i +   36x +  516y

Lib 2895 has entry points 425c and 3 sections:
  I:4188..4469 (738 words)
  X:2504..2871 (878 words)
  X:2874..2889 (22 words)
HRTITLE2   738i +  900x +    0y

Lib 29bd has entry points 44ea and 4 sections:
  I:446a..4729 (704 words)
  X:28a8..29af (264 words)
  X:29b0..29b1 (2 words)
  Y:0c2c..0c2d (2 words)
LIBLIST2   704i +  266x +    2y

Free memory:
 I:472a..7fbf
I: 14486 words (57944 bytes)
 X:1e14..1f17
 X:29d0..7fcf
X: 22276 words (44552 bytes)
 Y:0c30..0cff
 Y:0f00..1c0f
 Y:1d10..1fff
 Y:4000..6fdf
 Y:7000..7fff
Y: 20656 words (41312 bytes)
Libs: Hrhw Shellenv Run sDsd Auodac Lcd177hr Unifont2 uartIn hrTitle2 Frags
I 0000: ################ ################ ################ ################
I 1000: ################ ################ ################ ################
I 2000: ################ ################ ################ ################
I 3000: ####HHHSSSRDDDDD DDDDDDDDDDDDDAAA AAAAAAAAALLLLLLL LLLLLLLLLLUUUIII
I 4000: IIIIIIITTTTTTTTT TTFFFFFFFFFFFFFF ................ ................
I 5000: ................ ................ ................ ................
I 6000: ................ ................ ................ ................
I 7000: ................ ................ ................ ...............#

X 0000: ################ ################ ################ ################
X 1000: ################ ################ ################ ##############SS
X 2000: SS#DD##LLLLLLL## ###I#TTTTTTTTTTT TTTFFFFFF....... ................
X 3000: ................ ................ ................ ................
X 4000: ................ ................ ................ ................
X 5000: ................ ................ ................ ................
X 6000: ................ ................ ................ ................
X 7000: ................ ................ ................ ................

Y 0000: ################ ################ ################ D###IIIIIIII....
Y 1000: ................ ................ ................ .####...........
Y 2000: ################ ################ ################ ################
Y 3000: ################ ################ ################ ################
Y 4000: ................ ................ ................ ................
Y 5000: ................ ................ ................ ................
Y 6000: ................ ................ ................ ................
Y 7000: ................ ................ ................ ................

Free: I: 14308 words (43%), X: 21908 words (66%), Y: 20448 words (62%)

technic
Senior User
Posts: 47
Joined: Mon 2017-11-20 10:23

Re: VS1005 Hi-Res Player (March 2017 Demo) source code

Post by technic » Wed 2018-03-28 15:48

hm... UART console show warning when m4a file is played:

'D:MUSIC/*''D:MUSIC/*':b91. HRPLAY(28a8)
HRPlaying 04STEV~1.M4A
IMEM: only 2674w free!

User avatar
Panu
VLSI Staff
Posts: 2572
Joined: Tue 2010-06-22 13:43

Re: VS1005 Hi-Res Player (March 2017 Demo) source code

Post by Panu » Thu 2018-03-29 11:00

That warning just gives you an idea how near you are approaching an end of memory state in your product. 2.6kW is plenty, but it depends a lot on which codec is loaded. So it depends on the types of files played.

The warning is given by the loader when a new lowest amount of free instruction memory is reached since booting up.

-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

technic
Senior User
Posts: 47
Joined: Mon 2017-11-20 10:23

Re: VS1005 Hi-Res Player (March 2017 Demo) source code

Post by technic » Thu 2018-03-29 15:45

Okay, thank you.

PlayDir source file is my handbook now :)

Play/Pause button work now for me.

Code: Select all

case HRB_SE: {
			pause = !pause;
			audioDecoder->pause = pause && !audioDecoder->cs.cancel;
			break;
		}
I can't understood, how to stop HRPLAYER and return to HRTITLE.
PlayDir "quit" code:

Code: Select all

case 'q':
	  audioDecoder->cs.cancel = 1;
	  audioDecoder->pause = 0;
	  running = 0;
	  break;
what actions should I perform after "audioDecoder->cs.cancel = 1;?

User avatar
Panu
VLSI Staff
Posts: 2572
Joined: Tue 2010-06-22 13:43

Re: VS1005 Hi-Res Player (March 2017 Demo) source code

Post by Panu » Tue 2018-04-03 8:09

HRPLAY plays the file basically like this: (code simlified, error handling removed)

Code: Select all

DLLENTRY(HrPlay) ioresult HrPlay(HrCoreInfo *hrCoreP) {
	// Load decoder library and start UI buttons handling
	decoderLibrary = LoadLibrary("audiodec");
	audioDecoder = CreateAudioDecoder(decoderLibrary, fp, stdaudioout, NULL, auDecFGuess);
	AddCyclic(&uiCyclic, TICKS_PER_SEC/10, 0);

	DecodeAudio(decoderLibrary, audioDecoder, &errorString); 	// Play the file

	// Stop UI buttons handling, drop loaded decoder library and close.
	DropCyclic(&uiCyclic);
	DeleteAudioDecoder(decoderLibrary, audioDecoder);
	DropLibrary(decoderLibrary);
	return S_OK;
}
what actions should I perform after "audioDecoder->cs.cancel = 1;?
Just allow the file to continue playing. Codec will finish decoding the current block, after which DecodeAudio will return and HRPLAY closes. There's no asynchronic method to kill it.

-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

technic
Senior User
Posts: 47
Joined: Mon 2017-11-20 10:23

Re: VS1005 Hi-Res Player (March 2017 Demo) source code

Post by technic » Wed 2018-04-04 9:08

Thank you, Panu!
Panu wrote:
Tue 2018-04-03 8:09
Codec will finish decoding the current block, after which DecodeAudio will return and HRPLAY closes. There's no asynchronic method to kill it.
Do I understand correctly that after HRPlayer is closed HROpen starts the next file?

User avatar
Panu
VLSI Staff
Posts: 2572
Joined: Tue 2010-06-22 13:43

Re: VS1005 Hi-Res Player (March 2017 Demo) source code

Post by Panu » Thu 2018-04-05 9:02

technic wrote:
Wed 2018-04-04 9:08
Do I understand correctly that after HRPlayer is closed HROpen starts the next file?
Yes. HRCORE runs HROPEN and HRPLAY repeatedly in a while loop.

HROPEN does everything that is related to finding and opening a file, including redraw the LCD screen. Then, to save memory, it is dropped and HRPLAY is loaded instead to handle the decoding.

-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

ledochen
User
Posts: 5
Joined: Fri 2014-03-14 11:15

Re: VS1005 Hi-Res Player (March 2017 Demo) source code

Post by ledochen » Wed 2018-04-25 12:11

Hi Panu,

I'm very interested in this demo,I tried to install several versions of the software(vside_win32_v236/vside_win32_v243).
But I can't open your project(HiresPlayerMaster_source_and_root_Demo2017March).show this error,
error.jpg
error
error.jpg (16.51 KiB) Viewed 457 times
This is my This is my development board.
demo top.jpg
demo picture
demo top.jpg (205.28 KiB) Viewed 457 times
demo.jpg
demo picture
demo.jpg (243.59 KiB) Viewed 457 times
What do I need to do to test the functionality of HiFi Res player on my development board?
I'm really looking forward to this new design.
After test successful, I will design a HIFI player.

Many thks!

Ledo

Post Reply