Discussion:
[Pearpc-devel] Sound Patch
Adeeb Mohammed
2005-12-22 02:42:54 UTC
Permalink
I heard of the error on the sound patch is there anyway i can help?
Jens von der Heydt
2005-12-22 07:44:29 UTC
Permalink
Post by Adeeb Mohammed
I heard of the error on the sound patch is there anyway i can help?
Hello Adeeb,

everyone is welcome to help. In case of the sound patch this would be:
Understand how it's working and know how it *should* work.

Jens
Alex Smith
2005-12-22 08:03:14 UTC
Permalink
ATM, I'm trying to understand the design and get some output :)
Post by Jens von der Heydt
Post by Adeeb Mohammed
I heard of the error on the sound patch is there anyway i can help?
Hello Adeeb,
Understand how it's working and know how it *should* work.
Jens
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Pearpc-devel mailing list
https://lists.sourceforge.net/lists/listinfo/pearpc-devel
Alex Smith
2005-12-23 10:12:23 UTC
Permalink
What exactly was changed with the endian stuff? The sound patch was
using ppc_word_to_BE, which is exactly the same as the new
ppc_bswap_word. If I keep it as ppc_word_to_BE, I get a bunch of
segfaults. If I change it to ppc_bswap_word, it doesn't segfault, but I
get no sound output. Any ideas?

P.S: I hope that made sense :P
Post by Alex Smith
ATM, I'm trying to understand the design and get some output :)
Post by Jens von der Heydt
Post by Adeeb Mohammed
I heard of the error on the sound patch is there anyway i can help?
Hello Adeeb,
Understand how it's working and know how it *should* work.
Jens
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Pearpc-devel mailing list
https://lists.sourceforge.net/lists/listinfo/pearpc-devel
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Pearpc-devel mailing list
https://lists.sourceforge.net/lists/listinfo/pearpc-devel
Jens von der Heydt
2005-12-23 11:00:09 UTC
Permalink
Post by Alex Smith
What exactly was changed with the endian stuff? The sound patch was
using ppc_word_to_BE, which is exactly the same as the new
ppc_bswap_word. If I keep it as ppc_word_to_BE, I get a bunch of
segfaults. If I change it to ppc_bswap_word, it doesn't segfault, but I
get no sound output. Any ideas?
P.S: I hope that made sense :P
Post by Alex Smith
ATM, I'm trying to understand the design and get some output :)
Post by Jens von der Heydt
Post by Adeeb Mohammed
I heard of the error on the sound patch is there anyway i can help?
Hello Adeeb,
everyone is welcome to help. In case of the sound patch this
Understand how it's working and know how it *should* work.
Jens
I think you simply have to remove the le/be conversion in the
beginning of the function
because a later introduced patch to the "pci-bus" already does this
convert now.
it is just ONE TIME you have to remove this. I dont have the patch
sources
to show the exact line.

Jens
Alex Smith
2005-12-23 11:37:59 UTC
Permalink
I uploaded audio.cc -
http://www.tuxtalk.org/files/audio.cc

Which line needs to be changed?
Post by Alex Smith
Post by Alex Smith
What exactly was changed with the endian stuff?
The sound patch was
Post by Alex Smith
using ppc_word_to_BE, which is exactly the same as
the new
Post by Alex Smith
ppc_bswap_word. If I keep it as ppc_word_to_BE, I
get a bunch of
Post by Alex Smith
segfaults. If I change it to ppc_bswap_word, it
doesn't segfault,
Post by Alex Smith
but I
get no sound output. Any ideas?
P.S: I hope that made sense :P
On Thu, 2005-12-22 at 08:03 +0000, Alex Smith
Post by Alex Smith
ATM, I'm trying to understand the design and get
some output :)
Post by Alex Smith
Post by Alex Smith
On Thu, 2005-12-22 at 08:44 +0100, Jens von der
Post by Jens von der Heydt
Post by Adeeb Mohammed
I heard of the error on the sound patch is
there anyway i can help?
Post by Alex Smith
Post by Alex Smith
Post by Jens von der Heydt
Hello Adeeb,
everyone is welcome to help. In case of the
sound patch this
Post by Alex Smith
Post by Alex Smith
Post by Jens von der Heydt
Understand how it's working and know how it
*should* work.
Post by Alex Smith
Post by Alex Smith
Post by Jens von der Heydt
Jens
I think you simply have to remove the le/be
conversion in the
beginning of the function
because a later introduced patch to the "pci-bus"
already does this
convert now.
it is just ONE TIME you have to remove this. I dont
have the patch
sources
to show the exact line.
Jens
-------------------------------------------------------
Post by Alex Smith
This SF.net email is sponsored by: Splunk Inc. Do
you grep through log files
for problems? Stop! Download the new AJAX search
engine that makes
searching your log files as easy as surfing the
web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
Post by Alex Smith
_______________________________________________
Pearpc-devel mailing list
https://lists.sourceforge.net/lists/listinfo/pearpc-devel
Jens von der Heydt
2005-12-23 16:51:24 UTC
Permalink
,
Post by Alex Smith
I uploaded audio.cc -
http://www.tuxtalk.org/files/audio.cc
Which line needs to be changed?
No, that's the wrong file. I'l get the patch an d have a look.

