Page 1 sur 1

ACMDriverEnum

Publié : sam. 10/avr./2004 3:02
par ZapMan
Pour ceux qui veulent bricoler avec le "Audio Compression Manager", un début de code permettant de lister les drivers disponibles :

Code : Tout sélectionner


; ACMDRIVERENUM

#WAVE_FORMAT_ADPCM = 2
#WAVE_FORMAT_ALAW = 6
#WAVE_FORMAT_MULAW = 7
#WAVE_FORMAT_DVI_ADPCM = 17
#WAVE_FORMAT_G723_ADPCM         = $0014
#WAVE_FORMAT_DIALOGIC_OKI_ADPCM = $0017
#WAVE_FORMAT_TRUESPEECH         = $0022
#WAVE_FORMAT_GSM610             = $0031
#WAVE_FORMAT_G721_ADPCM         = $0040 ;* Antex Electronics G.721 */
#WAVE_FORMAT_G728_CELP          = $0041
#WAVE_FORMAT_MSG723             = $0042
#WAVE_FORMAT_MPEG               = $0050 ;/* MPEG Layer 1,2 */
#WAVE_FORMAT_MPEGLAYER3         = $0055 ;/* MPEG Layer 3 (MP3)*/
#WAVE_FORMAT_VOXWARE            = $0062
#WAVE_FORMAT_VOXWARE_BYTE_ALIGNED = $0069
#WAVE_FORMAT_VOXWARE_RT24       = $0074
#WAVE_FORMAT_VOXWARE_RT29       = $0075
#ACM_DRIVERENUMF_NOLOCAL  = $40000000
#ACM_DRIVERENUMF_DISABLED = $80000000

;

#ACMDRIVERDETAILS_SHORTNAME_CHARS    =32
#ACMDRIVERDETAILS_LONGNAME_CHARS     =128
#ACMDRIVERDETAILS_COPYRIGHT_CHARS    =80
#ACMDRIVERDETAILS_LICENSING_CHARS    =128
#ACMDRIVERDETAILS_FEATURES_CHARS     =512

;

#ACMFILTERDETAILS_FILTER_CHARS       =128
#ACM_FILTERENUMF_DWFILTERTAG         =$00010000

;

#ACMFORMATDETAILS_FORMAT_CHARS       =128
#ACMFILTERTAGDETAILS_FILTERTAG_CHARS =48

;

#WAVE_FILTER_UNKNOWN = 0
#WAVE_FORMAT_UNKNOWN = 0

;

#ACMDRIVERDETAILS_SUPPORTF_CODEC     =$00000001
#ACMDRIVERDETAILS_SUPPORTF_CONVERTER =$00000002
#ACMDRIVERDETAILS_SUPPORTF_FILTER    =$00000004
#ACMDRIVERDETAILS_SUPPORTF_HARDWARE  =$00000008
#ACMDRIVERDETAILS_SUPPORTF_ASYNC     =$00000010
#ACMDRIVERDETAILS_SUPPORTF_LOCAL     =$40000000
#ACMDRIVERDETAILS_SUPPORTF_DISABLED  =$80000000

;

