Page 1 sur 1

Jouer son depuis la mémoire

Publié : ven. 27/mai/2016 13:57
par jmg49
Bonjour,

j'arrive à lire un .s3m avec initsound(); loadmusic() et playmusic() , en includebinary ou non

maintenant j'ai mis le fichier en ressource, ajouté le fichier .rc dans les options du compilo, (avec reshack je vois bien mon .s3m)

pas moyen de le faire jouer ....j'ai adapté le code du MSDN

mon .rc :

Code : Tout sélectionner

;*************************************************
// LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US

SOUND_1 S3M "satell.s3m"

;*************************************************
partie du code PB qui est censé l'appeler :

Code : Tout sélectionner

InitSound()

hInst = GetModuleHandle_(#Null)
hResInfo = FindResource_(hInst, "SOUND_1", "S3M")
hRes = LoadResource_(hInst, hResInfo)
lpRes = LockResource_(hRes)

 
sndPlaySound_(lpRes,#SND_MEMORY | #SND_SYNC | #SND_NODEFAULT)


si vous avez une idée je suis preneur,

merci bien

Re: Jouer son depuis la mémoire

Publié : ven. 27/mai/2016 16:13
par jmg49
j'ai obtenu de bons resultats avec un code de Droopy pour transformer le fichier en data.b

je poste pour info , le data.b n'est pas complet , ligne trop longue .....mais ça play !! j'ai comparé avec un includeBinary l'.exe fait la même taille...

Code : Tout sélectionner

InitSound()

CatchMusic(1,?zic,?zicend-?zic)
PlayMusic(1)

MP_Graphics3D (640,480,0,3)


Repeat 
  
  event=WindowEvent()
  
Until MP_KeyDown(#PB_Key_Escape)


DataSection
zic:
Data.b 83,97,116,101,108,108,105,116,101,32,111,110,101,46,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,16,0,0,16,0,8,0,99,0,8,0
zicend:
EndDataSection