scopeapp-cvs Mailing List for MacCRO X
Status: Alpha
Brought to you by:
narge
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(8) |
Jul
(52) |
Aug
(3) |
Sep
|
Oct
(7) |
Nov
(1) |
Dec
(31) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(10) |
Feb
(75) |
Mar
|
Apr
(17) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(11) |
Dec
|
From: <sco...@li...> - 2003-11-16 12:11:24
|
Update of /cvsroot/scopeapp/scopeapp/MacCRO X.pbproj In directory sc8-pr-cvs1:/tmp/cvs-serv3514/MacCRO X.pbproj Modified Files: project.pbxproj Log Message: Fixed up a few problems with the new XCode project |
From: <sco...@li...> - 2003-11-16 07:00:20
|
Update of /cvsroot/scopeapp/scopeapp/src In directory sc8-pr-cvs1:/tmp/cvs-serv26460/src Modified Files: XYPlotView.m Log Message: Fixed trivial scaling bug, something still seems wrong though Index: XYPlotView.m =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/src/XYPlotView.m,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** XYPlotView.m 14 Feb 2003 11:57:33 -0000 1.12 --- XYPlotView.m 16 Nov 2003 06:59:37 -0000 1.13 *************** *** 106,110 **** curX = 0.5 + (myDisplayData[0][0] * theScaleFactor[0]); ! curY = 0.5 + (myDisplayData[1][0] * theScaleFactor[0]); [myTracePaths[0] addPoint: NSMakePoint(curX, curY)]; --- 106,110 ---- curX = 0.5 + (myDisplayData[0][0] * theScaleFactor[0]); ! curY = 0.5 + (myDisplayData[1][0] * theScaleFactor[1]); [myTracePaths[0] addPoint: NSMakePoint(curX, curY)]; *************** *** 114,118 **** { curX = 0.5 + (myDisplayData[0][curSample] * theScaleFactor[0]); ! curY = 0.5 + (myDisplayData[1][curSample] * theScaleFactor[0]); [myTracePaths[0] addPoint: NSMakePoint(curX, curY)]; } --- 114,118 ---- { curX = 0.5 + (myDisplayData[0][curSample] * theScaleFactor[0]); ! curY = 0.5 + (myDisplayData[1][curSample] * theScaleFactor[1]); [myTracePaths[0] addPoint: NSMakePoint(curX, curY)]; } |
From: <sco...@li...> - 2003-11-16 07:00:20
|
Update of /cvsroot/scopeapp/scopeapp In directory sc8-pr-cvs1:/tmp/cvs-serv26460 Modified Files: ChangeLog Log Message: Fixed trivial scaling bug, something still seems wrong though Index: ChangeLog =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/ChangeLog,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** ChangeLog 16 Nov 2003 06:35:13 -0000 1.24 --- ChangeLog 16 Nov 2003 06:59:37 -0000 1.25 *************** *** 1,4 **** --- 1,7 ---- 2003-11-16 Philip Derrin <na...@us...> + * src/XYPlotView.m: + Fixed trivial scaling bug, something still seems wrong though + * Info.plist, src/scopeapp_prefix.pch: Added as part of update to XCode |
From: <sco...@li...> - 2003-11-16 06:35:56
|
Update of /cvsroot/scopeapp/scopeapp In directory sc8-pr-cvs1:/tmp/cvs-serv23960 Modified Files: ChangeLog Log Message: Added as part of update to XCode Index: ChangeLog =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/ChangeLog,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** ChangeLog 16 Nov 2003 04:09:20 -0000 1.23 --- ChangeLog 16 Nov 2003 06:35:13 -0000 1.24 *************** *** 1,4 **** --- 1,7 ---- 2003-11-16 Philip Derrin <na...@us...> + * Info.plist, src/scopeapp_prefix.pch: + Added as part of update to XCode + * src/TraceView.m: Fixed a bug caused by multiple trace-views calling -startSampling |
From: <sco...@li...> - 2003-11-16 06:35:53
|
Update of /cvsroot/scopeapp/scopeapp/src In directory sc8-pr-cvs1:/tmp/cvs-serv23960/src Added Files: scopeapp_prefix.pch Log Message: Added as part of update to XCode --- NEW FILE: scopeapp_prefix.pch --- #ifdef __OBJC__ #include <Cocoa/Cocoa.h> #endif |
From: <sco...@li...> - 2003-11-16 06:34:50
|
Update of /cvsroot/scopeapp/scopeapp/MacCRO X.pbproj In directory sc8-pr-cvs1:/tmp/cvs-serv23739 Modified Files: project.pbxproj Log Message: Again, update to XCode, but properly this time |
From: <sco...@li...> - 2003-11-16 06:33:04
|
Update of /cvsroot/scopeapp/scopeapp In directory sc8-pr-cvs1:/tmp/cvs-serv23347 Added Files: Info.plist Log Message: New Info.plist for XCode --- NEW FILE: Info.plist --- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>English</string> <key>CFBundleExecutable</key> <string>MacCRO X</string> <key>CFBundleIconFile</key> <string></string> <key>CFBundleIdentifier</key> <string>net.sourceforge.scopeapp.MacCRO X</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleSignature</key> <string>MDSo</string> <key>CFBundleVersion</key> <string>0.1.3</string> <key>NSMainNibFile</key> <string>MainMenu</string> <key>NSPrincipalClass</key> <string>NSApplication</string> </dict> </plist> |
From: <sco...@li...> - 2003-11-16 04:10:03
|
Update of /cvsroot/scopeapp/scopeapp/src In directory sc8-pr-cvs1:/tmp/cvs-serv5213/src Modified Files: TraceView.m Log Message: Fixed a bug caused by multiple TraceViews calling -startSampling on the sampler without calling -stopSampling Index: TraceView.m =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/src/TraceView.m,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** TraceView.m 23 Apr 2003 06:28:48 -0000 1.20 --- TraceView.m 16 Nov 2003 04:09:20 -0000 1.21 *************** *** 238,242 **** { if(mySampler != nil) { - [mySampler stopSampling]; [mySampler setOwner: nil]; [mySampler release]; --- 238,241 ---- *************** *** 251,256 **** [self updateControls]; - [mySampler startSampling]; - return [self startDrawing]; } --- 250,253 ---- *************** *** 272,275 **** --- 269,275 ---- [NSThread detachNewThreadSelector: @selector(displayThread:) toTarget: self withObject: nil]; + + // start the sampler + [mySampler startSampling]; return self; *************** *** 287,290 **** --- 287,293 ---- [myDrawThreadState unlockWithCondition: kDrawThreadStopped]; + // stop the sampler + [mySampler stopSampling]; + return self; } |
From: <sco...@li...> - 2003-11-16 04:10:02
|
Update of /cvsroot/scopeapp/scopeapp In directory sc8-pr-cvs1:/tmp/cvs-serv5213 Modified Files: ChangeLog Log Message: Fixed a bug caused by multiple TraceViews calling -startSampling on the sampler without calling -stopSampling Index: ChangeLog =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/ChangeLog,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** ChangeLog 16 Nov 2003 04:07:30 -0000 1.22 --- ChangeLog 16 Nov 2003 04:09:20 -0000 1.23 *************** *** 1,4 **** --- 1,8 ---- 2003-11-16 Philip Derrin <na...@us...> + * src/TraceView.m: + Fixed a bug caused by multiple trace-views calling -startSampling + on the sampler without calling -stopSampling + * MacCRO X.pbproj: Updated to XCode |
From: <sco...@li...> - 2003-11-16 04:08:21
|
Update of /cvsroot/scopeapp/scopeapp In directory sc8-pr-cvs1:/tmp/cvs-serv4988 Modified Files: ChangeLog Log Message: Updated to XCode Index: ChangeLog =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/ChangeLog,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** ChangeLog 25 Apr 2003 07:33:20 -0000 1.21 --- ChangeLog 16 Nov 2003 04:07:30 -0000 1.22 *************** *** 1,2 **** --- 1,7 ---- + 2003-11-16 Philip Derrin <na...@us...> + + * MacCRO X.pbproj: + Updated to XCode + 2003-04-25 Philip Derrin <na...@us...> |
From: <sco...@li...> - 2003-11-16 04:08:21
|
Update of /cvsroot/scopeapp/scopeapp/MacCRO X.pbproj In directory sc8-pr-cvs1:/tmp/cvs-serv4988/MacCRO X.pbproj Modified Files: project.pbxproj Log Message: Updated to XCode |
From: <sco...@li...> - 2003-04-25 07:38:37
|
Update of /cvsroot/scopeapp/scopeapp/English.lproj In directory sc8-pr-cvs1:/tmp/cvs-serv20863/English.lproj Modified Files: Localizable.strings Log Message: Update Localizble.strings with PortAudioSampler error message strings. Index: Localizable.strings =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/English.lproj/Localizable.strings,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Localizable.strings 2 Feb 2003 10:23:15 -0000 1.5 --- Localizable.strings 25 Apr 2003 07:38:28 -0000 1.6 *************** *** 1,6 **** ! /** CoreAudioSampler.m **/ ! /** main.m **/ --- 1,17 ---- ! /** main.m **/ ! /** PortAudioSampler.m **/ ! ! "Couldn't start recording sound." = "Couldn't start recording sound."; ! "PortAudio returned error: %s" = "PortAudio returned error: %s"; ! "OK" = "OK"; ! "Couldn't stop recording sound." = "Couldn't stop recording sound."; ! "Couldn't open sound input device." = "Couldn't open sound input device."; ! "Couldn't find sound input device." = "Couldn't find sound input device."; ! "Select a sound input device in the Sound panel of System Preferences." = "Select a sound input device in the Sound panel of System Preferences."; ! "Make sure your sound card is configured correctly." = "Make sure your sound card is configured correctly."; ! ! /** ScopeAppDefaults.m **/ *************** *** 14,18 **** --- 25,35 ---- + /** SpectrumView.m **/ + + /** TestSampler.m **/ + + + /** TracePath.m **/ |
From: <sco...@li...> - 2003-04-25 07:34:04
|
Update of /cvsroot/scopeapp/scopeapp/MacCRO X.pbproj In directory sc8-pr-cvs1:/tmp/cvs-serv19499/MacCRO X.pbproj Modified Files: project.pbxproj Log Message: Disable TestSampler. |
From: <sco...@li...> - 2003-04-25 07:33:26
|
Update of /cvsroot/scopeapp/scopeapp In directory sc8-pr-cvs1:/tmp/cvs-serv19353 Modified Files: ChangeLog Log Message: Made the control window an ordinary non-floating window. Index: ChangeLog =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/ChangeLog,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** ChangeLog 25 Apr 2003 07:30:59 -0000 1.20 --- ChangeLog 25 Apr 2003 07:33:20 -0000 1.21 *************** *** 1,4 **** --- 1,7 ---- 2003-04-25 Philip Derrin <na...@us...> + * English.lproj/ScopeWindow.nib: + Made the control window an ordinary non-floating window. + * src/ScopeController.m (-initWithSamplerClass:), src/ScopeController.h, src/ScopeAppDelegate.m: |
From: <sco...@li...> - 2003-04-25 07:33:26
|
Update of /cvsroot/scopeapp/scopeapp/English.lproj/ScopeWindow.nib In directory sc8-pr-cvs1:/tmp/cvs-serv19353/English.lproj/ScopeWindow.nib Modified Files: info.nib objects.nib Log Message: Made the control window an ordinary non-floating window. Index: info.nib =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/English.lproj/ScopeWindow.nib/info.nib,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** info.nib 20 Feb 2003 02:26:55 -0000 1.9 --- info.nib 25 Apr 2003 07:33:21 -0000 1.10 *************** *** 9,17 **** <key>IBOpenObjects</key> <array> - <integer>25</integer> <integer>5</integer> </array> <key>IBSystem Version</key> ! <string>6H28</string> </dict> </plist> --- 9,17 ---- <key>IBOpenObjects</key> <array> <integer>5</integer> + <integer>25</integer> </array> <key>IBSystem Version</key> ! <string>6L29</string> </dict> </plist> Index: objects.nib =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/English.lproj/ScopeWindow.nib/objects.nib,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 Binary files /tmp/cvsGc7ewh and /tmp/cvs4e0OXq differ |
From: <sco...@li...> - 2003-04-25 07:31:42
|
Update of /cvsroot/scopeapp/scopeapp In directory sc8-pr-cvs1:/tmp/cvs-serv18754 Modified Files: ChangeLog Log Message: Make ScopeController take a class of input sampler to create, not an actual input sampler object; this allows the input sampler's error messages to be displayed in a more sensible manner, using a sheet on the scope window. Index: ChangeLog =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/ChangeLog,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ChangeLog 25 Apr 2003 07:27:31 -0000 1.19 --- ChangeLog 25 Apr 2003 07:30:59 -0000 1.20 *************** *** 1,4 **** --- 1,11 ---- 2003-04-25 Philip Derrin <na...@us...> + * src/ScopeController.m (-initWithSamplerClass:), + src/ScopeController.h, src/ScopeAppDelegate.m: + Make ScopeController take a class of input sampler to create, not an + actual input sampler object; this allows the input sampler's error + messages to be displayed in a more sensible manner, using a sheet on + the scope window. + * src/PortAudioSampler.m (-initPortAudio, -init, -startSampling, -stopSampling), src/PortAudioSampler.h: |
From: <sco...@li...> - 2003-04-25 07:31:26
|
Update of /cvsroot/scopeapp/scopeapp/src In directory sc8-pr-cvs1:/tmp/cvs-serv18754/src Modified Files: ScopeController.h ScopeController.m ScopeAppDelegate.m Log Message: Make ScopeController take a class of input sampler to create, not an actual input sampler object; this allows the input sampler's error messages to be displayed in a more sensible manner, using a sheet on the scope window. Index: ScopeController.h =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/src/ScopeController.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ScopeController.h 5 Feb 2003 12:55:38 -0000 1.9 --- ScopeController.h 25 Apr 2003 07:31:09 -0000 1.10 *************** *** 26,29 **** --- 26,30 ---- #import <AppKit/AppKit.h> + #import "InputSampler.h" #import "ScopeView.h" #import "SpectrumView.h" *************** *** 31,35 **** //#import "WaterfallView.h" ! @interface ScopeController : NSWindowController { IBOutlet ScopeView* myScopeView; IBOutlet SpectrumView* mySpectrumView; --- 32,36 ---- //#import "WaterfallView.h" ! @interface ScopeController : NSWindowController <InputErrorHandler> { IBOutlet ScopeView* myScopeView; IBOutlet SpectrumView* mySpectrumView; *************** *** 42,48 **** @private id <InputSampler, NSObject> mySampler; } ! -(id) initWithSampler: (id <InputSampler, NSObject>) sampler; -(void) windowBecameMain: (id) notification; --- 43,50 ---- @private id <InputSampler, NSObject> mySampler; + Class mySamplerClass; } ! -(id) initWithSamplerClass: (Class) samplerClass; -(void) windowBecameMain: (id) notification; Index: ScopeController.m =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/src/ScopeController.m,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ScopeController.m 14 Feb 2003 11:52:55 -0000 1.14 --- ScopeController.m 25 Apr 2003 07:31:16 -0000 1.15 *************** *** 37,41 **** @implementation ScopeController ! -(id) initWithSampler: (id <InputSampler, NSObject>) sampler { self = [super initWithWindowNibName: @"ScopeWindow"]; --- 37,41 ---- @implementation ScopeController ! -(id) initWithSamplerClass: (Class) samplerClass { self = [super initWithWindowNibName: @"ScopeWindow"]; *************** *** 45,50 **** NSNotificationCenter *nCenter; ! mySampler = sampler; ! [mySampler retain]; nCenter = [NSNotificationCenter defaultCenter]; --- 45,49 ---- NSNotificationCenter *nCenter; ! mySamplerClass = samplerClass; nCenter = [NSNotificationCenter defaultCenter]; *************** *** 60,73 **** -(void) windowDidLoad { - [[self window] orderFront: self]; - [myScopeView retain]; [myXYPlotView retain]; [mySpectrumView retain]; [myControlPanel retain]; ! [myControlPanel orderWindow: NSWindowAbove relativeTo: [[self window] windowNumber]]; // make sure the oscilloscope tab is selected, then // display the oscilloscope; don't set the delegate until --- 59,76 ---- -(void) windowDidLoad { [myScopeView retain]; [myXYPlotView retain]; [mySpectrumView retain]; [myControlPanel retain]; ! ! [[self window] orderFront: self]; ! [myControlPanel orderWindow: NSWindowAbove relativeTo: [[self window] windowNumber]]; + mySampler = [[mySamplerClass alloc] + initWithOwner: nil + withErrorHandler: self]; + // make sure the oscilloscope tab is selected, then // display the oscilloscope; don't set the delegate until *************** *** 160,163 **** --- 163,187 ---- [myControlPanel orderWindow: NSWindowAbove relativeTo: [[self window] windowNumber]]; + } + + -(int) displayError: (NSString*) title + withExtraText: (NSString*) subtitle + withDefaultButton: (NSString*) defaultButton + withCancelButton: (NSString*) cancelButton + isFatal: (BOOL) fatal; + { + SEL sheetClosedHandler = fatal ? @selector(handleFatalError) : nil; + + NSLog(@"Displaying error message..."); + NSBeginAlertSheet(title, defaultButton, cancelButton, nil, + [self window], self, nil, sheetClosedHandler, NULL, subtitle); + + return 0; + } + + - (void) handleFatalError + { + // send a close action to the window; this will call all the appropriate // methods to deallocate everything. + [[self window] close]; } Index: ScopeAppDelegate.m =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/src/ScopeAppDelegate.m,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ScopeAppDelegate.m 5 Feb 2003 12:56:14 -0000 1.19 --- ScopeAppDelegate.m 25 Apr 2003 07:31:18 -0000 1.20 *************** *** 37,54 **** { ScopeController* controller; ! id sampler; // FIXME choose an appropriate InputSampler ! sampler = [[PortAudioSampler alloc] init]; ! if(sampler) ! { ! // FIXME eventually this program will be (sort of) document-based, ! // with an NSDocumentController keeping track of all the existing ! // ScopeControllers and their associated windows. For now, just ! // create a ScopeController and let it take care of itself ! controller = [[ScopeController alloc] initWithSampler: sampler]; ! //[controller autorelease]; ! } myLicenseWindow = nil; --- 37,52 ---- { ScopeController* controller; ! Class samplerClass; // FIXME choose an appropriate InputSampler ! samplerClass = [PortAudioSampler class]; ! // FIXME eventually this program will be (sort of) document-based, ! // with an NSDocumentController keeping track of all the existing ! // ScopeControllers and their associated windows. For now, just ! // create a ScopeController and let it take care of itself ! controller = [[ScopeController alloc] ! initWithSamplerClass: samplerClass]; ! //[controller autorelease]; myLicenseWindow = nil; |
From: <sco...@li...> - 2003-04-25 07:27:35
|
Update of /cvsroot/scopeapp/scopeapp/src In directory sc8-pr-cvs1:/tmp/cvs-serv17938/src Modified Files: PortAudioSampler.h PortAudioSampler.m Log Message: Use the new InputErrorHandler protocol in PortAudioSampler; display sensible error messages when an error occurs (rather than just using NSLog). Index: PortAudioSampler.h =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/src/PortAudioSampler.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PortAudioSampler.h 5 Dec 2002 15:03:37 -0000 1.1 --- PortAudioSampler.h 25 Apr 2003 07:27:31 -0000 1.2 *************** *** 33,36 **** --- 33,37 ---- // InputSampler data id <InputHandler, NSObject> myOwner; + id <InputErrorHandler, NSObject> myErrorHandler; int myBlockSize; float mySampleRate; *************** *** 42,49 **** } - -(id) init; - // init a sampler with a given owner object ! -(id) initWithOwner: (id <InputHandler>) owner; -(void) dealloc; --- 43,49 ---- } // init a sampler with a given owner object ! -(id) initWithOwner: (id <InputHandler>) owner ! withErrorHandler: (id <InputErrorHandler, NSObject>) errorHandler; -(void) dealloc; Index: PortAudioSampler.m =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/src/PortAudioSampler.m,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PortAudioSampler.m 5 Dec 2002 15:03:38 -0000 1.1 --- PortAudioSampler.m 25 Apr 2003 07:27:32 -0000 1.2 *************** *** 26,29 **** --- 26,30 ---- #import "PortAudioSampler.h" + #import "ScopeAppGlobals.h" #import <AppKit/AppKit.h> *************** *** 48,58 **** @implementation PortAudioSampler - -(id) init - { - return [self initWithOwner: nil]; - } - // init a sampler with a given owner object -(id) initWithOwner: (id <InputHandler, NSObject>) owner { if(gPASamplerExists) return nil; --- 49,55 ---- @implementation PortAudioSampler // init a sampler with a given owner object -(id) initWithOwner: (id <InputHandler, NSObject>) owner + withErrorHandler: (id <InputErrorHandler, NSObject>) errorHandler { if(gPASamplerExists) return nil; *************** *** 65,68 **** --- 62,68 ---- if(myOwner) { [myOwner retain]; } + myErrorHandler = errorHandler; + if(myErrorHandler) { [myErrorHandler retain]; } + mySamplerRunning = NO; *************** *** 88,91 **** --- 88,92 ---- if(myOwner != nil) { [myOwner release]; } + if(myErrorHandler != nil) { [myErrorHandler release]; } [super dealloc]; *************** *** 120,126 **** --- 121,138 ---- status = Pa_StartStream(myStream); + if (status) { NSLog(@"Pa_StartStream: returned %d (%s)", status, Pa_GetErrorText(status)); + + [myErrorHandler displayError: _(@"Couldn't start recording sound.") + withExtraText: [NSString stringWithFormat: + _(@"PortAudio returned error: %s"), + Pa_GetErrorText(status)] + withDefaultButton: _(@"OK") + withCancelButton: nil isFatal: YES]; + + mySamplerRunning = NO; + return nil; } *************** *** 140,143 **** --- 152,165 ---- NSLog(@"Pa_StopStream: returned %d (%s)", status, Pa_GetErrorText(status)); + + [myErrorHandler displayError: _(@"Couldn't stop recording sound.") + withExtraText: [NSString stringWithFormat: + _(@"PortAudio returned error: %s"), + Pa_GetErrorText(status)] + withDefaultButton: _(@"OK") + withCancelButton: nil isFatal: NO]; + + mySamplerRunning = YES; + return nil; } *************** *** 215,220 **** status = Pa_Initialize(); if (status) { ! NSLog(@"Pa_StartStream: returned %d (%s)", status, Pa_GetErrorText(status)); return nil; } --- 237,250 ---- status = Pa_Initialize(); if (status) { ! NSLog(@"Pa_Initialize: returned %d (%s)", status, Pa_GetErrorText(status)); + + [myErrorHandler displayError: _(@"Couldn't open sound input device.") + withExtraText: [NSString stringWithFormat: + _(@"PortAudio returned error: %s"), + Pa_GetErrorText(status)] + withDefaultButton: _(@"OK") + withCancelButton: nil isFatal: YES]; + return nil; } *************** *** 224,227 **** --- 254,265 ---- if(inputDevice == paNoDevice) { NSLog(@"Pa_GetDefaultInputDeviceID: returned paNoDevice"); + [myErrorHandler displayError: _(@"Couldn't find sound input device.") + #if __APPLE__ + withExtraText: _(@"Select a sound input device in the Sound panel of System Preferences.") + #else + withExtraText: _(@"Make sure your sound card is configured correctly.") + #endif + withDefaultButton: _(@"OK") + withCancelButton: nil isFatal: YES]; Pa_Terminate(); return nil; *************** *** 263,266 **** --- 301,312 ---- NSLog(@"Pa_OpenStream: returned %d (%s)", status, Pa_GetErrorText(status)); + + [myErrorHandler displayError: _(@"Couldn't open sound input device.") + withExtraText: [NSString stringWithFormat: + _(@"PortAudio returned error: %s"), + Pa_GetErrorText(status)] + withDefaultButton: _(@"OK") + withCancelButton: nil isFatal: YES]; + Pa_Terminate(); return nil; |
From: <sco...@li...> - 2003-04-25 07:27:34
|
Update of /cvsroot/scopeapp/scopeapp In directory sc8-pr-cvs1:/tmp/cvs-serv17938 Modified Files: ChangeLog Log Message: Use the new InputErrorHandler protocol in PortAudioSampler; display sensible error messages when an error occurs (rather than just using NSLog). Index: ChangeLog =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/ChangeLog,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ChangeLog 25 Apr 2003 07:23:50 -0000 1.18 --- ChangeLog 25 Apr 2003 07:27:31 -0000 1.19 *************** *** 1,4 **** --- 1,10 ---- 2003-04-25 Philip Derrin <na...@us...> + * src/PortAudioSampler.m (-initPortAudio, -init, -startSampling, + -stopSampling), src/PortAudioSampler.h: + Use the new InputErrorHandler protocol in PortAudioSampler; display + sensible error messages when an error occurs (rather than just using + NSLog). + * src/InputSampler.h: Add a new InputErrorHandler protocol, containing a function to display |
From: <sco...@li...> - 2003-04-25 07:23:53
|
Update of /cvsroot/scopeapp/scopeapp/src In directory sc8-pr-cvs1:/tmp/cvs-serv17167/src Modified Files: InputSampler.h Log Message: Add a new InputErrorHandler protocol, containing a function to display error messages and (if necessary) close the input handler and the objects using it. Index: InputSampler.h =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/src/InputSampler.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** InputSampler.h 5 Dec 2002 15:08:10 -0000 1.6 --- InputSampler.h 25 Apr 2003 07:23:50 -0000 1.7 *************** *** 46,49 **** --- 46,62 ---- @end + @protocol InputErrorHandler + + // Display an alert when the InputSampler has encountered an error. + // If fatal, the InputHandler should destroy the InputSampler and exit + // when the error has finished displaying. + -(int) displayError: (NSString*) title + withExtraText: (NSString*) subtitle + withDefaultButton: (NSString*) defaultButton + withCancelButton: (NSString*) cancelButton + isFatal: (BOOL) fatal; + + @end + // ********** // Protocol for an object which samples sound data *************** *** 51,56 **** @protocol InputSampler ! // init a sampler with a given owner object ! -(id) initWithOwner: (id <InputHandler, NSObject>) owner; // return YES if the sampler has an input settings dialog it can show --- 64,70 ---- @protocol InputSampler ! // init a sampler with a given owner object, and an object which handles errors ! -(id) initWithOwner: (id <InputHandler, NSObject>) owner ! withErrorHandler: (id <InputErrorHandler, NSObject>) errorHandler; // return YES if the sampler has an input settings dialog it can show |
From: <sco...@li...> - 2003-04-25 07:23:53
|
Update of /cvsroot/scopeapp/scopeapp In directory sc8-pr-cvs1:/tmp/cvs-serv17167 Modified Files: ChangeLog Log Message: Add a new InputErrorHandler protocol, containing a function to display error messages and (if necessary) close the input handler and the objects using it. Index: ChangeLog =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/ChangeLog,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ChangeLog 25 Apr 2003 07:19:54 -0000 1.17 --- ChangeLog 25 Apr 2003 07:23:50 -0000 1.18 *************** *** 1,2 **** --- 1,9 ---- + 2003-04-25 Philip Derrin <na...@us...> + + * src/InputSampler.h: + Add a new InputErrorHandler protocol, containing a function to display + error messages and (if necessary) close the input handler and the + objects using it. + 2003-04-23 Philip Derrin <na...@us...> |
From: <sco...@li...> - 2003-04-25 07:19:57
|
Update of /cvsroot/scopeapp/scopeapp In directory sc8-pr-cvs1:/tmp/cvs-serv15843 Modified Files: ChangeLog Log Message: ChangeLog entries for April 23rd. Index: ChangeLog =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/ChangeLog,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ChangeLog 20 Feb 2003 13:07:02 -0000 1.16 --- ChangeLog 25 Apr 2003 07:19:54 -0000 1.17 *************** *** 1,2 **** --- 1,12 ---- + 2003-04-23 Philip Derrin <na...@us...> + + * src/TraceView.m (-displayRect:, -displayThread:): + Moved -updateCaptions call into -displayRect: to fix a crash caused by + the display thread updating a caption while it was being drawn. + + * src/portaudio: + Updated all files to the current v18-branch version from the PortAudio + CVS repository. + 2003-02-20 Philip Derrin <na...@us...> |
From: <sco...@li...> - 2003-04-23 06:28:52
|
Update of /cvsroot/scopeapp/scopeapp/src In directory sc8-pr-cvs1:/tmp/cvs-serv15398 Modified Files: TraceView.m Log Message: Fix crash due to thread-safety issue with text fields (captions are now updated only in the main thread, just before drawing) Index: TraceView.m =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/src/TraceView.m,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** TraceView.m 20 Feb 2003 12:51:32 -0000 1.19 --- TraceView.m 23 Apr 2003 06:28:48 -0000 1.20 *************** *** 112,115 **** --- 112,117 ---- BOOL wasAntiAliased; + [self updateCaptions]; + NSAffineTransform* scaling = [NSAffineTransform transform]; *************** *** 501,505 **** [self updateDisplay: 0]; [self updateDisplay: 1]; - [self updateCaptions]; [self display]; --- 503,506 ---- |
From: <sco...@li...> - 2003-04-23 06:26:38
|
Update of /cvsroot/scopeapp/scopeapp/MacCRO X.pbproj In directory sc8-pr-cvs1:/tmp/cvs-serv14812/MacCRO X.pbproj Modified Files: project.pbxproj Log Message: Add ringbuffer.c (needed by v18-patch version of pa_mac_core.c) |
From: <sco...@li...> - 2003-04-23 06:24:51
|
Update of /cvsroot/scopeapp/scopeapp/src/portaudio/pa_common In directory sc8-pr-cvs1:/tmp/cvs-serv13792/pa_common Modified Files: pa_convert.c pa_host.h pa_lib.c pa_trace.c pa_trace.h portaudio.h Log Message: Update portaudio to v18-patch (checked out 23/04/03) Index: pa_convert.c =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/src/portaudio/pa_common/pa_convert.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pa_convert.c 5 Dec 2002 14:46:42 -0000 1.1 --- pa_convert.c 23 Apr 2003 06:24:17 -0000 1.2 *************** *** 1,402 **** ! /* ! * pa_conversions.c ! * portaudio ! * ! * Created by Phil Burk on Mon Mar 18 2002. ! * ! */ ! #include <stdio.h> ! ! #include "portaudio.h" ! #include "pa_host.h" ! ! #define CLIP( val, min, max ) { val = ((val) < (min)) ? min : (((val) < (max)) ? (max) : (val)); } ! ! /*************************************************************************/ ! static void PaConvert_Float32_Int16( ! float *sourceBuffer, int sourceStride, ! short *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! short samp = (short) (*sourceBuffer * (32767.0f)); ! *targetBuffer = samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! /*************************************************************************/ ! static void PaConvert_Float32_Int16_Clip( ! float *sourceBuffer, int sourceStride, ! short *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! long samp = (long) (*sourceBuffer * (32767.0f)); ! CLIP( samp, -0x8000, 0x7FFF ); ! *targetBuffer = (short) samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! /*************************************************************************/ ! static void PaConvert_Float32_Int16_ClipDither( ! float *sourceBuffer, int sourceStride, ! short *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! // use smaller scaler to prevent overflow when we add the dither ! float dither = PaConvert_TriangularDither() * PA_DITHER_SCALE; ! float dithered = (*sourceBuffer * (32766.0f)) + dither; ! long samp = (long) dithered; ! CLIP( samp, -0x8000, 0x7FFF ); ! *targetBuffer = (short) samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! /*************************************************************************/ ! static void PaConvert_Float32_Int16_Dither( ! float *sourceBuffer, int sourceStride, ! short *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! // use smaller scaler to prevent overflow when we add the dither ! float dither = PaConvert_TriangularDither() * PA_DITHER_SCALE; ! float dithered = (*sourceBuffer * (32766.0f)) + dither; ! *targetBuffer = (short) dithered; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! ! /*************************************************************************/ ! static void PaConvert_Int16_Float32( ! short *sourceBuffer, int sourceStride, ! float *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! float samp = *sourceBuffer * (1.0f / 32768.0f); ! *targetBuffer = samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! /*************************************************************************/ ! static void PaConvert_Float32_Int8( ! float *sourceBuffer, int sourceStride, ! char *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! char samp = (char) (*sourceBuffer * (127.0)); ! *targetBuffer = samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! ! /*************************************************************************/ ! static void PaConvert_Float32_Int8_Clip( ! float *sourceBuffer, int sourceStride, ! char *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! long samp = *sourceBuffer * 127.0f; ! CLIP( samp, -0x80, 0x7F ); ! *targetBuffer = (char) samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! /*************************************************************************/ ! static void PaConvert_Float32_Int8_ClipDither( ! float *sourceBuffer, int sourceStride, ! char *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! // use smaller scaler to prevent overflow when we add the dither ! float dither = PaConvert_TriangularDither() * PA_DITHER_SCALE; ! float dithered = (*sourceBuffer * (126.0f)) + dither; ! long samp = (long) dithered; ! CLIP( samp, -0x80, 0x7F ); ! *targetBuffer = (char) samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! /*************************************************************************/ ! static void PaConvert_Float32_Int8_Dither( ! float *sourceBuffer, int sourceStride, ! char *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! // use smaller scaler to prevent overflow when we add the dither ! float dither = PaConvert_TriangularDither() * PA_DITHER_SCALE; //FIXME ! float dithered = (*sourceBuffer * (126.0f)) + dither; ! long samp = (long) dithered; ! *targetBuffer = (char) samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! /*************************************************************************/ ! static void PaConvert_Int8_Float32( ! char *sourceBuffer, int sourceStride, ! float *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! float samp = *sourceBuffer * (1.0f / 128.0f); ! *targetBuffer = samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! /*************************************************************************/ ! static void PaConvert_Float32_UInt8( ! float *sourceBuffer, int sourceStride, ! unsigned char *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! unsigned char samp = 128 + (unsigned char) (*sourceBuffer * (127.0)); ! *targetBuffer = samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! /*************************************************************************/ ! static void PaConvert_UInt8_Float32( ! unsigned char *sourceBuffer, int sourceStride, ! float *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! float samp = (*sourceBuffer - 128) * (1.0f / 128.0f); ! *targetBuffer = samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! /*************************************************************************/ ! static PortAudioConverter *PaConvert_SelectProc( PaSampleFormat sourceFormat, ! PaSampleFormat targetFormat, int ifClip, int ifDither ) ! { ! PortAudioConverter *proc = NULL; ! switch( sourceFormat ) ! { ! case paUInt8: ! switch( targetFormat ) ! { ! case paFloat32: ! proc = (PortAudioConverter *) PaConvert_UInt8_Float32; ! break; ! default: ! break; ! } ! break; ! case paInt8: ! switch( targetFormat ) ! { ! case paFloat32: ! proc = (PortAudioConverter *) PaConvert_Int8_Float32; ! break; ! default: ! break; ! } ! break; ! case paInt16: ! switch( targetFormat ) ! { ! case paFloat32: ! proc = (PortAudioConverter *) PaConvert_Int16_Float32; ! break; ! default: ! break; ! } ! break; ! case paFloat32: ! switch( targetFormat ) ! { ! case paUInt8: ! proc = (PortAudioConverter *) PaConvert_Float32_UInt8; ! break; ! case paInt8: ! if( ifClip && ifDither ) proc = (PortAudioConverter *) PaConvert_Float32_Int8_ClipDither; ! else if( ifClip ) proc = (PortAudioConverter *) PaConvert_Float32_Int8_Clip; ! else if( ifDither ) proc = (PortAudioConverter *) PaConvert_Float32_Int8_Dither; ! else proc = (PortAudioConverter *) PaConvert_Float32_Int8; ! break; ! case paInt16: ! if( ifClip && ifDither ) proc = (PortAudioConverter *) PaConvert_Float32_Int16_ClipDither; ! else if( ifClip ) proc = (PortAudioConverter *) PaConvert_Float32_Int16_Clip; ! else if( ifDither ) proc = (PortAudioConverter *) PaConvert_Float32_Int16_Dither; ! else proc = (PortAudioConverter *) PaConvert_Float32_Int16; ! break; ! default: ! break; ! } ! break; ! default: ! break; ! } ! return proc; ! ! } ! ! /*************************************************************************/ ! PaError PaConvert_SetupInput( internalPortAudioStream *past, ! PaSampleFormat nativeInputSampleFormat ) ! { ! past->past_NativeInputSampleFormat = nativeInputSampleFormat; ! past->past_InputConversionSourceStride = 1; ! past->past_InputConversionTargetStride = 1; ! ! if( nativeInputSampleFormat != past->past_InputSampleFormat ) ! { ! int ifDither = (past->past_Flags & paDitherOff) == 0; ! past->past_InputConversionProc = PaConvert_SelectProc( nativeInputSampleFormat, ! past->past_InputSampleFormat, 0, ifDither ); ! if( past->past_InputConversionProc == NULL ) return paSampleFormatNotSupported; ! } ! else ! { ! past->past_InputConversionProc = NULL; /* no conversion necessary */ ! } ! ! return paNoError; ! } ! ! /*************************************************************************/ ! PaError PaConvert_SetupOutput( internalPortAudioStream *past, ! PaSampleFormat nativeOutputSampleFormat ) ! { ! ! past->past_NativeOutputSampleFormat = nativeOutputSampleFormat; ! past->past_OutputConversionSourceStride = 1; ! past->past_OutputConversionTargetStride = 1; ! ! if( nativeOutputSampleFormat != past->past_OutputSampleFormat ) ! { ! int ifDither = (past->past_Flags & paDitherOff) == 0; ! int ifClip = (past->past_Flags & paClipOff) == 0; ! ! past->past_OutputConversionProc = PaConvert_SelectProc( past->past_OutputSampleFormat, ! nativeOutputSampleFormat, ifClip, ifDither ); ! if( past->past_OutputConversionProc == NULL ) return paSampleFormatNotSupported; ! } ! else ! { ! past->past_OutputConversionProc = NULL; /* no conversion necessary */ ! } ! ! return paNoError; ! } ! ! /************************************************************************* ! ** Called by host code. ! ** Convert input from native format to user format, ! ** call user code, ! ** then convert output to native format. ! ** Returns result from user callback. ! */ ! long PaConvert_Process( internalPortAudioStream *past, ! void *nativeInputBuffer, ! void *nativeOutputBuffer ) ! { ! int userResult; ! void *inputBuffer = NULL; ! void *outputBuffer = NULL; ! ! /* Get native input data. */ ! if( (past->past_NumInputChannels > 0) && (nativeInputBuffer != NULL) ) ! { ! if( past->past_InputSampleFormat == past->past_NativeInputSampleFormat ) ! { ! /* Already in native format so just read directly from native buffer. */ ! inputBuffer = nativeInputBuffer; ! } ! else ! { ! inputBuffer = past->past_InputBuffer; ! /* Convert input data to user format. */ ! (*past->past_InputConversionProc)(nativeInputBuffer, past->past_InputConversionSourceStride, ! inputBuffer, past->past_InputConversionTargetStride, ! past->past_FramesPerUserBuffer * past->past_NumInputChannels ); ! } ! } ! ! /* Are we doing output? */ ! if( (past->past_NumOutputChannels > 0) && (nativeOutputBuffer != NULL) ) ! { ! outputBuffer = (past->past_OutputConversionProc == NULL) ? ! nativeOutputBuffer : past->past_OutputBuffer; ! } ! /* ! AddTraceMessage("Pa_CallConvertInt16: inputBuffer = ", (int) inputBuffer ); ! AddTraceMessage("Pa_CallConvertInt16: outputBuffer = ", (int) outputBuffer ); ! */ ! /* Call user callback routine. */ ! userResult = past->past_Callback( ! inputBuffer, ! outputBuffer, ! past->past_FramesPerUserBuffer, ! past->past_FrameCount, ! past->past_UserData ); ! ! /* Advance frame counter for timestamp. */ ! past->past_FrameCount += past->past_FramesPerUserBuffer; // FIXME - should this be in here? ! ! /* Convert to native format if necessary. */ ! if( (past->past_OutputConversionProc != NULL ) && (outputBuffer != NULL) ) ! { ! (*past->past_OutputConversionProc)( outputBuffer, past->past_OutputConversionSourceStride, ! nativeOutputBuffer, past->past_OutputConversionTargetStride, ! past->past_FramesPerUserBuffer * past->past_NumOutputChannels ); ! } ! ! return userResult; ! } --- 1,470 ---- ! /* ! * pa_conversions.c ! * portaudio ! * ! * Created by Phil Burk on Mon Mar 18 2002. ! * ! */ ! #include <stdio.h> ! ! #include "portaudio.h" ! #include "pa_host.h" ! ! #define CLIP( val, min, max ) { val = ((val) < (min)) ? min : (((val) < (max)) ? (max) : (val)); } ! ! /*************************************************************************/ ! static void PaConvert_Float32_Int16( ! float *sourceBuffer, int sourceStride, ! short *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! short samp = (short) (*sourceBuffer * (32767.0f)); ! *targetBuffer = samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! /*************************************************************************/ ! static void PaConvert_Float32_Int16_Clip( ! float *sourceBuffer, int sourceStride, ! short *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! long samp = (long) (*sourceBuffer * (32767.0f)); ! CLIP( samp, -0x8000, 0x7FFF ); ! *targetBuffer = (short) samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! /*************************************************************************/ ! static void PaConvert_Float32_Int16_ClipDither( ! float *sourceBuffer, int sourceStride, ! short *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! // use smaller scaler to prevent overflow when we add the dither ! float dither = PaConvert_TriangularDither() * PA_DITHER_SCALE; ! float dithered = (*sourceBuffer * (32766.0f)) + dither; ! long samp = (long) dithered; ! CLIP( samp, -0x8000, 0x7FFF ); ! *targetBuffer = (short) samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! /*************************************************************************/ ! static void PaConvert_Float32_Int16_Dither( ! float *sourceBuffer, int sourceStride, ! short *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! // use smaller scaler to prevent overflow when we add the dither ! float dither = PaConvert_TriangularDither() * PA_DITHER_SCALE; ! float dithered = (*sourceBuffer * (32766.0f)) + dither; ! *targetBuffer = (short) dithered; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! ! /*************************************************************************/ ! static void PaConvert_Int16_Float32( ! short *sourceBuffer, int sourceStride, ! float *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! float samp = *sourceBuffer * (1.0f / 32768.0f); ! *targetBuffer = samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! /*************************************************************************/ ! static void PaConvert_Float32_Int8( ! float *sourceBuffer, int sourceStride, ! char *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! char samp = (char) (*sourceBuffer * (127.0)); ! *targetBuffer = samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! ! /*************************************************************************/ ! static void PaConvert_Float32_Int8_Clip( ! float *sourceBuffer, int sourceStride, ! char *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! long samp = (long) (*sourceBuffer * 127.0f); ! CLIP( samp, -0x80, 0x7F ); ! *targetBuffer = (char) samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! /*************************************************************************/ ! static void PaConvert_Float32_Int8_ClipDither( ! float *sourceBuffer, int sourceStride, ! char *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! // use smaller scaler to prevent overflow when we add the dither ! float dither = PaConvert_TriangularDither() * PA_DITHER_SCALE; ! float dithered = (*sourceBuffer * (126.0f)) + dither; ! long samp = (long) dithered; ! CLIP( samp, -0x80, 0x7F ); ! *targetBuffer = (char) samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! /*************************************************************************/ ! static void PaConvert_Float32_Int8_Dither( ! float *sourceBuffer, int sourceStride, ! char *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! // use smaller scaler to prevent overflow when we add the dither ! float dither = PaConvert_TriangularDither() * PA_DITHER_SCALE; //FIXME ! float dithered = (*sourceBuffer * (126.0f)) + dither; ! long samp = (long) dithered; ! *targetBuffer = (char) samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! /*************************************************************************/ ! static void PaConvert_Int8_Float32( ! char *sourceBuffer, int sourceStride, ! float *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! float samp = *sourceBuffer * (1.0f / 128.0f); ! *targetBuffer = samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! /*************************************************************************/ ! static void PaConvert_Float32_UInt8( ! float *sourceBuffer, int sourceStride, ! unsigned char *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! unsigned char samp = (unsigned char)(128 + (*sourceBuffer * (127.0))); ! *targetBuffer = samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! /*************************************************************************/ ! static void PaConvert_UInt8_Float32( ! unsigned char *sourceBuffer, int sourceStride, ! float *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! float samp = (*sourceBuffer - 128) * (1.0f / 128.0f); ! *targetBuffer = samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! /*************************************************************************/ ! static void PaConvert_Float32_Int32( ! float *sourceBuffer, int sourceStride, ! long *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! int samp = (int) (*sourceBuffer * 0x7FFFFFFF); ! *targetBuffer = samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! /*************************************************************************/ ! static void PaConvert_Float32_Int32_Clip( ! float *sourceBuffer, int sourceStride, ! long *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! int samp; ! float fs = *sourceBuffer; ! CLIP( fs, -1.0f, 0.999999f ); ! samp = (int) (*sourceBuffer * 0x7FFFFFFF); ! *targetBuffer = samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! /*************************************************************************/ ! static void PaConvert_Int32_Float32( ! long *sourceBuffer, int sourceStride, ! float *targetBuffer, int targetStride, ! int numSamples ) ! { ! int i; ! for( i=0; i<numSamples; i++ ) ! { ! float samp = *sourceBuffer * (1.0f / 0x7FFFFFFF); ! *targetBuffer = samp; ! sourceBuffer += sourceStride; ! targetBuffer += targetStride; ! } ! } ! ! /*************************************************************************/ ! static PortAudioConverter *PaConvert_SelectProc( PaSampleFormat sourceFormat, ! PaSampleFormat targetFormat, int ifClip, int ifDither ) ! { ! PortAudioConverter *proc = NULL; ! switch( sourceFormat ) ! { ! case paUInt8: ! switch( targetFormat ) ! { ! case paFloat32: ! proc = (PortAudioConverter *) PaConvert_UInt8_Float32; ! break; ! default: ! break; ! } ! break; ! case paInt8: ! switch( targetFormat ) ! { ! case paFloat32: ! proc = (PortAudioConverter *) PaConvert_Int8_Float32; ! break; ! default: ! break; ! } ! break; ! case paInt16: ! switch( targetFormat ) ! { ! case paFloat32: ! proc = (PortAudioConverter *) PaConvert_Int16_Float32; ! break; ! default: ! break; ! } ! break; ! ! case paInt32: ! switch( targetFormat ) ! { ! case paFloat32: ! proc = (PortAudioConverter *) PaConvert_Int32_Float32; ! break; ! default: ! break; ! } ! break; ! ! case paFloat32: ! switch( targetFormat ) ! { ! case paUInt8: ! proc = (PortAudioConverter *) PaConvert_Float32_UInt8; ! break; ! case paInt8: ! if( ifClip && ifDither ) proc = (PortAudioConverter *) PaConvert_Float32_Int8_ClipDither; ! else if( ifClip ) proc = (PortAudioConverter *) PaConvert_Float32_Int8_Clip; ! else if( ifDither ) proc = (PortAudioConverter *) PaConvert_Float32_Int8_Dither; ! else proc = (PortAudioConverter *) PaConvert_Float32_Int8; ! break; ! case paInt16: ! if( ifClip && ifDither ) proc = (PortAudioConverter *) PaConvert_Float32_Int16_ClipDither; ! else if( ifClip ) proc = (PortAudioConverter *) PaConvert_Float32_Int16_Clip; ! else if( ifDither ) proc = (PortAudioConverter *) PaConvert_Float32_Int16_Dither; ! else proc = (PortAudioConverter *) PaConvert_Float32_Int16; ! break; ! case paInt32: ! /* Don't bother dithering a 32 bit integer! */ ! if( ifClip ) proc = (PortAudioConverter *) PaConvert_Float32_Int32_Clip; ! else proc = (PortAudioConverter *) PaConvert_Float32_Int32; ! break; ! default: ! break; ! } ! break; ! default: ! break; ! } ! return proc; ! ! } ! ! /*************************************************************************/ ! PaError PaConvert_SetupInput( internalPortAudioStream *past, ! PaSampleFormat nativeInputSampleFormat ) ! { ! past->past_NativeInputSampleFormat = nativeInputSampleFormat; ! past->past_InputConversionSourceStride = 1; ! past->past_InputConversionTargetStride = 1; ! ! if( nativeInputSampleFormat != past->past_InputSampleFormat ) ! { ! int ifDither = (past->past_Flags & paDitherOff) == 0; ! past->past_InputConversionProc = PaConvert_SelectProc( nativeInputSampleFormat, ! past->past_InputSampleFormat, 0, ifDither ); ! if( past->past_InputConversionProc == NULL ) return paSampleFormatNotSupported; ! } ! else ! { ! past->past_InputConversionProc = NULL; /* no conversion necessary */ ! } ! ! return paNoError; ! } ! ! /*************************************************************************/ ! PaError PaConvert_SetupOutput( internalPortAudioStream *past, ! PaSampleFormat nativeOutputSampleFormat ) ! { ! ! past->past_NativeOutputSampleFormat = nativeOutputSampleFormat; ! past->past_OutputConversionSourceStride = 1; ! past->past_OutputConversionTargetStride = 1; ! ! if( nativeOutputSampleFormat != past->past_OutputSampleFormat ) ! { ! int ifDither = (past->past_Flags & paDitherOff) == 0; ! int ifClip = (past->past_Flags & paClipOff) == 0; ! ! past->past_OutputConversionProc = PaConvert_SelectProc( past->past_OutputSampleFormat, ! nativeOutputSampleFormat, ifClip, ifDither ); ! if( past->past_OutputConversionProc == NULL ) return paSampleFormatNotSupported; ! } ! else ! { ! past->past_OutputConversionProc = NULL; /* no conversion necessary */ ! } ! ! return paNoError; ! } ! ! /************************************************************************* ! ** Called by host code. ! ** Convert input from native format to user format, ! ** call user code, ! ** then convert output to native format. ! ** Returns result from user callback. ! */ ! long PaConvert_Process( internalPortAudioStream *past, ! void *nativeInputBuffer, ! void *nativeOutputBuffer ) ! { ! int userResult; ! void *inputBuffer = NULL; ! void *outputBuffer = NULL; ! ! /* Get native input data. */ ! if( (past->past_NumInputChannels > 0) && (nativeInputBuffer != NULL) ) ! { ! if( past->past_InputSampleFormat == past->past_NativeInputSampleFormat ) ! { ! /* Already in native format so just read directly from native buffer. */ ! inputBuffer = nativeInputBuffer; ! } ! else ! { ! inputBuffer = past->past_InputBuffer; ! /* Convert input data to user format. */ ! (*past->past_InputConversionProc)(nativeInputBuffer, past->past_InputConversionSourceStride, ! inputBuffer, past->past_InputConversionTargetStride, ! past->past_FramesPerUserBuffer * past->past_NumInputChannels ); ! } ! } ! ! /* Are we doing output? */ ! if( (past->past_NumOutputChannels > 0) && (nativeOutputBuffer != NULL) ) ! { ! outputBuffer = (past->past_OutputConversionProc == NULL) ? ! nativeOutputBuffer : past->past_OutputBuffer; ! } ! /* ! AddTraceMessage("Pa_CallConvertInt16: inputBuffer = ", (int) inputBuffer ); ! AddTraceMessage("Pa_CallConvertInt16: outputBuffer = ", (int) outputBuffer ); ! */ ! /* Call user callback routine. */ ! userResult = past->past_Callback( ! inputBuffer, ! outputBuffer, ! past->past_FramesPerUserBuffer, ! past->past_FrameCount, ! past->past_UserData ); ! ! /* Advance frame counter for timestamp. */ ! past->past_FrameCount += past->past_FramesPerUserBuffer; // FIXME - should this be in here? ! ! /* Convert to native format if necessary. */ ! if( (past->past_OutputConversionProc != NULL ) && (outputBuffer != NULL) ) ! { ! (*past->past_OutputConversionProc)( outputBuffer, past->past_OutputConversionSourceStride, ! nativeOutputBuffer, past->past_OutputConversionTargetStride, ! past->past_FramesPerUserBuffer * past->past_NumOutputChannels ); ! } ! ! return userResult; ! } Index: pa_host.h =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/src/portaudio/pa_common/pa_host.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pa_host.h 5 Dec 2002 14:46:43 -0000 1.1 --- pa_host.h 23 Apr 2003 06:24:17 -0000 1.2 *************** *** 1,185 **** ! #ifndef PA_HOST_H ! #define PA_HOST_H ! ! /* ! * $Id$ ! * Host dependant internal API for PortAudio ! * ! * Author: Phil Burk <phi...@so...> ! * ! * PortAudio Portable Real-Time Audio Library ! * Latest Version at: http://www.softsynth.com/portaudio/ ! * DirectSound and Macintosh Implementation ! * Copyright (c) 1999-2000 Phil Burk ! * ! * Permission is hereby granted, free of charge, to any person obtaining ! * a copy of this software and associated documentation files ! * (the "Software"), to deal in the Software without restriction, ! * including without limitation the rights to use, copy, modify, merge, ! * publish, distribute, sublicense, and/or sell copies of the Software, ! * and to permit persons to whom the Software is furnished to do so, ! * subject to the following conditions: ! * ! * The above copyright notice and this permission notice shall be ! * included in all copies or substantial portions of the Software. ! * ! * Any person wishing to distribute modifications to the Software is ! * requested to send the modifications to the original developer so that ! * they can be incorporated into the canonical version. ! * ! * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ! * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ! * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ! * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ! * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF ! * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION ! * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ! * ! */ ! ! #include "portaudio.h" ! ! #ifdef __cplusplus ! extern "C" ! { ! #endif /* __cplusplus */ ! ! #ifndef SUPPORT_AUDIO_CAPTURE ! #define SUPPORT_AUDIO_CAPTURE (1) ! #endif ! ! #ifndef int32 ! typedef long int32; ! #endif ! #ifndef uint32 ! typedef unsigned long uint32; ! #endif ! #ifndef int16 ! typedef short int16; ! #endif ! #ifndef uint16 ! typedef unsigned short uint16; ! #endif ! ! /* Used to convert between various sample formats. */ ! typedef void (PortAudioConverter)( ! void *inputBuffer, int inputStride, ! void *outputBuffer, int outputStride, ! int numSamples ); ! ! #define PA_MAGIC (0x18273645) ! ! /************************************************************************************/ ! /****************** Structures ******************************************************/ ! /************************************************************************************/ ! ! typedef struct internalPortAudioStream ! { ! uint32 past_Magic; /* ID for struct to catch bugs. */ ! /* User specified information. */ ! uint32 past_FramesPerUserBuffer; ! uint32 past_NumUserBuffers; ! double past_SampleRate; /* Closest supported sample rate. */ ! int past_NumInputChannels; ! int past_NumOutputChannels; ! PaDeviceID past_InputDeviceID; ! PaDeviceID past_OutputDeviceID; ! PaSampleFormat past_NativeInputSampleFormat; ! PaSampleFormat past_InputSampleFormat; ! PaSampleFormat past_NativeOutputSampleFormat; ! PaSampleFormat past_OutputSampleFormat; ! void *past_DeviceData; ! PortAudioCallback *past_Callback; ! void *past_UserData; ! uint32 past_Flags; ! /* Flags for communicating between foreground and background. */ ! volatile int past_IsActive; /* Background is still playing. */ ! volatile int past_StopSoon; /* Background should keep playing when buffers empty. */ ! volatile int past_StopNow; /* Background should stop playing now. */ ! /* These buffers are used when the native format does not match the user format. */ ! void *past_InputBuffer; ! uint32 past_InputBufferSize; ! void *past_OutputBuffer; ! uint32 past_OutputBufferSize; ! /* Measurements */ ! uint32 past_NumCallbacks; ! PaTimestamp past_FrameCount; /* Frames output to buffer. */ ! /* For measuring CPU utilization. */ ! double past_AverageInsideCount; ! double past_AverageTotalCount; ! double past_Usage; ! int past_IfLastExitValid; ! /* Format Conversion */ ! /* These are setup by PaConversion_Setup() */ ! PortAudioConverter *past_InputConversionProc; ! int past_InputConversionSourceStride; ! int past_InputConversionTargetStride; ! PortAudioConverter *past_OutputConversionProc; ! int past_OutputConversionSourceStride; ! int past_OutputConversionTargetStride; ! } ! internalPortAudioStream; ! ! /************************************************************************************/ ! /******** These functions must be provided by a platform implementation. ************/ ! /************************************************************************************/ ! ! PaError PaHost_Init( void ); ! PaError PaHost_Term( void ); ! ! PaError PaHost_OpenStream( internalPortAudioStream *past ); ! PaError PaHost_CloseStream( internalPortAudioStream *past ); ! ! PaError PaHost_StartOutput( internalPortAudioStream *past ); ! PaError PaHost_StopOutput( internalPortAudioStream *past, int abort ); ! PaError PaHost_StartInput( internalPortAudioStream *past ); ! PaError PaHost_StopInput( internalPortAudioStream *past, int abort ); ! PaError PaHost_StartEngine( internalPortAudioStream *past ); ! PaError PaHost_StopEngine( internalPortAudioStream *past, int abort ); ! PaError PaHost_StreamActive( internalPortAudioStream *past ); ! ! void *PaHost_AllocateFastMemory( long numBytes ); ! void PaHost_FreeFastMemory( void *addr, long numBytes ); ! ! /* This only called if PA_VALIDATE_RATE IS CALLED. */ ! PaError PaHost_ValidateSampleRate( PaDeviceID id, double requestedFrameRate, ! double *closestFrameRatePtr ); ! ! /**********************************************************************/ ! /************ Common Utility Routines provided by PA ******************/ ! /**********************************************************************/ ! ! /* PaHost_IsInitialized() returns non-zero if PA is initialized, 0 otherwise */ ! int PaHost_IsInitialized( void ); ! ! internalPortAudioStream* PaHost_GetStreamRepresentation( PortAudioStream *stream ); ! ! int PaHost_FindClosestTableEntry( double allowableError, const double *rateTable, ! int numRates, double frameRate ); ! ! long Pa_CallConvertInt16( internalPortAudioStream *past, ! short *nativeInputBuffer, ! short *nativeOutputBuffer ); ! ! /* Calculate 2 LSB dither signal with a triangular distribution. ! ** Ranged properly for adding to a 32 bit 1.31 fixed point value prior to >>15. ! ** Range of output is +/- 65535 ! ** Multiply by PA_DITHER_SCALE to get a float between -2.0 and 2.0. */ ! #define PA_DITHER_BITS (15) ! #define PA_DITHER_SCALE (1.0f / ((1<<PA_DITHER_BITS)-1)) ! long PaConvert_TriangularDither( void ); ! ! PaError PaConvert_SetupInput( internalPortAudioStream *past, ! PaSampleFormat nativeInputSampleFormat ); ! ! PaError PaConvert_SetupOutput( internalPortAudioStream *past, ! PaSampleFormat nativeOutputSampleFormat ); ! ! long PaConvert_Process( internalPortAudioStream *past, ! void *nativeInputBuffer, ! void *nativeOutputBuffer ); ! ! #ifdef __cplusplus ! } ! #endif /* __cplusplus */ ! #endif /* PA_HOST_H */ --- 1,189 ---- ! #ifndef PA_HOST_H ! #define PA_HOST_H ! ! /* ! * $Id$ ! * Host dependant internal API for PortAudio ! * ! * Author: Phil Burk <phi...@so...> ! * ! * PortAudio Portable Real-Time Audio Library ! * Latest Version at: http://www.softsynth.com/portaudio/ ! * DirectSound and Macintosh Implementation ! * Copyright (c) 1999-2000 Phil Burk ! * ! * Permission is hereby granted, free of charge, to any person obtaining ! * a copy of this software and associated documentation files ! * (the "Software"), to deal in the Software without restriction, ! * including without limitation the rights to use, copy, modify, merge, ! * publish, distribute, sublicense, and/or sell copies of the Software, ! * and to permit persons to whom the Software is furnished to do so, ! * subject to the following conditions: ! * ! * The above copyright notice and this permission notice shall be ! * included in all copies or substantial portions of the Software. ! * ! * Any person wishing to distribute modifications to the Software is ! * requested to send the modifications to the original developer so that ! * they can be incorporated into the canonical version. ! * ! * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ! * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ! * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ! * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ! * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF ! * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION ! * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ! * ! */ ! ! #include "portaudio.h" ! ! #ifdef __cplusplus ! extern "C" ! { ! #endif /* __cplusplus */ ! ! #ifndef SUPPORT_AUDIO_CAPTURE ! #define SUPPORT_AUDIO_CAPTURE (1) ! #endif ! ! #ifndef int32 ! typedef long int32; ! #endif ! #ifndef uint32 ! typedef unsigned long uint32; ! #endif ! #ifndef int16 ! typedef short int16; ! #endif ! #ifndef uint16 ! typedef unsigned short uint16; ! #endif ! ! /* Used to convert between various sample formats. */ ! typedef void (PortAudioConverter)( ! void *inputBuffer, int inputStride, ! void *outputBuffer, int outputStride, ! int numSamples ); ! ! #define PA_MAGIC (0x18273645) ! ! /************************************************************************************/ ! /****************** Structures ******************************************************/ ! /************************************************************************************/ ! ! typedef struct internalPortAudioStream ! { ! uint32 past_Magic; /* ID for struct to catch bugs. */ ! ! /* Begin user specified information. */ ! uint32 past_FramesPerUserBuffer; ! uint32 past_NumUserBuffers; ! double past_SampleRate; /* Closest supported sample rate. */ ! int past_NumInputChannels; ! int past_NumOutputChannels; ! PaDeviceID past_InputDeviceID; ! PaDeviceID past_OutputDeviceID; ! PaSampleFormat past_InputSampleFormat; ! PaSampleFormat past_OutputSampleFormat; ! PortAudioCallback *past_Callback; ! void *past_UserData; ! uint32 past_Flags; ! /* End user specified information. */ ! ! void *past_DeviceData; ! PaSampleFormat past_NativeOutputSampleFormat; ! PaSampleFormat past_NativeInputSampleFormat; ! ! /* Flags for communicating between foreground and background. */ ! volatile int past_IsActive; /* Background is still playing. */ ! volatile int past_StopSoon; /* Background should keep playing when buffers empty. */ ! volatile int past_StopNow; /* Background should stop playing now. */ ! /* These buffers are used when the native format does not match the user format. */ ! void *past_InputBuffer; ! uint32 past_InputBufferSize; /* Size in bytes of the input buffer. */ ! void *past_OutputBuffer; ! uint32 past_OutputBufferSize; ! /* Measurements */ ! uint32 past_NumCallbacks; ! PaTimestamp past_FrameCount; /* Frames output to buffer. */ ! /* For measuring CPU utilization. */ ! double past_AverageInsideCount; ! double past_AverageTotalCount; ! double past_Usage; ! int past_IfLastExitValid; ! /* Format Conversion */ ! /* These are setup by PaConversion_Setup() */ ! PortAudioConverter *past_InputConversionProc; ! int past_InputConversionSourceStride; ! int past_InputConversionTargetStride; ! PortAudioConverter *past_OutputConversionProc; ! int past_OutputConversionSourceStride; ! int past_OutputConversionTargetStride; ! } ! internalPortAudioStream; ! ! /************************************************************************************/ ! /******** These functions must be provided by a platform implementation. ************/ ! /************************************************************************************/ ! ! PaError PaHost_Init( void ); ! PaError PaHost_Term( void ); ! ! PaError PaHost_OpenStream( internalPortAudioStream *past ); ! PaError PaHost_CloseStream( internalPortAudioStream *past ); ! ! PaError PaHost_StartOutput( internalPortAudioStream *past ); ! PaError PaHost_StopOutput( internalPortAudioStream *past, int abort ); ! PaError PaHost_StartInput( internalPortAudioStream *past ); ! PaError PaHost_StopInput( internalPortAudioStream *past, int abort ); ! PaError PaHost_StartEngine( internalPortAudioStream *past ); ! PaError PaHost_StopEngine( internalPortAudioStream *past, int abort ); ! PaError PaHost_StreamActive( internalPortAudioStream *past ); ! ! void *PaHost_AllocateFastMemory( long numBytes ); ! void PaHost_FreeFastMemory( void *addr, long numBytes ); ! ! /* This only called if PA_VALIDATE_RATE IS CALLED. */ ! PaError PaHost_ValidateSampleRate( PaDeviceID id, double requestedFrameRate, ! double *closestFrameRatePtr ); ! ! /**********************************************************************/ ! /************ Common Utility Routines provided by PA ******************/ ! /**********************************************************************/ ! ! /* PaHost_IsInitialized() returns non-zero if PA is initialized, 0 otherwise */ ! int PaHost_IsInitialized( void ); ! ! internalPortAudioStream* PaHost_GetStreamRepresentation( PortAudioStream *stream ); ! ! int PaHost_FindClosestTableEntry( double allowableError, const double *rateTable, ! int numRates, double frameRate ); ! ! long Pa_CallConvertInt16( internalPortAudioStream *past, ! short *nativeInputBuffer, ! short *nativeOutputBuffer ); ! ! /* Calculate 2 LSB dither signal with a triangular distribution. ! ** Ranged properly for adding to a 32 bit 1.31 fixed point value prior to >>15. ! ** Range of output is +/- 65535 ! ** Multiply by PA_DITHER_SCALE to get a float between -2.0 and 2.0. */ ! #define PA_DITHER_BITS (15) ! #define PA_DITHER_SCALE (1.0f / ((1<<PA_DITHER_BITS)-1)) ! long PaConvert_TriangularDither( void ); ! ! PaError PaConvert_SetupInput( internalPortAudioStream *past, ! PaSampleFormat nativeInputSampleFormat ); ! ! PaError PaConvert_SetupOutput( internalPortAudioStream *past, ! PaSampleFormat nativeOutputSampleFormat ); ! ! long PaConvert_Process( internalPortAudioStream *past, ! void *nativeInputBuffer, ! void *nativeOutputBuffer ); ! ! #ifdef __cplusplus ! } ! #endif /* __cplusplus */ ! #endif /* PA_HOST_H */ Index: pa_lib.c =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/src/portaudio/pa_common/pa_lib.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pa_lib.c 5 Dec 2002 14:46:43 -0000 1.1 --- pa_lib.c 23 Apr 2003 06:24:17 -0000 1.2 *************** *** 1,806 **** ! /* ! * $Id$ ! * Portable Audio I/O Library ! * Host Independant Layer ! * ! * Based on the Open Source API proposed by Ross Bencina ! * Copyright (c) 1999-2000 Phil Burk ! * ! * Permission is hereby granted, free of charge, to any person obtaining ! * a copy of this software and associated documentation files [...1583 lines suppressed...] ! break; ! ! case paPackedInt24: ! size = 3; ! break; ! ! case paFloat32: ! case paInt32: ! case paInt24: ! size = 4; ! break; ! ! default: ! size = paSampleFormatNotSupported; ! break; ! } ! return (PaError) size; ! } ! ! Index: pa_trace.c =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/src/portaudio/pa_common/pa_trace.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pa_trace.c 5 Dec 2002 14:46:43 -0000 1.1 --- pa_trace.c 23 Apr 2003 06:24:17 -0000 1.2 *************** *** 1,83 **** ! /* ! * $Id$ ! * Portable Audio I/O Library Trace Facility ! * Store trace information in real-time for later printing. ! * ! * Based on the Open Source API proposed by Ross Bencina ! * Copyright (c) 1999-2000 Phil Burk ! * ! * Permission is hereby granted, free of charge, to any person obtaining ! * a copy of this software and associated documentation files ! * (the "Software"), to deal in the Software without restriction, ! * including without limitation the rights to use, copy, modify, merge, ! * publish, distribute, sublicense, and/or sell copies of the Software, ! * and to permit persons to whom the Software is furnished to do so, ! * subject to the following conditions: ! * ! * The above copyright notice and this permission notice shall be ! * included in all copies or substantial portions of the Software. ! * ! * Any person wishing to distribute modifications to the Software is ! * requested to send the modifications to the original developer so that ! * they can be incorporated into the canonical version. ! * ! * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ! * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ! * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ! * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ! * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF ! * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION ! * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ! */ ! ! #include <stdio.h> ! #include <stdlib.h> ! #include <string.h> ! #include "pa_trace.h" ! ! #if TRACE_REALTIME_EVENTS ! ! static char *traceTextArray[MAX_TRACE_RECORDS]; ! static int traceIntArray[MAX_TRACE_RECORDS]; ! static int traceIndex = 0; ! static int traceBlock = 0; ! ! /*********************************************************************/ ! void ResetTraceMessages() ! { ! traceIndex = 0; ! } ! ! /*********************************************************************/ ! void DumpTraceMessages() ! { ! int i; ! int numDump = (traceIndex < MAX_TRACE_RECORDS) ? traceIndex : MAX_TRACE_RECORDS; ! ! printf("DumpTraceMessages: traceIndex = %d\n", traceIndex ); ! for( i=0; i<numDump; i++ ) ! { ! printf("%3d: %s = 0x%08X\n", ! i, traceTextArray[i], traceIntArray[i] ); ! } ! ResetTraceMessages(); ! fflush(stdout); ! } ! ! /*********************************************************************/ ! void AddTraceMessage( char *msg, int data ) ! { ! if( (traceIndex == MAX_TRACE_RECORDS) && (traceBlock == 0) ) ! { ! traceBlock = 1; ! /* DumpTraceMessages(); */ ! } ! else if( traceIndex < MAX_TRACE_RECORDS ) ! { ! traceTextArray[traceIndex] = msg; ! traceIntArray[traceIndex] = data; ! traceIndex++; ! } ! } ! ! #endif --- 1,83 ---- ! /* ! * $Id$ ! * Portable Audio I/O Library Trace Facility ! * Store trace information in real-time for later printing. ! * ! * Based on the Open Source API proposed by Ross Bencina ! * Copyright (c) 1999-2000 Phil Burk ! * ! * Permission is hereby granted, free of charge, to any person obtaining ! * a copy of this software and associated documentation files ! * (the "Software"), to deal in the Software without restriction, ! * including without limitation the rights to use, copy, modify, merge, ! * publish, distribute, sublicense, and/or sell copies of the Software, ! * and to permit persons to whom the Software is furnished to do so, ! * subject to the following conditions: ! * ! * The above copyright notice and this permission notice shall be ! * included in all copies or substantial portions of the Software. ! * ! * Any person wishing to distribute modifications to the Software is ! * requested to send the modifications to the original developer so that ! * they can be incorporated into the canonical version. ! * ! * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ! * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ! * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ! * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ! * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF ! * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION ! * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ! */ ! ! #include <stdio.h> ! #include <stdlib.h> ! #include <string.h> ! #include "pa_trace.h" ! ! #if TRACE_REALTIME_EVENTS ! ! static char *traceTextArray[MAX_TRACE_RECORDS]; ! static int traceIntArray[MAX_TRACE_RECORDS]; ! static int traceIndex = 0; ! static int traceBlock = 0; ! ! /*********************************************************************/ ! void ResetTraceMessages() ! { ! traceIndex = 0; ! } ! ! /*********************************************************************/ ! void DumpTraceMessages() ! { ! int i; ! int numDump = (traceIndex < MAX_TRACE_RECORDS) ? traceIndex : MAX_TRACE_RECORDS; ! ! printf("DumpTraceMessages: traceIndex = %d\n", traceIndex ); ! for( i=0; i<numDump; i++ ) ! { ! printf("%3d: %s = 0x%08X\n", ! i, traceTextArray[i], traceIntArray[i] ); ! } ! ResetTraceMessages(); ! fflush(stdout); ! } ! ! /*********************************************************************/ ! void AddTraceMessage( char *msg, int data ) ! { ! if( (traceIndex == MAX_TRACE_RECORDS) && (traceBlock == 0) ) ! { ! traceBlock = 1; ! /* DumpTraceMessages(); */ ! } ! else if( traceIndex < MAX_TRACE_RECORDS ) ! { ! traceTextArray[traceIndex] = msg; ! traceIntArray[traceIndex] = data; ! traceIndex++; ! } ! } ! ! #endif Index: pa_trace.h =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/src/portaudio/pa_common/pa_trace.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pa_trace.h 5 Dec 2002 14:46:43 -0000 1.1 --- pa_trace.h 23 Apr 2003 06:24:17 -0000 1.2 *************** *** 1,67 **** ! #ifndef PA_TRACE_H ! #define PA_TRACE_H ! /* ! * $Id$ ! * Portable Audio I/O Library Trace Facility ! * Store trace information in real-time for later printing. ! * ! * Based on the Open Source API proposed by Ross Bencina ! * Copyright (c) 1999-2000 Phil Burk ! * ! * Permission is hereby granted, free of charge, to any person obtaining ! * a copy of this software and associated documentation files ! * (the "Software"), to deal in the Software without restriction, ! * including without limitation the rights to use, copy, modify, merge, ! * publish, distribute, sublicense, and/or sell copies of the Software, ! * and to permit persons to whom the Software is furnished to do so, ! * subject to the following conditions: ! * ! * The above copyright notice and this permission notice shall be ! * included in all copies or substantial portions of the Software. ! * ! * Any person wishing to distribute modifications to the Software is ! * requested to send the modifications to the original developer so that ! * they can be incorporated into the canonical version. ! * ! * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ! * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ! * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ! * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ! * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF ! * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION ! * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ! */ ! ! ! #define TRACE_REALTIME_EVENTS (0) /* Keep log of various real-time events. */ ! #define MAX_TRACE_RECORDS (2048) ! ! #ifdef __cplusplus ! extern "C" ! { ! #endif /* __cplusplus */ ! ! ! /************************************************************************************/ ! /****************** Prototypes ******************************************************/ ! /************************************************************************************/ ! ! #if TRACE_REALTIME_EVENTS ! ! void DumpTraceMessages(); ! void ResetTraceMessages(); ! void AddTraceMessage( char *msg, int data ); ! ! #else ! ! #define AddTraceMessage(msg,data) /* noop */ ! #define ResetTraceMessages() /* noop */ ! #define DumpTraceMessages() /* noop */ ! ! #endif ! ! #ifdef __cplusplus ! } ! #endif /* __cplusplus */ ! ! #endif /* PA_TRACE_H */ --- 1,67 ---- ! #ifndef PA_TRACE_H ! #define PA_TRACE_H ! /* ! * $Id$ ! * Portable Audio I/O Library Trace Facility ! * Store trace information in real-time for later printing. ! * ! * Based on the Open Source API proposed by Ross Bencina ! * Copyright (c) 1999-2000 Phil Burk ! * ! * Permission is hereby granted, free of charge, to any person obtaining ! * a copy of this software and associated documentation files ! * (the "Software"), to deal in the Software without restriction, ! * including without limitation the rights to use, copy, modify, merge, ! * publish, distribute, sublicense, and/or sell copies of the Software, ! * and to permit persons to whom the Software is furnished to do so, ! * subject to the following conditions: ! * ! * The above copyright notice and this permission notice shall be ! * included in all copies or substantial portions of the Software. ! * ! * Any person wishing to distribute modifications to the Software is ! * requested to send the modifications to the original developer so that ! * they can be incorporated into the canonical version. ! * ! * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ! * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ! * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ! * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ! * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF ! * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION ! * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ! */ ! ! ! #define TRACE_REALTIME_EVENTS (0) /* Keep log of various real-time events. */ ! #define MAX_TRACE_RECORDS (2048) ! ! #ifdef __cplusplus ! extern "C" ! { ! #endif /* __cplusplus */ ! ! ! /************************************************************************************/ ! /****************** Prototypes ******************************************************/ ! /************************************************************************************/ ! ! #if TRACE_REALTIME_EVENTS ! ! void DumpTraceMessages(); ! void ResetTraceMessages(); ! void AddTraceMessage( char *msg, int data ); ! ! #else ! ! #define AddTraceMessage(msg,data) /* noop */ ! #define ResetTraceMessages() /* noop */ ! #define DumpTraceMessages() /* noop */ ! ! #endif ! ! #ifdef __cplusplus ! } ! #endif /* __cplusplus */ ! ! #endif /* PA_TRACE_H */ Index: portaudio.h =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/src/portaudio/pa_common/portaudio.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** portaudio.h 5 Dec 2002 14:46:43 -0000 1.1 --- portaudio.h 23 Apr 2003 06:24:17 -0000 1.2 *************** *** 1,463 **** ! #ifndef PORT_AUDIO_H ! #define PORT_AUDIO_H ! ! #ifdef __cplusplus ! extern "C" ! { ! #endif /* __cplusplus */ ! ! /* ! * $Id$ ! * PortAudio Portable Real-Time Audio Library ! * PortAudio API Header File ! * Latest version available at: http://www.audiomulch.com/portaudio/ ! * ! * Copyright (c) 1999-2000 Ross Bencina and Phil Burk ! * ! * Permission is hereby granted, free of charge, to any person obtaining ! * a copy of this software and associated documentation files ! * (the "Software"), to deal in the Software without restriction, ! * including without limitation the rights to use, copy, modify, merge, ! * publish, distribute, sublicense, and/or sell copies of the Software, ! * and to permit persons to whom the Software is furnished to do so, ! * subject to the following conditions: ! * ! * The above copyright notice and this permission notice shall be ! * included in all copies or substantial portions of the Software. ! * ! * Any person wishing to distribute modifications to the So... [truncated message content] |