SndPlaySound Virtual Guitar

SndPlaySound Virtual Guitar

Postby Lisa Giordano » Fri Aug 29, 2008 1:42 pm

Ciao a tutti
Mi sto divertendo a sviluppare una utility per chitarra che consente di suonare gli accordi memorizzando le progressioni, i vari accordi sono registrati in wav per cui uso SndPlaySound per suonarli.
Ora, vorrei aggiungere una base di Drum ma non so come eseguire contemporaneamente due SndPlaySound.
Help me
User avatar
Lisa Giordano
 
Posts: 25
Joined: Wed Jul 09, 2008 5:56 pm

Postby Antonio Linares » Sat Aug 30, 2008 9:25 am

Lisa,

You may use a Timer to play the drums sound every time period.

Please review fwh\samples\TestTime.prg to review how to manage timers.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

VGuitar

Postby Lisa Giordano » Sat Aug 30, 2008 12:33 pm

Questo esempio funziona perfettamente, l'inconveniente è che nella function giro(), SndPlaySound( "Accordi\Beat68.wav", 1 ) viene interrotta da SndPlaySound( "Accordi\"+aFile[t]+".wav", 1 ).
Io vorrei invece che rimanesse in esecuzione SndPlaySound( "Accordi\Beat68.wav", 1 ) in un loop, e che che nello tempo girasse
For t=1 to Len(aFile)
SndPlaySound( "Accordi\"+aFile[t]+".wav", 1 )
inkey(1)
Next t




#include "Fivewin.ch"


************************************************************************
Function Test()
Local oWnd, oMenu, oImg
Local oWC,oBar,oCursor
Local aFile:={}

DEFINE WINDOW oWnd FROM 0,0 TO 30,100 MENU oMenu TITLE "Virtual Guitar" MDI

DEFINE BUTTONBAR oBar SIZE 50,30 3DLOOK CURSOR oCursor OF oWnd

DEFINE BUTTON OF oBar PROMPT "Do+" ACTION(SndPlaySound( "Accordi\C+.wav", 1 ),aadd(aFile,"C+")) GROUP
DEFINE BUTTON OF oBar PROMPT "Re-" ACTION(SndPlaySound( "Accordi\D-.wav", 1 ),aadd(aFile,"D-")) GROUP
DEFINE BUTTON OF oBar PROMPT "Mi-" ACTION(SndPlaySound( "Accordi\E-.wav", 1 ),aadd(aFile,"E-")) GROUP
DEFINE BUTTON OF oBar PROMPT "Mi+" ACTION(SndPlaySound( "Accordi\E+.wav", 1 ),aadd(aFile,"E+")) GROUP
DEFINE BUTTON OF oBar PROMPT "Fa+" ACTION(SndPlaySound( "Accordi\F+.wav", 1 ),aadd(aFile,"F+")) GROUP
DEFINE BUTTON OF oBar PROMPT "Sol+" ACTION(SndPlaySound( "Accordi\G+.wav", 1 ),aadd(aFile,"G+")) GROUP
DEFINE BUTTON OF oBar PROMPT "La-" ACTION(SndPlaySound( "Accordi\A-.wav", ),aadd(aFile,"A-")) GROUP
DEFINE BUTTON OF oBar PROMPT " " GROUP
DEFINE BUTTON OF oBar PROMPT "Nuovo" ACTION (aFile:={}) GROUP
DEFINE BUTTON OF oBar PROMPT "Giro" ACTION (Giro(aFile)) GROUP
DEFINE BUTTON OF oBar PROMPT "Esci" ACTION (oWnd:End()) GROUP
ACTIVATE WINDOW oWnd

return nil

**********************************************************

Function Giro(aFile)
Local t,i
SndPlaySound( "Accordi\Beat68.wav", 1 )
For t=1 to Len(aFile)
SndPlaySound( "Accordi\"+aFile[t]+".wav", 1 )
inkey(1)
Next t
return nil

Ciao grazie
User avatar
Lisa Giordano
 
Posts: 25
Joined: Wed Jul 09, 2008 5:56 pm

Postby Antonio Linares » Sat Aug 30, 2008 12:50 pm

Lisa,

Prueba a no usar 1 al llamar a SndPlaySound( ... ) // , 1 ) no
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Lisa Giordano » Sat Aug 30, 2008 12:57 pm

Antonio,

Ho provato ad usare tutti i parametri 0,1,2,4,8,16 e le varie combinazioni,
ma ma più sndplay non vengono eseguite contemporaneamente.
Il suono drum più chitarra non vengono eseguite insieme.
Ciao
User avatar
Lisa Giordano
 
Posts: 25
Joined: Wed Jul 09, 2008 5:56 pm

Postby Antonio Linares » Sat Aug 30, 2008 2:55 pm

Lisa,

/*
* flag values for fuSound and fdwSound arguments on [snd]PlaySound
*/
#define SND_SYNC 0x0000 /* play synchronously (default) */
#define SND_ASYNC 0x0001 /* play asynchronously */
#define SND_NODEFAULT 0x0002 /* silence (!default) if sound not found */
#define SND_MEMORY 0x0004 /* pszSound points to a memory file */
#define SND_LOOP 0x0008 /* loop the sound until next sndPlaySound */
#define SND_NOSTOP 0x0010 /* don't stop any currently playing sound */

#define SND_NOWAIT 0x00002000L /* don't wait if the driver is busy */
#define SND_ALIAS 0x00010000L /* name is a registry alias */
#define SND_ALIAS_ID 0x00110000L /* alias is a predefined ID */
#define SND_FILENAME 0x00020000L /* name is file name */
#define SND_RESOURCE 0x00040004L /* name is resource name or atom */
#if(WINVER >= 0x0400)
#define SND_PURGE 0x0040 /* purge non-static events for task */
#define SND_APPLICATION 0x0080 /* look for application specific association

Maybe nOr( SND_ASYNC, SND_NOSTOP ) ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 108 guests