Player example

HMG Samples and Enhancements

Moderator: Rathinagiri

User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Player example

Post by mustafa »

Hello Master Roberto
With Open File routine that sent me the other day
and the Post to publish on Mobile Signs
they both liked.

Mobile Letters
http://hmgforum.com/viewtopic.php?f=9&t=1166

I took the license to do an application of
research which combines the two concepts

Names I've found that moving can be
titles of the songs I've put two words
if you are not listening to any song just goes on
program name, but if we load a song
first one leaves the name of the Mp3 file you want
listen and then leaves the Advertising Program.
We must be careful if altered over advertising
Two of changing the number of posters that will follow

nCt: = Iif (nCt> 2, 1, nCt) replace a
the number you want if there are 4 posters for example
then would be:
nCt: = Iif (nCt> 4, 1, nCt)

To view the song title I've created tables
reaching up to 61 letter. "Mp3" = 65 Digits
Has to consider whether the music file is more
65 digits long, we should extend the table.

In this small investigation will only be charged
a song, listen and view the Pennant, not
as one might do that could carry
memory several songs and gradually go
listening.

Nor what is the code to make some
buttons to raise and lower the sound in the
songs.

Hoping to have contributed to research
PLAYER of friends share
Greetings

*---------------------------------------------*
Hola Maestro Roberto
Con la rutina de Open File que me mando el otro día
y el Post que publique sobre Letreros Móviles
que tanto le gusto.

Mobile Letters
http://hmgforum.com/viewtopic.php?f=9&t=1166

Me he tomado la licencia de hacer una aplicación de
investigación donde se combinan los dos conceptos

He descubierto que los Nombres en movimiento pueden ser
los títulos de las canciones yo he puesto dos es decir
si no se está escuchando ninguna canción solo sale el
nombre del programa , pero si cargamos una canción
primero sale el nombre del fichero Mp3 que queremos
escuchar y luego sale la Publicidad de Programa.
Hay que ir con cuidado si se altera la publicidad a más de
dos de cambiar el número de Carteles que irán siguiendo

nCt := Iif( nCt > 2 , 1 , nCt ) hay que cambiar a
el numero que queramos si hay 4 carteles por ejemplo
entonces sería :
nCt := Iif( nCt > 4 , 1 , nCt )

Para ver el titulo de la canción he creado unas tablas
que llegan hasta 61 Letra + ".Mp3" = 65 Dígitos
Ha tener en cuenta si el fichero de música es más
largo de 65 Dígitos , habría que ampliar la tabla.

En esta pequeña investigación solo se puede cargar
una canción , escucharla y ver la Banderola, no se
como se podría hacer que se pudieran cargar en
memoria varias canciones y paulatinamente ir
escuchándose.

Tampoco se cual es el código para hacer unos
botones para subir y bajar el sonido en las
canciones.

Esperando haber contribuido a la investigación
del PLAYER amigos compartan
Saludos

Mustafa :mrgreen:
Attachments
Player.zip
(1.02 MiB) Downloaded 474 times
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Player example

Post by mustafa »

Screenshot
Attachments
Screenshot.jpg
Screenshot.jpg (39.5 KiB) Viewed 6341 times
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Player example

Post by Roberto Lopez »

mustafa wrote:Hello Master Roberto
With Open File routine that sent me the other day
and the Post to publish on Mobile Signs
they both liked.
<...>
Excellent!

Thanks for sharing with us!
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Player example

Post by esgici »

mustafa wrote: Hoping to have contributed to research
PLAYER of friends share
Hola Mustafa

Thanks to sharing your code with us and congratulations, very nice contribution :)
To view the song title I've created tables
reaching up to 61 letter. "Mp3" = 65 Digits
Has to consider whether the music file is more
65 digits long, we should extend the table.
I'm not sure that I understood your intention correctly. If meaning of "view" is viewing the song title without ".mp3" extension in the mobile letters area, this "tables" has no effect; whatever length of the song title, .mp3 is visible.

Moreover, in the Procedure Busca_Music(), I think, instead of too many IF..ENDIF block ( 61 for up to 64 byte ), you may think using a single and simple formula such as:

Code: Select all

Nuevo =  LEFT (ficherAaX, LEN( ficherAaX ) - 4 ) 

In this small investigation will only be charged
a song, listen and view the Pennant, not
as one might do that could carry
memory several songs and gradually go
listening.
Regarding using of nCt in the Procedure Efeito_Abertura(), surely, you can add this functionality easily.
Nor what is the code to make some
buttons to raise and lower the sound in the
songs.
Again, you can add this functionality too, by using volume property of PLAYER control.

Saludos cordiales

--

Esgici
Viva INTERNATIONAL HMG :D
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Player example

Post by mustafa »

As Salamu Alaicum

Esgici friend
How nice it is for my re-read your tips together
to Master Robert.
It's a shame that I can not express in English for
I understand that you as the translator of English is not
reflecting the true meaning of my words, is the
only way for us to understand "the English".

I wanted to tell me what is the order in the Play function
to raise and lower the volume of songs?

Besides the orders for the Buttons
Play (), Pause (), Resume (), Position: = 1
I want to know that I order to raise and lower the sound
of a song on a button?

Friend my effusive greeting

*-----------------------------------------*

As Salamu Alaicum
amigo Esgici
Que bonito es para mi volver a leer tus consejos junto
a los del Maestro Roberto.
Es una lastima que no me pueda expresar en Ingles para
que Vd. me entienda pues el traductor de Ingles no está
reflejando el verdadero sentido de mis palabras, es el
único camino que tenemos para entenderlos "el Ingles".

Yo queria que me dijera cual es la orden en la funcion PLAYER
para subir y bajar el volumen de las canciones ?

