-
October 7th, 2009, 10:21 AM
#16
Re: Streaming Audio from one PC to another over a Local Network
Try sleep 5000 (for 5 seconds sleep) might need time to save the file
Code:
Call .SaveStreamBuffer(Index, ExData(Index)) ' Save the current wave data to the wave buffer Error occurs here
SLEEP 5000 ' 5 Second delay?
Call .AddStreamToQueue(Index) ' Queue the current wave stream
-
October 7th, 2009, 10:49 AM
#17
Re: Streaming Audio from one PC to another over a Local Network
Originally Posted by dglienna
Try sleep 5000 (for 5 seconds sleep) might need time to save the file
Code:
Call .SaveStreamBuffer(Index, ExData(Index)) ' Save the current wave data to the wave buffer Error occurs here
SLEEP 5000 ' 5 Second delay?
Call .AddStreamToQueue(Index) ' Queue the current wave stream
I can't have Sleep for 5 seconds in between every chunk of streaming audio.
But thanks for looking.
-
October 7th, 2009, 02:04 PM
#18
Re: Streaming Audio from one PC to another over a Local Network
Well, try it first, to see if that solves the problem. Even 20ms is good for the timer
-
October 7th, 2009, 02:10 PM
#19
Re: Streaming Audio from one PC to another over a Local Network
Originally Posted by dglienna
Well, try it first, to see if that solves the problem. Even 20ms is good for the timer
OK I will, I think I tried a DoEvents there as well before as a test and that had little efect.
Thanks for looking.
-
October 7th, 2009, 02:26 PM
#20
Re: Streaming Audio from one PC to another over a Local Network
Originally Posted by dglienna
Well, try it first, to see if that solves the problem. Even 20ms is good for the timer
I tried from 20ms >to> 5000ms in three different places in that sub.
It it did do something but the error 13 is still there at the same point.
-
October 7th, 2009, 02:28 PM
#21
Re: Streaming Audio from one PC to another over a Local Network
Originally Posted by BriansBrain
One way from a Server >>> to a single Client, both the PCs are connected to the same router, in fact both the PCs are in the same room.
The original Microsoft code was both ways, send and recieve, but I only require One Way.
Yes, I understand that you only need one way, but have you edited the code so that it no longer attempts both ways?
Sorry I should have been clearer, the program I want to receive the sound on the Client will NOT work on Vista or 7
...
Sorry I did not mention, the error is at the receive end, when the Winsock recieves Data.
Now I'm confused. The first quote sounds like the program you are using to receive is not the one we're discussing. The second quote does sound like you're using the program we're discussing. Can you please clarify which is it?
There are two Calls to SaveStreamBuffer in the same Sub, the first one works, the second gives the error.
Someone commented on the problem...
Type mismatches with streams can be caused by trying to pass a string when the receiver expects a byte.
A byte implies 8 bits so perhaps you have to somehow send a "long byte" instead of an "integer byte" (ie a 16 bit byte?)
But I can't get my head around it.
I doubt this has anything to do with the error, unless the changes you've made include a change in the data type being passed.
Please remember to rate the posts and threads that you find useful.
How can something be both new and improved at the same time?
-
October 8th, 2009, 05:40 AM
#22
Re: Streaming Audio from one PC to another over a Local Network
Originally Posted by WizBang
I understand that you only need one way, but have you edited the code so that it no longer attempts both ways?
Of course, it only Streams one way.
Originally Posted by WizBang
Now I'm confused. The first quote sounds like the program you are using to receive is not the one we're discussing.
I am using the program we are discussing to recieve the sound stream on PC-2.
The reason I said...
Sorry I should have been clearer, the program I want to receive the sound on the Client will NOT work on Vista or 7
It should have been >> The program I want to pass the sound too after it has been recieved by my program on PC-2 will not work on Vista or 7
Originally Posted by WizBang
I doubt this has anything to do with the error, unless the changes you've made include a change in the data type being passed.
The only Changes I have made is to take out the not required code for Chat.
In The TCPSocket (Winsock) Sub where the error acours this is original Microsoft code, it has NOT been modified.
The original code was used for the demo of Chat at 8kHz, 8bit Mono.
At that setting the code in the TCPSocket (Winsock) Sub the code only gets to the first Call to SaveStreamBuffer.
When I set the Server to Stream at 44khz, 16bit, Stereo, Winsock recieves more Data and the code gets to the Second Call to SaveStreamBuffer, this is where the error happens.
When Microsoft wrote the code I don't think they even tried it at a higher setting than 8kHz, 8bit Mono, but they wrote the code for the Winsock to recieve more data, but they did not test or debug it, this is what I think.
Thanks for looking.
-
October 8th, 2009, 05:45 PM
#23
Re: Streaming Audio from one PC to another over a Local Network
[ playing music from Windows 7 on XP Media Center computer right now...]
Being STREAMED directly from Windows 7 over my WIFI.
I don't get it. You can send low quality, and it works fine. You can't send high quality, and you think it's MS and their API's? What do you think I'm using on the XP box? Media Player 11.
If you do get it to work, you'll find that there is latency between the signals. Unless you are seeking a delay, then I don't think you'll be happy.
-
October 9th, 2009, 05:24 AM
#24
Re: Streaming Audio from one PC to another over a Local Network
Originally Posted by dglienna
[ playing music from Windows 7 on XP Media Center computer right now...]
Being STREAMED directly from Windows 7 over my WIFI.
I know it can be done in Vista or 7, but I want to do it in XP/2000
Originally Posted by dglienna
I don't get it. You can send low quality, and it works fine. You can't send high quality, and you think it's MS and their API's?
The Microsoft code as mentioned above was written in 1996/7, and was available as source code, it was not supported, it was for demo only, I asume Microsoft has found the error in the above Microsoft code by now.
> > > > > > I/we on the other hand have NOT yet.
Originally Posted by dglienna
If you do get it to work, you'll find that there is latency between the signals.
I did mention in one of my replies, latency is not a problem, as long as it's roughly constant, which it should be.
Thanks for looking.
-
October 9th, 2009, 05:22 PM
#25
Re: Streaming Audio from one PC to another over a Local Network
If it wasn't supported THEN, why would they have fixed that? This was updated after that.
Code:
Option Explicit
Private Const SND_APPLICATION = &H80 ' look for application specific association
Private Const SND_ALIAS = &H10000 ' name is a WIN.INI [sounds] entry
Private Const SND_ALIAS_ID = &H110000 ' name is a WIN.INI [sounds] entry identifier
Private Const SND_ASYNC = &H1 ' play asynchronously
Private Const SND_FILENAME = &H20000 ' name is a file name
Private Const SND_LOOP = &H8 ' loop the sound until next sndPlaySound
Private Const SND_MEMORY = &H4 ' lpszSoundName points to a memory file
Private Const SND_NODEFAULT = &H2 ' silence not default, if sound not found
Private Const SND_NOSTOP = &H10 ' don't stop any currently playing sound
Private Const SND_NOWAIT = &H2000 ' don't wait if the driver is busy
Private Const SND_PURGE = &H40 ' purge non-static events for task
Private Const SND_RESOURCE = &H40004 ' name is a resource name or atom
Private Const SND_SYNC = &H0 ' play synchronously (default)
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Dim flag As Boolean
Private Sub Command1_Click()
If Not flag Then
Command1.Caption = "Stop"
PlaySound SoundFile(0), ByVal 0&, SND_ASYNC Or SND_LOOP
Else
Command1.Caption = "Play"
PlaySound SoundFile(0), ByVal 0&, SND_MEMORY
End If
flag = Not flag
End Sub
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
Call LoadSounds
Command1.Caption = "Play"
End Sub
-
October 10th, 2009, 07:01 AM
#26
Re: Streaming Audio from one PC to another over a Local Network
Originally Posted by dglienna
If it wasn't supported THEN, why would they have fixed that? This was updated after that.
According to the person who copied the original code from the 1997 VB6 installation CD, he said that the documentation with the Microsoft Chat Demo stated that it was not supported by Microsoft.
That is all I know!
-
October 10th, 2009, 12:19 PM
#27
Re: Streaming Audio from one PC to another over a Local Network
I wonder if it would help debug this thing to use the CSocket or CSocketPlus class. It provides all the functionality of winsock. But since you can use the class module in your program, rather than having a separate DLL, maybe you can step through the error. There is at least one VB preference setting pertaining to breaking, so check that too.
Please remember to rate the posts and threads that you find useful.
How can something be both new and improved at the same time?
-
October 11th, 2009, 08:36 AM
#28
Re: Streaming Audio from one PC to another over a Local Network
Originally Posted by WizBang
I wonder if it would help debug this thing to use the CSocket or CSocketPlus class. It provides all the functionality of winsock. But since you can use the class module in your program, rather than having a separate DLL, maybe you can step through the error. There is at least one VB preference setting pertaining to breaking, so check that too.
But if you have a look at the sub where the error occurs, it's in the code, it's not a winsock error.
In that sub there are two Calls to the ClassModule >>> WaveStream.cls
It happens every time the code gets to the second >>> Call .SaveStreamBuffer
The error is Type Mismatch so...
If the First >>> Call .SaveStreamBuffer does NOT error
It's probably trying to pass a string in the second Call when the receiver expects a byte.
But I can't get my head around it... that's why I came here to ask a Guru.
Code:
'================== The TCPSocket is Winsock =============================
With wStream
If (TCPSocket(Index).BytesReceived > 0) Then ' Validate that bytes where actually received
Do While (TCPSocket(Index).BytesReceived > 0) ' While data available...
If (ExBytes(Index) = 0) Then ' Was there leftover data from last time
If (.waveChunkSize <= TCPSocket(Index).BytesReceived) Then ' Can we get and entire wave buffer of data
Call TCPSocket(Index).GetData(WaveData, vbByte + vbArray, .waveChunkSize) ' Get 1 wave buffer of data
Call .SaveStreamBuffer(Index, WaveData) ' Save wave data to buffer
Call .AddStreamToQueue(Index) ' Queue current stream for playback
Else
ExBytes(Index) = TCPSocket(Index).BytesReceived ' Save Extra bytes
Call TCPSocket(Index).GetData(ExData(Index), vbByte + vbArray, ExBytes(Index)) ' Get Extra data
End If
Else
Call TCPSocket(Index).GetData(WaveData, vbByte + vbArray, .waveChunkSize - ExBytes(Index)) ' Get leftover bits
ExData(Index) = MidB(ExData(Index), 1) & MidB(WaveData, 1) ' Sync wave bits...
Call .SaveStreamBuffer(Index, ExData(Index)) ' Save the current wave data to the wave buffer
Call .AddStreamToQueue(Index) ' Queue the current wave stream
ExBytes(Index) = 0 ' Clear Extra byte count
ExData(Index) = "" ' Clear Extra data buffer
End If
Loop ' Look for next Data Chunk
If (Not .Playing And .PlayDeviceFree And _
Not .Recording And .RecDeviceFree) Then ' Check Audio Device Status
Call cmdTalk_Click ' Start PlayBack...
End If
End If
End With
'=================================================================
Thanks for looking.
-
October 11th, 2009, 10:39 AM
#29
Re: Streaming Audio from one PC to another over a Local Network
Originally Posted by BriansBrain
It's probably trying to pass a string in the second Call when the receiver expects a byte.
No, it isn't. The type being passed is the same for both. So if it's correct the first time, then it's correct the second time too. However, one thing does catch my attention:
Code:
ExData(Index) = MidB(ExData(Index), 1) & MidB(WaveData, 1) ' Sync wave bits...
Something tells me the problem is there, because MidB() works on 8 bit bytes. What is the data type of ExData?
Please remember to rate the posts and threads that you find useful.
How can something be both new and improved at the same time?
-
October 11th, 2009, 01:46 PM
#30
Re: Streaming Audio from one PC to another over a Local Network
Originally Posted by WizBang
What is the data type of ExData?
Before that code is ...
Dim rc As Long ' Return Code Variable
Dim WaveData() As Byte ' Byte array of wave data
Static ExBytes(MAXTCP) As Long ' Extra bytes in frame buffer
Static ExData(MAXTCP) As Variant ' Extra bytes from frame buffer
All I know is if I increase the wav streaming quality, whether it be 8bit or 16bit the error ocours.
Last edited by BriansBrain; October 11th, 2009 at 01:50 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|