NESDev and Strangulation Records messageboards
Forum Index | FAQ | New User | Login | Search

Previous ThreadView All ThreadsNext ThreadShow in Flat Mode*


SubjectRe: Emulation Sound Quality  
Posted byblargg
Posted on7/28/04 03:29 AM
From IP199.170.89.78  



[...] After spending some time looking at the source I realized that the sample data output by your library is in a 16-bit *signed* format, which was not welcome at all by Allegro. So, I decided to use another sound library to output the data, namely PortAudio, which seems to work quite well.

Just about everything I've encountered uses signed samples when they are 16 bits (8 bit samples are common in both formats). If you use unsigned you've got to add a compensation offset when adding or multiplying samples. This function swaps between signed and unsigned representation:

    void toggle_signedness( int16_t* p, size_t s ) {
while ( s-- ) {
*p ^= 0x8000;
++p;
//*p++ ^= 0x8000; // might trigger obscure compiler bugs :)
}
}

Is there any way you could output samples in an unsigned manner?

Convert the buffer in-place; the only downside is the tiny performance hit. Blip_Reader allows inline reading from a Blip_Buffer, but it's much less friendly and not well documented yet. Blip_Reader will be better documented in a future release.

How can I find out the amount of cycles "stolen" (killed, murdered, whatever) by the DMC unit as it fetches sample data? Also, is there any way of knowing the exact time (timestamp) at which those cycles were stolen? Or, do you think all of this is not needed at all?

I measured 4 CPU cycles stolen by a DMC memory read (see the APU reference), which you can account for when your DMC reader callback is invoked. Regarding adjustment of the CPU, I'm going to start a new thread for the issue since it's involved.




-
Entire Thread
Subject  Posted byPosted On
*Emulation Sound Quality  blargg7/3/04 12:43 PM
.*Re: Emulation Sound Quality  blargg8/14/04 04:18 AM
.*Re: Emulation Sound Quality  <_Hyde_>7/27/04 5:13 PM
...Re: Emulation Sound Quality  blargg7/28/04 03:29 AM
...*Re: Emulation Sound Quality  <_Hyde_>7/28/04 7:45 PM
..*Signed audio  tepples7/28/04 00:07 AM
...*Re: Signed audio  <_Hyde_>7/28/04 7:47 PM
.*Re: Emulation Sound Quality  blargg7/19/04 5:35 PM
..*Re: Emulation Sound Quality  Jsr7/19/04 8:34 PM
..*Re: Emulation Sound Quality  Richter X7/19/04 6:42 PM
...*Re: Emulation Sound Quality  blargg7/20/04 07:40 AM
....*Re: Emulation Sound Quality  blargg7/21/04 12:42 PM
....*Re: Emulation Sound Quality  Jsr7/20/04 8:29 PM
....*FM  tepples7/20/04 3:29 PM
.....*Re: FM  blargg7/24/04 02:18 AM
......*Re: FM  Richter X7/24/04 02:53 AM
.......*Re: FM  Disch7/24/04 03:07 AM
........*Re: FM  blargg7/24/04 09:36 AM
......*Re: FM  Fx37/24/04 02:31 AM
.*Re: Emulation Sound Quality  Disch7/10/04 04:37 AM
..*Re: Emulation Sound Quality  blargg7/10/04 10:17 AM
...*Re: Emulation Sound Quality  Disch7/10/04 10:29 PM
....*One more Q  Disch7/10/04 11:08 PM
.*Re: Emulation Sound Quality  koitsu7/8/04 02:16 AM
.*Re: Emulation Sound Quality  Drilian7/7/04 7:50 PM
..*Re: Emulation Sound Quality  Drilian7/8/04 3:35 PM
...*Re: Emulation Sound Quality  blargg7/10/04 03:29 AM
....*Re: Emulation Sound Quality  koitsu7/10/04 04:16 AM
.....*Re: Win32 tracker  Bloopaws7/10/04 11:54 AM
......*Re: Win32 tracker  tepples7/15/04 2:05 PM
.......*Re: Win32 tracker  dXtr7/15/04 8:08 PM
...*Re: Emulation Sound Quality  koitsu7/8/04 6:12 PM
Jump to

Memblers' homepage             Contact Me

Forums powered by WWWThreads Demo