Jens
Jens von der Heydt
2005-12-23 16:58:37 UTC
Permalink
Ok, I am only reading the diff:

In src/io/macio/macio.cc , function:
bool PCI_MacIO::writeDeviceMem( uint r ......)


bool PCI_MacIO::writeDeviceMem(uint r, uint32 address, uint32 data,
uint size)
{

- if (r==0 && address >= 0x8000 && address < 0x8100) {
+ uint8 membuf[0x10000];
+ uint32 dmaChannel = (address & 0xf00) >> 8;
+ uint32 datasrc;
+ uint32 datasize;
+
+ uint32 operle;
+ uint16 opcode;
+ uint16 basecode;
+ uint16 reqCount;
+ bool result;
+
+
+ uint32 datale = ppc_word_to_BE(data);


this line above adds the double and therefore unwanted
convesion, remove it and you should hear sound.

Boy, while reading though the code I remembered what
a mess this diff created. These DeviceIO-Stuff really
should go into it's audio-device c - file. and not into macio.cc


Jens
Alex Smith
2005-12-23 19:13:16 UTC
Permalink
Can you look at the audio.cc to see what might cause a segfault? I
copied the original version of it over my modified version, and I can't
remember what I changed.
Post by Jens von der Heydt
bool PCI_MacIO::writeDeviceMem( uint r ......)
bool PCI_MacIO::writeDeviceMem(uint r, uint32 address, uint32 data,
uint size)
{
- if (r==0 && address >= 0x8000 && address < 0x8100) {
+ uint8 membuf[0x10000];
+ uint32 dmaChannel = (address & 0xf00) >> 8;
+ uint32 datasrc;
+ uint32 datasize;
+
+ uint32 operle;
+ uint16 opcode;
+ uint16 basecode;
+ uint16 reqCount;
+ bool result;
+
+
+ uint32 datale = ppc_word_to_BE(data);
this line above adds the double and therefore unwanted
convesion, remove it and you should hear sound.
Boy, while reading though the code I remembered what
a mess this diff created. These DeviceIO-Stuff really
should go into it's audio-device c - file. and not into macio.cc
Jens
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Pearpc-devel mailing list
https://lists.sourceforge.net/lists/listinfo/pearpc-devel
Alex Smith
2005-12-23 19:22:19 UTC
Permalink
With regard to the segfaults, I ran ppc with the generic core through
gdb and got this:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1589089360 (LWP 26799)]
0x08067196 in handleX11Event (event=@0xa1486268) at sysx11.cc:209
209 gMouse->handleEvent(ev);

Why on earth would the sound code cause problems with the X11 GUI code??
Post by Jens von der Heydt
bool PCI_MacIO::writeDeviceMem( uint r ......)
bool PCI_MacIO::writeDeviceMem(uint r, uint32 address, uint32 data,
uint size)
{
- if (r==0 && address >= 0x8000 && address < 0x8100) {
+ uint8 membuf[0x10000];
+ uint32 dmaChannel = (address & 0xf00) >> 8;
+ uint32 datasrc;
+ uint32 datasize;
+
+ uint32 operle;
+ uint16 opcode;
+ uint16 basecode;
+ uint16 reqCount;
+ bool result;
+
+
+ uint32 datale = ppc_word_to_BE(data);
this line above adds the double and therefore unwanted
convesion, remove it and you should hear sound.
Boy, while reading though the code I remembered what
a mess this diff created. These DeviceIO-Stuff really
should go into it's audio-device c - file. and not into macio.cc
Jens
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Pearpc-devel mailing list
https://lists.sourceforge.net/lists/listinfo/pearpc-devel
Jens von der Heydt
2005-12-23 20:10:57 UTC
Permalink
Post by Alex Smith
With regard to the segfaults, I ran ppc with the generic core through
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1589089360 (LWP 26799)]
209 gMouse->handleEvent(ev);
Why on earth would the sound code cause problems with the X11 GUI code??
Strange thing. Does it work with sdl then?


Jens
Alex Smith
2005-12-23 20:59:08 UTC
Permalink
Nope, same error.
Post by Jens von der Heydt
Post by Alex Smith
With regard to the segfaults, I ran ppc with the generic core through
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1589089360 (LWP 26799)]
209 gMouse->handleEvent(ev);
Why on earth would the sound code cause problems with the X11 GUI code??
Strange thing. Does it work with sdl then?
Jens
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Pearpc-devel mailing list
https://lists.sourceforge.net/lists/listinfo/pearpc-devel
Jens von der Heydt
2005-12-23 21:24:09 UTC
Permalink
Post by Alex Smith
Nope, same error.
Post by Jens von der Heydt
Post by Alex Smith
With regard to the segfaults, I ran ppc with the generic core through
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1589089360 (LWP 26799)]
209 gMouse->handleEvent(ev);
Why on earth would the sound code cause problems with the X11 GUI code??
Strange thing. Does it work with sdl then?
Jens
By the way, you can also use the cp_jitc to debug with gdb
you only have to make sure that the problem you're searching for
is not in the generated jitc - code, then you're fine.

I can not think of anything in this patch that could cause a segfault
other than a portautio - installation that is not linked or compiled
right.

No clue what you did change in the code?

Jens
Hugh McMaster
2005-12-24 03:42:44 UTC
Permalink
Speaking only from my experience, I tried a newly compiled Win-32 build. It
worked relatively well, better than I though it would anyway. Speed was
excellent, 1.5 GHz, sound played the alert sounds in the System Properties
Sound box, after about a 1 second delay. Also, during the reg. process, (I
had to reinstall), there was a vague tune being played, with cut sounds.
The errors caused seemed to be DMA related. Could someone send me the
changed sources as they are currently, so I can have a look?
Hugh McMaster
2005-12-24 03:45:18 UTC
Permalink
Sorry... That was me, Apple 101.
Post by Hugh McMaster
Speaking only from my experience, I tried a newly compiled Win-32 build.
It worked relatively well, better than I though it would anyway. Speed was
excellent, 1.5 GHz, sound played the alert sounds in the System Properties
Sound box, after about a 1 second delay. Also, during the reg. process, (I
had to reinstall), there was a vague tune being played, with cut sounds.
The errors caused seemed to be DMA related. Could someone send me the
changed sources as they are currently, so I can have a look?
Alex Smith
2005-12-24 07:58:26 UTC
Permalink
Still can't remember, but it was something to do with the endian
functions (ppc_bswap_word, ppc_word_to_BE, etc).

The portaudio is Ubuntu's package of it, so unless Ubuntu broke it, it
should work... I'll try to recompile
Post by Jens von der Heydt
Post by Alex Smith
Nope, same error.
Post by Jens von der Heydt
Post by Alex Smith
With regard to the segfaults, I ran ppc with the generic core through
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1589089360 (LWP 26799)]
209 gMouse->handleEvent(ev);
Why on earth would the sound code cause problems with the X11 GUI code??
Strange thing. Does it work with sdl then?
Jens
By the way, you can also use the cp_jitc to debug with gdb
you only have to make sure that the problem you're searching for
is not in the generated jitc - code, then you're fine.
I can not think of anything in this patch that could cause a segfault
other than a portautio - installation that is not linked or compiled
right.
No clue what you did change in the code?
Jens
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Pearpc-devel mailing list
https://lists.sourceforge.net/lists/listinfo/pearpc-devel
Alex Smith
2005-12-24 08:26:51 UTC
Permalink
Right, it's not portaudio - I just compiled and installed portaudio into
a temporary location and linked pearpc against it, and I still get a
segfault
Post by Alex Smith
Still can't remember, but it was something to do with the endian
functions (ppc_bswap_word, ppc_word_to_BE, etc).
The portaudio is Ubuntu's package of it, so unless Ubuntu broke it, it
should work... I'll try to recompile
Post by Jens von der Heydt
Post by Alex Smith
Nope, same error.
Post by Jens von der Heydt
Post by Alex Smith
With regard to the segfaults, I ran ppc with the generic core through
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1589089360 (LWP 26799)]
209 gMouse->handleEvent(ev);
Why on earth would the sound code cause problems with the X11 GUI code??
Strange thing. Does it work with sdl then?
Jens
By the way, you can also use the cp_jitc to debug with gdb
you only have to make sure that the problem you're searching for
is not in the generated jitc - code, then you're fine.
I can not think of anything in this patch that could cause a segfault
other than a portautio - installation that is not linked or compiled
right.
No clue what you did change in the code?
Jens
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Pearpc-devel mailing list
https://lists.sourceforge.net/lists/listinfo/pearpc-devel
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Pearpc-devel mailing list
https://lists.sourceforge.net/lists/listinfo/pearpc-devel
Adeeb Mohammed
2005-12-25 14:01:37 UTC
Permalink
Would the delay be lessened if the sound was run on a seperate thread?.
Jens von der Heydt
2005-12-26 13:24:49 UTC
Permalink
Post by Adeeb Mohammed
Would the delay be lessened if the sound was run on a seperate
thread?.
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through
log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD
SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Pearpc-devel mailing list
https://lists.sourceforge.net/lists/listinfo/pearpc-devel
Sound playback is actually "threaded" through portaudio,
the dma transfer is done in the cpu-thread.