Aparte de las ordenes para los Botones
Play() , Pause() , Resume() , Position := 1
yo quiero saber que orden doy para subir y bajar el sonido
de una canción en un Botón ?

Amigo mi más efusivo saludo

Mustafa
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Player example

Post by esgici »

mustafa wrote: I wanted to tell me what is the order in the Play function
to raise and lower the volume of songs?
Besides the orders for the Buttons
Play (), Pause (), Resume (), Position: = 1
I want to know that I order to raise and lower the sound
of a song on a button?
Hola Mustafa

Our PLAYER control has a property named "VOLUME". If we succeed SET and GET value of this property, we can also succeed changing volume of song playing by our program. Increasing and decreasing of volume by user may be achieve by using SLIDER, SPINNER, simply two buttons with "+" and "-" signs or anything else.

Unfortunately, I can't succeed making real this theory. Because I can't getting any value other than NIL, by using GetProperty() function. I don't know this sentence is sufficient or not:

Code: Select all

   nVolumValue := GetProperty( "Form_1", "Player_1", "VOLUME" )
Also

Code: Select all

   SetProperty( "Form_1", "Player_1", "VOLUME", <nVolumValue> )
don't produce expected result.

Sorry for this inconvenience. I'm sure that our gurus will help us.

Saludos cordiales.

--

Esgici
Viva INTERNATIONAL HMG :D
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Player example

Post by mustafa »

Hello Esgici
Thank you very much for your kind technical advice
as always a pleasure to greet
Greetings

*------------------------------------*
Hola Esgici
Muchas gracias por tus amables consejos técnicos,
como siempre es un places saludarte
Saludos

Selamlar
Mustafa
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Player example

Post by Roberto Lopez »

esgici wrote:

Code: Select all

   SetProperty( "Form_1", "Player_1", "VOLUME", <nVolumValue> )
don't produce expected result.

Sorry for this inconvenience. I'm sure that our gurus will help us.

Saludos cordiales.

--

Esgici
Volume property works perfect.

Please test this:

Code: Select all

/*

	Player control demo.

	Mustafá & Roberto Lopez

*/
 
#include "hmg.ch"

Function main()

	DEFINE WINDOW Form_1 AT 115,143 WIDTH 575 HEIGHT 425 MAIN TITLE "MP3 Player" 

		DEFINE PLAYER Player_1
			ROW    0
			COL    0
			WIDTH  0
			HEIGHT 0
			FILE ''
			HELPID Nil
			NOAUTOSIZEWINDOW .F.            
			NOAUTOSIZEMOVIE .F.              
			NOERRORDLG .F.
			NOMENU .F.
			NOOPEN .F.
			NOPLAYBAR .T.
			SHOWALL .F.
			SHOWMODE .F.
			SHOWNAME .F.                  
			SHOWPOSITION .F.
		END PLAYER
           
		@ 130,020 BUTTON Button_D1 ;
			CAPTION "Play MP3" ;
			ACTION Form_1.Player_1.Play() 

		@ 130,120 BUTTON Button_D2 ;
			CAPTION "Pause MP3" ;
			ACTION Form_1.Player_1.Pause()
                                 
		@ 130,220 BUTTON Button_D3 ;
			CAPTION "Resume MP3" ;
			ACTION Form_1.Player_1.Resume()

		@ 130,320 BUTTON Button_D4 ;
			CAPTION "End MP3" ;
			ACTION Form_1.Player_1.Position := 1

		@ 130,450 BUTTON Button_D5 ;
			CAPTION "Search" ;
			ACTION Busca_Music()

		@ 180,30 LABEL label_1 ;
			VALUE 'Volume:' 

		@ 180,100 SLIDER slider_1 ;
			RANGE 0,10 ;
			ON CHANGE Form_1.Player_1.Volume := Form_1.Slider_1.Value * 100 


	END WINDOW

	Form_1.Center
	Form_1.Activate

Return Nil


*-------------------------------------------*
Procedure Busca_Music()
*-------------------------------------------*

	Form_1.Player_1.Open ( GetFile( { { 'Mp3 Files' , '*.mp3'} } , '' , '' , .f. , .f. ) )

RETURN NIL
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Player example

Post by mustafa »

Hello Master Roberto :
Thanks for your input works perfect Control
I've only had to push away the
@ 180.100 SLIDER slider_1; a
@ 180.140 SLIDER slider_1;
because I think the Label prevented the full
development of it was as if rooted SLIDER
just moving this control works perfectly.
Very grateful for their dedication.
Greeting

*---------------------------------------------*
Hola Maestro Roberto
Gracias por su aportación funciona perfecto
el Control solo he tenido que alejar el
@ 180,100 SLIDER slider_1 ; a
@ 180,140 SLIDER slider_1 ;
pues el Label creo que impedia el total
desarrollo del SLIDER pues quedaba como clavado
solo desplazando dicho control funciona perfectamente.
Muy agradecido por su dedicación.
Saludo

Mustafa
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Player example

Post by esgici »

Roberto Lopez wrote:
Volume property works perfect.
Thanks a lot Maestro :)

As always, problem resolved by the hand of master; the question of Mustafa answered.

And unfortunately, my problem left unresolved:

Code: Select all

      @ 180,100 SLIDER slider_1 ;
         RANGE 0,10 ;
         ON CHANGE { || Form_1.Player_1.Volume := Form_1.Slider_1.Value * 100,;
                                  Form_1.Label_2.Value := "[ " + ;
                                  PADL( GetProperty( "Form_1", "Player_1", "VOLUME" ), 9) + " ]" }  

      @ 180,230 LABEL label_2 ;
         VALUE "[ " + PADL( GetProperty( "Form_1", "Player_1", "VOLUME" ), 9) + " ]"
Best regards

--

Esgici
Viva INTERNATIONAL HMG :D
Post Reply