Visual Basic, .NET, ASP, VBScript
 

   
   
     

Форум - Общий форум

Страница: 1 |

 

  Вопрос: DirectX8-DirectSound DS.CreateSoundBuffer Добавлено: 26.09.07 17:21  

Автор вопроса:  KreAtoR
если кто разбирается, ну или может помочь. посмотрите этот пример. Проблема у меня при создании Буффера. могу воспроизвести файлб но немогу создать буфер и не могу создать буфер из ресурса. Помогите плиз

begin 644 DIRECTSOUND8.rar
hIa3m6Fc5+AyEQk++1E++++++++1rKrEUY1g++EI++-sF+++0y9BQsJRsCXQR
hAlM+6++++2F7IYJ1J3BDJIt2C3l4Pr7hAGtaQao+g2-9H+k-IEmBHwq-KxuZ
hTkvFskbORRMRYWZeIw+MrqWc1RSgUF870MnE5MlgH4HsLzpJpYgc11TUqDKl
hVqRhLTBy1UxnaT5aNavgzAtxxnCOiNWrSNnaPWp9Rxip7M3VGqRobc6TXy3M
hCBdkvhf5dijNHVyeNqhHjMFMnDhCuuobgzm8-2x01HPEL5zq0pXmDk5t6TcU
hMYgVlDm9jIOWLRn4BbcuHIRpf0zYUHeumd9CqTk2gBAwG2UAgBVYUzdgF76q
hdPP+ykwzQn8itqWHcFPoXaqDQkiyKTsWHuVg3V6BrZYWvZmWpuqVxwGeneef
hP5cIjr39+kR0+aFNdedoxAOOEjR8IuW2-LMkK6T+ySZxuHSPlYrRSxT42HdH
htT6fwGQyfB6dQtQo1pB1kTj2pcEReRG1l7uevabag4u+6djrvP4LzTgYhQZ7
hDaqvUMP42-aMN47HpPC4M5FrSADvRay8bJU4t-ZhULwgMRA9jO7cF9nnCv9s
hN42QNscIxV-KqaKbmdCNHKCukAKMf7OPonsd+KbAEgsrm8fydueCua6NheRz
hbuDbJQCoiiow9xLXiiG1dDngEpsvh+WM5AylpR4zz3mlLqKnWlSpmtX2qj5-
hPoBhZyiAgUUz2v3Z8IfI2TpvvhWrLIiUvvEQ9H5T3aQRSJy7Awj3pv5irlby
hH5XEsfMfL2ooZfuOmZeMrVpX0-rED-f3W0xECti1HHSRmdhB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
hFIBIIoxJHYEsL3-mPqdZOrEl9bNWQ+1k8bIJ1RYEnAnx5-3vo0y1cBwN8+q0
hYo63S1sG7BGA-hBWiJmw5l8G8Y9VG80FHzWoLrSUBpidcZYdGiWnkV+XQn-d
hCvwj5wrBnFiwAr+Drk4S+Ns-svNFLw4kLly5o328MIY3CyKXjz+C6k-aw0s1
hRKQBzqbxtbgzBhWu0rlPhrFoywg9naHmnO7xgtVFra8EO2d-J6AFyrYlM3iq
hUlMka4KHryb+ikjkAgL4g5nNiIdlSYh+OsFyKLKq4yk3vSLrQEv4hHxq2V9P
hUnjE4ymnGoFNZgstu+YKvUnXUKJjmq6PwkNhe0LSLFrpQ5SWreTaBmMp2hyp
hKrOt+qXF4gY7rSF7Gw4B4Rf9ALG9pAePk2GKcIVzxVg9aw0muZHhfzDn4K2J
hXSACYtyTbbTLHKCHRU8-qd1OEbqIcJsN62RbZCZvBtjtOiBaEb9JIncneneR
hJseLKG8p0agYhBX5xzyPR1eefZHoloFdnneB5pqLu4AslOr-DoSNw6WeQS9q
hY4YFYwp7vWoQxNqzEI5fLqosL2EijckuH8KdFjwhn1bu6ygYmfUcLQhSVIJJ
hURQO6H0J7M+Q-lf8z5otw-VFPBYTodzTeOlVqD6tTroJYguWJybSkrEUY1s+
hAU+++16++++0ufjfRZpICXQRA-Y+6++++2F7IYJ1J3BDJIt2C3lEQaxeNKho
hAGtqMbQ+wCPcGINjQaol61oUB1Eg61Is90+sCHMg61MpAmkUKWkUAX6g616t
h90+sBnEg61MqAGkUEko8LTNos7+l+++++++++++++U++++-LS1cr31+A+-++
O++-2GJ73EpFHHpJCF1U+w0dp3QExSk-+-k++
+
end
sum -r/size 56416/2051

Ответить

  Ответы Всего ответов: 3  

Номер ответа: 1
Автор ответа:
 Mr.Smile



ICQ: 427682013 