The delay in playback happens because we cannot return
the actual position in the playback buffer. Portaudio does
not support this.


Jens
Max Jakub Ried
2005-12-26 19:53:33 UTC
Permalink
So we have to change the buffer passed to portaudio at everytime a
sound is being played?
Post by Jens von der Heydt
Post by Adeeb Mohammed
Would the delay be lessened if the sound was run on a seperate thread?.
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through
log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD
SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Pearpc-devel mailing list
https://lists.sourceforge.net/lists/listinfo/pearpc-devel
Sound playback is actually "threaded" through portaudio,
the dma transfer is done in the cpu-thread.
The delay in playback happens because we cannot return
the actual position in the playback buffer. Portaudio does
not support this.
Jens
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&opclick
_______________________________________________
Pearpc-devel mailing list
https://lists.sourceforge.net/lists/listinfo/pearpc-devel
Jens von der Heydt
2005-12-26 22:56:57 UTC
Permalink
Post by Max Jakub Ried
So we have to change the buffer passed to portaudio at everytime a
sound is being played?
Well, it depends (tm) :)

The problem with the sound implementation is the way portaudio is run.
There are different ways and Canadacow chose the one currently in the
source.
That is: Portaudio is constantly playing a predefined buffer and the
emulated client
is pushing into this buffer whenever it things it might be necessery,
by requesting
the current playback position. It then starts a new dma transfer that
ends in the
portaudio buffer - therefore we constantly play something that is
sound data
but not at the right time. That's why it jitters and cracks all the
time.

The synchro between client dma transfers and portaudios sound buffer
is nearly
inexistent. We actually need a portaudio (or other lib)
implementation that is
able to tell us the current playback position ... Ok, we could
calculate it with a
startposition etc... Portaudio does support other ways of playback,
maybe something
can be written.

I'm currently testing things with AMD64 and still have to continue
the gfx thing,
so I don't have time for this. A good starting point as a working
example of how
DMA had to be emulated might be the IDE.cc file of pearpc since this
one is
using DMA - and it also seems to work :)

Jens

Loading...