Results 1 to 5 of 5

Thread: [2005] Problems after converting this project

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2006
    Posts
    115

    Question [2005] Problems after converting this project

    I downloaded this http://robydx.altervista.org/DirectX...ctSoundRec.zip it records voice but it converts with errors. They say for the parts that have errors (is ambiguous in the namespace 'Microsoft.DirectX.DirectSound'). I have DirectX SDK installed and don't know what the problem is I was wondering if somebody else could convert it in vb.net 2005 and see if it's just not working for me.

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Jun 2006
    Posts
    115

    Re: [2005] Problems after converting this project

    well this is some of the code I tried converting from that project but things llike CaptureBuffer get this error have errors (is ambiguous in the namespace 'Microsoft.DirectX.DirectSound').

    VB Code:
    1. Imports Microsoft.DirectX
    2. Imports Microsoft.DirectX.DirectSound
    3. Imports System.Threading
    4. Imports System.IO
    5.  
    6. Public Class Form1
    7.    
    8.     Dim cBuff As CaptureBuffer 'buffer di registrazione
    9.     Dim th As New Threading.Thread(AddressOf checkD) 'thread che salva ad intervalli regolari i dati nel file
    10.  
    11.  
    12.     Public PositionNotify(16) As BufferPositionNotify 'posizioni di notifica
    13.     Public appNotify As Notify 'notificatore
    14.     Public NotificationEvent As AutoResetEvent = Nothing 'gestore delle attese nel thread
    15.  
    16.     Dim captureBufferSize As Integer 'dimensione del buffer
    17.     Dim notifySize As Integer 'dimensione della notifica
    18.     Public NextCaptureOffset As Integer = 0 'prossimo intervallo di cattura
    19.  
    20.  
    21.  
    22.  
    23.  
    24.     Private WaveFile As FileStream = Nothing 'file wave
    25.     Private Writer As BinaryWriter = Nothing 'scrittore del file
    26.     Private SampleCount As Integer = 0 'bit catturati
    27.  
    28.     Private isRecording As Boolean = False
    29.  
    30.     Const nNotification As Integer = 16
    31.  
    32.  
    33.     'guide del sistema
    34.     Dim guide() As Guid
    35.  
    36.  
    37.     Private Sub Rec_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Rec.Click
    38.  
    39.         'bit per sample
    40.         Dim bitS As Integer
    41.         If bit1.Checked Then bitS = 8 Else bitS = 16
    42.         'canali
    43.         Dim canali As Integer
    44.         If canali1.Checked Then canali = 1 Else canali = 2
    45.         'frequenza
    46.         Dim freq As Integer
    47.         If freq1.Checked Then freq = 48000
    48.         If freq2.Checked Then freq = 44100
    49.         If freq3.Checked Then freq = 22050
    50.         If freq4.Checked Then freq = 11025
    51.         If freq5.Checked Then freq = 8000
    52.  
    53.  
    54.  
    55.         Rec.Enabled = False
    56.         stopRec.Enabled = True
    57.  
    58.  
    59.  
    60.         'descrizione del capBuffer
    61.         Dim capD As CaptureBufferDescription
    62.         Dim captureF As New Capture(guide(ComboBox1.SelectedIndex))
    63.  
    64.  
    65.         'formato
    66.         Dim format As WaveFormat
    67.         format.BitsPerSample = bitS
    68.         format.Channels = canali
    69.         format.SamplesPerSecond = freq
    70.         format.BlockAlign = CShort(format.Channels * (format.BitsPerSample / 8))
    71.         format.AverageBytesPerSecond = format.BlockAlign * format.SamplesPerSecond
    72.         format.FormatTag = WaveFormatTag.Pcm
    73.         capD.Format = format
    74.  
    75.  
    76.         Select Case SaveD.ShowDialog
    77.             Case Windows.Forms.DialogResult.OK, Windows.Forms.DialogResult.Yes
    78.                 'crea il file
    79.                 CreateRIFF(SaveD.FileName, format)
    80.             Case Else
    81.                 Exit Sub
    82.         End Select
    83.        
    84.  
    85.  
    86.  
    87.         notifySize = IIf(1024 > format.AverageBytesPerSecond / 8, 1024, format.AverageBytesPerSecond / 8)
    88.         notifySize -= notifySize Mod format.BlockAlign
    89.  
    90.         ' imposta la dimensione del buffer
    91.         captureBufferSize = notifySize * nNotification
    92.  
    93.         ' Crea il capture buffer
    94.         capD.BufferBytes = captureBufferSize
    95.         cBuff = New CaptureBuffer(capD, captureF)
    96.  
    97.  
    98.  
    99.         NotificationEvent = New AutoResetEvent(False)
    100.         'creazione notifica
    101.         Dim i As Integer
    102.         For i = 0 To nNotification - 1
    103.             PositionNotify(i).Offset = notifySize * i + notifySize - 1
    104.             PositionNotify(i).EventNotifyHandle = NotificationEvent.Handle
    105.         Next
    106.  
    107.  
    108.  
    109.         appNotify = New Notify(cBuff)
    110.  
    111.        
    112.         'imposta il notificatore affinchè generi l'evento nel thread
    113.         appNotify.SetNotificationPositions(PositionNotify, nNotification)
    114.  
    115.         isRecording = True
    116.         cBuff.Start(True)
    117.         th.Start() 'inizia il thread
    118.  
    119.  
    120.     End Sub

  3. #3
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: [2005] Problems after converting this project

    Well what is ambiguous? Just means that you are using a name for a variable that also appears in one of your referenced assemblies, for whatever name you are getting the error on. You can just change the name in the code to something else (or enclose the ambiguous names in brackets, I believe)

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jun 2006
    Posts
    115

    Re: [2005] Problems after converting this project

    but i've tried that it still doesn't work for instance I have this:

    VB Code:
    1. Dim cBuff As CaptureBuffer
    then the error is then I get the error (CaptureBuffer is ambiguous in the namespace 'Microsoft.DirectX.DirectSound') and it's a class in Microsoft.DirectX.DirectSound. I even tried it this way:
    VB Code:
    1. Dim cBuff As Microsoft.DirectX.DirectSound.CaptureBuffer
    but when I do it that way capturebuffer isn't even in the list of classes and I know it's suppose to be because I even checked the msdn site

  5. #5
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: [2005] Problems after converting this project

    Not sure what to tell you, as those two lines both work for me when just copying and pasting in, with the DirecSound dll referenced... Maybe its just something that went wrong in the conversion. Why not try starting a new project and just copying and pasting the code over?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width