Вопросов: 14
Ответов: 464
 Профиль | | #1 Добавлено: 26.09.07 19:56
Что-то твой архив (внутри который) не открывается! :(

Ответить

Номер ответа: 2
Автор ответа:
 KreAtoR



Вопросов: 120
Ответов: 438
 Профиль | | #2 Добавлено: 27.09.07 12:48
незнаю у меня все открылось, кликнул два раза и все.

Ответить

Номер ответа: 3
Автор ответа:
 KreAtoR



Вопросов: 120
Ответов: 438
 Профиль | | #3 Добавлено: 27.09.07 12:50
если всетаки не открывается

            Option Explicit
    'On the Form1 command1.Name = comCap
    '             Command2.Name = comPlay
    'Project Add DirectX 8
        
        Private Const DC_QUID As String = vbNullString
        Private Const DS_QUID As String = vbNullString
        Private Const FILE As String = "C:\WINDOWS\Media\Windows XP-Startvorgang.wav"
        Private Const BUFFER_FROM As String = "CreateSoundBuffer" 'CreateSoundBufferFromFile
                                                                          'CreateSoundBuffer
                                                                          'CreateSoundBufferFromResource
        Private DX As New DirectX8
        Private DS As DirectSound8
        Private DC As DirectSoundCapture8
        Private DSSB As DirectSoundSecondaryBuffer8
        Private DSCB As DirectSoundCaptureBuffer8
        Private DSD As DSBUFFERDESC
        Private DCD As DSCBUFFERDESC
        Private capFormat As WAVEFORMATEX
        Dim curInfo As DSCURSORS
        
Private Sub InitDSCB()
    Set DC = Nothing
    Set DC = DX.DirectSoundCaptureCreate(DC_QUID)
    With capFormat
        .nFormatTag = WAVE_FORMAT_PCM
        .nChannels = 2
        .lSamplesPerSec = 44100
        .nBitsPerSample = 16
        .nBlockAlign = .nChannels * .nBitsPerSample / 8
        .lAvgBytesPerSec = .lSamplesPerSec * .nBlockAlign
        .nSize = 0
    End With
    With DCD
        .fxFormat = capFormat
        .lBufferBytes = capFormat.lAvgBytesPerSec * 20
        .lFlags = DSCBCAPS_WAVEMAPPED
    End With
    Set DSCB = DC.CreateCaptureBuffer(DCD)
    'DSCB.Start DSCBSTART_DEFAULT
End Sub

Private Sub InitDSSB()
    Dim bytes() As Integer
    'DSCB.Stop
    Set DS = Nothing
    Set DS = DX.DirectSoundCreate(DS_QUID)
    ;DS.SetCooperativeLevel Me.hWnd, DSSCL_PRIORITY
    With DSD
        .lFlags = DSBCAPS_CTRLFREQUENCY Or DSBCAPS_CTRLPAN Or DSBCAPS_CTRLVOLUME
        .lBufferBytes = curInfo.lWrite + 1
        .fxFormat = DCD.fxFormat
    End With
    
    If BUFFER_FROM = "CreateSoundBuffer" Then
        Set DSSB = DS.CreateSoundBuffer(DSD)
        ReDim bytes(curInfo.lWrite)
        ;DSCB.ReadBuffer 0, UBound(bytes), bytes(0), DSCBLOCK_DEFAULT
        ;DSSB.WriteBuffer 0, UBound(bytes), bytes(0), DSBLOCK_DEFAULT
    ElseIf BUFFER_FROM = "CreateSoundBufferFromFile" Then
        Set DSSB = DS.CreateSoundBufferFromFile(FILE, DSD)
    ElseIf BUFFER_FROM = "CreateSoundBufferFromResource" Then
        Set DSSB = DS.CreateSoundBufferFromResource("", DC_QUID, DSD)
    End If
    'DSB.Play DSBPLAY_DEFAULT
End Sub

Private Sub comCap_Click()
    If comCap.Caption = "Capture" Then
        InitDSCB
        ;DSCB.Start DSCBSTART_DEFAULT
        comCap.Caption = "Stop"
        comPlay.Enabled = False
    ElseIf comCap.Caption = "Stop" Then
        ;DSCB.Stop
        comCap.Caption = "Capture"
        comPlay.Enabled = True
    End If
End Sub

Private Sub comPlay_Click()
    If comPlay.Caption = "Play" Then
        InitDSSB
        ;DSSB.Play DSBPLAY_LOOPING
        comPlay.Caption = "Stop"
        comCap.Enabled = False
    Else
        ;DSSB.Stop
        comPlay.Caption = "Play"
        comCap.Enabled = True
    End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Set DX = Nothing
    Set DS = Nothing
    Set DC = Nothing
    Set DSSB = Nothing
    Set DSCB = Nothing
End Sub


на форму две кнопки
comCap
comPlay

и подключить надо directX 8

Ответить

Страница: 1 |

Поиск по форуму



© Copyright 2002-2011 VBNet.RU | Пишите нам