#ACM_FORMATENUMF_WFORMATTAG       =$00010000
#ACM_FORMATENUMF_NCHANNELS        =$00020000
#ACM_FORMATENUMF_NSAMPLESPERSEC   =$00040000
#ACM_FORMATENUMF_WBITSPERSAMPLE   =$00080000
#ACM_FORMATENUMF_CONVERT          =$00100000
#ACM_FORMATENUMF_SUGGEST          =$00200000
#ACM_FORMATENUMF_HARDWARE         =$00400000
#ACM_FORMATENUMF_INPUT            =$00800000
#ACM_FORMATENUMF_OUTPUT           =$01000000
Structure ACMDRIVERDETAILS
  cbStruct.l
  fccType.l
  fccComp.l
  wMid.w
  wPid.w
  vdwACM.l
  vdwDriver.l
  fdwSupport.l
  cFormatTags.l
  cFilterTags.l
  hicon.l
  szShortName.b[#ACMDRIVERDETAILS_SHORTNAME_CHARS];
  szLongName.b[#ACMDRIVERDETAILS_LONGNAME_CHARS];
  szCopyright.b[#ACMDRIVERDETAILS_COPYRIGHT_CHARS];
  szLicensing.b[#ACMDRIVERDETAILS_LICENSING_CHARS];
  szFeatures.b[#ACMDRIVERDETAILS_FEATURES_CHARS];
EndStructure
Structure ACMFILTERDETAILS
  cbStruct.l
  dwFilterIndex.l
  dwFilterTag.l
  fdwSupport.l
  pwfltr.l
  cbwfltr.l
  szFilter.b[#ACMFILTERDETAILS_FILTER_CHARS];
EndStructure
Structure ACMFILTERTAGDETAILS
  cbStruct.l
  dwFilterTagIndex.l
  dwFilterTag.l
  cbFilterSize.l
  fdwSupport.l
  cStandardFilters.l
  szFilterTag.b[#ACMFILTERTAGDETAILS_FILTERTAG_CHARS];
EndStructure
Structure ACMFORMATDETAILS
  cbStruct.l
  dwFormatIndex.l
  dwFormatTag.l
  fdwSupport.l
  pwfx.l
  cbwfx.l
  szFormat.b[#ACMFORMATDETAILS_FORMAT_CHARS];
EndStructure
Structure WAVEFILTER
  cbStruct.l
  dwFilterTag.l
  fdwFilter.l
  dwReserved.l[5];
EndStructure
Structure WAVEFORMATEX
  wFormatTag.w        ; Waveform-audio format type. A complete list of format tags can be found in the Mmreg.h header file. For one- Or two-channel PCM data, this value should be WAVE_FORMAT_PCM.
  nChannels.w         ; Number of channels in the waveform-audio data. Monaural data uses one channel and stereo data uses two channels.
  nSamplesPerSec.l    ; Sample rate, in samples per second (hertz). If wFormatTag is WAVE_FORMAT_PCM, then common values for nSamplesPerSec are 8.0 kHz, 11.025 kHz, 22.05 kHz, and 44.1 kHz. For non-PCM formats, this member must be computed according to the manufacturer's specification of the format tag.
  nAvgBytesPerSec.l   ; Required average data-transfer rate, in bytes per second, for the format tag. If wFormatTag is WAVE_FORMAT_PCM, nAvgBytesPerSec should be equal to the product of nSamplesPerSec and nBlockAlign. For non-PCM formats, this member must be computed according to the manufacturer's specification of the format tag.
  nBlockAlign.w       ; Block alignment, in bytes. The block alignment is the minimum atomic unit of data for the wFormatTag format type. If wFormatTag is WAVE_FORMAT_PCM or WAVE_FORMAT_EXTENSIBLE, nBlockAlign must be equal to the product of nChannels and wBitsPerSample divided by 8 (bits per byte). For non-PCM formats, this member must be computed according to the manufacturer's specification of the format tag.  :Software must process a multiple of nBlockAlign bytes of Data at a time. Data written To And Read from a device must always start at the beginning of a block. For example, it is illegal To start playback of PCM Data in the middle of a sample (that is, on a non-block-aligned boundary).
  wBitsPerSample.w    ; Bits per sample for the wFormatTag format type. If wFormatTag is WAVE_FORMAT_PCM, then wBitsPerSample should be equal to 8 or 16. For non-PCM formats, this member must be set according to the manufacturer's specification of the format tag. If wFormatTag is WAVE_FORMAT_EXTENSIBLE, this value can be any integer multiple of 8. Some compression schemes cannot define a value for wBitsPerSample, so this member can be zero.
  cbSize.w            ; Size, in bytes, of extra format information appended to the end of the WAVEFORMATEX structure. This information can be used by non-PCM formats to store extra attributes for the wFormatTag. If no extra information is required by the wFormatTag, this member must be set to zero. For WAVE_FORMAT_PCM formats (and only WAVE_FORMAT_PCM formats), this member is ignored.
EndStructure
Structure ACMFILTERCHOOSE
  cbStruct.l;
  fdwStyle.l;
  hwndOwner.l;
  pwfltr.l;
  cbwfltr.l;
  pszTitle.l;
  szFilterTag.b[#ACMFILTERTAGDETAILS_FILTERTAG_CHARS];
  szFilter.b[#ACMFILTERDETAILS_FILTER_CHARS];
  pszName.l;
  cchName.l;
  fdwEnum.l;
  pwfltrEnum.l;
  hInstance.l;
  pszTemplateName.l;
  lCustData.l;
  pfnHook.l;
EndStructure
Procedure DebugError(e.l)
  tx.s = ""
  Select e
  Case #MMSYSERR_INVALFLAG
    tx = "INVALIDE FLAG"
  Case #MMSYSERR_INVALHANDLE
    tx = "INVALIDE HANDLE"
  Case #MMSYSERR_INVALPARAM
    tx = "INVALIDE PARAM"
  Case #MMSYSERR_NODRIVER
    tx = "NO DRIVER"
  EndSelect
  If tx
    Debug tx
  EndIf
EndProcedure


Procedure acmFiltTagCallBack (*hadid.l,*paftd.ACMFILTERTAGDETAILS  ,dwInstance.l,fdwSupport.l)
  Debug "******** "+PeekS(@*paftd\szFilterTag[0])
  ProcedureReturn #true
EndProcedure
Procedure acmFiltCallBack (*hadid.l,*pafd.ACMFILTERDETAILS  ,dwInstance.l,fdwSupport.l)
  Debug "********   "+PeekS(@*pafd\szFilter[0])
  ProcedureReturn #true
EndProcedure
Procedure acmFmtCallBack (*hadid.l,*pafd2.ACMFORMATDETAILS,dwInstance.l,fdwSupport.l)
  Select *pafd2\dwFormatTag
  Case #WAVE_FORMAT_PCM
    tx.s = "PCM"
  Case #WAVE_FORMAT_ALAW
    tx =  "ALAW"
  Case #WAVE_FORMAT_MULAW
    tx = "MULAW"
  Case #WAVE_FORMAT_ADPCM
    tx = "ADPCM"
  Case #WAVE_FORMAT_DVI_ADPCM
    tx = "DVI ADPCM"
  Case #WAVE_FORMAT_DVI_ADPCM
    tx = "Dialogic OKI ADPCM"
  Case #WAVE_FORMAT_GSM610
    tx = "GSM610"
  Case #WAVE_FORMAT_TRUESPEECH
    tx = "TRUESPEECH"
  Case #WAVE_FORMAT_G723_ADPCM
    tx = "G723 ADPCM"
  Case #WAVE_FORMAT_MPEG
    tx = "MPEG"
  Case #WAVE_FORMAT_MSG723
    tx = "MSG723"
  Case #WAVE_FORMAT_MPEGLAYER3
    tx = "MP3"
  Case #WAVE_FORMAT_VOXWARE
    tx = "VOXWARE"
  Case #WAVE_FORMAT_VOXWARE_BYTE_ALIGNED
    tx = "VOXWARE BYTEALIGNED"
  Case #WAVE_FORMAT_VOXWARE_RT24
    tx = "VOXWARE RT24"
  Case #WAVE_FORMAT_VOXWARE_RT29
    tx = "VOXWARE RT29"
  Case 304
    tx = "ACELP.net"
  Default
    tx = "FormatTag #"+Str(*pafd2\dwFormatTag)
  EndSelect
  Debug "   "+Str(*pafd2\dwFormatIndex)+"- "+tx +" : "+PeekS(@*pafd2\szFormat[0])
  ProcedureReturn #true
EndProcedure
Procedure acmCallback(*hadid.l,dwInstance.l,fdwSupport.l)
  fdwDetails.l = 0 ; reserved - must be 0
  padd.ACMDRIVERDETAILS\cbStruct = SizeOf(ACMDRIVERDETAILS)
  If acmDriverDetails_(*hadid,@padd,fdwDetails) = 0
    svar.s = PeekS(@padd\szLongName[0])+" : "+ PeekS(@padd\szFeatures[0])
    Debug svar
    svar = "   "+PeekS(@padd\szCopyright[0])+" - License : "+ PeekS(@padd\szLicensing[0])
    If PeekS(@padd\szLicensing[0]) = ""
      svar = svar + "ND"
    EndIf
    Debug svar
    fdwSupport = @padd\fdwSupport
    svar = ""
    If (fdwSupport & #ACMDRIVERDETAILS_SUPPORTF_ASYNC): SVar = "Async conversions " : EndIf
    If (fdwSupport & #ACMDRIVERDETAILS_SUPPORTF_CODEC)
      If Svar: Svar = Svar + " + " : EndIf
      Svar = Svar+"Different format conversions"
    EndIf
    If (fdwSupport & #ACMDRIVERDETAILS_SUPPORTF_CONVERTER)
      If Svar: Svar = Svar + " + " : EndIf
      Svar = Svar+"Same format conversions"
    EndIf
    If (fdwSupport & #ACMDRIVERDETAILS_SUPPORTF_FILTER)
      If Svar: Svar = Svar + " + " : EndIf
      Svar = Svar+"Filtering"
    EndIf
    If Svar: Debug "   Can do : " +Svar: EndIf
    acmDriverOpen_(@*phad,*hadid, 0)
    dwInstance.l = 0
    paftd.ACMFILTERTAGDETAILS
    RtlZeroMemory_(@paftd,SizeOf(ACMFILTERTAGDETAILS));
    paftd\cbStruct = SizeOf(ACMFILTERTAGDETAILS)+200
    paftd\dwFilterTag = #WAVE_FORMAT_PCM
    paftd\cbFilterSize = 2000
    paftd\fdwSupport =0
    e = acmFilterTagEnum_(*phad,@paftd,@acmFiltTagCallBack(),@dwInstance,0)
    Wf.WAVEFILTER\cbStruct = SizeOf(WAVEFILTER)+200
    Wf\dwFilterTag =#WAVE_FORMAT_PCM; #WAVE_FILTER_UNKNOWN;
    pafd.ACMFILTERDETAILS\cbStruct = SizeOf(ACMFILTERDETAILS)
    pafd\pwfltr   = @wf
    pafd\cbwfltr  = SizeOf(WAVEFILTER)+200
    pafd\dwFilterTag = #WAVE_FORMAT_PCM; #WAVE_FILTER_UNKNOWN;
    fdwEnum = #ACM_FILTERENUMF_DWFILTERTAG
    e = acmFilterEnum_(*phad, @pafd,@acmFiltCallBack(),@dwInstance,fdwEnum)
    wfx.WAVEFORMATEX                ; Wave Format Structure
    RtlZeroMemory_(@wfx,SizeOf(WAVEFORMATEX));
    wfx\wFormatTag      = #WAVE_FORMAT_UNKNOWN; #WAVE_FORMAT_PCM;
    wfx\nChannels       = 2 ;dwPrimaryChannels;
    wfx\nSamplesPerSec  = 44100     ;dwPrimaryFreq;
    wfx\wBitsPerSample  = 16        ;dwPrimaryBitRate;
    wfx\nBlockAlign     = (wfx\wBitsPerSample / 8 * wfx\nChannels)
    wfx\nAvgBytesPerSec = (wfx\nSamplesPerSec * wfx\nBlockAlign)
    pafd2.ACMFORMATDETAILS\cbStruct = SizeOf(ACMFORMATDETAILS )
    pafd2\pwfx   = @wfx
    pafd2\cbwfx  = SizeOf(WAVEFORMATEX )+200
    pafd2\dwFormatTag = #WAVE_FORMAT_UNKNOWN;#WAVE_FORMAT_PCM;

    ;pafd2\fdwSupport = fdwSupport

    fdwEnum.l = #ACM_FORMATENUMF_INPUT|#ACM_FORMATENUMF_OUTPUT
    acmFormatEnum_(*phad, @pafd2,@acmFmtCallBack(),dwInstance,fdwEnum)
    Wf.WAVEFILTER\cbStruct = SizeOf(WAVEFILTER)
    Wf\dwFilterTag = #WAVE_FORMAT_PCM;
    pszName.s = ""
    fc.ACMFILTERCHOOSE\cbStruct = SizeOf(ACMFILTERCHOOSE)
    fc\fdwStyle =0
    fc\hwndOwner=0
    fc\pwfltr   =@Wf
    fc\cbwfltr  = SizeOf(WAVEFILTER)
    fc\pszTitle =0

    ;fc\szFilterTag.b[#ACMFILTERTAGDETAILS_FILTERTAG_CHARS];
    ;fc\szFilter.b[#ACMFILTERDETAILS_FILTER_CHARS];

    fc\pszName = @pszName
    fc\cchName =0
    fc\fdwEnum =0;
    fc\pwfltrEnum=0
    fc\hInstance=0
    fc\pszTemplateName=0
    fc\lCustData=0
    fc\pfnHook=0
    acmDriverClose_(*phad, 0)
  EndIf
  ProcedureReturn #true
EndProcedure


Procedure DSCallback(lpGuid,lpcstrDescription,lpcstrModule,lpContext)
  svar.s = PeekS(lpcstrDescription)
  Debug svar
  ProcedureReturn #true
EndProcedure



  Debug "****  PERIPHERIQUES  ****"
  If OpenLibrary(0,"dsound.DLL")
    If IsFunction(0, "DirectSoundEnumerateA")
      lp = 1
      CallFunction(0,"DirectSoundEnumerateA",@DSCallback(),@lp)
    Else
      Debug "not a fonction"
    EndIf
  Else
    Debug "not a library"
  EndIf
  Debug ""
  Debug "****  DRIVERS  ****"
  v.l = 0
  fdwEnum.l = 0;#ACM_DRIVERENUMF_DISABLED|#ACM_DRIVERENUMF_NOLOCAL
  acmDriverEnum_(@acmCallback(),@v,fdwEnum )
Pour servir et valoir ce que de droit.

Publié : sam. 10/avr./2004 8:52
par KarLKoX
Alors la, chapo : un code tout bo, tres bien codé et facile à comprendre !
On sent que tu es loin de ton premier coup d'essaye ;)

Sinon, tant que tu es la, j'ai modifié complètement mon fichier source DirectSound pour enfin avoir trouvé ce qui bloquait le compilateur PureBasic (le linker de LCC en fait) ! J'en ai profité pour faire un peu le ménage et le code s'en trouve nettement réduit.
Pour résumer, ca venait du fait qu'on ne peut pas appeler les pointeurs sur fonctions de DirectSound de tous objet récupéré (DirectSoundCreate, CreateSoundBuffer ...).
En fait, il faut obligatoirement passer par la table des pointeurs :

- au lieu d'avoir MonBufferDirectSound->Play(0, 0, DSBPLAY_LOOPING); il faut faire MonBufferDirectSound->lpVtbl->Play(MonBufferDirectSound, 0, 0, DSBPLAY_LOOPING); (on remet en 1er param le pointeur "*this")
et ce, pour toutes les fonctions de DirectSound appelant une fonction membre :)

Apres deux nuits blanches, je te raconte pas dans quel état j'étais :P
Je mettrais l'archive à jour mais j'attend de faire plus de test car le nouveau code me semble un peu moins robuste.
Et j'ai viré ces saloperie de notifications qui en fait, ne servent à rien :]

PS : merci à John Carmack d'avoir livré les sources de Quake 1 car sans lui, je pouvais chercher encore longtemps :roll:

Publié : sam. 10/avr./2004 15:59
par ZapMan
J'ai peur de ne pas te suivre tout à fait :oops:

Pense-tu que ça ait un rapport avec le fait que le code suivant ne marche pas ??

Code : Tout sélectionner

#CLSCTX_INPROC_SERVER = 1 
#CLSCTX_INPROC_HANDLER = 2 
#CLSCTX_LOCAL_SERVER = 4 
#CLSCTX_REMOTE_SERVER = 16
#CLSCTX_NO_CODE_DOWNLOAD = 400
#CLSCTX_NO_FAILURE_LOG = 4000
#DMUS_APATH_SHARED_STEREOPLUSREVERB   =1       ; A standard music set up with stereo outs And reverb. */
#DMUS_APATH_DYNAMIC_3D                =6       ; An audio path with one dynamic bus from the synth feeding To a dynamic 3d buffer. Does not send To env reverb. */
#DMUS_APATH_DYNAMIC_MONO              =7       ; An audio path with one dynamic bus from the synth feeding To a dynamic mono buffer. */
#DMUS_APATH_DYNAMIC_STEREO            =8       ; An audio path with two dynamic buses from the synth feeding To a dynamic stereo buffer. */
#DMUS_AUDIOF_3D = $1
#DMUS_AUDIOF_ENVIRON = $2
#DMUS_AUDIOF_EAX = $4
#DMUS_AUDIOF_DMOS = $8
#DMUS_AUDIOF_STREAMING = $10
#DMUS_AUDIOF_BUFFERS = $20
#DMUS_AUDIOF_ALL = $3F
#DMUS_AUDIOPARAMS_FEATURES = $00000001
#DMUS_AUDIOPARAMS_VOICES = $00000002
#DMUS_AUDIOPARAMS_SAMPLERATE = $00000004
#DMUS_AUDIOPARAMS_DEFAULTSYNTH = $00000008

CoInitialize_(0)

;IDirectMusicSegment8*     g_pSegment      = NULL;
CoCreateInstance_(?CLSID_DirectMusicLoader, 0,#CLSCTX_INPROC_SERVER, ?IID_IDirectMusicLoader8,@*g_pLoader.IDirectMusicLoader8)
CoCreateInstance_(?CLSID_DirectMusicPerformance, 0,#CLSCTX_INPROC_SERVER,?IID_IDirectMusicPerformance8,@*g_pPerformance.IDirectMusicPerformance8)
;*g_pPerformance\InitAudio(0,0,0,#DMUS_APATH_SHARED_STEREOPLUSREVERB,64,#DMUS_AUDIOF_ALL,0)
      ;  0, ;IDirectMusic Interface not needed.
      ;  0, ;IDirectSound Interface not needed.
      ;  0, ;Window handle.
      ;  #DMUS_APATH_SHARED_STEREOPLUSREVERB,  // Default audiopath type.
      ;  64,;Number of performance channels.
      ;  DMUS_AUDIOF_ALL,       // Features on synthesizer.
      ;  0  ;Audio parameters; use defaults.
*g_pPerformance\Init(0,0,0)
                     
DataSection   ; GUID from DSOUND.h and dmusici.h
  IID_DirectSoundBuffer8:
    Data.l $6825A449 
    Data.w $7524,$4D82 
    Data.b $92,$0F,$50,$E3,$6A,$B3,$AB,$1E 
    
  GUID_DSFX_STANDARD_ECHO:
    Data.l $ef3e932c
    Data.w $d40b , $4f51
    Data.b $8c,$cf,$3f,$98,$f1,$b2,$9d,$5d
    
  IID_IDirectSoundFXEcho:
    Data.l $8bd28edf
    Data.w $50db, $4e92
    Data.b $a2,$bd,$44,$54,$88,$d1,$ed,$42
    
  CLSID_DirectMusicLoader:
    Data.l $d2ac2892
    Data.w  $b39b,$11d1
    Data.b $87,$4,$0,$60,$8,$93,$b1,$bd
  
  CLSID_DirectMusicPerformance:
    Data.l $d2ac2881
    Data.w $b39b,$11d1
    Data.b $87,$4,$0,$60,$8,$93,$b1,$bd
  
  IID_IDirectMusicLoader8:
    Data.l $19e7c08c
    Data.w $a44,$4e6a
    Data.b $a1,$16,$59,$5a,$7c,$d5,$de,$8c

  IID_IDirectMusicPerformance8:
    Data.l $679c4137
    Data.w $c62e,$4147
    Data.b $b2,$b4,$9d,$56,$9a,$cb,$25,$4c
EndDataSection 
J'obtiens un "End to to garbage of the line" concernant mon *g_pPerformance\Init(0,0,0)
et pareil pour *g_pPerformance\InitAudio(0,0,0,#DMUS_APATH_SHARED_STEREOPLUSREVERB,64,#DMUS_AUDIOF_ALL,0) :evil:

Publié : sam. 10/avr./2004 23:35
par KarLKoX
J'ai vite fait regardé le SDK de DirectMusic et je pense avoir trouvé ce qui cloche : Init() n'existe plus dans IDirectMusicPerformance8 mais dans l'ancien IDirectMusicPerformance et prend deux paramettres (au lieu de trois, supprime le troisieme param, ca va compiler).
De plus, pour utiliser les nouvelles méthodes de IDirectMusicPerformance8 tu dois changer le fichier "dsound.lib" du répertoire "PureLibraries\Windows\Libraries" par celui de Directx 9, c'est ce que j'ai du faire pour ma librairie :)

Publié : dim. 11/avr./2004 5:53
par ZapMan
Je vais essayer ça.

Merci

Publié : dim. 11/avr./2004 23:58
par ZapMan
Pour
*g_pPerformance\Init(0,0,0)
tu as mis le doigt dessus, ça marche impec avec 2 paramètres (et je ne comprends vraiment pas pourquoi !)
Pour *g_pPerformance\InitAudio(0,0,0,#DMUS_APATH_SHARED_STEREOPLUSREVERB,64,#DMUS_AUDIOF_ALL,0)
j'ai essayé toutes les versions de DSound.lib que j'ai et ça fait pareil. Comment tu as fait pour avoir ta version ? Le seul moyen que j'ai trouvé c'est se télécharger DirectX 9.0 SDK Update - (Summer 2003) de Microsfoutu, mais ça fait 189 megas et c'est tellement long que j'ai toujours une erreur pendant que ça se passe : pas moyen !

Publié : mer. 14/avr./2004 13:12
par KarLKoX
Bon, cette fois ci, j'ai trouvé d'ou venait l'erreur : de la définition de l'interface par défaut de purebasic.
Je l'ai refaite pour directx 9 :

Code : Tout sélectionner

; IDirectMusicBand interface definition
;
Interface IDirectMusicBand_DX9
  QueryInterface(a.l, b.l)
  AddRef()
  Release()
  CreateSegment(a.l)
  Download(a.l)
  Unload(a.l)
EndInterface

; IDirectMusicObject interface definition
;
Interface IDirectMusicObject_DX9
  QueryInterface(a.l, b.l)
  AddRef()
  Release()
  GetDescriptor(a.l)
  SetDescriptor(a.l)
  ParseDescriptor(a.l, b.l)
EndInterface

; IDirectMusicLoader interface definition
;
Interface IDirectMusicLoader_DX9
  QueryInterface(a.l, b.l)
  AddRef()
  Release()
  GetObject(a.l, b.l, c.l)
  SetObject(a.l)
  SetSearchDirectory(a.l, b.l, c.l)
  ScanDirectory(a.l, b.l, c.l)
  CacheObject(a.l)
  ReleaseObject(a.l)
  ClearCache(a.l)
  EnableCache(a.l, b.l)
  EnumObject(a.l, b.l, c.l)
EndInterface

; IDirectMusicLoader8 interface definition
;
Interface IDirectMusicLoader8_DX9
  QueryInterface(a.l, b.l)
  AddRef()
  Release()
  GetObject(a.l, b.l, c.l)
  SetObject(a.l)
  SetSearchDirectory(a.l, b.l, c.l)
  ScanDirectory(a.l, b.l, c.l)
  CacheObject(a.l)
  ReleaseObject(a.l)
  ClearCache(a.l)
  EnableCache(a.l, b.l)
  EnumObject(a.l, b.l, c.l)
  CollectGarbage()
  ReleaseObjectByUnknown(a.l)
  LoadObjectFromFile(a.l, b.l, c.l, d.l)
EndInterface

; IDirectMusicGetLoader interface definition
;
Interface IDirectMusicGetLoader_DX9
  QueryInterface(a.l, b.l)
  AddRef()
  Release()
  GetLoader(a.l)
EndInterface

; IDirectMusicSegment interface definition
;
Interface IDirectMusicSegment_DX9
  QueryInterface(a.l, b.l)
  AddRef()
  Release()
  GetLength(a.l)
  SetLength(a.l)
  GetRepeats(a.l)
  SetRepeats(a.l)
  GetDefaultResolution(a.l)
  SetDefaultResolution(a.l)
  GetTrack(a.l, b.l, c.l, d.l)
  GetTrackGroup(a.l, b.l)
  InsertTrack(a.l, b.l)
  RemoveTrack(a.l)
  InitPlay(a.l, b.l, c.l)
  GetGraph(a.l)
  SetGraph(a.l)
  AddNotificationType(a.l)
  RemoveNotificationType(a.l)
  GetParam(a.l, b.l, c.l, d.l, e.l, f.l)
  SetParam(a.l, b.l, c.l, d.l, e.l)
  Clone(a.l, b.l, c.l)
  SetStartPoint(a.l)
  GetStartPoint(a.l)
  SetLoopPoints(a.l, b.l)
  GetLoopPoints(a.l, b.l)
  SetPChannelsUsed(a.l, b.l)
EndInterface

; IDirectMusicSegment8 interface definition
;
Interface IDirectMusicSegment8_DX9
  QueryInterface(a.l, b.l)
  AddRef()
  Release()
  GetLength(a.l)
  SetLength(a.l)
  GetRepeats(a.l)
  SetRepeats(a.l)
  GetDefaultResolution(a.l)
  SetDefaultResolution(a.l)
  GetTrack(a.l, b.l, c.l, d.l)
  GetTrackGroup(a.l, b.l)
  InsertTrack(a.l, b.l)
  RemoveTrack(a.l)
  InitPlay(a.l, b.l, c.l)
  GetGraph(a.l)
  SetGraph(a.l)
  AddNotificationType(a.l)
  RemoveNotificationType(a.l)
  GetParam(a.l, b.l, c.l, d.l, e.l, f.l)
  SetParam(a.l, b.l, c.l, d.l, e.l)
  Clone(a.l, b.l, c.l)
  SetStartPoint(a.l)
  GetStartPoint(a.l)
  SetLoopPoints(a.l, b.l)
  GetLoopPoints(a.l, b.l)
  SetPChannelsUsed(a.l, b.l)
  SetTrackConfig(a.l, b.l, c.l, d.l, e.l)
  GetAudioPathConfig(a.l)
  Compose(a.l, b.l, c.l, d.l)
  Download(a.l)
  Unload(a.l)
EndInterface

; IDirectMusicSegmentState interface definition
;
Interface IDirectMusicSegmentState_DX9
  QueryInterface(a.l, b.l)
  AddRef()
  Release()
  GetRepeats(a.l)
  GetSegment(a.l)
  GetStartTime(a.l)
  GetSeek(a.l)
  GetStartPoint(a.l)
EndInterface

; IDirectMusicSegmentState8 interface definition
;
Interface IDirectMusicSegmentState8_DX9
  QueryInterface(a.l, b.l)
  AddRef()
  Release()
  GetRepeats(a.l)
  GetSegment(a.l)
  GetStartTime(a.l)
  GetSeek(a.l)
  GetStartPoint(a.l)
  SetTrackConfig(a.l, b.l, c.l, d.l, e.l)
  GetObjectInPath(a.l, b.l, c.l, d.l, e.l, f.l, g.l, h.l)
EndInterface

; IDirectMusicAudioPath interface definition
;
Interface IDirectMusicAudioPath_DX9
  QueryInterface(a.l, b.l)
  AddRef()
  Release()
  GetObjectInPath(a.l, b.l, c.l, d.l, e.l, f.l, g.l, h.l)
  Activate(a.l, b.l)
  SetVolume(a.l, b.l, c.l)
  ConvertPChannel(a.l, b.l)
EndInterface

; IDirectMusicPerformance interface definition
;
Interface IDirectMusicPerformance_DX9
  QueryInterface(a.l, b.l)
  AddRef()
  Release()
  Init(a.l, b.l, c.l)
  PlaySegment(a.l, b.l, c.l, d.l)
  Stop(a.l, b.l, c.l, d.l)
  GetSegmentState(a.l, b.l)
  SetPrepareTime(a.l)
  GetPrepareTime(a.l)
  SetBumperLength(a.l)
  GetBumperLength(a.l)
  SendPMsg(a.l)
  MusicToReferenceTime(a.l, b.l)
  ReferenceToMusicTime(a.l, b.l)
  IsPlaying(a.l, b.l)
  GetTime(a.l, b.l)
  AllocPMsg(a.l, b.l)
  FreePMsg(a.l)
  GetGraph(a.l)
  SetGraph(a.l)
  SetNotificationHandle(a.l, b.l)
  GetNotificationPMsg(a.l)
  AddNotificationType(a.l)
  RemoveNotificationType(a.l)
  AddPort(a.l)
  RemovePort(a.l)
  AssignPChannelBlock(a.l, b.l, c.l)
  AssignPChannel(a.l, b.l, c.l, d.l)
  PChannelInfo(a.l, b.l, c.l, d.l)
  DownloadInstrument(a.l, b.l, c.l, d.l, e.l, f.l, g.l, h.l)
  Invalidate(a.l, b.l)
  GetParam(a.l, b.l, c.l, d.l, e.l, f.l)
  SetParam(a.l, b.l, c.l, d.l, e.l)
  GetGlobalParam(a.l, b.l, c.l)
  SetGlobalParam(a.l, b.l, c.l)
  GetLatencyTime(a.l)
  GetQueueTime(a.l)
  AdjustTime(a.l)
  CloseDown()
  GetResolvedTime(a.l, b.l, c.l)
  MIDIToMusic(a.l, b.l, c.l, d.l, e.l)
  MusicToMIDI(a.l, b.l, c.l, d.l, e.l)
  TimeToRhythm(a.l, b.l, c.l, d.l, e.l, f.l)
  RhythmToTime(a.l, b.l, c.l, d.l, e.l, f.l)
EndInterface

; IDirectMusicPerformance8 interface definition
;
Interface IDirectMusicPerformance8_DX9
  QueryInterface(a.l, b.l)
  AddRef()
  Release()
  Init(a.l, b.l, c.l)
  PlaySegment(a.l, b.l, c.l, d.l)
  Stop(a.l, b.l, c.l, d.l)
  GetSegmentState(a.l, b.l)
  SetPrepareTime(a.l)
  GetPrepareTime(a.l)
  SetBumperLength(a.l)
  GetBumperLength(a.l)
  SendPMsg(a.l)
  MusicToReferenceTime(a.l, b.l)
  ReferenceToMusicTime(a.l, b.l)
  IsPlaying(a.l, b.l)
  GetTime(a.l, b.l)
  AllocPMsg(a.l, b.l)
  FreePMsg(a.l)
  GetGraph(a.l)
  SetGraph(a.l)
  SetNotificationHandle(a.l, b.l)
  GetNotificationPMsg(a.l)
  AddNotificationType(a.l)
  RemoveNotificationType(a.l)
  AddPort(a.l)
  RemovePort(a.l)
  AssignPChannelBlock(a.l, b.l, c.l)
  AssignPChannel(a.l, b.l, c.l, d.l)
  PChannelInfo(a.l, b.l, c.l, d.l)
  DownloadInstrument(a.l, b.l, c.l, d.l, e.l, f.l, g.l, h.l)
  Invalidate(a.l, b.l)
  GetParam(a.l, b.l, c.l, d.l, e.l, f.l)
  SetParam(a.l, b.l, c.l, d.l, e.l)
  GetGlobalParam(a.l, b.l, c.l)
  SetGlobalParam(a.l, b.l, c.l)
  GetLatencyTime(a.l)
  GetQueueTime(a.l)
  AdjustTime(a.l)
  CloseDown()
  GetResolvedTime(a.l, b.l, c.l)
  MIDIToMusic(a.l, b.l, c.l, d.l, e.l)
  MusicToMIDI(a.l, b.l, c.l, d.l, e.l)
  TimeToRhythm(a.l, b.l, c.l, d.l, e.l, f.l)
  RhythmToTime(a.l, b.l, c.l, d.l, e.l, f.l)
  InitAudio(a.l, b.l, c.l, d.l, e.l, f.l, g.l)
  PlaySegmentEx(a.l, b.l, c.l, d.l, e.l, f.l, g.l, h.l)
  StopEx(a.l, b.l, c.l, d.l, e.l)
  ClonePMsg(a.l, b.l)
  CreateAudioPath(a.l, b.l, c.l, d.l)
  CreateStandardAudioPath(a.l, b.l, c.l, d.l)
  SetDefaultAudioPath(a.l)
  GetDefaultAudioPath(a.l)
  GetParamEx(a.l, b.l, c.l, d.l, e.l, f.l, g.l)
EndInterface

; IDirectMusicGraph interface definition
;
Interface IDirectMusicGraph_DX9
  QueryInterface(a.l, b.l)
  AddRef()
  Release()
  StampPMsg(a.l)
  InsertTool(a.l, b.l, c.l, d.l)
  GetTool(a.l, b.l)
  RemoveTool(a.l)
EndInterface

; IDirectMusicStyle interface definition
;
Interface IDirectMusicStyle_DX9
  QueryInterface(a.l, b.l)
  AddRef()
  Release()
  GetBand(a.l, b.l)
  EnumBand(a.l, b.l)
  GetDefaultBand(a.l)
  EnumMotif(a.l, b.l)
  GetMotif(a.l, b.l)
  GetDefaultChordMap(a.l)
  EnumChordMap(a.l, b.l)
  GetChordMap(a.l, b.l)
  GetTimeSignature(a.l)
  GetEmbellishmentLength(a.l, b.l, c.l, d.l)
  GetTempo(a.l)
EndInterface

; IDirectMusicStyle8 interface definition
;
Interface IDirectMusicStyle8_DX9
  QueryInterface(a.l, b.l)
  AddRef()
  Release()
  GetBand(a.l, b.l)
  EnumBand(a.l, b.l)
  GetDefaultBand(a.l)
  EnumMotif(a.l, b.l)
  GetMotif(a.l, b.l)
  GetDefaultChordMap(a.l)
  EnumChordMap(a.l, b.l)
  GetChordMap(a.l, b.l)
  GetTimeSignature(a.l)
  GetEmbellishmentLength(a.l, b.l, c.l, d.l)
  GetTempo(a.l)
  EnumPattern(a.l, b.l, c.l)
EndInterface

; IDirectMusicChordMap interface definition
;
Interface IDirectMusicChordMap_DX9
  QueryInterface(a.l, b.l)
  AddRef()
  Release()
  GetScale(a.l)
EndInterface

; IDirectMusicComposer interface definition
;
Interface IDirectMusicComposer_DX9
  QueryInterface(a.l, b.l)
  AddRef()
  Release()
  ComposeSegmentFromTemplate(a.l, b.l, c.l, d.l, e.l)
  ComposeSegmentFromShape(a.l, b.l, c.l, d.l, e.l, f.l, g.l, h.l)
  ComposeTransition(a.l, b.l, c.l, d.l, e.l, f.l, g.l)
  AutoTransition(a.l, b.l, c.l, d.l, e.l, f.l, g.l, h.l)
  ComposeTemplateFromShape(a.l, b.l, c.l, d.l, e.l, f.l)
  ChangeChordMap(a.l, b.l, c.l)
EndInterface

; IDirectMusicPatternTrack interface definition
;
Interface IDirectMusicPatternTrack_DX9
  QueryInterface(a.l, b.l)
  AddRef()
  Release()
  CreateSegment(a.l, b.l)
  SetVariation(a.l, b.l, c.l)
  SetPatternByName(a.l, b.l, c.l, d.l, e.l)
EndInterface

; IDirectMusicScript interface definition
;
Interface IDirectMusicScript_DX9
  QueryInterface(a.l, b.l)
  AddRef()
  Release()
  Init(a.l, b.l)
  CallRoutine(a.l, b.l)
  SetVariableVariant(a.l, b.l, c.l, d.l)
  GetVariableVariant(a.l, b.l, c.l)
  SetVariableNumber(a.l, b.l, c.l)
  GetVariableNumber(a.l, b.l, c.l)
  SetVariableObject(a.l, b.l, c.l)
  GetVariableObject(a.l, b.l, c.l, d.l)
  EnumRoutine(a.l, b.l)
  EnumVariable(a.l, b.l)
EndInterface

; IDirectMusicContainer interface definition
;
Interface IDirectMusicContainer_DX9
  QueryInterface(a.l, b.l)
  AddRef()
  Release()
  EnumObject(a.l, b.l, c.l, d.l)
EndInterface
J'ai ajouté le suffixe "_DX9" pour éviter toute confusion avec les interfaces de pb.
Ton code devrait compiler mais il faudra que tu changes par ca :

Code : Tout sélectionner

CoCreateInstance_(?CLSID_DirectMusicLoader, 0,#CLSCTX_INPROC_SERVER, ?IID_IDirectMusicLoader8,@*g_pLoader.IDirectMusicLoader8_DX9) 
CoCreateInstance_(?CLSID_DirectMusicPerformance, 0,#CLSCTX_INPROC_SERVER,?IID_IDirectMusicPerformance8,@*g_pPerformance.IDirectMusicPerformance8_DX9) 
Pareil pour tous les autres objets :)

Publié : mer. 14/avr./2004 13:30
par Fred
Qu'est ce qui est incorrecte dans les definitions ?

Publié : mer. 14/avr./2004 14:02
par KarLKoX
Les interfaces du types DirectPeformance8 (pas DirectPerformance) donc en gros, tout ce qui touche à DirectX 8 et >.

Publié : mer. 14/avr./2004 22:25
par ZapMan
Tu t'es donné bien du mal, KarLKox. Merci beaucoup, c'est trés sympa.

Publié : jeu. 15/avr./2004 1:31
par KarLKoX
mouof, c'est rien, ca m'a permis de voire que la prog COM c'est pas pour moi mais que DirectMusic, en fait, c'est pas si mal ... :)