-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swinsian Support #25
Comments
Thanks and interesting. I will have a look into it.
… Im trying to add Swinsian support but I'm having issues getting it
done. I used the Doppler.h and repurposed everything to Swinsian,
changed the ApplicationIDHandle in AppDelegate, but no luck so far.
Swinsian has a scriptable variable called sound volume, same as
iTunes.
--
Reply to this email directly or view it on GitHub:
#25
You are receiving this because you are subscribed to this thread.
Message ID: ***@***.***>
|
I figured a bit more out: Volume Control recognizes swinisian because an error occurs when I actually want to change volume but this only happens if swinisian is actually playing a track. So I guess volume control finds Swinsian at the correct "com.swinsian.Swinsian" handle. This is the code for swinisian.h
#import <AppKit/AppKit.h> @Class SwinsianTrack, SwinsianApplication; enum SwinsianEPlS { /*
// playable track
// The application program @Property (copy, readonly) SwinsianTrack *currentTrack; // the currently playing track
And here is the code for the appdelegate: #import "AppDelegate.h" #import <IOKit/hidsystem/ev_keymap.h> #import "OSD.h" //This will handle signals for us, specifically SIGTERM. #pragma mark - Tapping key stroke events //static void displayPreferencesChanged(CGDirectDisplayID displayID, CGDisplayChangeSummaryFlags flags, void *userInfo) { CGEventRef event_tap_callback(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void *refcon)
} #pragma mark - Class extension for status menu @interface AppDelegate ()
} #pragma mark - Extention music applications @implementation PlayerApplication @synthesize currentVolume = _currentVolume;
-(id)initWithBundleIdentifier:(NSString*) bundleIdentifier {
} #pragma mark - Implementation AppDelegate @implementation AppDelegate // @synthesize AppleRemoteConnected=_AppleRemoteConnected; @synthesize iTunesBtn = _iTunesBtn; @synthesize iTunesPerc = _iTunesPerc; @synthesize sparkle_updater = _sparkle_updater; @synthesize statusMenu = _statusMenu; static NSTimeInterval volumeRampTimeInterval=0.01f;
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101000 // MAC_OS_X_VERSION_10_10
}
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101000 // MAC_OS_X_VERSION_10_10
}
-(void) sendMediaKey: (int)key {
}
-(void)awakeFromNib -(void)completeInitialization
}
}
}
} -(void)resetEventTap
}
#pragma mark - Hide From Status Bar
#pragma mark - Music players
#pragma mark - NSMenuDelegate
I really just changed any Doppler related line to Swinisian. Not as it should be done but i dont need Doppler. |
Any updates on this? Still trying to get this to work. |
I will eventually give it a try. I am sorry, I cannot promise when.
Possibly by the end of July.
I hope you will understand.
… Any updates on this? Still trying to get this to work.
--
Reply to this email directly or view it on GitHub:
#25 (comment)
You are receiving this because you commented.
Message ID: ***@***.***>
|
Ofc, I am trying to fix it myself but I am not really a programmer. Changing the volume exits with error code. Seems to be something about memory. This only happens when swinsian is actually playing back music. So the good thing: I managed that volume control recognizes swinsian. However it seems to break inside the function in appdelegate.m
where using applescript to check Swinsians functions it seems soundVolume is defined as: sound volume (number) : the volume. (0 minimum, 100 maximum) whereas applescript says about Music: sound volume (integer) : the sound output volume (0 = minimum, 100 = maximum) So I dont know if the invoked apple script is causing this problem or simply because the soundVolume property is hardcoded to be of type NSInteger. Eventually I'll find out, but maybe you can hint me. UPDATE: |
I fixed it :) I'll refactor the code and eventually upload it or send it to you so you can include my code to inlcude swinsian functionality. Just tell me how I can beam it to you :) |
Did you test first a simple Applescript to show that you can control the
volume?
Unfortunately I would have to look more in detail. Did you try to pass
it to chatgpt? Clearly the code was written pre-chat-gpt. But it can
really help you.
… Ofc, I am trying to fix it myself but I am not really a programmer.
Changing the volume exits with error code. Seems to be something about
memory. This only happens when swinsian is actually playing back
music. So the good thing: I managed that volume control recognizes
swinsian.
However it seems to break inside the function in appdelegate.m
- (double) currentVolume
where
double vol2 = [musicPlayer soundVolume];
tries to get the @Property of Swinsian.h called soundVolume.
However since i just replaced the Doppler keywords with Swinsian,
@Property NSInteger soundVolume; is still defined as NSInteger and I
am thinking that Swinsian may not be returning a different type then
NSInteger.
using applescript to check Swinsians functions it seems soundVolume is
defined as:
sound volume (number) : the volume. (0 minimum, 100 maximum)
whereas applescript says about Music:
sound volume (integer) : the sound output volume (0 = minimum, 100 =
maximum)
So I dont know if the invoked apple script is causing this problem or
simply because the soundVolume property is hardcoded to be of type
NSInteger.
Eventually I'll find out, but maybe you can hint me.
--
Reply to this email directly or view it on GitHub:
#25 (comment)
You are receiving this because you commented.
Message ID: ***@***.***>
|
Sounds great. Congratulations!
Yes, in principle you can open a pull request on git. If it is too
complicated, just post the code.
… I fixed it :)
I'll refactor the code and eventually upload it or send it to you so
you can include my code to inlcude swinsian functionality. Just tell
me how I can beam it to you :)
--
Reply to this email directly or view it on GitHub:
#25 (comment)
You are receiving this because you commented.
Message ID: ***@***.***>
|
Another update: as mentioned I addes Swinsian support, however while doing that I broke Music and probably iTunes support. Swinsian.h:
#import <AppKit/AppKit.h> @Class SwinsianTrack, SwinsianApplication; enum SwinsianEPlS { /*
// playable track
// The application program @Property (copy, readonly) SwinsianTrack *currentTrack; // the currently playing track
@EnD Inside AppDelegate.m, i essentially added a Swinsian statement after every Doppler statment. Just copy and paste and change "doppler" to "swinsian". However as Swinsian returns NSNumber, I changed all the properties for soundVolume of iTunes.h Spotify.h and Doppler.h to be of type NSNumber. And I modified these two functions in AppDelegate.m
It works when swinsian is running and playing music but this line: Possible solutions might be either to get this type distinction working or to check which app actually is playing atm inside the currentVolume function. Or revert the Properties to type NSInteger and use some fancy bitwise operations to extract the float or int values. I dont know. |
Im trying to add Swinsian support but I'm having issues getting it done. I used the Doppler.h and repurposed everything to Swinsian, changed the ApplicationIDHandle in AppDelegate, but no luck so far. Swinsian has a scriptable variable called sound volume, same as iTunes.
The text was updated successfully, but these errors were encountered: